fix(types): replace 'any' with 'unknown' for improved type safety across workflow and metadata files

This commit is contained in:
2025-12-29 23:52:02 +00:00
parent 4c1a3ee65e
commit ef86c48fd0
33 changed files with 56 additions and 26 deletions

View File

@@ -5,7 +5,7 @@ export function createNode(
id: string,
type: WorkflowNode['type'],
label: string,
config: Record<string, any> = {}
config: Record<string, unknown> = {}
): WorkflowNode {
return { id, type, label, config, position: { x: 0, y: 0 } }
}
@@ -15,7 +15,7 @@ export function createWorkflow(id: string, name: string, nodes: WorkflowNode[]):
}
export function createContext(
data: any = {},
data: unknown = {},
overrides: Partial<WorkflowExecutionContext> = {}
): WorkflowExecutionContext {
return { data, ...overrides }

View File

@@ -68,10 +68,10 @@ async function sleep(delayMs: number) {
*/
async function executeNodeOnce(
node: WorkflowNode,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
try {
switch (node.type) {
case 'trigger':
@@ -105,10 +105,10 @@ async function executeNodeOnce(
export async function executeNode(
node: WorkflowNode,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
const retryConfig = normalizeRetryConfig(node.config?.retry)
let attempt = 0
let lastError: string | undefined

View File

@@ -13,7 +13,7 @@ export async function executeWorkflow(
context: WorkflowExecutionContext
): Promise<WorkflowExecutionResult> {
const state = createWorkflowState()
const outputs: Record<string, any> = {}
const outputs: Record<string, unknown> = {}
let currentData = context.data
try {

View File

@@ -3,6 +3,6 @@ import type { WorkflowState } from './workflow-state'
/**
* Log a message to workflow state
*/
export function logToWorkflow(state: WorkflowState, ...args: any[]): void {
export function logToWorkflow(state: WorkflowState, ...args: unknown[]): void {
state.logs.push(args.map(arg => String(arg)).join(' '))
}

View File

@@ -8,10 +8,10 @@ import type { WorkflowState } from '../workflow-state'
*/
export async function executeActionNode(
node: WorkflowNode,
data: any,
data: unknown,
_context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
logToWorkflow(state, `Action: ${node.config.action || 'default'}`)
return { success: true, output: data }
}

View File

@@ -8,10 +8,10 @@ import type { WorkflowState } from '../workflow-state'
*/
export async function executeConditionNode(
node: WorkflowNode,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
const condition = node.config.condition || 'true'
try {

View File

@@ -9,17 +9,17 @@ import type { WorkflowState } from '../workflow-state'
*/
export async function executeLuaCode(
code: string,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
const engine = createSandboxedLuaEngine()
try {
const luaContext = {
data,
user: context.user,
log: (...args: any[]) => logToWorkflow(state, ...args),
log: (...args: unknown[]) => logToWorkflow(state, ...args),
}
const result: SandboxedLuaResult = await engine.executeWithSandbox(code, luaContext)

View File

@@ -8,10 +8,10 @@ import type { WorkflowState } from './workflow-state'
*/
export async function executeLuaNode(
node: WorkflowNode,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
const scriptId = node.config.scriptId
if (!scriptId || !context.scripts) {

View File

@@ -8,10 +8,10 @@ import type { WorkflowState } from '../workflow-state'
*/
export async function executeTransformNode(
node: WorkflowNode,
data: any,
data: unknown,
context: WorkflowExecutionContext,
state: WorkflowState
): Promise<{ success: boolean; output?: any; error?: string }> {
): Promise<{ success: boolean; output?: unknown; error?: string }> {
const transform = node.config.transform || 'data'
try {

View File

@@ -4,7 +4,7 @@ import type { LuaScript } from '../types/level-types'
* Context passed to workflow execution
*/
export interface WorkflowExecutionContext {
data: any
user?: any
data: unknown
user?: Record<string, unknown> | null
scripts?: LuaScript[]
}

View File

@@ -3,7 +3,7 @@
*/
export interface WorkflowExecutionResult {
success: boolean
outputs: Record<string, any>
outputs: Record<string, unknown>
logs: string[]
error?: string
securityWarnings?: string[]

View File

@@ -1,11 +1,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '@/dbal/development/src/blob/tenant-aware-storage' {
import type { BlobListResult,BlobMetadata, BlobStorage } from '@/dbal/development/src/blob'
import type { InMemoryTenantManager } from '@/dbal/development/src/core/tenant-context'
export class TenantAwareBlobStorage implements BlobStorage {
constructor(storage: BlobStorage, tenantManager: InMemoryTenantManager, ...args: any[])
constructor(storage: BlobStorage, tenantManager: InMemoryTenantManager, ...args: unknown[])
upload(key: string, data: Buffer | string, metadata?: BlobMetadata): Promise<string>
download(key: string): Promise<Buffer>
delete(key: string): Promise<void>

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '@monaco-editor/react' {
import type { ComponentType, ReactNode } from 'react'
import type { editor, languages } from 'monaco-editor'

View File

@@ -6,6 +6,7 @@
"name": "Admin Dialog",
"version": "1.0.0",
"description": "Admin dialogs for user and settings management",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_dialogs"],
@@ -19,6 +20,7 @@
"name": "Arcade Lobby",
"version": "1.0.0",
"description": "Gaming lobby for tournaments, party queues, and highlights.",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "gaming",
"dependencies": [],
@@ -31,6 +33,7 @@
"name": "Codegen Studio",
"version": "1.0.0",
"description": "Generate Next.js, React, and CLI starters from configurable templates.",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "tools",
"dependencies": [],
@@ -43,6 +46,7 @@
"name": "Code Editor",
"version": "1.0.0",
"description": "Code editor components for JSON, Lua, and themes",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "editors",
"dependencies": [],
@@ -56,6 +60,7 @@
"name": "Dashboard",
"version": "1.0.0",
"description": "Dashboard components with stats and layouts",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],
@@ -69,6 +74,7 @@
"name": "Data Table",
"version": "1.0.0",
"description": "Data table with columns, rows, and pagination",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],
@@ -82,6 +88,7 @@
"name": "Form Builder",
"version": "1.0.0",
"description": "Form builder with field types and validation",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],
@@ -95,6 +102,7 @@
"name": "Forum Forge",
"version": "1.0.0",
"description": "Modern forum starter with categories, threads, and moderation lanes.",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "social",
"dependencies": [],
@@ -107,6 +115,7 @@
"name": "Navigation Menu",
"version": "1.0.0",
"description": "Navigation sidebar and menu components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],
@@ -120,6 +129,7 @@
"name": "Notification Center",
"version": "1.0.0",
"description": "Toast notifications and notification list",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],
@@ -133,6 +143,7 @@
"name": "Auth Components",
"version": "1.0.0",
"description": "Authentication gate and access denied views",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],
@@ -146,6 +157,7 @@
"name": "Dialog Components",
"version": "1.0.0",
"description": "Confirm and alert dialog components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],
@@ -159,6 +171,7 @@
"name": "Social Hub",
"version": "1.0.0",
"description": "Modern social feed with creator tools and live rooms",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "social",
"dependencies": [],
@@ -201,6 +214,7 @@
"name": "Schema Editor",
"version": "1.0.0",
"description": "Database schema editor components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "editors",
"dependencies": ["form_builder"],

View File

@@ -3,6 +3,7 @@
"name": "Navigation Menu",
"version": "1.0.0",
"description": "Sidebar, navigation menus, and breadcrumbs",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],

View File

@@ -3,6 +3,7 @@
"name": "Notification Center",
"version": "1.0.0",
"description": "Notification center components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "Schema Editor",
"version": "1.0.0",
"description": "Database schema editor components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "editors",
"dependencies": ["form_builder"],

View File

@@ -3,6 +3,7 @@
"name": "Social Hub",
"version": "1.0.0",
"description": "Modern social feed with creator tools and live rooms",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "social",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "Stream Cast",
"version": "1.0.0",
"description": "Live streaming control room with schedules, scenes, and audience pulse.",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "media",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "Auth UI",
"version": "1.0.0",
"description": "Access denied, auth gate, and loading states",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],

View File

@@ -3,6 +3,7 @@
"name": "UI Dialogs",
"version": "1.0.0",
"description": "Confirmation, alert, and form dialogs",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "App Footer",
"version": "1.0.0",
"description": "Shared footer with copyright and links",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "App Header",
"version": "1.0.0",
"description": "Shared navigation header with user avatar and actions",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],

View File

@@ -3,6 +3,7 @@
"name": "Home Page",
"version": "1.0.0",
"description": "Level 1 home page with server status",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],

View File

@@ -3,6 +3,7 @@
"name": "Intro Section",
"version": "1.0.0",
"description": "Page intro with eyebrow, title, and description",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [],

View File

@@ -3,6 +3,7 @@
"name": "Level 2 - User Dashboard",
"version": "1.0.0",
"description": "User dashboard with profile, comments, and chat",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions", "ui_header", "ui_intro"],

View File

@@ -3,6 +3,7 @@
"name": "Level 3 - Admin Panel",
"version": "1.0.0",
"description": "Admin panel for user and content management",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions", "ui_header", "ui_intro"],

View File

@@ -3,6 +3,7 @@
"name": "Level 4 - Builder",
"version": "1.0.0",
"description": "Application builder with schemas and workflows",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions", "ui_header", "ui_intro"],

View File

@@ -3,6 +3,7 @@
"name": "Level 5 - Super God",
"version": "1.0.0",
"description": "Super god panel for tenant management",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions", "ui_header", "ui_intro"],

View File

@@ -3,6 +3,7 @@
"name": "Login Page",
"version": "1.0.0",
"description": "Login and registration page with form validation",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": ["ui_permissions"],

View File

@@ -3,6 +3,7 @@
"name": "UI Pages Bundle",
"version": "2.0.0",
"description": "Meta-package that bundles all UI page packages",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "ui",
"dependencies": [

View File

@@ -3,6 +3,7 @@
"name": "User Manager",
"version": "1.0.0",
"description": "User management components and actions",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "managers",
"dependencies": ["ui_permissions", "data_table"],

View File

@@ -3,6 +3,7 @@
"name": "Workflow Editor",
"version": "1.0.0",
"description": "Workflow editor and run status components",
"icon": "static_content/icon.svg",
"author": "MetaBuilder",
"category": "editors",
"dependencies": [],