update: types,packages,lua (4 files)

This commit is contained in:
Richard Ward
2025-12-30 15:05:30 +00:00
parent 88a5916d09
commit 61ba630e42
4 changed files with 452 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
-- LuaCATS type definitions for arcade_lobby package
-- See: https://luals.github.io/wiki/annotations/
--------------------------------------------------------------------------------
-- Player & Party Types
--------------------------------------------------------------------------------
---@class Player
---@field id string Player ID
---@field username string Player username
---@field rating number Matchmaking rating/ELO
---@field level number Account level
---@field status "online"|"in_queue"|"in_game"|"offline" Player status
---@class Party
---@field id string Party ID
---@field leaderId string Party leader's player ID
---@field members Player[] Party members
---@field size number Number of members
---@class PartyInvite
---@field id string Invite ID
---@field fromPlayerId string Inviting player ID
---@field toPlayerId string Invited player ID
---@field partyId string Target party ID
---@field expiresAt string ISO date string
--------------------------------------------------------------------------------
-- Matchmaking Types
--------------------------------------------------------------------------------
---@alias QueueBucket "solo"|"duo"|"squad"
---@class QueueEntry
---@field partyId string Party ID
---@field bucket QueueBucket Queue bucket
---@field joinedAt string ISO date string
---@field avgRating number Average party rating
---@field region string Server region
---@class MatchResult
---@field success boolean Match found
---@field matchId? string Created match ID
---@field players? Player[] Matched players
---@field estimatedWait? number Estimated seconds until match
---@class QueueMetrics
---@field solo number Players in solo queue
---@field duo number Players in duo queue
---@field squad number Players in squad queue
---@field avgWaitTime number Average wait in seconds
---@field activeMatches number Current active matches
--------------------------------------------------------------------------------
-- Permission Types
--------------------------------------------------------------------------------
---@class LobbyPermissions
---@field canCreateParty boolean Can create parties
---@field canInvite boolean Can invite to party
---@field canQueue boolean Can join matchmaking
---@field canSpectate boolean Can spectate matches
--------------------------------------------------------------------------------
-- Matchmaking Module
--------------------------------------------------------------------------------
---@class MatchmakingModule
---@field assign_bucket fun(party: Party): QueueBucket Determine queue bucket
---@field joinQueue fun(party: Party, region?: string): QueueEntry Join matchmaking
---@field leaveQueue fun(partyId: string): boolean Leave matchmaking
---@field getQueueStatus fun(partyId: string): QueueEntry|nil Get queue status
---@class PermissionsModule
---@field check fun(playerId: string): LobbyPermissions Get player permissions
---@field canJoinParty fun(playerId: string, partyId: string): boolean Check party join permission
---@class QueueMetricsModule
---@field get fun(): QueueMetrics Get current metrics
---@field getByRegion fun(region: string): QueueMetrics Get regional metrics
return {}

View File

@@ -0,0 +1,102 @@
-- LuaCATS type definitions for audit_log package
-- See: https://luals.github.io/wiki/annotations/
--------------------------------------------------------------------------------
-- Audit Entry Types
--------------------------------------------------------------------------------
---@class AuditLogEntry
---@field id string Entry ID
---@field timestamp string ISO date string
---@field operation "create"|"read"|"update"|"delete"|"login"|"logout"|"other" Operation type
---@field entity string Entity/table name
---@field entityId? string Target entity ID
---@field userId string Acting user ID
---@field username string Acting username
---@field userLevel number User's permission level
---@field tenantId string Tenant context
---@field details table<string, any> Operation details
---@field ipAddress? string Client IP address
---@field userAgent? string Client user agent
---@class AuditChange
---@field field string Changed field name
---@field oldValue any Previous value
---@field newValue any New value
---@class AuditEntryWithChanges : AuditLogEntry
---@field changes AuditChange[] Field-level changes
--------------------------------------------------------------------------------
-- Filter Types
--------------------------------------------------------------------------------
---@class AuditFilter
---@field operation? string Filter by operation type
---@field entity? string Filter by entity name
---@field userId? string Filter by acting user
---@field startDate? string ISO date string
---@field endDate? string ISO date string
---@field limit? number Max results
---@field offset? number Skip results
---@class FilterResult
---@field entries AuditLogEntry[] Matching entries
---@field total number Total matching count
---@field hasMore boolean More results available
--------------------------------------------------------------------------------
-- Formatting Types
--------------------------------------------------------------------------------
---@alias TimeFormat "relative"|"absolute"|"iso"
---@class FormattingOptions
---@field timeFormat? TimeFormat How to format timestamps
---@field includeDetails? boolean Include full details
---@field highlightChanges? boolean Highlight changed fields
---@class FormattedEntry
---@field id string Entry ID
---@field timeDisplay string Formatted timestamp
---@field summary string Human-readable summary
---@field badge table Badge display info
---@field expandable boolean Has expandable details
--------------------------------------------------------------------------------
-- Statistics Types
--------------------------------------------------------------------------------
---@class AuditStats
---@field totalEntries number Total log entries
---@field entriesByOperation table<string, number> Count per operation
---@field entriesByEntity table<string, number> Count per entity
---@field topUsers table<string, number> Most active users
---@field recentActivity number Entries in last 24h
---@class ActivityTrend
---@field date string Date (YYYY-MM-DD)
---@field count number Entry count
---@field operations table<string, number> Breakdown by operation
--------------------------------------------------------------------------------
-- Audit Modules
--------------------------------------------------------------------------------
---@class FiltersModule
---@field apply fun(entries: AuditLogEntry[], filter: AuditFilter): FilterResult Apply filters
---@field byOperation fun(entries: AuditLogEntry[], op: string): AuditLogEntry[] Filter by operation
---@field byDateRange fun(entries: AuditLogEntry[], start: string, end_: string): AuditLogEntry[] Filter by date
---@field byUser fun(entries: AuditLogEntry[], userId: string): AuditLogEntry[] Filter by user
---@class FormattingModule
---@field formatEntry fun(entry: AuditLogEntry, options?: FormattingOptions): FormattedEntry
---@field formatTime fun(timestamp: string, format?: TimeFormat): string
---@field generateSummary fun(entry: AuditLogEntry): string
---@class StatsModule
---@field calculate fun(entries: AuditLogEntry[]): AuditStats
---@field getTrends fun(entries: AuditLogEntry[], days?: number): ActivityTrend[]
---@field getTopEntities fun(entries: AuditLogEntry[], limit?: number): table<string, number>
return {}

View File

@@ -0,0 +1,124 @@
-- LuaCATS type definitions for code_editor package
-- See: https://luals.github.io/wiki/annotations/
--------------------------------------------------------------------------------
-- Editor Types
--------------------------------------------------------------------------------
---@alias EditorLanguage "lua"|"json"|"javascript"|"typescript"|"html"|"css"|"yaml"|"markdown"|"sql"
---@class EditorOptions
---@field language? EditorLanguage Code language
---@field read_only? boolean Disable editing
---@field line_numbers? boolean Show line numbers
---@field word_wrap? boolean Enable word wrap
---@field minimap? boolean Show minimap
---@field theme? "dark"|"light" Editor theme
---@field font_size? number Font size in pixels
---@field tab_size? number Tab width in spaces
---@field show_snippets? boolean Show snippet suggestions
---@class EditorState
---@field value string Current editor content
---@field language EditorLanguage Active language
---@field cursorPosition CursorPosition Cursor location
---@field selection? Selection Selected text range
---@field dirty boolean Has unsaved changes
---@class CursorPosition
---@field line number Line number (1-indexed)
---@field column number Column number (1-indexed)
---@class Selection
---@field startLine number Start line
---@field startColumn number Start column
---@field endLine number End line
---@field endColumn number End column
--------------------------------------------------------------------------------
-- Validation Types
--------------------------------------------------------------------------------
---@class ValidationResult
---@field valid boolean Is code valid
---@field errors ValidationError[] Syntax errors
---@field warnings ValidationWarning[] Warnings
---@class ValidationError
---@field line number Error line
---@field column number Error column
---@field message string Error message
---@field severity "error" Severity level
---@class ValidationWarning
---@field line number Warning line
---@field column number Warning column
---@field message string Warning message
---@field severity "warning" Severity level
--------------------------------------------------------------------------------
-- Execution Types
--------------------------------------------------------------------------------
---@class SandboxAction
---@field action "execute"|"validate"|"format" Action type
---@field sandbox boolean Run in sandbox
---@field context table<string, any> Execution context
---@class ExecutionResult
---@field success boolean Execution succeeded
---@field output? any Return value
---@field error? string Error message
---@field logs string[] Console output
---@field executionTime number Time in milliseconds
--------------------------------------------------------------------------------
-- Theme Types
--------------------------------------------------------------------------------
---@class EditorTheme
---@field name string Theme name
---@field type "dark"|"light" Theme type
---@field colors ThemeColors Color palette
---@class ThemeColors
---@field background string Background color
---@field foreground string Text color
---@field lineNumbers string Line number color
---@field selection string Selection highlight
---@field cursor string Cursor color
---@field keywords string Keyword color
---@field strings string String color
---@field comments string Comment color
---@field numbers string Number color
---@field functions string Function color
--------------------------------------------------------------------------------
-- UI Components
--------------------------------------------------------------------------------
---@class UIComponent
---@field type string Component type name
---@field props? table<string, any> Component props
---@field children? UIComponent[] Nested children
--------------------------------------------------------------------------------
-- Editor Modules
--------------------------------------------------------------------------------
---@class LuaEditorModule
---@field render fun(value?: string, options?: EditorOptions): UIComponent Render Lua editor
---@field validate fun(lua_code: string): ValidationResult Validate Lua syntax
---@field run_sandbox fun(lua_code: string, context?: table): SandboxAction Execute in sandbox
---@class JsonEditorModule
---@field render fun(value?: string, options?: EditorOptions): UIComponent Render JSON editor
---@field validate fun(json_code: string): ValidationResult Validate JSON syntax
---@field format fun(json_code: string, indent?: number): string Format JSON
---@class ThemeModule
---@field getTheme fun(name: string): EditorTheme Get theme by name
---@field listThemes fun(): string[] List available themes
---@field applyTheme fun(theme: EditorTheme): boolean Apply theme to editor
return {}

View File

@@ -0,0 +1,144 @@
-- LuaCATS type definitions for screenshot_analyzer package
-- See: https://luals.github.io/wiki/annotations/
--------------------------------------------------------------------------------
-- Page Analysis Types
--------------------------------------------------------------------------------
---@class ElementCounts
---@field headings integer Number of heading elements
---@field paragraphs integer Number of paragraph elements
---@field links integer Number of link elements
---@field images integer Number of image elements
---@field buttons integer Number of button elements
---@field inputs integer Number of input elements
---@field forms integer Number of form elements
---@field tables integer Number of table elements
---@class PageStructure
---@field text_length integer Length of text content
---@field html_length integer Length of HTML sample
---@field element_counts ElementCounts Element count breakdown
---@class StructureResult
---@field success boolean Whether analysis succeeded
---@field structure PageStructure Structure analysis data
--------------------------------------------------------------------------------
-- Page Type Detection
--------------------------------------------------------------------------------
---@alias PageType
---| "homepage"
---| "login"
---| "dashboard"
---| "article"
---| "form"
---| "listing"
---| "profile"
---| "settings"
---| "error"
---| "unknown"
---@class PageTypeIndicators
---@field has_form boolean Whether page has forms
---@field has_login boolean Whether page has login form
---@field has_table boolean Whether page has tables
---@field has_article boolean Whether page has article element
---@field has_navigation boolean Whether page has nav element
---@field has_sidebar boolean Whether page has sidebar
---@class PageTypeResult
---@field success boolean Whether detection succeeded
---@field page_type PageType Detected page type
---@field confidence number Confidence score (0-1)
---@field indicators PageTypeIndicators Detection indicators
--------------------------------------------------------------------------------
-- Page Info
--------------------------------------------------------------------------------
---@class PageInfo
---@field url string Current page URL
---@field title string Page title
---@field description? string Meta description
---@field viewport? ViewportInfo Viewport dimensions
---@field loadTime? number Page load time in ms
---@class ViewportInfo
---@field width number Viewport width
---@field height number Viewport height
---@field devicePixelRatio number Device pixel ratio
--------------------------------------------------------------------------------
-- Screenshot Capture
--------------------------------------------------------------------------------
---@class CaptureOptions
---@field fullPage? boolean Capture full page
---@field selector? string CSS selector to capture
---@field format? "png"|"jpeg"|"webp" Image format
---@field quality? number Image quality (1-100)
---@field scale? number Screenshot scale factor
---@class CaptureResult
---@field success boolean Whether capture succeeded
---@field dataUrl? string Base64 data URL
---@field width? number Image width
---@field height? number Image height
---@field error? string Error message
--------------------------------------------------------------------------------
-- Recommendations
--------------------------------------------------------------------------------
---@alias RecommendationType "accessibility"|"usability"|"performance"|"seo"
---@alias RecommendationPriority "high"|"medium"|"low"
---@class Recommendation
---@field type RecommendationType Type of recommendation
---@field priority RecommendationPriority Priority level
---@field message string Recommendation message
---@field element? string Related element selector
---@field fix? string Suggested fix
---@class RecommendationsResult
---@field success boolean Whether analysis succeeded
---@field recommendations Recommendation[] List of recommendations
---@field count integer Number of recommendations
---@field byPriority table<RecommendationPriority, integer> Count by priority
--------------------------------------------------------------------------------
-- Report Generation
--------------------------------------------------------------------------------
---@class ReportData
---@field structure PageStructure Structure data
---@field page_type PageTypeResult Page type data
---@field info PageInfo Page info data
---@field recommendations Recommendation[] Recommendations
---@class ReportResult
---@field success boolean Whether report generation succeeded
---@field report string Markdown formatted report
---@field data ReportData Raw report data
--------------------------------------------------------------------------------
-- Analyzer Modules
--------------------------------------------------------------------------------
---@class AnalyzeModule
---@field analyze_structure fun(): StructureResult Analyze page structure
---@field detect_page_type fun(): PageTypeResult Detect page type
---@field get_recommendations fun(): RecommendationsResult Get improvement recommendations
---@field generate_report fun(): ReportResult Generate full report
---@class CaptureModule
---@field screenshot fun(options?: CaptureOptions): CaptureResult Take screenshot
---@field captureElement fun(selector: string, options?: CaptureOptions): CaptureResult Capture element
---@class PageInfoModule
---@field get fun(): PageInfo Get current page info
---@field getViewport fun(): ViewportInfo Get viewport info
return {}