convex
Version:
Client for the Convex Cloud
58 lines (57 loc) • 2.16 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(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var api_exports = {};
__export(api_exports, {
getDevDeployment: () => getDevDeployment,
getUrlAndAdminKey: () => getUrlAndAdminKey
});
module.exports = __toCommonJS(api_exports);
var import_chalk = __toESM(require("chalk"));
var import_utils = require("./utils.js");
async function getUrlAndAdminKey(ctx, projectSlug, teamSlug, deploymentType) {
const authorizeArgs = {
projectSlug,
teamSlug,
deploymentType
};
const data = await (0, import_utils.bigBrainAPI)(
ctx,
"POST",
"deployment/authorize",
authorizeArgs
);
const adminKey = data.adminKey;
const url = data.url;
if (adminKey === void 0 || url === void 0) {
const msg = "Unknown error during authorization: " + JSON.stringify(data);
console.error(import_chalk.default.red(msg));
return await ctx.fatalError(1, "network", new Error(msg));
}
return { adminKey, url };
}
async function getDevDeployment(ctx, args) {
return await (0, import_utils.bigBrainAPI)(ctx, "PUT", "dev_deployment", args);
}
//# sourceMappingURL=api.js.map