evaengine 0.11.1 → 1.0.0
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/.ai/analysis.md +657 -0
- package/.ai/architecture/runtime.md +504 -0
- package/.ai/contracts/public-api.md +447 -0
- package/.ai/external-project-guide.md +248 -0
- package/.ai/vision.md +314 -0
- package/README.md +51 -62
- package/bin/engine +15 -21
- package/index.js +2 -18
- package/package.json +60 -64
- package/src/index.js +57 -0
- package/bin/engine-babel +0 -38
- package/lib/commands/index.js +0 -25
- package/lib/commands/index.js.map +0 -1
- package/lib/commands/interface.js +0 -51
- package/lib/commands/interface.js.map +0 -1
- package/lib/commands/make_entity.js +0 -549
- package/lib/commands/make_entity.js.map +0 -1
- package/lib/commands/tramp.js +0 -53
- package/lib/commands/tramp.js.map +0 -1
- package/lib/config/index.js +0 -98
- package/lib/config/index.js.map +0 -1
- package/lib/di.js +0 -99
- package/lib/di.js.map +0 -1
- package/lib/engine.js +0 -558
- package/lib/engine.js.map +0 -1
- package/lib/entities/index.js +0 -283
- package/lib/entities/index.js.map +0 -1
- package/lib/exceptions/index.js +0 -522
- package/lib/exceptions/index.js.map +0 -1
- package/lib/index.js +0 -105
- package/lib/index.js.map +0 -1
- package/lib/middlewares/auth.js +0 -97
- package/lib/middlewares/auth.js.map +0 -1
- package/lib/middlewares/auth_kong.js +0 -48
- package/lib/middlewares/auth_kong.js.map +0 -1
- package/lib/middlewares/debug.js +0 -68
- package/lib/middlewares/debug.js.map +0 -1
- package/lib/middlewares/index.js +0 -45
- package/lib/middlewares/index.js.map +0 -1
- package/lib/middlewares/providers.js +0 -102
- package/lib/middlewares/providers.js.map +0 -1
- package/lib/middlewares/session.js +0 -76
- package/lib/middlewares/session.js.map +0 -1
- package/lib/middlewares/trace.js +0 -241
- package/lib/middlewares/trace.js.map +0 -1
- package/lib/middlewares/validator.js +0 -71
- package/lib/middlewares/validator.js.map +0 -1
- package/lib/middlewares/view_cache.js +0 -160
- package/lib/middlewares/view_cache.js.map +0 -1
- package/lib/services/cache.js +0 -234
- package/lib/services/cache.js.map +0 -1
- package/lib/services/config.js +0 -140
- package/lib/services/config.js.map +0 -1
- package/lib/services/env.js +0 -40
- package/lib/services/env.js.map +0 -1
- package/lib/services/event_manager.js +0 -110
- package/lib/services/event_manager.js.map +0 -1
- package/lib/services/http_client.js +0 -178
- package/lib/services/http_client.js.map +0 -1
- package/lib/services/index.js +0 -70
- package/lib/services/index.js.map +0 -1
- package/lib/services/interface.js +0 -12
- package/lib/services/interface.js.map +0 -1
- package/lib/services/joi.js +0 -28
- package/lib/services/joi.js.map +0 -1
- package/lib/services/jwt_token.js +0 -120
- package/lib/services/jwt_token.js.map +0 -1
- package/lib/services/jwt_token_kong.js +0 -111
- package/lib/services/jwt_token_kong.js.map +0 -1
- package/lib/services/logger.js +0 -172
- package/lib/services/logger.js.map +0 -1
- package/lib/services/namespace.js +0 -188
- package/lib/services/namespace.js.map +0 -1
- package/lib/services/now.js +0 -69
- package/lib/services/now.js.map +0 -1
- package/lib/services/providers.js +0 -195
- package/lib/services/providers.js.map +0 -1
- package/lib/services/redis.js +0 -77
- package/lib/services/redis.js.map +0 -1
- package/lib/services/rest_client.js +0 -136
- package/lib/services/rest_client.js.map +0 -1
- package/lib/swagger/index.js +0 -684
- package/lib/swagger/index.js.map +0 -1
- package/lib/utils/api_scaffold.js +0 -253
- package/lib/utils/api_scaffold.js.map +0 -1
- package/lib/utils/case_converter.js +0 -48
- package/lib/utils/case_converter.js.map +0 -1
- package/lib/utils/crc32.js +0 -22
- package/lib/utils/crc32.js.map +0 -1
- package/lib/utils/datetime.js +0 -21
- package/lib/utils/datetime.js.map +0 -1
- package/lib/utils/host.js +0 -48
- package/lib/utils/host.js.map +0 -1
- package/lib/utils/index.js +0 -61
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/pagination.js +0 -269
- package/lib/utils/pagination.js.map +0 -1
- package/lib/utils/random.js +0 -33
- package/lib/utils/random.js.map +0 -1
- package/lib/utils/smart_query.js +0 -342
- package/lib/utils/smart_query.js.map +0 -1
- package/lib/utils/test.js +0 -62
- package/lib/utils/test.js.map +0 -1
- package/lib/utils/wrapper.js +0 -9
- package/lib/utils/wrapper.js.map +0 -1
package/lib/exceptions/index.js
DELETED
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DatabaseIOException = exports.RestServiceIOException = exports.HttpRequestIOException = exports.IOException = exports.RuntimeException = exports.ResourceConflictedException = exports.OperationUnsupportedException = exports.ResourceNotFoundException = exports.OperationNotPermittedException = exports.UnauthorizedException = exports.RestServiceLogicException = exports.HttpRequestLogicException = exports.ModelInvalidateException = exports.FormInvalidateException = exports.InvalidArgumentException = exports.LogicException = exports.StandardException = undefined;
|
|
7
|
-
|
|
8
|
-
var _appRootPath = require('app-root-path');
|
|
9
|
-
|
|
10
|
-
var _appRootPath2 = _interopRequireDefault(_appRootPath);
|
|
11
|
-
|
|
12
|
-
var _path = require('path');
|
|
13
|
-
|
|
14
|
-
var _path2 = _interopRequireDefault(_path);
|
|
15
|
-
|
|
16
|
-
var _util = require('util');
|
|
17
|
-
|
|
18
|
-
var _crc = require('../utils/crc32');
|
|
19
|
-
|
|
20
|
-
var _crc2 = _interopRequireDefault(_crc);
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function _extendableBuiltin(cls) {
|
|
25
|
-
function ExtendableBuiltin() {
|
|
26
|
-
var instance = Reflect.construct(cls, Array.from(arguments));
|
|
27
|
-
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
|
28
|
-
return instance;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
32
|
-
constructor: {
|
|
33
|
-
value: cls,
|
|
34
|
-
enumerable: false,
|
|
35
|
-
writable: true,
|
|
36
|
-
configurable: true
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (Object.setPrototypeOf) {
|
|
41
|
-
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
42
|
-
} else {
|
|
43
|
-
ExtendableBuiltin.__proto__ = cls;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return ExtendableBuiltin;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Make Error be able to work with JSON.stringify()
|
|
51
|
-
*/
|
|
52
|
-
if (!('toJSON' in Error.prototype)) {
|
|
53
|
-
Object.defineProperty(Error.prototype, 'toJSON', { //eslint-disable-line
|
|
54
|
-
value: function () {
|
|
55
|
-
//eslint-disable-line
|
|
56
|
-
const alt = {};
|
|
57
|
-
Object.getOwnPropertyNames(this).forEach(function (key) {
|
|
58
|
-
//eslint-disable-line
|
|
59
|
-
alt[key] = this[key];
|
|
60
|
-
}, this);
|
|
61
|
-
return alt;
|
|
62
|
-
},
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let i18nHandler = _util.format;
|
|
69
|
-
|
|
70
|
-
let factory = () => {};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Exception interface
|
|
74
|
-
* Support usages:
|
|
75
|
-
* throw new Exception();
|
|
76
|
-
* throw new Exception('Something');
|
|
77
|
-
* throw new Exception(new Error());
|
|
78
|
-
* throw new Exception(new Exception());
|
|
79
|
-
* throw (new Exception()).i18n('some %d', 123)
|
|
80
|
-
*/
|
|
81
|
-
let StandardException = exports.StandardException = class StandardException extends _extendableBuiltin(Error) {
|
|
82
|
-
/**
|
|
83
|
-
* Generate string hash by crc32
|
|
84
|
-
* @param {string} str
|
|
85
|
-
* @param {string} padstr
|
|
86
|
-
* @returns {string}
|
|
87
|
-
*/
|
|
88
|
-
static hash(str, padstr = '0000000000') {
|
|
89
|
-
const crcstr = (0, _crc2.default)(str).toString();
|
|
90
|
-
return padstr.substring(0, padstr.length - crcstr.length) + crcstr;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Hash an exception into an 18 bits code
|
|
95
|
-
* @param {string} className
|
|
96
|
-
* @param {string} fileName
|
|
97
|
-
* @returns {Number}
|
|
98
|
-
*/
|
|
99
|
-
static generateCode(className, fileName = __filename) {
|
|
100
|
-
const namespace = fileName.replace(_appRootPath2.default.path, '').split(_path2.default.sep).join('/');
|
|
101
|
-
const group = fileName === __filename ? '11111' : (0, _crc2.default)(namespace).toString().substring(0, 5);
|
|
102
|
-
return parseInt(`${group}000${StandardException.hash(className)}`, 10);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Remove useless info from error stack
|
|
107
|
-
* @param {string} stack
|
|
108
|
-
* @returns {Array}
|
|
109
|
-
*/
|
|
110
|
-
static stackBeautifier(stack) {
|
|
111
|
-
const lines = stack.split('\n');
|
|
112
|
-
const stackOut = [];
|
|
113
|
-
for (const line of lines) {
|
|
114
|
-
if (!line.match(/node_modules|\(node\.js|\(native/)) {
|
|
115
|
-
stackOut.push(line);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return stackOut;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
static setI18nHandler(handler) {
|
|
122
|
-
i18nHandler = handler;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Deserialize an exception from a JSON object
|
|
127
|
-
* @param {object} json
|
|
128
|
-
*/
|
|
129
|
-
static factory(json = {}) {
|
|
130
|
-
return factory(json);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Http status code
|
|
135
|
-
* @returns {number}
|
|
136
|
-
*/
|
|
137
|
-
get statusCode() {
|
|
138
|
-
return 500;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* If throw a StandardException, keep throw to above
|
|
143
|
-
* If throw a Error, set Error message to exception message, set Error to details
|
|
144
|
-
* If throw a String, set String to exception message
|
|
145
|
-
* If throw a null or undefined, set exception name as exception message
|
|
146
|
-
* Otherwise, throw a TypeError
|
|
147
|
-
*
|
|
148
|
-
* @param {StandardException|Error|String} exceptionOrMsg
|
|
149
|
-
*/
|
|
150
|
-
constructor(exceptionOrMsg) {
|
|
151
|
-
const throwingNothing = !exceptionOrMsg;
|
|
152
|
-
const throwingString = typeof exceptionOrMsg === 'string';
|
|
153
|
-
const throwingSelf = exceptionOrMsg instanceof StandardException;
|
|
154
|
-
const throwingError = exceptionOrMsg instanceof Error;
|
|
155
|
-
const throwingUnknown = throwingNothing + throwingString + throwingSelf + throwingError === 0;
|
|
156
|
-
|
|
157
|
-
if (throwingUnknown === true) {
|
|
158
|
-
throw new TypeError('Unexpected params for exception');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (throwingSelf === true) {
|
|
162
|
-
throw exceptionOrMsg;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
let message = 'Something wrong';
|
|
166
|
-
if (throwingString === true) {
|
|
167
|
-
message = exceptionOrMsg;
|
|
168
|
-
}
|
|
169
|
-
if (throwingError === true) {
|
|
170
|
-
({ message } = exceptionOrMsg);
|
|
171
|
-
}
|
|
172
|
-
super(message);
|
|
173
|
-
|
|
174
|
-
if (throwingNothing === true) {
|
|
175
|
-
message = this.constructor.name;
|
|
176
|
-
}
|
|
177
|
-
this.message = message;
|
|
178
|
-
this.humanMessage = message;
|
|
179
|
-
this.throwingError = throwingError;
|
|
180
|
-
|
|
181
|
-
Error.captureStackTrace(this, this.constructor);
|
|
182
|
-
this.details = throwingError ? exceptionOrMsg : [];
|
|
183
|
-
this.prevError = {};
|
|
184
|
-
this.code = null;
|
|
185
|
-
this.filename = __filename;
|
|
186
|
-
this.translated = false;
|
|
187
|
-
this.importance = 0;
|
|
188
|
-
if (throwingError === true) {
|
|
189
|
-
this.setPrevError(exceptionOrMsg);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
i18n(...args) {
|
|
194
|
-
this.message = (0, _util.format)(...args);
|
|
195
|
-
this.humanMessage = i18nHandler(...args);
|
|
196
|
-
if (this.message !== this.humanMessage) {
|
|
197
|
-
this.translated = true;
|
|
198
|
-
}
|
|
199
|
-
return this;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
getHumanMessage() {
|
|
203
|
-
if (this.translated) {
|
|
204
|
-
return this.humanMessage;
|
|
205
|
-
}
|
|
206
|
-
let message = i18nHandler(this.message);
|
|
207
|
-
if (message !== this.message) {
|
|
208
|
-
this.humanMessage = message;
|
|
209
|
-
this.translated = true;
|
|
210
|
-
return this.humanMessage;
|
|
211
|
-
}
|
|
212
|
-
message = i18nHandler(this.constructor.name);
|
|
213
|
-
if (message !== this.constructor.name) {
|
|
214
|
-
this.humanMessage = message;
|
|
215
|
-
this.translated = true;
|
|
216
|
-
return this.humanMessage;
|
|
217
|
-
}
|
|
218
|
-
return this.message;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
setMessage(message) {
|
|
222
|
-
this.message = message;
|
|
223
|
-
return this;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
setCode(code) {
|
|
227
|
-
this.code = parseInt(code, 10);
|
|
228
|
-
return this;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
getCode() {
|
|
232
|
-
if (this.code) {
|
|
233
|
-
return this.code;
|
|
234
|
-
}
|
|
235
|
-
this.code = StandardException.generateCode(this.constructor.name, this.filename) || -1;
|
|
236
|
-
return this.code;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
getStatusCode() {
|
|
240
|
-
return this.statusCode;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
setImportance(importance) {
|
|
244
|
-
this.importance = parseInt(importance, 10);
|
|
245
|
-
return this;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
getImportance() {
|
|
249
|
-
return this.importance;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
setFileName(filename) {
|
|
253
|
-
this.filename = filename;
|
|
254
|
-
return this;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
getFileName() {
|
|
258
|
-
return this.filename;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
setDetails(details) {
|
|
262
|
-
this.details = details;
|
|
263
|
-
return this;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
getDetails() {
|
|
267
|
-
return Array.isArray(this.details) ? this.details : [this.details];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
setPrevError(prevError) {
|
|
271
|
-
this.prevError = prevError;
|
|
272
|
-
return this;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
getPrevError() {
|
|
276
|
-
return this.prevError;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
toJSON() {
|
|
280
|
-
return {
|
|
281
|
-
statusCode: this.statusCode,
|
|
282
|
-
code: this.getCode(),
|
|
283
|
-
name: this.constructor.name,
|
|
284
|
-
message: this.message,
|
|
285
|
-
humanMessage: this.getHumanMessage(),
|
|
286
|
-
filename: this.getFileName(),
|
|
287
|
-
prevError: this.getPrevError(),
|
|
288
|
-
errors: Array.isArray(this.getDetails()) ? this.getDetails() : [this.getDetails()],
|
|
289
|
-
stack: StandardException.stackBeautifier(this.stack),
|
|
290
|
-
fullStack: this.stack.split('\n')
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
let LogicException = exports.LogicException = class LogicException extends StandardException {
|
|
295
|
-
get statusCode() {
|
|
296
|
-
return 400;
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
let InvalidArgumentException = exports.InvalidArgumentException = class InvalidArgumentException extends LogicException {};
|
|
300
|
-
let FormInvalidateException = exports.FormInvalidateException = class FormInvalidateException extends InvalidArgumentException {
|
|
301
|
-
constructor(exceptionOrMsg) {
|
|
302
|
-
super(exceptionOrMsg);
|
|
303
|
-
if (this.throwingError && exceptionOrMsg.isJoi === true) {
|
|
304
|
-
this.message = exceptionOrMsg.details[0].message;
|
|
305
|
-
this.details = exceptionOrMsg.details;
|
|
306
|
-
|
|
307
|
-
this.i18n(this.message);
|
|
308
|
-
this.translated = true;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
let ModelInvalidateException = exports.ModelInvalidateException = class ModelInvalidateException extends InvalidArgumentException {
|
|
313
|
-
constructor(exceptionOrMsg) {
|
|
314
|
-
super(exceptionOrMsg);
|
|
315
|
-
if (this.throwingError) {
|
|
316
|
-
this.details = exceptionOrMsg.errors;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
let HttpRequestLogicException = exports.HttpRequestLogicException = class HttpRequestLogicException extends InvalidArgumentException {
|
|
321
|
-
/**
|
|
322
|
-
* Support request promise error
|
|
323
|
-
* https://github.com/request/promise-core/blob/master/lib/errors.js
|
|
324
|
-
* @param exceptionOrMsg
|
|
325
|
-
*/
|
|
326
|
-
constructor(exceptionOrMsg) {
|
|
327
|
-
super(exceptionOrMsg);
|
|
328
|
-
if (this.throwingError && ['StatusCodeError', 'RequestError', 'TransformError'].includes(exceptionOrMsg.name)) {
|
|
329
|
-
this.details = exceptionOrMsg;
|
|
330
|
-
const { response } = exceptionOrMsg;
|
|
331
|
-
this.response = response || null;
|
|
332
|
-
this.request = response ? response.request : null;
|
|
333
|
-
}
|
|
334
|
-
this.requestParams = null;
|
|
335
|
-
this.responseParams = null;
|
|
336
|
-
this.businessCode = null;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
setResponse(response) {
|
|
340
|
-
this.response = response || null;
|
|
341
|
-
this.request = response ? response.request : null;
|
|
342
|
-
return this;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
getRequest() {
|
|
346
|
-
if (!this.request) {
|
|
347
|
-
throw new Error('No request set into exception');
|
|
348
|
-
}
|
|
349
|
-
return this.request;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
getResponse() {
|
|
353
|
-
if (!this.response) {
|
|
354
|
-
throw new Error('No response set into exception');
|
|
355
|
-
}
|
|
356
|
-
return this.response;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
setRequestParams(params) {
|
|
360
|
-
this.requestParams = params;
|
|
361
|
-
return this;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
getRequestParams() {
|
|
365
|
-
return this.requestParams;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
setResponseParams(params) {
|
|
369
|
-
this.responseParams = params;
|
|
370
|
-
return this;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
getResponseParams() {
|
|
374
|
-
return this.responseParams;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
setBusinessCode(code) {
|
|
378
|
-
this.businessCode = code;
|
|
379
|
-
return this;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
getBusinessCode() {
|
|
383
|
-
return this.businessCode;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
let RestServiceLogicException = exports.RestServiceLogicException = class RestServiceLogicException extends HttpRequestLogicException {
|
|
387
|
-
constructor(exceptionOrMsg) {
|
|
388
|
-
super(exceptionOrMsg);
|
|
389
|
-
if (this.throwingError && this.response && this.response.body) {
|
|
390
|
-
this.prevError = factory(this.response.body);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
let UnauthorizedException = exports.UnauthorizedException = class UnauthorizedException extends LogicException {
|
|
395
|
-
get statusCode() {
|
|
396
|
-
return 401;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
let OperationNotPermittedException = exports.OperationNotPermittedException = class OperationNotPermittedException extends LogicException {
|
|
400
|
-
get statusCode() {
|
|
401
|
-
return 403;
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
let ResourceNotFoundException = exports.ResourceNotFoundException = class ResourceNotFoundException extends LogicException {
|
|
405
|
-
get statusCode() {
|
|
406
|
-
return 404;
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
let OperationUnsupportedException = exports.OperationUnsupportedException = class OperationUnsupportedException extends LogicException {
|
|
410
|
-
get statusCode() {
|
|
411
|
-
return 405;
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
let ResourceConflictedException = exports.ResourceConflictedException = class ResourceConflictedException extends LogicException {
|
|
415
|
-
get statusCode() {
|
|
416
|
-
return 409;
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
let RuntimeException = exports.RuntimeException = class RuntimeException extends StandardException {};
|
|
420
|
-
let IOException = exports.IOException = class IOException extends RuntimeException {};
|
|
421
|
-
let HttpRequestIOException = exports.HttpRequestIOException = class HttpRequestIOException extends IOException {
|
|
422
|
-
constructor(exceptionOrMsg) {
|
|
423
|
-
super(exceptionOrMsg);
|
|
424
|
-
if (this.throwingError && ['StatusCodeError', 'RequestError', 'TransformError'].includes(exceptionOrMsg.name)) {
|
|
425
|
-
this.details = exceptionOrMsg;
|
|
426
|
-
const { response } = exceptionOrMsg;
|
|
427
|
-
this.response = response || null;
|
|
428
|
-
this.request = response ? response.request : null;
|
|
429
|
-
}
|
|
430
|
-
this.requestParams = null;
|
|
431
|
-
this.responseParams = null;
|
|
432
|
-
this.businessCode = null;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
getRequest() {
|
|
436
|
-
return this.request;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
getResponse() {
|
|
440
|
-
return this.response;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
setRequestParams(params) {
|
|
444
|
-
this.requestParams = params;
|
|
445
|
-
return this;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
getRequestParams() {
|
|
449
|
-
return this.requestParams;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
setResponseParams(params) {
|
|
453
|
-
this.responseParams = params;
|
|
454
|
-
return this;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
getResponseParams() {
|
|
458
|
-
return this.responseParams;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
setBusinessCode(code) {
|
|
462
|
-
this.businessCode = code;
|
|
463
|
-
return this;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
getBusinessCode() {
|
|
467
|
-
return this.businessCode;
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
let RestServiceIOException = exports.RestServiceIOException = class RestServiceIOException extends HttpRequestIOException {
|
|
471
|
-
constructor(exceptionOrMsg) {
|
|
472
|
-
super(exceptionOrMsg);
|
|
473
|
-
if (this.throwingError && this.response && this.response.body) {
|
|
474
|
-
this.prevError = factory(this.response.body);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
let DatabaseIOException = exports.DatabaseIOException = class DatabaseIOException extends IOException {};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
const exceptions = {
|
|
482
|
-
StandardException,
|
|
483
|
-
LogicException,
|
|
484
|
-
InvalidArgumentException,
|
|
485
|
-
FormInvalidateException,
|
|
486
|
-
ModelInvalidateException,
|
|
487
|
-
HttpRequestLogicException,
|
|
488
|
-
RestServiceLogicException,
|
|
489
|
-
UnauthorizedException,
|
|
490
|
-
OperationUnsupportedException,
|
|
491
|
-
OperationNotPermittedException,
|
|
492
|
-
ResourceNotFoundException,
|
|
493
|
-
ResourceConflictedException,
|
|
494
|
-
RuntimeException,
|
|
495
|
-
IOException,
|
|
496
|
-
HttpRequestIOException,
|
|
497
|
-
RestServiceIOException,
|
|
498
|
-
DatabaseIOException
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
factory = json => {
|
|
502
|
-
const {
|
|
503
|
-
code, name, statusCode, message, prevError, errors, fullStack = []
|
|
504
|
-
} = json;
|
|
505
|
-
if (!code || !name || !statusCode || !message) {
|
|
506
|
-
return {};
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
let e = null;
|
|
510
|
-
if (Object.keys(exceptions).includes(name)) {
|
|
511
|
-
e = new exceptions[name](); //eslint-disable-line
|
|
512
|
-
} else if (statusCode < 500) {
|
|
513
|
-
e = new LogicException(message);
|
|
514
|
-
} else {
|
|
515
|
-
e = new RuntimeException(message);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
e.setCode(code).setDetails(errors).setPrevError(prevError);
|
|
519
|
-
e.stack = fullStack.join('\n');
|
|
520
|
-
return e;
|
|
521
|
-
};
|
|
522
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/index.js"],"names":["Error","prototype","Object","defineProperty","value","alt","getOwnPropertyNames","forEach","key","configurable","writable","i18nHandler","format","factory","StandardException","hash","str","padstr","crcstr","toString","substring","length","generateCode","className","fileName","__filename","namespace","replace","appRoot","path","split","sep","join","group","parseInt","stackBeautifier","stack","lines","stackOut","line","match","push","setI18nHandler","handler","json","statusCode","constructor","exceptionOrMsg","throwingNothing","throwingString","throwingSelf","throwingError","throwingUnknown","TypeError","message","name","humanMessage","captureStackTrace","details","prevError","code","filename","translated","importance","setPrevError","i18n","args","getHumanMessage","setMessage","setCode","getCode","getStatusCode","setImportance","getImportance","setFileName","getFileName","setDetails","getDetails","Array","isArray","getPrevError","toJSON","errors","fullStack","LogicException","InvalidArgumentException","FormInvalidateException","isJoi","ModelInvalidateException","HttpRequestLogicException","includes","response","request","requestParams","responseParams","businessCode","setResponse","getRequest","getResponse","setRequestParams","params","getRequestParams","setResponseParams","getResponseParams","setBusinessCode","getBusinessCode","RestServiceLogicException","body","UnauthorizedException","OperationNotPermittedException","ResourceNotFoundException","OperationUnsupportedException","ResourceConflictedException","RuntimeException","IOException","HttpRequestIOException","RestServiceIOException","DatabaseIOException","exceptions","e","keys"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAF,GAAU+C,UAAUnD,IAAV,CAAe,IAAf,CAAV;AACA,SAAOuF,CAAP;AACD,CAtBD","file":"index.js","sourcesContent":["import appRoot from 'app-root-path';\nimport path from 'path';\nimport { format } from 'util';\nimport crc32 from '../utils/crc32';\n\n\n/**\n * Make Error be able to work with JSON.stringify()\n */\nif (!('toJSON' in Error.prototype)) {\n Object.defineProperty(Error.prototype, 'toJSON', { //eslint-disable-line\n value: function () { //eslint-disable-line\n const alt = {};\n Object.getOwnPropertyNames(this).forEach(function (key) { //eslint-disable-line\n alt[key] = this[key];\n }, this);\n return alt;\n },\n configurable: true,\n writable: true\n });\n}\n\n\nlet i18nHandler = format;\n\nlet factory = () => {\n};\n\n/**\n * Exception interface\n * Support usages:\n * throw new Exception();\n * throw new Exception('Something');\n * throw new Exception(new Error());\n * throw new Exception(new Exception());\n * throw (new Exception()).i18n('some %d', 123)\n */\nexport class StandardException extends Error {\n /**\n * Generate string hash by crc32\n * @param {string} str\n * @param {string} padstr\n * @returns {string}\n */\n static hash(str, padstr = '0000000000') {\n const crcstr = crc32(str).toString();\n return padstr.substring(0, padstr.length - crcstr.length) + crcstr;\n }\n\n /**\n * Hash an exception into an 18 bits code\n * @param {string} className\n * @param {string} fileName\n * @returns {Number}\n */\n static generateCode(className, fileName = __filename) {\n const namespace = fileName.replace(appRoot.path, '').split(path.sep).join('/');\n const group = fileName === __filename ? '11111' : crc32(namespace).toString().substring(0, 5);\n return parseInt(`${group}000${StandardException.hash(className)}`, 10);\n }\n\n /**\n * Remove useless info from error stack\n * @param {string} stack\n * @returns {Array}\n */\n static stackBeautifier(stack) {\n const lines = stack.split('\\n');\n const stackOut = [];\n for (const line of lines) {\n if (!line.match(/node_modules|\\(node\\.js|\\(native/)) {\n stackOut.push(line);\n }\n }\n return stackOut;\n }\n\n static setI18nHandler(handler) {\n i18nHandler = handler;\n }\n\n /**\n * Deserialize an exception from a JSON object\n * @param {object} json\n */\n static factory(json = {}) {\n return factory(json);\n }\n\n /**\n * Http status code\n * @returns {number}\n */\n get statusCode() {\n return 500;\n }\n\n /**\n * If throw a StandardException, keep throw to above\n * If throw a Error, set Error message to exception message, set Error to details\n * If throw a String, set String to exception message\n * If throw a null or undefined, set exception name as exception message\n * Otherwise, throw a TypeError\n *\n * @param {StandardException|Error|String} exceptionOrMsg\n */\n constructor(exceptionOrMsg) {\n const throwingNothing = !exceptionOrMsg;\n const throwingString = typeof exceptionOrMsg === 'string';\n const throwingSelf = exceptionOrMsg instanceof StandardException;\n const throwingError = exceptionOrMsg instanceof Error;\n const throwingUnknown = throwingNothing + throwingString + throwingSelf + throwingError === 0;\n\n if (throwingUnknown === true) {\n throw new TypeError('Unexpected params for exception');\n }\n\n if (throwingSelf === true) {\n throw exceptionOrMsg;\n }\n\n let message = 'Something wrong';\n if (throwingString === true) {\n message = exceptionOrMsg;\n }\n if (throwingError === true) {\n ({ message } = exceptionOrMsg);\n }\n super(message);\n\n if (throwingNothing === true) {\n message = this.constructor.name;\n }\n this.message = message;\n this.humanMessage = message;\n this.throwingError = throwingError;\n\n Error.captureStackTrace(this, this.constructor);\n this.details = throwingError ? exceptionOrMsg : [];\n this.prevError = {};\n this.code = null;\n this.filename = __filename;\n this.translated = false;\n this.importance = 0;\n if (throwingError === true) {\n this.setPrevError(exceptionOrMsg);\n }\n }\n\n i18n(...args) {\n this.message = format(...args);\n this.humanMessage = i18nHandler(...args);\n if (this.message !== this.humanMessage) {\n this.translated = true;\n }\n return this;\n }\n\n getHumanMessage() {\n if (this.translated) {\n return this.humanMessage;\n }\n let message = i18nHandler(this.message);\n if (message !== this.message) {\n this.humanMessage = message;\n this.translated = true;\n return this.humanMessage;\n }\n message = i18nHandler(this.constructor.name);\n if (message !== this.constructor.name) {\n this.humanMessage = message;\n this.translated = true;\n return this.humanMessage;\n }\n return this.message;\n }\n\n setMessage(message) {\n this.message = message;\n return this;\n }\n\n setCode(code) {\n this.code = parseInt(code, 10);\n return this;\n }\n\n getCode() {\n if (this.code) {\n return this.code;\n }\n this.code = StandardException.generateCode(this.constructor.name, this.filename) || -1;\n return this.code;\n }\n\n getStatusCode() {\n return this.statusCode;\n }\n\n setImportance(importance) {\n this.importance = parseInt(importance, 10);\n return this;\n }\n\n getImportance() {\n return this.importance;\n }\n\n setFileName(filename) {\n this.filename = filename;\n return this;\n }\n\n getFileName() {\n return this.filename;\n }\n\n setDetails(details) {\n this.details = details;\n return this;\n }\n\n getDetails() {\n return Array.isArray(this.details) ? this.details : [this.details];\n }\n\n setPrevError(prevError) {\n this.prevError = prevError;\n return this;\n }\n\n getPrevError() {\n return this.prevError;\n }\n\n toJSON() {\n return {\n statusCode: this.statusCode,\n code: this.getCode(),\n name: this.constructor.name,\n message: this.message,\n humanMessage: this.getHumanMessage(),\n filename: this.getFileName(),\n prevError: this.getPrevError(),\n errors: Array.isArray(this.getDetails()) ?\n this.getDetails() : [this.getDetails()],\n stack: StandardException.stackBeautifier(this.stack),\n fullStack: this.stack.split('\\n')\n };\n }\n}\n\nexport class LogicException extends StandardException {\n get statusCode() {\n return 400;\n }\n}\n\nexport class InvalidArgumentException extends LogicException {\n}\n\nexport class FormInvalidateException extends InvalidArgumentException {\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError && exceptionOrMsg.isJoi === true) {\n this.message = exceptionOrMsg.details[0].message;\n this.details = exceptionOrMsg.details;\n\n this.i18n(this.message);\n this.translated = true;\n }\n }\n}\n\nexport class ModelInvalidateException extends InvalidArgumentException {\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError) {\n this.details = exceptionOrMsg.errors;\n }\n }\n}\n\nexport class HttpRequestLogicException extends InvalidArgumentException {\n /**\n * Support request promise error\n * https://github.com/request/promise-core/blob/master/lib/errors.js\n * @param exceptionOrMsg\n */\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError && ['StatusCodeError', 'RequestError', 'TransformError'].includes(exceptionOrMsg.name)) {\n this.details = exceptionOrMsg;\n const { response } = exceptionOrMsg;\n this.response = response || null;\n this.request = response ? response.request : null;\n }\n this.requestParams = null;\n this.responseParams = null;\n this.businessCode = null;\n }\n\n setResponse(response) {\n this.response = response || null;\n this.request = response ? response.request : null;\n return this;\n }\n\n getRequest() {\n if (!this.request) {\n throw new Error('No request set into exception');\n }\n return this.request;\n }\n\n getResponse() {\n if (!this.response) {\n throw new Error('No response set into exception');\n }\n return this.response;\n }\n\n setRequestParams(params) {\n this.requestParams = params;\n return this;\n }\n\n getRequestParams() {\n return this.requestParams;\n }\n\n setResponseParams(params) {\n this.responseParams = params;\n return this;\n }\n\n getResponseParams() {\n return this.responseParams;\n }\n\n setBusinessCode(code) {\n this.businessCode = code;\n return this;\n }\n\n getBusinessCode() {\n return this.businessCode;\n }\n}\n\nexport class RestServiceLogicException extends HttpRequestLogicException {\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError && this.response && this.response.body) {\n this.prevError = factory(this.response.body);\n }\n }\n}\n\nexport class UnauthorizedException extends LogicException {\n get statusCode() {\n return 401;\n }\n}\n\nexport class OperationNotPermittedException extends LogicException {\n get statusCode() {\n return 403;\n }\n}\n\nexport class ResourceNotFoundException extends LogicException {\n get statusCode() {\n return 404;\n }\n}\n\nexport class OperationUnsupportedException extends LogicException {\n get statusCode() {\n return 405;\n }\n}\n\nexport class ResourceConflictedException extends LogicException {\n get statusCode() {\n return 409;\n }\n}\n\nexport class RuntimeException extends StandardException {\n}\n\nexport class IOException extends RuntimeException {\n}\n\nexport class HttpRequestIOException extends IOException {\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError && ['StatusCodeError', 'RequestError', 'TransformError'].includes(exceptionOrMsg.name)) {\n this.details = exceptionOrMsg;\n const { response } = exceptionOrMsg;\n this.response = response || null;\n this.request = response ? response.request : null;\n }\n this.requestParams = null;\n this.responseParams = null;\n this.businessCode = null;\n }\n\n getRequest() {\n return this.request;\n }\n\n getResponse() {\n return this.response;\n }\n\n setRequestParams(params) {\n this.requestParams = params;\n return this;\n }\n\n getRequestParams() {\n return this.requestParams;\n }\n\n setResponseParams(params) {\n this.responseParams = params;\n return this;\n }\n\n getResponseParams() {\n return this.responseParams;\n }\n\n setBusinessCode(code) {\n this.businessCode = code;\n return this;\n }\n\n getBusinessCode() {\n return this.businessCode;\n }\n}\n\nexport class RestServiceIOException extends HttpRequestIOException {\n constructor(exceptionOrMsg) {\n super(exceptionOrMsg);\n if (this.throwingError && this.response && this.response.body) {\n this.prevError = factory(this.response.body);\n }\n }\n}\n\nexport class DatabaseIOException extends IOException {\n}\n\nconst exceptions = {\n StandardException,\n LogicException,\n InvalidArgumentException,\n FormInvalidateException,\n ModelInvalidateException,\n HttpRequestLogicException,\n RestServiceLogicException,\n UnauthorizedException,\n OperationUnsupportedException,\n OperationNotPermittedException,\n ResourceNotFoundException,\n ResourceConflictedException,\n RuntimeException,\n IOException,\n HttpRequestIOException,\n RestServiceIOException,\n DatabaseIOException\n};\n\nfactory = (json) => {\n const {\n code, name, statusCode, message, prevError, errors, fullStack = []\n } = json;\n if (!code || !name || !statusCode || !message) {\n return {};\n }\n\n let e = null;\n if (Object.keys(exceptions).includes(name)) {\n e = new exceptions[name]; //eslint-disable-line\n } else if (statusCode < 500) {\n e = new LogicException(message);\n } else {\n e = new RuntimeException(message);\n }\n\n e.setCode(code)\n .setDetails(errors)\n .setPrevError(prevError);\n e.stack = fullStack.join('\\n');\n return e;\n};\n"]}
|
package/lib/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _constitute = require('constitute');
|
|
4
|
-
|
|
5
|
-
var _constitute2 = _interopRequireDefault(_constitute);
|
|
6
|
-
|
|
7
|
-
var _mysql = require('mysql');
|
|
8
|
-
|
|
9
|
-
var _mysql2 = _interopRequireDefault(_mysql);
|
|
10
|
-
|
|
11
|
-
var _sequelize = require('sequelize');
|
|
12
|
-
|
|
13
|
-
var _sequelize2 = _interopRequireDefault(_sequelize);
|
|
14
|
-
|
|
15
|
-
var _joi = require('joi');
|
|
16
|
-
|
|
17
|
-
var _joi2 = _interopRequireDefault(_joi);
|
|
18
|
-
|
|
19
|
-
var _engine = require('./engine');
|
|
20
|
-
|
|
21
|
-
var engine = _interopRequireWildcard(_engine);
|
|
22
|
-
|
|
23
|
-
var _swagger = require('./swagger');
|
|
24
|
-
|
|
25
|
-
var swagger = _interopRequireWildcard(_swagger);
|
|
26
|
-
|
|
27
|
-
var _exceptions = require('./exceptions');
|
|
28
|
-
|
|
29
|
-
var exceptions = _interopRequireWildcard(_exceptions);
|
|
30
|
-
|
|
31
|
-
var _services = require('./services');
|
|
32
|
-
|
|
33
|
-
var services = _interopRequireWildcard(_services);
|
|
34
|
-
|
|
35
|
-
var _middlewares = require('./middlewares');
|
|
36
|
-
|
|
37
|
-
var middlewares = _interopRequireWildcard(_middlewares);
|
|
38
|
-
|
|
39
|
-
var _providers = require('./services/providers');
|
|
40
|
-
|
|
41
|
-
var ServiceProviders = _interopRequireWildcard(_providers);
|
|
42
|
-
|
|
43
|
-
var _providers2 = require('./middlewares/providers');
|
|
44
|
-
|
|
45
|
-
var MiddlewareProviders = _interopRequireWildcard(_providers2);
|
|
46
|
-
|
|
47
|
-
var _utils = require('./utils');
|
|
48
|
-
|
|
49
|
-
var utils = _interopRequireWildcard(_utils);
|
|
50
|
-
|
|
51
|
-
var _commands = require('./commands');
|
|
52
|
-
|
|
53
|
-
var commands = _interopRequireWildcard(_commands);
|
|
54
|
-
|
|
55
|
-
var _entities = require('./entities');
|
|
56
|
-
|
|
57
|
-
var _entities2 = _interopRequireDefault(_entities);
|
|
58
|
-
|
|
59
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
60
|
-
|
|
61
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
|
-
|
|
63
|
-
const providers = {
|
|
64
|
-
services: ServiceProviders,
|
|
65
|
-
middlewares: MiddlewareProviders
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const { wrapper } = utils;
|
|
69
|
-
|
|
70
|
-
const {
|
|
71
|
-
DI,
|
|
72
|
-
express
|
|
73
|
-
} = engine;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @typedef {Object} engineCore
|
|
77
|
-
*/
|
|
78
|
-
const core = {
|
|
79
|
-
EvaEngine: engine.default,
|
|
80
|
-
Command: commands.default,
|
|
81
|
-
DI,
|
|
82
|
-
Entities: _entities2.default,
|
|
83
|
-
engine,
|
|
84
|
-
express,
|
|
85
|
-
commands,
|
|
86
|
-
dependencies: {
|
|
87
|
-
Joi: _joi2.default,
|
|
88
|
-
constitute: _constitute2.default,
|
|
89
|
-
sequelize: _sequelize2.default,
|
|
90
|
-
mysql: _mysql2.default
|
|
91
|
-
},
|
|
92
|
-
exceptions,
|
|
93
|
-
middlewares,
|
|
94
|
-
sequelize: _sequelize2.default,
|
|
95
|
-
Joi: _joi2.default,
|
|
96
|
-
swagger,
|
|
97
|
-
services,
|
|
98
|
-
providers,
|
|
99
|
-
wrapper,
|
|
100
|
-
utils
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
module.exports = core;
|
|
104
|
-
exports = module.exports; //eslint-disable-line
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["engine","swagger","exceptions","services","middlewares","ServiceProviders","MiddlewareProviders","utils","commands","providers","wrapper","DI","express","core","EvaEngine","Command","Entities","dependencies","Joi","constitute","sequelize","mysql","module","exports"],"mappings":";;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;IAAuBA,M;;AACvB;;IAAYC,O;;AACZ;;IAAYC,U;;AACZ;;IAAYC,Q;;AACZ;;IAAYC,W;;AACZ;;IAAYC,gB;;AACZ;;IAAYC,mB;;AACZ;;IAAYC,K;;AACZ;;IAAqBC,Q;;AACrB;;;;;;;;AAEA,MAAMC,YAAY;AAChBN,YAAUE,gBADM;AAEhBD,eAAaE;AAFG,CAAlB;;AAKA,MAAM,EAAEI,OAAF,KAAcH,KAApB;;AAEA,MAAM;AACJI,IADI;AAEJC;AAFI,IAGFZ,MAHJ;;AAKA;;;AAGA,MAAMa,OAAO;AACXC,2BADW;AAEXC,2BAFW;AAGXJ,IAHW;AAIXK,8BAJW;AAKXhB,QALW;AAMXY,SANW;AAOXJ,UAPW;AAQXS,gBAAc;AACZC,sBADY;AAEZC,oCAFY;AAGZC,kCAHY;AAIZC;AAJY,GARH;AAcXnB,YAdW;AAeXE,aAfW;AAgBXgB,gCAhBW;AAiBXF,oBAjBW;AAkBXjB,SAlBW;AAmBXE,UAnBW;AAoBXM,WApBW;AAqBXC,SArBW;AAsBXH;AAtBW,CAAb;;AAyBAe,OAAOC,OAAP,GAAiBV,IAAjB;AACAU,UAAUD,OAAOC,OAAjB,C,CAA0B","file":"index.js","sourcesContent":["import constitute from 'constitute';\nimport mysql from 'mysql';\nimport sequelize from 'sequelize';\nimport Joi from 'joi';\nimport EvaEngine, * as engine from './engine';\nimport * as swagger from './swagger';\nimport * as exceptions from './exceptions';\nimport * as services from './services';\nimport * as middlewares from './middlewares';\nimport * as ServiceProviders from './services/providers';\nimport * as MiddlewareProviders from './middlewares/providers';\nimport * as utils from './utils';\nimport Command, * as commands from './commands';\nimport Entities from './entities';\n\nconst providers = {\n services: ServiceProviders,\n middlewares: MiddlewareProviders\n};\n\nconst { wrapper } = utils;\n\nconst {\n DI,\n express\n} = engine;\n\n/**\n * @typedef {Object} engineCore\n */\nconst core = {\n EvaEngine,\n Command,\n DI,\n Entities,\n engine,\n express,\n commands,\n dependencies: {\n Joi,\n constitute,\n sequelize,\n mysql\n },\n exceptions,\n middlewares,\n sequelize,\n Joi,\n swagger,\n services,\n providers,\n wrapper,\n utils\n};\n\nmodule.exports = core;\nexports = module.exports; //eslint-disable-line\n"]}
|