firebase-tools
Version:
Command-Line Interface for Firebase
54 lines (53 loc) • 2.58 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.markdownDocsOfTools = exports.availableTools = void 0;
const index_js_1 = require("./auth/index.js");
const index_js_2 = require("./dataconnect/index.js");
const index_js_3 = require("./firestore/index.js");
const index_js_4 = require("./core/index.js");
const index_js_5 = require("./storage/index.js");
const index_js_6 = require("./messaging/index.js");
const index_js_7 = require("./remoteconfig/index.js");
const index_js_8 = require("./crashlytics/index.js");
const index_js_9 = require("./apphosting/index.js");
function availableTools(activeFeatures) {
const toolDefs = addFeaturePrefix("firebase", index_js_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_js_3.firestoreTools),
auth: addFeaturePrefix("auth", index_js_1.authTools),
dataconnect: addFeaturePrefix("dataconnect", index_js_2.dataconnectTools),
storage: addFeaturePrefix("storage", index_js_5.storageTools),
messaging: addFeaturePrefix("messaging", index_js_6.messagingTools),
remoteconfig: addFeaturePrefix("remoteconfig", index_js_7.remoteConfigTools),
crashlytics: addFeaturePrefix("crashlytics", index_js_8.crashlyticsTools),
apphosting: addFeaturePrefix("apphosting", index_js_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;
;