Module connector_script

Module connector_script 

Source
Expand description

Lua scripted connector runtime.

Loads .lua connector scripts at runtime and executes them in a sandboxed Lua 5.4 VM. Each script implements connector.scan(config) → items[], returning documents that flow into the standard ingestion pipeline.

§Architecture

The Lua VM runs on a blocking thread via [tokio::task::spawn_blocking] to avoid blocking the async runtime. HTTP calls use reqwest::blocking, and sleep() uses std::thread::sleep.

§Host APIs

Scripts have access to sandboxed host APIs provided by crate::lua_runtime:

ModuleFunctions
httpget, post, put
jsonparse, encode
envget
loginfo, warn, error, debug
fsread, list (sandboxed to script directory)
base64encode, decode
cryptosha256, hmac_sha256
sleepsleep(seconds)

§Configuration

[connectors.script.jira]
path = "connectors/jira.lua"
timeout = 600
url = "https://mycompany.atlassian.net"
api_token = "${JIRA_API_TOKEN}"

See docs/LUA_CONNECTORS.md for the full specification.

Structs§

ScriptConnector
A Lua scripted connector instance that implements the Connector trait.

Functions§

lua_table_to_source_items 🔒
Convert a Lua array table into a Vec of SourceItems.
parse_lua_timestamp 🔒
Parse a timestamp from a Lua table field.
run_lua_scan 🔒
Execute a Lua connector script and return the resulting source items.
scaffold_connector
Scaffold a new connector script from a template.
scan_script
Scan a Lua script connector and return the ingested items.
test_script
Test a connector script without writing to the database.