chore: remove unused packages & code (#27925)

pull/27990/head
Jason Rasmussen 2026-04-20 08:39:46 -04:00 committed by GitHub
parent 0eef15a3ab
commit 94a34436a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 3 additions and 329 deletions

View File

@ -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 = <AssetMediaStatus>[
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) {

View File

@ -16348,7 +16348,6 @@
"description": "Upload status",
"enum": [
"created",
"replaced",
"duplicate"
],
"type": "string"

View File

@ -6899,7 +6899,6 @@ export enum Permission {
}
export enum AssetMediaStatus {
Created = "created",
Replaced = "replaced",
Duplicate = "duplicate"
}
export enum AssetUploadAction {

View File

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

View File

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

View File

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

View File

@ -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<PluginTable>;
export type PluginFilter = Selectable<PluginFilterTable> & {
methodName: string;
title: string;

View File

@ -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';

View File

@ -3,7 +3,6 @@ import z from 'zod';
export enum AssetMediaStatus {
CREATED = 'created',
REPLACED = 'replaced',
DUPLICATE = 'duplicate',
}

View File

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

View File

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

View File

@ -65,13 +65,8 @@ export interface DecodeToBufferOptions extends DecodeImageOptions {
}
export type GenerateThumbnailOptions = Pick<ImageOptions, 'format' | 'quality' | 'progressive'> & DecodeToBufferOptions;
export type GenerateThumbnailFromBufferOptions = GenerateThumbnailOptions & { raw: RawImageInfo };
export type GenerateThumbhashOptions = DecodeImageOptions;
export type GenerateThumbhashFromBufferOptions = GenerateThumbhashOptions & { raw: RawImageInfo };
export interface GenerateThumbnailsOptions {
colorspace: string;
preview?: ImageOptions;

View File

@ -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<void>;
type RepoDeps = {
configRepo: ConfigRepository;
metadataRepo: SystemMetadataRepository;

View File

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

View File

@ -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<SharedLinkResponseDto>({
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<SharedLinkResponseDto>({
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,
}),
};

View File

@ -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: '',
},
};

View File

@ -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<T>(items: T[] = []): AsyncIterableIterator<T> {
for (const item of items) {
await Promise.resolve();