sc-theme-builder/lib/constants.js
2026-07-01 20:07:28 -05:00

32 lines
1.3 KiB
JavaScript

// One source of truth for plugin metadata, route paths, table name, caps, and
// config keys. Pure module: imports nothing (so it is safe to require from the
// unit-testable core as well as from the Saltcorn-dependent wiring).
const PLUGIN_NAME = "theme-builder"; // canonical plugin_name
const API_VERSION = 1;
const THEME_TABLE = "_themebuilder_themes";
const URL_PREFIX = "/theme-builder"; // top-level, NOT under core /admin
const API_BASE = `${URL_PREFIX}/api`;
const CSS_ROUTE = `${URL_PREFIX}/theme.css`;
const FORMAT_VERSION = 1; // export envelope formatVersion
const SCHEMA_ID = "saltcorn-theme";
const ENGINE = "bootstrap5";
const MAX_IMPORT_BYTES = 2 * 1024 * 1024; // 2 MiB
const MAX_TOKENS = 2000;
const ROLE_ADMIN = 1;
const ROLE_PUBLIC = 100;
// config keys (live in plugin.configuration):
const CFG = {
ACTIVE: "activeThemeId",
BY_ROLE: "activeByRole",
HASH: "activeHash",
LAYOUT_MODE: "layoutMode",
SCHEMA_VER: "schemaVersion",
};
module.exports = {
PLUGIN_NAME, API_VERSION, THEME_TABLE, URL_PREFIX, API_BASE, CSS_ROUTE,
FORMAT_VERSION, SCHEMA_ID, ENGINE, MAX_IMPORT_BYTES, MAX_TOKENS,
ROLE_ADMIN, ROLE_PUBLIC, CFG,
};