firebase-tools
Version:
Command-Line Interface for Firebase
35 lines (34 loc) • 1.26 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.list_apps = void 0;
const zod_1 = require("zod");
const tool_js_1 = require("../../tool.js");
const util_js_1 = require("../../util.js");
const apps_js_1 = require("../../../management/apps.js");
exports.list_apps = (0, tool_js_1.tool)({
name: "list_apps",
description: "Retrieves apps registered in the current Firebase project.",
inputSchema: zod_1.z.object({
platform: zod_1.z
.enum(["ios", "android", "web", "all"])
.default("all")
.describe("the specific platform to list (omit to list all platforms)"),
}),
annotations: {
title: "List Firebase Apps",
readOnlyHint: true,
},
_meta: {
requiresProject: true,
requiresAuth: true,
},
}, async ({ platform }, { projectId }) => {
try {
const apps = await (0, apps_js_1.listFirebaseApps)(projectId, platform === "all" ? apps_js_1.AppPlatform.ANY : platform.toUpperCase());
return (0, util_js_1.toContent)(apps);
}
catch (err) {
const originalMessage = err.original ? `: ${err.original.message}` : "";
throw new Error(`Failed to list Firebase apps${originalMessage}`);
}
});
;