Files
drop/server/server/internal/library/provider.ts
T
DecDuck 13c97cfcfc In-app store, torrential backend, locales (#332)
* feat: add store nav and fixes

* fix: reduce password requirement & new task error ui

* fix: client webtoken fix

* fix: delta versions and dockerfile

* fix: use setup platforms for filter & display

* fix: setup not accounted when returning valid options

* feat: tighter delta version support

* feat: dl/disk size

* feat: offload manifest generation to torrential

* fix: bump torrential

* feat: remove droplet

* feat: bump torrential

* feat: convert locales
2026-02-06 00:12:24 +11:00

62 lines
1.6 KiB
TypeScript

import type { LibraryBackend } from "~/prisma/client/enums";
export abstract class LibraryProvider<CFG> {
constructor(_config: CFG, _id: string) {
throw new Error("Library doesn't have a proper constructor");
}
/**
* @returns ID of the current library provider (fs, smb, s3, etc)
*/
abstract type(): LibraryBackend;
/**
* @returns the specific ID of this current provider
*/
abstract id(): string;
/**
* @returns list of (usually) top-level game folder names
*/
abstract listGames(): Promise<string[]>;
/**
* @param game folder name of the game to list versions for
* @returns list of version folder names
*/
abstract listVersions(
game: string,
existingPaths?: string[],
): Promise<string[]>;
/**
* @param game folder name of the game
* @param version folder name of the version
* @returns recursive list of all files in version, relative to the version folder (e.g. ./setup.exe)
*/
abstract versionReaddir(game: string, version: string): Promise<string[]>;
/**
* @param game folder name of the game
* @param version folder name of the version
* @returns string of JSON of the droplet manifest
*/
abstract generateDropletManifest(
game: string,
version: string,
progress: (v: number) => void,
log: (v: string) => void,
): Promise<string>;
abstract peekFile(
game: string,
version: string,
filename: string,
): Promise<{ size: number } | undefined>;
abstract fsStats(): { freeSpace: number; totalSpace: number } | undefined;
}
export class GameNotFoundError extends Error {}
export class VersionNotFoundError extends Error {}