diff --git a/open-api/bin/generate-open-api.sh b/open-api/bin/generate-open-api.sh index 76012383c..f0a211abe 100755 --- a/open-api/bin/generate-open-api.sh +++ b/open-api/bin/generate-open-api.sh @@ -19,7 +19,7 @@ function dart { function typescript { rm -rf ./typescript-sdk/client npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ./typescript-sdk/axios-client --additional-properties=useSingleRequestParameter=true,supportsES6=true - npx --yes oazapfts --optimistic --argumentStyle=object immich-openapi-specs.json typescript-sdk/fetch-client.ts + npx --yes oazapfts --optimistic --argumentStyle=object --useEnumType immich-openapi-specs.json typescript-sdk/fetch-client.ts npm --prefix typescript-sdk ci && npm --prefix typescript-sdk run build } diff --git a/open-api/typescript-sdk/fetch-client.ts b/open-api/typescript-sdk/fetch-client.ts index 00b8c6832..e37b43ca7 100644 Binary files a/open-api/typescript-sdk/fetch-client.ts and b/open-api/typescript-sdk/fetch-client.ts differ diff --git a/open-api/typescript-sdk/tsconfig.fetch.json b/open-api/typescript-sdk/tsconfig.fetch.json index 58ef1ffa6..92d17ebda 100644 --- a/open-api/typescript-sdk/tsconfig.fetch.json +++ b/open-api/typescript-sdk/tsconfig.fetch.json @@ -1,5 +1,5 @@ { - "include": ["fetch.ts"], + "include": ["fetch.ts", "fetch-client.ts"], "compilerOptions": { "target": "esnext", "strict": true, diff --git a/web/src/api/index.ts b/web/src/api/index.ts deleted file mode 100644 index 886f439d8..000000000 --- a/web/src/api/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './api'; -export * from '@immich/sdk/axios'; -export * from './utils'; diff --git a/web/src/api/types.ts b/web/src/api/types.ts deleted file mode 100644 index 7a2ae17f6..000000000 --- a/web/src/api/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Configuration } from '@immich/sdk/axios'; - -/* eslint-disable @typescript-eslint/no-explicit-any */ -export type ApiFp = (configuration: Configuration) => Record any>; - -export type OmitLast = T extends readonly [...infer U, any?] ? U : [...T]; - -export type ApiParams> = OmitLast[K]>>; diff --git a/web/src/api/utils.ts b/web/src/api/utils.ts deleted file mode 100644 index decfefc56..000000000 --- a/web/src/api/utils.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { finishOAuth, linkOAuthAccount, startOAuth, unlinkOAuthAccount } from '@immich/sdk'; -import { type UserResponseDto } from '@immich/sdk/axios'; -import type { AxiosError } from 'axios'; -import { - NotificationType, - notificationController, -} from '../lib/components/shared-components/notification/notification'; -import { handleError } from '../lib/utils/handle-error'; - -export type ApiError = AxiosError<{ message: string }>; - -export const copyToClipboard = async (secret: string) => { - try { - await navigator.clipboard.writeText(secret); - notificationController.show({ message: 'Copied to clipboard!', type: NotificationType.Info }); - } catch (error) { - handleError(error, 'Cannot copy to clipboard, make sure you are accessing the page through https'); - } -}; - -export const makeSharedLinkUrl = (externalDomain: string, key: string) => { - let url = externalDomain || window.location.origin; - if (!url.endsWith('/')) { - url += '/'; - } - return `${url}share/${key}`; -}; - -export const oauth = { - isCallback: (location: Location) => { - const search = location.search; - return search.includes('code=') || search.includes('error='); - }, - isAutoLaunchDisabled: (location: Location) => { - const values = ['autoLaunch=0', 'password=1', 'password=true']; - for (const value of values) { - if (location.search.includes(value)) { - return true; - } - } - return false; - }, - authorize: async (location: Location) => { - try { - const redirectUri = location.href.split('?')[0]; - const { url } = await startOAuth({ oAuthConfigDto: { redirectUri } }); - window.location.href = url; - return true; - } catch (error) { - handleError(error, 'Unable to login with OAuth'); - return false; - } - }, - login: (location: Location) => { - return finishOAuth({ oAuthCallbackDto: { url: location.href } }); - }, - link: (location: Location): Promise => { - return linkOAuthAccount({ oAuthCallbackDto: { url: location.href } }); - }, - unlink: () => { - return unlinkOAuthAccount(); - }, -}; diff --git a/web/src/api/api.ts b/web/src/lib/api/index.ts similarity index 57% rename from web/src/api/api.ts rename to web/src/lib/api/index.ts index 53340cb45..de8a5f722 100644 --- a/web/src/api/api.ts +++ b/web/src/lib/api/index.ts @@ -4,12 +4,10 @@ class ImmichApi { public downloadApi: DownloadApi; public assetApi: AssetApi; - private config: configuration.Configuration; - constructor(parameters: configuration.ConfigurationParameters) { - this.config = new configuration.Configuration(parameters); - this.downloadApi = new DownloadApi(this.config); - this.assetApi = new AssetApi(this.config); + const config = new configuration.Configuration(parameters); + this.downloadApi = new DownloadApi(config); + this.assetApi = new AssetApi(config); } } diff --git a/web/src/lib/components/admin-page/jobs/job-tile.svelte b/web/src/lib/components/admin-page/jobs/job-tile.svelte index 42f489d41..9e4738669 100644 --- a/web/src/lib/components/admin-page/jobs/job-tile.svelte +++ b/web/src/lib/components/admin-page/jobs/job-tile.svelte @@ -3,8 +3,7 @@ import Button from '$lib/components/elements/buttons/button.svelte'; import Icon from '$lib/components/elements/icon.svelte'; import { locale } from '$lib/stores/preferences.store'; - import { type JobCommandDto, type JobCountsDto, type QueueStatusDto } from '@immich/sdk'; - import { JobCommand } from '@immich/sdk/axios'; + import { JobCommand, type JobCommandDto, type JobCountsDto, type QueueStatusDto } from '@immich/sdk'; import { mdiAlertCircle, mdiAllInclusive, diff --git a/web/src/lib/components/admin-page/jobs/jobs-panel.svelte b/web/src/lib/components/admin-page/jobs/jobs-panel.svelte index 7ab7c0462..60756166f 100644 --- a/web/src/lib/components/admin-page/jobs/jobs-panel.svelte +++ b/web/src/lib/components/admin-page/jobs/jobs-panel.svelte @@ -6,8 +6,7 @@ import { featureFlags } from '$lib/stores/server-config.store'; import { getJobName } from '$lib/utils'; import { handleError } from '$lib/utils/handle-error'; - import { sendJobCommand, type AllJobStatusResponseDto, type JobCommandDto } from '@immich/sdk'; - import { JobCommand, JobName } from '@immich/sdk/axios'; + import { JobCommand, JobName, sendJobCommand, type AllJobStatusResponseDto, type JobCommandDto } from '@immich/sdk'; import { mdiFaceRecognition, mdiFileJpgBox, diff --git a/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte b/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte index b0f5a9c08..cd73b77f4 100644 --- a/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte +++ b/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte @@ -1,7 +1,14 @@ diff --git a/web/src/lib/components/admin-page/settings/logging-settings/logging-settings.svelte b/web/src/lib/components/admin-page/settings/logging-settings/logging-settings.svelte index 85ea60545..f29e6f9ea 100644 --- a/web/src/lib/components/admin-page/settings/logging-settings/logging-settings.svelte +++ b/web/src/lib/components/admin-page/settings/logging-settings/logging-settings.svelte @@ -1,6 +1,5 @@