@dimah-s3/db
v1.5.9
Published
Optional database plugin for dimah-s3 — track S3 object ownership, listings, and resumable uploads
Maintainers
Readme
@dimah-s3/db
Optional FumaDB persistence for dimah-s3 — storage_object table via the db() plugin.
Docs: Database Setup · Database Lifecycle Hooks · llms.txt · Example: examples/with-db
import { DimahS3DB, db } from "@dimah-s3/db";
import { dimahS3, route } from "@dimah-s3/server";
import { drizzleAdapter } from "fumadb/adapters/drizzle";
export const dimahS3Db = DimahS3DB.client(
drizzleAdapter({ db: drizzleDb, provider: "sqlite" }),
);
export const s3 = dimahS3({
client: awsS3,
bucket: process.env.S3_BUCKET!,
plugins: [
db({
client: dimahS3Db,
resolveScope: async (request) => {
const session = await getSession(request);
return session ? `user:${session.userId}` : null;
},
}),
],
routes: {
uploads: route({
upload: true,
}),
},
});
s3.db.objects.listByScope({ scope });Copy-paste schemas (with indexes): drizzle.ts · schema.prisma
