@zerooneit/expressive-tea 1.3.0-beta.1 → 1.3.0-beta.3
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/classes/Boot.d.ts +1 -1
- package/classes/Boot.js +3 -2
- package/classes/Settings.d.ts +1 -1
- package/classes/Settings.js +11 -11
- package/decorators/annotations.d.ts +1 -1
- package/decorators/annotations.js +4 -4
- package/decorators/module.d.ts +1 -1
- package/decorators/proxy.d.ts +13 -0
- package/decorators/proxy.js +70 -0
- package/decorators/router.d.ts +4 -3
- package/decorators/router.js +10 -10
- package/decorators/server.d.ts +3 -2
- package/decorators/server.js +29 -19
- package/engines/http/index.d.ts +3 -1
- package/engines/http/index.js +16 -6
- package/engines/teacup/index.js +26 -25
- package/engines/teapot/index.js +30 -30
- package/engines/websocket/index.js +6 -5
- package/helpers/boot-helper.d.ts +2 -1
- package/helpers/boot-helper.js +13 -8
- package/helpers/decorators.js +4 -4
- package/helpers/server.d.ts +3 -3
- package/helpers/server.js +9 -9
- package/helpers/teapot-helper.d.ts +1 -0
- package/helpers/websocket-helper.d.ts +1 -0
- package/libs/classNames.d.ts +1 -0
- package/libs/classNames.js +4 -0
- package/package.json +29 -30
- package/services/WebsocketService.d.ts +1 -0
- package/classes/MetaData.d.ts +0 -17
- package/classes/MetaData.js +0 -68
- package/helpers/object-helper.d.ts +0 -166
- package/helpers/object-helper.js +0 -288
- package/libs/constants.d.ts +0 -69
- package/libs/constants.js +0 -101
- package/libs/interfaces.d.ts +0 -127
- package/libs/interfaces.js +0 -2
- package/libs/types.d.ts +0 -12
- package/libs/types.js +0 -2
- package/yarn-error.log +0 -5906
package/helpers/object-helper.js
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOwnArgumentNames = exports.prototypeOf = exports.descriptorOf = exports.nameOfSymbol = exports.nameOfClass = exports.nameOf = exports.ancestorsOf = exports.getInheritedClass = exports.isPromise = exports.isEmpty = exports.isClass = exports.isObject = exports.isDate = exports.isCollection = exports.isArrayOrArrayClass = exports.isArray = exports.isBoolean = exports.isNumber = exports.isString = exports.primitiveOf = exports.isPrimitiveOrPrimitiveClass = exports.getClassOrSymbol = exports.classOf = exports.getClass = exports.getConstructor = void 0;
|
|
4
|
-
/* istanbul ignore file */
|
|
5
|
-
/**
|
|
6
|
-
* Get the provide constructor.
|
|
7
|
-
* @param targetClass
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
const getConstructor = (targetClass) => typeof targetClass === 'function' ? targetClass : targetClass.constructor;
|
|
11
|
-
exports.getConstructor = getConstructor;
|
|
12
|
-
/**
|
|
13
|
-
* Get the provide constructor if target is an instance.
|
|
14
|
-
* @param target
|
|
15
|
-
* @returns {*}
|
|
16
|
-
* @ignore
|
|
17
|
-
*/
|
|
18
|
-
function getClass(target) {
|
|
19
|
-
return target.prototype ? target : target.constructor;
|
|
20
|
-
}
|
|
21
|
-
exports.getClass = getClass;
|
|
22
|
-
/**
|
|
23
|
-
* Get the provide constructor if target is an instance.
|
|
24
|
-
* @param target
|
|
25
|
-
* @returns {*}
|
|
26
|
-
* @alias getClass
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
function classOf(target) {
|
|
30
|
-
return getClass(target);
|
|
31
|
-
}
|
|
32
|
-
exports.classOf = classOf;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param target
|
|
36
|
-
* @returns {symbol}
|
|
37
|
-
* @ignore
|
|
38
|
-
*/
|
|
39
|
-
function getClassOrSymbol(target) {
|
|
40
|
-
return typeof target === 'symbol' ? target : getClass(target);
|
|
41
|
-
}
|
|
42
|
-
exports.getClassOrSymbol = getClassOrSymbol;
|
|
43
|
-
/**
|
|
44
|
-
* Return true if the given obj is a primitive.
|
|
45
|
-
* @param target
|
|
46
|
-
* @returns {boolean}
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
function isPrimitiveOrPrimitiveClass(target) {
|
|
50
|
-
return isString(target) || isNumber(target) || isBoolean(target);
|
|
51
|
-
}
|
|
52
|
-
exports.isPrimitiveOrPrimitiveClass = isPrimitiveOrPrimitiveClass;
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param target
|
|
56
|
-
* @returns {"string" | "number" | "boolean" | "any"}
|
|
57
|
-
* @ignore
|
|
58
|
-
*/
|
|
59
|
-
function primitiveOf(target) {
|
|
60
|
-
if (isString(target)) {
|
|
61
|
-
return 'string';
|
|
62
|
-
}
|
|
63
|
-
if (isNumber(target)) {
|
|
64
|
-
return 'number';
|
|
65
|
-
}
|
|
66
|
-
if (isBoolean(target)) {
|
|
67
|
-
return 'boolean';
|
|
68
|
-
}
|
|
69
|
-
return 'any';
|
|
70
|
-
}
|
|
71
|
-
exports.primitiveOf = primitiveOf;
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @param target
|
|
75
|
-
* @returns {boolean}
|
|
76
|
-
* @ignore
|
|
77
|
-
*/
|
|
78
|
-
function isString(target) {
|
|
79
|
-
return checkType(target, 'string', String);
|
|
80
|
-
}
|
|
81
|
-
exports.isString = isString;
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @param target
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
* @ignore
|
|
87
|
-
*/
|
|
88
|
-
function isNumber(target) {
|
|
89
|
-
return checkType(target, 'number', Number);
|
|
90
|
-
}
|
|
91
|
-
exports.isNumber = isNumber;
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
94
|
-
* @param target
|
|
95
|
-
* @returns {boolean}
|
|
96
|
-
* @ignore
|
|
97
|
-
*/
|
|
98
|
-
function isBoolean(target) {
|
|
99
|
-
return checkType(target, 'boolean', Boolean);
|
|
100
|
-
}
|
|
101
|
-
exports.isBoolean = isBoolean;
|
|
102
|
-
function checkType(target, type, TypeClass) {
|
|
103
|
-
return typeof target === type || target instanceof TypeClass || target === TypeClass;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @param target
|
|
108
|
-
* @returns {Boolean}
|
|
109
|
-
* @ignore
|
|
110
|
-
*/
|
|
111
|
-
function isArray(target) {
|
|
112
|
-
return Array.isArray(target);
|
|
113
|
-
}
|
|
114
|
-
exports.isArray = isArray;
|
|
115
|
-
/**
|
|
116
|
-
* Return true if the clazz is an array.
|
|
117
|
-
* @param target
|
|
118
|
-
* @returns {boolean}
|
|
119
|
-
* @ignore
|
|
120
|
-
*/
|
|
121
|
-
function isArrayOrArrayClass(target) {
|
|
122
|
-
if (target === Array) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return isArray(target);
|
|
126
|
-
}
|
|
127
|
-
exports.isArrayOrArrayClass = isArrayOrArrayClass;
|
|
128
|
-
/**
|
|
129
|
-
* Return true if the target.
|
|
130
|
-
* @param target
|
|
131
|
-
* @returns {boolean}
|
|
132
|
-
* @ignore
|
|
133
|
-
*/
|
|
134
|
-
function isCollection(target) {
|
|
135
|
-
return (isArrayOrArrayClass(target) ||
|
|
136
|
-
target === Map ||
|
|
137
|
-
target instanceof Map ||
|
|
138
|
-
target === Set ||
|
|
139
|
-
target instanceof Set ||
|
|
140
|
-
target === WeakMap ||
|
|
141
|
-
target instanceof WeakMap ||
|
|
142
|
-
target === WeakSet ||
|
|
143
|
-
target instanceof WeakSet);
|
|
144
|
-
}
|
|
145
|
-
exports.isCollection = isCollection;
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
* @param target
|
|
149
|
-
* @returns {boolean}
|
|
150
|
-
* @ignore
|
|
151
|
-
*/
|
|
152
|
-
function isDate(target) {
|
|
153
|
-
return target === Date || target instanceof Date;
|
|
154
|
-
}
|
|
155
|
-
exports.isDate = isDate;
|
|
156
|
-
/**
|
|
157
|
-
*
|
|
158
|
-
* @param target
|
|
159
|
-
* @returns {boolean}
|
|
160
|
-
* @ignore
|
|
161
|
-
*/
|
|
162
|
-
function isObject(target) {
|
|
163
|
-
return target === Object;
|
|
164
|
-
}
|
|
165
|
-
exports.isObject = isObject;
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
168
|
-
* @param target
|
|
169
|
-
* @returns {boolean}
|
|
170
|
-
* @ignore
|
|
171
|
-
*/
|
|
172
|
-
function isClass(target) {
|
|
173
|
-
return (!isPrimitiveOrPrimitiveClass(target) &&
|
|
174
|
-
!isObject(target) &&
|
|
175
|
-
!isDate(target) &&
|
|
176
|
-
target !== undefined &&
|
|
177
|
-
!isPromise(target));
|
|
178
|
-
}
|
|
179
|
-
exports.isClass = isClass;
|
|
180
|
-
/**
|
|
181
|
-
* Return true if the value is an empty string, null or undefined.
|
|
182
|
-
* @param value
|
|
183
|
-
* @returns {boolean}
|
|
184
|
-
* @ignore
|
|
185
|
-
*/
|
|
186
|
-
function isEmpty(value) {
|
|
187
|
-
return value === '' || value === null || value === undefined;
|
|
188
|
-
}
|
|
189
|
-
exports.isEmpty = isEmpty;
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
* @param target
|
|
193
|
-
* @returns {boolean}
|
|
194
|
-
* @ignore
|
|
195
|
-
*/
|
|
196
|
-
function isPromise(target) {
|
|
197
|
-
return target === Promise || target instanceof Promise;
|
|
198
|
-
}
|
|
199
|
-
exports.isPromise = isPromise;
|
|
200
|
-
/**
|
|
201
|
-
*
|
|
202
|
-
* @param target
|
|
203
|
-
* @returns {any}
|
|
204
|
-
* @ignore
|
|
205
|
-
*/
|
|
206
|
-
function getInheritedClass(target) {
|
|
207
|
-
return Object.getPrototypeOf(target);
|
|
208
|
-
}
|
|
209
|
-
exports.getInheritedClass = getInheritedClass;
|
|
210
|
-
/**
|
|
211
|
-
*
|
|
212
|
-
* @param target
|
|
213
|
-
* @returns {Array}
|
|
214
|
-
* @ignore
|
|
215
|
-
*/
|
|
216
|
-
function ancestorsOf(target) {
|
|
217
|
-
const classes = [];
|
|
218
|
-
let currentTarget = getClass(target);
|
|
219
|
-
while (nameOf(currentTarget) !== '') {
|
|
220
|
-
classes.unshift(currentTarget);
|
|
221
|
-
currentTarget = getInheritedClass(currentTarget);
|
|
222
|
-
}
|
|
223
|
-
return classes;
|
|
224
|
-
}
|
|
225
|
-
exports.ancestorsOf = ancestorsOf;
|
|
226
|
-
/**
|
|
227
|
-
* Get object name
|
|
228
|
-
* @ignore
|
|
229
|
-
*/
|
|
230
|
-
function nameOf(obj) {
|
|
231
|
-
switch (typeof obj) {
|
|
232
|
-
default:
|
|
233
|
-
return '' + obj;
|
|
234
|
-
case 'symbol':
|
|
235
|
-
return (0, exports.nameOfSymbol)(obj);
|
|
236
|
-
case 'function':
|
|
237
|
-
return nameOfClass(obj);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
exports.nameOf = nameOf;
|
|
241
|
-
/**
|
|
242
|
-
* Get the provide name.
|
|
243
|
-
* @param targetClass
|
|
244
|
-
* @ignore
|
|
245
|
-
*/
|
|
246
|
-
function nameOfClass(targetClass) {
|
|
247
|
-
return typeof targetClass === 'function' ? targetClass.name : targetClass.constructor.name;
|
|
248
|
-
}
|
|
249
|
-
exports.nameOfClass = nameOfClass;
|
|
250
|
-
/**
|
|
251
|
-
* Get symbol name.
|
|
252
|
-
* @param sym
|
|
253
|
-
* @ignore
|
|
254
|
-
*/
|
|
255
|
-
const nameOfSymbol = (sym) => sym
|
|
256
|
-
.toString()
|
|
257
|
-
.replace('Symbol(', '')
|
|
258
|
-
.replace(')', '');
|
|
259
|
-
exports.nameOfSymbol = nameOfSymbol;
|
|
260
|
-
/**
|
|
261
|
-
*
|
|
262
|
-
* @param target
|
|
263
|
-
* @param {string} propertyKey
|
|
264
|
-
* @returns {PropertyDescriptor}
|
|
265
|
-
* @ignore
|
|
266
|
-
*/
|
|
267
|
-
function descriptorOf(target, propertyKey) {
|
|
268
|
-
return Object.getOwnPropertyDescriptor((target && target.prototype) || target, propertyKey);
|
|
269
|
-
}
|
|
270
|
-
exports.descriptorOf = descriptorOf;
|
|
271
|
-
/**
|
|
272
|
-
*
|
|
273
|
-
* @param target
|
|
274
|
-
* @returns {any}
|
|
275
|
-
* @ignore
|
|
276
|
-
*/
|
|
277
|
-
function prototypeOf(target) {
|
|
278
|
-
return classOf(target) === target ? target.prototype : target;
|
|
279
|
-
}
|
|
280
|
-
exports.prototypeOf = prototypeOf;
|
|
281
|
-
const argumentsRegExp = /\(([\s\S]*?)\)/;
|
|
282
|
-
const replaceRegExp = /[ ,\n\r\t]+/;
|
|
283
|
-
// tslint:disable-next-line:ban-types
|
|
284
|
-
function getOwnArgumentNames(fn) {
|
|
285
|
-
const fnArguments = argumentsRegExp.exec(fn.toString())[1].trim();
|
|
286
|
-
return fnArguments && fnArguments.length ? fnArguments.split(replaceRegExp) : [];
|
|
287
|
-
}
|
|
288
|
-
exports.getOwnArgumentNames = getOwnArgumentNames;
|
package/libs/constants.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* As Expressive Tea have some stages when is boot the application, this enum helps to attach plugin when use the Pour
|
|
3
|
-
* or Plug decorations and this is the definition.
|
|
4
|
-
*
|
|
5
|
-
* <b>BOOT_DEPENDENCIES</b>: Used for some application dependencies, example, databases configuration or websocket settings.
|
|
6
|
-
*
|
|
7
|
-
* <b>INITIALIZE_MIDDLEWARES</b>: Used for application middlewares, example body-parser, cors, sessions express plugins.
|
|
8
|
-
*
|
|
9
|
-
* <b>APPLICATION</b>: Used internally to register all modules registered by Module decorator.
|
|
10
|
-
*
|
|
11
|
-
* <b>AFTER_APPLICATION_MIDDLEWARES</b>: Used to add middlewares after routers, commonly used for Error handling.
|
|
12
|
-
*
|
|
13
|
-
* <b>START</b>: This Stage is used to execute some code or attach middlewares before application starts and might be used to
|
|
14
|
-
* settings something after plugins/middlewares registered.
|
|
15
|
-
*
|
|
16
|
-
* @inner
|
|
17
|
-
* @export
|
|
18
|
-
* @enum {number}
|
|
19
|
-
* @summary Available Boot Stages
|
|
20
|
-
*/
|
|
21
|
-
export declare enum BOOT_STAGES {
|
|
22
|
-
BOOT_DEPENDENCIES = 0,
|
|
23
|
-
INITIALIZE_MIDDLEWARES = 1,
|
|
24
|
-
APPLICATION = 2,
|
|
25
|
-
AFTER_APPLICATION_MIDDLEWARES = 3,
|
|
26
|
-
START = 4,
|
|
27
|
-
ON_HTTP_CREATION = 5
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* This Determinate how the application is booting internally, this should not be modified unless you know what are you
|
|
31
|
-
* doing, however, even that is the case should not be modified. The Order is the next one:
|
|
32
|
-
*
|
|
33
|
-
* <b><i>BOOT_DEPENDENCIES</i></b> --> <b><i>INITIALIZE_MIDDLEWARES</i></b> --> <b><i>APPLICATION</i></b> -->
|
|
34
|
-
* <b><i>AFTER_APPLICATION_MIDDLEWARES</i></b> --> <b><i>START</i></b>
|
|
35
|
-
* @inner
|
|
36
|
-
* @type Array<BOOT_STAGES>
|
|
37
|
-
* @constant
|
|
38
|
-
* @summary Current Aplication Boot Order
|
|
39
|
-
*/
|
|
40
|
-
export declare const BOOT_ORDER: BOOT_STAGES[];
|
|
41
|
-
export declare const BOOT_STAGES_LIST: BOOT_STAGES[];
|
|
42
|
-
export declare const STAGES_INIT: {
|
|
43
|
-
0: any[];
|
|
44
|
-
1: any[];
|
|
45
|
-
2: any[];
|
|
46
|
-
3: any[];
|
|
47
|
-
4: any[];
|
|
48
|
-
};
|
|
49
|
-
export declare const EXPRESS_DIRECTIVES: string[];
|
|
50
|
-
export declare const BOOT_STAGES_KEY = "boot:stage-settings";
|
|
51
|
-
export declare const ROUTER_HANDLERS_KEY = "app:routes:handlers";
|
|
52
|
-
export declare const ROUTER_MIDDLEWARES_KEY = "app:routes:middlewares";
|
|
53
|
-
export declare const REGISTERED_MODEL_KEY = "app:models:registered";
|
|
54
|
-
export declare const REGISTERED_MODULE_KEY = "app:modules:registered";
|
|
55
|
-
export declare const PLUGINS_KEY = "boot:app-plugins";
|
|
56
|
-
export declare const REGISTERED_STATIC_KEY = "app:statics";
|
|
57
|
-
export declare const REGISTERED_DIRECTIVES_KEY = "app:directives";
|
|
58
|
-
export declare const ARGUMENTS_KEY = "app:routes:arguments";
|
|
59
|
-
export declare const ROUTER_ANNOTATIONS_KEY = "app:routes:annotations";
|
|
60
|
-
export declare const ASSIGN_TEAPOT_KEY = "app:gateway:teapot";
|
|
61
|
-
export declare const ASSIGN_TEACUP_KEY = "app:gateway:teacup";
|
|
62
|
-
export declare const ARGUMENT_TYPES: {
|
|
63
|
-
BODY: symbol;
|
|
64
|
-
GET_PARAM: symbol;
|
|
65
|
-
NEXT: symbol;
|
|
66
|
-
QUERY: symbol;
|
|
67
|
-
REQUEST: symbol;
|
|
68
|
-
RESPONSE: symbol;
|
|
69
|
-
};
|
package/libs/constants.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// tslint:disable:max-line-length
|
|
3
|
-
/**
|
|
4
|
-
* As Expressive Tea have some stages when is boot the application, this enum helps to attach plugin when use the Pour
|
|
5
|
-
* or Plug decorations and this is the definition.
|
|
6
|
-
*
|
|
7
|
-
* <b>BOOT_DEPENDENCIES</b>: Used for some application dependencies, example, databases configuration or websocket settings.
|
|
8
|
-
*
|
|
9
|
-
* <b>INITIALIZE_MIDDLEWARES</b>: Used for application middlewares, example body-parser, cors, sessions express plugins.
|
|
10
|
-
*
|
|
11
|
-
* <b>APPLICATION</b>: Used internally to register all modules registered by Module decorator.
|
|
12
|
-
*
|
|
13
|
-
* <b>AFTER_APPLICATION_MIDDLEWARES</b>: Used to add middlewares after routers, commonly used for Error handling.
|
|
14
|
-
*
|
|
15
|
-
* <b>START</b>: This Stage is used to execute some code or attach middlewares before application starts and might be used to
|
|
16
|
-
* settings something after plugins/middlewares registered.
|
|
17
|
-
*
|
|
18
|
-
* @inner
|
|
19
|
-
* @export
|
|
20
|
-
* @enum {number}
|
|
21
|
-
* @summary Available Boot Stages
|
|
22
|
-
*/
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.ARGUMENT_TYPES = exports.ASSIGN_TEACUP_KEY = exports.ASSIGN_TEAPOT_KEY = exports.ROUTER_ANNOTATIONS_KEY = exports.ARGUMENTS_KEY = exports.REGISTERED_DIRECTIVES_KEY = exports.REGISTERED_STATIC_KEY = exports.PLUGINS_KEY = exports.REGISTERED_MODULE_KEY = exports.REGISTERED_MODEL_KEY = exports.ROUTER_MIDDLEWARES_KEY = exports.ROUTER_HANDLERS_KEY = exports.BOOT_STAGES_KEY = exports.EXPRESS_DIRECTIVES = exports.STAGES_INIT = exports.BOOT_STAGES_LIST = exports.BOOT_ORDER = exports.BOOT_STAGES = void 0;
|
|
25
|
-
// tslint:enable:max-line-length
|
|
26
|
-
var BOOT_STAGES;
|
|
27
|
-
(function (BOOT_STAGES) {
|
|
28
|
-
BOOT_STAGES[BOOT_STAGES["BOOT_DEPENDENCIES"] = 0] = "BOOT_DEPENDENCIES";
|
|
29
|
-
BOOT_STAGES[BOOT_STAGES["INITIALIZE_MIDDLEWARES"] = 1] = "INITIALIZE_MIDDLEWARES";
|
|
30
|
-
BOOT_STAGES[BOOT_STAGES["APPLICATION"] = 2] = "APPLICATION";
|
|
31
|
-
BOOT_STAGES[BOOT_STAGES["AFTER_APPLICATION_MIDDLEWARES"] = 3] = "AFTER_APPLICATION_MIDDLEWARES";
|
|
32
|
-
BOOT_STAGES[BOOT_STAGES["START"] = 4] = "START";
|
|
33
|
-
BOOT_STAGES[BOOT_STAGES["ON_HTTP_CREATION"] = 5] = "ON_HTTP_CREATION";
|
|
34
|
-
})(BOOT_STAGES = exports.BOOT_STAGES || (exports.BOOT_STAGES = {}));
|
|
35
|
-
/**
|
|
36
|
-
* This Determinate how the application is booting internally, this should not be modified unless you know what are you
|
|
37
|
-
* doing, however, even that is the case should not be modified. The Order is the next one:
|
|
38
|
-
*
|
|
39
|
-
* <b><i>BOOT_DEPENDENCIES</i></b> --> <b><i>INITIALIZE_MIDDLEWARES</i></b> --> <b><i>APPLICATION</i></b> -->
|
|
40
|
-
* <b><i>AFTER_APPLICATION_MIDDLEWARES</i></b> --> <b><i>START</i></b>
|
|
41
|
-
* @inner
|
|
42
|
-
* @type Array<BOOT_STAGES>
|
|
43
|
-
* @constant
|
|
44
|
-
* @summary Current Aplication Boot Order
|
|
45
|
-
*/
|
|
46
|
-
exports.BOOT_ORDER = [
|
|
47
|
-
BOOT_STAGES.BOOT_DEPENDENCIES,
|
|
48
|
-
BOOT_STAGES.INITIALIZE_MIDDLEWARES,
|
|
49
|
-
BOOT_STAGES.APPLICATION
|
|
50
|
-
];
|
|
51
|
-
exports.BOOT_STAGES_LIST = [
|
|
52
|
-
BOOT_STAGES.BOOT_DEPENDENCIES,
|
|
53
|
-
BOOT_STAGES.INITIALIZE_MIDDLEWARES,
|
|
54
|
-
BOOT_STAGES.APPLICATION,
|
|
55
|
-
BOOT_STAGES.AFTER_APPLICATION_MIDDLEWARES,
|
|
56
|
-
BOOT_STAGES.START
|
|
57
|
-
];
|
|
58
|
-
exports.STAGES_INIT = {
|
|
59
|
-
[BOOT_STAGES.BOOT_DEPENDENCIES]: [],
|
|
60
|
-
[BOOT_STAGES.INITIALIZE_MIDDLEWARES]: [],
|
|
61
|
-
[BOOT_STAGES.APPLICATION]: [],
|
|
62
|
-
[BOOT_STAGES.AFTER_APPLICATION_MIDDLEWARES]: [],
|
|
63
|
-
[BOOT_STAGES.START]: []
|
|
64
|
-
};
|
|
65
|
-
exports.EXPRESS_DIRECTIVES = [
|
|
66
|
-
'case sensitive routing',
|
|
67
|
-
'env',
|
|
68
|
-
'etag',
|
|
69
|
-
'jsonp callback name',
|
|
70
|
-
'json escape',
|
|
71
|
-
'json replacer',
|
|
72
|
-
'json spaces',
|
|
73
|
-
'query parser',
|
|
74
|
-
'strict routing',
|
|
75
|
-
'subdomain offset',
|
|
76
|
-
'trust proxy',
|
|
77
|
-
'views',
|
|
78
|
-
'view cache',
|
|
79
|
-
'view engine',
|
|
80
|
-
'x-powered-by'
|
|
81
|
-
];
|
|
82
|
-
exports.BOOT_STAGES_KEY = 'boot:stage-settings';
|
|
83
|
-
exports.ROUTER_HANDLERS_KEY = 'app:routes:handlers';
|
|
84
|
-
exports.ROUTER_MIDDLEWARES_KEY = 'app:routes:middlewares';
|
|
85
|
-
exports.REGISTERED_MODEL_KEY = 'app:models:registered';
|
|
86
|
-
exports.REGISTERED_MODULE_KEY = 'app:modules:registered';
|
|
87
|
-
exports.PLUGINS_KEY = 'boot:app-plugins';
|
|
88
|
-
exports.REGISTERED_STATIC_KEY = 'app:statics';
|
|
89
|
-
exports.REGISTERED_DIRECTIVES_KEY = 'app:directives';
|
|
90
|
-
exports.ARGUMENTS_KEY = 'app:routes:arguments';
|
|
91
|
-
exports.ROUTER_ANNOTATIONS_KEY = 'app:routes:annotations';
|
|
92
|
-
exports.ASSIGN_TEAPOT_KEY = 'app:gateway:teapot';
|
|
93
|
-
exports.ASSIGN_TEACUP_KEY = 'app:gateway:teacup';
|
|
94
|
-
exports.ARGUMENT_TYPES = {
|
|
95
|
-
BODY: Symbol('BODY'),
|
|
96
|
-
GET_PARAM: Symbol('GET_PARAM'),
|
|
97
|
-
NEXT: Symbol('NEXT'),
|
|
98
|
-
QUERY: Symbol('QUERY'),
|
|
99
|
-
REQUEST: Symbol('REQUEST'),
|
|
100
|
-
RESPONSE: Symbol('RESPONSE')
|
|
101
|
-
};
|
package/libs/interfaces.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Express, Router } from 'express';
|
|
3
|
-
import * as http from 'http';
|
|
4
|
-
import * as https from 'https';
|
|
5
|
-
import { ExpressiveTeaMiddleware, ExpressMiddlewareHandler } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Define the dynamic structure for an object and useful to provide a dynamic object type on the applications.
|
|
8
|
-
* @typedef {Object} IDynamicObject
|
|
9
|
-
* @summary Dynamic Object Definition
|
|
10
|
-
*/
|
|
11
|
-
export interface IDynamicObject {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Expressive Tea Application interface is the response from an started application, contains the express application
|
|
16
|
-
* and a node http server instance.
|
|
17
|
-
* @typedef {Object} ExpressiveTeaApplication
|
|
18
|
-
* @property {Express} application Express Application Instance
|
|
19
|
-
* @property {HTTPServer} server HTTP Server Object
|
|
20
|
-
* @summary Application Interface
|
|
21
|
-
*/
|
|
22
|
-
export interface ExpressiveTeaApplication {
|
|
23
|
-
application: Express;
|
|
24
|
-
server: http.Server;
|
|
25
|
-
secureServer?: https.Server;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Declare the properties which the server will save into settings, is a semi dynamic object since is allowed to save
|
|
29
|
-
* any property but is contains only one defined property to keep the port of the server.
|
|
30
|
-
* @typedef {Object} ExpressiveTeaServerProps
|
|
31
|
-
* @property {number} [port] - Properties where server will be listen requests.
|
|
32
|
-
* @summary Expressive Tea Server Properties
|
|
33
|
-
*/
|
|
34
|
-
export interface ExpressiveTeaServerProps {
|
|
35
|
-
port?: number;
|
|
36
|
-
[key: string]: any;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Define the Main Plugins Properties.
|
|
40
|
-
* @typedef {Object} ExpressiveTeaPluginProps
|
|
41
|
-
* @property {string} name - Define a Plugin Name
|
|
42
|
-
* @property {number} priority - Define a Plugin Priority.
|
|
43
|
-
* @summary Plugin Properties
|
|
44
|
-
*/
|
|
45
|
-
export interface ExpressiveTeaPluginProps {
|
|
46
|
-
name: string;
|
|
47
|
-
priority: number;
|
|
48
|
-
}
|
|
49
|
-
export interface ExpressiveTeaPotSettings {
|
|
50
|
-
serverKey: string;
|
|
51
|
-
clientKey: string;
|
|
52
|
-
port?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface ExpressiveTeaCupSettings {
|
|
55
|
-
address: string;
|
|
56
|
-
clientKey: string;
|
|
57
|
-
mountTo: string;
|
|
58
|
-
serverUrl: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Define Expressive Module Properties.
|
|
62
|
-
* @typedef {Object} ExpressiveTeaModuleProps
|
|
63
|
-
* @property {Object[]} controllers - Controllers Assigned to Module
|
|
64
|
-
* @property {Object[]} providers -Dependency Injection Providers
|
|
65
|
-
* @property {string} mountpoint - Endpoint part which Module it will use as root.
|
|
66
|
-
* @summary
|
|
67
|
-
*/
|
|
68
|
-
export interface ExpressiveTeaModuleProps {
|
|
69
|
-
controllers: any[];
|
|
70
|
-
providers?: any[];
|
|
71
|
-
mountpoint: string;
|
|
72
|
-
}
|
|
73
|
-
export interface IExpressiveTeaModule {
|
|
74
|
-
readonly settings: ExpressiveTeaModuleProps;
|
|
75
|
-
readonly router: Router;
|
|
76
|
-
readonly controllers: any[];
|
|
77
|
-
__register(server: Express): void;
|
|
78
|
-
}
|
|
79
|
-
export interface IExpressiveTeaRoute {
|
|
80
|
-
readonly router: Router;
|
|
81
|
-
readonly mountpoint: string;
|
|
82
|
-
__mount(parent: Router): IExpressiveTeaRoute;
|
|
83
|
-
__registerHandler(options: ExpressiveTeaHandlerOptions): ExpressMiddlewareHandler;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @typedef {Object} ExpressiveTeaApplication
|
|
87
|
-
* @property {Express} application Express Application Instance
|
|
88
|
-
* @property {HTTPServer} server HTTP Server Object
|
|
89
|
-
*/
|
|
90
|
-
export interface ExpressiveTeaStaticFileServer {
|
|
91
|
-
dotfiles?: 'allow' | 'deny' | 'ignore';
|
|
92
|
-
etag?: boolean;
|
|
93
|
-
extensions?: string[];
|
|
94
|
-
index?: boolean;
|
|
95
|
-
maxAge?: string;
|
|
96
|
-
redirect?: boolean;
|
|
97
|
-
setHeaders?(res: any, path: any, stat: any): any;
|
|
98
|
-
}
|
|
99
|
-
export interface ExpressiveTeaStatic {
|
|
100
|
-
root: string;
|
|
101
|
-
virtual: string | null;
|
|
102
|
-
options: ExpressiveTeaStaticFileServer | never;
|
|
103
|
-
}
|
|
104
|
-
export interface ExpressiveTeaDirective {
|
|
105
|
-
name: string;
|
|
106
|
-
settings: any[];
|
|
107
|
-
}
|
|
108
|
-
export interface ExpressiveTeaHandlerOptions {
|
|
109
|
-
verb: string;
|
|
110
|
-
route: string;
|
|
111
|
-
handler: ExpressiveTeaMiddleware & ExpressiveTeaMiddlewareExtends;
|
|
112
|
-
target: unknown;
|
|
113
|
-
propertyKey: string | symbol;
|
|
114
|
-
}
|
|
115
|
-
export interface ExpressiveTeaArgumentOptions {
|
|
116
|
-
key: string | symbol;
|
|
117
|
-
index: number;
|
|
118
|
-
type: symbol;
|
|
119
|
-
arguments?: string | string[];
|
|
120
|
-
}
|
|
121
|
-
export interface ExpressiveTeaAnnotations {
|
|
122
|
-
type: string;
|
|
123
|
-
arguments?: any[];
|
|
124
|
-
}
|
|
125
|
-
export interface ExpressiveTeaMiddlewareExtends {
|
|
126
|
-
$middlewares?: ExpressMiddlewareHandler[];
|
|
127
|
-
}
|
package/libs/interfaces.js
DELETED
package/libs/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
2
|
-
export declare type Resolvable<R> = R | PromiseLike<R>;
|
|
3
|
-
export declare type Resolver<R> = (thenableOrResult?: Resolvable<R>) => void;
|
|
4
|
-
export declare type Rejector = (error?: any) => void;
|
|
5
|
-
export declare type ExpressiveTeaModuleClass<T> = new (...args: any[]) => T;
|
|
6
|
-
export declare type ExpressiveTeaRouteClass<T> = new (...args: any[]) => T;
|
|
7
|
-
export declare type ExpressMiddlewareHandler = (request?: Request, response?: Response, next?: NextFunction) => void;
|
|
8
|
-
export declare type ExpressiveTeaMiddleware = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
9
|
-
export declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
|
10
|
-
export declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
|
11
|
-
export declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor | void;
|
|
12
|
-
export declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
package/libs/types.js
DELETED