firebase-tools
Version:
Command-Line Interface for Firebase
54 lines (53 loc) • 2.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.markdownDocsOfTools = exports.availableTools = void 0;
const index_1 = require("./auth/index");
const index_2 = require("./dataconnect/index");
const index_3 = require("./firestore/index");
const index_4 = require("./core/index");
const index_5 = require("./storage/index");
const index_6 = require("./messaging/index");
const index_7 = require("./remoteconfig/index");
const index_8 = require("./crashlytics/index");
const index_9 = require("./apphosting/index");
function availableTools(activeFeatures) {
const toolDefs = addFeaturePrefix("firebase", index_4.coreTools);
if (!(activeFeatures === null || activeFeatures === void 0 ? void 0 : activeFeatures.length)) {
activeFeatures = Object.keys(tools);
}
for (const key of activeFeatures) {
toolDefs.push(...tools[key]);
}
return toolDefs;
}
exports.availableTools = availableTools;
const tools = {
firestore: addFeaturePrefix("firestore", index_3.firestoreTools),
auth: addFeaturePrefix("auth", index_1.authTools),
dataconnect: addFeaturePrefix("dataconnect", index_2.dataconnectTools),
storage: addFeaturePrefix("storage", index_5.storageTools),
messaging: addFeaturePrefix("messaging", index_6.messagingTools),
remoteconfig: addFeaturePrefix("remoteconfig", index_7.remoteConfigTools),
crashlytics: addFeaturePrefix("crashlytics", index_8.crashlyticsTools),
apphosting: addFeaturePrefix("apphosting", index_9.appHostingTools),
};
function addFeaturePrefix(feature, tools) {
return tools.map((tool) => (Object.assign(Object.assign({}, tool), { mcp: Object.assign(Object.assign({}, tool.mcp), { name: `${feature}_${tool.mcp.name}`, _meta: Object.assign(Object.assign({}, tool.mcp._meta), { feature }) }) })));
}
function markdownDocsOfTools() {
var _a, _b, _c;
const allTools = availableTools([]);
let doc = `
| Tool Name | Feature Group | Description |
| --------- | ------------- | ----------- |`;
for (const tool of allTools) {
let feature = ((_b = (_a = tool.mcp) === null || _a === void 0 ? void 0 : _a._meta) === null || _b === void 0 ? void 0 : _b.feature) || "";
if (feature === "firebase") {
feature = "core";
}
doc += `
| ${tool.mcp.name} | ${feature} | ${((_c = tool.mcp) === null || _c === void 0 ? void 0 : _c.description) || ""} |`;
}
return doc;
}
exports.markdownDocsOfTools = markdownDocsOfTools;