@serverless-devs/engine 0.0.1-beta.3 → 0.0.1-beta.30

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.
@@ -14,9 +14,88 @@ declare class Actions {
14
14
  private inputs;
15
15
  constructor(actions?: IAction[], option?: IOptions);
16
16
  setValue(key: string, value: any): void;
17
- start(hookType: `${IHookType}`, inputs?: Record<string, any>): Promise<Record<string, any>>;
17
+ /**
18
+ * Initiates the execution of actions based on the given hook type.
19
+ *
20
+ * This function will attempt to execute the appropriate actions based on the hook type provided.
21
+ * If there's an error during the process, especially for GLOBAL hook level, it logs the failure.
22
+ *
23
+ * @param hookType The type of hook (e.g. PRE, POST) that determines which actions should be executed.
24
+ * @param inputs Optional inputs that might be used during the execution of actions.
25
+ * @returns Returns a record containing relevant data from the execution.
26
+ *
27
+ * @throws {DevsError} Throws a DevsError if there's an error during the action execution.
28
+ *
29
+ * @example
30
+ * const result = await actionsInstance.start('pre');
31
+ */
32
+ start(hookType: `${IHookType}`, inputs?: Record<string, any>): Promise<{}>;
33
+ /**
34
+ * Executes actions post the initial starting phase based on the given hook type.
35
+ *
36
+ * This is an internal function primarily used after the initial start of the actions
37
+ * to handle the actual execution of the actions based on the hook type.
38
+ * It filters the actions to be executed based on the hook type, logs their start,
39
+ * and then dispatches them to their respective handler methods based on their action type.
40
+ *
41
+ * @private
42
+ *
43
+ * @param {string} hookType - The type of hook (e.g. PRE, POST) determining which actions should be executed.
44
+ * @param {Record<string, any>} [inputs={}] - Optional inputs that might be used during the execution of actions.
45
+ *
46
+ * @returns {Promise<Record<string, any>>} - Returns a record containing relevant data from the execution.
47
+ *
48
+ * @throws {DevsError} - Throws a DevsError if there's an error during the action execution.
49
+ *
50
+ * @example
51
+ * const result = await actionsInstance.afterStart('PRE');
52
+ */
53
+ private afterStart;
54
+ /**
55
+ * Monitors the completion of a given command process.
56
+ *
57
+ * @param cp - The command process to be monitored.
58
+ *
59
+ * @returns Promise<object> - Resolves with an empty object if the command process completes successfully.
60
+ * Rejects with an error if the command process encounters an error.
61
+ */
62
+ private onFinish;
63
+ /**
64
+ * Executes the action specified by the provided hook.
65
+ *
66
+ * @param hook - The action hook specifying the command to run and its associated configurations.
67
+ *
68
+ * @throws DevsError - Throws an error if the command execution fails or if the specified directory does not exist.
69
+ *
70
+ * @returns Promise<void> - Resolves once the command has been executed.
71
+ */
18
72
  private run;
73
+ /**
74
+ * Loads and executes a specified plugin.
75
+ *
76
+ * This function attempts to load a plugin component, then invokes it with the appropriate inputs.
77
+ * If the plugin execution fails and the failure is allowed (based on the record's allowFailure setting),
78
+ * it gracefully handles the error without throwing. Otherwise, it throws a DevsError.
79
+ *
80
+ * @param hook - An object representing the plugin action to be executed.
81
+ *
82
+ * @throws DevsError - Throws a DevsError if the plugin execution fails and the failure is not allowed.
83
+ */
19
84
  private plugin;
85
+ /**
86
+ * Loads and executes a specified component command.
87
+ *
88
+ * This function tries to load a given component and run the specified command for it.
89
+ * If the component command execution fails and the failure is allowed (based on the record's allowFailure setting),
90
+ * it gracefully handles the error without throwing. If the command does not exist for the component,
91
+ * it throws an error indicating the missing command.
92
+ *
93
+ * @param hook - An object representing the component action to be executed.
94
+ *
95
+ * @throws DevsError - Throws a DevsError if:
96
+ * 1. The component command execution fails and the failure is not allowed.
97
+ * 2. The specified command does not exist for the component.
98
+ */
20
99
  private component;
21
100
  }
22
101
  export default Actions;
@@ -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 = {}) {
@@ -53,25 +55,80 @@ class Actions {
53
55
  this.inputs = {};
54
56
  this.logger = option.logger;
55
57
  }
58
+ // Set value to the record of the action.
56
59
  setValue(key, value) {
57
60
  if (this.option.skipActions)
58
61
  return;
59
62
  (0, lodash_1.set)(this.record, key, value);
60
63
  }
64
+ /**
65
+ * Initiates the execution of actions based on the given hook type.
66
+ *
67
+ * This function will attempt to execute the appropriate actions based on the hook type provided.
68
+ * If there's an error during the process, especially for GLOBAL hook level, it logs the failure.
69
+ *
70
+ * @param hookType The type of hook (e.g. PRE, POST) that determines which actions should be executed.
71
+ * @param inputs Optional inputs that might be used during the execution of actions.
72
+ * @returns Returns a record containing relevant data from the execution.
73
+ *
74
+ * @throws {DevsError} Throws a DevsError if there's an error during the action execution.
75
+ *
76
+ * @example
77
+ * const result = await actionsInstance.start('pre');
78
+ */
61
79
  start(hookType, inputs = {}) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ try {
82
+ return yield this.afterStart(hookType, inputs);
83
+ }
84
+ catch (error) {
85
+ let err = error;
86
+ if (this.option.hookLevel === parse_spec_1.IActionLevel.GLOBAL) {
87
+ 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)`)}`);
88
+ }
89
+ throw error;
90
+ }
91
+ });
92
+ }
93
+ /**
94
+ * Executes actions post the initial starting phase based on the given hook type.
95
+ *
96
+ * This is an internal function primarily used after the initial start of the actions
97
+ * to handle the actual execution of the actions based on the hook type.
98
+ * It filters the actions to be executed based on the hook type, logs their start,
99
+ * and then dispatches them to their respective handler methods based on their action type.
100
+ *
101
+ * @private
102
+ *
103
+ * @param {string} hookType - The type of hook (e.g. PRE, POST) determining which actions should be executed.
104
+ * @param {Record<string, any>} [inputs={}] - Optional inputs that might be used during the execution of actions.
105
+ *
106
+ * @returns {Promise<Record<string, any>>} - Returns a record containing relevant data from the execution.
107
+ *
108
+ * @throws {DevsError} - Throws a DevsError if there's an error during the action execution.
109
+ *
110
+ * @example
111
+ * const result = await actionsInstance.afterStart('PRE');
112
+ */
113
+ afterStart(hookType, inputs = {}) {
62
114
  return __awaiter(this, void 0, void 0, function* () {
63
115
  if (this.option.skipActions)
64
116
  return {};
65
117
  this.inputs = inputs;
66
- const hooks = (0, lodash_1.filter)(this.actions, (item) => item.hookType === hookType);
118
+ const hooks = (0, lodash_1.filter)(this.actions, item => item.hookType === hookType);
67
119
  if ((0, lodash_1.isEmpty)(hooks))
68
120
  return {};
69
- this.logger.info(`Start the ${hookType}-action in ${this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
70
- ? `${this.option.projectName} project`
71
- : parse_spec_1.IActionLevel.GLOBAL}`);
121
+ this.record.startTime = Date.now();
122
+ this.record.lable = this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT ? `[${this.option.projectName}]` : parse_spec_1.IActionLevel.GLOBAL;
123
+ this.logger.debug(`Start executing the ${hookType}-action in ${this.record.lable}`);
72
124
  const newHooks = (0, parse_spec_1.getInputs)(hooks, this.record.magic);
125
+ // post-action应获取componentProps, 先清空pluginOutput
126
+ if (hookType !== parse_spec_1.IHookType.PRE) {
127
+ this.record.pluginOutput = {};
128
+ }
73
129
  for (const hook of newHooks) {
74
- debug(`${hook.level} action item: ${(0, utils_1.stringify)(hook)}`);
130
+ debug(`${hook.level} action item: ${(0, utils_2.stringify)(hook)}`);
131
+ this.record.allowFailure = this.record.step && 'allow_failure' in this.record.step ? (0, lodash_1.get)(this.record, 'step.allow_failure') : hook.allow_failure;
75
132
  if (hook.actionType === parse_spec_1.IActionType.RUN) {
76
133
  yield this.run(hook);
77
134
  }
@@ -83,62 +140,200 @@ class Actions {
83
140
  yield this.component(hook);
84
141
  }
85
142
  }
86
- this.logger.info(`End the ${hookType}-action in ${this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
87
- ? `${this.option.projectName} project`
88
- : parse_spec_1.IActionLevel.GLOBAL}`);
89
- return this.record.pluginOutput;
143
+ this.logger.debug(`The ${hookType}-action successfully to execute in ${this.record.lable}`);
144
+ if (this.option.hookLevel === parse_spec_1.IActionLevel.GLOBAL) {
145
+ 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)})`)}`);
146
+ }
147
+ return this.record;
90
148
  });
91
149
  }
150
+ /**
151
+ * Monitors the completion of a given command process.
152
+ *
153
+ * @param cp - The command process to be monitored.
154
+ *
155
+ * @returns Promise<object> - Resolves with an empty object if the command process completes successfully.
156
+ * Rejects with an error if the command process encounters an error.
157
+ */
158
+ onFinish(cp) {
159
+ return new Promise((resolve, reject) => {
160
+ // Arrays to store stdout and stderr data from the command process.
161
+ const stdout = [];
162
+ const stderr = [];
163
+ // Listen to the 'data' event of stdout. Append the data chunk to the logger and the stdout array.
164
+ cp.stdout.on('data', (chunk) => {
165
+ this.logger.append(chunk.toString());
166
+ stdout.push(chunk);
167
+ });
168
+ // Listen to the 'data' event of stderr. Append the data chunk to the logger and the stderr array.
169
+ cp.stderr.on('data', (chunk) => {
170
+ this.logger.append(chunk.toString());
171
+ stderr.push(chunk);
172
+ });
173
+ // Listen to the 'exit' event of the command process.
174
+ // If the process exits with a code of 0, resolve the promise.
175
+ // If the process exits with a non-zero code, reject the promise with the accumulated stderr as the error message.
176
+ cp.on('exit', (code) => {
177
+ code === 0 ? resolve({}) : reject(new Error(Buffer.concat(stderr).toString()));
178
+ });
179
+ });
180
+ }
181
+ /**
182
+ * Executes the action specified by the provided hook.
183
+ *
184
+ * @param hook - The action hook specifying the command to run and its associated configurations.
185
+ *
186
+ * @throws DevsError - Throws an error if the command execution fails or if the specified directory does not exist.
187
+ *
188
+ * @returns Promise<void> - Resolves once the command has been executed.
189
+ */
92
190
  run(hook) {
93
191
  return __awaiter(this, void 0, void 0, function* () {
192
+ // Check if the provided path exists and is a directory.
94
193
  if (fs_extra_1.default.existsSync(hook.path) && fs_extra_1.default.lstatSync(hook.path).isDirectory()) {
95
194
  try {
96
- execa_1.default.sync(hook.value, {
195
+ // Execute the command in the specified directory.
196
+ const cp = (0, execa_1.command)(hook.value, {
97
197
  cwd: hook.path,
98
- stdio: 'inherit',
99
198
  shell: true,
100
199
  });
200
+ yield this.onFinish(cp);
101
201
  }
102
202
  catch (e) {
103
203
  const error = e;
104
- // pre hook, throw error
105
- if (hook.hookType !== parse_spec_1.IHookType.PRE)
106
- return;
204
+ // If the current environment is Windows, log additional debugging information.
107
205
  if (utils.isWindow()) {
108
206
  debug('Command run execution environment:CMD');
109
207
  debug('Please check whether the actions section of yaml can be executed in the current environment.');
110
208
  }
111
- (0, utils_1.throwError)('Global pre-action failed to execute:' + error.message);
209
+ // Check if the error can be safely ignored.
210
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
211
+ exitCode: constants_1.EXIT_CODE.RUN,
212
+ command: this.record.command,
213
+ });
214
+ if (useAllowFailure)
215
+ return;
216
+ throw new utils_1.DevsError(error.message, {
217
+ data: (0, lodash_1.get)(e, 'data'),
218
+ stack: error.stack,
219
+ exitCode: constants_1.EXIT_CODE.RUN,
220
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
221
+ });
112
222
  }
223
+ return;
113
224
  }
225
+ // Check if the error related to a non-existent directory can be safely ignored.
226
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
227
+ exitCode: constants_1.EXIT_CODE.DEVS,
228
+ command: this.record.command,
229
+ });
230
+ if (useAllowFailure)
231
+ return;
232
+ throw new utils_1.DevsError(`The ${hook.path} directory does not exist.`, {
233
+ exitCode: constants_1.EXIT_CODE.DEVS,
234
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
235
+ });
114
236
  });
115
237
  }
238
+ /**
239
+ * Loads and executes a specified plugin.
240
+ *
241
+ * This function attempts to load a plugin component, then invokes it with the appropriate inputs.
242
+ * If the plugin execution fails and the failure is allowed (based on the record's allowFailure setting),
243
+ * it gracefully handles the error without throwing. Otherwise, it throws a DevsError.
244
+ *
245
+ * @param hook - An object representing the plugin action to be executed.
246
+ *
247
+ * @throws DevsError - Throws a DevsError if the plugin execution fails and the failure is not allowed.
248
+ */
116
249
  plugin(hook) {
117
250
  return __awaiter(this, void 0, void 0, function* () {
118
- const instance = yield (0, load_component_1.default)(hook.value);
119
- // TODO: inputs
120
- const inputs = (0, lodash_1.isEmpty)(this.record.pluginOutput) ? this.inputs : this.record.pluginOutput;
121
- this.record.pluginOutput = yield instance(inputs, hook.args);
251
+ try {
252
+ // Load the plugin component.
253
+ const instance = yield (0, load_component_1.default)(hook.value);
254
+ // Determine the inputs for the plugin based on the record's pluginOutput.
255
+ const inputs = (0, lodash_1.isEmpty)(this.record.pluginOutput) ? this.inputs : this.record.pluginOutput;
256
+ // Execute the plugin with the determined inputs and provided arguments.
257
+ this.record.pluginOutput = yield instance(inputs, hook.args);
258
+ }
259
+ catch (e) {
260
+ const error = e;
261
+ // Check if the failure is allowed based on the record's allowFailure setting.
262
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
263
+ exitCode: constants_1.EXIT_CODE.PLUGIN,
264
+ command: this.record.command,
265
+ });
266
+ if (useAllowFailure)
267
+ return;
268
+ throw new utils_1.DevsError(error.message, {
269
+ data: (0, lodash_1.get)(e, 'data'),
270
+ stack: error.stack,
271
+ exitCode: constants_1.EXIT_CODE.PLUGIN,
272
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
273
+ });
274
+ }
122
275
  });
123
276
  }
277
+ /**
278
+ * Loads and executes a specified component command.
279
+ *
280
+ * This function tries to load a given component and run the specified command for it.
281
+ * If the component command execution fails and the failure is allowed (based on the record's allowFailure setting),
282
+ * it gracefully handles the error without throwing. If the command does not exist for the component,
283
+ * it throws an error indicating the missing command.
284
+ *
285
+ * @param hook - An object representing the component action to be executed.
286
+ *
287
+ * @throws DevsError - Throws a DevsError if:
288
+ * 1. The component command execution fails and the failure is not allowed.
289
+ * 2. The specified command does not exist for the component.
290
+ */
124
291
  component(hook) {
125
292
  return __awaiter(this, void 0, void 0, function* () {
293
+ // Parse the command and arguments from the hook value.
126
294
  const argv = (0, string_argv_1.default)(hook.value);
127
295
  const { _ } = utils.parseArgv(argv);
128
- const [componentName, method] = _;
296
+ const [componentName, command] = _;
297
+ // Load the specified component.
129
298
  const instance = yield (0, load_component_1.default)(componentName, { logger: this.logger });
130
- if (instance[method]) {
299
+ // Check if the specified command exists for the component.
300
+ if (instance[command]) {
131
301
  // 方法存在,执行报错,退出码101
132
- 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)) });
302
+ 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)) });
133
303
  try {
134
- return yield instance[method](newInputs);
304
+ // Execute the command for the component with the prepared inputs.
305
+ return yield instance[command](newInputs);
135
306
  }
136
- catch (error) {
137
- (0, utils_1.throw101Error)(error, `${hook.actionType}-action failed to execute:`);
307
+ catch (e) {
308
+ const error = e;
309
+ // Check if the failure is allowed based on the record's allowFailure setting.
310
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
311
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
312
+ command: this.record.command,
313
+ });
314
+ if (useAllowFailure)
315
+ return;
316
+ throw new utils_1.DevsError(error.message, {
317
+ data: (0, lodash_1.get)(e, 'data'),
318
+ stack: error.stack,
319
+ exitCode: constants_1.EXIT_CODE.COMPONENT,
320
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
321
+ });
138
322
  }
139
323
  }
324
+ // Check if the failure (due to missing command) is allowed.
325
+ const useAllowFailure = (0, utils_2.getAllowFailure)(this.record.allowFailure, {
326
+ exitCode: constants_1.EXIT_CODE.DEVS,
327
+ command: this.record.command,
328
+ });
329
+ if (useAllowFailure)
330
+ return;
140
331
  // 方法不存在,此时系统将会认为是未找到组件方法,系统的exit code为100;
141
- (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')}`);
332
+ throw new utils_1.DevsError(`The [${command}] command was not found.`, {
333
+ exitCode: constants_1.EXIT_CODE.DEVS,
334
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
335
+ 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')}`,
336
+ });
142
337
  });
143
338
  }
144
339
  }
@@ -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;AAexE,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;QAEv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AAO,0BAA0B,EAAE;gBAC7D,QAAQ,EAAE,qBAAS,CAAC,IAAI;gBACxB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,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,14 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXIT_CODE = void 0;
4
+ exports.EXIT_CODE = {
5
+ // CLI 执行错误
6
+ DEVS: 100,
7
+ // 组件 执行错误
8
+ COMPONENT: 101,
9
+ // 插件 执行错误
10
+ PLUGIN: 101,
11
+ // shell 执行错误
12
+ RUN: 101,
13
+ };
2
14
  //# 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,WAAW;IACX,IAAI,EAAE,GAAG;IACT,UAAU;IACV,SAAS,EAAE,GAAG;IACd,UAAU;IACV,MAAM,EAAE,GAAG;IACX,aAAa;IACb,GAAG,EAAE,GAAG;CACT,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { IEngineOptions, IContext } from './types';
2
- export { IEngineOptions, IContext } from './types';
2
+ export * from './types';
3
+ /**
4
+ * Engine Class
5
+ *
6
+ * This class provides an engine to handle Serverless Devs operations and steps.
7
+ * It operates based on the xstate state machine library, ensuring that execution follows
8
+ * the predefined flow and states.
9
+ */
3
10
  declare class Engine {
4
11
  private options;
5
12
  context: IContext;
@@ -11,18 +18,85 @@ declare class Engine {
11
18
  private globalActionInstance;
12
19
  private actionInstance;
13
20
  constructor(options: IEngineOptions);
21
+ /**
22
+ * Initialization steps before starting the engine.
23
+ */
24
+ private beforeStart;
25
+ /**
26
+ * Start the engine.
27
+ *
28
+ * This is the primary execution function for the engine. It is responsible for starting
29
+ * the entire engine and handling each step.
30
+ *
31
+ * @note engine应收敛所有的异常,不应该抛出异常
32
+ */
14
33
  start(): Promise<IContext>;
15
- output(): void;
34
+ /**
35
+ * Extracts and returns an object containing the output of each step.
36
+ * The object's key is the project name and the value is the output of that project.
37
+ */
38
+ private getOutput;
39
+ /**
40
+ * Validates the 'steps' and 'command' present in 'this.spec'.
41
+ * Throws an error if either 'steps' or 'command' are missing.
42
+ */
16
43
  private validate;
44
+ /**
45
+ * Asynchronously downloads and initializes the given steps.
46
+ * For each step, it loads the specified component and associates a logger with it.
47
+ * Returns an array containing the initialized steps.
48
+ */
17
49
  private download;
18
50
  private getLogger;
51
+ /**
52
+ * Updates the context for the given step based on the provided options.
53
+ *
54
+ * @param item - The current step being processed.
55
+ * @param options - An object containing details like status, error, output, etc. to update the step's context.
56
+ */
19
57
  private recordContext;
58
+ /**
59
+ * Generates a context data for the given step containing details like cwd, vars, and other steps' outputs and props.
60
+ * @param item - The current step being processed.
61
+ * @returns - The generated context data.
62
+ */
20
63
  private getFilterContext;
64
+ /**
65
+ * Handles the subsequent operations after a step has been completed.
66
+ * 1. Marks the step as completed.
67
+ * 2. If the step status is FAILURE, attempts to trigger the global FAIL hook.
68
+ * 3. If the step status is SUCCESS, attempts to trigger the global SUCCESS hook.
69
+ * 4. Regardless of the step's status, tries to trigger the global COMPLETE hook to denote completion.
70
+ */
21
71
  private doCompleted;
72
+ /**
73
+ * Handles the execution process for a project step.
74
+ * @param item - The project step to handle.
75
+ */
22
76
  private handleSrc;
77
+ /**
78
+ * Handles the logic after a project step's execution.
79
+ * @param item - The project step to handle.
80
+ */
23
81
  private handleAfterSrc;
82
+ /**
83
+ * Retrieve properties for a specific project step.
84
+ * @param item - The project step for which properties are to be retrieved.
85
+ * @returns An object containing properties related to the project step.
86
+ */
24
87
  private getProps;
88
+ /**
89
+ * Executes the appropriate action based on the provided project step.
90
+ * @param item - The project step to be executed.
91
+ * @param data - Additional data which may contain plugin output.
92
+ * @returns Result of the executed action, if applicable.
93
+ */
25
94
  private doSrc;
95
+ /**
96
+ * Handles the project step that is marked to be skipped.
97
+ * @param item - The project step to be skipped.
98
+ * @returns A resolved Promise.
99
+ */
26
100
  private doSkip;
27
101
  }
28
102
  export default Engine;