From d23fd32e8410e4c306e4ca5d2545421b18861052 Mon Sep 17 00:00:00 2001 From: Alexey Date: Sat, 2 Aug 2025 01:01:05 +0300 Subject: [PATCH] update annotations --- com/_globals.lua | 55 ++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/com/_globals.lua b/com/_globals.lua index 2100958..3a84933 100644 --- a/com/_globals.lua +++ b/com/_globals.lua @@ -4,46 +4,51 @@ ---@alias AnyTable table --- Global session module interface +---@class SessionIn +---@field params AnyTable Request parameters + +---@class SessionOut +---@field result Any|string? Result payload (table or primitive) +---@field error { code: integer, message: string, data: Any }? Optional error info + ---@class SessionModule ----@field in AnyTable Input context (read-only) ----@field in.params AnyTable Request parameters ----@field out AnyTable Output context (write results/errors) ----@field out.result Any|string? Result payload (table or primitive) ----@field out.error { code: integer, message: string }? Optional error info +---@field in SessionIn Input context (read-only) +---@field out SessionOut Output context (write results/errors) --- Global log module interface ---@class LogModule ----@field info fun(msg: string) Log informational message ----@field debug fun(msg: string) Log debug message ----@field error fun(msg: string) Log error message ----@field warn fun(msg: string) Log warning message ----@field event fun(msg: string) Log event (generic) ----@field event_error fun(msg: string) Log event error ----@field event_warn fun(msg: string) Log event warning +---@field info fun(msg: string) Log informational message +---@field debug fun(msg: string) Log debug message +---@field error fun(msg: string) Log error message +---@field warn fun(msg: string) Log warning message +---@field event fun(msg: string) Log event (generic) +---@field event_error fun(msg: string) Log event error +---@field event_warn fun(msg: string) Log event warning --- Global net module interface ---@class HttpResponse ----@field status integer HTTP status code ----@field status_text string HTTP status text ----@field body string Response body +---@field status integer HTTP status code +---@field status_text string HTTP status text +---@field body string Response body ---@field content_length integer Content length ----@field headers AnyTable Map of headers +---@field headers AnyTable Map of headers ---@class HttpModule ----@field get fun(log: boolean, url: string): HttpResponse, string? Perform GET ----@field post fun(log: boolean, url: string, content_type: string, payload: string): HttpResponse, string? Perform POST +---@field get fun(log: boolean, url: string): HttpResponse, string? Perform GET +---@field post fun(log: boolean, url: string, content_type: string, payload: string): HttpResponse, string? Perform POST ---@class NetModule ----@field http HttpModule HTTP client functions +---@field http HttpModule HTTP client functions ---- Global session variable +--- Global variables declaration +---@global ---@type SessionModule -_G.session = _G.session or {} +_G.session = session or {} ---- Global log variable +---@global ---@type LogModule -_G.log = _G.log or {} +_G.log = log or {} ---- Global net variable +---@global ---@type NetModule -_G.net = _G.net or {} \ No newline at end of file +_G.net = net or {} \ No newline at end of file