From 55d894c6f33b58375a5675292b48edfc873b04cb Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Tue, 13 Jan 2026 07:50:53 +0100 Subject: [PATCH] chore: gen api client --- .../api-client/@tanstack/react-query.gen.ts | 470 ++++-------------- app/client/api-client/client.gen.ts | 11 +- app/client/api-client/client/index.ts | 6 +- app/client/api-client/client/types.gen.ts | 68 +-- app/client/api-client/client/utils.gen.ts | 76 +-- app/client/api-client/core/auth.gen.ts | 3 +- .../api-client/core/bodySerializer.gen.ts | 30 +- app/client/api-client/core/params.gen.ts | 13 +- .../api-client/core/pathSerializer.gen.ts | 30 +- .../api-client/core/queryKeySerializer.gen.ts | 39 +- .../api-client/core/serverSentEvents.gen.ts | 45 +- app/client/api-client/core/types.gen.ts | 44 +- app/client/api-client/core/utils.gen.ts | 12 +- app/client/api-client/sdk.gen.ts | 422 ++++++---------- openapi-ts.config.ts | 2 +- 15 files changed, 325 insertions(+), 946 deletions(-) diff --git a/app/client/api-client/@tanstack/react-query.gen.ts b/app/client/api-client/@tanstack/react-query.gen.ts index 8f40258f..342f4a36 100644 --- a/app/client/api-client/@tanstack/react-query.gen.ts +++ b/app/client/api-client/@tanstack/react-query.gen.ts @@ -1,10 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { - type DefaultError, - queryOptions, - type UseMutationOptions, -} from "@tanstack/react-query"; +import { type DefaultError, queryOptions, type UseMutationOptions } from "@tanstack/react-query"; import { client } from "../client.gen"; import { @@ -179,8 +175,7 @@ const createQueryKey = ( ): [QueryKey[0]] => { const params: QueryKey[0] = { _id: id, - baseUrl: - options?.baseUrl || (options?.client ?? client).getConfig().baseUrl, + baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl, } as QueryKey[0]; if (infinite) { params._infinite = infinite; @@ -203,19 +198,13 @@ const createQueryKey = ( return [params]; }; -export const getStatusQueryKey = (options?: Options) => - createQueryKey("getStatus", options); +export const getStatusQueryKey = (options?: Options) => createQueryKey("getStatus", options); /** * Get authentication system status */ export const getStatusOptions = (options?: Options) => - queryOptions< - GetStatusResponse, - DefaultError, - GetStatusResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getStatus({ ...options, @@ -228,19 +217,13 @@ export const getStatusOptions = (options?: Options) => queryKey: getStatusQueryKey(options), }); -export const listVolumesQueryKey = (options?: Options) => - createQueryKey("listVolumes", options); +export const listVolumesQueryKey = (options?: Options) => createQueryKey("listVolumes", options); /** * List all volumes */ export const listVolumesOptions = (options?: Options) => - queryOptions< - ListVolumesResponse, - DefaultError, - ListVolumesResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await listVolumes({ ...options, @@ -258,16 +241,8 @@ export const listVolumesOptions = (options?: Options) => */ export const createVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - CreateVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await createVolume({ ...options, @@ -285,16 +260,8 @@ export const createVolumeMutation = ( */ export const testConnectionMutation = ( options?: Partial>, -): UseMutationOptions< - TestConnectionResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - TestConnectionResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await testConnection({ ...options, @@ -312,16 +279,8 @@ export const testConnectionMutation = ( */ export const deleteVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - DeleteVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await deleteVolume({ ...options, @@ -334,19 +293,13 @@ export const deleteVolumeMutation = ( return mutationOptions; }; -export const getVolumeQueryKey = (options: Options) => - createQueryKey("getVolume", options); +export const getVolumeQueryKey = (options: Options) => createQueryKey("getVolume", options); /** * Get a volume by name */ export const getVolumeOptions = (options: Options) => - queryOptions< - GetVolumeResponse, - DefaultError, - GetVolumeResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getVolume({ ...options, @@ -364,16 +317,8 @@ export const getVolumeOptions = (options: Options) => */ export const updateVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - UpdateVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await updateVolume({ ...options, @@ -391,16 +336,8 @@ export const updateVolumeMutation = ( */ export const mountVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - MountVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - MountVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await mountVolume({ ...options, @@ -418,16 +355,8 @@ export const mountVolumeMutation = ( */ export const unmountVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - UnmountVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UnmountVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await unmountVolume({ ...options, @@ -445,16 +374,8 @@ export const unmountVolumeMutation = ( */ export const healthCheckVolumeMutation = ( options?: Partial>, -): UseMutationOptions< - HealthCheckVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - HealthCheckVolumeResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await healthCheckVolume({ ...options, @@ -467,19 +388,13 @@ export const healthCheckVolumeMutation = ( return mutationOptions; }; -export const listFilesQueryKey = (options: Options) => - createQueryKey("listFiles", options); +export const listFilesQueryKey = (options: Options) => createQueryKey("listFiles", options); /** * List files in a volume directory */ export const listFilesOptions = (options: Options) => - queryOptions< - ListFilesResponse, - DefaultError, - ListFilesResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await listFiles({ ...options, @@ -492,16 +407,13 @@ export const listFilesOptions = (options: Options) => queryKey: listFilesQueryKey(options), }); -export const browseFilesystemQueryKey = ( - options?: Options, -) => createQueryKey("browseFilesystem", options); +export const browseFilesystemQueryKey = (options?: Options) => + createQueryKey("browseFilesystem", options); /** * Browse directories on the host filesystem */ -export const browseFilesystemOptions = ( - options?: Options, -) => +export const browseFilesystemOptions = (options?: Options) => queryOptions< BrowseFilesystemResponse, DefaultError, @@ -520,16 +432,13 @@ export const browseFilesystemOptions = ( queryKey: browseFilesystemQueryKey(options), }); -export const listRepositoriesQueryKey = ( - options?: Options, -) => createQueryKey("listRepositories", options); +export const listRepositoriesQueryKey = (options?: Options) => + createQueryKey("listRepositories", options); /** * List all repositories */ -export const listRepositoriesOptions = ( - options?: Options, -) => +export const listRepositoriesOptions = (options?: Options) => queryOptions< ListRepositoriesResponse, DefaultError, @@ -553,16 +462,8 @@ export const listRepositoriesOptions = ( */ export const createRepositoryMutation = ( options?: Partial>, -): UseMutationOptions< - CreateRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateRepositoryResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await createRepository({ ...options, @@ -575,16 +476,13 @@ export const createRepositoryMutation = ( return mutationOptions; }; -export const listRcloneRemotesQueryKey = ( - options?: Options, -) => createQueryKey("listRcloneRemotes", options); +export const listRcloneRemotesQueryKey = (options?: Options) => + createQueryKey("listRcloneRemotes", options); /** * List all configured rclone remotes on the host system */ -export const listRcloneRemotesOptions = ( - options?: Options, -) => +export const listRcloneRemotesOptions = (options?: Options) => queryOptions< ListRcloneRemotesResponse, DefaultError, @@ -608,16 +506,8 @@ export const listRcloneRemotesOptions = ( */ export const deleteRepositoryMutation = ( options?: Partial>, -): UseMutationOptions< - DeleteRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteRepositoryResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await deleteRepository({ ...options, @@ -630,19 +520,13 @@ export const deleteRepositoryMutation = ( return mutationOptions; }; -export const getRepositoryQueryKey = (options: Options) => - createQueryKey("getRepository", options); +export const getRepositoryQueryKey = (options: Options) => createQueryKey("getRepository", options); /** * Get a single repository by ID */ export const getRepositoryOptions = (options: Options) => - queryOptions< - GetRepositoryResponse, - DefaultError, - GetRepositoryResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getRepository({ ...options, @@ -660,16 +544,8 @@ export const getRepositoryOptions = (options: Options) => */ export const updateRepositoryMutation = ( options?: Partial>, -): UseMutationOptions< - UpdateRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateRepositoryResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await updateRepository({ ...options, @@ -687,16 +563,8 @@ export const updateRepositoryMutation = ( */ export const deleteSnapshotsMutation = ( options?: Partial>, -): UseMutationOptions< - DeleteSnapshotsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteSnapshotsResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await deleteSnapshots({ ...options, @@ -709,19 +577,13 @@ export const deleteSnapshotsMutation = ( return mutationOptions; }; -export const listSnapshotsQueryKey = (options: Options) => - createQueryKey("listSnapshots", options); +export const listSnapshotsQueryKey = (options: Options) => createQueryKey("listSnapshots", options); /** * List all snapshots in a repository */ export const listSnapshotsOptions = (options: Options) => - queryOptions< - ListSnapshotsResponse, - DefaultError, - ListSnapshotsResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await listSnapshots({ ...options, @@ -739,16 +601,8 @@ export const listSnapshotsOptions = (options: Options) => */ export const deleteSnapshotMutation = ( options?: Partial>, -): UseMutationOptions< - DeleteSnapshotResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteSnapshotResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await deleteSnapshot({ ...options, @@ -761,16 +615,13 @@ export const deleteSnapshotMutation = ( return mutationOptions; }; -export const getSnapshotDetailsQueryKey = ( - options: Options, -) => createQueryKey("getSnapshotDetails", options); +export const getSnapshotDetailsQueryKey = (options: Options) => + createQueryKey("getSnapshotDetails", options); /** * Get details of a specific snapshot */ -export const getSnapshotDetailsOptions = ( - options: Options, -) => +export const getSnapshotDetailsOptions = (options: Options) => queryOptions< GetSnapshotDetailsResponse, DefaultError, @@ -789,16 +640,13 @@ export const getSnapshotDetailsOptions = ( queryKey: getSnapshotDetailsQueryKey(options), }); -export const listSnapshotFilesQueryKey = ( - options: Options, -) => createQueryKey("listSnapshotFiles", options); +export const listSnapshotFilesQueryKey = (options: Options) => + createQueryKey("listSnapshotFiles", options); /** * List files and directories in a snapshot */ -export const listSnapshotFilesOptions = ( - options: Options, -) => +export const listSnapshotFilesOptions = (options: Options) => queryOptions< ListSnapshotFilesResponse, DefaultError, @@ -822,16 +670,8 @@ export const listSnapshotFilesOptions = ( */ export const restoreSnapshotMutation = ( options?: Partial>, -): UseMutationOptions< - RestoreSnapshotResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RestoreSnapshotResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await restoreSnapshot({ ...options, @@ -849,16 +689,8 @@ export const restoreSnapshotMutation = ( */ export const doctorRepositoryMutation = ( options?: Partial>, -): UseMutationOptions< - DoctorRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DoctorRepositoryResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await doctorRepository({ ...options, @@ -876,16 +708,8 @@ export const doctorRepositoryMutation = ( */ export const tagSnapshotsMutation = ( options?: Partial>, -): UseMutationOptions< - TagSnapshotsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - TagSnapshotsResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await tagSnapshots({ ...options, @@ -898,16 +722,13 @@ export const tagSnapshotsMutation = ( return mutationOptions; }; -export const listBackupSchedulesQueryKey = ( - options?: Options, -) => createQueryKey("listBackupSchedules", options); +export const listBackupSchedulesQueryKey = (options?: Options) => + createQueryKey("listBackupSchedules", options); /** * List all backup schedules */ -export const listBackupSchedulesOptions = ( - options?: Options, -) => +export const listBackupSchedulesOptions = (options?: Options) => queryOptions< ListBackupSchedulesResponse, DefaultError, @@ -931,11 +752,7 @@ export const listBackupSchedulesOptions = ( */ export const createBackupScheduleMutation = ( options?: Partial>, -): UseMutationOptions< - CreateBackupScheduleResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< CreateBackupScheduleResponse, DefaultError, @@ -958,11 +775,7 @@ export const createBackupScheduleMutation = ( */ export const deleteBackupScheduleMutation = ( options?: Partial>, -): UseMutationOptions< - DeleteBackupScheduleResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< DeleteBackupScheduleResponse, DefaultError, @@ -980,16 +793,13 @@ export const deleteBackupScheduleMutation = ( return mutationOptions; }; -export const getBackupScheduleQueryKey = ( - options: Options, -) => createQueryKey("getBackupSchedule", options); +export const getBackupScheduleQueryKey = (options: Options) => + createQueryKey("getBackupSchedule", options); /** * Get a backup schedule by ID */ -export const getBackupScheduleOptions = ( - options: Options, -) => +export const getBackupScheduleOptions = (options: Options) => queryOptions< GetBackupScheduleResponse, DefaultError, @@ -1013,11 +823,7 @@ export const getBackupScheduleOptions = ( */ export const updateBackupScheduleMutation = ( options?: Partial>, -): UseMutationOptions< - UpdateBackupScheduleResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< UpdateBackupScheduleResponse, DefaultError, @@ -1035,16 +841,13 @@ export const updateBackupScheduleMutation = ( return mutationOptions; }; -export const getBackupScheduleForVolumeQueryKey = ( - options: Options, -) => createQueryKey("getBackupScheduleForVolume", options); +export const getBackupScheduleForVolumeQueryKey = (options: Options) => + createQueryKey("getBackupScheduleForVolume", options); /** * Get a backup schedule for a specific volume */ -export const getBackupScheduleForVolumeOptions = ( - options: Options, -) => +export const getBackupScheduleForVolumeOptions = (options: Options) => queryOptions< GetBackupScheduleForVolumeResponse, DefaultError, @@ -1068,16 +871,8 @@ export const getBackupScheduleForVolumeOptions = ( */ export const runBackupNowMutation = ( options?: Partial>, -): UseMutationOptions< - RunBackupNowResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RunBackupNowResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await runBackupNow({ ...options, @@ -1095,16 +890,8 @@ export const runBackupNowMutation = ( */ export const stopBackupMutation = ( options?: Partial>, -): UseMutationOptions< - StopBackupResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - StopBackupResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await stopBackup({ ...options, @@ -1122,16 +909,8 @@ export const stopBackupMutation = ( */ export const runForgetMutation = ( options?: Partial>, -): UseMutationOptions< - RunForgetResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RunForgetResponse, - DefaultError, - Options - > = { +): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { mutationFn: async (fnOptions) => { const { data } = await runForget({ ...options, @@ -1144,16 +923,13 @@ export const runForgetMutation = ( return mutationOptions; }; -export const getScheduleNotificationsQueryKey = ( - options: Options, -) => createQueryKey("getScheduleNotifications", options); +export const getScheduleNotificationsQueryKey = (options: Options) => + createQueryKey("getScheduleNotifications", options); /** * Get notification assignments for a backup schedule */ -export const getScheduleNotificationsOptions = ( - options: Options, -) => +export const getScheduleNotificationsOptions = (options: Options) => queryOptions< GetScheduleNotificationsResponse, DefaultError, @@ -1177,11 +953,7 @@ export const getScheduleNotificationsOptions = ( */ export const updateScheduleNotificationsMutation = ( options?: Partial>, -): UseMutationOptions< - UpdateScheduleNotificationsResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< UpdateScheduleNotificationsResponse, DefaultError, @@ -1199,16 +971,13 @@ export const updateScheduleNotificationsMutation = ( return mutationOptions; }; -export const getScheduleMirrorsQueryKey = ( - options: Options, -) => createQueryKey("getScheduleMirrors", options); +export const getScheduleMirrorsQueryKey = (options: Options) => + createQueryKey("getScheduleMirrors", options); /** * Get mirror repository assignments for a backup schedule */ -export const getScheduleMirrorsOptions = ( - options: Options, -) => +export const getScheduleMirrorsOptions = (options: Options) => queryOptions< GetScheduleMirrorsResponse, DefaultError, @@ -1232,11 +1001,7 @@ export const getScheduleMirrorsOptions = ( */ export const updateScheduleMirrorsMutation = ( options?: Partial>, -): UseMutationOptions< - UpdateScheduleMirrorsResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< UpdateScheduleMirrorsResponse, DefaultError, @@ -1254,16 +1019,13 @@ export const updateScheduleMirrorsMutation = ( return mutationOptions; }; -export const getMirrorCompatibilityQueryKey = ( - options: Options, -) => createQueryKey("getMirrorCompatibility", options); +export const getMirrorCompatibilityQueryKey = (options: Options) => + createQueryKey("getMirrorCompatibility", options); /** * Get mirror compatibility info for all repositories relative to a backup schedule's primary repository */ -export const getMirrorCompatibilityOptions = ( - options: Options, -) => +export const getMirrorCompatibilityOptions = (options: Options) => queryOptions< GetMirrorCompatibilityResponse, DefaultError, @@ -1287,11 +1049,7 @@ export const getMirrorCompatibilityOptions = ( */ export const reorderBackupSchedulesMutation = ( options?: Partial>, -): UseMutationOptions< - ReorderBackupSchedulesResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< ReorderBackupSchedulesResponse, DefaultError, @@ -1309,16 +1067,13 @@ export const reorderBackupSchedulesMutation = ( return mutationOptions; }; -export const listNotificationDestinationsQueryKey = ( - options?: Options, -) => createQueryKey("listNotificationDestinations", options); +export const listNotificationDestinationsQueryKey = (options?: Options) => + createQueryKey("listNotificationDestinations", options); /** * List all notification destinations */ -export const listNotificationDestinationsOptions = ( - options?: Options, -) => +export const listNotificationDestinationsOptions = (options?: Options) => queryOptions< ListNotificationDestinationsResponse, DefaultError, @@ -1391,16 +1146,13 @@ export const deleteNotificationDestinationMutation = ( return mutationOptions; }; -export const getNotificationDestinationQueryKey = ( - options: Options, -) => createQueryKey("getNotificationDestination", options); +export const getNotificationDestinationQueryKey = (options: Options) => + createQueryKey("getNotificationDestination", options); /** * Get a notification destination by ID */ -export const getNotificationDestinationOptions = ( - options: Options, -) => +export const getNotificationDestinationOptions = (options: Options) => queryOptions< GetNotificationDestinationResponse, DefaultError, @@ -1451,11 +1203,7 @@ export const updateNotificationDestinationMutation = ( */ export const testNotificationDestinationMutation = ( options?: Partial>, -): UseMutationOptions< - TestNotificationDestinationResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< TestNotificationDestinationResponse, DefaultError, @@ -1473,19 +1221,13 @@ export const testNotificationDestinationMutation = ( return mutationOptions; }; -export const getSystemInfoQueryKey = (options?: Options) => - createQueryKey("getSystemInfo", options); +export const getSystemInfoQueryKey = (options?: Options) => createQueryKey("getSystemInfo", options); /** * Get system information including available capabilities */ export const getSystemInfoOptions = (options?: Options) => - queryOptions< - GetSystemInfoResponse, - DefaultError, - GetSystemInfoResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getSystemInfo({ ...options, @@ -1498,19 +1240,13 @@ export const getSystemInfoOptions = (options?: Options) => queryKey: getSystemInfoQueryKey(options), }); -export const getUpdatesQueryKey = (options?: Options) => - createQueryKey("getUpdates", options); +export const getUpdatesQueryKey = (options?: Options) => createQueryKey("getUpdates", options); /** * Check for application updates from GitHub */ export const getUpdatesOptions = (options?: Options) => - queryOptions< - GetUpdatesResponse, - DefaultError, - GetUpdatesResponse, - ReturnType - >({ + queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getUpdates({ ...options, @@ -1528,11 +1264,7 @@ export const getUpdatesOptions = (options?: Options) => */ export const downloadResticPasswordMutation = ( options?: Partial>, -): UseMutationOptions< - DownloadResticPasswordResponse, - DefaultError, - Options -> => { +): UseMutationOptions> => { const mutationOptions: UseMutationOptions< DownloadResticPasswordResponse, DefaultError, diff --git a/app/client/api-client/client.gen.ts b/app/client/api-client/client.gen.ts index 92f3451a..301c95c0 100644 --- a/app/client/api-client/client.gen.ts +++ b/app/client/api-client/client.gen.ts @@ -1,11 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { - type ClientOptions, - type Config, - createClient, - createConfig, -} from "./client"; +import { type ClientOptions, type Config, createClient, createConfig } from "./client"; import type { ClientOptions as ClientOptions2 } from "./types.gen"; /** @@ -20,6 +15,4 @@ export type CreateClientConfig = ( override?: Config, ) => Config & T>; -export const client = createClient( - createConfig({ baseUrl: "http://localhost:4096" }), -); +export const client = createClient(createConfig({ baseUrl: "http://localhost:4096" })); diff --git a/app/client/api-client/client/index.ts b/app/client/api-client/client/index.ts index 99ab72d0..88229e0a 100644 --- a/app/client/api-client/client/index.ts +++ b/app/client/api-client/client/index.ts @@ -2,11 +2,7 @@ export type { Auth } from "../core/auth.gen"; export type { QuerySerializerOptions } from "../core/bodySerializer.gen"; -export { - formDataBodySerializer, - jsonBodySerializer, - urlSearchParamsBodySerializer, -} from "../core/bodySerializer.gen"; +export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer.gen"; export { buildClientParams } from "../core/params.gen"; export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen"; export { createClient } from "./client.gen"; diff --git a/app/client/api-client/client/types.gen.ts b/app/client/api-client/client/types.gen.ts index 68310f36..b5495c11 100644 --- a/app/client/api-client/client/types.gen.ts +++ b/app/client/api-client/client/types.gen.ts @@ -1,21 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts import type { Auth } from "../core/auth.gen"; -import type { - ServerSentEventsOptions, - ServerSentEventsResult, -} from "../core/serverSentEvents.gen"; -import type { - Client as CoreClient, - Config as CoreConfig, -} from "../core/types.gen"; +import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen"; +import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen"; import type { Middleware } from "./utils.gen"; export type ResponseStyle = "data" | "fields"; export interface Config - extends Omit, - CoreConfig { + extends Omit, CoreConfig { /** * Base URL for all requests made by this client. */ @@ -42,14 +35,7 @@ export interface Config * * @default 'auto' */ - parseAs?: - | "arrayBuffer" - | "auto" - | "blob" - | "formData" - | "json" - | "stream" - | "text"; + parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text"; /** * Should we return only data or multiple fields (data, error, response, etc.)? * @@ -69,17 +55,15 @@ export interface RequestOptions< TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string, -> extends Config<{ +> + extends + Config<{ responseStyle: TResponseStyle; throwOnError: ThrowOnError; }>, Pick< ServerSentEventsOptions, - | "onSseError" - | "onSseEvent" - | "sseDefaultRetryDelay" - | "sseMaxRetryAttempts" - | "sseMaxRetryDelay" + "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay" > { /** * Any body that you want to add to your request. @@ -116,32 +100,22 @@ export type RequestResult< ? TData[keyof TData] : TData : { - data: TData extends Record - ? TData[keyof TData] - : TData; + data: TData extends Record ? TData[keyof TData] : TData; request: Request; response: Response; } > : Promise< TResponseStyle extends "data" - ? - | (TData extends Record - ? TData[keyof TData] - : TData) - | undefined + ? (TData extends Record ? TData[keyof TData] : TData) | undefined : ( | { - data: TData extends Record - ? TData[keyof TData] - : TData; + data: TData extends Record ? TData[keyof TData] : TData; error: undefined; } | { data: undefined; - error: TError extends Record - ? TError[keyof TError] - : TError; + error: TError extends Record ? TError[keyof TError] : TError; } ) & { request: Request; @@ -180,10 +154,7 @@ type RequestFn = < TResponseStyle extends ResponseStyle = "fields", >( options: Omit, "method"> & - Pick< - Required>, - "method" - >, + Pick>, "method">, ) => RequestResult; type BuildUrlFn = < @@ -197,13 +168,7 @@ type BuildUrlFn = < options: TData & Options, ) => string; -export type Client = CoreClient< - RequestFn, - Config, - MethodFn, - BuildUrlFn, - SseFn -> & { +export type Client = CoreClient & { interceptors: Middleware; }; @@ -234,8 +199,5 @@ export type Options< ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = "fields", -> = OmitKeys< - RequestOptions, - "body" | "path" | "query" | "url" -> & +> = OmitKeys, "body" | "path" | "query" | "url"> & ([TData] extends [never] ? unknown : Omit); diff --git a/app/client/api-client/client/utils.gen.ts b/app/client/api-client/client/utils.gen.ts index 82b63a89..fb460443 100644 --- a/app/client/api-client/client/utils.gen.ts +++ b/app/client/api-client/client/utils.gen.ts @@ -3,23 +3,11 @@ import { getAuthToken } from "../core/auth.gen"; import type { QuerySerializerOptions } from "../core/bodySerializer.gen"; import { jsonBodySerializer } from "../core/bodySerializer.gen"; -import { - serializeArrayParam, - serializeObjectParam, - serializePrimitiveParam, -} from "../core/pathSerializer.gen"; +import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.gen"; import { getUrl } from "../core/utils.gen"; -import type { - Client, - ClientOptions, - Config, - RequestOptions, -} from "./types.gen"; +import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen"; -export const createQuerySerializer = ({ - parameters = {}, - ...args -}: QuerySerializerOptions = {}) => { +export const createQuerySerializer = ({ parameters = {}, ...args }: QuerySerializerOptions = {}) => { const querySerializer = (queryParams: T) => { const search: string[] = []; if (queryParams && typeof queryParams === "object") { @@ -70,9 +58,7 @@ export const createQuerySerializer = ({ /** * Infers parseAs value from provided Content-Type header. */ -export const getParseAs = ( - contentType: string | null, -): Exclude => { +export const getParseAs = (contentType: string | null): Exclude => { if (!contentType) { // If no Content-Type header is provided, the best we can do is return the raw response body, // which is effectively the same as the 'stream' option. @@ -85,10 +71,7 @@ export const getParseAs = ( return; } - if ( - cleanContent.startsWith("application/json") || - cleanContent.endsWith("+json") - ) { + if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) { return "json"; } @@ -96,11 +79,7 @@ export const getParseAs = ( return "formData"; } - if ( - ["application/", "audio/", "image/", "video/"].some((type) => - cleanContent.startsWith(type), - ) - ) { + if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) { return "blob"; } @@ -120,11 +99,7 @@ const checkForExistence = ( if (!name) { return false; } - if ( - options.headers.has(name) || - options.query?.[name] || - options.headers.get("Cookie")?.includes(`${name}=`) - ) { + if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) { return true; } return false; @@ -197,19 +172,14 @@ const headersEntries = (headers: Headers): Array<[string, string]> => { return entries; }; -export const mergeHeaders = ( - ...headers: Array["headers"] | undefined> -): Headers => { +export const mergeHeaders = (...headers: Array["headers"] | undefined>): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { if (!header) { continue; } - const iterator = - header instanceof Headers - ? headersEntries(header) - : Object.entries(header); + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { @@ -221,10 +191,7 @@ export const mergeHeaders = ( } else if (value !== undefined) { // assume object headers are meant to be JSON stringified, i.e. their // content value in OpenAPI specification is 'application/json' - mergedHeaders.set( - key, - typeof value === "object" ? JSON.stringify(value) : (value as string), - ); + mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : (value as string)); } } } @@ -238,16 +205,9 @@ type ErrInterceptor = ( options: Options, ) => Err | Promise; -type ReqInterceptor = ( - request: Req, - options: Options, -) => Req | Promise; +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; -type ResInterceptor = ( - response: Res, - request: Req, - options: Options, -) => Res | Promise; +type ResInterceptor = (response: Res, request: Req, options: Options) => Res | Promise; class Interceptors { fns: Array = []; @@ -275,10 +235,7 @@ class Interceptors { return this.fns.indexOf(id); } - update( - id: number | Interceptor, - fn: Interceptor, - ): number | Interceptor | false { + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { const index = this.getInterceptorIndex(id); if (this.fns[index]) { this.fns[index] = fn; @@ -299,12 +256,7 @@ export interface Middleware { response: Interceptors>; } -export const createInterceptors = (): Middleware< - Req, - Res, - Err, - Options -> => ({ +export const createInterceptors = (): Middleware => ({ error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), diff --git a/app/client/api-client/core/auth.gen.ts b/app/client/api-client/core/auth.gen.ts index 48eb5109..9d804052 100644 --- a/app/client/api-client/core/auth.gen.ts +++ b/app/client/api-client/core/auth.gen.ts @@ -23,8 +23,7 @@ export const getAuthToken = async ( auth: Auth, callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, ): Promise => { - const token = - typeof callback === "function" ? await callback(auth) : callback; + const token = typeof callback === "function" ? await callback(auth) : callback; if (!token) { return; diff --git a/app/client/api-client/core/bodySerializer.gen.ts b/app/client/api-client/core/bodySerializer.gen.ts index 80771d70..10e7b3a6 100644 --- a/app/client/api-client/core/bodySerializer.gen.ts +++ b/app/client/api-client/core/bodySerializer.gen.ts @@ -1,10 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { - ArrayStyle, - ObjectStyle, - SerializerOptions, -} from "./pathSerializer.gen"; +import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen"; export type QuerySerializer = (query: Record) => string; @@ -24,11 +20,7 @@ export type QuerySerializerOptions = QuerySerializerOptionsObject & { parameters?: Record; }; -const serializeFormDataPair = ( - data: FormData, - key: string, - value: unknown, -): void => { +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { if (typeof value === "string" || value instanceof Blob) { data.append(key, value); } else if (value instanceof Date) { @@ -38,11 +30,7 @@ const serializeFormDataPair = ( } }; -const serializeUrlSearchParamsPair = ( - data: URLSearchParams, - key: string, - value: unknown, -): void => { +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { if (typeof value === "string") { data.append(key, value); } else { @@ -51,9 +39,7 @@ const serializeUrlSearchParamsPair = ( }; export const formDataBodySerializer = { - bodySerializer: | Array>>( - body: T, - ): FormData => { + bodySerializer: | Array>>(body: T): FormData => { const data = new FormData(); Object.entries(body).forEach(([key, value]) => { @@ -73,15 +59,11 @@ export const formDataBodySerializer = { export const jsonBodySerializer = { bodySerializer: (body: T): string => - JSON.stringify(body, (_key, value) => - typeof value === "bigint" ? value.toString() : value, - ), + JSON.stringify(body, (_key, value) => (typeof value === "bigint" ? value.toString() : value)), }; export const urlSearchParamsBodySerializer = { - bodySerializer: | Array>>( - body: T, - ): string => { + bodySerializer: | Array>>(body: T): string => { const data = new URLSearchParams(); Object.entries(body).forEach(([key, value]) => { diff --git a/app/client/api-client/core/params.gen.ts b/app/client/api-client/core/params.gen.ts index 8cfe5a59..c1fb15c5 100644 --- a/app/client/api-client/core/params.gen.ts +++ b/app/client/api-client/core/params.gen.ts @@ -102,10 +102,7 @@ const stripEmptySlots = (params: Params) => { } }; -export const buildClientParams = ( - args: ReadonlyArray, - fields: FieldsConfig, -) => { +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { const params: Params = { body: {}, headers: {}, @@ -148,15 +145,11 @@ export const buildClientParams = ( params[field.map] = value; } } else { - const extra = extraPrefixes.find(([prefix]) => - key.startsWith(prefix), - ); + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); if (extra) { const [prefix, slot] = extra; - (params[slot] as Record)[ - key.slice(prefix.length) - ] = value; + (params[slot] as Record)[key.slice(prefix.length)] = value; } else if ("allowExtra" in config && config.allowExtra) { for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { diff --git a/app/client/api-client/core/pathSerializer.gen.ts b/app/client/api-client/core/pathSerializer.gen.ts index 2fe930d9..9e3cccde 100644 --- a/app/client/api-client/core/pathSerializer.gen.ts +++ b/app/client/api-client/core/pathSerializer.gen.ts @@ -1,8 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -interface SerializeOptions - extends SerializePrimitiveOptions, - SerializerOptions {} +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} interface SerializePrimitiveOptions { allowReserved?: boolean; @@ -76,9 +74,9 @@ export const serializeArrayParam = ({ value: unknown[]; }) => { if (!explode) { - const joinedValues = ( - allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) - ).join(separatorArrayNoExplode(style)); + const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join( + separatorArrayNoExplode(style), + ); switch (style) { case "label": return `.${joinedValues}`; @@ -105,16 +103,10 @@ export const serializeArrayParam = ({ }); }) .join(separator); - return style === "label" || style === "matrix" - ? separator + joinedValues - : joinedValues; + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; }; -export const serializePrimitiveParam = ({ - allowReserved, - name, - value, -}: SerializePrimitiveParam) => { +export const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => { if (value === undefined || value === null) { return ""; } @@ -146,11 +138,7 @@ export const serializeObjectParam = ({ if (style !== "deepObject" && !explode) { let values: string[] = []; Object.entries(value).forEach(([key, v]) => { - values = [ - ...values, - key, - allowReserved ? (v as string) : encodeURIComponent(v as string), - ]; + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; }); const joinedValues = values.join(","); switch (style) { @@ -175,7 +163,5 @@ export const serializeObjectParam = ({ }), ) .join(separator); - return style === "label" || style === "matrix" - ? separator + joinedValues - : joinedValues; + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; }; diff --git a/app/client/api-client/core/queryKeySerializer.gen.ts b/app/client/api-client/core/queryKeySerializer.gen.ts index 2e8e7aab..b3e87676 100644 --- a/app/client/api-client/core/queryKeySerializer.gen.ts +++ b/app/client/api-client/core/queryKeySerializer.gen.ts @@ -3,23 +3,13 @@ /** * JSON-friendly union that mirrors what Pinia Colada can hash. */ -export type JsonValue = - | null - | string - | number - | boolean - | JsonValue[] - | { [key: string]: JsonValue }; +export type JsonValue = null | string | number | boolean | JsonValue[] | { [key: string]: JsonValue }; /** * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. */ export const queryKeyJsonReplacer = (_key: string, value: unknown) => { - if ( - value === undefined || - typeof value === "function" || - typeof value === "symbol" - ) { + if (value === undefined || typeof value === "function" || typeof value === "symbol") { return undefined; } if (typeof value === "bigint") { @@ -61,9 +51,7 @@ const isPlainObject = (value: unknown): value is Record => { * Turns URLSearchParams into a sorted JSON object for deterministic keys. */ const serializeSearchParams = (params: URLSearchParams): JsonValue => { - const entries = Array.from(params.entries()).sort(([a], [b]) => - a.localeCompare(b), - ); + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); const result: Record = {}; for (const [key, value] of entries) { @@ -86,26 +74,16 @@ const serializeSearchParams = (params: URLSearchParams): JsonValue => { /** * Normalizes any accepted value into a JSON-friendly shape for query keys. */ -export const serializeQueryKeyValue = ( - value: unknown, -): JsonValue | undefined => { +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { if (value === null) { return null; } - if ( - typeof value === "string" || - typeof value === "number" || - typeof value === "boolean" - ) { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { return value; } - if ( - value === undefined || - typeof value === "function" || - typeof value === "symbol" - ) { + if (value === undefined || typeof value === "function" || typeof value === "symbol") { return undefined; } @@ -121,10 +99,7 @@ export const serializeQueryKeyValue = ( return stringifyToJsonValue(value); } - if ( - typeof URLSearchParams !== "undefined" && - value instanceof URLSearchParams - ) { + if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) { return serializeSearchParams(value); } diff --git a/app/client/api-client/core/serverSentEvents.gen.ts b/app/client/api-client/core/serverSentEvents.gen.ts index 8dfe6a5c..479546e8 100644 --- a/app/client/api-client/core/serverSentEvents.gen.ts +++ b/app/client/api-client/core/serverSentEvents.gen.ts @@ -2,10 +2,7 @@ import type { Config } from "./types.gen"; -export type ServerSentEventsOptions = Omit< - RequestInit, - "method" -> & +export type ServerSentEventsOptions = Omit & Pick & { /** * Fetch API implementation. You can use this option to provide a custom @@ -74,16 +71,8 @@ export interface StreamEvent { retry?: number; } -export type ServerSentEventsResult< - TData = unknown, - TReturn = void, - TNext = unknown, -> = { - stream: AsyncGenerator< - TData extends Record ? TData[keyof TData] : TData, - TReturn, - TNext - >; +export type ServerSentEventsResult = { + stream: AsyncGenerator ? TData[keyof TData] : TData, TReturn, TNext>; }; export const createSseClient = ({ @@ -101,9 +90,7 @@ export const createSseClient = ({ }: ServerSentEventsOptions): ServerSentEventsResult => { let lastEventId: string | undefined; - const sleep = - sseSleepFn ?? - ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); const createStream = async function* () { let retryDelay: number = sseDefaultRetryDelay ?? 3000; @@ -141,16 +128,11 @@ export const createSseClient = ({ const _fetch = options.fetch ?? globalThis.fetch; const response = await _fetch(request); - if (!response.ok) - throw new Error( - `SSE failed: ${response.status} ${response.statusText}`, - ); + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); if (!response.body) throw new Error("No body in SSE response"); - const reader = response.body - .pipeThrough(new TextDecoderStream()) - .getReader(); + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); let buffer = ""; @@ -188,10 +170,7 @@ export const createSseClient = ({ } else if (line.startsWith("id:")) { lastEventId = line.replace(/^id:\s*/, ""); } else if (line.startsWith("retry:")) { - const parsed = Number.parseInt( - line.replace(/^retry:\s*/, ""), - 10, - ); + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10); if (!Number.isNaN(parsed)) { retryDelay = parsed; } @@ -243,18 +222,12 @@ export const createSseClient = ({ // connection failed or aborted; retry after delay onSseError?.(error); - if ( - sseMaxRetryAttempts !== undefined && - attempt >= sseMaxRetryAttempts - ) { + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { break; // stop after firing error } // exponential backoff: double retry each attempt, cap at 30s - const backoff = Math.min( - retryDelay * 2 ** (attempt - 1), - sseMaxRetryDelay ?? 30000, - ); + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); await sleep(backoff); } } diff --git a/app/client/api-client/core/types.gen.ts b/app/client/api-client/core/types.gen.ts index 8db8c934..62252e53 100644 --- a/app/client/api-client/core/types.gen.ts +++ b/app/client/api-client/core/types.gen.ts @@ -1,30 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts import type { Auth, AuthToken } from "./auth.gen"; -import type { - BodySerializer, - QuerySerializer, - QuerySerializerOptions, -} from "./bodySerializer.gen"; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen"; -export type HttpMethod = - | "connect" - | "delete" - | "get" - | "head" - | "options" - | "patch" - | "post" - | "put" - | "trace"; +export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"; -export type Client< - RequestFn = never, - Config = unknown, - MethodFn = never, - BuildUrlFn = never, - SseFn = never, -> = { +export type Client = { /** * Returns the final request URL. */ @@ -34,9 +15,7 @@ export type Client< setConfig: (config: Config) => Config; } & { [K in HttpMethod]: MethodFn; -} & ([SseFn] extends [never] - ? { sse?: never } - : { sse: { [K in HttpMethod]: SseFn } }); +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); export interface Config { /** @@ -57,16 +36,7 @@ export interface Config { */ headers?: | RequestInit["headers"] - | Record< - string, - | string - | number - | boolean - | (string | number | boolean)[] - | null - | undefined - | unknown - >; + | Record; /** * The request method. * @@ -112,7 +82,5 @@ type IsExactlyNeverOrNeverUndefined = [T] extends [never] : false; export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; }; diff --git a/app/client/api-client/core/utils.gen.ts b/app/client/api-client/core/utils.gen.ts index 999c4a36..7e48839f 100644 --- a/app/client/api-client/core/utils.gen.ts +++ b/app/client/api-client/core/utils.gen.ts @@ -44,10 +44,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { } if (Array.isArray(value)) { - url = url.replace( - match, - serializeArrayParam({ explode, name, style, value }), - ); + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); continue; } @@ -76,9 +73,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - const replaceValue = encodeURIComponent( - style === "label" ? `.${value as string}` : (value as string), - ); + const replaceValue = encodeURIComponent(style === "label" ? `.${value as string}` : (value as string)); url = url.replace(match, replaceValue); } } @@ -123,8 +118,7 @@ export function getValidRequestBody(options: { if (isSerializedBody) { if ("serializedBody" in options) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ""; + const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== ""; return hasSerializedBody ? options.serializedBody : null; } diff --git a/app/client/api-client/sdk.gen.ts b/app/client/api-client/sdk.gen.ts index 5d28a09c..835080bd 100644 --- a/app/client/api-client/sdk.gen.ts +++ b/app/client/api-client/sdk.gen.ts @@ -114,10 +114,10 @@ import type { UpdateVolumeResponses, } from "./types.gen"; -export type Options< - TData extends TDataShape = TDataShape, - ThrowOnError extends boolean = boolean, -> = Options2 & { +export type Options = Options2< + TData, + ThrowOnError +> & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -134,9 +134,7 @@ export type Options< /** * Get authentication system status */ -export const getStatus = ( - options?: Options, -) => +export const getStatus = (options?: Options) => (options?.client ?? client).get({ url: "/api/v1/auth/status", ...options, @@ -145,25 +143,14 @@ export const getStatus = ( /** * List all volumes */ -export const listVolumes = ( - options?: Options, -) => - (options?.client ?? client).get({ - url: "/api/v1/volumes", - ...options, - }); +export const listVolumes = (options?: Options) => + (options?.client ?? client).get({ url: "/api/v1/volumes", ...options }); /** * Create a new volume */ -export const createVolume = ( - options?: Options, -) => - (options?.client ?? client).post< - CreateVolumeResponses, - unknown, - ThrowOnError - >({ +export const createVolume = (options?: Options) => + (options?.client ?? client).post({ url: "/api/v1/volumes", ...options, headers: { @@ -178,11 +165,7 @@ export const createVolume = ( export const testConnection = ( options?: Options, ) => - (options?.client ?? client).post< - TestConnectionResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/volumes/test-connection", ...options, headers: { @@ -194,38 +177,26 @@ export const testConnection = ( /** * Delete a volume */ -export const deleteVolume = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/{name}", ...options }); +export const deleteVolume = (options: Options) => + (options.client ?? client).delete({ + url: "/api/v1/volumes/{name}", + ...options, + }); /** * Get a volume by name */ -export const getVolume = ( - options: Options, -) => - (options.client ?? client).get< - GetVolumeResponses, - GetVolumeErrors, - ThrowOnError - >({ url: "/api/v1/volumes/{name}", ...options }); +export const getVolume = (options: Options) => + (options.client ?? client).get({ + url: "/api/v1/volumes/{name}", + ...options, + }); /** * Update a volume's configuration */ -export const updateVolume = ( - options: Options, -) => - (options.client ?? client).put< - UpdateVolumeResponses, - UpdateVolumeErrors, - ThrowOnError - >({ +export const updateVolume = (options: Options) => + (options.client ?? client).put({ url: "/api/v1/volumes/{name}", ...options, headers: { @@ -237,9 +208,7 @@ export const updateVolume = ( /** * Mount a volume */ -export const mountVolume = ( - options: Options, -) => +export const mountVolume = (options: Options) => (options.client ?? client).post({ url: "/api/v1/volumes/{name}/mount", ...options, @@ -251,11 +220,10 @@ export const mountVolume = ( export const unmountVolume = ( options: Options, ) => - (options.client ?? client).post< - UnmountVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/{name}/unmount", ...options }); + (options.client ?? client).post({ + url: "/api/v1/volumes/{name}/unmount", + ...options, + }); /** * Perform a health check on a volume @@ -263,18 +231,15 @@ export const unmountVolume = ( export const healthCheckVolume = ( options: Options, ) => - (options.client ?? client).post< - HealthCheckVolumeResponses, - HealthCheckVolumeErrors, - ThrowOnError - >({ url: "/api/v1/volumes/{name}/health-check", ...options }); + (options.client ?? client).post({ + url: "/api/v1/volumes/{name}/health-check", + ...options, + }); /** * List files in a volume directory */ -export const listFiles = ( - options: Options, -) => +export const listFiles = (options: Options) => (options.client ?? client).get({ url: "/api/v1/volumes/{name}/files", ...options, @@ -286,11 +251,10 @@ export const listFiles = ( export const browseFilesystem = ( options?: Options, ) => - (options?.client ?? client).get< - BrowseFilesystemResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/filesystem/browse", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/volumes/filesystem/browse", + ...options, + }); /** * List all repositories @@ -298,11 +262,10 @@ export const browseFilesystem = ( export const listRepositories = ( options?: Options, ) => - (options?.client ?? client).get< - ListRepositoriesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/repositories", + ...options, + }); /** * Create a new restic repository @@ -310,11 +273,7 @@ export const listRepositories = ( export const createRepository = ( options?: Options, ) => - (options?.client ?? client).post< - CreateRepositoryResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/repositories", ...options, headers: { @@ -329,11 +288,10 @@ export const createRepository = ( export const listRcloneRemotes = ( options?: Options, ) => - (options?.client ?? client).get< - ListRcloneRemotesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/rclone-remotes", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/repositories/rclone-remotes", + ...options, + }); /** * Delete a repository @@ -341,11 +299,10 @@ export const listRcloneRemotes = ( export const deleteRepository = ( options: Options, ) => - (options.client ?? client).delete< - DeleteRepositoryResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}", ...options }); + (options.client ?? client).delete({ + url: "/api/v1/repositories/{id}", + ...options, + }); /** * Get a single repository by ID @@ -353,9 +310,10 @@ export const deleteRepository = ( export const getRepository = ( options: Options, ) => - (options.client ?? client).get( - { url: "/api/v1/repositories/{id}", ...options }, - ); + (options.client ?? client).get({ + url: "/api/v1/repositories/{id}", + ...options, + }); /** * Update a repository's name or settings @@ -363,11 +321,7 @@ export const getRepository = ( export const updateRepository = ( options: Options, ) => - (options.client ?? client).patch< - UpdateRepositoryResponses, - UpdateRepositoryErrors, - ThrowOnError - >({ + (options.client ?? client).patch({ url: "/api/v1/repositories/{id}", ...options, headers: { @@ -382,11 +336,7 @@ export const updateRepository = ( export const deleteSnapshots = ( options: Options, ) => - (options.client ?? client).delete< - DeleteSnapshotsResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).delete({ url: "/api/v1/repositories/{id}/snapshots", ...options, headers: { @@ -401,9 +351,10 @@ export const deleteSnapshots = ( export const listSnapshots = ( options: Options, ) => - (options.client ?? client).get( - { url: "/api/v1/repositories/{id}/snapshots", ...options }, - ); + (options.client ?? client).get({ + url: "/api/v1/repositories/{id}/snapshots", + ...options, + }); /** * Delete a specific snapshot from a repository @@ -411,11 +362,10 @@ export const listSnapshots = ( export const deleteSnapshot = ( options: Options, ) => - (options.client ?? client).delete< - DeleteSnapshotResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options }); + (options.client ?? client).delete({ + url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", + ...options, + }); /** * Get details of a specific snapshot @@ -423,11 +373,10 @@ export const deleteSnapshot = ( export const getSnapshotDetails = ( options: Options, ) => - (options.client ?? client).get< - GetSnapshotDetailsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options }); + (options.client ?? client).get({ + url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", + ...options, + }); /** * List files and directories in a snapshot @@ -435,11 +384,7 @@ export const getSnapshotDetails = ( export const listSnapshotFiles = ( options: Options, ) => - (options.client ?? client).get< - ListSnapshotFilesResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).get({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}/files", ...options, }); @@ -450,11 +395,7 @@ export const listSnapshotFiles = ( export const restoreSnapshot = ( options: Options, ) => - (options.client ?? client).post< - RestoreSnapshotResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).post({ url: "/api/v1/repositories/{id}/restore", ...options, headers: { @@ -469,28 +410,23 @@ export const restoreSnapshot = ( export const doctorRepository = ( options: Options, ) => - (options.client ?? client).post< - DoctorRepositoryResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/doctor", ...options }); + (options.client ?? client).post({ + url: "/api/v1/repositories/{id}/doctor", + ...options, + }); /** * Tag multiple snapshots in a repository */ -export const tagSnapshots = ( - options: Options, -) => - (options.client ?? client).post( - { - url: "/api/v1/repositories/{id}/snapshots/tag", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, +export const tagSnapshots = (options: Options) => + (options.client ?? client).post({ + url: "/api/v1/repositories/{id}/snapshots/tag", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, }, - ); + }); /** * List all backup schedules @@ -498,11 +434,10 @@ export const tagSnapshots = ( export const listBackupSchedules = ( options?: Options, ) => - (options?.client ?? client).get< - ListBackupSchedulesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/backups", + ...options, + }); /** * Create a new backup schedule for a volume @@ -510,11 +445,7 @@ export const listBackupSchedules = ( export const createBackupSchedule = ( options?: Options, ) => - (options?.client ?? client).post< - CreateBackupScheduleResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/backups", ...options, headers: { @@ -529,11 +460,10 @@ export const createBackupSchedule = ( export const deleteBackupSchedule = ( options: Options, ) => - (options.client ?? client).delete< - DeleteBackupScheduleResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}", ...options }); + (options.client ?? client).delete({ + url: "/api/v1/backups/{scheduleId}", + ...options, + }); /** * Get a backup schedule by ID @@ -541,11 +471,10 @@ export const deleteBackupSchedule = ( export const getBackupSchedule = ( options: Options, ) => - (options.client ?? client).get< - GetBackupScheduleResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}", ...options }); + (options.client ?? client).get({ + url: "/api/v1/backups/{scheduleId}", + ...options, + }); /** * Update a backup schedule @@ -553,11 +482,7 @@ export const getBackupSchedule = ( export const updateBackupSchedule = ( options: Options, ) => - (options.client ?? client).patch< - UpdateBackupScheduleResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).patch({ url: "/api/v1/backups/{scheduleId}", ...options, headers: { @@ -569,45 +494,36 @@ export const updateBackupSchedule = ( /** * Get a backup schedule for a specific volume */ -export const getBackupScheduleForVolume = < - ThrowOnError extends boolean = false, ->( +export const getBackupScheduleForVolume = ( options: Options, ) => - (options.client ?? client).get< - GetBackupScheduleForVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/volume/{volumeId}", ...options }); + (options.client ?? client).get({ + url: "/api/v1/backups/volume/{volumeId}", + ...options, + }); /** * Trigger a backup immediately for a schedule */ -export const runBackupNow = ( - options: Options, -) => - (options.client ?? client).post( - { url: "/api/v1/backups/{scheduleId}/run", ...options }, - ); +export const runBackupNow = (options: Options) => + (options.client ?? client).post({ + url: "/api/v1/backups/{scheduleId}/run", + ...options, + }); /** * Stop a backup that is currently in progress */ -export const stopBackup = ( - options: Options, -) => - (options.client ?? client).post< - StopBackupResponses, - StopBackupErrors, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/stop", ...options }); +export const stopBackup = (options: Options) => + (options.client ?? client).post({ + url: "/api/v1/backups/{scheduleId}/stop", + ...options, + }); /** * Manually apply retention policy to clean up old snapshots */ -export const runForget = ( - options: Options, -) => +export const runForget = (options: Options) => (options.client ?? client).post({ url: "/api/v1/backups/{scheduleId}/forget", ...options, @@ -619,25 +535,18 @@ export const runForget = ( export const getScheduleNotifications = ( options: Options, ) => - (options.client ?? client).get< - GetScheduleNotificationsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/notifications", ...options }); + (options.client ?? client).get({ + url: "/api/v1/backups/{scheduleId}/notifications", + ...options, + }); /** * Update notification assignments for a backup schedule */ -export const updateScheduleNotifications = < - ThrowOnError extends boolean = false, ->( +export const updateScheduleNotifications = ( options: Options, ) => - (options.client ?? client).put< - UpdateScheduleNotificationsResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).put({ url: "/api/v1/backups/{scheduleId}/notifications", ...options, headers: { @@ -652,11 +561,10 @@ export const updateScheduleNotifications = < export const getScheduleMirrors = ( options: Options, ) => - (options.client ?? client).get< - GetScheduleMirrorsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/mirrors", ...options }); + (options.client ?? client).get({ + url: "/api/v1/backups/{scheduleId}/mirrors", + ...options, + }); /** * Update mirror repository assignments for a backup schedule @@ -664,11 +572,7 @@ export const getScheduleMirrors = ( export const updateScheduleMirrors = ( options: Options, ) => - (options.client ?? client).put< - UpdateScheduleMirrorsResponses, - unknown, - ThrowOnError - >({ + (options.client ?? client).put({ url: "/api/v1/backups/{scheduleId}/mirrors", ...options, headers: { @@ -683,11 +587,10 @@ export const updateScheduleMirrors = ( export const getMirrorCompatibility = ( options: Options, ) => - (options.client ?? client).get< - GetMirrorCompatibilityResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/mirrors/compatibility", ...options }); + (options.client ?? client).get({ + url: "/api/v1/backups/{scheduleId}/mirrors/compatibility", + ...options, + }); /** * Reorder backup schedules by providing an array of schedule IDs in the desired order @@ -695,11 +598,7 @@ export const getMirrorCompatibility = ( export const reorderBackupSchedules = ( options?: Options, ) => - (options?.client ?? client).post< - ReorderBackupSchedulesResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/backups/reorder", ...options, headers: { @@ -711,30 +610,21 @@ export const reorderBackupSchedules = ( /** * List all notification destinations */ -export const listNotificationDestinations = < - ThrowOnError extends boolean = false, ->( +export const listNotificationDestinations = ( options?: Options, ) => - (options?.client ?? client).get< - ListNotificationDestinationsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/notifications/destinations", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/notifications/destinations", + ...options, + }); /** * Create a new notification destination */ -export const createNotificationDestination = < - ThrowOnError extends boolean = false, ->( +export const createNotificationDestination = ( options?: Options, ) => - (options?.client ?? client).post< - CreateNotificationDestinationResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/notifications/destinations", ...options, headers: { @@ -746,9 +636,7 @@ export const createNotificationDestination = < /** * Delete a notification destination */ -export const deleteNotificationDestination = < - ThrowOnError extends boolean = false, ->( +export const deleteNotificationDestination = ( options: Options, ) => (options.client ?? client).delete< @@ -760,23 +648,18 @@ export const deleteNotificationDestination = < /** * Get a notification destination by ID */ -export const getNotificationDestination = < - ThrowOnError extends boolean = false, ->( +export const getNotificationDestination = ( options: Options, ) => - (options.client ?? client).get< - GetNotificationDestinationResponses, - GetNotificationDestinationErrors, - ThrowOnError - >({ url: "/api/v1/notifications/destinations/{id}", ...options }); + (options.client ?? client).get({ + url: "/api/v1/notifications/destinations/{id}", + ...options, + }); /** * Update a notification destination */ -export const updateNotificationDestination = < - ThrowOnError extends boolean = false, ->( +export const updateNotificationDestination = ( options: Options, ) => (options.client ?? client).patch< @@ -795,9 +678,7 @@ export const updateNotificationDestination = < /** * Test a notification destination by sending a test message */ -export const testNotificationDestination = < - ThrowOnError extends boolean = false, ->( +export const testNotificationDestination = ( options: Options, ) => (options.client ?? client).post< @@ -812,18 +693,15 @@ export const testNotificationDestination = < export const getSystemInfo = ( options?: Options, ) => - (options?.client ?? client).get< - GetSystemInfoResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/system/info", ...options }); + (options?.client ?? client).get({ + url: "/api/v1/system/info", + ...options, + }); /** * Check for application updates from GitHub */ -export const getUpdates = ( - options?: Options, -) => +export const getUpdates = (options?: Options) => (options?.client ?? client).get({ url: "/api/v1/system/updates", ...options, @@ -835,11 +713,7 @@ export const getUpdates = ( export const downloadResticPassword = ( options?: Options, ) => - (options?.client ?? client).post< - DownloadResticPasswordResponses, - unknown, - ThrowOnError - >({ + (options?.client ?? client).post({ url: "/api/v1/system/restic-password", ...options, headers: { diff --git a/openapi-ts.config.ts b/openapi-ts.config.ts index 1cde65df..8a691832 100644 --- a/openapi-ts.config.ts +++ b/openapi-ts.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ input: `http://${config.serverIp}:4096/api/v1/openapi.json`, output: { path: "./app/client/api-client", - format: "biome", + postProcess: ["oxfmt"], }, plugins: [...defaultPlugins, "@tanstack/react-query", "@hey-api/client-fetch"], });