Skip to content

Commit 4ad359d

Browse files
committed
chore: regen api client
1 parent db108c0 commit 4ad359d

19 files changed

Lines changed: 197 additions & 163 deletions

src/lib/api/internal/v1/client.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { createClientConfig } from '../runtime-config.ts';
44

5-
import { type ClientOptions, type Config, createClient, createConfig } from './client';
5+
import { type Client, type ClientOptions, type Config, createClient, createConfig } from './client';
66
import type { ClientOptions as ClientOptions2 } from './types.gen';
77

88
/**
@@ -15,4 +15,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
1515
*/
1616
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
1717

18-
export const client = createClient(createClientConfig(createConfig<ClientOptions2>({ baseUrl: 'https://api.openshock.app', throwOnError: true })));
18+
export const client: Client = createClient(createClientConfig(createConfig<ClientOptions2>({ baseUrl: 'https://api.openshock.app', throwOnError: true })));

src/lib/api/internal/v1/client/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export {
99
} from '../core/bodySerializer.gen';
1010
export { buildClientParams } from '../core/params.gen';
1111
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
12+
export type { ServerSentEventsResult } from '../core/serverSentEvents.gen';
13+
export type { ClientMeta } from '../core/types.gen';
1214
export { createClient } from './client.gen';
1315
export type {
1416
Client,

src/lib/api/internal/v1/client/utils.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'
1414
export const createQuerySerializer = <T = unknown>({
1515
parameters = {},
1616
...args
17-
}: QuerySerializerOptions = {}) => {
18-
const querySerializer = (queryParams: T) => {
17+
}: QuerySerializerOptions = {}): ((queryParams: T) => string) => {
18+
const querySerializer = (queryParams: T): string => {
1919
const search: string[] = [];
2020
if (queryParams && typeof queryParams === 'object') {
2121
for (const name in queryParams) {

src/lib/api/internal/v1/core/auth.gen.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export interface Auth {
99
* @default 'header'
1010
*/
1111
in?: 'header' | 'query' | 'cookie';
12+
/**
13+
* A unique identifier for the security scheme.
14+
*
15+
* Defined only when there are multiple security schemes whose `Auth`
16+
* shape would otherwise be identical.
17+
*/
18+
key?: string;
1219
/**
1320
* Header or query parameter name.
1421
*

src/lib/api/internal/v1/core/params.gen.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type KeyMap = Map<
6262
}
6363
>;
6464

65-
const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
65+
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
6666
if (!map) {
6767
map = new Map();
6868
}
@@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
8585
}
8686

8787
return map;
88-
};
88+
}
8989

9090
interface Params {
9191
body: unknown;
@@ -94,16 +94,18 @@ interface Params {
9494
query: Record<string, unknown>;
9595
}
9696

97-
const stripEmptySlots = (params: Params) => {
97+
type ParamsSlotMap = Record<Slot, unknown>;
98+
99+
function stripEmptySlots(params: ParamsSlotMap): void {
98100
for (const [slot, value] of Object.entries(params)) {
99101
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
100102
delete params[slot as Slot];
101103
}
102104
}
103-
};
105+
}
104106

105-
export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
106-
const params: Params = {
107+
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
108+
const params: ParamsSlotMap = {
107109
body: Object.create(null),
108110
headers: Object.create(null),
109111
path: Object.create(null),
@@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
165167

166168
stripEmptySlots(params);
167169

168-
return params;
169-
};
170+
return params as Params;
171+
}

src/lib/api/internal/v1/core/pathSerializer.gen.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
2525
value: string;
2626
}
2727

28-
export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
28+
export const separatorArrayExplode = (style: ArraySeparatorStyle): '.' | ';' | ',' | '&' => {
2929
switch (style) {
3030
case 'label':
3131
return '.';
@@ -38,7 +38,7 @@ export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
3838
}
3939
};
4040

41-
export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
41+
export const separatorArrayNoExplode = (style: ArraySeparatorStyle): ',' | '|' | '%20' => {
4242
switch (style) {
4343
case 'form':
4444
return ',';
@@ -51,7 +51,7 @@ export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
5151
}
5252
};
5353

54-
export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
54+
export const separatorObjectExplode = (style: ObjectSeparatorStyle): '.' | ';' | ',' | '&' => {
5555
switch (style) {
5656
case 'label':
5757
return '.';
@@ -72,7 +72,7 @@ export const serializeArrayParam = ({
7272
value,
7373
}: SerializeOptions<ArraySeparatorStyle> & {
7474
value: unknown[];
75-
}) => {
75+
}): string => {
7676
if (!explode) {
7777
const joinedValues = (
7878
allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
@@ -110,7 +110,7 @@ export const serializePrimitiveParam = ({
110110
allowReserved,
111111
name,
112112
value,
113-
}: SerializePrimitiveParam) => {
113+
}: SerializePrimitiveParam): string => {
114114
if (value === undefined || value === null) {
115115
return '';
116116
}
@@ -134,7 +134,7 @@ export const serializeObjectParam = ({
134134
}: SerializeOptions<ObjectSeparatorStyle> & {
135135
value: Record<string, unknown> | Date;
136136
valueOnly?: boolean;
137-
}) => {
137+
}): string => {
138138
if (value instanceof Date) {
139139
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
140140
}

src/lib/api/internal/v1/core/queryKeySerializer.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type JsonValue =
1414
/**
1515
* Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
1616
*/
17-
export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
17+
export const queryKeyJsonReplacer = (_key: string, value: unknown): unknown | undefined => {
1818
if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
1919
return undefined;
2020
}

src/lib/api/internal/v1/core/types.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ export interface Config {
9191
responseValidator?: (data: unknown) => Promise<unknown>;
9292
}
9393

94+
/**
95+
* Arbitrary metadata passed through the `meta` request option.
96+
*/
97+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
98+
export interface ClientMeta {}
99+
94100
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
95101
? true
96102
: [T] extends [never | undefined]

src/lib/api/internal/v1/core/utils.gen.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export interface PathSerializer {
1313
url: string;
1414
}
1515

16-
export const PATH_PARAM_RE = /\{[^{}]+\}/g;
16+
export const PATH_PARAM_RE: RegExp = /\{[^{}]+\}/g;
1717

18-
export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
18+
export const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {
1919
let url = _url;
2020
const matches = _url.match(PATH_PARAM_RE);
2121
if (matches) {
@@ -94,7 +94,7 @@ export const getUrl = ({
9494
query?: Record<string, unknown>;
9595
querySerializer: QuerySerializer;
9696
url: string;
97-
}) => {
97+
}): string => {
9898
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
9999
let url = (baseUrl ?? '') + pathUrl;
100100
if (path) {
@@ -114,7 +114,7 @@ export function getValidRequestBody(options: {
114114
body?: unknown;
115115
bodySerializer?: BodySerializer | null;
116116
serializedBody?: unknown;
117-
}) {
117+
}): unknown {
118118
const hasBody = options.body !== undefined;
119119
const isSerializedBody = hasBody && options.bodySerializer;
120120

0 commit comments

Comments
 (0)