mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
code: validate,store,packages (2 files)
This commit is contained in:
@@ -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 => ({});
|
||||
|
||||
@@ -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}`)
|
||||
|
||||
Reference in New Issue
Block a user