firebase-tools
Version:
Command-Line Interface for Firebase
35 lines (34 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.publish_template = void 0;
const zod_1 = require("zod");
const tool_1 = require("../../tool");
const util_1 = require("../../util");
const publish_1 = require("../../../remoteconfig/publish");
exports.publish_template = (0, tool_1.tool)({
name: "publish_template",
description: "Publishes a new remote config template for the project",
inputSchema: zod_1.z.object({
template: zod_1.z.object({}).describe("The Remote Config template object to publish."),
force: zod_1.z
.boolean()
.optional()
.describe("If true, the publish will bypass ETag validation and overwrite the current template. Defaults to false if not provided."),
}),
annotations: {
title: "Publish Remote Config template",
readOnlyHint: false,
},
_meta: {
requiresAuth: true,
requiresProject: true,
},
}, async ({ template, force }, { projectId }) => {
if (template === undefined) {
return (0, util_1.mcpError)(`No template specified in the publish requests`);
}
if (force === undefined) {
return (0, util_1.toContent)(await (0, publish_1.publishTemplate)(projectId, template));
}
return (0, util_1.toContent)(await (0, publish_1.publishTemplate)(projectId, template, { force }));
});