@serverless-devs/engine 0.0.1-beta.1
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.
- package/LICENSE +21 -0
- package/lib/actions/index.d.ts +21 -0
- package/lib/actions/index.js +142 -0
- package/lib/actions/index.js.map +1 -0
- package/lib/constants/index.d.ts +0 -0
- package/lib/constants/index.js +2 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/index.d.ts +27 -0
- package/lib/index.js +401 -0
- package/lib/index.js.map +1 -0
- package/lib/types.d.ts +68 -0
- package/lib/types.js +23 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.js +88 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Serverless Devs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IAction, IActionLevel, IHookType } from '@serverless-devs/parse-spec';
|
|
2
|
+
import { ILoggerInstance } from '@serverless-devs/logger';
|
|
3
|
+
interface IOptions {
|
|
4
|
+
hookLevel: `${IActionLevel}`;
|
|
5
|
+
projectName?: string;
|
|
6
|
+
logger: ILoggerInstance;
|
|
7
|
+
}
|
|
8
|
+
declare class Actions {
|
|
9
|
+
private actions;
|
|
10
|
+
private option;
|
|
11
|
+
private record;
|
|
12
|
+
private logger;
|
|
13
|
+
private inputs;
|
|
14
|
+
constructor(actions?: IAction[], option?: IOptions);
|
|
15
|
+
setValue(key: string, value: any): void;
|
|
16
|
+
start(hookType: `${IHookType}`, inputs?: Record<string, any>): Promise<Record<string, any>>;
|
|
17
|
+
private run;
|
|
18
|
+
private plugin;
|
|
19
|
+
private component;
|
|
20
|
+
}
|
|
21
|
+
export default Actions;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const parse_spec_1 = require("@serverless-devs/parse-spec");
|
|
39
|
+
const lodash_1 = require("lodash");
|
|
40
|
+
const utils = __importStar(require("@serverless-devs/utils"));
|
|
41
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
42
|
+
const execa_1 = __importDefault(require("execa"));
|
|
43
|
+
const load_component_1 = __importDefault(require("@serverless-devs/load-component"));
|
|
44
|
+
const string_argv_1 = __importDefault(require("string-argv"));
|
|
45
|
+
const utils_1 = require("../utils");
|
|
46
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
47
|
+
const debug = require('@serverless-cd/debug')('serverless-devs:engine');
|
|
48
|
+
class Actions {
|
|
49
|
+
constructor(actions = [], option = {}) {
|
|
50
|
+
this.actions = actions;
|
|
51
|
+
this.option = option;
|
|
52
|
+
this.record = {};
|
|
53
|
+
this.inputs = {};
|
|
54
|
+
this.logger = option.logger;
|
|
55
|
+
}
|
|
56
|
+
setValue(key, value) {
|
|
57
|
+
(0, lodash_1.set)(this.record, key, value);
|
|
58
|
+
}
|
|
59
|
+
start(hookType, inputs = {}) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
this.inputs = inputs;
|
|
62
|
+
const hooks = (0, lodash_1.filter)(this.actions, (item) => item.hookType === hookType);
|
|
63
|
+
if ((0, lodash_1.isEmpty)(hooks))
|
|
64
|
+
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}`);
|
|
68
|
+
const newHooks = (0, parse_spec_1.getInputs)(hooks, this.record.magic);
|
|
69
|
+
for (const hook of newHooks) {
|
|
70
|
+
debug(`${hook.level} action item: ${(0, utils_1.stringify)(hook)}`);
|
|
71
|
+
if (hook.actionType === parse_spec_1.IActionType.RUN) {
|
|
72
|
+
yield this.run(hook);
|
|
73
|
+
}
|
|
74
|
+
if (hook.actionType === parse_spec_1.IActionType.PLUGIN) {
|
|
75
|
+
yield this.plugin(hook);
|
|
76
|
+
}
|
|
77
|
+
// 项目action才有component
|
|
78
|
+
if (hook.actionType === parse_spec_1.IActionType.COMPONENT && hook.level === parse_spec_1.IActionLevel.PROJECT) {
|
|
79
|
+
yield this.component(hook);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
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;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
run(hook) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (fs_extra_1.default.existsSync(hook.path) && fs_extra_1.default.lstatSync(hook.path).isDirectory()) {
|
|
91
|
+
try {
|
|
92
|
+
execa_1.default.sync(hook.value, {
|
|
93
|
+
cwd: hook.path,
|
|
94
|
+
stdio: 'inherit',
|
|
95
|
+
shell: true,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
const error = e;
|
|
100
|
+
// pre hook, throw error
|
|
101
|
+
if (hook.hookType !== parse_spec_1.IHookType.PRE)
|
|
102
|
+
return;
|
|
103
|
+
if (utils.isWindow()) {
|
|
104
|
+
debug('Command run execution environment:CMD');
|
|
105
|
+
debug('Please check whether the actions section of yaml can be executed in the current environment.');
|
|
106
|
+
}
|
|
107
|
+
(0, utils_1.throwError)('Global pre-action failed to execute:' + error.message);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
plugin(hook) {
|
|
113
|
+
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);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
component(hook) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const argv = (0, string_argv_1.default)(hook.value);
|
|
123
|
+
const { _ } = utils.parseArgv(argv);
|
|
124
|
+
const [componentName, method] = _;
|
|
125
|
+
const instance = yield (0, load_component_1.default)(componentName);
|
|
126
|
+
if (instance[method]) {
|
|
127
|
+
// 方法存在,执行报错,退出码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)) });
|
|
129
|
+
try {
|
|
130
|
+
return yield instance[method](newInputs);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
(0, utils_1.throw101Error)(error, `${hook.actionType}-action failed to execute:`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// 方法不存在,此时系统将会认为是未找到组件方法,系统的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')}`);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.default = Actions;
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,G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AAK,CAAC,SAAS,CAChH,gFAAgF,CACjF,EAAE,CACJ,CAAC;QACJ,CAAC;KAAA;CACF;AAED,kBAAe,OAAO,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IEngineOptions, IContext } from './types';
|
|
2
|
+
export { IEngineOptions, IContext } from './types';
|
|
3
|
+
declare class Engine {
|
|
4
|
+
private options;
|
|
5
|
+
context: IContext;
|
|
6
|
+
private record;
|
|
7
|
+
private spec;
|
|
8
|
+
private glog;
|
|
9
|
+
private logger;
|
|
10
|
+
private parseSpecInstance;
|
|
11
|
+
private globalActionInstance;
|
|
12
|
+
private actionInstance;
|
|
13
|
+
constructor(options: IEngineOptions);
|
|
14
|
+
start(): Promise<IContext>;
|
|
15
|
+
private validate;
|
|
16
|
+
private download;
|
|
17
|
+
private getLogger;
|
|
18
|
+
private recordContext;
|
|
19
|
+
private getFilterContext;
|
|
20
|
+
private doCompleted;
|
|
21
|
+
private handleSrc;
|
|
22
|
+
private handleAfterSrc;
|
|
23
|
+
private getProps;
|
|
24
|
+
private doSrc;
|
|
25
|
+
private doSkip;
|
|
26
|
+
}
|
|
27
|
+
export default Engine;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const xstate_1 = require("xstate");
|
|
39
|
+
const lodash_1 = require("lodash");
|
|
40
|
+
const types_1 = require("./types");
|
|
41
|
+
const utils_1 = require("./utils");
|
|
42
|
+
const parse_spec_1 = __importStar(require("@serverless-devs/parse-spec"));
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
45
|
+
const actions_1 = __importDefault(require("./actions"));
|
|
46
|
+
const credential_1 = __importDefault(require("@serverless-devs/credential"));
|
|
47
|
+
const load_component_1 = __importDefault(require("@serverless-devs/load-component"));
|
|
48
|
+
const logger_1 = __importDefault(require("@serverless-devs/logger"));
|
|
49
|
+
const utils = __importStar(require("@serverless-devs/utils"));
|
|
50
|
+
const debug = require('@serverless-cd/debug')('serverless-devs:engine');
|
|
51
|
+
class Engine {
|
|
52
|
+
constructor(options) {
|
|
53
|
+
this.options = options;
|
|
54
|
+
this.context = { status: types_1.STEP_STATUS.PENING, completed: false };
|
|
55
|
+
this.record = { status: types_1.STEP_STATUS.PENING, editStatusAble: true };
|
|
56
|
+
this.spec = {};
|
|
57
|
+
debug('engine start');
|
|
58
|
+
this.options.args = (0, lodash_1.get)(this.options, 'args', process.argv.slice(2));
|
|
59
|
+
debug(`engine options: ${(0, utils_1.stringify)(options)}`);
|
|
60
|
+
}
|
|
61
|
+
start() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
this.context.status = types_1.STEP_STATUS.RUNNING;
|
|
64
|
+
this.parseSpecInstance = new parse_spec_1.default((0, lodash_1.get)(this.options, 'yamlPath'), this.options.args);
|
|
65
|
+
this.spec = this.parseSpecInstance.start();
|
|
66
|
+
const { steps: _steps, yaml, access = yaml.access } = this.spec;
|
|
67
|
+
this.validate();
|
|
68
|
+
this.glog = this.getLogger();
|
|
69
|
+
this.logger = this.glog.__generate('engine');
|
|
70
|
+
const steps = yield this.download(_steps);
|
|
71
|
+
this.globalActionInstance = new actions_1.default(yaml.actions, {
|
|
72
|
+
hookLevel: parse_spec_1.IActionLevel.GLOBAL,
|
|
73
|
+
logger: this.logger,
|
|
74
|
+
});
|
|
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) => {
|
|
78
|
+
return Object.assign(Object.assign({}, item), { stepCount: (0, lodash_1.uniqueId)(), status: types_1.STEP_STATUS.PENING, done: false });
|
|
79
|
+
});
|
|
80
|
+
const res = yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const states = {
|
|
82
|
+
init: {
|
|
83
|
+
on: {
|
|
84
|
+
INIT: (0, lodash_1.get)(this.context.steps, '[0].stepCount'),
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
final: {
|
|
88
|
+
type: 'final',
|
|
89
|
+
invoke: {
|
|
90
|
+
src: () => __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
// 执行终态是 error-with-continue 的时候,改为 success
|
|
92
|
+
const status = this.record.status === types_1.STEP_STATUS.ERROR_WITH_CONTINUE
|
|
93
|
+
? types_1.STEP_STATUS.SUCCESS
|
|
94
|
+
: this.record.status;
|
|
95
|
+
this.context.status = status;
|
|
96
|
+
yield this.doCompleted();
|
|
97
|
+
this.context.steps = (0, lodash_1.map)(this.context.steps, (item) => (0, lodash_1.omit)(item, ['instance']));
|
|
98
|
+
debug(`context: ${(0, utils_1.stringify)(this.context)}`);
|
|
99
|
+
debug('engine end');
|
|
100
|
+
resolve(this.context);
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
(0, lodash_1.each)(this.context.steps, (item, index) => {
|
|
106
|
+
const target = this.context.steps[index + 1]
|
|
107
|
+
? (0, lodash_1.get)(this.context.steps, `[${index + 1}].stepCount`)
|
|
108
|
+
: 'final';
|
|
109
|
+
const flowProject = yaml.useFlow
|
|
110
|
+
? (0, lodash_1.filter)(this.context.steps, (o) => o.flowId === item.flowId)
|
|
111
|
+
: [item];
|
|
112
|
+
states[item.stepCount] = {
|
|
113
|
+
invoke: {
|
|
114
|
+
id: item.stepCount,
|
|
115
|
+
src: () => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
// 并行时如果已经执行过,则跳过。
|
|
117
|
+
if (item.done)
|
|
118
|
+
return;
|
|
119
|
+
this.record.startTime = Date.now();
|
|
120
|
+
// 记录 context
|
|
121
|
+
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
|
+
// 检查全局的执行状态,如果是failure,则不执行该步骤, 并记录状态为 skipped
|
|
135
|
+
if (this.record.status === types_1.STEP_STATUS.FAILURE) {
|
|
136
|
+
return yield Promise.all((0, lodash_1.map)(flowProject, (o) => this.doSkip(o)));
|
|
137
|
+
}
|
|
138
|
+
return yield Promise.all((0, lodash_1.map)(flowProject, (o) => this.handleSrc(o)));
|
|
139
|
+
}),
|
|
140
|
+
onDone: {
|
|
141
|
+
target,
|
|
142
|
+
},
|
|
143
|
+
onError: target,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
const fetchMachine = (0, xstate_1.createMachine)({
|
|
148
|
+
predictableActionArguments: true,
|
|
149
|
+
id: 'step',
|
|
150
|
+
initial: 'init',
|
|
151
|
+
states,
|
|
152
|
+
});
|
|
153
|
+
const stepService = (0, xstate_1.interpret)(fetchMachine)
|
|
154
|
+
.onTransition((state) => state.value)
|
|
155
|
+
.start();
|
|
156
|
+
stepService.send('INIT');
|
|
157
|
+
}));
|
|
158
|
+
return res;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
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
|
+
}
|
|
169
|
+
}
|
|
170
|
+
download(steps) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const newSteps = [];
|
|
173
|
+
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 }));
|
|
176
|
+
}
|
|
177
|
+
return newSteps;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
getLogger() {
|
|
181
|
+
const customLogger = (0, lodash_1.get)(this.options, 'logConfig.customLogger');
|
|
182
|
+
if (customLogger) {
|
|
183
|
+
debug('use custom logger');
|
|
184
|
+
if (customLogger instanceof logger_1.default) {
|
|
185
|
+
return customLogger;
|
|
186
|
+
}
|
|
187
|
+
throw new Error('customLogger must be instance of Logger');
|
|
188
|
+
}
|
|
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) }));
|
|
190
|
+
}
|
|
191
|
+
recordContext(item, options = {}) {
|
|
192
|
+
const { status, error, output, process_time, props, done } = options;
|
|
193
|
+
this.context.stepCount = item.stepCount;
|
|
194
|
+
this.context.steps = (0, lodash_1.map)(this.context.steps, (obj) => {
|
|
195
|
+
if (obj.stepCount === item.stepCount) {
|
|
196
|
+
if (status) {
|
|
197
|
+
obj.status = status;
|
|
198
|
+
}
|
|
199
|
+
if (error) {
|
|
200
|
+
obj.error = error;
|
|
201
|
+
this.context.error = error;
|
|
202
|
+
}
|
|
203
|
+
if (props) {
|
|
204
|
+
obj.props = props;
|
|
205
|
+
}
|
|
206
|
+
if (output) {
|
|
207
|
+
obj.output = output;
|
|
208
|
+
}
|
|
209
|
+
if (done) {
|
|
210
|
+
obj.done = done;
|
|
211
|
+
}
|
|
212
|
+
if ((0, lodash_1.has)(options, 'process_time')) {
|
|
213
|
+
obj.process_time = process_time;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return obj;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
getFilterContext(item) {
|
|
220
|
+
const data = {
|
|
221
|
+
cwd: path_1.default.dirname(this.spec.yaml.path),
|
|
222
|
+
vars: this.spec.yaml.vars,
|
|
223
|
+
credential: item.credential,
|
|
224
|
+
};
|
|
225
|
+
for (const obj of this.context.steps) {
|
|
226
|
+
data[obj.projectName] = { output: obj.output || {}, props: obj.props || {} };
|
|
227
|
+
}
|
|
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
|
+
};
|
|
235
|
+
return data;
|
|
236
|
+
}
|
|
237
|
+
doCompleted() {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
this.context.completed = true;
|
|
240
|
+
if (this.context.status === types_1.STEP_STATUS.SUCCESS) {
|
|
241
|
+
yield this.globalActionInstance.start(parse_spec_1.IHookType.SUCCESS, this.context);
|
|
242
|
+
}
|
|
243
|
+
if (this.context.status === types_1.STEP_STATUS.FAILURE) {
|
|
244
|
+
yield this.globalActionInstance.start(parse_spec_1.IHookType.FAIL, this.context);
|
|
245
|
+
}
|
|
246
|
+
yield this.globalActionInstance.start(parse_spec_1.IHookType.COMPLETE, this.context);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
handleSrc(item) {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
this.logger.info(`Start executing project ${item.projectName}`);
|
|
252
|
+
try {
|
|
253
|
+
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
|
+
}
|
|
259
|
+
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);
|
|
267
|
+
}
|
|
268
|
+
// 若记录的全局状态为true,则进行输出成功的日志
|
|
269
|
+
this.record.status === types_1.STEP_STATUS.SUCCESS &&
|
|
270
|
+
this.logger.info(`Project ${item.projectName} successfully to execute`);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
handleAfterSrc(item) {
|
|
274
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
+
try {
|
|
276
|
+
debug(`project item: ${(0, utils_1.stringify)(item)}`);
|
|
277
|
+
item.credential = yield (0, utils_1.getCredential)(item.access);
|
|
278
|
+
const newAction = this.parseSpecInstance.parseActions(item.actions, parse_spec_1.IActionLevel.PROJECT);
|
|
279
|
+
debug(`project actions: ${JSON.stringify(newAction)}`);
|
|
280
|
+
this.actionInstance = new actions_1.default(newAction, {
|
|
281
|
+
hookLevel: parse_spec_1.IActionLevel.PROJECT,
|
|
282
|
+
projectName: item.projectName,
|
|
283
|
+
logger: this.logger,
|
|
284
|
+
});
|
|
285
|
+
this.actionInstance.setValue('magic', this.getFilterContext(item));
|
|
286
|
+
const newInputs = yield this.getProps(item);
|
|
287
|
+
const pluginResult = yield this.actionInstance.start(parse_spec_1.IHookType.PRE, newInputs);
|
|
288
|
+
const response = yield this.doSrc(item, pluginResult);
|
|
289
|
+
// 记录全局的执行状态
|
|
290
|
+
if (this.record.editStatusAble) {
|
|
291
|
+
this.record.status = types_1.STEP_STATUS.SUCCESS;
|
|
292
|
+
}
|
|
293
|
+
// id 添加状态
|
|
294
|
+
if (item.id) {
|
|
295
|
+
this.record.steps = Object.assign(Object.assign({}, this.record.steps), { [item.id]: {
|
|
296
|
+
status: types_1.STEP_STATUS.SUCCESS,
|
|
297
|
+
output: response,
|
|
298
|
+
} });
|
|
299
|
+
}
|
|
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 });
|
|
302
|
+
}
|
|
303
|
+
catch (e) {
|
|
304
|
+
const error = e;
|
|
305
|
+
const status = item['continue-on-error'] === true ? types_1.STEP_STATUS.ERROR_WITH_CONTINUE : types_1.STEP_STATUS.FAILURE;
|
|
306
|
+
// 记录全局的执行状态
|
|
307
|
+
if (this.record.editStatusAble) {
|
|
308
|
+
this.record.status = status;
|
|
309
|
+
}
|
|
310
|
+
if (status === types_1.STEP_STATUS.FAILURE) {
|
|
311
|
+
// 全局的执行状态一旦失败,便不可修改
|
|
312
|
+
this.record.editStatusAble = false;
|
|
313
|
+
}
|
|
314
|
+
if (item.id) {
|
|
315
|
+
this.record.steps = Object.assign(Object.assign({}, this.record.steps), { [item.id]: {
|
|
316
|
+
status,
|
|
317
|
+
} });
|
|
318
|
+
}
|
|
319
|
+
const process_time = (0, utils_1.getProcessTime)(this.record.startTime);
|
|
320
|
+
if (item['continue-on-error']) {
|
|
321
|
+
this.recordContext(item, { status, process_time });
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
this.recordContext(item, { status, error, process_time });
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
getProps(item) {
|
|
331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
+
const magic = this.getFilterContext(item);
|
|
333
|
+
debug(`magic context: ${JSON.stringify(magic)}`);
|
|
334
|
+
const newInputs = (0, parse_spec_1.getInputs)(item.props, magic);
|
|
335
|
+
const { projectName, method } = this.spec;
|
|
336
|
+
// TODO: inputs数据
|
|
337
|
+
const result = {
|
|
338
|
+
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)),
|
|
346
|
+
};
|
|
347
|
+
this.recordContext(item, { props: newInputs });
|
|
348
|
+
debug(`get props: ${JSON.stringify(result)}`);
|
|
349
|
+
return result;
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
doSrc(item, data = {}) {
|
|
353
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
const { method = '', projectName } = this.spec;
|
|
355
|
+
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);
|
|
359
|
+
// 服务级操作
|
|
360
|
+
if (projectName) {
|
|
361
|
+
if ((0, lodash_1.isFunction)(item.instance[method])) {
|
|
362
|
+
// 方法存在,执行报错,退出码101
|
|
363
|
+
try {
|
|
364
|
+
return yield item.instance[method](componentProps);
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
(0, utils_1.throw101Error)(error, `Project ${item.projectName} failed to execute:`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// 方法不存在,此时系统将会认为是未找到组件方法,系统的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')}`);
|
|
372
|
+
}
|
|
373
|
+
// 应用级操作
|
|
374
|
+
if ((0, lodash_1.isFunction)(item.instance[method])) {
|
|
375
|
+
// 方法存在,执行报错,退出码101
|
|
376
|
+
try {
|
|
377
|
+
return yield item.instance[method](componentProps);
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
(0, utils_1.throw101Error)(error, `Project ${item.projectName} failed to execute:`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// 方法不存在,进行警告,但是并不会报错,最终的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`);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
doSkip(item) {
|
|
388
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
389
|
+
// id 添加状态
|
|
390
|
+
if (item.id) {
|
|
391
|
+
this.record.steps = Object.assign(Object.assign({}, this.record.steps), { [item.id]: {
|
|
392
|
+
status: types_1.STEP_STATUS.SKIP,
|
|
393
|
+
} });
|
|
394
|
+
}
|
|
395
|
+
this.recordContext(item, { status: types_1.STEP_STATUS.SKIP, process_time: 0 });
|
|
396
|
+
return Promise.resolve();
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
exports.default = Engine;
|
|
401
|
+
//# sourceMappingURL=index.js.map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W,IAAI,CAAC,WAAW,qBAAqB,CAAC,CAAC;iBACjF;aACF;YACD,qCAAqC;YACrC,IAAA,kBAAU,EACR,QAAQ,MAAM,0BAA0B,EACxC,8BAA8B,IAAI,CAAC,SAAS,YAAY,MAAM,mHAAmH,CAClL,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
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IStep } from '@serverless-devs/parse-spec';
|
|
2
|
+
import { IOptions as ILogConfig } from '@serverless-devs/logger/lib/type';
|
|
3
|
+
import Logger from '@serverless-devs/logger';
|
|
4
|
+
export interface IEngineOptions {
|
|
5
|
+
args: string[];
|
|
6
|
+
yamlPath?: string;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
logConfig?: EngineLogger;
|
|
10
|
+
}
|
|
11
|
+
export type EngineLogger = Partial<ILogConfig> & {
|
|
12
|
+
customLogger?: Logger;
|
|
13
|
+
};
|
|
14
|
+
export type IStepOptions = IStep & {
|
|
15
|
+
instance?: any;
|
|
16
|
+
id?: string;
|
|
17
|
+
if?: string;
|
|
18
|
+
'continue-on-error'?: boolean;
|
|
19
|
+
'working-directory'?: string;
|
|
20
|
+
stepCount?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
error?: Error;
|
|
23
|
+
output?: Record<string, any>;
|
|
24
|
+
process_time?: number;
|
|
25
|
+
credential?: Record<string, any>;
|
|
26
|
+
done?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare enum STEP_IF {
|
|
29
|
+
SUCCESS = "success()",
|
|
30
|
+
FAILURE = "failure()",
|
|
31
|
+
ALWAYS = "always()"
|
|
32
|
+
}
|
|
33
|
+
export declare enum STEP_STATUS_BASE {
|
|
34
|
+
SUCCESS = "success",
|
|
35
|
+
FAILURE = "failure",
|
|
36
|
+
RUNNING = "running",
|
|
37
|
+
PENING = "pending",
|
|
38
|
+
ERROR_WITH_CONTINUE = "error-with-continue"
|
|
39
|
+
}
|
|
40
|
+
export type IStatus = `${STEP_STATUS_BASE}`;
|
|
41
|
+
declare enum STEP_STATUS_SKIP {
|
|
42
|
+
SKIP = "skipped"
|
|
43
|
+
}
|
|
44
|
+
export declare const STEP_STATUS: {
|
|
45
|
+
SKIP: STEP_STATUS_SKIP.SKIP;
|
|
46
|
+
SUCCESS: STEP_STATUS_BASE.SUCCESS;
|
|
47
|
+
FAILURE: STEP_STATUS_BASE.FAILURE;
|
|
48
|
+
RUNNING: STEP_STATUS_BASE.RUNNING;
|
|
49
|
+
PENING: STEP_STATUS_BASE.PENING;
|
|
50
|
+
ERROR_WITH_CONTINUE: STEP_STATUS_BASE.ERROR_WITH_CONTINUE;
|
|
51
|
+
};
|
|
52
|
+
export interface IRecord {
|
|
53
|
+
editStatusAble: boolean;
|
|
54
|
+
steps: Record<string, any>;
|
|
55
|
+
status: IStatus;
|
|
56
|
+
startTime: number;
|
|
57
|
+
}
|
|
58
|
+
export interface IContext {
|
|
59
|
+
cwd: string;
|
|
60
|
+
stepCount: string;
|
|
61
|
+
steps: IStepOptions[];
|
|
62
|
+
env: Record<string, any>;
|
|
63
|
+
status: IStatus;
|
|
64
|
+
completed: boolean;
|
|
65
|
+
inputs: Record<string, any>;
|
|
66
|
+
error: Error;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STEP_STATUS = exports.STEP_STATUS_BASE = exports.STEP_IF = void 0;
|
|
4
|
+
var STEP_IF;
|
|
5
|
+
(function (STEP_IF) {
|
|
6
|
+
STEP_IF["SUCCESS"] = "success()";
|
|
7
|
+
STEP_IF["FAILURE"] = "failure()";
|
|
8
|
+
STEP_IF["ALWAYS"] = "always()";
|
|
9
|
+
})(STEP_IF = exports.STEP_IF || (exports.STEP_IF = {}));
|
|
10
|
+
var STEP_STATUS_BASE;
|
|
11
|
+
(function (STEP_STATUS_BASE) {
|
|
12
|
+
STEP_STATUS_BASE["SUCCESS"] = "success";
|
|
13
|
+
STEP_STATUS_BASE["FAILURE"] = "failure";
|
|
14
|
+
STEP_STATUS_BASE["RUNNING"] = "running";
|
|
15
|
+
STEP_STATUS_BASE["PENING"] = "pending";
|
|
16
|
+
STEP_STATUS_BASE["ERROR_WITH_CONTINUE"] = "error-with-continue";
|
|
17
|
+
})(STEP_STATUS_BASE = exports.STEP_STATUS_BASE || (exports.STEP_STATUS_BASE = {}));
|
|
18
|
+
var STEP_STATUS_SKIP;
|
|
19
|
+
(function (STEP_STATUS_SKIP) {
|
|
20
|
+
STEP_STATUS_SKIP["SKIP"] = "skipped";
|
|
21
|
+
})(STEP_STATUS_SKIP || (STEP_STATUS_SKIP = {}));
|
|
22
|
+
exports.STEP_STATUS = Object.assign(Object.assign({}, STEP_STATUS_BASE), STEP_STATUS_SKIP);
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getLogPath(filePath: string): string;
|
|
2
|
+
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>>;
|
|
7
|
+
export declare const stringify: (value: any) => string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.stringify = exports.getCredential = exports.throwError = exports.throw100Error = exports.throw101Error = exports.getProcessTime = exports.getLogPath = void 0;
|
|
16
|
+
const credential_1 = __importDefault(require("@serverless-devs/credential"));
|
|
17
|
+
const flatted_1 = __importDefault(require("flatted"));
|
|
18
|
+
const lodash_1 = require("lodash");
|
|
19
|
+
function getLogPath(filePath) {
|
|
20
|
+
return `step_${filePath}.log`;
|
|
21
|
+
}
|
|
22
|
+
exports.getLogPath = getLogPath;
|
|
23
|
+
function getProcessTime(time) {
|
|
24
|
+
return (Math.round((Date.now() - time) / 10) * 10) / 1000;
|
|
25
|
+
}
|
|
26
|
+
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) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
try {
|
|
60
|
+
const instance = new credential_1.default();
|
|
61
|
+
const res = yield instance.get(access);
|
|
62
|
+
return (0, lodash_1.get)(res, 'credential', {});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.getCredential = getCredential;
|
|
70
|
+
const stringify = (value) => {
|
|
71
|
+
try {
|
|
72
|
+
const data = Object.assign({}, value);
|
|
73
|
+
const steps = (0, lodash_1.get)(value, 'steps');
|
|
74
|
+
if (steps) {
|
|
75
|
+
(0, lodash_1.set)(data, 'steps', (0, lodash_1.map)(steps, (step) => (0, lodash_1.omit)(step, 'instance')));
|
|
76
|
+
}
|
|
77
|
+
const instance = (0, lodash_1.get)(data, 'instance');
|
|
78
|
+
if (instance) {
|
|
79
|
+
delete data.instance;
|
|
80
|
+
}
|
|
81
|
+
return JSON.stringify(data);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return flatted_1.default.stringify(value);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.stringify = stringify;
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,CAA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C,CAAC;YACvC,OAAO,IAAA,YAAG,EAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CAAA;AARD,sCAQC;AAEM,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,EAAE;IACtC,IAAI;QACF,MAAM,IAAI,qBAAQ,KAAK,CAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAA,YAAG,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,KAAK,EAAE;YACT,IAAA,YAAG,EACD,IAAI,EACJ,OAAO,EACP,IAAA,YAAG,EAAC,KAAK,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAA,aAAI,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAClD,CAAC;SACH;QACD,MAAM,QAAQ,GAAG,IAAA,YAAG,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACvC,IAAI,QAAQ,EAAE;YACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC7B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,iBAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACjC;AACH,CAAC,CAAC;AAnBW,QAAA,SAAS,aAmBpB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@serverless-devs/engine",
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"description": "request for serverless-devs",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"author": "xsahxl",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"registry": "https://registry.npmjs.org",
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@serverless-cd/debug": "^4.3.4",
|
|
14
|
+
"chalk": "4.x",
|
|
15
|
+
"execa": "^5.1.1",
|
|
16
|
+
"flatted": "^3.2.7",
|
|
17
|
+
"fs-extra": "^11.1.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"string-argv": "^0.3.2",
|
|
20
|
+
"xstate": "^4.37.2",
|
|
21
|
+
"@serverless-devs/logger": "^0.0.1",
|
|
22
|
+
"@serverless-devs/load-component": "^0.0.1-beta.1",
|
|
23
|
+
"@serverless-devs/credential": "^0.0.2",
|
|
24
|
+
"@serverless-devs/utils": "^0.0.7",
|
|
25
|
+
"@serverless-devs/parse-spec": "^0.0.1-beta.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/fs-extra": "^11.0.1",
|
|
29
|
+
"@types/lodash": "^4.14.195"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rimraf lib node_modules",
|
|
33
|
+
"build": "tsc"
|
|
34
|
+
}
|
|
35
|
+
}
|