@serverless-devs/engine 0.0.1-beta.9 → 0.0.2

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
+ /**
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
+ */
17
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;
@@ -40,7 +40,7 @@ const lodash_1 = require("lodash");
40
40
  const utils = __importStar(require("@serverless-devs/utils"));
41
41
  const utils_1 = require("@serverless-devs/utils");
42
42
  const fs_extra_1 = __importDefault(require("fs-extra"));
43
- const execa_1 = __importDefault(require("execa"));
43
+ const execa_1 = require("execa");
44
44
  const load_component_1 = __importDefault(require("@serverless-devs/load-component"));
45
45
  const string_argv_1 = __importDefault(require("string-argv"));
46
46
  const utils_2 = require("../utils");
@@ -55,27 +55,80 @@ class Actions {
55
55
  this.inputs = {};
56
56
  this.logger = option.logger;
57
57
  }
58
+ // Set value to the record of the action.
58
59
  setValue(key, value) {
59
60
  if (this.option.skipActions)
60
61
  return;
61
62
  (0, lodash_1.set)(this.record, key, value);
62
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
+ */
63
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 = {}) {
64
114
  return __awaiter(this, void 0, void 0, function* () {
65
115
  if (this.option.skipActions)
66
116
  return {};
67
117
  this.inputs = inputs;
68
- 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);
69
119
  if ((0, lodash_1.isEmpty)(hooks))
70
120
  return {};
71
- this.record.lable =
72
- this.option.hookLevel === parse_spec_1.IActionLevel.PROJECT
73
- ? `${this.option.projectName} project`
74
- : 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;
75
123
  this.logger.debug(`Start executing the ${hookType}-action in ${this.record.lable}`);
76
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
+ }
77
129
  for (const hook of newHooks) {
78
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;
79
132
  if (hook.actionType === parse_spec_1.IActionType.RUN) {
80
133
  yield this.run(hook);
81
134
  }
@@ -87,94 +140,199 @@ class Actions {
87
140
  yield this.component(hook);
88
141
  }
89
142
  }
90
- // pre-action执行完毕,清空pluginOutput, post-action应获取componentProps
91
- if (hookType === parse_spec_1.IHookType.PRE) {
92
- this.record.pluginOutput = {};
93
- }
94
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
+ }
95
147
  return this.record;
96
148
  });
97
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
+ */
98
190
  run(hook) {
99
191
  return __awaiter(this, void 0, void 0, function* () {
192
+ // Check if the provided path exists and is a directory.
100
193
  if (fs_extra_1.default.existsSync(hook.path) && fs_extra_1.default.lstatSync(hook.path).isDirectory()) {
101
194
  try {
102
- execa_1.default.sync(hook.value, {
195
+ // Execute the command in the specified directory.
196
+ const cp = (0, execa_1.command)(hook.value, {
103
197
  cwd: hook.path,
104
- stdio: 'inherit',
105
198
  shell: true,
106
199
  });
200
+ yield this.onFinish(cp);
107
201
  }
108
202
  catch (e) {
109
203
  const error = e;
204
+ // If the current environment is Windows, log additional debugging information.
110
205
  if (utils.isWindow()) {
111
206
  debug('Command run execution environment:CMD');
112
207
  debug('Please check whether the actions section of yaml can be executed in the current environment.');
113
208
  }
114
- if ((0, utils_2.getAllowFailure)(hook.allow_failure, { exitCode: constants_1.EXIT_CODE.RUN }))
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)
115
215
  return;
116
- throw new utils_1.TipsError(error.message, {
216
+ throw new utils_1.DevsError(error.message, {
217
+ data: (0, lodash_1.get)(e, 'data'),
218
+ stack: error.stack,
117
219
  exitCode: constants_1.EXIT_CODE.RUN,
118
- prefix: `${this.record.lable} ${hook.hookType}-action failed to execute:`,
220
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
119
221
  });
120
222
  }
121
223
  return;
122
224
  }
123
- if ((0, utils_2.getAllowFailure)(hook.allow_failure, { exitCode: constants_1.EXIT_CODE.DEVS }))
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)
124
231
  return;
125
- throw new utils_1.TipsError(`The ${hook.path} directory does not exist.`, {
232
+ throw new utils_1.DevsError(`The ${hook.path} directory does not exist.`, {
126
233
  exitCode: constants_1.EXIT_CODE.DEVS,
127
- prefix: `${this.record.lable} ${hook.hookType}-action failed to execute:`,
234
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
128
235
  });
129
236
  });
130
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
+ */
131
249
  plugin(hook) {
132
250
  return __awaiter(this, void 0, void 0, function* () {
133
251
  try {
252
+ // Load the plugin component.
134
253
  const instance = yield (0, load_component_1.default)(hook.value);
254
+ // Determine the inputs for the plugin based on the record's pluginOutput.
135
255
  const inputs = (0, lodash_1.isEmpty)(this.record.pluginOutput) ? this.inputs : this.record.pluginOutput;
136
- this.record.pluginOutput = yield instance(inputs, hook.args);
256
+ // Execute the plugin with the determined inputs and provided arguments.
257
+ this.record.pluginOutput = yield instance(inputs, hook.args, this.logger);
137
258
  }
138
259
  catch (e) {
139
260
  const error = e;
140
- if ((0, utils_2.getAllowFailure)(hook.allow_failure, { exitCode: constants_1.EXIT_CODE.PLUGIN }))
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)
141
267
  return;
142
- throw new utils_1.TipsError(error.message, {
268
+ throw new utils_1.DevsError(error.message, {
269
+ data: (0, lodash_1.get)(e, 'data'),
270
+ stack: error.stack,
143
271
  exitCode: constants_1.EXIT_CODE.PLUGIN,
144
- prefix: `${this.record.lable} ${hook.hookType}-action failed to execute:`,
272
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
145
273
  });
146
274
  }
147
275
  });
148
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
+ */
149
291
  component(hook) {
150
292
  return __awaiter(this, void 0, void 0, function* () {
293
+ // Parse the command and arguments from the hook value.
151
294
  const argv = (0, string_argv_1.default)(hook.value);
152
295
  const { _ } = utils.parseArgv(argv);
153
- const [componentName, method] = _;
296
+ const [componentName, command] = _;
297
+ // Load the specified component.
154
298
  const instance = yield (0, load_component_1.default)(componentName, { logger: this.logger });
155
- if (instance[method]) {
299
+ // Check if the specified command exists for the component.
300
+ if (instance[command]) {
156
301
  // 方法存在,执行报错,退出码101
157
- 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)) });
158
303
  try {
159
- return yield instance[method](newInputs);
304
+ // Execute the command for the component with the prepared inputs.
305
+ return yield instance[command](newInputs);
160
306
  }
161
307
  catch (e) {
162
308
  const error = e;
163
- if ((0, utils_2.getAllowFailure)(hook.allow_failure, { exitCode: constants_1.EXIT_CODE.COMPONENT }))
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)
164
315
  return;
165
- throw new utils_1.TipsError(error.message, {
316
+ throw new utils_1.DevsError(error.message, {
317
+ data: (0, lodash_1.get)(e, 'data'),
318
+ stack: error.stack,
166
319
  exitCode: constants_1.EXIT_CODE.COMPONENT,
167
- prefix: `${this.record.lable} ${hook.hookType}-action failed to execute:`,
320
+ prefix: `${this.record.lable} ${hook.hookType}-action failed to [${this.record.command}]:`,
168
321
  });
169
322
  }
170
323
  }
171
- if ((0, utils_2.getAllowFailure)(hook.allow_failure, { exitCode: constants_1.EXIT_CODE.DEVS }))
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)
172
330
  return;
173
331
  // 方法不存在,此时系统将会认为是未找到组件方法,系统的exit code为100;
174
- throw new utils_1.TipsError(`The [${method}] command was not found.`, {
332
+ throw new utils_1.DevsError(`The [${command}] command was not found.`, {
175
333
  exitCode: constants_1.EXIT_CODE.DEVS,
176
- prefix: `${this.record.lable} ${hook.hookType}-action failed to execute:`,
177
- tips: `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')}`,
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')}`,
178
336
  });
179
337
  });
180
338
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DASqC;AACrC,mCAAwD;AACxD,8DAAgD;AAChD,kDAAmD;AACnD,wDAA0B;AAC1B,kDAA0B;AAC1B,qFAA4D;AAC5D,8DAAqC;AACrC,oCAAsD;AACtD,kDAA0B;AAE1B,4CAAyC;AAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAgBxE,MAAM,OAAO;IAIX,YAAoB,UAAqB,EAAE,EAAU,SAAS,EAAc;QAAxD,YAAO,GAAP,OAAO,CAAgB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AC,SAAS;wBAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,sBAAsB,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI;qBAC3F,CAAC,CAAC;iBACJ;aACF;YAED,4DAA4D;YAC5D,MAAM,eAAe,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;gBAChE,QAAQ,EAAE,qBAAS,CAAC,IAAI;gBACxB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;aAC7B,CAAC,CAAC;YACH,IAAI,eAAe;gBAAE,OAAO;YAC5B,2CAA2C;YAC3C,MAAM,IAAI,iBAAS,CAAC,QAAQ,OAAO,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"}
@@ -2,9 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EXIT_CODE = void 0;
4
4
  exports.EXIT_CODE = {
5
+ // CLI 执行错误
5
6
  DEVS: 100,
7
+ // 组件 执行错误
6
8
  COMPONENT: 101,
9
+ // 插件 执行错误
7
10
  PLUGIN: 101,
11
+ // shell 执行错误
8
12
  RUN: 101,
9
13
  };
10
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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"}
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,19 +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
+ */
14
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
+ */
15
33
  start(): Promise<IContext>;
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
+ */
16
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
+ */
17
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
+ */
18
49
  private download;
19
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
+ */
20
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
+ */
21
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
+ */
22
71
  private doCompleted;
72
+ /**
73
+ * Handles the execution process for a project step.
74
+ * @param item - The project step to handle.
75
+ */
23
76
  private handleSrc;
77
+ /**
78
+ * Handles the logic after a project step's execution.
79
+ * @param item - The project step to handle.
80
+ */
24
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
+ */
25
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
+ */
26
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
+ */
27
100
  private doSkip;
28
101
  }
29
102
  export default Engine;