UNPKG

@cocalc/server

Version:

CoCalc server functionality: functions used by either the hub and the next.js server

17 lines 800 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const pool_1 = __importDefault(require("@cocalc/database/pool")); const misc_1 = require("@cocalc/util/misc"); async function isSandbox(project_id) { if (!(0, misc_1.is_valid_uuid_string)(project_id)) { throw Error("invalid project_id"); } const pool = (0, pool_1.default)("long"); // fine to cache "yes, you're a sandbox project" for a few seconds is fine. const { rows } = await pool.query(`SELECT sandbox FROM projects WHERE project_id=\$1`, [project_id]); return !!rows[0]?.sandbox; } exports.default = isSandbox; //# sourceMappingURL=is-sandbox.js.map