UNPKG

firebase-tools

Version:
35 lines (34 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.publish_template = void 0; const zod_1 = require("zod"); const tool_js_1 = require("../../tool.js"); const util_js_1 = require("../../util.js"); const publish_js_1 = require("../../../remoteconfig/publish.js"); exports.publish_template = (0, tool_js_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_js_1.mcpError)(`No template specified in the publish requests`); } if (force === undefined) { return (0, util_js_1.toContent)(await (0, publish_js_1.publishTemplate)(projectId, template)); } return (0, util_js_1.toContent)(await (0, publish_js_1.publishTemplate)(projectId, template, { force })); });