From 94a34436a31e6c9b54ffd43dda5fd73abcca21f5 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Mon, 20 Apr 2026 08:39:46 -0400 Subject: [PATCH] chore: remove unused packages & code (#27925) --- .../openapi/lib/model/asset_media_status.dart | 3 - open-api/immich-openapi-specs.json | 1 - open-api/typescript-sdk/src/fetch-client.ts | 1 - pnpm-lock.yaml | 9 -- server/package.json | 6 +- server/src/constants.ts | 4 - server/src/database.ts | 4 +- server/src/decorators.ts | 13 +-- server/src/dtos/asset-media-response.dto.ts | 1 - server/src/enum.ts | 94 ------------------- server/src/repositories/map.repository.ts | 6 -- server/src/types.ts | 5 - server/src/utils/config.ts | 2 - server/src/utils/maintenance.ts | 49 ---------- server/test/fixtures/shared-link.stub.ts | 52 ---------- server/test/medium/responses.ts | 45 --------- server/test/utils.ts | 37 -------- 17 files changed, 3 insertions(+), 329 deletions(-) diff --git a/mobile/openapi/lib/model/asset_media_status.dart b/mobile/openapi/lib/model/asset_media_status.dart index b45918e5c3..44438f15ab 100644 --- a/mobile/openapi/lib/model/asset_media_status.dart +++ b/mobile/openapi/lib/model/asset_media_status.dart @@ -24,13 +24,11 @@ class AssetMediaStatus { String toJson() => value; static const created = AssetMediaStatus._(r'created'); - static const replaced = AssetMediaStatus._(r'replaced'); static const duplicate = AssetMediaStatus._(r'duplicate'); /// List of all possible values in this [enum][AssetMediaStatus]. static const values = [ created, - replaced, duplicate, ]; @@ -71,7 +69,6 @@ class AssetMediaStatusTypeTransformer { if (data != null) { switch (data) { case r'created': return AssetMediaStatus.created; - case r'replaced': return AssetMediaStatus.replaced; case r'duplicate': return AssetMediaStatus.duplicate; default: if (!allowNull) { diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 852fe907e0..48dca7f6db 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -16348,7 +16348,6 @@ "description": "Upload status", "enum": [ "created", - "replaced", "duplicate" ], "type": "string" diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index da24059a2a..bb269024f6 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -6899,7 +6899,6 @@ export enum Permission { } export enum AssetMediaStatus { Created = "created", - Replaced = "replaced", Duplicate = "duplicate" } export enum AssetUploadAction { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa9ae989ec..0d36a05f4c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -412,9 +412,6 @@ importers: '@socket.io/redis-adapter': specifier: ^8.3.0 version: 8.3.0(socket.io-adapter@2.5.6) - ajv: - specifier: ^8.17.1 - version: 8.18.0 archiver: specifier: ^7.0.0 version: 7.0.1 @@ -523,9 +520,6 @@ importers: pg: specifier: ^8.11.3 version: 8.20.0 - pg-connection-string: - specifier: ^2.9.1 - version: 2.12.0 picomatch: specifier: ^4.0.2 version: 4.0.4 @@ -689,9 +683,6 @@ importers: mock-fs: specifier: ^5.2.0 version: 5.5.0 - node-gyp: - specifier: ^12.0.0 - version: 12.2.0 pngjs: specifier: ^7.0.0 version: 7.0.0 diff --git a/server/package.json b/server/package.json index 497e724127..a4723c906b 100644 --- a/server/package.json +++ b/server/package.json @@ -26,7 +26,6 @@ "test": "vitest --config test/vitest.config.mjs", "test:cov": "vitest --config test/vitest.config.mjs --coverage", "test:medium": "vitest --config test/vitest.config.medium.mjs", - "typeorm": "typeorm", "migrations:debug": "sql-tools -u ${DB_URL:-postgres://postgres:postgres@localhost:5432/immich} migrations generate --debug", "migrations:generate": "sql-tools -u ${DB_URL:-postgres://postgres:postgres@localhost:5432/immich} migrations generate", "migrations:create": "sql-tools -u ${DB_URL:-postgres://postgres:postgres@localhost:5432/immich} migrations create", @@ -63,7 +62,6 @@ "@react-email/components": "^1.0.0", "@react-email/render": "^2.0.0", "@socket.io/redis-adapter": "^8.3.0", - "ajv": "^8.17.1", "archiver": "^7.0.0", "async-lock": "^1.4.0", "bcrypt": "^6.0.0", @@ -96,11 +94,10 @@ "nestjs-cls": "^6.0.0", "nestjs-kysely": "3.1.2", "nestjs-otel": "^7.0.0", - "nodemailer": "^8.0.0", "nestjs-zod": "^5.3.0", + "nodemailer": "^8.0.0", "openid-client": "^6.3.3", "pg": "^8.11.3", - "pg-connection-string": "^2.9.1", "picomatch": "^4.0.2", "postgres": "3.4.8", "react": "^19.0.0", @@ -157,7 +154,6 @@ "eslint-plugin-unicorn": "^64.0.0", "globals": "^17.0.0", "mock-fs": "^5.2.0", - "node-gyp": "^12.0.0", "pngjs": "^7.0.0", "prettier": "^3.7.4", "prettier-plugin-organize-imports": "^4.0.0", diff --git a/server/src/constants.ts b/server/src/constants.ts index 4f8d9342c7..20249bf1ca 100644 --- a/server/src/constants.ts +++ b/server/src/constants.ts @@ -1,4 +1,3 @@ -import { Duration } from 'luxon'; import { readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { SemVer } from 'semver'; @@ -52,9 +51,6 @@ const packageFile = join(basePath, '..', 'package.json'); const { version } = JSON.parse(readFileSync(packageFile, 'utf8')); export const serverVersion = new SemVer(version); -export const AUDIT_LOG_MAX_DURATION = Duration.fromObject({ days: 100 }); -export const ONE_HOUR = Duration.fromObject({ hours: 1 }); - export const citiesFile = 'cities500.txt'; export const reverseGeocodeMaxDistance = 25_000; diff --git a/server/src/database.ts b/server/src/database.ts index 7235af46fa..29d0353891 100644 --- a/server/src/database.ts +++ b/server/src/database.ts @@ -18,7 +18,7 @@ import { import { AlbumTable } from 'src/schema/tables/album.table'; import { AssetExifTable } from 'src/schema/tables/asset-exif.table'; import { AssetTable } from 'src/schema/tables/asset.table'; -import { PluginActionTable, PluginFilterTable, PluginTable } from 'src/schema/tables/plugin.table'; +import { PluginActionTable, PluginFilterTable } from 'src/schema/tables/plugin.table'; import { WorkflowActionTable, WorkflowFilterTable, WorkflowTable } from 'src/schema/tables/workflow.table'; import { UserMetadataItem } from 'src/types'; import type { ActionConfig, FilterConfig, JSONSchema } from 'src/types/plugin-schema.types'; @@ -277,8 +277,6 @@ export type AssetFace = { isVisible: boolean; }; -export type Plugin = Selectable; - export type PluginFilter = Selectable & { methodName: string; title: string; diff --git a/server/src/decorators.ts b/server/src/decorators.ts index a5c5bf38db..75a3463ee7 100644 --- a/server/src/decorators.ts +++ b/server/src/decorators.ts @@ -1,6 +1,6 @@ import { BeforeUpdateTrigger, Column, ColumnOptions } from '@immich/sql-tools'; import { SetMetadata, applyDecorators } from '@nestjs/common'; -import { ApiOperation, ApiOperationOptions, ApiProperty, ApiPropertyOptions, ApiTags } from '@nestjs/swagger'; +import { ApiOperation, ApiOperationOptions, ApiTags } from '@nestjs/swagger'; import _ from 'lodash'; import { ApiCustomExtension, ApiTag, ImmichWorker, JobName, MetadataKey, QueueName } from 'src/enum'; import { EmitEvent } from 'src/repositories/event.repository'; @@ -172,17 +172,6 @@ export const Endpoint = ({ history, ...options }: EndpointOptions) => { return applyDecorators(...decorators); }; -export type PropertyOptions = ApiPropertyOptions & { history?: HistoryBuilder }; -export const Property = ({ history, ...options }: PropertyOptions) => { - const extensions = history?.getExtensions() ?? {}; - - if (history?.isDeprecated()) { - options.deprecated = true; - } - - return ApiProperty({ ...options, ...extensions }); -}; - type HistoryEntry = { version: string; state: ApiState | 'Added' | 'Updated'; diff --git a/server/src/dtos/asset-media-response.dto.ts b/server/src/dtos/asset-media-response.dto.ts index ab79b8428c..0f27fc5974 100644 --- a/server/src/dtos/asset-media-response.dto.ts +++ b/server/src/dtos/asset-media-response.dto.ts @@ -3,7 +3,6 @@ import z from 'zod'; export enum AssetMediaStatus { CREATED = 'created', - REPLACED = 'replaced', DUPLICATE = 'duplicate', } diff --git a/server/src/enum.ts b/server/src/enum.ts index 08d710e08c..76e1841a89 100644 --- a/server/src/enum.ts +++ b/server/src/enum.ts @@ -5,8 +5,6 @@ export enum AuthType { OAuth = 'oauth', } -export const AuthTypeSchema = z.enum(AuthType).describe('Auth type').meta({ id: 'AuthType' }); - export enum ImmichCookie { AccessToken = 'immich_access_token', MaintenanceToken = 'immich_maintenance_token', @@ -17,8 +15,6 @@ export enum ImmichCookie { OAuthCodeVerifier = 'immich_oauth_code_verifier', } -export const ImmichCookieSchema = z.enum(ImmichCookie).describe('Immich cookie').meta({ id: 'ImmichCookie' }); - export enum ImmichHeader { ApiKey = 'x-api-key', UserToken = 'x-immich-user-token', @@ -29,8 +25,6 @@ export enum ImmichHeader { Cid = 'x-immich-cid', } -export const ImmichHeaderSchema = z.enum(ImmichHeader).describe('Immich header').meta({ id: 'ImmichHeader' }); - export enum ImmichQuery { SharedLinkKey = 'key', SharedLinkSlug = 'slug', @@ -38,8 +32,6 @@ export enum ImmichQuery { SessionKey = 'sessionKey', } -export const ImmichQuerySchema = z.enum(ImmichQuery).describe('Immich query').meta({ id: 'ImmichQuery' }); - export enum AssetType { Image = 'IMAGE', Video = 'VIDEO', @@ -56,11 +48,6 @@ export enum ChecksumAlgorithm { sha1Path = 'sha1-path', } -export const ChecksumAlgorithmSchema = z - .enum(ChecksumAlgorithm) - .describe('Checksum algorithm') - .meta({ id: 'ChecksumAlgorithmEnum' }); - export enum AssetFileType { /** * An full/large-size image extracted/converted from RAW photos @@ -72,8 +59,6 @@ export enum AssetFileType { EncodedVideo = 'encoded_video', } -export const AssetFileTypeSchema = z.enum(AssetFileType).describe('Asset file type').meta({ id: 'AssetFileType' }); - export enum AlbumUserRole { Editor = 'editor', Viewer = 'viewer', @@ -313,8 +298,6 @@ export enum Permission { AdminAuthUnlinkAll = 'adminAuth.unlinkAll', } -export const PermissionSchema = z.enum(Permission).describe('Permission').meta({ id: 'Permission' }); - export enum SharedLinkType { Album = 'ALBUM', @@ -351,11 +334,6 @@ export enum SystemMetadataKey { License = 'license', } -export const SystemMetadataKeySchema = z - .enum(SystemMetadataKey) - .describe('System metadata key') - .meta({ id: 'SystemMetadataKey' }); - export enum UserMetadataKey { Preferences = 'preferences', License = 'license', @@ -371,11 +349,6 @@ export enum AssetMetadataKey { MobileApp = 'mobile-app', } -export const AssetMetadataKeySchema = z - .enum(AssetMetadataKey) - .describe('Asset metadata key') - .meta({ id: 'AssetMetadataKey' }); - export enum UserAvatarColor { Primary = 'primary', Pink = 'pink', @@ -408,8 +381,6 @@ export enum AssetStatus { Deleted = 'deleted', } -export const AssetStatusSchema = z.enum(AssetStatus).describe('Asset status').meta({ id: 'AssetStatus' }); - export enum SourceType { MachineLearning = 'machine-learning', Exif = 'exif', @@ -434,20 +405,14 @@ export enum AssetPathType { EncodedVideo = 'encoded_video', } -export const AssetPathTypeSchema = z.enum(AssetPathType).describe('Asset path type').meta({ id: 'AssetPathType' }); - export enum PersonPathType { Face = 'face', } -export const PersonPathTypeSchema = z.enum(PersonPathType).describe('Person path type').meta({ id: 'PersonPathType' }); - export enum UserPathType { Profile = 'profile', } -export const UserPathTypeSchema = z.enum(UserPathType).describe('User path type').meta({ id: 'UserPathType' }); - export type PathType = AssetFileType | AssetPathType | PersonPathType | UserPathType; export enum TranscodePolicy { @@ -470,11 +435,6 @@ export enum TranscodeTarget { All = 'ALL', } -export const TranscodeTargetSchema = z - .enum(TranscodeTarget) - .describe('Transcode target') - .meta({ id: 'TranscodeTarget' }); - export enum VideoCodec { H264 = 'h264', Hevc = 'hevc', @@ -556,11 +516,6 @@ export enum RawExtractedFormat { Jxl = 'jxl', } -export const RawExtractedFormatSchema = z - .enum(RawExtractedFormat) - .describe('Raw extracted format') - .meta({ id: 'RawExtractedFormat' }); - export enum LogLevel { Verbose = 'verbose', Debug = 'debug', @@ -586,38 +541,25 @@ export enum ApiCustomExtension { State = 'x-immich-state', } -export const ApiCustomExtensionSchema = z - .enum(ApiCustomExtension) - .describe('API custom extension') - .meta({ id: 'ApiCustomExtension' }); - export enum MetadataKey { AuthRoute = 'auth_route', - AdminRoute = 'admin_route', - SharedRoute = 'shared_route', ApiKeySecurity = 'api_key', EventConfig = 'event_config', JobConfig = 'job_config', TelemetryEnabled = 'telemetry_enabled', } -export const MetadataKeySchema = z.enum(MetadataKey).describe('Metadata key').meta({ id: 'MetadataKey' }); - export enum RouteKey { Asset = 'assets', User = 'users', } -export const RouteKeySchema = z.enum(RouteKey).describe('Route key').meta({ id: 'RouteKey' }); - export enum CacheControl { PrivateWithCache = 'private_with_cache', PrivateWithoutCache = 'private_without_cache', None = 'none', } -export const CacheControlSchema = z.enum(CacheControl).describe('Cache control').meta({ id: 'CacheControl' }); - export enum ImmichEnvironment { Development = 'development', Testing = 'testing', @@ -635,8 +577,6 @@ export enum ImmichWorker { Microservices = 'microservices', } -export const ImmichWorkerSchema = z.enum(ImmichWorker).describe('Immich worker').meta({ id: 'ImmichWorker' }); - export enum ImmichTelemetry { Host = 'host', Api = 'api', @@ -645,11 +585,6 @@ export enum ImmichTelemetry { Job = 'job', } -export const ImmichTelemetrySchema = z - .enum(ImmichTelemetry) - .describe('Immich telemetry') - .meta({ id: 'ImmichTelemetry' }); - export enum ExifOrientation { Horizontal = 1, MirrorHorizontal = 2, @@ -661,11 +596,6 @@ export enum ExifOrientation { Rotate270CW = 8, } -export const ExifOrientationSchema = z - .enum(ExifOrientation) - .describe('EXIF orientation') - .meta({ id: 'ExifOrientation' }); - export enum DatabaseExtension { Cube = 'cube', EarthDistance = 'earthdistance', @@ -674,11 +604,6 @@ export enum DatabaseExtension { VectorChord = 'vchord', } -export const DatabaseExtensionSchema = z - .enum(DatabaseExtension) - .describe('Database extension') - .meta({ id: 'DatabaseExtension' }); - export enum BootstrapEventPriority { // Database service should be initialized before anything else, most other services need database access DatabaseService = -200, @@ -690,11 +615,6 @@ export enum BootstrapEventPriority { SystemConfig = 100, } -export const BootstrapEventPrioritySchema = z - .enum(BootstrapEventPriority) - .describe('Bootstrap event priority') - .meta({ id: 'BootstrapEventPriority' }); - export enum QueueName { ThumbnailGeneration = 'thumbnailGeneration', MetadataExtraction = 'metadataExtraction', @@ -833,21 +753,15 @@ export enum JobStatus { Skipped = 'skipped', } -export const JobStatusSchema = z.enum(JobStatus).describe('Job status').meta({ id: 'JobStatus' }); - export enum QueueCleanType { Failed = 'failed', } -export const QueueCleanTypeSchema = z.enum(QueueCleanType).describe('Queue clean type').meta({ id: 'QueueCleanType' }); - export enum VectorIndex { Clip = 'clip_index', Face = 'face_index', } -export const VectorIndexSchema = z.enum(VectorIndex).describe('Vector index').meta({ id: 'VectorIndex' }); - export enum DatabaseLock { GeodataImport = 100, Migrations = 200, @@ -865,8 +779,6 @@ export enum DatabaseLock { VersionCheck = 800, } -export const DatabaseLockSchema = z.enum(DatabaseLock).describe('Database lock').meta({ id: 'DatabaseLock' }); - export enum MaintenanceAction { Start = 'start', End = 'end', @@ -883,8 +795,6 @@ export enum ExitCode { AppRestart = 7, } -export const ExitCodeSchema = z.enum(ExitCode).describe('Exit code').meta({ id: 'ExitCode' }); - export enum SyncRequestType { AlbumsV1 = 'AlbumsV1', AlbumUsersV1 = 'AlbumUsersV1', @@ -1043,8 +953,6 @@ export enum CronJob { VersionCheck = 'VersionCheck', } -export const CronJobSchema = z.enum(CronJob).describe('Cron job').meta({ id: 'CronJob' }); - export enum ApiTag { Activities = 'Activities', Albums = 'Albums', @@ -1085,8 +993,6 @@ export enum ApiTag { Workflows = 'Workflows', } -export const ApiTagSchema = z.enum(ApiTag).describe('API tag').meta({ id: 'ApiTag' }); - export enum PluginContext { Asset = 'asset', Album = 'album', diff --git a/server/src/repositories/map.repository.ts b/server/src/repositories/map.repository.ts index 7c384b44b2..909a35c1e1 100644 --- a/server/src/repositories/map.repository.ts +++ b/server/src/repositories/map.repository.ts @@ -33,12 +33,6 @@ export interface ReverseGeocodeResult { city: string | null; } -export interface MapMarker extends ReverseGeocodeResult { - id: string; - lat: number; - lon: number; -} - interface MapDB extends DB { geodata_places_tmp: GeodataPlacesTable; naturalearth_countries_tmp: NaturalEarthCountriesTable; diff --git a/server/src/types.ts b/server/src/types.ts index f9bde47aae..a69bd79dff 100644 --- a/server/src/types.ts +++ b/server/src/types.ts @@ -65,13 +65,8 @@ export interface DecodeToBufferOptions extends DecodeImageOptions { } export type GenerateThumbnailOptions = Pick & DecodeToBufferOptions; - -export type GenerateThumbnailFromBufferOptions = GenerateThumbnailOptions & { raw: RawImageInfo }; - export type GenerateThumbhashOptions = DecodeImageOptions; -export type GenerateThumbhashFromBufferOptions = GenerateThumbhashOptions & { raw: RawImageInfo }; - export interface GenerateThumbnailsOptions { colorspace: string; preview?: ImageOptions; diff --git a/server/src/utils/config.ts b/server/src/utils/config.ts index df7d05978c..62f37128d8 100644 --- a/server/src/utils/config.ts +++ b/server/src/utils/config.ts @@ -10,8 +10,6 @@ import { SystemMetadataRepository } from 'src/repositories/system-metadata.repos import { DeepPartial } from 'src/types'; import { getKeysDeep, unsetDeep } from 'src/utils/misc'; -export type SystemConfigValidator = (config: SystemConfig, newConfig: SystemConfig) => void | Promise; - type RepoDeps = { configRepo: ConfigRepository; metadataRepo: SystemMetadataRepository; diff --git a/server/src/utils/maintenance.ts b/server/src/utils/maintenance.ts index 47abb0ab89..44b98f3f75 100644 --- a/server/src/utils/maintenance.ts +++ b/server/src/utils/maintenance.ts @@ -1,60 +1,11 @@ -import { createAdapter } from '@socket.io/redis-adapter'; -import Redis from 'ioredis'; import { SignJWT } from 'jose'; import { randomBytes } from 'node:crypto'; import { join } from 'node:path'; -import { Server as SocketIO } from 'socket.io'; import { StorageCore } from 'src/cores/storage.core'; import { MaintenanceAuthDto, MaintenanceDetectInstallResponseDto } from 'src/dtos/maintenance.dto'; import { StorageFolder } from 'src/enum'; -import { ConfigRepository } from 'src/repositories/config.repository'; -import { AppRestartEvent } from 'src/repositories/event.repository'; import { StorageRepository } from 'src/repositories/storage.repository'; -export function sendOneShotAppRestart(state: AppRestartEvent): void { - const server = new SocketIO(); - const { redis } = new ConfigRepository().getEnv(); - const pubClient = new Redis(redis); - const subClient = pubClient.duplicate(); - server.adapter(createAdapter(pubClient, subClient)); - - /** - * Keep trying until we manage to stop Immich - * - * Sometimes there appear to be communication - * issues between to the other servers. - * - * This issue only occurs with this method. - */ - async function tryTerminate() { - while (true) { - try { - const responses = await server.serverSideEmitWithAck('AppRestart', state); - if (responses.length > 0) { - return; - } - } catch (error) { - console.error(error); - console.error('Encountered an error while telling Immich to stop.'); - } - - console.info( - "\nIt doesn't appear that Immich stopped, trying again in a moment.\nIf Immich is already not running, you can ignore this error.", - ); - - await new Promise((r) => setTimeout(r, 1e3)); - } - } - - // => corresponds to notification.service.ts#onAppRestart - server.emit('AppRestartV1', state, () => { - void tryTerminate().finally(() => { - pubClient.disconnect(); - subClient.disconnect(); - }); - }); -} - export async function createMaintenanceLoginUrl( baseUrl: string, auth: MaintenanceAuthDto, diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts index ac073c299d..7a3adc0437 100644 --- a/server/test/fixtures/shared-link.stub.ts +++ b/server/test/fixtures/shared-link.stub.ts @@ -1,5 +1,4 @@ import { MapAsset } from 'src/dtos/asset-response.dto'; -import { SharedLinkResponseDto } from 'src/dtos/shared-link.dto'; import { SharedLinkType } from 'src/enum'; import { AssetFactory } from 'test/factories/asset.factory'; import { authStub } from 'test/fixtures/auth.stub'; @@ -70,23 +69,6 @@ export const sharedLinkStub = { album: null, slug: null, }), - readonlyNoExif: Object.freeze({ - id: '123', - userId: authStub.admin.user.id, - key: sharedLinkBytes, - type: SharedLinkType.Individual, - createdAt: today, - expiresAt: tomorrow, - allowUpload: false, - allowDownload: false, - showExif: false, - description: null, - password: null, - assets: [], - albumId: null, - album: null, - slug: null, - }), passwordRequired: Object.freeze({ id: '123', userId: authStub.admin.user.id, @@ -105,37 +87,3 @@ export const sharedLinkStub = { album: null, }), }; - -export const sharedLinkResponseStub = { - valid: Object.freeze({ - allowDownload: true, - allowUpload: true, - assets: [], - createdAt: today, - description: null, - password: null, - expiresAt: tomorrow, - id: '123', - key: sharedLinkBytes.toString('base64url'), - showMetadata: true, - type: SharedLinkType.Album, - userId: 'admin_id', - slug: null, - }), - expired: Object.freeze({ - album: undefined, - allowDownload: true, - allowUpload: true, - assets: [], - createdAt: today, - description: null, - password: null, - expiresAt: yesterday, - id: '123', - key: sharedLinkBytes.toString('base64url'), - showMetadata: true, - type: SharedLinkType.Album, - userId: 'admin_id', - slug: null, - }), -}; diff --git a/server/test/medium/responses.ts b/server/test/medium/responses.ts index e9f9daaf76..dcc4cdd177 100644 --- a/server/test/medium/responses.ts +++ b/server/test/medium/responses.ts @@ -67,48 +67,3 @@ export const errorDto = { correlationId: expect.any(String), }, }; - -export const signupResponseDto = { - admin: { - avatarColor: expect.any(String), - id: expect.any(String), - name: 'Immich Admin', - email: 'admin@immich.cloud', - storageLabel: 'admin', - profileImagePath: '', - // why? lol - shouldChangePassword: true, - isAdmin: true, - createdAt: expect.any(String), - updatedAt: expect.any(String), - deletedAt: null, - oauthId: '', - quotaUsageInBytes: 0, - quotaSizeInBytes: null, - status: 'active', - license: null, - profileChangedAt: expect.any(String), - }, -}; - -export const loginResponseDto = { - admin: { - accessToken: expect.any(String), - name: 'Immich Admin', - isAdmin: true, - profileImagePath: '', - shouldChangePassword: true, - userEmail: 'admin@immich.cloud', - userId: expect.any(String), - }, -}; -export const deviceDto = { - current: { - id: expect.any(String), - createdAt: expect.any(String), - updatedAt: expect.any(String), - current: true, - deviceOS: '', - deviceType: '', - }, -}; diff --git a/server/test/utils.ts b/server/test/utils.ts index 7e47afbb01..3c5967ae50 100644 --- a/server/test/utils.ts +++ b/server/test/utils.ts @@ -531,43 +531,6 @@ export const mockDuplex = return duplex; }; -export const mockFork = vitest.fn((exitCode: number, stdout: string, stderr: string, error?: unknown) => { - const stdoutStream = new Readable({ - read() { - this.push(stdout); // write mock data to stdout - this.push(null); // end stream - }, - }); - - return { - stdout: stdoutStream, - stderr: new Readable({ - read() { - this.push(stderr); // write mock data to stderr - this.push(null); // end stream - }, - }), - stdin: new Writable({ - write(chunk, encoding, callback) { - callback(); - }, - }), - exitCode, - on: vitest.fn((event, callback: any) => { - if (event === 'close') { - stdoutStream.once('end', () => callback(0)); - } - if (event === 'error' && error) { - stdoutStream.once('end', () => callback(error)); - } - if (event === 'exit') { - stdoutStream.once('end', () => callback(exitCode)); - } - }), - kill: vitest.fn(), - } as unknown as ChildProcessWithoutNullStreams; -}); - export async function* makeStream(items: T[] = []): AsyncIterableIterator { for (const item of items) { await Promise.resolve();