chore: remove unused packages & code (#27925)

This commit is contained in:
Jason Rasmussen
2026-04-20 08:39:46 -04:00
committed by GitHub
parent 0eef15a3ab
commit 94a34436a3
17 changed files with 3 additions and 329 deletions
-3
View File
@@ -24,13 +24,11 @@ class AssetMediaStatus {
String toJson() => value; String toJson() => value;
static const created = AssetMediaStatus._(r'created'); static const created = AssetMediaStatus._(r'created');
static const replaced = AssetMediaStatus._(r'replaced');
static const duplicate = AssetMediaStatus._(r'duplicate'); static const duplicate = AssetMediaStatus._(r'duplicate');
/// List of all possible values in this [enum][AssetMediaStatus]. /// List of all possible values in this [enum][AssetMediaStatus].
static const values = <AssetMediaStatus>[ static const values = <AssetMediaStatus>[
created, created,
replaced,
duplicate, duplicate,
]; ];
@@ -71,7 +69,6 @@ class AssetMediaStatusTypeTransformer {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case r'created': return AssetMediaStatus.created; case r'created': return AssetMediaStatus.created;
case r'replaced': return AssetMediaStatus.replaced;
case r'duplicate': return AssetMediaStatus.duplicate; case r'duplicate': return AssetMediaStatus.duplicate;
default: default:
if (!allowNull) { if (!allowNull) {
-1
View File
@@ -16348,7 +16348,6 @@
"description": "Upload status", "description": "Upload status",
"enum": [ "enum": [
"created", "created",
"replaced",
"duplicate" "duplicate"
], ],
"type": "string" "type": "string"
@@ -6899,7 +6899,6 @@ export enum Permission {
} }
export enum AssetMediaStatus { export enum AssetMediaStatus {
Created = "created", Created = "created",
Replaced = "replaced",
Duplicate = "duplicate" Duplicate = "duplicate"
} }
export enum AssetUploadAction { export enum AssetUploadAction {
-9
View File
@@ -412,9 +412,6 @@ importers:
'@socket.io/redis-adapter': '@socket.io/redis-adapter':
specifier: ^8.3.0 specifier: ^8.3.0
version: 8.3.0(socket.io-adapter@2.5.6) version: 8.3.0(socket.io-adapter@2.5.6)
ajv:
specifier: ^8.17.1
version: 8.18.0
archiver: archiver:
specifier: ^7.0.0 specifier: ^7.0.0
version: 7.0.1 version: 7.0.1
@@ -523,9 +520,6 @@ importers:
pg: pg:
specifier: ^8.11.3 specifier: ^8.11.3
version: 8.20.0 version: 8.20.0
pg-connection-string:
specifier: ^2.9.1
version: 2.12.0
picomatch: picomatch:
specifier: ^4.0.2 specifier: ^4.0.2
version: 4.0.4 version: 4.0.4
@@ -689,9 +683,6 @@ importers:
mock-fs: mock-fs:
specifier: ^5.2.0 specifier: ^5.2.0
version: 5.5.0 version: 5.5.0
node-gyp:
specifier: ^12.0.0
version: 12.2.0
pngjs: pngjs:
specifier: ^7.0.0 specifier: ^7.0.0
version: 7.0.0 version: 7.0.0
+1 -5
View File
@@ -26,7 +26,6 @@
"test": "vitest --config test/vitest.config.mjs", "test": "vitest --config test/vitest.config.mjs",
"test:cov": "vitest --config test/vitest.config.mjs --coverage", "test:cov": "vitest --config test/vitest.config.mjs --coverage",
"test:medium": "vitest --config test/vitest.config.medium.mjs", "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: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: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", "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/components": "^1.0.0",
"@react-email/render": "^2.0.0", "@react-email/render": "^2.0.0",
"@socket.io/redis-adapter": "^8.3.0", "@socket.io/redis-adapter": "^8.3.0",
"ajv": "^8.17.1",
"archiver": "^7.0.0", "archiver": "^7.0.0",
"async-lock": "^1.4.0", "async-lock": "^1.4.0",
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",
@@ -96,11 +94,10 @@
"nestjs-cls": "^6.0.0", "nestjs-cls": "^6.0.0",
"nestjs-kysely": "3.1.2", "nestjs-kysely": "3.1.2",
"nestjs-otel": "^7.0.0", "nestjs-otel": "^7.0.0",
"nodemailer": "^8.0.0",
"nestjs-zod": "^5.3.0", "nestjs-zod": "^5.3.0",
"nodemailer": "^8.0.0",
"openid-client": "^6.3.3", "openid-client": "^6.3.3",
"pg": "^8.11.3", "pg": "^8.11.3",
"pg-connection-string": "^2.9.1",
"picomatch": "^4.0.2", "picomatch": "^4.0.2",
"postgres": "3.4.8", "postgres": "3.4.8",
"react": "^19.0.0", "react": "^19.0.0",
@@ -157,7 +154,6 @@
"eslint-plugin-unicorn": "^64.0.0", "eslint-plugin-unicorn": "^64.0.0",
"globals": "^17.0.0", "globals": "^17.0.0",
"mock-fs": "^5.2.0", "mock-fs": "^5.2.0",
"node-gyp": "^12.0.0",
"pngjs": "^7.0.0", "pngjs": "^7.0.0",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"prettier-plugin-organize-imports": "^4.0.0", "prettier-plugin-organize-imports": "^4.0.0",
-4
View File
@@ -1,4 +1,3 @@
import { Duration } from 'luxon';
import { readFileSync } from 'node:fs'; import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path'; import { dirname, join } from 'node:path';
import { SemVer } from 'semver'; import { SemVer } from 'semver';
@@ -52,9 +51,6 @@ const packageFile = join(basePath, '..', 'package.json');
const { version } = JSON.parse(readFileSync(packageFile, 'utf8')); const { version } = JSON.parse(readFileSync(packageFile, 'utf8'));
export const serverVersion = new SemVer(version); 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 citiesFile = 'cities500.txt';
export const reverseGeocodeMaxDistance = 25_000; export const reverseGeocodeMaxDistance = 25_000;
+1 -3
View File
@@ -18,7 +18,7 @@ import {
import { AlbumTable } from 'src/schema/tables/album.table'; import { AlbumTable } from 'src/schema/tables/album.table';
import { AssetExifTable } from 'src/schema/tables/asset-exif.table'; import { AssetExifTable } from 'src/schema/tables/asset-exif.table';
import { AssetTable } from 'src/schema/tables/asset.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 { WorkflowActionTable, WorkflowFilterTable, WorkflowTable } from 'src/schema/tables/workflow.table';
import { UserMetadataItem } from 'src/types'; import { UserMetadataItem } from 'src/types';
import type { ActionConfig, FilterConfig, JSONSchema } from 'src/types/plugin-schema.types'; import type { ActionConfig, FilterConfig, JSONSchema } from 'src/types/plugin-schema.types';
@@ -277,8 +277,6 @@ export type AssetFace = {
isVisible: boolean; isVisible: boolean;
}; };
export type Plugin = Selectable<PluginTable>;
export type PluginFilter = Selectable<PluginFilterTable> & { export type PluginFilter = Selectable<PluginFilterTable> & {
methodName: string; methodName: string;
title: string; title: string;
+1 -12
View File
@@ -1,6 +1,6 @@
import { BeforeUpdateTrigger, Column, ColumnOptions } from '@immich/sql-tools'; import { BeforeUpdateTrigger, Column, ColumnOptions } from '@immich/sql-tools';
import { SetMetadata, applyDecorators } from '@nestjs/common'; 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 _ from 'lodash';
import { ApiCustomExtension, ApiTag, ImmichWorker, JobName, MetadataKey, QueueName } from 'src/enum'; import { ApiCustomExtension, ApiTag, ImmichWorker, JobName, MetadataKey, QueueName } from 'src/enum';
import { EmitEvent } from 'src/repositories/event.repository'; import { EmitEvent } from 'src/repositories/event.repository';
@@ -172,17 +172,6 @@ export const Endpoint = ({ history, ...options }: EndpointOptions) => {
return applyDecorators(...decorators); 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 = { type HistoryEntry = {
version: string; version: string;
state: ApiState | 'Added' | 'Updated'; state: ApiState | 'Added' | 'Updated';
@@ -3,7 +3,6 @@ import z from 'zod';
export enum AssetMediaStatus { export enum AssetMediaStatus {
CREATED = 'created', CREATED = 'created',
REPLACED = 'replaced',
DUPLICATE = 'duplicate', DUPLICATE = 'duplicate',
} }
-94
View File
@@ -5,8 +5,6 @@ export enum AuthType {
OAuth = 'oauth', OAuth = 'oauth',
} }
export const AuthTypeSchema = z.enum(AuthType).describe('Auth type').meta({ id: 'AuthType' });
export enum ImmichCookie { export enum ImmichCookie {
AccessToken = 'immich_access_token', AccessToken = 'immich_access_token',
MaintenanceToken = 'immich_maintenance_token', MaintenanceToken = 'immich_maintenance_token',
@@ -17,8 +15,6 @@ export enum ImmichCookie {
OAuthCodeVerifier = 'immich_oauth_code_verifier', OAuthCodeVerifier = 'immich_oauth_code_verifier',
} }
export const ImmichCookieSchema = z.enum(ImmichCookie).describe('Immich cookie').meta({ id: 'ImmichCookie' });
export enum ImmichHeader { export enum ImmichHeader {
ApiKey = 'x-api-key', ApiKey = 'x-api-key',
UserToken = 'x-immich-user-token', UserToken = 'x-immich-user-token',
@@ -29,8 +25,6 @@ export enum ImmichHeader {
Cid = 'x-immich-cid', Cid = 'x-immich-cid',
} }
export const ImmichHeaderSchema = z.enum(ImmichHeader).describe('Immich header').meta({ id: 'ImmichHeader' });
export enum ImmichQuery { export enum ImmichQuery {
SharedLinkKey = 'key', SharedLinkKey = 'key',
SharedLinkSlug = 'slug', SharedLinkSlug = 'slug',
@@ -38,8 +32,6 @@ export enum ImmichQuery {
SessionKey = 'sessionKey', SessionKey = 'sessionKey',
} }
export const ImmichQuerySchema = z.enum(ImmichQuery).describe('Immich query').meta({ id: 'ImmichQuery' });
export enum AssetType { export enum AssetType {
Image = 'IMAGE', Image = 'IMAGE',
Video = 'VIDEO', Video = 'VIDEO',
@@ -56,11 +48,6 @@ export enum ChecksumAlgorithm {
sha1Path = 'sha1-path', sha1Path = 'sha1-path',
} }
export const ChecksumAlgorithmSchema = z
.enum(ChecksumAlgorithm)
.describe('Checksum algorithm')
.meta({ id: 'ChecksumAlgorithmEnum' });
export enum AssetFileType { export enum AssetFileType {
/** /**
* An full/large-size image extracted/converted from RAW photos * An full/large-size image extracted/converted from RAW photos
@@ -72,8 +59,6 @@ export enum AssetFileType {
EncodedVideo = 'encoded_video', EncodedVideo = 'encoded_video',
} }
export const AssetFileTypeSchema = z.enum(AssetFileType).describe('Asset file type').meta({ id: 'AssetFileType' });
export enum AlbumUserRole { export enum AlbumUserRole {
Editor = 'editor', Editor = 'editor',
Viewer = 'viewer', Viewer = 'viewer',
@@ -313,8 +298,6 @@ export enum Permission {
AdminAuthUnlinkAll = 'adminAuth.unlinkAll', AdminAuthUnlinkAll = 'adminAuth.unlinkAll',
} }
export const PermissionSchema = z.enum(Permission).describe('Permission').meta({ id: 'Permission' });
export enum SharedLinkType { export enum SharedLinkType {
Album = 'ALBUM', Album = 'ALBUM',
@@ -351,11 +334,6 @@ export enum SystemMetadataKey {
License = 'license', License = 'license',
} }
export const SystemMetadataKeySchema = z
.enum(SystemMetadataKey)
.describe('System metadata key')
.meta({ id: 'SystemMetadataKey' });
export enum UserMetadataKey { export enum UserMetadataKey {
Preferences = 'preferences', Preferences = 'preferences',
License = 'license', License = 'license',
@@ -371,11 +349,6 @@ export enum AssetMetadataKey {
MobileApp = 'mobile-app', MobileApp = 'mobile-app',
} }
export const AssetMetadataKeySchema = z
.enum(AssetMetadataKey)
.describe('Asset metadata key')
.meta({ id: 'AssetMetadataKey' });
export enum UserAvatarColor { export enum UserAvatarColor {
Primary = 'primary', Primary = 'primary',
Pink = 'pink', Pink = 'pink',
@@ -408,8 +381,6 @@ export enum AssetStatus {
Deleted = 'deleted', Deleted = 'deleted',
} }
export const AssetStatusSchema = z.enum(AssetStatus).describe('Asset status').meta({ id: 'AssetStatus' });
export enum SourceType { export enum SourceType {
MachineLearning = 'machine-learning', MachineLearning = 'machine-learning',
Exif = 'exif', Exif = 'exif',
@@ -434,20 +405,14 @@ export enum AssetPathType {
EncodedVideo = 'encoded_video', EncodedVideo = 'encoded_video',
} }
export const AssetPathTypeSchema = z.enum(AssetPathType).describe('Asset path type').meta({ id: 'AssetPathType' });
export enum PersonPathType { export enum PersonPathType {
Face = 'face', Face = 'face',
} }
export const PersonPathTypeSchema = z.enum(PersonPathType).describe('Person path type').meta({ id: 'PersonPathType' });
export enum UserPathType { export enum UserPathType {
Profile = 'profile', Profile = 'profile',
} }
export const UserPathTypeSchema = z.enum(UserPathType).describe('User path type').meta({ id: 'UserPathType' });
export type PathType = AssetFileType | AssetPathType | PersonPathType | UserPathType; export type PathType = AssetFileType | AssetPathType | PersonPathType | UserPathType;
export enum TranscodePolicy { export enum TranscodePolicy {
@@ -470,11 +435,6 @@ export enum TranscodeTarget {
All = 'ALL', All = 'ALL',
} }
export const TranscodeTargetSchema = z
.enum(TranscodeTarget)
.describe('Transcode target')
.meta({ id: 'TranscodeTarget' });
export enum VideoCodec { export enum VideoCodec {
H264 = 'h264', H264 = 'h264',
Hevc = 'hevc', Hevc = 'hevc',
@@ -556,11 +516,6 @@ export enum RawExtractedFormat {
Jxl = 'jxl', Jxl = 'jxl',
} }
export const RawExtractedFormatSchema = z
.enum(RawExtractedFormat)
.describe('Raw extracted format')
.meta({ id: 'RawExtractedFormat' });
export enum LogLevel { export enum LogLevel {
Verbose = 'verbose', Verbose = 'verbose',
Debug = 'debug', Debug = 'debug',
@@ -586,38 +541,25 @@ export enum ApiCustomExtension {
State = 'x-immich-state', State = 'x-immich-state',
} }
export const ApiCustomExtensionSchema = z
.enum(ApiCustomExtension)
.describe('API custom extension')
.meta({ id: 'ApiCustomExtension' });
export enum MetadataKey { export enum MetadataKey {
AuthRoute = 'auth_route', AuthRoute = 'auth_route',
AdminRoute = 'admin_route',
SharedRoute = 'shared_route',
ApiKeySecurity = 'api_key', ApiKeySecurity = 'api_key',
EventConfig = 'event_config', EventConfig = 'event_config',
JobConfig = 'job_config', JobConfig = 'job_config',
TelemetryEnabled = 'telemetry_enabled', TelemetryEnabled = 'telemetry_enabled',
} }
export const MetadataKeySchema = z.enum(MetadataKey).describe('Metadata key').meta({ id: 'MetadataKey' });
export enum RouteKey { export enum RouteKey {
Asset = 'assets', Asset = 'assets',
User = 'users', User = 'users',
} }
export const RouteKeySchema = z.enum(RouteKey).describe('Route key').meta({ id: 'RouteKey' });
export enum CacheControl { export enum CacheControl {
PrivateWithCache = 'private_with_cache', PrivateWithCache = 'private_with_cache',
PrivateWithoutCache = 'private_without_cache', PrivateWithoutCache = 'private_without_cache',
None = 'none', None = 'none',
} }
export const CacheControlSchema = z.enum(CacheControl).describe('Cache control').meta({ id: 'CacheControl' });
export enum ImmichEnvironment { export enum ImmichEnvironment {
Development = 'development', Development = 'development',
Testing = 'testing', Testing = 'testing',
@@ -635,8 +577,6 @@ export enum ImmichWorker {
Microservices = 'microservices', Microservices = 'microservices',
} }
export const ImmichWorkerSchema = z.enum(ImmichWorker).describe('Immich worker').meta({ id: 'ImmichWorker' });
export enum ImmichTelemetry { export enum ImmichTelemetry {
Host = 'host', Host = 'host',
Api = 'api', Api = 'api',
@@ -645,11 +585,6 @@ export enum ImmichTelemetry {
Job = 'job', Job = 'job',
} }
export const ImmichTelemetrySchema = z
.enum(ImmichTelemetry)
.describe('Immich telemetry')
.meta({ id: 'ImmichTelemetry' });
export enum ExifOrientation { export enum ExifOrientation {
Horizontal = 1, Horizontal = 1,
MirrorHorizontal = 2, MirrorHorizontal = 2,
@@ -661,11 +596,6 @@ export enum ExifOrientation {
Rotate270CW = 8, Rotate270CW = 8,
} }
export const ExifOrientationSchema = z
.enum(ExifOrientation)
.describe('EXIF orientation')
.meta({ id: 'ExifOrientation' });
export enum DatabaseExtension { export enum DatabaseExtension {
Cube = 'cube', Cube = 'cube',
EarthDistance = 'earthdistance', EarthDistance = 'earthdistance',
@@ -674,11 +604,6 @@ export enum DatabaseExtension {
VectorChord = 'vchord', VectorChord = 'vchord',
} }
export const DatabaseExtensionSchema = z
.enum(DatabaseExtension)
.describe('Database extension')
.meta({ id: 'DatabaseExtension' });
export enum BootstrapEventPriority { export enum BootstrapEventPriority {
// Database service should be initialized before anything else, most other services need database access // Database service should be initialized before anything else, most other services need database access
DatabaseService = -200, DatabaseService = -200,
@@ -690,11 +615,6 @@ export enum BootstrapEventPriority {
SystemConfig = 100, SystemConfig = 100,
} }
export const BootstrapEventPrioritySchema = z
.enum(BootstrapEventPriority)
.describe('Bootstrap event priority')
.meta({ id: 'BootstrapEventPriority' });
export enum QueueName { export enum QueueName {
ThumbnailGeneration = 'thumbnailGeneration', ThumbnailGeneration = 'thumbnailGeneration',
MetadataExtraction = 'metadataExtraction', MetadataExtraction = 'metadataExtraction',
@@ -833,21 +753,15 @@ export enum JobStatus {
Skipped = 'skipped', Skipped = 'skipped',
} }
export const JobStatusSchema = z.enum(JobStatus).describe('Job status').meta({ id: 'JobStatus' });
export enum QueueCleanType { export enum QueueCleanType {
Failed = 'failed', Failed = 'failed',
} }
export const QueueCleanTypeSchema = z.enum(QueueCleanType).describe('Queue clean type').meta({ id: 'QueueCleanType' });
export enum VectorIndex { export enum VectorIndex {
Clip = 'clip_index', Clip = 'clip_index',
Face = 'face_index', Face = 'face_index',
} }
export const VectorIndexSchema = z.enum(VectorIndex).describe('Vector index').meta({ id: 'VectorIndex' });
export enum DatabaseLock { export enum DatabaseLock {
GeodataImport = 100, GeodataImport = 100,
Migrations = 200, Migrations = 200,
@@ -865,8 +779,6 @@ export enum DatabaseLock {
VersionCheck = 800, VersionCheck = 800,
} }
export const DatabaseLockSchema = z.enum(DatabaseLock).describe('Database lock').meta({ id: 'DatabaseLock' });
export enum MaintenanceAction { export enum MaintenanceAction {
Start = 'start', Start = 'start',
End = 'end', End = 'end',
@@ -883,8 +795,6 @@ export enum ExitCode {
AppRestart = 7, AppRestart = 7,
} }
export const ExitCodeSchema = z.enum(ExitCode).describe('Exit code').meta({ id: 'ExitCode' });
export enum SyncRequestType { export enum SyncRequestType {
AlbumsV1 = 'AlbumsV1', AlbumsV1 = 'AlbumsV1',
AlbumUsersV1 = 'AlbumUsersV1', AlbumUsersV1 = 'AlbumUsersV1',
@@ -1043,8 +953,6 @@ export enum CronJob {
VersionCheck = 'VersionCheck', VersionCheck = 'VersionCheck',
} }
export const CronJobSchema = z.enum(CronJob).describe('Cron job').meta({ id: 'CronJob' });
export enum ApiTag { export enum ApiTag {
Activities = 'Activities', Activities = 'Activities',
Albums = 'Albums', Albums = 'Albums',
@@ -1085,8 +993,6 @@ export enum ApiTag {
Workflows = 'Workflows', Workflows = 'Workflows',
} }
export const ApiTagSchema = z.enum(ApiTag).describe('API tag').meta({ id: 'ApiTag' });
export enum PluginContext { export enum PluginContext {
Asset = 'asset', Asset = 'asset',
Album = 'album', Album = 'album',
@@ -33,12 +33,6 @@ export interface ReverseGeocodeResult {
city: string | null; city: string | null;
} }
export interface MapMarker extends ReverseGeocodeResult {
id: string;
lat: number;
lon: number;
}
interface MapDB extends DB { interface MapDB extends DB {
geodata_places_tmp: GeodataPlacesTable; geodata_places_tmp: GeodataPlacesTable;
naturalearth_countries_tmp: NaturalEarthCountriesTable; naturalearth_countries_tmp: NaturalEarthCountriesTable;
-5
View File
@@ -65,13 +65,8 @@ export interface DecodeToBufferOptions extends DecodeImageOptions {
} }
export type GenerateThumbnailOptions = Pick<ImageOptions, 'format' | 'quality' | 'progressive'> & DecodeToBufferOptions; export type GenerateThumbnailOptions = Pick<ImageOptions, 'format' | 'quality' | 'progressive'> & DecodeToBufferOptions;
export type GenerateThumbnailFromBufferOptions = GenerateThumbnailOptions & { raw: RawImageInfo };
export type GenerateThumbhashOptions = DecodeImageOptions; export type GenerateThumbhashOptions = DecodeImageOptions;
export type GenerateThumbhashFromBufferOptions = GenerateThumbhashOptions & { raw: RawImageInfo };
export interface GenerateThumbnailsOptions { export interface GenerateThumbnailsOptions {
colorspace: string; colorspace: string;
preview?: ImageOptions; preview?: ImageOptions;
-2
View File
@@ -10,8 +10,6 @@ import { SystemMetadataRepository } from 'src/repositories/system-metadata.repos
import { DeepPartial } from 'src/types'; import { DeepPartial } from 'src/types';
import { getKeysDeep, unsetDeep } from 'src/utils/misc'; import { getKeysDeep, unsetDeep } from 'src/utils/misc';
export type SystemConfigValidator = (config: SystemConfig, newConfig: SystemConfig) => void | Promise<void>;
type RepoDeps = { type RepoDeps = {
configRepo: ConfigRepository; configRepo: ConfigRepository;
metadataRepo: SystemMetadataRepository; metadataRepo: SystemMetadataRepository;
-49
View File
@@ -1,60 +1,11 @@
import { createAdapter } from '@socket.io/redis-adapter';
import Redis from 'ioredis';
import { SignJWT } from 'jose'; import { SignJWT } from 'jose';
import { randomBytes } from 'node:crypto'; import { randomBytes } from 'node:crypto';
import { join } from 'node:path'; import { join } from 'node:path';
import { Server as SocketIO } from 'socket.io';
import { StorageCore } from 'src/cores/storage.core'; import { StorageCore } from 'src/cores/storage.core';
import { MaintenanceAuthDto, MaintenanceDetectInstallResponseDto } from 'src/dtos/maintenance.dto'; import { MaintenanceAuthDto, MaintenanceDetectInstallResponseDto } from 'src/dtos/maintenance.dto';
import { StorageFolder } from 'src/enum'; 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'; 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( export async function createMaintenanceLoginUrl(
baseUrl: string, baseUrl: string,
auth: MaintenanceAuthDto, auth: MaintenanceAuthDto,
-52
View File
@@ -1,5 +1,4 @@
import { MapAsset } from 'src/dtos/asset-response.dto'; import { MapAsset } from 'src/dtos/asset-response.dto';
import { SharedLinkResponseDto } from 'src/dtos/shared-link.dto';
import { SharedLinkType } from 'src/enum'; import { SharedLinkType } from 'src/enum';
import { AssetFactory } from 'test/factories/asset.factory'; import { AssetFactory } from 'test/factories/asset.factory';
import { authStub } from 'test/fixtures/auth.stub'; import { authStub } from 'test/fixtures/auth.stub';
@@ -70,23 +69,6 @@ export const sharedLinkStub = {
album: null, album: null,
slug: 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({ passwordRequired: Object.freeze({
id: '123', id: '123',
userId: authStub.admin.user.id, userId: authStub.admin.user.id,
@@ -105,37 +87,3 @@ export const sharedLinkStub = {
album: null, 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,
}),
};
-45
View File
@@ -67,48 +67,3 @@ export const errorDto = {
correlationId: expect.any(String), 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: '',
},
};
-37
View File
@@ -531,43 +531,6 @@ export const mockDuplex =
return duplex; 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> { export async function* makeStream<T>(items: T[] = []): AsyncIterableIterator<T> {
for (const item of items) { for (const item of items) {
await Promise.resolve(); await Promise.resolve();