forked from pinks/eris
1
0
Fork 0
nyx/app/workerInstanceStore.ts

25 lines
617 B
TypeScript
Raw Normal View History

2023-10-13 11:47:57 +00:00
import { Store } from "indexed_kv";
import { Static, t } from "elysia";
2023-10-13 11:47:57 +00:00
import { db } from "./db.ts";
export const workerInstanceSchema = t.Object({
key: t.String(),
name: t.Nullable(t.String()),
sdUrl: t.String(),
sdAuth: t.Nullable(t.Object({
user: t.String(),
password: t.String(),
})),
lastOnlineTime: t.Optional(t.Number()),
lastError: t.Optional(t.Object({
message: t.String(),
time: t.Number(),
})),
});
2023-10-13 11:47:57 +00:00
export type WorkerInstance = Static<typeof workerInstanceSchema>;
2023-10-13 11:47:57 +00:00
export const workerInstanceStore = new Store<WorkerInstance>(db, "workerInstances", {
indices: {},
});