mirror of
https://github.com/immich-app/immich.git
synced 2025-10-24 07:19:05 -04:00
* Migrate from npm to pnpm across entire project • Update all GitHub workflow files to use pnpm instead of npm • Replace npm commands with pnpm equivalents in devcontainer scripts • Remove package-lock.json files and update to use pnpm-lock.yaml • Consolidate node version references to use server/.nvmrc * Refine pnpm migration based on review feedback • Replace SKIP_SHARP_FILTERING with SHARP_IGNORE_GLOBAL_LIBVIPS environment variable • Improve Sharp package filtering to include specific Linux architectures for Docker builds • Optimize Dockerfile dependency caching with improved layer structure • Clean up workspace configuration and remove redundant settings * Address additional review feedback for pnpm migration • Fix node-version-file paths in GitHub workflow configurations • Refactor .pnpmfile.cjs to use switch statement for better code organization • Correct cache type typo in fix-format workflow • Simplify Vite configuration by merging configs inline • Update package description for consistency * Use 'server/.nvmrc' for fix-format.yml GHA * Delete npm locks * Remove Docker volume isolation for node_modules directories • Remove volume mounts for node_modules and related directories • Allow shared access between host and container filesystem • Update init container to handle file ownership with conditional existence check * Remove unused Docker volumes and volume mounts • Remove node_modules volume mounts from devcontainer configuration • Remove unused named volumes for pnpm-store, node_modules, and cache directories • Clean up Docker Compose configuration after removing volume isolation * Fix typescript-sdk package issues • Remove unknown "build" dependency that was incorrectly added to package.json • Update pnpm-lock.yaml to reflect dependency removal * Add pnpm setup to mobile workflow for translation formatting • Add pnpm action setup step to mobile unit tests workflow • Required for translation file formatting and sorting operations --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
146 lines
5.8 KiB
TypeScript
146 lines
5.8 KiB
TypeScript
import { Duration } from 'luxon';
|
|
import { readFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { SemVer } from 'semver';
|
|
import { DatabaseExtension, ExifOrientation, VectorIndex } from 'src/enum';
|
|
|
|
export const POSTGRES_VERSION_RANGE = '>=14.0.0';
|
|
export const VECTORCHORD_VERSION_RANGE = '>=0.3 <0.5';
|
|
export const VECTORS_VERSION_RANGE = '>=0.2 <0.4';
|
|
export const VECTOR_VERSION_RANGE = '>=0.5 <1';
|
|
|
|
export const NEXT_RELEASE = 'NEXT_RELEASE';
|
|
export const LIFECYCLE_EXTENSION = 'x-immich-lifecycle';
|
|
export const DEPRECATED_IN_PREFIX = 'This property was deprecated in ';
|
|
export const ADDED_IN_PREFIX = 'This property was added in ';
|
|
|
|
export const JOBS_ASSET_PAGINATION_SIZE = 1000;
|
|
export const JOBS_LIBRARY_PAGINATION_SIZE = 10_000;
|
|
|
|
export const EXTENSION_NAMES: Record<DatabaseExtension, string> = {
|
|
cube: 'cube',
|
|
earthdistance: 'earthdistance',
|
|
vector: 'pgvector',
|
|
vectors: 'pgvecto.rs',
|
|
vchord: 'VectorChord',
|
|
} as const;
|
|
|
|
export const VECTOR_EXTENSIONS = [
|
|
DatabaseExtension.VectorChord,
|
|
DatabaseExtension.Vectors,
|
|
DatabaseExtension.Vector,
|
|
] as const;
|
|
|
|
export const VECTOR_INDEX_TABLES = {
|
|
[VectorIndex.Clip]: 'smart_search',
|
|
[VectorIndex.Face]: 'face_search',
|
|
} as const;
|
|
|
|
export const VECTORCHORD_LIST_SLACK_FACTOR = 1.2;
|
|
|
|
export const SALT_ROUNDS = 10;
|
|
|
|
export const IWorker = 'IWorker';
|
|
|
|
// eslint-disable-next-line unicorn/prefer-module
|
|
const basePath = dirname(__filename);
|
|
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 MACHINE_LEARNING_PING_TIMEOUT = Number(process.env.MACHINE_LEARNING_PING_TIMEOUT || 2000);
|
|
export const MACHINE_LEARNING_AVAILABILITY_BACKOFF_TIME = Number(
|
|
process.env.MACHINE_LEARNING_AVAILABILITY_BACKOFF_TIME || 30_000,
|
|
);
|
|
|
|
export const citiesFile = 'cities500.txt';
|
|
export const reverseGeocodeMaxDistance = 25_000;
|
|
|
|
export const MOBILE_REDIRECT = 'app.immich:///oauth-callback';
|
|
export const LOGIN_URL = '/auth/login?autoLaunch=0';
|
|
|
|
export const excludePaths = ['/.well-known/immich', '/custom.css', '/favicon.ico'];
|
|
|
|
export const FACE_THUMBNAIL_SIZE = 250;
|
|
|
|
type ModelInfo = { dimSize: number };
|
|
export const CLIP_MODEL_INFO: Record<string, ModelInfo> = {
|
|
RN101__openai: { dimSize: 512 },
|
|
RN101__yfcc15m: { dimSize: 512 },
|
|
'ViT-B-16__laion400m_e31': { dimSize: 512 },
|
|
'ViT-B-16__laion400m_e32': { dimSize: 512 },
|
|
'ViT-B-16__openai': { dimSize: 512 },
|
|
'ViT-B-32__laion2b-s34b-b79k': { dimSize: 512 },
|
|
'ViT-B-32__laion2b_e16': { dimSize: 512 },
|
|
'ViT-B-32__laion400m_e31': { dimSize: 512 },
|
|
'ViT-B-32__laion400m_e32': { dimSize: 512 },
|
|
'ViT-B-32__openai': { dimSize: 512 },
|
|
'XLM-Roberta-Base-ViT-B-32__laion5b_s13b_b90k': { dimSize: 512 },
|
|
'XLM-Roberta-Large-Vit-B-32': { dimSize: 512 },
|
|
RN50x4__openai: { dimSize: 640 },
|
|
'ViT-B-16-plus-240__laion400m_e31': { dimSize: 640 },
|
|
'ViT-B-16-plus-240__laion400m_e32': { dimSize: 640 },
|
|
'XLM-Roberta-Large-Vit-B-16Plus': { dimSize: 640 },
|
|
'LABSE-Vit-L-14': { dimSize: 768 },
|
|
RN50x16__openai: { dimSize: 768 },
|
|
'ViT-B-16-SigLIP-256__webli': { dimSize: 768 },
|
|
'ViT-B-16-SigLIP-384__webli': { dimSize: 768 },
|
|
'ViT-B-16-SigLIP-512__webli': { dimSize: 768 },
|
|
'ViT-B-16-SigLIP-i18n-256__webli': { dimSize: 768 },
|
|
'ViT-B-16-SigLIP__webli': { dimSize: 768 },
|
|
'ViT-L-14-336__openai': { dimSize: 768 },
|
|
'ViT-L-14-quickgelu__dfn2b': { dimSize: 768 },
|
|
'ViT-L-14__laion2b-s32b-b82k': { dimSize: 768 },
|
|
'ViT-L-14__laion400m_e31': { dimSize: 768 },
|
|
'ViT-L-14__laion400m_e32': { dimSize: 768 },
|
|
'ViT-L-14__openai': { dimSize: 768 },
|
|
'XLM-Roberta-Large-Vit-L-14': { dimSize: 768 },
|
|
'nllb-clip-base-siglip__mrl': { dimSize: 768 },
|
|
'nllb-clip-base-siglip__v1': { dimSize: 768 },
|
|
RN50__cc12m: { dimSize: 1024 },
|
|
RN50__openai: { dimSize: 1024 },
|
|
RN50__yfcc15m: { dimSize: 1024 },
|
|
RN50x64__openai: { dimSize: 1024 },
|
|
'ViT-H-14-378-quickgelu__dfn5b': { dimSize: 1024 },
|
|
'ViT-H-14-quickgelu__dfn5b': { dimSize: 1024 },
|
|
'ViT-H-14__laion2b-s32b-b79k': { dimSize: 1024 },
|
|
'ViT-L-16-SigLIP-256__webli': { dimSize: 1024 },
|
|
'ViT-L-16-SigLIP-384__webli': { dimSize: 1024 },
|
|
'ViT-g-14__laion2b-s12b-b42k': { dimSize: 1024 },
|
|
'XLM-Roberta-Large-ViT-H-14__frozen_laion5b_s13b_b90k': { dimSize: 1024 },
|
|
'ViT-SO400M-14-SigLIP-384__webli': { dimSize: 1152 },
|
|
'nllb-clip-large-siglip__mrl': { dimSize: 1152 },
|
|
'nllb-clip-large-siglip__v1': { dimSize: 1152 },
|
|
'ViT-B-16-SigLIP2__webli': { dimSize: 768 },
|
|
'ViT-B-32-SigLIP2-256__webli': { dimSize: 768 },
|
|
'ViT-L-16-SigLIP2-256__webli': { dimSize: 1024 },
|
|
'ViT-L-16-SigLIP2-384__webli': { dimSize: 1024 },
|
|
'ViT-L-16-SigLIP2-512__webli': { dimSize: 1024 },
|
|
'ViT-SO400M-14-SigLIP2__webli': { dimSize: 1152 },
|
|
'ViT-SO400M-14-SigLIP2-378__webli': { dimSize: 1152 },
|
|
'ViT-SO400M-16-SigLIP2-256__webli': { dimSize: 1152 },
|
|
'ViT-SO400M-16-SigLIP2-384__webli': { dimSize: 1152 },
|
|
'ViT-SO400M-16-SigLIP2-512__webli': { dimSize: 1152 },
|
|
'ViT-gopt-16-SigLIP2-256__webli': { dimSize: 1536 },
|
|
'ViT-gopt-16-SigLIP2-384__webli': { dimSize: 1536 },
|
|
};
|
|
|
|
type SharpRotationData = {
|
|
angle?: number;
|
|
flip?: boolean;
|
|
flop?: boolean;
|
|
};
|
|
export const ORIENTATION_TO_SHARP_ROTATION: Record<ExifOrientation, SharpRotationData> = {
|
|
[ExifOrientation.Horizontal]: { angle: 0 },
|
|
[ExifOrientation.MirrorHorizontal]: { angle: 0, flop: true },
|
|
[ExifOrientation.Rotate180]: { angle: 180 },
|
|
[ExifOrientation.MirrorVertical]: { angle: 180, flop: true },
|
|
[ExifOrientation.MirrorHorizontalRotate270CW]: { angle: 270, flip: true },
|
|
[ExifOrientation.Rotate90CW]: { angle: 90 },
|
|
[ExifOrientation.MirrorHorizontalRotate90CW]: { angle: 90, flip: true },
|
|
[ExifOrientation.Rotate270CW]: { angle: 270 },
|
|
} as const;
|