1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4 | return new (P || (P = Promise))(function (resolve, reject) {
|
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9 | });
|
10 | };
|
11 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
12 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
13 | };
|
14 | Object.defineProperty(exports, "__esModule", { value: true });
|
15 | const ops_1 = __importDefault(require("./ops"));
|
16 | const execute = (renderedActions, args, config) => __awaiter(void 0, void 0, void 0, function* () {
|
17 | const { logger } = config;
|
18 | const messages = [];
|
19 | const results = [];
|
20 | for (const action of renderedActions) {
|
21 | const { message } = action.attributes;
|
22 | if (message) {
|
23 | messages.push(message);
|
24 | }
|
25 | const ops = ops_1.default(action.attributes);
|
26 | for (const op of ops) {
|
27 | results.push(yield op(action, args, config));
|
28 | }
|
29 | }
|
30 | if (messages.length > 0) {
|
31 | logger.colorful(`${args.action}:\n${messages.join('\n')}`);
|
32 | }
|
33 | return results;
|
34 | });
|
35 | module.exports = execute;
|
36 |
|
\ | No newline at end of file |