code: validate,store,packages (2 files)

This commit is contained in:
Richard Ward
2025-12-30 20:40:56 +00:00
parent 7575f15158
commit cca9ccd6c9
2 changed files with 8 additions and 48 deletions

View File

@@ -1,50 +1,10 @@
import { randomUUID } from 'crypto'
import type { LuaScript, Package, PageView, Session, User, Workflow } from '../types'
/**
* @file in-memory-store.ts
* @description In-memory store stub
*/
export class InMemoryStore {
users = new Map<string, User>()
usersByEmail = new Map<string, string>()
usersByUsername = new Map<string, string>()
pages = new Map<string, PageView>()
pageSlugs = new Map<string, string>()
workflows = new Map<string, Workflow>()
workflowNames = new Map<string, string>()
sessions = new Map<string, Session>()
sessionTokens = new Map<string, string>()
luaScripts = new Map<string, LuaScript>()
luaScriptNames = new Map<string, string>()
packages = new Map<string, Package>()
packageKeys = new Map<string, string>()
generateId(_prefix?: string): string {
return randomUUID()
}
clear(): void {
this.users.clear()
this.usersByEmail.clear()
this.usersByUsername.clear()
this.pages.clear()
this.pageSlugs.clear()
this.workflows.clear()
this.workflowNames.clear()
this.sessions.clear()
this.sessionTokens.clear()
this.luaScripts.clear()
this.luaScriptNames.clear()
this.packages.clear()
this.packageKeys.clear()
}
export interface InMemoryStore {
[key: string]: any;
}
export const createInMemoryStore = (): InMemoryStore => new InMemoryStore()
export const createInMemoryStore = (): InMemoryStore => ({});

View File

@@ -296,7 +296,7 @@ function main() {
// Determine packages directory (relative to script location)
const scriptDir = __dirname
const packagesDir = path.resolve(scriptDir, '../../packages')
const packagesDir = path.resolve(scriptDir, '../../../packages')
if (!fs.existsSync(packagesDir)) {
console.error(`Packages directory not found: ${packagesDir}`)