32 lines
587 B
TypeScript
32 lines
587 B
TypeScript
import { Datastore } from "./deps.ts";
|
|
import { FS } from "./deps.ts";
|
|
await FS.ensureDir("./data");
|
|
|
|
export interface IPackage {
|
|
name: string;
|
|
owner: string;
|
|
description: string;
|
|
versions: string[];
|
|
deprecated: boolean;
|
|
}
|
|
|
|
export interface IApiKey {
|
|
user: string;
|
|
key: string;
|
|
createdAt: Date;
|
|
lastAccess?: Date;
|
|
lastIP?: string;
|
|
}
|
|
|
|
const db = {
|
|
package: new Datastore<IPackage>({
|
|
filename: "data/packages.json",
|
|
autoload: true,
|
|
}),
|
|
api_key: new Datastore<IApiKey>({
|
|
filename: "data/api_keys.json",
|
|
}),
|
|
};
|
|
|
|
export default db;
|