33 lines
606 B
TypeScript
33 lines
606 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;
|
|
readme: string;
|
|
}
|
|
|
|
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;
|