1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

chore: enum support for new API (#7110)

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Ben McCann 2024-02-14 06:38:57 -08:00 committed by GitHub
parent 6f5648569a
commit 87ae0be081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
108 changed files with 353 additions and 343 deletions

View File

@ -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
}

Binary file not shown.

View File

@ -1,5 +1,5 @@
{
"include": ["fetch.ts"],
"include": ["fetch.ts", "fetch-client.ts"],
"compilerOptions": {
"target": "esnext",
"strict": true,

View File

@ -1,3 +0,0 @@
export * from './api';
export * from '@immich/sdk/axios';
export * from './utils';

View File

@ -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, (...arguments_: any) => any>;
export type OmitLast<T extends readonly unknown[]> = T extends readonly [...infer U, any?] ? U : [...T];
export type ApiParams<F extends ApiFp, K extends keyof ReturnType<F>> = OmitLast<Parameters<ReturnType<F>[K]>>;

View File

@ -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<UserResponseDto> => {
return linkOAuthAccount({ oAuthCallbackDto: { url: location.href } });
},
unlink: () => {
return unlinkOAuthAccount();
},
};

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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,

View File

@ -1,7 +1,14 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { type SystemConfigDto } from '@immich/sdk';
import { AudioCodec, CQMode, ToneMapping, TranscodeHWAccel, TranscodePolicy, VideoCodec } from '@immich/sdk/axios';
import {
AudioCodec,
CQMode,
ToneMapping,
TranscodeHWAccel,
TranscodePolicy,
VideoCodec,
type SystemConfigDto,
} from '@immich/sdk';
import { mdiHelpCircleOutline } from '@mdi/js';
import { isEqual, sortBy } from 'lodash-es';
import { createEventDispatcher } from 'svelte';

View File

@ -1,7 +1,6 @@
<script lang="ts">
import { getJobName } from '$lib/utils';
import { type SystemConfigDto, type SystemConfigJobDto } from '@immich/sdk';
import { JobName } from '@immich/sdk/axios';
import { JobName, type SystemConfigDto, type SystemConfigJobDto } from '@immich/sdk';
import { isEqual } from 'lodash-es';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';
@ -29,7 +28,8 @@
JobName.Migration,
];
function isSystemConfigJobDto(jobName: JobName): jobName is keyof SystemConfigJobDto {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isSystemConfigJobDto(jobName: any): jobName is keyof SystemConfigJobDto {
return jobName in config.job;
}
</script>

View File

@ -1,6 +1,5 @@
<script lang="ts">
import { type SystemConfigDto } from '@immich/sdk';
import { LogLevel } from '@immich/sdk/axios';
import { LogLevel, type SystemConfigDto } from '@immich/sdk';
import { isEqual } from 'lodash-es';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';

View File

@ -1,8 +1,7 @@
<script lang="ts">
import SettingButtonsRow from '$lib/components/admin-page/settings/setting-buttons-row.svelte';
import SettingSelect from '$lib/components/admin-page/settings/setting-select.svelte';
import { type SystemConfigDto } from '@immich/sdk';
import { Colorspace } from '@immich/sdk/axios';
import { Colorspace, type SystemConfigDto } from '@immich/sdk';
import { isEqual } from 'lodash-es';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';

View File

@ -1,12 +1,13 @@
import { createObjectURLMock } from '$lib/__mocks__/jsdom-url.mock';
import { api, ThumbnailFormat } from '@api';
import { api } from '$lib/api';
import { ThumbnailFormat } from '@immich/sdk';
import { albumFactory } from '@test-data';
import '@testing-library/jest-dom';
import { fireEvent, render, type RenderResult, waitFor } from '@testing-library/svelte';
import AlbumCard from '../album-card.svelte';
import { fireEvent, render, waitFor, type RenderResult } from '@testing-library/svelte';
import type { MockedObject } from 'vitest';
import AlbumCard from '../album-card.svelte';
vi.mock('@api');
vi.mock('$lib/api');
const apiMock: MockedObject<typeof api> = api as MockedObject<typeof api>;
describe('AlbumCard component', () => {

View File

@ -1,11 +1,11 @@
<script lang="ts">
import { api } from '$lib/api';
import noThumbnailUrl from '$lib/assets/no-thumbnail.png';
import Icon from '$lib/components/elements/icon.svelte';
import { locale } from '$lib/stores/preferences.store';
import { user } from '$lib/stores/user.store';
import { getAssetThumbnailUrl } from '$lib/utils';
import { ThumbnailFormat, api, type AlbumResponseDto } from '@api';
import { getUserById } from '@immich/sdk';
import { ThumbnailFormat, getUserById, type AlbumResponseDto } from '@immich/sdk';
import { mdiDotsVertical } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { getContextMenuPosition } from '../../utils/context-menu';

View File

@ -1,12 +1,12 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import type { AlbumResponseDto, UserResponseDto } from '@immich/sdk';
import { mdiClose, mdiPlus } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import SettingSwitch from '../admin-page/settings/setting-switch.svelte';
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
import UserAvatar from '../shared-components/user-avatar.svelte';
import { createEventDispatcher } from 'svelte';
import type { AlbumResponseDto, UserResponseDto } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
export let album: AlbumResponseDto;
export let user: UserResponseDto;

View File

@ -5,7 +5,7 @@
import { dragAndDropFilesStore } from '$lib/stores/drag-and-drop-files.store';
import { locale } from '$lib/stores/preferences.store';
import { fileUploadHandler, openFileUploadDialog } from '$lib/utils/file-uploader';
import type { AlbumResponseDto, SharedLinkResponseDto, UserResponseDto } from '@api';
import type { AlbumResponseDto, SharedLinkResponseDto, UserResponseDto } from '@immich/sdk';
import { onDestroy, onMount } from 'svelte';
import { dateFormats } from '../../constants';
import { createAssetInteractionStore } from '../../stores/asset-interaction.store';

View File

@ -1,6 +1,5 @@
<script lang="ts">
import { type AlbumResponseDto, type UserResponseDto } from '@immich/sdk';
import { getMyUserInfo, removeUserFromAlbum } from '@immich/sdk';
import { getMyUserInfo, removeUserFromAlbum, type AlbumResponseDto, type UserResponseDto } from '@immich/sdk';
import { mdiDotsVertical } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { getContextMenuPosition } from '../../utils/context-menu';

View File

@ -1,5 +1,5 @@
<script lang="ts">
import type { AlbumResponseDto, AssetResponseDto } from '@api';
import type { AlbumResponseDto, AssetResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import { quintOut } from 'svelte/easing';
import { fly } from 'svelte/transition';

View File

@ -1,8 +1,8 @@
<script lang="ts">
import type { ActivityResponseDto } from '@immich/sdk';
import { mdiCommentOutline, mdiHeart, mdiHeartOutline } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import Icon from '../elements/icon.svelte';
import type { ActivityResponseDto } from '@api';
export let isLiked: ActivityResponseDto | null;
export let numberOfComments: number | undefined;

View File

@ -8,6 +8,8 @@
import { handleError } from '$lib/utils/handle-error';
import { isTenMinutesApart } from '$lib/utils/timesince';
import {
ReactionType,
ThumbnailFormat,
createActivity,
deleteActivity,
getActivities,
@ -15,7 +17,6 @@
type AssetTypeEnum,
type UserResponseDto,
} from '@immich/sdk';
import { ReactionType, ThumbnailFormat } from '@immich/sdk/axios';
import { mdiClose, mdiDotsVertical, mdiHeart, mdiSend } from '@mdi/js';
import * as luxon from 'luxon';
import { createEventDispatcher, onMount } from 'svelte';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { getAssetThumbnailUrl } from '$lib/utils';
import { ThumbnailFormat, type AlbumResponseDto } from '@api';
import { ThumbnailFormat, type AlbumResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher<{

View File

@ -5,7 +5,7 @@
import { getAssetJobName } from '$lib/utils';
import { clickOutside } from '$lib/utils/click-outside';
import { getContextMenuPosition } from '$lib/utils/context-menu';
import { AssetJobName, AssetTypeEnum, type AssetResponseDto } from '@api';
import { AssetJobName, AssetTypeEnum, type AssetResponseDto } from '@immich/sdk';
import {
mdiAlertOutline,
mdiArrowLeft,

View File

@ -20,12 +20,6 @@
AssetJobName,
AssetTypeEnum,
ReactionType,
type ActivityResponseDto,
type AlbumResponseDto,
type AssetResponseDto,
type SharedLinkResponseDto,
} from '@api';
import {
createActivity,
createAlbum,
deleteActivity,
@ -36,6 +30,10 @@
runAssetJobs,
updateAsset,
updateAssets,
type ActivityResponseDto,
type AlbumResponseDto,
type AssetResponseDto,
type SharedLinkResponseDto,
} from '@immich/sdk';
import { mdiChevronLeft, mdiChevronRight, mdiImageBrokenVariant } from '@mdi/js';
import { createEventDispatcher, onDestroy, onMount } from 'svelte';

View File

@ -11,8 +11,13 @@
import { getAssetFilename } from '$lib/utils/asset-utils';
import { autoGrowHeight } from '$lib/utils/autogrow';
import { clickOutside } from '$lib/utils/click-outside';
import { ThumbnailFormat, type AlbumResponseDto, type AssetResponseDto } from '@api';
import { getAssetInfo, updateAsset } from '@immich/sdk';
import {
ThumbnailFormat,
getAssetInfo,
updateAsset,
type AlbumResponseDto,
type AssetResponseDto,
} from '@immich/sdk';
import {
mdiCalendar,
mdiCameraIris,

View File

@ -1,8 +1,9 @@
<script lang="ts">
import { api } from '$lib/api';
import { getKey } from '$lib/utils';
import { type AssetResponseDto } from '@immich/sdk';
import { fade } from 'svelte/transition';
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
import { api, type AssetResponseDto } from '@api';
import { getKey } from '$lib/utils';
export let asset: AssetResponseDto;

View File

@ -1,4 +1,5 @@
<script lang="ts">
import { api } from '$lib/api';
import { photoViewer } from '$lib/stores/assets.store';
import { boundingBoxesArray } from '$lib/stores/people.store';
import { alwaysLoadOriginalFile } from '$lib/stores/preferences.store';
@ -7,7 +8,7 @@
import { isWebCompatibleImage } from '$lib/utils/asset-utils';
import { getBoundingBox } from '$lib/utils/people-utils';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { api, type AssetResponseDto } from '@api';
import { type AssetResponseDto } from '@immich/sdk';
import { useZoomImageWheel } from '@zoom-image/svelte';
import { onDestroy, onMount } from 'svelte';
import { fade } from 'svelte/transition';

View File

@ -2,7 +2,7 @@
import { videoViewerVolume } from '$lib/stores/preferences.store';
import { getAssetFileUrl, getAssetThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { ThumbnailFormat } from '@api';
import { ThumbnailFormat } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';
import LoadingSpinner from '../shared-components/loading-spinner.svelte';

View File

@ -4,7 +4,7 @@
import { ProjectionType } from '$lib/constants';
import { getAssetFileUrl, getAssetThumbnailUrl, isSharedLink } from '$lib/utils';
import { timeToSeconds } from '$lib/utils/time-to-seconds';
import { AssetTypeEnum, ThumbnailFormat, type AssetResponseDto } from '@api';
import { AssetTypeEnum, ThumbnailFormat, type AssetResponseDto } from '@immich/sdk';
import {
mdiArchiveArrowDownOutline,
mdiCameraBurst,

View File

@ -4,8 +4,13 @@
import { getAssetThumbnailUrl, getPeopleThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { getPersonNameWithHiddenValue, searchNameLocal } from '$lib/utils/person';
import { AssetTypeEnum, ThumbnailFormat, type AssetFaceResponseDto, type PersonResponseDto } from '@api';
import { searchPerson } from '@immich/sdk';
import {
AssetTypeEnum,
ThumbnailFormat,
searchPerson,
type AssetFaceResponseDto,
type PersonResponseDto,
} from '@immich/sdk';
import { mdiArrowLeftThin, mdiClose, mdiMagnify, mdiPlus } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import { linear } from 'svelte/easing';

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { type PersonResponseDto } from '@api';
import { type PersonResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
import Button from '../elements/buttons/button.svelte';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { getPeopleThumbnailUrl } from '$lib/utils';
import { type PersonResponseDto } from '@api';
import { type PersonResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';

View File

@ -4,8 +4,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import { ActionQueryParameterValue, AppRoute, QueryParameter } from '$lib/constants';
import { handleError } from '$lib/utils/handle-error';
import { type PersonResponseDto } from '@api';
import { getAllPeople, getPerson, mergePerson } from '@immich/sdk';
import { getAllPeople, getPerson, mergePerson, type PersonResponseDto } from '@immich/sdk';
import { mdiCallMerge, mdiMerge, mdiSwapHorizontal } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { flip } from 'svelte/animate';

View File

@ -2,7 +2,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
import { getPeopleThumbnailUrl } from '$lib/utils';
import { type PersonResponseDto } from '@api';
import { type PersonResponseDto } from '@immich/sdk';
import { mdiArrowLeft, mdiClose, mdiMerge } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';

View File

@ -3,7 +3,7 @@
import { AppRoute, QueryParameter } from '$lib/constants';
import { getPeopleThumbnailUrl } from '$lib/utils';
import { getContextMenuPosition } from '$lib/utils/context-menu';
import { type PersonResponseDto } from '@api';
import { type PersonResponseDto } from '@immich/sdk';
import { mdiDotsVertical } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';

View File

@ -2,8 +2,7 @@
import { maximumLengthSearchPeople, timeBeforeShowLoadingSpinner } from '$lib/constants';
import { handleError } from '$lib/utils/handle-error';
import { searchNameLocal } from '$lib/utils/person';
import { type PersonResponseDto } from '@api';
import { searchPerson } from '@immich/sdk';
import { searchPerson, type PersonResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import FaceThumbnail from './face-thumbnail.svelte';
import SearchBar from './search-bar.svelte';

View File

@ -6,8 +6,15 @@
import { getPeopleThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { getPersonNameWithHiddenValue } from '$lib/utils/person';
import { AssetTypeEnum, type AssetFaceResponseDto, type PersonResponseDto } from '@api';
import { createPerson, getAllPeople, getFaces, reassignFacesById } from '@immich/sdk';
import {
AssetTypeEnum,
createPerson,
getAllPeople,
getFaces,
reassignFacesById,
type AssetFaceResponseDto,
type PersonResponseDto,
} from '@immich/sdk';
import { mdiArrowLeftThin, mdiRestart } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { linear } from 'svelte/easing';

View File

@ -1,13 +1,13 @@
<script lang="ts">
import type { APIKeyResponseDto } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
import type { ApiKeyResponseDto } from '@immich/sdk';
import { mdiKeyVariant } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { mdiKeyVariant } from '@mdi/js';
import { NotificationType, notificationController } from '../shared-components/notification/notification';
export let apiKey: Partial<APIKeyResponseDto>;
export let apiKey: Partial<ApiKeyResponseDto>;
export let title = 'API Key';
export let cancelText = 'Cancel';
export let submitText = 'Save';
@ -15,7 +15,7 @@
const dispatch = createEventDispatcher<{
cancel: void;
submit: Partial<APIKeyResponseDto>;
submit: Partial<ApiKeyResponseDto>;
}>();
const handleCancel = () => dispatch('cancel');
const handleSubmit = () => {

View File

@ -1,10 +1,10 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { copyToClipboard } from '$lib/utils';
import { mdiKeyVariant } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { copyToClipboard } from '@api';
import Button from '../elements/buttons/button.svelte';
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
import { mdiKeyVariant } from '@mdi/js';
import Icon from '$lib/components/elements/icon.svelte';
export let secret = '';

View File

@ -1,12 +1,11 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import { handleError } from '../../utils/handle-error';
import LibraryImportPathForm from './library-import-path-form.svelte';
import { onMount } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import type { LibraryResponseDto } from '@api';
import type { LibraryResponseDto } from '@immich/sdk';
import { mdiPencilOutline } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { handleError } from '../../utils/handle-error';
import Button from '../elements/buttons/button.svelte';
import LibraryImportPathForm from './library-import-path-form.svelte';
export let library: Partial<LibraryResponseDto>;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { LibraryResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import type { LibraryResponseDto } from '@api';
export let library: Partial<LibraryResponseDto>;

View File

@ -1,12 +1,11 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import { LibraryType, type LibraryResponseDto } from '@api';
import { handleError } from '../../utils/handle-error';
import { onMount } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import LibraryExclusionPatternForm from './library-exclusion-pattern-form.svelte';
import { LibraryType, type LibraryResponseDto } from '@immich/sdk';
import { mdiPencilOutline } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import { handleError } from '../../utils/handle-error';
import Button from '../elements/buttons/button.svelte';
import LibraryExclusionPatternForm from './library-exclusion-pattern-form.svelte';
export let library: Partial<LibraryResponseDto>;

View File

@ -3,8 +3,8 @@
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
import { AppRoute } from '$lib/constants';
import { featureFlags, serverConfig } from '$lib/stores/server-config.store';
import { oauth } from '$lib/utils';
import { getServerErrorMessage, handleError } from '$lib/utils/handle-error';
import { oauth } from '@api';
import { getServerConfig, login } from '@immich/sdk';
import { createEventDispatcher, onMount } from 'svelte';
import { fade } from 'svelte/transition';

View File

@ -10,7 +10,7 @@
import { memoryStore } from '$lib/stores/memory.store';
import { getAssetThumbnailUrl } from '$lib/utils';
import { fromLocalDateTime } from '$lib/utils/timeline-util';
import { getMemoryLane } from '@immich/sdk';
import { ThumbnailFormat, getMemoryLane } from '@immich/sdk';
import { mdiChevronDown, mdiChevronLeft, mdiChevronRight, mdiChevronUp, mdiPause, mdiPlay } from '@mdi/js';
import { DateTime } from 'luxon';
import { onMount } from 'svelte';
@ -168,7 +168,9 @@
<button class="relative h-full w-full rounded-2xl" disabled={!previousMemory} on:click={toPreviousMemory}>
<img
class="h-full w-full rounded-2xl object-cover"
src={previousMemory ? getAssetThumbnailUrl(previousMemory.assets[0].id, 'JPEG') : noThumbnailUrl}
src={previousMemory
? getAssetThumbnailUrl(previousMemory.assets[0].id, ThumbnailFormat.Jpeg)
: noThumbnailUrl}
alt=""
draggable="false"
/>
@ -191,7 +193,7 @@
<img
transition:fade
class="h-full w-full rounded-2xl object-contain transition-all"
src={getAssetThumbnailUrl(currentAsset.id, 'JPEG')}
src={getAssetThumbnailUrl(currentAsset.id, ThumbnailFormat.Jpeg)}
alt=""
draggable="false"
/>
@ -231,7 +233,7 @@
<button class="relative h-full w-full rounded-2xl" on:click={toNextMemory} disabled={!nextMemory}>
<img
class="h-full w-full rounded-2xl object-cover"
src={nextMemory ? getAssetThumbnailUrl(nextMemory.assets[0].id, 'JPEG') : noThumbnailUrl}
src={nextMemory ? getAssetThumbnailUrl(nextMemory.assets[0].id, ThumbnailFormat.Jpeg) : noThumbnailUrl}
alt=""
draggable="false"
/>

View File

@ -1,8 +1,7 @@
<script lang="ts">
import { featureFlags } from '$lib/stores/server-config.store';
import { user } from '$lib/stores/user.store';
import { type SystemConfigDto } from '@api';
import { getConfig } from '@immich/sdk';
import { getConfig, type SystemConfigDto } from '@immich/sdk';
import { mdiArrowLeft, mdiCheck } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import AdminSettings from '../admin-page/settings/admin-settings.svelte';

View File

@ -8,8 +8,7 @@
} from '$lib/components/shared-components/notification/notification';
import { AppRoute } from '$lib/constants';
import { addAssetsToAlbum } from '$lib/utils/asset-utils';
import { type AlbumResponseDto } from '@api';
import { createAlbum } from '@immich/sdk';
import { createAlbum, type AlbumResponseDto } from '@immich/sdk';
import { getMenuContext } from '../asset-select-context-menu.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';

View File

@ -6,8 +6,7 @@
} from '$lib/components/shared-components/notification/notification';
import { getAssetJobMessage, getAssetJobName } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { AssetJobName, AssetTypeEnum } from '@api';
import { runAssetJobs } from '@immich/sdk';
import { AssetJobName, AssetTypeEnum, runAssetJobs } from '@immich/sdk';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
export let jobs: AssetJobName[] = [

View File

@ -2,8 +2,7 @@
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import { getKey } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { type SharedLinkResponseDto } from '@api';
import { removeSharedLinkAssets } from '@immich/sdk';
import { removeSharedLinkAssets, type SharedLinkResponseDto } from '@immich/sdk';
import { mdiDeleteOutline } from '@mdi/js';
import ConfirmDialogue from '../../shared-components/confirm-dialogue.svelte';
import { NotificationType, notificationController } from '../../shared-components/notification/notification';

View File

@ -1,18 +1,17 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import type { AssetStore, Viewport } from '$lib/stores/assets.store';
import { locale } from '$lib/stores/preferences.store';
import { getAssetRatio } from '$lib/utils/asset-utils';
import { formatGroupTitle, fromLocalDateTime, splitBucketIntoDateGroups } from '$lib/utils/timeline-util';
import type { AssetResponseDto } from '@api';
import type { AssetResponseDto } from '@immich/sdk';
import { mdiCheckCircle, mdiCircleOutline } from '@mdi/js';
import justifiedLayout from 'justified-layout';
import { createEventDispatcher } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { fly } from 'svelte/transition';
import Thumbnail from '../assets/thumbnail/thumbnail.svelte';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import type { AssetStore } from '$lib/stores/assets.store';
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
import type { Viewport } from '$lib/stores/assets.store';
import { mdiCheckCircle, mdiCircleOutline } from '@mdi/js';
export let assets: AssetResponseDto[];
export let bucketDate: string;

View File

@ -7,8 +7,11 @@
import { BucketPosition, type AssetStore, type Viewport } from '$lib/stores/assets.store';
import { locale, showDeleteModal } from '$lib/stores/preferences.store';
import { isSearchEnabled } from '$lib/stores/search.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { deleteAssets } from '$lib/utils/actions';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { formatGroupTitle, splitBucketIntoDateGroups } from '$lib/utils/timeline-util';
import type { AlbumResponseDto, AssetResponseDto } from '@api';
import type { AlbumResponseDto, AssetResponseDto } from '@immich/sdk';
import { DateTime } from 'luxon';
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import AssetViewer from '../asset-viewer/asset-viewer.svelte';
@ -17,9 +20,6 @@
import Scrollbar from '../shared-components/scrollbar/scrollbar.svelte';
import ShowShortcuts from '../shared-components/show-shortcuts.svelte';
import AssetDateGroup from './asset-date-group.svelte';
import { featureFlags } from '$lib/stores/server-config.store';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { deleteAssets } from '$lib/utils/actions';
import DeleteAssetDialog from './delete-asset-dialog.svelte';
export let isSelectionMode = false;

View File

@ -14,9 +14,9 @@
<script lang="ts">
import { locale } from '$lib/stores/preferences.store';
import type { AssetResponseDto } from '@api';
import ControlAppBar from '../shared-components/control-app-bar.svelte';
import type { AssetResponseDto } from '@immich/sdk';
import { mdiClose } from '@mdi/js';
import ControlAppBar from '../shared-components/control-app-bar.svelte';
export let assets: Set<AssetResponseDto>;
export let clearSelect: () => void;

View File

@ -4,7 +4,7 @@
import { AppRoute, QueryParameter } from '$lib/constants';
import { memoryStore } from '$lib/stores/memory.store';
import { getAssetThumbnailUrl } from '$lib/utils';
import { getMemoryLane } from '@immich/sdk';
import { ThumbnailFormat, getMemoryLane } from '@immich/sdk';
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
@ -73,7 +73,7 @@
>
<img
class="h-full w-full rounded-xl object-cover"
src={getAssetThumbnailUrl(memory.assets[0].id, 'JPEG')}
src={getAssetThumbnailUrl(memory.assets[0].id, ThumbnailFormat.Jpeg)}
alt={memory.title}
draggable="false"
/>

View File

@ -6,8 +6,7 @@
import { downloadArchive } from '$lib/utils/asset-utils';
import { fileUploadHandler, openFileUploadDialog } from '$lib/utils/file-uploader';
import { handleError } from '$lib/utils/handle-error';
import { type AssetResponseDto, type SharedLinkResponseDto } from '@api';
import { addSharedLinkAssets } from '@immich/sdk';
import { addSharedLinkAssets, type AssetResponseDto, type SharedLinkResponseDto } from '@immich/sdk';
import { mdiArrowLeft, mdiFileImagePlusOutline, mdiFolderDownloadOutline, mdiSelectAll } from '@mdi/js';
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
import DownloadAction from '../photos-page/actions/download-action.svelte';

View File

@ -1,7 +1,6 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { type AlbumResponseDto } from '@api';
import { getAllAlbums } from '@immich/sdk';
import { getAllAlbums, type AlbumResponseDto } from '@immich/sdk';
import { mdiPlus } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import AlbumListItem from '../asset-viewer/album-list-item.svelte';

View File

@ -1,5 +1,5 @@
<script lang="ts">
import type { AssetResponseDto } from '@api';
import type { AssetResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import ConfirmDialogue from './confirm-dialogue.svelte';
import Map from './map/map.svelte';

View File

@ -6,9 +6,9 @@
import Button from '$lib/components/elements/buttons/button.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { serverConfig } from '$lib/stores/server-config.store';
import { copyToClipboard, makeSharedLinkUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { SharedLinkType, copyToClipboard, makeSharedLinkUrl, type SharedLinkResponseDto } from '@api';
import { createSharedLink, updateSharedLink } from '@immich/sdk';
import { SharedLinkType, createSharedLink, updateSharedLink, type SharedLinkResponseDto } from '@immich/sdk';
import { mdiLink } from '@mdi/js';
import { createEventDispatcher, onMount } from 'svelte';
import BaseModal from '../base-modal.svelte';

View File

@ -1,7 +1,7 @@
<script lang="ts">
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import { getThumbnailSize } from '$lib/utils/thumbnail-util';
import { type AssetResponseDto, ThumbnailFormat } from '@api';
import { ThumbnailFormat, type AssetResponseDto } from '@immich/sdk';
import { createEventDispatcher } from 'svelte';
import { flip } from 'svelte/animate';

View File

@ -1,15 +1,14 @@
<script lang="ts">
import { page } from '$app/stores';
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import { handleError } from '$lib/utils/handle-error';
import { type AssetResponseDto, ThumbnailFormat } from '@api';
import AssetViewer from '../../asset-viewer/asset-viewer.svelte';
import { flip } from 'svelte/animate';
import { getThumbnailSize } from '$lib/utils/thumbnail-util';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { onDestroy } from 'svelte';
import { createEventDispatcher } from 'svelte';
import type { BucketPosition } from '$lib/stores/assets.store';
import { handleError } from '$lib/utils/handle-error';
import { getThumbnailSize } from '$lib/utils/thumbnail-util';
import { ThumbnailFormat, type AssetResponseDto } from '@immich/sdk';
import { createEventDispatcher, onDestroy } from 'svelte';
import { flip } from 'svelte/animate';
import AssetViewer from '../../asset-viewer/asset-viewer.svelte';
const dispatch = createEventDispatcher<{ intersected: { container: HTMLDivElement; position: BucketPosition } }>();

View File

@ -3,7 +3,7 @@
import { Theme } from '$lib/constants';
import { colorTheme, mapSettings } from '$lib/stores/preferences.store';
import { getAssetThumbnailUrl } from '$lib/utils';
import { getMapStyle, type MapMarkerResponseDto } from '@immich/sdk';
import { getMapStyle, MapTheme, type MapMarkerResponseDto } from '@immich/sdk';
import { mdiCog, mdiMapMarker } from '@mdi/js';
import type { Feature, GeoJsonProperties, Geometry, Point } from 'geojson';
import type { GeoJSONSource, LngLatLike, StyleSpecification } from 'maplibre-gl';
@ -38,7 +38,7 @@
$: style = (() =>
getMapStyle({
theme: $mapSettings.allowDarkMode ? $colorTheme.value : Theme.LIGHT,
theme: ($mapSettings.allowDarkMode ? $colorTheme.value : Theme.LIGHT) as unknown as MapTheme,
}) as Promise<StyleSpecification>)();
const dispatch = createEventDispatcher<{

View File

@ -8,7 +8,7 @@
import { mdiCog, mdiLogout, mdiPencil } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';
import { NotificationType, notificationController } from '../notification/notification';
import { notificationController, NotificationType } from '../notification/notification';
import UserAvatar from '../user-avatar.svelte';
import AvatarSelector from './avatar-selector.svelte';

View File

@ -1,8 +1,8 @@
<script lang="ts">
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import { UserAvatarColor, type UserResponseDto } from '@immich/sdk';
import { mdiClose } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import { UserAvatarColor, type UserResponseDto } from '@api';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import FullScreenModal from '../full-screen-modal.svelte';
import UserAvatar from '../user-avatar.svelte';

View File

@ -1,8 +1,7 @@
<script lang="ts">
import { user } from '$lib/stores/user.store';
import { handleError } from '$lib/utils/handle-error';
import { type AssetResponseDto } from '@api';
import { createProfileImage } from '@immich/sdk';
import { createProfileImage, type AssetResponseDto } from '@immich/sdk';
import domtoimage from 'dom-to-image';
import { createEventDispatcher, onMount } from 'svelte';
import PhotoViewer from '../asset-viewer/photo-viewer.svelte';

View File

@ -4,7 +4,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import { getPeopleThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { SearchSuggestionType, type PersonResponseDto } from '@api';
import { SearchSuggestionType, type PersonResponseDto } from '@immich/sdk';
import { getAllPeople, getSearchSuggestions } from '@immich/sdk';
import { mdiArrowRight, mdiClose } from '@mdi/js';
import { onMount } from 'svelte';

View File

@ -2,7 +2,6 @@
import { page } from '$app/stores';
import { locale, sidebarSettings } from '$lib/stores/preferences.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { type AssetApiGetAssetStatisticsRequest } from '@api';
import { getAlbumCount, getAssetStatistics } from '@immich/sdk';
import {
mdiAccount,
@ -24,7 +23,7 @@
import SideBarButton from './side-bar-button.svelte';
import SideBarSection from './side-bar-section.svelte';
const getStats = (dto: AssetApiGetAssetStatisticsRequest) => getAssetStatistics(dto);
const getStats = (dto: Parameters<typeof getAssetStatistics>[0]) => getAssetStatistics(dto);
const handleAlbumCount = async () => {
try {

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { ServerVersionResponseDto } from '@api';
import { websocketStore } from '$lib/stores/websocket';
import type { ServerVersionResponseDto } from '@immich/sdk';
import Button from '../elements/buttons/button.svelte';
import FullScreenModal from './full-screen-modal.svelte';

View File

@ -4,8 +4,13 @@
import Icon from '$lib/components/elements/icon.svelte';
import { AppRoute } from '$lib/constants';
import { getAssetThumbnailUrl } from '$lib/utils';
import { SharedLinkType, ThumbnailFormat, type AssetResponseDto, type SharedLinkResponseDto } from '@api';
import { getAssetInfo } from '@immich/sdk';
import {
SharedLinkType,
ThumbnailFormat,
getAssetInfo,
type AssetResponseDto,
type SharedLinkResponseDto,
} from '@immich/sdk';
import { mdiCircleEditOutline, mdiContentCopy, mdiDelete, mdiOpenInNew } from '@mdi/js';
import * as luxon from 'luxon';
import { createEventDispatcher } from 'svelte';

View File

@ -3,7 +3,7 @@
notificationController,
NotificationType,
} from '$lib/components/shared-components/notification/notification';
import { type ApiError } from '@api';
import { type ApiError } from '$lib/utils';
import { changePassword } from '@immich/sdk';
import { fade } from 'svelte/transition';
import SettingInputField, { SettingInputFieldType } from '../admin-page/settings/setting-input-field.svelte';

View File

@ -1,19 +1,19 @@
<script lang="ts">
import { locale } from '$lib/stores/preferences.store';
import type { AuthDeviceResponseDto } from '@api';
import { DateTime, type ToRelativeCalendarOptions } from 'luxon';
import { createEventDispatcher } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { locale } from '$lib/stores/preferences.store';
import type { AuthDeviceResponseDto } from '@immich/sdk';
import {
mdiAndroid,
mdiApple,
mdiAppleSafari,
mdiMicrosoftWindows,
mdiLinux,
mdiGoogleChrome,
mdiTrashCanOutline,
mdiHelp,
mdiLinux,
mdiMicrosoftWindows,
mdiTrashCanOutline,
} from '@mdi/js';
import { DateTime, type ToRelativeCalendarOptions } from 'luxon';
import { createEventDispatcher } from 'svelte';
export let device: AuthDeviceResponseDto;

View File

@ -1,10 +1,9 @@
<script lang="ts">
import { type AuthDeviceResponseDto } from '@api';
import { getAuthDevices, logoutAuthDevice, logoutAuthDevices } from '@immich/sdk';
import { getAuthDevices, logoutAuthDevice, logoutAuthDevices, type AuthDeviceResponseDto } from '@immich/sdk';
import { handleError } from '../../utils/handle-error';
import Button from '../elements/buttons/button.svelte';
import ConfirmDialogue from '../shared-components/confirm-dialogue.svelte';
import { notificationController, NotificationType } from '../shared-components/notification/notification';
import { NotificationType, notificationController } from '../shared-components/notification/notification';
import DeviceCard from './device-card.svelte';
export let devices: AuthDeviceResponseDto[];

View File

@ -4,8 +4,8 @@
import { getBytesWithUnit } from '$lib/utils/byte-units';
import { getContextMenuPosition } from '$lib/utils/context-menu';
import { handleError } from '$lib/utils/handle-error';
import { LibraryType, type LibraryResponseDto, type LibraryStatsResponseDto } from '@api';
import {
LibraryType,
createLibrary,
deleteLibrary,
getLibraries,
@ -13,6 +13,8 @@
removeOfflineFiles,
scanLibrary,
updateLibrary,
type LibraryResponseDto,
type LibraryStatsResponseDto,
} from '@immich/sdk';
import { mdiDatabase, mdiDotsVertical, mdiUpload } from '@mdi/js';
import { onMount } from 'svelte';

View File

@ -3,8 +3,7 @@
notificationController,
NotificationType,
} from '$lib/components/shared-components/notification/notification';
import { type UserResponseDto } from '@api';
import { updateUser } from '@immich/sdk';
import { updateUser, type UserResponseDto } from '@immich/sdk';
import { fade } from 'svelte/transition';
import { handleError } from '../../utils/handle-error';
import SettingSwitch from '../admin-page/settings/setting-switch.svelte';

View File

@ -1,7 +1,8 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { featureFlags } from '$lib/stores/server-config.store';
import { oauth, type UserResponseDto } from '@api';
import { oauth } from '$lib/utils';
import { type UserResponseDto } from '@immich/sdk';
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
import { handleError } from '../../utils/handle-error';

View File

@ -1,6 +1,5 @@
<script lang="ts">
import { type UserResponseDto } from '@api';
import { getAllUsers, getPartners } from '@immich/sdk';
import { getAllUsers, getPartners, type UserResponseDto } from '@immich/sdk';
import { createEventDispatcher, onMount } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import BaseModal from '../shared-components/base-modal.svelte';

View File

@ -1,6 +1,12 @@
<script lang="ts">
import { type PartnerResponseDto, type UserResponseDto } from '@api';
import { createPartner, getPartners, removePartner, updatePartner } from '@immich/sdk';
import {
createPartner,
getPartners,
removePartner,
updatePartner,
type PartnerResponseDto,
type UserResponseDto,
} from '@immich/sdk';
import { mdiCheck, mdiClose } from '@mdi/js';
import { onMount } from 'svelte';
import { handleError } from '../../utils/handle-error';

View File

@ -1,8 +1,7 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { locale } from '$lib/stores/preferences.store';
import { type APIKeyResponseDto } from '@api';
import { createApiKey, deleteApiKey, getApiKeys, updateApiKey } from '@immich/sdk';
import { createApiKey, deleteApiKey, getApiKeys, updateApiKey, type ApiKeyResponseDto } from '@immich/sdk';
import { mdiPencilOutline, mdiTrashCanOutline } from '@mdi/js';
import { fade } from 'svelte/transition';
import { handleError } from '../../utils/handle-error';
@ -12,11 +11,11 @@
import ConfirmDialogue from '../shared-components/confirm-dialogue.svelte';
import { NotificationType, notificationController } from '../shared-components/notification/notification';
export let keys: APIKeyResponseDto[];
export let keys: ApiKeyResponseDto[];
let newKey: Partial<APIKeyResponseDto> | null = null;
let editKey: APIKeyResponseDto | null = null;
let deleteKey: APIKeyResponseDto | null = null;
let newKey: Partial<ApiKeyResponseDto> | null = null;
let editKey: ApiKeyResponseDto | null = null;
let deleteKey: ApiKeyResponseDto | null = null;
let secret = '';
const format: Intl.DateTimeFormatOptions = {
@ -29,7 +28,7 @@
keys = await getApiKeys();
}
const handleCreate = async (detail: Partial<APIKeyResponseDto>) => {
const handleCreate = async (detail: Partial<ApiKeyResponseDto>) => {
try {
const data = await createApiKey({ apiKeyCreateDto: detail });
secret = data.secret;
@ -41,7 +40,7 @@
}
};
const handleUpdate = async (detail: Partial<APIKeyResponseDto>) => {
const handleUpdate = async (detail: Partial<ApiKeyResponseDto>) => {
if (!editKey || !detail.name) {
return;
}

View File

@ -1,25 +1,26 @@
<script lang="ts">
import { browser } from '$app/environment';
import { page } from '$app/stores';
import { OpenSettingQueryParameterValue, QueryParameter } from '$lib/constants';
import { featureFlags } from '$lib/stores/server-config.store';
import { type APIKeyResponseDto, type AuthDeviceResponseDto, oauth } from '@api';
import { user } from '$lib/stores/user.store';
import { oauth } from '$lib/utils';
import { type ApiKeyResponseDto, type AuthDeviceResponseDto } from '@immich/sdk';
import SettingAccordion from '../admin-page/settings/setting-accordion.svelte';
import AppearanceSettings from './appearance-settings.svelte';
import ChangePasswordSettings from './change-password-settings.svelte';
import DeviceList from './device-list.svelte';
import LibraryList from './library-list.svelte';
import MemoriesSettings from './memories-settings.svelte';
import OAuthSettings from './oauth-settings.svelte';
import PartnerSettings from './partner-settings.svelte';
import QualitySettings from './quality-settings.svelte';
import SidebarSettings from './sidebar-settings.svelte';
import TrashSettings from './trash-settings.svelte';
import UserAPIKeyList from './user-api-key-list.svelte';
import UserProfileSettings from './user-profile-settings.svelte';
import { user } from '$lib/stores/user.store';
import { OpenSettingQueryParameterValue, QueryParameter } from '$lib/constants';
import AppearanceSettings from './appearance-settings.svelte';
import TrashSettings from './trash-settings.svelte';
import QualitySettings from './quality-settings.svelte';
export let keys: APIKeyResponseDto[] = [];
export let keys: ApiKeyResponseDto[] = [];
export let devices: AuthDeviceResponseDto[] = [];
let oauthOpen = false;

View File

@ -1,4 +1,4 @@
import type { AssetResponseDto } from '@api';
import type { AssetResponseDto } from '@immich/sdk';
import { derived, writable } from 'svelte/store';
export interface AssetInteractionStore {

View File

@ -1,6 +1,5 @@
import { getKey } from '$lib/utils';
import { type AssetResponseDto } from '@api';
import { getAssetInfo } from '@immich/sdk';
import { getAssetInfo, type AssetResponseDto } from '@immich/sdk';
import { writable } from 'svelte/store';
function createAssetViewingStore() {

View File

@ -1,6 +1,5 @@
import { getKey } from '$lib/utils';
import { getTimeBucket, getTimeBuckets, type AssetResponseDto } from '@immich/sdk';
import { TimeBucketSize, type AssetApiGetTimeBucketsRequest } from '@immich/sdk/axios';
import { TimeBucketSize, getTimeBucket, getTimeBuckets, type AssetResponseDto } from '@immich/sdk';
import { throttle } from 'lodash-es';
import { DateTime } from 'luxon';
import { writable, type Unsubscriber } from 'svelte/store';
@ -13,7 +12,7 @@ export enum BucketPosition {
Visible = 'visible',
Unknown = 'unknown',
}
type AssetApiGetTimeBucketsRequest = Parameters<typeof getTimeBuckets>[0];
export type AssetStoreOptions = Omit<AssetApiGetTimeBucketsRequest, 'size'>;
export interface Viewport {
@ -157,10 +156,7 @@ export class AssetStore {
this.assetToBucket = {};
this.albumAssets = new Set();
const buckets = await getTimeBuckets({
...this.options,
key: getKey(),
});
const buckets = await getTimeBuckets({ ...this.options, key: getKey() });
this.initialized = true;

View File

@ -1,4 +1,4 @@
import type { MemoryLaneResponseDto } from '@immich/sdk';
import { writable } from 'svelte/store';
import type { MemoryLaneResponseDto } from '@api';
export const memoryStore = writable<MemoryLaneResponseDto[]>();

View File

@ -1,5 +1,4 @@
import { type ServerConfigDto, type ServerFeaturesDto } from '@api';
import { getServerConfig, getServerFeatures } from '@immich/sdk';
import { getServerConfig, getServerFeatures, type ServerConfigDto, type ServerFeaturesDto } from '@immich/sdk';
import { writable } from 'svelte/store';
export type FeatureFlags = ServerFeaturesDto & { loaded: boolean };

View File

@ -1,4 +1,4 @@
import type { ServerInfoResponseDto } from '@immich/sdk';
import { writable } from 'svelte/store';
import type { ServerInfoResponseDto } from '@api';
export const serverInfo = writable<ServerInfoResponseDto>();

View File

@ -1,4 +1,4 @@
import type { AssetResponseDto } from '@immich/sdk';
import { writable } from 'svelte/store';
import type { AssetResponseDto } from '@api';
export const stackAssetsStore = writable<AssetResponseDto[]>([]);

View File

@ -1,5 +1,5 @@
import type { UserResponseDto } from '@immich/sdk';
import { writable } from 'svelte/store';
import type { UserResponseDto } from '@api';
export let user = writable<UserResponseDto>();

View File

@ -1,5 +1,5 @@
import type { AssetResponseDto, ServerVersionResponseDto } from '@api';
import { type Socket, io } from 'socket.io-client';
import type { AssetResponseDto, ServerVersionResponseDto } from '@immich/sdk';
import { io, type Socket } from 'socket.io-client';
import { get, writable } from 'svelte/store';
import { loadConfig } from './server-config.store';
import { user } from './user.store';

View File

@ -1,7 +1,20 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { defaults } from '@immich/sdk';
import { AssetJobName, JobName, ThumbnailFormat, common } from '@immich/sdk/axios';
import { NotificationType, notificationController } from '$lib/components/shared-components/notification/notification';
import { handleError } from '$lib/utils/handle-error';
import {
AssetJobName,
JobName,
ThumbnailFormat,
defaults,
finishOAuth,
linkOAuthAccount,
startOAuth,
unlinkOAuthAccount,
type UserResponseDto,
} from '@immich/sdk';
import { common } from '@immich/sdk/axios';
import type { AxiosError } from 'axios';
import { get } from 'svelte/store';
interface UpdateParamAction {
@ -121,3 +134,58 @@ export const getAssetJobMessage = (job: AssetJobName) => {
return messages[job];
};
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<UserResponseDto> => {
return linkOAuthAccount({ oAuthCallbackDto: { url: location.href } });
},
unlink: () => {
return unlinkOAuthAccount();
},
};

View File

@ -1,4 +1,4 @@
import type { AssetResponseDto } from '@api';
import type { AssetResponseDto } from '@immich/sdk';
import { getAssetFilename, getFilenameExtension } from './asset-utils';
describe('get file extension from filename', () => {

View File

@ -1,6 +1,6 @@
import { api } from '$lib/api';
import { notificationController, NotificationType } from '$lib/components/shared-components/notification/notification';
import { downloadManager } from '$lib/stores/download';
import { api } from '@api';
import {
addAssetsToAlbum as addAssets,
getDownloadInfo,

View File

@ -1,10 +1,10 @@
import { api } from '$lib/api';
import { UploadState } from '$lib/models/upload-asset';
import { uploadAssetsStore } from '$lib/stores/upload';
import { getKey } from '$lib/utils';
import { addAssetsToAlbum } from '$lib/utils/asset-utils';
import { ExecutorQueue } from '$lib/utils/executor-queue';
import { api, type AssetFileUploadResponseDto } from '@api';
import { getSupportedMediaTypes } from '@immich/sdk';
import { getSupportedMediaTypes, type AssetFileUploadResponseDto } from '@immich/sdk';
import { getServerErrorMessage, handleError } from './handle-error';
let _extensions: string[];

View File

@ -1,4 +1,4 @@
import type { ApiError } from '@api';
import type { ApiError } from '$lib/utils';
import axios from 'axios';
import { notificationController, NotificationType } from '../components/shared-components/notification/notification';

View File

@ -1,4 +1,4 @@
import type { PersonResponseDto } from '@api';
import type { PersonResponseDto } from '@immich/sdk';
export const searchNameLocal = (
name: string,

View File

@ -1,4 +1,4 @@
import type { AssetResponseDto } from '@api';
import type { AssetResponseDto } from '@immich/sdk';
import { groupBy, sortBy } from 'lodash-es';
import { DateTime, Interval } from 'luxon';

View File

@ -8,42 +8,41 @@
</script>
<script lang="ts">
import { albumViewSettings } from '$lib/stores/preferences.store';
import AlbumCard from '$lib/components/album-page/album-card.svelte';
import { goto } from '$app/navigation';
import AlbumCard from '$lib/components/album-page/album-card.svelte';
import LinkButton from '$lib/components/elements/buttons/link-button.svelte';
import Dropdown from '$lib/components/elements/dropdown.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import TableHeader from '$lib/components/elements/table-header.svelte';
import EditAlbumForm from '$lib/components/forms/edit-album-form.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
import ContextMenu from '$lib/components/shared-components/context-menu/context-menu.svelte';
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
import type { PageData } from './$types';
import { useAlbums } from './albums.bloc';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import LinkButton from '$lib/components/elements/buttons/link-button.svelte';
import { onMount } from 'svelte';
import { flip } from 'svelte/animate';
import Dropdown from '$lib/components/elements/dropdown.svelte';
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
import { AppRoute, dateFormats } from '$lib/constants';
import { locale, AlbumViewMode } from '$lib/stores/preferences.store';
import {
notificationController,
NotificationType,
} from '$lib/components/shared-components/notification/notification';
import type { AlbumResponseDto } from '@api';
import TableHeader from '$lib/components/elements/table-header.svelte';
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
import EditAlbumForm from '$lib/components/forms/edit-album-form.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { orderBy } from 'lodash-es';
import {
mdiPlusBoxOutline,
NotificationType,
notificationController,
} from '$lib/components/shared-components/notification/notification';
import { AppRoute, dateFormats } from '$lib/constants';
import { AlbumViewMode, albumViewSettings, locale } from '$lib/stores/preferences.store';
import type { AlbumResponseDto } from '@immich/sdk';
import {
mdiArrowDownThin,
mdiArrowUpThin,
mdiDeleteOutline,
mdiFormatListBulletedSquare,
mdiPencilOutline,
mdiPlusBoxOutline,
mdiTrashCanOutline,
mdiViewGridOutline,
mdiDeleteOutline,
} from '@mdi/js';
import { orderBy } from 'lodash-es';
import { onMount } from 'svelte';
import { flip } from 'svelte/animate';
import type { PageData } from './$types';
import { useAlbums } from './albums.bloc';
export let data: PageData;

View File

@ -46,8 +46,9 @@
import { getContextMenuPosition } from '$lib/utils/context-menu';
import { openFileUploadDialog } from '$lib/utils/file-uploader';
import { handleError } from '$lib/utils/handle-error';
import { ReactionLevel, ReactionType, type ActivityResponseDto, type UserResponseDto } from '@api';
import {
ReactionLevel,
ReactionType,
addAssetsToAlbum,
addUsersToAlbum,
createActivity,
@ -57,6 +58,8 @@
getActivityStatistics,
getAlbumInfo,
updateAlbumInfo,
type ActivityResponseDto,
type UserResponseDto,
} from '@immich/sdk';
import {
mdiArrowLeft,

View File

@ -10,8 +10,7 @@
import type { MapSettings } from '$lib/stores/preferences.store';
import { mapSettings } from '$lib/stores/preferences.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { type MapMarkerResponseDto } from '@api';
import { getMapMarkers } from '@immich/sdk';
import { getMapMarkers, type MapMarkerResponseDto } from '@immich/sdk';
import { isEqual } from 'lodash-es';
import { DateTime, Duration } from 'luxon';
import { onDestroy, onMount } from 'svelte';

View File

@ -28,8 +28,15 @@
import { handleError } from '$lib/utils/handle-error';
import { searchNameLocal } from '$lib/utils/person';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { type PeopleUpdateItem, type PersonResponseDto } from '@api';
import { getPerson, mergePerson, searchPerson, updatePeople, updatePerson } from '@immich/sdk';
import {
getPerson,
mergePerson,
searchPerson,
updatePeople,
updatePerson,
type PeopleUpdateItem,
type PersonResponseDto,
} from '@immich/sdk';
import { mdiAccountOff, mdiEyeOutline } from '@mdi/js';
import { onDestroy, onMount } from 'svelte';
import type { PageData } from './$types';

View File

@ -31,6 +31,7 @@
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { AssetStore } from '$lib/stores/assets.store';
import { websocketStore } from '$lib/stores/websocket';
import { getPeopleThumbnailUrl } from '$lib/utils';
import { clickOutside } from '$lib/utils/click-outside';
import { handleError } from '$lib/utils/handle-error';
import { isExternalUrl } from '$lib/utils/navigation';
@ -46,7 +47,6 @@
import { mdiArrowLeft, mdiDotsVertical, mdiPlus } from '@mdi/js';
import { onMount } from 'svelte';
import type { PageData } from './$types';
import { getPeopleThumbnailUrl } from '$lib/utils';
export let data: PageData;

View File

@ -1,11 +1,11 @@
<script lang="ts">
import type { SearchExploreResponseDto } from '@api';
import type { PageData } from './$types';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { mdiMapMarkerOff } from '@mdi/js';
import Icon from '$lib/components/elements/icon.svelte';
import { AppRoute } from '$lib/constants';
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { AppRoute } from '$lib/constants';
import type { SearchExploreResponseDto } from '@immich/sdk';
import { mdiMapMarkerOff } from '@mdi/js';
import type { PageData } from './$types';
export let data: PageData;

View File

@ -1,6 +1,10 @@
<script lang="ts">
import { browser } from '$app/environment';
import { afterNavigate, goto } from '$app/navigation';
import { page } from '$app/stores';
import AlbumCard from '$lib/components/album-page/album-card.svelte';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
import ChangeDate from '$lib/components/photos-page/actions/change-date-action.svelte';
@ -14,20 +18,16 @@
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte';
import type { PageData } from './$types';
import Icon from '$lib/components/elements/icon.svelte';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import { AppRoute, QueryParameter } from '$lib/constants';
import AlbumCard from '$lib/components/album-page/album-card.svelte';
import { flip } from 'svelte/animate';
import { onDestroy, onMount } from 'svelte';
import { browser } from '$app/environment';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { preventRaceConditionSearchBar } from '$lib/stores/search.store';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { mdiArrowLeft, mdiDotsVertical, mdiImageOffOutline, mdiPlus, mdiSelectAll } from '@mdi/js';
import { search, type AssetResponseDto, type SearchResponseDto } from '@immich/sdk';
import { authenticate } from '$lib/utils/auth';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
import { search, type AssetResponseDto, type SearchResponseDto } from '@immich/sdk';
import { mdiArrowLeft, mdiDotsVertical, mdiImageOffOutline, mdiPlus, mdiSelectAll } from '@mdi/js';
import { onDestroy, onMount } from 'svelte';
import { flip } from 'svelte/animate';
import type { PageData } from './$types';
export let data: PageData;

View File

@ -7,8 +7,7 @@
import ThemeButton from '$lib/components/shared-components/theme-button.svelte';
import { user } from '$lib/stores/user.store';
import { handleError } from '$lib/utils/handle-error';
import { SharedLinkType } from '@api';
import { getMySharedLink } from '@immich/sdk';
import { getMySharedLink, SharedLinkType } from '@immich/sdk';
import type { PageData } from './$types';
export let data: PageData;

Some files were not shown because too many files have changed in this diff Show More