@serverless-devs/engine 0.0.1-beta.2 → 0.0.1-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ interface IOptions {
4
4
  hookLevel: `${IActionLevel}`;
5
5
  projectName?: string;
6
6
  logger: ILoggerInstance;
7
+ skipActions?: boolean;
7
8
  }
8
9
  declare class Actions {
9
10
  private actions;
@@ -13,7 +14,9 @@ declare class Actions {
13
14
  private inputs;
14
15
  constructor(actions?: IAction[], option?: IOptions);
15
16
  setValue(key: string, value: any): void;
16
- start(hookType: `${IHookType}`, inputs?: Record<string, any>): Promise<Record<string, any>>;
17
+ start(hookType: `${IHookType}`, inputs?: Record<string, any>): Promise<{}>;
18
+ private afterStart;
19
+ private onFinish;
17
20
  private run;
18
21
  private plugin;
19
22
  private component;
@@ -38,12 +38,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  const parse_spec_1 = require("@serverless-devs/parse-spec");
39
39
  const lodash_1 = require("lodash");
40
40
  const utils = __importStar(require("@serverless-devs/utils"));
41
+ const utils_1 = require("@serverless-devs/utils");
41
42
  const fs_extra_1 = __importDefault(require("fs-extra"));
42
- const execa_1 = __importDefault(require("execa"));
43
+ const execa_1 = require("execa");
43
44
  const load_component_1 = __importDefault(require("@serverless-devs/load-component"));
44
45
  const string_argv_1 = __importDefault(require("string-argv"));
45
- const utils_1 = require("../utils");
46
+ const utils_2 = require("../utils");
46
47
  const chalk_1 = __importDefault(require("chalk"));
48
+ const constants_1 = require("../constants");
47
49
  const debug = require('@serverless-cd/debug')('serverless-devs:engine');
48
50
  class Actions {
49
51
  constructor(actions = [], option = {}) {
@@ -54,20 +56,48 @@ class Actions {
54
56
  this.logger = option.logger;
55
57
  }
56
58
  setValue(key, value) {
59
+ if (this.option.skipActions)
60
+ return;
57
61
  (0, lodash_1.set)(this.record, key, value);
58
62
  }
59
63
  start(hookType, inputs = {}) {
60
64
  return __awaiter(this, void 0, void 0, function* () {
65
+ try {
66
+ return yield this.afterStart(hookType, inputs);
67
+ }
68
+ catch (error) {
69
+ if (this.option.hookLevel === parse_spec_1.IActionLevel.GLOBAL) {
70
+ this.logger.write(`${chalk_1.default.red('✖')} ${chalk_1.default.gray(`${parse_spec_1.IActionLevel.GLOBAL} ${hookType}-action failed to [${this.record.command}] (${(0, utils_2.getProcessTime)(this.record.startTime)}s)`)}`);
71
+ }
72
+ throw error;
73
+ }
74
+ });
75
+ }
76
+ afterStart(hookType, inputs = {}) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ if (this.option.skipActions)
79
+ return {};
61
80
  this.inputs = inputs;
62
81
  const hooks = (0, lodash_1.filter)(this.actions, (item) => item.hookType === hookType);
63
82
  if ((0, lodash_1.isEmpty)(hooks))
64
83
  return {};
65
- this.logger.info(`Start the ${hookType}-action in ${this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
66
- ? `${this.option.projectName} project`
67
- : parse_spec_1.IActionLevel.GLOBAL}`);
84
+ this.record.startTime = Date.now();
85
+ this.record.lable =
86
+ this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
87
+ ? `[${this.option.projectName}]`
88
+ : parse_spec_1.IActionLevel.GLOBAL;
89
+ this.logger.debug(`Start executing the ${hookType}-action in ${this.record.lable}`);
68
90
  const newHooks = (0, parse_spec_1.getInputs)(hooks, this.record.magic);
91
+ // post-action应获取componentProps, 先清空pluginOutput
92
+ if (hookType !== parse_spec_1.IHookType.PRE) {
93
+ this.record.pluginOutput = {};
94
+ }
69
95
  for (const hook of newHooks) {
70
- debug(`${hook.level} action item: ${(0, utils_1.stringify)(hook)}`);
96
+ debug(`${hook.level} action item: ${(0, utils_2.stringify)(hook)}`);
97
+ this.record.allowFailure =
98
+ this.record.step && 'allow_failure' in this.record.step
99
+ ? (0, lodash_1.get)(this.record, 'step.allow_failure')
100
+ : hook.allow_failure;
71
101
  if (hook.actionType === parse_spec_1.IActionType.RUN) {
72
102
  yield this.run(hook);
73
103
  }
@@ -79,62 +109,131 @@ class Actions {
79
109
  yield this.component(hook);
80
110
  }
81
111
  }
82
- this.logger.info(`End the ${hookType}-action in ${this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
83
- ? `${this.option.projectName} project`
84
- : parse_spec_1.IActionLevel.GLOBAL}`);
85
- return this.record.pluginOutput;
112
+ this.logger.debug(`The ${hookType}-action successfully to execute in ${this.record.lable}`);
113
+ if (this.option.hookLevel === parse_spec_1.IActionLevel.GLOBAL) {
114
+ this.logger.write(`${chalk_1.default.green('✔')} ${chalk_1.default.gray(`${parse_spec_1.IActionLevel.GLOBAL} ${hookType}-action completed (${(0, utils_2.getProcessTime)(this.record.startTime)})`)}`);
115
+ }
116
+ return this.record;
117
+ });
118
+ }
119
+ onFinish(cp) {
120
+ return new Promise((resolve, reject) => {
121
+ const stdout = [];
122
+ const stderr = [];
123
+ cp.stdout.on('data', (chunk) => {
124
+ this.logger.append(chunk.toString());
125
+ stdout.push(chunk);
126
+ });
127
+ cp.stderr.on('data', (chunk) => {
128
+ this.logger.append(chunk.toString());
129
+ stderr.push(chunk);
130
+ });
131
+ cp.on('exit', (code) => {
132
+ code === 0 ? resolve({}) : reject(new Error(Buffer.concat(stderr).toString()));
133
+ });
86
134
  });
87
135
  }
88
136
  run(hook) {
89
137
  return __awaiter(this, void 0, void 0, function* () {
90
138
  if (fs_extra_1.default.existsSync(hook.path) && fs_extra_1.default.lstatSync(hook.path).isDirectory()) {
91
139
  try {
92
- execa_1.default.sync(hook.value, {
140
+ const cp = (0, execa_1.command)(hook.value, {
93
141
  cwd: hook.path,
94
- stdio: 'inherit',
95
142
  shell: true,
96
143
  });
144
+ yield this.onFinish(cp);
97
145
  }
98
146
  catch (e) {
99
147
  const error = e;
100
- // pre hook, throw error
101
- if (hook.hookType !== parse_spec_1.IHookType.PRE)
102
- return;
103
148
  if (utils.isWindow()) {
104
149
  debug('Command run execution environment:CMD');
105
150
  debug('Please check whether the actions section of yaml can be executed in the current environment.');
106
151
  }
107
- (0, utils_1.throwError)('Global pre-action failed to execute:' + error.message);
152
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
153
+ exitCode: constants_1.EXIT_CODE.RUN,
154
+ command: this.record.command,
155
+ });
156
+ if (useAllowFailure)
157
+ return;
158
+ throw new utils_1.DevsError(error.message, {
159
+ exitCode: constants_1.EXIT_CODE.RUN,
160
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
161
+ });
108
162
  }
163
+ return;
109
164
  }
165
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
166
+ exitCode: constants_1.EXIT_CODE.DEVS,
167
+ command: this.record.command,
168
+ });
169
+ if (useAllowFailure)
170
+ return;
171
+ throw new utils_1.DevsError(`The ${hook.path} directory does not exist.`, {
172
+ exitCode: constants_1.EXIT_CODE.DEVS,
173
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
174
+ });
110
175
  });
111
176
  }
112
177
  plugin(hook) {
113
178
  return __awaiter(this, void 0, void 0, function* () {
114
- const instance = yield (0, load_component_1.default)(hook.value);
115
- // TODO: inputs
116
- const inputs = (0, lodash_1.isEmpty)(this.record.pluginOutput) ? this.inputs : this.record.pluginOutput;
117
- this.record.pluginOutput = yield instance(inputs, hook.args);
179
+ try {
180
+ const instance = yield (0, load_component_1.default)(hook.value);
181
+ const inputs = (0, lodash_1.isEmpty)(this.record.pluginOutput) ? this.inputs : this.record.pluginOutput;
182
+ this.record.pluginOutput = yield instance(inputs, hook.args);
183
+ }
184
+ catch (e) {
185
+ const error = e;
186
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
187
+ exitCode: constants_1.EXIT_CODE.PLUGIN,
188
+ command: this.record.command,
189
+ });
190
+ if (useAllowFailure)
191
+ return;
192
+ throw new utils_1.DevsError(error.message, {
193
+ exitCode: constants_1.EXIT_CODE.PLUGIN,
194
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
195
+ });
196
+ }
118
197
  });
119
198
  }
120
199
  component(hook) {
121
200
  return __awaiter(this, void 0, void 0, function* () {
122
201
  const argv = (0, string_argv_1.default)(hook.value);
123
202
  const { _ } = utils.parseArgv(argv);
124
- const [componentName, method] = _;
125
- const instance = yield (0, load_component_1.default)(componentName);
126
- if (instance[method]) {
203
+ const [componentName, command] = _;
204
+ const instance = yield (0, load_component_1.default)(componentName, { logger: this.logger });
205
+ if (instance[command]) {
127
206
  // 方法存在,执行报错,退出码101
128
- const newInputs = Object.assign(Object.assign({}, this.record.componentProps), { argv: (0, lodash_1.filter)(argv.slice(2), (o) => !(0, lodash_1.includes)([componentName, method], o)) });
207
+ const newInputs = Object.assign(Object.assign({}, this.record.componentProps), { argv: (0, lodash_1.filter)(argv.slice(2), (o) => !(0, lodash_1.includes)([componentName, command], o)) });
129
208
  try {
130
- return yield instance[method](newInputs);
209
+ return yield instance[command](newInputs);
131
210
  }
132
- catch (error) {
133
- (0, utils_1.throw101Error)(error, `${hook.actionType}-action failed to execute:`);
211
+ catch (e) {
212
+ const error = e;
213
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
214
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
215
+ command: this.record.command,
216
+ });
217
+ if (useAllowFailure)
218
+ return;
219
+ throw new utils_1.DevsError(error.message, {
220
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
221
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
222
+ });
134
223
  }
135
224
  }
225
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
226
+ exitCode: constants_1.EXIT_CODE.DEVS,
227
+ command: this.record.command,
228
+ });
229
+ if (useAllowFailure)
230
+ return;
136
231
  // 方法不存在,此时系统将会认为是未找到组件方法,系统的exit code为100;
137
- (0, utils_1.throw100Error)(`The [${method}] command was not found.`, `Please check the component ${componentName} has the ${method} method. Serverless Devs documents:${chalk_1.default.underline('https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command')}`);
232
+ throw new utils_1.DevsError(`The [${command}] command was not found.`, {
233
+ exitCode: constants_1.EXIT_CODE.DEVS,
234
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
235
+ tips: `Please check the component ${componentName} has the ${command} command. Serverless Devs documents:${chalk_1.default.underline('https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command')}`,
236
+ });
138
237
  });
139
238
  }
140
239
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DASqC;AACrC,mCAAwD;AACxD,8DAAgD;AAChD,wDAA0B;AAC1B,kDAA0B;AAC1B,qFAA4D;AAC5D,8DAAqC;AACrC,oCAA+E;AAC/E,kDAA0B;AAG1B,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAcxE,MAAM,OAAO;IAIX,YAAoB,UAAqB,EAAE,EAAU,SAAS,EAAc;QAAxD,YAAO,GAAP,OAAO,CAAgB;QAAU,WAAM,GAAN,MAAM,CAAiB;QAHpE,WAAM,GAAG,EAAa,CAAC;QAEvB,WAAM,GAAwB,EAAE,CAAC;QAEvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IACM,QAAQ,CAAC,GAAW,EAAE,KAAU;QACrC,IAAA,YAAG,EAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACY,KAAK,CAAC,QAAwB,EAAE,SAA8B,EAAE;;YAC3E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,MAAM,KAAK,GAAG,IAAA,eAAM,EAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IA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AI,CAAC,QAAQ,sBAAsB,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI;gBAC1F,IAAI,EAAE,8BAA8B,aAAa,YAAY,OAAO,uCAAuC,eAAK,CAAC,SAAS,CACxH,gFAAgF,CACjF,EAAE;aACJ,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAED,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const EXIT_CODE: {
2
+ DEVS: number;
3
+ COMPONENT: number;
4
+ PLUGIN: number;
5
+ RUN: number;
6
+ };
@@ -1,2 +1,10 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXIT_CODE = void 0;
4
+ exports.EXIT_CODE = {
5
+ DEVS: 100,
6
+ COMPONENT: 101,
7
+ PLUGIN: 101,
8
+ RUN: 101,
9
+ };
2
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,GAAG;IACX,GAAG,EAAE,GAAG;CACT,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IEngineOptions, IContext } from './types';
2
- export { IEngineOptions, IContext } from './types';
2
+ export { IEngineOptions, IContext, IEngineError } from './types';
3
3
  declare class Engine {
4
4
  private options;
5
5
  context: IContext;
@@ -11,7 +11,9 @@ declare class Engine {
11
11
  private globalActionInstance;
12
12
  private actionInstance;
13
13
  constructor(options: IEngineOptions);
14
+ private beforeStart;
14
15
  start(): Promise<IContext>;
16
+ private getOutput;
15
17
  private validate;
16
18
  private download;
17
19
  private getLogger;
package/lib/index.js CHANGED
@@ -47,34 +47,80 @@ const credential_1 = __importDefault(require("@serverless-devs/credential"));
47
47
  const load_component_1 = __importDefault(require("@serverless-devs/load-component"));
48
48
  const logger_1 = __importDefault(require("@serverless-devs/logger"));
49
49
  const utils = __importStar(require("@serverless-devs/utils"));
50
+ const utils_2 = require("@serverless-devs/utils");
51
+ const constants_1 = require("./constants");
52
+ const assert_1 = __importDefault(require("assert"));
50
53
  const debug = require('@serverless-cd/debug')('serverless-devs:engine');
51
54
  class Engine {
52
55
  constructor(options) {
53
56
  this.options = options;
54
- this.context = { status: types_1.STEP_STATUS.PENING, completed: false };
57
+ this.context = {
58
+ status: types_1.STEP_STATUS.PENING,
59
+ completed: false,
60
+ error: [],
61
+ };
55
62
  this.record = { status: types_1.STEP_STATUS.PENING, editStatusAble: true };
56
63
  this.spec = {};
57
64
  debug('engine start');
65
+ // 初始化参数
58
66
  this.options.args = (0, lodash_1.get)(this.options, 'args', process.argv.slice(2));
67
+ this.options.cwd = (0, lodash_1.get)(this.options, 'cwd', process.cwd());
68
+ this.options.template = utils.getAbsolutePath((0, lodash_1.get)(this.options, 'template'), this.options.cwd);
59
69
  debug(`engine options: ${(0, utils_1.stringify)(options)}`);
60
70
  }
61
- start() {
71
+ beforeStart() {
62
72
  return __awaiter(this, void 0, void 0, function* () {
63
- this.context.status = types_1.STEP_STATUS.RUNNING;
73
+ // 初始化 spec
64
74
  this.parseSpecInstance = new parse_spec_1.default((0, lodash_1.get)(this.options, 'template'), this.options.args);
65
75
  this.spec = this.parseSpecInstance.start();
66
- const { steps: _steps, yaml, access = yaml.access } = this.spec;
76
+ // 初始化行参环境变量 > .env (parse-spec require .env)
77
+ (0, lodash_1.each)(this.options.env, (value, key) => {
78
+ process.env[key] = value;
79
+ });
80
+ const { steps: _steps } = this.spec;
81
+ // 参数校验
67
82
  this.validate();
83
+ // 初始化 logger
68
84
  this.glog = this.getLogger();
69
85
  this.logger = this.glog.__generate('engine');
70
- const steps = yield this.download(_steps);
86
+ this.context.steps = yield this.download(_steps);
87
+ });
88
+ }
89
+ // engine应收敛所有的异常,不应该抛出异常
90
+ start() {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ this.context.status = types_1.STEP_STATUS.RUNNING;
93
+ try {
94
+ yield this.beforeStart();
95
+ }
96
+ catch (error) {
97
+ this.context.status = types_1.STEP_STATUS.FAILURE;
98
+ this.context.completed = true;
99
+ this.context.error.push(error);
100
+ return this.context;
101
+ }
102
+ const { steps: _steps, yaml, command, access = yaml.access } = this.spec;
103
+ this.logger.write(`⌛ Steps for [${command}] of [${(0, lodash_1.get)(this.spec, 'yaml.appName')}]\n${chalk_1.default.gray('====================')}`);
104
+ // 初始化全局的 action
71
105
  this.globalActionInstance = new actions_1.default(yaml.actions, {
72
106
  hookLevel: parse_spec_1.IActionLevel.GLOBAL,
73
107
  logger: this.logger,
108
+ skipActions: this.spec.skipActions,
74
109
  });
75
- const credential = yield (0, utils_1.getCredential)(access);
76
- yield this.globalActionInstance.start(parse_spec_1.IHookType.PRE, { access, credential });
77
- this.context.steps = (0, lodash_1.map)(steps, (item) => {
110
+ const credential = yield (0, utils_1.getCredential)(access, this.logger);
111
+ // 处理 global-pre
112
+ try {
113
+ this.globalActionInstance.setValue('magic', this.getFilterContext());
114
+ this.globalActionInstance.setValue('command', command);
115
+ yield this.globalActionInstance.start(parse_spec_1.IHookType.PRE, { access, credential });
116
+ }
117
+ catch (error) {
118
+ this.context.error.push(error);
119
+ this.context.status = types_1.STEP_STATUS.FAILURE;
120
+ yield this.doCompleted();
121
+ return this.context;
122
+ }
123
+ this.context.steps = (0, lodash_1.map)(this.context.steps, (item) => {
78
124
  return Object.assign(Object.assign({}, item), { stepCount: (0, lodash_1.uniqueId)(), status: types_1.STEP_STATUS.PENING, done: false });
79
125
  });
80
126
  const res = yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
@@ -95,6 +141,7 @@ class Engine {
95
141
  this.context.status = status;
96
142
  yield this.doCompleted();
97
143
  this.context.steps = (0, lodash_1.map)(this.context.steps, (item) => (0, lodash_1.omit)(item, ['instance']));
144
+ this.context.output = this.getOutput();
98
145
  debug(`context: ${(0, utils_1.stringify)(this.context)}`);
99
146
  debug('engine end');
100
147
  resolve(this.context);
@@ -113,24 +160,12 @@ class Engine {
113
160
  invoke: {
114
161
  id: item.stepCount,
115
162
  src: () => __awaiter(this, void 0, void 0, function* () {
116
- // 并行时如果已经执行过,则跳过。
163
+ // 并行时如果已经执行,则跳过。
117
164
  if (item.done)
118
165
  return;
119
166
  this.record.startTime = Date.now();
120
167
  // 记录 context
121
168
  this.recordContext(item, { status: types_1.STEP_STATUS.RUNNING });
122
- // 先判断if条件,成功则执行该步骤。
123
- if (item.if) {
124
- // 替换 failure()
125
- item.if = (0, lodash_1.replace)(item.if, types_1.STEP_IF.FAILURE, this.record.status === types_1.STEP_STATUS.FAILURE ? 'true' : 'false');
126
- // 替换 success()
127
- item.if = (0, lodash_1.replace)(item.if, types_1.STEP_IF.SUCCESS, this.record.status !== types_1.STEP_STATUS.FAILURE ? 'true' : 'false');
128
- // 替换 always()
129
- item.if = (0, lodash_1.replace)(item.if, types_1.STEP_IF.ALWAYS, 'true');
130
- return item.if === 'true'
131
- ? yield Promise.all((0, lodash_1.map)(flowProject, (o) => this.handleSrc(o)))
132
- : yield Promise.all((0, lodash_1.map)(flowProject, (o) => this.doSkip(o)));
133
- }
134
169
  // 检查全局的执行状态,如果是failure,则不执行该步骤, 并记录状态为 skipped
135
170
  if (this.record.status === types_1.STEP_STATUS.FAILURE) {
136
171
  return yield Promise.all((0, lodash_1.map)(flowProject, (o) => this.doSkip(o)));
@@ -155,24 +190,34 @@ class Engine {
155
190
  .start();
156
191
  stepService.send('INIT');
157
192
  }));
193
+ this.glog.__clear();
158
194
  return res;
159
195
  });
160
196
  }
197
+ getOutput() {
198
+ const output = {};
199
+ (0, lodash_1.each)(this.context.steps, (item) => {
200
+ if (!(0, lodash_1.isEmpty)(item.output)) {
201
+ (0, lodash_1.set)(output, item.projectName, item.output);
202
+ }
203
+ });
204
+ return output;
205
+ }
161
206
  validate() {
162
- const { steps, method } = this.spec;
163
- if ((0, lodash_1.isEmpty)(steps)) {
164
- throw new Error('steps is empty');
165
- }
166
- if ((0, lodash_1.isEmpty)(method)) {
167
- throw new Error('method is empty');
168
- }
207
+ const { steps, command } = this.spec;
208
+ (0, assert_1.default)(!(0, lodash_1.isEmpty)(steps), 'steps is required');
209
+ (0, assert_1.default)(command, 'command is required');
169
210
  }
170
211
  download(steps) {
171
212
  return __awaiter(this, void 0, void 0, function* () {
172
213
  const newSteps = [];
173
214
  for (const step of steps) {
174
- const instance = yield (0, load_component_1.default)(step.component, this.glog.__generate(step.projectName));
175
- newSteps.push(Object.assign(Object.assign({}, step), { instance }));
215
+ const logger = this.glog.__generate(step.projectName);
216
+ const instance = yield (0, load_component_1.default)(step.component, {
217
+ logger,
218
+ engineLogger: this.logger,
219
+ });
220
+ newSteps.push(Object.assign(Object.assign({}, step), { instance, logger }));
176
221
  }
177
222
  return newSteps;
178
223
  });
@@ -181,12 +226,12 @@ class Engine {
181
226
  const customLogger = (0, lodash_1.get)(this.options, 'logConfig.customLogger');
182
227
  if (customLogger) {
183
228
  debug('use custom logger');
184
- if (customLogger instanceof logger_1.default) {
229
+ if ((customLogger === null || customLogger === void 0 ? void 0 : customLogger.CODE) === logger_1.default.CODE) {
185
230
  return customLogger;
186
231
  }
187
232
  throw new Error('customLogger must be instance of Logger');
188
233
  }
189
- return new logger_1.default(Object.assign(Object.assign({ traceId: Math.random().toString(16).slice(2), logDir: path_1.default.join(utils.getRootHome(), 'logs') }, this.options.logConfig), { level: (0, lodash_1.get)(this.options, 'logConfig.level', this.spec.debug ? 'DEBUG' : undefined) }));
234
+ return new logger_1.default(Object.assign(Object.assign({ traceId: (0, lodash_1.get)(process.env, 'serverless_devs_trace_id', utils.format()), logDir: path_1.default.join(utils.getRootHome(), 'logs') }, this.options.logConfig), { level: (0, lodash_1.get)(this.options, 'logConfig.level', this.spec.debug ? 'DEBUG' : undefined) }));
190
235
  }
191
236
  recordContext(item, options = {}) {
192
237
  const { status, error, output, process_time, props, done } = options;
@@ -198,7 +243,7 @@ class Engine {
198
243
  }
199
244
  if (error) {
200
245
  obj.error = error;
201
- this.context.error = error;
246
+ this.context.error.push(error);
202
247
  }
203
248
  if (props) {
204
249
  obj.props = props;
@@ -220,69 +265,126 @@ class Engine {
220
265
  const data = {
221
266
  cwd: path_1.default.dirname(this.spec.yaml.path),
222
267
  vars: this.spec.yaml.vars,
223
- credential: item.credential,
224
268
  };
225
269
  for (const obj of this.context.steps) {
226
270
  data[obj.projectName] = { output: obj.output || {}, props: obj.props || {} };
227
271
  }
228
- data.that = {
229
- name: item.projectName,
230
- access: item.access,
231
- component: item.component,
232
- props: data[item.projectName].props,
233
- output: data[item.projectName].output,
234
- };
272
+ if (item) {
273
+ data.credential = item.credential;
274
+ data.that = {
275
+ name: item.projectName,
276
+ access: item.access,
277
+ component: item.component,
278
+ props: data[item.projectName].props,
279
+ output: data[item.projectName].output,
280
+ };
281
+ }
235
282
  return data;
236
283
  }
237
284
  doCompleted() {
238
285
  return __awaiter(this, void 0, void 0, function* () {
239
286
  this.context.completed = true;
287
+ if (this.context.status === types_1.STEP_STATUS.FAILURE) {
288
+ try {
289
+ yield this.globalActionInstance.start(parse_spec_1.IHookType.FAIL, this.context);
290
+ }
291
+ catch (error) {
292
+ this.context.status = types_1.STEP_STATUS.FAILURE;
293
+ this.context.error.push(error);
294
+ }
295
+ }
240
296
  if (this.context.status === types_1.STEP_STATUS.SUCCESS) {
241
- yield this.globalActionInstance.start(parse_spec_1.IHookType.SUCCESS, this.context);
297
+ try {
298
+ yield this.globalActionInstance.start(parse_spec_1.IHookType.SUCCESS, this.context);
299
+ }
300
+ catch (error) {
301
+ this.context.status = types_1.STEP_STATUS.FAILURE;
302
+ this.context.error.push(error);
303
+ }
242
304
  }
243
- if (this.context.status === types_1.STEP_STATUS.FAILURE) {
244
- yield this.globalActionInstance.start(parse_spec_1.IHookType.FAIL, this.context);
305
+ try {
306
+ yield this.globalActionInstance.start(parse_spec_1.IHookType.COMPLETE, this.context);
307
+ }
308
+ catch (error) {
309
+ this.context.status = types_1.STEP_STATUS.FAILURE;
310
+ this.context.error.push(error);
245
311
  }
246
- yield this.globalActionInstance.start(parse_spec_1.IHookType.COMPLETE, this.context);
247
312
  });
248
313
  }
249
314
  handleSrc(item) {
250
315
  return __awaiter(this, void 0, void 0, function* () {
251
- this.logger.info(`Start executing project ${item.projectName}`);
316
+ const { command } = this.spec;
252
317
  try {
318
+ // project pre hook and project component
253
319
  yield this.handleAfterSrc(item);
254
- // 项目的output, 再次获取魔法变量
255
- this.actionInstance.setValue('magic', this.getFilterContext(item));
256
- const newInputs = yield this.getProps(item);
257
- yield this.actionInstance.start(parse_spec_1.IHookType.SUCCESS, newInputs);
258
320
  }
259
321
  catch (error) {
260
- const newInputs = yield this.getProps(item);
261
- yield this.actionInstance.start(parse_spec_1.IHookType.FAIL, newInputs);
262
- }
263
- finally {
264
- this.recordContext(item, { done: true });
265
- const newInputs = yield this.getProps(item);
266
- yield this.actionInstance.start(parse_spec_1.IHookType.COMPLETE, newInputs);
322
+ // project fail hook
323
+ try {
324
+ const res = yield this.actionInstance.start(parse_spec_1.IHookType.FAIL, this.record.componentProps);
325
+ this.recordContext(item, (0, lodash_1.get)(res, 'pluginOutput', {}));
326
+ }
327
+ catch (error) {
328
+ this.record.status = types_1.STEP_STATUS.FAILURE;
329
+ this.recordContext(item, { error });
330
+ }
267
331
  }
268
332
  // 若记录的全局状态为true,则进行输出成功的日志
269
- this.record.status === types_1.STEP_STATUS.SUCCESS &&
270
- this.logger.info(`Project ${item.projectName} successfully to execute`);
333
+ if (this.record.status === types_1.STEP_STATUS.SUCCESS) {
334
+ // project success hook
335
+ try {
336
+ // 项目的output, 再次获取魔法变量
337
+ this.actionInstance.setValue('magic', this.getFilterContext(item));
338
+ const res = yield this.actionInstance.start(parse_spec_1.IHookType.SUCCESS, Object.assign(Object.assign({}, this.record.componentProps), { output: (0, lodash_1.get)(item, 'output', {}) }));
339
+ this.recordContext(item, (0, lodash_1.get)(res, 'pluginOutput', {}));
340
+ }
341
+ catch (error) {
342
+ this.record.status = types_1.STEP_STATUS.FAILURE;
343
+ this.recordContext(item, { error });
344
+ }
345
+ }
346
+ // project complete hook
347
+ try {
348
+ const res = yield this.actionInstance.start(parse_spec_1.IHookType.COMPLETE, Object.assign(Object.assign({}, this.record.componentProps), { output: (0, lodash_1.get)(item, 'output', {}) }));
349
+ this.recordContext(item, (0, lodash_1.get)(res, 'pluginOutput', {}));
350
+ }
351
+ catch (error) {
352
+ this.record.status = types_1.STEP_STATUS.FAILURE;
353
+ this.recordContext(item, { error });
354
+ }
355
+ // 记录项目已经执行完成
356
+ const process_time = (0, utils_1.getProcessTime)(this.record.startTime);
357
+ this.recordContext(item, { done: true, process_time });
358
+ if (this.record.status === types_1.STEP_STATUS.SUCCESS) {
359
+ this.logger.write(`${chalk_1.default.green('✔')} ${chalk_1.default.gray(`[${item.projectName}] completed (${process_time}s)`)}`);
360
+ }
361
+ if (this.record.status === types_1.STEP_STATUS.FAILURE) {
362
+ this.logger.write(`${chalk_1.default.red('✖')} ${chalk_1.default.gray(`[${item.projectName}] failed to [${command}] (${process_time}s)`)}`);
363
+ }
364
+ // step执行完成后,释放logger
365
+ this.glog.__unset(item.projectName);
271
366
  });
272
367
  }
273
368
  handleAfterSrc(item) {
274
369
  return __awaiter(this, void 0, void 0, function* () {
275
370
  try {
276
371
  debug(`project item: ${(0, utils_1.stringify)(item)}`);
277
- item.credential = yield (0, utils_1.getCredential)(item.access);
372
+ const { command } = this.spec;
373
+ item.credential = yield (0, utils_1.getCredential)(item.access, this.logger);
374
+ (0, lodash_1.each)(item.credential, (v) => {
375
+ this.glog.__setSecret([v]);
376
+ });
278
377
  const newAction = this.parseSpecInstance.parseActions(item.actions, parse_spec_1.IActionLevel.PROJECT);
279
378
  debug(`project actions: ${JSON.stringify(newAction)}`);
280
379
  this.actionInstance = new actions_1.default(newAction, {
281
380
  hookLevel: parse_spec_1.IActionLevel.PROJECT,
282
381
  projectName: item.projectName,
283
- logger: this.logger,
382
+ logger: item.logger,
383
+ skipActions: this.spec.skipActions,
284
384
  });
285
385
  this.actionInstance.setValue('magic', this.getFilterContext(item));
386
+ this.actionInstance.setValue('step', item);
387
+ this.actionInstance.setValue('command', command);
286
388
  const newInputs = yield this.getProps(item);
287
389
  const pluginResult = yield this.actionInstance.start(parse_spec_1.IHookType.PRE, newInputs);
288
390
  const response = yield this.doSrc(item, pluginResult);
@@ -297,8 +399,7 @@ class Engine {
297
399
  output: response,
298
400
  } });
299
401
  }
300
- const process_time = (0, utils_1.getProcessTime)(this.record.startTime);
301
- this.recordContext(item, { status: types_1.STEP_STATUS.SUCCESS, output: response, process_time });
402
+ this.recordContext(item, { status: types_1.STEP_STATUS.SUCCESS, output: response });
302
403
  }
303
404
  catch (e) {
304
405
  const error = e;
@@ -316,12 +417,11 @@ class Engine {
316
417
  status,
317
418
  } });
318
419
  }
319
- const process_time = (0, utils_1.getProcessTime)(this.record.startTime);
320
420
  if (item['continue-on-error']) {
321
- this.recordContext(item, { status, process_time });
421
+ this.recordContext(item, { status });
322
422
  }
323
423
  else {
324
- this.recordContext(item, { status, error, process_time });
424
+ this.recordContext(item, { status, error });
325
425
  throw error;
326
426
  }
327
427
  }
@@ -332,17 +432,26 @@ class Engine {
332
432
  const magic = this.getFilterContext(item);
333
433
  debug(`magic context: ${JSON.stringify(magic)}`);
334
434
  const newInputs = (0, parse_spec_1.getInputs)(item.props, magic);
335
- const { projectName, method } = this.spec;
336
- // TODO: inputs数据
435
+ const { projectName, command } = this.spec;
337
436
  const result = {
437
+ cwd: this.options.cwd,
438
+ name: (0, lodash_1.get)(this.spec, 'yaml.appName'),
338
439
  props: newInputs,
339
- method,
340
- yaml: this.spec.yaml,
341
- projectName: item.projectName,
342
- access: item.access,
343
- component: item.component,
344
- credential: new credential_1.default(),
345
- args: (0, lodash_1.filter)(this.options.args, (o) => !(0, lodash_1.includes)([projectName, method], o)),
440
+ command,
441
+ args: (0, lodash_1.filter)(this.options.args, (o) => !(0, lodash_1.includes)([projectName, command], o)),
442
+ yaml: {
443
+ path: (0, lodash_1.get)(this.spec, 'yaml.path'),
444
+ },
445
+ resource: {
446
+ name: item.projectName,
447
+ component: item.component,
448
+ access: item.access,
449
+ },
450
+ outputs: this.getOutput(),
451
+ getCredential: () => __awaiter(this, void 0, void 0, function* () {
452
+ const res = yield new credential_1.default({ logger: this.logger }).get(item.access);
453
+ return (0, lodash_1.get)(res, 'credential', {});
454
+ }),
346
455
  };
347
456
  this.recordContext(item, { props: newInputs });
348
457
  debug(`get props: ${JSON.stringify(result)}`);
@@ -351,37 +460,67 @@ class Engine {
351
460
  }
352
461
  doSrc(item, data = {}) {
353
462
  return __awaiter(this, void 0, void 0, function* () {
354
- const { method = '', projectName } = this.spec;
463
+ const { command = '', projectName } = this.spec;
355
464
  const newInputs = yield this.getProps(item);
356
- const componentProps = (0, lodash_1.isEmpty)(data.pluginOutput) ? newInputs : data.pluginOutput;
357
- debug(`component props: ${(0, utils_1.stringify)(componentProps)}`);
358
- this.actionInstance.setValue('componentProps', componentProps);
465
+ this.record.componentProps = (0, lodash_1.isEmpty)(data.pluginOutput) ? newInputs : data.pluginOutput;
466
+ debug(`component props: ${(0, utils_1.stringify)(this.record.componentProps)}`);
467
+ this.actionInstance.setValue('componentProps', this.record.componentProps);
359
468
  // 服务级操作
360
469
  if (projectName) {
361
- if ((0, lodash_1.isFunction)(item.instance[method])) {
470
+ if ((0, lodash_1.isFunction)(item.instance[command])) {
362
471
  // 方法存在,执行报错,退出码101
363
472
  try {
364
- return yield item.instance[method](componentProps);
473
+ return yield item.instance[command](this.record.componentProps);
365
474
  }
366
- catch (error) {
367
- (0, utils_1.throw101Error)(error, `Project ${item.projectName} failed to execute:`);
475
+ catch (e) {
476
+ const useAllowFailure = (0, utils_1.getAllowFailure)(item.allow_failure, {
477
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
478
+ command,
479
+ });
480
+ if (useAllowFailure)
481
+ return;
482
+ const error = e;
483
+ throw new utils_2.DevsError(error.message, {
484
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
485
+ prefix: `[${item.projectName}] failed to [${command}]:`,
486
+ });
368
487
  }
369
488
  }
489
+ const useAllowFailure = (0, utils_1.getAllowFailure)(item.allow_failure, {
490
+ exitCode: constants_1.EXIT_CODE.DEVS,
491
+ command,
492
+ });
493
+ if (useAllowFailure)
494
+ return;
370
495
  // 方法不存在,此时系统将会认为是未找到组件方法,系统的exit code为100;
371
- (0, utils_1.throw100Error)(`The [${method}] command was not found.`, `Please check the component ${item.component} has the ${method} method. Serverless Devs documents:${chalk_1.default.underline('https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command')}`);
496
+ throw new utils_2.DevsError(`The [${command}] command was not found.`, {
497
+ exitCode: constants_1.EXIT_CODE.DEVS,
498
+ tips: `Please check the component ${item.component} has the ${command} command. Serverless Devs documents:${chalk_1.default.underline('https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command')}`,
499
+ prefix: `[${item.projectName}] failed to [${command}]:`,
500
+ });
372
501
  }
373
502
  // 应用级操作
374
- if ((0, lodash_1.isFunction)(item.instance[method])) {
503
+ if ((0, lodash_1.isFunction)(item.instance[command])) {
375
504
  // 方法存在,执行报错,退出码101
376
505
  try {
377
- return yield item.instance[method](componentProps);
506
+ return yield item.instance[command](this.record.componentProps);
378
507
  }
379
- catch (error) {
380
- (0, utils_1.throw101Error)(error, `Project ${item.projectName} failed to execute:`);
508
+ catch (e) {
509
+ const useAllowFailure = (0, utils_1.getAllowFailure)(item.allow_failure, {
510
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
511
+ command,
512
+ });
513
+ if (useAllowFailure)
514
+ return;
515
+ const error = e;
516
+ throw new utils_2.DevsError(error.message, {
517
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
518
+ prefix: `[${item.projectName}] failed to [${command}]:`,
519
+ });
381
520
  }
382
521
  }
383
522
  // 方法不存在,进行警告,但是并不会报错,最终的exit code为0;
384
- (0, utils_1.throwError)(`The [${method}] command was not found.`, `Please check the component ${item.component} has the ${method} method. Serverless Devs documents:https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command`);
523
+ this.logger.tips(`The [${command}] command was not found.`, `Please check the component ${item.component} has the ${command} command. Serverless Devs documents:https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command`);
385
524
  });
386
525
  }
387
526
  doSkip(item) {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkD;AAClD,mCAYgB;AAChB,mCAQiB;AACjB,mCAOiB;AACjB,0EAMqC;AACrC,gDAAwB;AACxB,kDAA0B;AAC1B,wDAAgC;AAChC,6EAAqD;AACrD,qFAA4D;AAC5D,qEAAkE;AAClE,8DAAgD;AAIhD,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAExE,MAAM,MAAM;IASV,YAAoB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;QARpC,YAAO,GAAG,EAAE,MAAM,EAAE,mBAAW,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAc,CAAC;QACtE,WAAM,GAAG,EAAE,MAAM,EAAE,mBAAW,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAa,CAAC;QACzE,SAAI,GAAG,EAAW,CAAC;QAOzB,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAA,YAAG,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,mBAAmB,IAAA,iBAAS,EAAC,OAAO,CAAC,EAAE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,MAAM,KAAK,GAAG,CAAU,CAAC;oBACzB,MAAM,IAAI,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;wBACjC,QAAQ,EAAE,qBAAS,CAAC,SAAS;wBAC7B,MAAM,EAAE,IAAI,IAAI,CAAC,WAAW,gBAAgB,OAAO,IAAI;qBACxD,CAAC,CAAC;iBACJ;aACF;YACD,qCAAqC;YACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,QAAQ,OAAO,0BAA0B,EACzC,8BAA8B,IAAI,CAAC,SAAS,YAAY,OAAO,oHAAoH,CACpL,CAAC;QACJ,CAAC;KAAA;IACa,MAAM,CAAC,IAAkB;;YACrC,UAAU;YACV,IAAI,IAAI,CAAC,EAAE,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,KAAK,mCACZ,IAAI,CAAC,MAAM,CAAC,KAAK,KACpB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;wBACT,MAAM,EAAE,mBAAW,CAAC,IAAI;qBACzB,GACF,CAAC;aACH;YACD,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,mBAAW,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;YACxE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KAAA;CACF;AAED,kBAAe,MAAM,CAAC"}
package/lib/types.d.ts CHANGED
@@ -1,17 +1,20 @@
1
+ /// <reference types="node" />
1
2
  import { IStep } from '@serverless-devs/parse-spec';
2
3
  import { IOptions as ILogConfig } from '@serverless-devs/logger/lib/type';
3
- import Logger from '@serverless-devs/logger';
4
+ import Logger, { ILoggerInstance } from '@serverless-devs/logger';
5
+ import { AssertionError } from 'assert';
6
+ import { DevsError } from '@serverless-devs/utils';
4
7
  export interface IEngineOptions {
5
8
  args?: string[];
6
9
  template?: string;
7
10
  env?: Record<string, string>;
8
11
  cwd?: string;
9
- logConfig?: EngineLogger;
12
+ logConfig?: Partial<ILogConfig> & {
13
+ customLogger?: Logger;
14
+ };
10
15
  }
11
- export type EngineLogger = Partial<ILogConfig> & {
12
- customLogger?: Logger;
13
- };
14
16
  export type IStepOptions = IStep & {
17
+ logger: ILoggerInstance;
15
18
  instance?: any;
16
19
  id?: string;
17
20
  if?: string;
@@ -54,6 +57,7 @@ export interface IRecord {
54
57
  steps: Record<string, any>;
55
58
  status: IStatus;
56
59
  startTime: number;
60
+ componentProps: Record<string, any>;
57
61
  }
58
62
  export interface IContext {
59
63
  cwd: string;
@@ -63,6 +67,8 @@ export interface IContext {
63
67
  status: IStatus;
64
68
  completed: boolean;
65
69
  inputs: Record<string, any>;
66
- error: Error;
70
+ error: IEngineError[];
71
+ output: Record<string, any>;
67
72
  }
73
+ export type IEngineError = Error | AssertionError | DevsError;
68
74
  export {};
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA+BA,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,gCAAqB,CAAA;IACrB,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;AACrB,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AAED,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,sCAAkB,CAAA;IAClB,+DAA2C,CAAA;AAC7C,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B;AAID,IAAK,gBAEJ;AAFD,WAAK,gBAAgB;IACnB,oCAAgB,CAAA;AAClB,CAAC,EAFI,gBAAgB,KAAhB,gBAAgB,QAEpB;AAEY,QAAA,WAAW,mCAAQ,gBAAgB,GAAK,gBAAgB,EAAG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAgCA,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,gCAAqB,CAAA;IACrB,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;AACrB,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AAED,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,sCAAkB,CAAA;IAClB,+DAA2C,CAAA;AAC7C,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B;AAID,IAAK,gBAEJ;AAFD,WAAK,gBAAgB;IACnB,oCAAgB,CAAA;AAClB,CAAC,EAFI,gBAAgB,KAAhB,gBAAgB,QAEpB;AAEY,QAAA,WAAW,mCAAQ,gBAAgB,GAAK,gBAAgB,EAAG"}
@@ -1,7 +1,11 @@
1
+ import { ILoggerInstance } from '@serverless-devs/logger';
2
+ import { IAllowFailure } from '@serverless-devs/parse-spec';
1
3
  export declare function getLogPath(filePath: string): string;
4
+ export declare const randomId: () => string;
2
5
  export declare function getProcessTime(time: number): number;
3
- export declare function throw101Error(error: Error, prefix: string): void;
4
- export declare function throw100Error(message: string, tips?: string): void;
5
- export declare function throwError(message: string, tips?: string): void;
6
- export declare function getCredential(access?: string): Promise<Record<string, string>>;
6
+ export declare function getCredential(access: string | undefined, logger: ILoggerInstance): Promise<Record<string, string>>;
7
7
  export declare const stringify: (value: any) => string;
8
+ export declare const getAllowFailure: (allowFailure: boolean | IAllowFailure | undefined, data: {
9
+ exitCode?: number;
10
+ command?: string;
11
+ }) => boolean;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.stringify = exports.getCredential = exports.throwError = exports.throw100Error = exports.throw101Error = exports.getProcessTime = exports.getLogPath = void 0;
15
+ exports.getAllowFailure = exports.stringify = exports.getCredential = exports.getProcessTime = exports.randomId = exports.getLogPath = void 0;
16
16
  const credential_1 = __importDefault(require("@serverless-devs/credential"));
17
17
  const flatted_1 = __importDefault(require("flatted"));
18
18
  const lodash_1 = require("lodash");
@@ -20,44 +20,16 @@ function getLogPath(filePath) {
20
20
  return `step_${filePath}.log`;
21
21
  }
22
22
  exports.getLogPath = getLogPath;
23
+ const randomId = () => Math.random().toString(16).slice(2);
24
+ exports.randomId = randomId;
23
25
  function getProcessTime(time) {
24
26
  return (Math.round((Date.now() - time) / 10) * 10) / 1000;
25
27
  }
26
28
  exports.getProcessTime = getProcessTime;
27
- function throw101Error(error, prefix) {
28
- let jsonMsg;
29
- try {
30
- jsonMsg = JSON.parse(error.message);
31
- }
32
- catch (error) { }
33
- if (jsonMsg && jsonMsg.tips) {
34
- throw new Error(JSON.stringify({
35
- code: 101,
36
- message: jsonMsg.message,
37
- tips: jsonMsg.tips,
38
- prefix,
39
- }));
40
- }
41
- throw new Error(JSON.stringify({
42
- code: 101,
43
- message: error.message,
44
- stack: error.stack,
45
- prefix,
46
- }));
47
- }
48
- exports.throw101Error = throw101Error;
49
- function throw100Error(message, tips) {
50
- throw new Error(JSON.stringify({ code: 100, message, tips }));
51
- }
52
- exports.throw100Error = throw100Error;
53
- function throwError(message, tips) {
54
- throw new Error(JSON.stringify({ message, tips }));
55
- }
56
- exports.throwError = throwError;
57
- function getCredential(access) {
29
+ function getCredential(access, logger) {
58
30
  return __awaiter(this, void 0, void 0, function* () {
59
31
  try {
60
- const instance = new credential_1.default();
32
+ const instance = new credential_1.default({ logger });
61
33
  const res = yield instance.get(access);
62
34
  return (0, lodash_1.get)(res, 'credential', {});
63
35
  }
@@ -85,4 +57,23 @@ const stringify = (value) => {
85
57
  }
86
58
  };
87
59
  exports.stringify = stringify;
60
+ const getAllowFailure = (allowFailure, data) => {
61
+ if (typeof allowFailure === 'boolean') {
62
+ return allowFailure;
63
+ }
64
+ if (typeof allowFailure !== 'object')
65
+ return false;
66
+ if ('exit_code' in allowFailure && 'command' in allowFailure) {
67
+ return ((0, lodash_1.includes)((0, lodash_1.get)(allowFailure, 'exit_code'), (0, lodash_1.get)(data, 'exitCode')) &&
68
+ (0, lodash_1.includes)((0, lodash_1.get)(allowFailure, 'command'), (0, lodash_1.get)(data, 'command')));
69
+ }
70
+ if ('exit_code' in allowFailure) {
71
+ return (0, lodash_1.includes)((0, lodash_1.get)(allowFailure, 'exit_code'), (0, lodash_1.get)(data, 'exitCode'));
72
+ }
73
+ if ('command' in allowFailure) {
74
+ return (0, lodash_1.includes)((0, lodash_1.get)(allowFailure, 'command'), (0, lodash_1.get)(data, 'command'));
75
+ }
76
+ return false;
77
+ };
78
+ exports.getAllowFailure = getAllowFailure;
88
79
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAAqD;AACrD,sDAA8B;AAC9B,mCAA6C;AAE7C,SAAgB,UAAU,CAAC,QAAgB;IACzC,OAAO,QAAQ,QAAQ,MAAM,CAAC;AAChC,CAAC;AAFD,gCAEC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;AAC5D,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,KAAY,EAAE,MAAc;IACxD,IAAI,OAAO,CAAC;IACZ,IAAI;QACF,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KACrC;IAAC,OAAO,KAAK,EAAE,GAAE;IAElB,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAA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CAAC,CAAC;YAC/D,IAAA,iBAAQ,EAAC,IAAA,YAAG,EAAC,YAAY,EAAE,SAAS,CAAC,EAAE,IAAA,YAAG,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAC7D,CAAC;KACH;IACD,IAAI,WAAW,IAAI,YAAY,EAAE;QAC/B,OAAO,IAAA,iBAAQ,EAAC,IAAA,YAAG,EAAC,YAAY,EAAE,WAAW,CAAC,EAAE,IAAA,YAAG,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;KACxE;IACD,IAAI,SAAS,IAAI,YAAY,EAAE;QAC7B,OAAO,IAAA,iBAAQ,EAAC,IAAA,YAAG,EAAC,YAAY,EAAE,SAAS,CAAC,EAAE,IAAA,YAAG,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KACrE;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AArBW,QAAA,eAAe,mBAqB1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serverless-devs/engine",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.21",
4
4
  "description": "request for serverless-devs",
5
5
  "main": "lib/index.js",
6
6
  "author": "xsahxl",
@@ -19,10 +19,10 @@
19
19
  "string-argv": "^0.3.2",
20
20
  "xstate": "^4.37.2",
21
21
  "@serverless-devs/credential": "^0.0.2-beta.1",
22
- "@serverless-devs/load-component": "^0.0.2-beta.1",
23
- "@serverless-devs/logger": "^0.0.2-beta.1",
24
- "@serverless-devs/parse-spec": "^0.0.1-beta.2",
25
- "@serverless-devs/utils": "^0.0.8-beta.1"
22
+ "@serverless-devs/parse-spec": "^0.0.1-beta.9",
23
+ "@serverless-devs/utils": "^0.0.8-beta.6",
24
+ "@serverless-devs/logger": "^0.0.2-beta.6",
25
+ "@serverless-devs/load-component": "^0.0.2-beta.5"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/fs-extra": "^11.0.1",
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rimraf lib node_modules",
33
+ "watch": "tsc -w",
33
34
  "build": "tsc"
34
35
  }
35
36
  }