Files
diachron/express/services/index.ts
2026-01-03 17:06:54 -06:00

52 lines
889 B
TypeScript

// services.ts
import { AuthService, InMemoryAuthStore } from "../auth";
import { config } from "../config";
import { getLogs, log } from "../logging";
import { AnonymousUser, anonymousUser, type User } from "../user";
//const database = Client({
//})
const database = {};
const logging = {
log,
getLogs,
};
const random = {
randomNumber: () => {
return Math.random();
},
};
const misc = {
sleep: (ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms));
},
};
const session = {
getUser: (): User => {
return anonymousUser;
},
};
// Initialize auth with in-memory store
const authStore = new InMemoryAuthStore();
const auth = new AuthService(authStore);
// Keep this asciibetically sorted
const services = {
auth,
database,
logging,
misc,
random,
session,
};
export { services };