2025-01-10 14:02:12 -05:00
|
|
|
import { UserEntity } from 'src/entities/user.entity';
|
2025-01-22 17:11:07 -05:00
|
|
|
import { ExifOrientation, ImageFormat, Permission, TranscodeTarget, VideoCodec } from 'src/enum';
|
2025-01-21 11:09:24 -05:00
|
|
|
import { AccessRepository } from 'src/repositories/access.repository';
|
2025-01-15 23:31:26 -05:00
|
|
|
import { ActivityRepository } from 'src/repositories/activity.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { AlbumUserRepository } from 'src/repositories/album-user.repository';
|
2025-01-21 11:45:59 -05:00
|
|
|
import { ApiKeyRepository } from 'src/repositories/api-key.repository';
|
2025-01-21 13:13:09 -05:00
|
|
|
import { AuditRepository } from 'src/repositories/audit.repository';
|
|
|
|
import { ConfigRepository } from 'src/repositories/config.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { CronRepository } from 'src/repositories/cron.repository';
|
2025-01-23 08:31:30 -05:00
|
|
|
import { LoggingRepository } from 'src/repositories/logging.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { MapRepository } from 'src/repositories/map.repository';
|
2025-01-22 17:11:07 -05:00
|
|
|
import { MediaRepository } from 'src/repositories/media.repository';
|
2025-01-22 16:39:13 -05:00
|
|
|
import { MemoryRepository } from 'src/repositories/memory.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { MetadataRepository } from 'src/repositories/metadata.repository';
|
|
|
|
import { NotificationRepository } from 'src/repositories/notification.repository';
|
|
|
|
import { OAuthRepository } from 'src/repositories/oauth.repository';
|
2025-02-07 18:04:04 -05:00
|
|
|
import { ProcessRepository } from 'src/repositories/process.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { ServerInfoRepository } from 'src/repositories/server-info.repository';
|
2025-02-07 18:16:40 -05:00
|
|
|
import { SessionRepository } from 'src/repositories/session.repository';
|
2025-02-07 17:26:49 -05:00
|
|
|
import { SystemMetadataRepository } from 'src/repositories/system-metadata.repository';
|
2025-01-23 18:10:17 -05:00
|
|
|
import { MetricGroupRepository, TelemetryRepository } from 'src/repositories/telemetry.repository';
|
|
|
|
import { TrashRepository } from 'src/repositories/trash.repository';
|
|
|
|
import { VersionHistoryRepository } from 'src/repositories/version-history.repository';
|
2025-01-21 13:26:13 -05:00
|
|
|
import { ViewRepository } from 'src/repositories/view-repository';
|
2025-01-10 14:02:12 -05:00
|
|
|
|
2025-01-21 16:47:48 -05:00
|
|
|
export type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
|
|
|
2025-01-10 14:02:12 -05:00
|
|
|
export type AuthApiKey = {
|
|
|
|
id: string;
|
|
|
|
key: string;
|
|
|
|
user: UserEntity;
|
|
|
|
permissions: Permission[];
|
|
|
|
};
|
2025-01-15 23:31:26 -05:00
|
|
|
|
|
|
|
export type RepositoryInterface<T extends object> = Pick<T, keyof T>;
|
|
|
|
|
|
|
|
export type IActivityRepository = RepositoryInterface<ActivityRepository>;
|
2025-01-21 11:09:24 -05:00
|
|
|
export type IAccessRepository = { [K in keyof AccessRepository]: RepositoryInterface<AccessRepository[K]> };
|
2025-01-23 18:10:17 -05:00
|
|
|
export type IAlbumUserRepository = RepositoryInterface<AlbumUserRepository>;
|
2025-01-21 11:45:59 -05:00
|
|
|
export type IApiKeyRepository = RepositoryInterface<ApiKeyRepository>;
|
2025-01-21 13:13:09 -05:00
|
|
|
export type IAuditRepository = RepositoryInterface<AuditRepository>;
|
|
|
|
export type IConfigRepository = RepositoryInterface<ConfigRepository>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type ICronRepository = RepositoryInterface<CronRepository>;
|
2025-01-23 08:31:30 -05:00
|
|
|
export type ILoggingRepository = Pick<
|
|
|
|
LoggingRepository,
|
|
|
|
| 'verbose'
|
|
|
|
| 'log'
|
|
|
|
| 'debug'
|
|
|
|
| 'warn'
|
|
|
|
| 'error'
|
|
|
|
| 'fatal'
|
|
|
|
| 'isLevelEnabled'
|
|
|
|
| 'setLogLevel'
|
|
|
|
| 'setContext'
|
|
|
|
| 'setAppName'
|
|
|
|
>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type IMapRepository = RepositoryInterface<MapRepository>;
|
2025-01-22 17:11:07 -05:00
|
|
|
export type IMediaRepository = RepositoryInterface<MediaRepository>;
|
2025-01-22 16:39:13 -05:00
|
|
|
export type IMemoryRepository = RepositoryInterface<MemoryRepository>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type IMetadataRepository = RepositoryInterface<MetadataRepository>;
|
|
|
|
export type IMetricGroupRepository = RepositoryInterface<MetricGroupRepository>;
|
|
|
|
export type INotificationRepository = RepositoryInterface<NotificationRepository>;
|
|
|
|
export type IOAuthRepository = RepositoryInterface<OAuthRepository>;
|
2025-02-07 18:04:04 -05:00
|
|
|
export type IProcessRepository = RepositoryInterface<ProcessRepository>;
|
2025-02-07 18:16:40 -05:00
|
|
|
export type ISessionRepository = RepositoryInterface<SessionRepository>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type IServerInfoRepository = RepositoryInterface<ServerInfoRepository>;
|
2025-02-07 17:26:49 -05:00
|
|
|
export type ISystemMetadataRepository = RepositoryInterface<SystemMetadataRepository>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type ITelemetryRepository = RepositoryInterface<TelemetryRepository>;
|
|
|
|
export type ITrashRepository = RepositoryInterface<TrashRepository>;
|
2025-01-21 13:26:13 -05:00
|
|
|
export type IViewRepository = RepositoryInterface<ViewRepository>;
|
2025-01-23 18:10:17 -05:00
|
|
|
export type IVersionHistoryRepository = RepositoryInterface<VersionHistoryRepository>;
|
2025-01-15 23:31:26 -05:00
|
|
|
|
|
|
|
export type ActivityItem =
|
|
|
|
| Awaited<ReturnType<IActivityRepository['create']>>
|
|
|
|
| Awaited<ReturnType<IActivityRepository['search']>>[0];
|
2025-01-21 11:45:59 -05:00
|
|
|
|
|
|
|
export type ApiKeyItem =
|
|
|
|
| Awaited<ReturnType<IApiKeyRepository['create']>>
|
|
|
|
| NonNullable<Awaited<ReturnType<IApiKeyRepository['getById']>>>
|
|
|
|
| Awaited<ReturnType<IApiKeyRepository['getByUserId']>>[0];
|
2025-01-22 16:39:13 -05:00
|
|
|
|
|
|
|
export type MemoryItem =
|
|
|
|
| Awaited<ReturnType<IMemoryRepository['create']>>
|
|
|
|
| Awaited<ReturnType<IMemoryRepository['search']>>[0];
|
2025-01-22 17:11:07 -05:00
|
|
|
|
2025-02-07 18:16:40 -05:00
|
|
|
export type SessionItem = Awaited<ReturnType<ISessionRepository['getByUserId']>>[0];
|
|
|
|
|
2025-01-22 17:11:07 -05:00
|
|
|
export interface CropOptions {
|
|
|
|
top: number;
|
|
|
|
left: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ImageOptions {
|
|
|
|
format: ImageFormat;
|
|
|
|
quality: number;
|
|
|
|
size: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RawImageInfo {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
channels: 1 | 2 | 3 | 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DecodeImageOptions {
|
|
|
|
colorspace: string;
|
|
|
|
crop?: CropOptions;
|
|
|
|
processInvalidImages: boolean;
|
|
|
|
raw?: RawImageInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DecodeToBufferOptions extends DecodeImageOptions {
|
|
|
|
size: number;
|
|
|
|
orientation?: ExifOrientation;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type GenerateThumbnailOptions = ImageOptions & DecodeImageOptions;
|
|
|
|
|
|
|
|
export type GenerateThumbnailFromBufferOptions = GenerateThumbnailOptions & { raw: RawImageInfo };
|
|
|
|
|
|
|
|
export type GenerateThumbhashOptions = DecodeImageOptions;
|
|
|
|
|
|
|
|
export type GenerateThumbhashFromBufferOptions = GenerateThumbhashOptions & { raw: RawImageInfo };
|
|
|
|
|
|
|
|
export interface GenerateThumbnailsOptions {
|
|
|
|
colorspace: string;
|
|
|
|
crop?: CropOptions;
|
|
|
|
preview?: ImageOptions;
|
|
|
|
processInvalidImages: boolean;
|
|
|
|
thumbhash?: boolean;
|
|
|
|
thumbnail?: ImageOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoStreamInfo {
|
|
|
|
index: number;
|
|
|
|
height: number;
|
|
|
|
width: number;
|
|
|
|
rotation: number;
|
|
|
|
codecName?: string;
|
|
|
|
frameCount: number;
|
|
|
|
isHDR: boolean;
|
|
|
|
bitrate: number;
|
|
|
|
pixelFormat: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AudioStreamInfo {
|
|
|
|
index: number;
|
|
|
|
codecName?: string;
|
|
|
|
frameCount: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoFormat {
|
|
|
|
formatName?: string;
|
|
|
|
formatLongName?: string;
|
|
|
|
duration: number;
|
|
|
|
bitrate: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ImageDimensions {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface InputDimensions extends ImageDimensions {
|
|
|
|
inputPath: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoInfo {
|
|
|
|
format: VideoFormat;
|
|
|
|
videoStreams: VideoStreamInfo[];
|
|
|
|
audioStreams: AudioStreamInfo[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TranscodeCommand {
|
|
|
|
inputOptions: string[];
|
|
|
|
outputOptions: string[];
|
|
|
|
twoPass: boolean;
|
|
|
|
progress: {
|
|
|
|
frameCount: number;
|
|
|
|
percentInterval: number;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BitrateDistribution {
|
|
|
|
max: number;
|
|
|
|
target: number;
|
|
|
|
min: number;
|
|
|
|
unit: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ImageBuffer {
|
|
|
|
data: Buffer;
|
|
|
|
info: RawImageInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoCodecSWConfig {
|
|
|
|
getCommand(
|
|
|
|
target: TranscodeTarget,
|
|
|
|
videoStream: VideoStreamInfo,
|
|
|
|
audioStream: AudioStreamInfo,
|
|
|
|
format?: VideoFormat,
|
|
|
|
): TranscodeCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoCodecHWConfig extends VideoCodecSWConfig {
|
|
|
|
getSupportedCodecs(): Array<VideoCodec>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProbeOptions {
|
|
|
|
countFrames: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoInterfaces {
|
|
|
|
dri: string[];
|
|
|
|
mali: boolean;
|
|
|
|
}
|