firebase-tools
Version:
Command-Line Interface for Firebase
48 lines (47 loc) • 1.71 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.list_users = void 0;
const zod_1 = require("zod");
const tool_js_1 = require("../../tool.js");
const util_js_1 = require("../../util.js");
const auth_js_1 = require("../../../gcp/auth.js");
exports.list_users = (0, tool_js_1.tool)({
name: "list_users",
description: "Retrieves all users in the project up to the specified limit.",
inputSchema: zod_1.z.object({
limit: zod_1.z
.number()
.optional()
.default(100)
.describe("The number of users to return. Defaults to 100 if not supplied."),
}),
annotations: {
title: "List Firebase Users",
readOnlyHint: true,
},
_meta: {
requiresAuth: true,
requiresProject: true,
},
}, async ({ limit } = {}, { projectId }) => {
if (!limit) {
limit = 100;
}
const users = await (0, auth_js_1.listUsers)(projectId, limit);
const usersPruned = users.map((user) => {
const { passwordHash, salt } = user, prunedUser = __rest(user, ["passwordHash", "salt"]);
return prunedUser;
});
return (0, util_js_1.toContent)(usersPruned);
});
;