mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
update: ui,types,packages (3 files)
This commit is contained in:
113
packages/ui_level4/seed/scripts/types.lua
Normal file
113
packages/ui_level4/seed/scripts/types.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
-- LuaCATS type definitions for ui_level4 package (Admin Panel)
|
||||
-- See: https://luals.github.io/wiki/annotations/
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Render Context
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class RenderContext
|
||||
---@field user User Current logged-in user (level 4+)
|
||||
---@field stats? AdminStats System statistics
|
||||
|
||||
---@class User
|
||||
---@field id string User ID
|
||||
---@field username string Username
|
||||
---@field level number Permission level (4 = ADMIN)
|
||||
---@field tenantId string Admin's tenant ID
|
||||
|
||||
---@class AdminStats
|
||||
---@field totalUsers number Total user count
|
||||
---@field activeUsers number Active users today
|
||||
---@field totalWorkflows number Workflow count
|
||||
---@field totalSchemas number Schema count
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Schema Types
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class Schema
|
||||
---@field id string Schema ID
|
||||
---@field name string Schema name
|
||||
---@field description? string Schema description
|
||||
---@field fields SchemaField[] Schema fields
|
||||
---@field createdAt string ISO date string
|
||||
---@field updatedAt string ISO date string
|
||||
|
||||
---@class SchemaField
|
||||
---@field name string Field name
|
||||
---@field type "string"|"number"|"boolean"|"date"|"reference"|"array" Field type
|
||||
---@field required? boolean Is required
|
||||
---@field defaultValue? any Default value
|
||||
---@field validation? FieldValidation Validation rules
|
||||
|
||||
---@class FieldValidation
|
||||
---@field min? number Minimum value/length
|
||||
---@field max? number Maximum value/length
|
||||
---@field pattern? string Regex pattern
|
||||
---@field enum? any[] Allowed values
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Workflow Types
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class Workflow
|
||||
---@field id string Workflow ID
|
||||
---@field name string Workflow name
|
||||
---@field description? string Workflow description
|
||||
---@field steps WorkflowStep[] Workflow steps
|
||||
---@field trigger? WorkflowTrigger Trigger configuration
|
||||
---@field enabled boolean Is workflow active
|
||||
|
||||
---@class WorkflowStep
|
||||
---@field id string Step ID
|
||||
---@field name string Step name
|
||||
---@field type "action"|"condition"|"transform"|"lua" Step type
|
||||
---@field config table<string, any> Step configuration
|
||||
---@field next? string[] Next step IDs
|
||||
|
||||
---@class WorkflowTrigger
|
||||
---@field type "manual"|"schedule"|"event" Trigger type
|
||||
---@field config table<string, any> Trigger configuration
|
||||
|
||||
---@class WorkflowsRenderContext
|
||||
---@field workflows? Workflow[] Available workflows
|
||||
|
||||
---@class ActionResult
|
||||
---@field success boolean Whether action succeeded
|
||||
---@field action string Action identifier
|
||||
---@field id? string Created/modified ID
|
||||
---@field error? string Error message
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- UI Components
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type name
|
||||
---@field props? table<string, any> Component props
|
||||
---@field children? UIComponent[] Nested children
|
||||
|
||||
---@class CardProps
|
||||
---@field variant? "default"|"outlined" Card style
|
||||
---@field className? string CSS classes
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Admin Modules
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class SchemasModule
|
||||
---@field render fun(schemas: Schema[]): UIComponent Render schemas tab
|
||||
---@field create fun(data: Schema): ActionResult Create new schema
|
||||
---@field update fun(id: string, data: Schema): ActionResult Update schema
|
||||
---@field delete fun(id: string): ActionResult Delete schema
|
||||
|
||||
---@class WorkflowsModule
|
||||
---@field render fun(ctx: WorkflowsRenderContext): UIComponent Render workflows tab
|
||||
---@field addWorkflow fun(): ActionResult Open add workflow dialog
|
||||
---@field runWorkflow fun(id: string): ActionResult Execute workflow
|
||||
|
||||
---@class LayoutModule
|
||||
---@field render fun(ctx: RenderContext): UIComponent Main layout renderer
|
||||
---@field tabs fun(): UIComponent Tab navigation component
|
||||
|
||||
return {}
|
||||
110
packages/ui_level5/seed/scripts/types.lua
Normal file
110
packages/ui_level5/seed/scripts/types.lua
Normal file
@@ -0,0 +1,110 @@
|
||||
-- LuaCATS type definitions for ui_level5 package (God Panel)
|
||||
-- See: https://luals.github.io/wiki/annotations/
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Render Context
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class RenderContext
|
||||
---@field user User Current logged-in user (level 5+)
|
||||
---@field currentTenant? Tenant Current tenant context
|
||||
|
||||
---@class User
|
||||
---@field id string User ID
|
||||
---@field username string Username
|
||||
---@field level number Permission level (5 = GOD)
|
||||
---@field tenantId string User's tenant ID
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Tenant Types
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class Tenant
|
||||
---@field id string Tenant ID
|
||||
---@field name string Tenant name
|
||||
---@field slug string URL-safe identifier
|
||||
---@field domain? string Custom domain
|
||||
---@field status "active"|"suspended"|"pending" Tenant status
|
||||
---@field plan "free"|"pro"|"enterprise" Subscription plan
|
||||
---@field createdAt string ISO date string
|
||||
---@field settings TenantSettings Tenant configuration
|
||||
|
||||
---@class TenantSettings
|
||||
---@field maxUsers? number User limit
|
||||
---@field maxStorage? number Storage limit in bytes
|
||||
---@field features? string[] Enabled features
|
||||
---@field branding? TenantBranding Custom branding
|
||||
|
||||
---@class TenantBranding
|
||||
---@field logoUrl? string Logo URL
|
||||
---@field primaryColor? string Brand color
|
||||
---@field title? string Site title
|
||||
|
||||
---@class TenantStats
|
||||
---@field userCount number Active users
|
||||
---@field storageUsed number Bytes used
|
||||
---@field workflowCount number Workflow count
|
||||
---@field lastActive string ISO date string
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Power Transfer Types
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class PowerTransfer
|
||||
---@field id string Transfer ID
|
||||
---@field fromUserId string Source user ID
|
||||
---@field toUserId string Destination user ID
|
||||
---@field level number Level being transferred
|
||||
---@field reason string Transfer reason
|
||||
---@field status "pending"|"approved"|"rejected" Transfer status
|
||||
---@field createdAt string ISO date string
|
||||
---@field approvedBy? string Approver user ID
|
||||
|
||||
---@class TransferRequest
|
||||
---@field toUserId string Target user ID
|
||||
---@field level number Level to transfer
|
||||
---@field reason string Justification
|
||||
---@field duration? number Temporary transfer hours
|
||||
|
||||
---@class TransferResult
|
||||
---@field success boolean Whether transfer succeeded
|
||||
---@field transferId? string Created transfer ID
|
||||
---@field error? string Error message
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- UI Components
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type name
|
||||
---@field props? table<string, any> Component props
|
||||
---@field children? UIComponent[] Nested children
|
||||
|
||||
---@class SelectOption
|
||||
---@field value string Option value
|
||||
---@field label string Display label
|
||||
---@field disabled? boolean Disable option
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- God Panel Modules
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class TenantsModule
|
||||
---@field list fun(): Tenant[] List all tenants
|
||||
---@field get fun(id: string): Tenant Get tenant by ID
|
||||
---@field create fun(data: Tenant): Tenant Create new tenant
|
||||
---@field update fun(id: string, data: Tenant): Tenant Update tenant
|
||||
---@field suspend fun(id: string, reason: string): Tenant Suspend tenant
|
||||
---@field getStats fun(id: string): TenantStats Get tenant statistics
|
||||
|
||||
---@class TransferModule
|
||||
---@field request fun(data: TransferRequest): TransferResult Request transfer
|
||||
---@field approve fun(id: string): TransferResult Approve transfer
|
||||
---@field reject fun(id: string, reason: string): TransferResult Reject transfer
|
||||
---@field list fun(): PowerTransfer[] List pending transfers
|
||||
|
||||
---@class LayoutModule
|
||||
---@field render fun(ctx: RenderContext): UIComponent Main layout renderer
|
||||
---@field tabs fun(): UIComponent Tab navigation component
|
||||
|
||||
return {}
|
||||
162
packages/ui_level6/seed/scripts/types.lua
Normal file
162
packages/ui_level6/seed/scripts/types.lua
Normal file
@@ -0,0 +1,162 @@
|
||||
-- LuaCATS type definitions for ui_level6 package (Supergod Panel)
|
||||
-- See: https://luals.github.io/wiki/annotations/
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Render Context
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class RenderContext
|
||||
---@field user User Current logged-in user (level 6)
|
||||
|
||||
---@class User
|
||||
---@field id string User ID
|
||||
---@field username string Username
|
||||
---@field level number Permission level (6 = SUPERGOD)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- System Administration Types
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class SystemConfig
|
||||
---@field maintenance boolean Maintenance mode enabled
|
||||
---@field debugMode boolean Debug logging enabled
|
||||
---@field maxUploadSize number Max upload size in bytes
|
||||
---@field allowedOrigins string[] CORS origins
|
||||
---@field rateLimits RateLimitConfig Rate limiting config
|
||||
---@field features FeatureFlags Feature toggles
|
||||
|
||||
---@class RateLimitConfig
|
||||
---@field requestsPerMinute number API rate limit
|
||||
---@field loginAttemptsPerHour number Login attempt limit
|
||||
---@field uploadLimitPerDay number Daily upload limit
|
||||
|
||||
---@class FeatureFlags
|
||||
---@field [string] boolean Feature name to enabled state
|
||||
|
||||
---@class SystemHealth
|
||||
---@field status "healthy"|"degraded"|"down" Overall status
|
||||
---@field database DatabaseHealth Database status
|
||||
---@field cache CacheHealth Cache status
|
||||
---@field storage StorageHealth Storage status
|
||||
---@field uptime number Uptime in seconds
|
||||
---@field lastCheck string ISO date string
|
||||
|
||||
---@class DatabaseHealth
|
||||
---@field connected boolean Is connected
|
||||
---@field latencyMs number Query latency
|
||||
---@field poolSize number Connection pool size
|
||||
---@field activeConnections number Active connections
|
||||
|
||||
---@class CacheHealth
|
||||
---@field connected boolean Is connected
|
||||
---@field hitRate number Cache hit percentage
|
||||
---@field memoryUsed number Bytes used
|
||||
|
||||
---@class StorageHealth
|
||||
---@field available boolean Is available
|
||||
---@field usedBytes number Storage used
|
||||
---@field totalBytes number Total capacity
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Tenant Management (Global)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class GlobalTenant
|
||||
---@field id string Tenant ID
|
||||
---@field name string Tenant name
|
||||
---@field status "active"|"suspended"|"pending"|"deleted" Tenant status
|
||||
---@field plan "free"|"pro"|"enterprise" Subscription plan
|
||||
---@field ownerEmail string Owner email
|
||||
---@field createdAt string ISO date string
|
||||
---@field deletedAt? string Soft delete timestamp
|
||||
|
||||
---@class TenantAction
|
||||
---@field action "activate"|"suspend"|"delete"|"restore" Action type
|
||||
---@field tenantId string Target tenant
|
||||
---@field reason? string Action reason
|
||||
|
||||
---@class TenantActionResult
|
||||
---@field success boolean Action succeeded
|
||||
---@field tenant? GlobalTenant Updated tenant
|
||||
---@field error? string Error message
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Power Transfer (Global)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class GlobalTransfer
|
||||
---@field id string Transfer ID
|
||||
---@field fromUserId string Source user ID
|
||||
---@field fromUsername string Source username
|
||||
---@field toUserId string Destination user ID
|
||||
---@field toUsername string Destination username
|
||||
---@field level number Level being transferred
|
||||
---@field tenantId string Tenant context
|
||||
---@field status "pending"|"approved"|"rejected"|"expired" Status
|
||||
---@field createdAt string ISO date string
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Audit Log
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class AuditEntry
|
||||
---@field id string Entry ID
|
||||
---@field action string Action performed
|
||||
---@field actorId string User who performed action
|
||||
---@field actorUsername string Actor username
|
||||
---@field targetType "user"|"tenant"|"system"|"transfer" Target type
|
||||
---@field targetId string Target ID
|
||||
---@field details table<string, any> Action details
|
||||
---@field timestamp string ISO date string
|
||||
---@field ipAddress? string Client IP
|
||||
|
||||
---@class AuditFilter
|
||||
---@field action? string Filter by action
|
||||
---@field actorId? string Filter by actor
|
||||
---@field targetType? string Filter by target type
|
||||
---@field startDate? string Filter start date
|
||||
---@field endDate? string Filter end date
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- UI Components
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type name
|
||||
---@field props? table<string, any> Component props
|
||||
---@field children? UIComponent[] Nested children
|
||||
|
||||
---@class AlertProps
|
||||
---@field severity "info"|"warning"|"error"|"success" Alert type
|
||||
---@field title? string Alert title
|
||||
---@field message string Alert message
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Supergod Modules
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
---@class SystemModule
|
||||
---@field getConfig fun(): SystemConfig Get system configuration
|
||||
---@field updateConfig fun(config: SystemConfig): SystemConfig Update configuration
|
||||
---@field getHealth fun(): SystemHealth Get system health status
|
||||
---@field setMaintenance fun(enabled: boolean, message?: string): SystemConfig Toggle maintenance
|
||||
---@field clearCache fun(): boolean Clear all caches
|
||||
|
||||
---@class GlobalTenantsModule
|
||||
---@field list fun(filter?: table): GlobalTenant[] List all tenants
|
||||
---@field action fun(data: TenantAction): TenantActionResult Perform tenant action
|
||||
---@field getStats fun(): table<string, number> Get global statistics
|
||||
|
||||
---@class GlobalTransferModule
|
||||
---@field listAll fun(): GlobalTransfer[] List all pending transfers
|
||||
---@field override fun(id: string, decision: "approve"|"reject"): GlobalTransfer Override decision
|
||||
|
||||
---@class AuditModule
|
||||
---@field query fun(filter?: AuditFilter): AuditEntry[] Query audit log
|
||||
---@field export fun(filter?: AuditFilter, format?: "json"|"csv"): string Export log
|
||||
|
||||
---@class LayoutModule
|
||||
---@field render fun(ctx: RenderContext): UIComponent Main layout renderer
|
||||
---@field tabs fun(): UIComponent Tab navigation component
|
||||
|
||||
return {}
|
||||
Reference in New Issue
Block a user