// postiz-poster: Saltcorn plugin that publishes table rows to social networks // through a Postiz instance (self-hosted or cloud). Exposes one trigger action, // post_to_postiz, configured per-trigger. The Postiz connection itself lives in // the plugin configuration (see lib/config.js); the API key is sealed at rest // (see lib/apiKey.js). The saltcorn-mcp server drives the plugin through the // tools of lib/mcpTools.js. const { PLUGIN_NAME, ACTION_NAME } = require("./lib/constants"); const { configurationWorkflow } = require("./lib/config"); const { makePostAction } = require("./lib/action"); const { sealStoredApiKey } = require("./lib/apiKey"); const mcpTools = require("./lib/mcpTools"); // Runs each time the plugin loads. Seals a plaintext apiKey left in the database // by plugin versions before 0.0.3 (the configuration workflow now seals on save). const onLoad = async () => { try { await sealStoredApiKey(); } catch (err) { // eslint-disable-next-line no-console console.error(`[${PLUGIN_NAME}] sealing stored secrets failed:`, err); } }; module.exports = { sc_plugin_api_version: 1, plugin_name: PLUGIN_NAME, configuration_workflow: configurationWorkflow, onLoad: onLoad, // Saltcorn calls capability keys with the saved plugin config when a // configuration_workflow is present (see saltcorn-data db/state.ts). actions: (pluginCfg) => ({ [ACTION_NAME]: makePostAction(pluginCfg || {}) }), // saltcorn-mcp tools (mcp/docs/pluginTools.md); handlers read the current // configuration themselves, so the list does not depend on it. mcp_tools: () => mcpTools.tools() };