FlatLibrary provider (#127)

This commit is contained in:
DecDuck
2025-07-06 12:44:41 +10:00
committed by GitHub
parent 73c27f0984
commit 706f2aac83
11 changed files with 233 additions and 75 deletions

View File

@ -2,10 +2,11 @@ import { LibraryBackend } from "~/prisma/client";
import prisma from "../internal/db/database";
import type { JsonValue } from "@prisma/client/runtime/library";
import type { LibraryProvider } from "../internal/library/provider";
import type { FilesystemProviderConfig } from "../internal/library/filesystem";
import { FilesystemProvider } from "../internal/library/filesystem";
import type { FilesystemProviderConfig } from "../internal/library/providers/filesystem";
import { FilesystemProvider } from "../internal/library/providers/filesystem";
import libraryManager from "../internal/library";
import path from "path";
import { FlatFilesystemProvider } from "../internal/library/providers/flat";
export const libraryConstructors: {
[key in LibraryBackend]: (
@ -19,6 +20,12 @@ export const libraryConstructors: {
): LibraryProvider<unknown> {
return new FilesystemProvider(value, id);
},
FlatFilesystem: function (
value: JsonValue,
id: string,
): LibraryProvider<unknown> {
return new FlatFilesystemProvider(value, id);
},
};
export default defineNitroPlugin(async () => {