"use strict";
/*
Get all licenses that the signed in user manages.

See docs in @cocalc/server/licenses/get-managed.ts

Returns [License1, License2, ...] on success or {error:'a message'} on failure.
For the fields in the License objects, see @cocalc/server/licenses/get-managed.ts
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_managed_1 = __importDefault(require("@cocalc/server/licenses/get-managed"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
async function handle(req, res) {
    try {
        res.json(await get(req));
    }
    catch (err) {
        res.json({ error: `${err.message}` });
        return;
    }
}
exports.default = handle;
async function get(req) {
    const account_id = await (0, get_account_1.default)(req);
    if (account_id == null) {
        return [];
    }
    return await (0, get_managed_1.default)(account_id);
}
//# sourceMappingURL=get-managed.js.map