2020-07-28 12:39:54 +00:00
|
|
|
import { Datastore } from "./deps.ts";
|
2020-07-28 13:56:02 +00:00
|
|
|
import { FS } from "./deps.ts";
|
|
|
|
await FS.ensureDir("./data");
|
2020-07-28 12:39:54 +00:00
|
|
|
|
|
|
|
export interface IPackage {
|
|
|
|
name: string;
|
2020-08-03 07:38:01 +00:00
|
|
|
owner: string;
|
2020-07-31 18:16:12 +00:00
|
|
|
description: string;
|
2020-07-28 12:39:54 +00:00
|
|
|
versions: string[];
|
2020-07-31 22:15:10 +00:00
|
|
|
deprecated: boolean;
|
2020-07-28 12:39:54 +00:00
|
|
|
}
|
|
|
|
|
2020-07-31 18:16:12 +00:00
|
|
|
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",
|
|
|
|
}),
|
|
|
|
};
|
2020-07-28 12:39:54 +00:00
|
|
|
|
|
|
|
export default db;
|