convex
Version:
Client for the Convex Cloud
82 lines (81 loc) • 3.34 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var filePaths_exports = {};
__export(filePaths_exports, {
binariesDir: () => binariesDir,
binaryZip: () => binaryZip,
deploymentStateDir: () => deploymentStateDir,
executablePath: () => executablePath,
loadDeploymentConfig: () => loadDeploymentConfig,
rootDeploymentStateDir: () => rootDeploymentStateDir,
saveDeploymentConfig: () => saveDeploymentConfig,
versionedBinaryDir: () => versionedBinaryDir
});
module.exports = __toCommonJS(filePaths_exports);
var import_path = __toESM(require("path"), 1);
var import_utils = require("../utils/utils.js");
function rootDeploymentStateDir() {
return import_path.default.join((0, import_utils.rootDirectory)(), "convex-backend-state");
}
function deploymentStateDir(deploymentName) {
return import_path.default.join(rootDeploymentStateDir(), deploymentName);
}
function loadDeploymentConfig(ctx, deploymentName) {
const configFile = import_path.default.join(
deploymentStateDir(deploymentName),
"config.json"
);
if (ctx.fs.exists(configFile)) {
return JSON.parse(ctx.fs.readUtf8File(configFile));
}
return null;
}
function saveDeploymentConfig(ctx, deploymentName, config) {
const configFile = import_path.default.join(
deploymentStateDir(deploymentName),
"config.json"
);
if (!ctx.fs.exists(deploymentStateDir(deploymentName))) {
ctx.fs.mkdir(deploymentStateDir(deploymentName), { recursive: true });
}
ctx.fs.writeUtf8File(configFile, JSON.stringify(config));
}
function binariesDir() {
return import_path.default.join((0, import_utils.rootDirectory)(), "binaries");
}
function binaryZip() {
return import_path.default.join(binariesDir(), "convex-backend.zip");
}
function versionedBinaryDir(version) {
return import_path.default.join(binariesDir(), version);
}
function executablePath(version) {
return import_path.default.join(versionedBinaryDir(version), "convex-local-backend");
}
//# sourceMappingURL=filePaths.js.map