"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const list_1 = __importDefault(require("./list"));
const upload_1 = __importDefault(require("./upload"));
function publish(type, options) {
    return __awaiter(this, void 0, void 0, function* () {
        const paramsHandler = {
            ls: list_1.default,
            list: list_1.default,
            upload: () => {
                (0, upload_1.default)(options);
            }, // 上传oss
        };
        if (Object.prototype.hasOwnProperty.call(paramsHandler, type)) {
            const fn = paramsHandler[type];
            yield fn();
        }
    });
}
// 发布命令的核心逻辑
function execOss(options) {
    return __awaiter(this, void 0, void 0, function* () {
        Object.keys(options).forEach((type) => __awaiter(this, void 0, void 0, function* () {
            yield publish(type, options);
        }));
    });
}
exports.default = execOss;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9jb21tYW5kcy9vc3MvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7QUFBQSxrREFBNEI7QUFDNUIsc0RBQW1EO0FBV25ELFNBQWUsT0FBTyxDQUFDLElBQVcsRUFBRSxPQUF5Qjs7UUFDM0QsTUFBTSxhQUFhLEdBQW9CO1lBQ3JDLEVBQUUsRUFBRSxjQUFPO1lBQ1gsSUFBSSxFQUFFLGNBQU87WUFDYixNQUFNLEVBQUUsR0FBRyxFQUFFO2dCQUNYLElBQUEsZ0JBQU0sRUFBQyxPQUFPLENBQUMsQ0FBQTtZQUNqQixDQUFDLEVBQUUsUUFBUTtTQUNaLENBQUE7UUFDRCxJQUFJLE1BQU0sQ0FBQyxTQUFTLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLEVBQUU7WUFDN0QsTUFBTSxFQUFFLEdBQUcsYUFBYSxDQUFDLElBQUksQ0FBQyxDQUFBO1lBQzlCLE1BQU0sRUFBRSxFQUFFLENBQUE7U0FDWDtJQUNILENBQUM7Q0FBQTtBQUVELFlBQVk7QUFDWixTQUFlLE9BQU8sQ0FBQyxPQUF5Qjs7UUFDOUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBTyxJQUFJLEVBQUUsRUFBRTtZQUMxQyxNQUFNLE9BQU8sQ0FBQyxJQUFhLEVBQUUsT0FBTyxDQUFDLENBQUE7UUFDdkMsQ0FBQyxDQUFBLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FBQTtBQUVELGtCQUFlLE9BQU8sQ0FBQSJ9