itrm-tools 1.0.45 → 1.0.47
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/dist/api/APIRequest.d.ts +67 -67
- package/dist/api/APIRequest.js +145 -145
- package/dist/api/APIRequest.js.map +1 -1
- package/dist/api/APIRequestBuilder.d.ts +20 -20
- package/dist/api/APIRequestBuilder.js +14 -14
- package/dist/api/APIRouter.d.ts +11 -11
- package/dist/api/APIRouter.js +21 -21
- package/dist/api/APIService.d.ts +42 -42
- package/dist/api/APIService.js +108 -108
- package/dist/api/APIService.js.map +1 -1
- package/dist/api/ExpressConfiguration.d.ts +4 -4
- package/dist/api/ExpressConfiguration.js +2 -2
- package/dist/api/HttpsAPIService.d.ts +10 -10
- package/dist/api/HttpsAPIService.js +47 -47
- package/dist/api/channel/ServerSentEventsManager.d.ts +8 -8
- package/dist/api/channel/ServerSentEventsManager.js +25 -25
- package/dist/api/check/APIChecker.d.ts +26 -26
- package/dist/api/check/APIChecker.js +40 -40
- package/dist/api/check/CheckableAPIRequest.d.ts +9 -9
- package/dist/api/check/CheckableAPIRequest.js +44 -44
- package/dist/api/check/CheckableAPIRouter.d.ts +11 -11
- package/dist/api/check/CheckableAPIRouter.js +48 -48
- package/dist/api/check/request/CheckableDeleteRequest.d.ts +8 -8
- package/dist/api/check/request/CheckableDeleteRequest.js +17 -17
- package/dist/api/check/request/CheckableFileUploadingPostRequest.d.ts +11 -11
- package/dist/api/check/request/CheckableFileUploadingPostRequest.js +22 -22
- package/dist/api/check/request/CheckableGetRequest.d.ts +8 -8
- package/dist/api/check/request/CheckableGetRequest.js +17 -17
- package/dist/api/check/request/CheckablePostRequest.d.ts +8 -8
- package/dist/api/check/request/CheckablePostRequest.js +17 -17
- package/dist/api/check/request/CheckablePutRequest.d.ts +8 -8
- package/dist/api/check/request/CheckablePutRequest.js +17 -17
- package/dist/api/check/route/SimpleCheckableAPIRouter.d.ts +7 -7
- package/dist/api/check/route/SimpleCheckableAPIRouter.js +25 -25
- package/dist/api/express/ExpressFileUploadingConfiguration.d.ts +6 -6
- package/dist/api/express/ExpressFileUploadingConfiguration.js +27 -27
- package/dist/api/express/ExpressStandardConfiguration.d.ts +11 -11
- package/dist/api/express/ExpressStandardConfiguration.js +29 -29
- package/dist/api/request/DeleteRequest.d.ts +7 -7
- package/dist/api/request/DeleteRequest.js +16 -16
- package/dist/api/request/GetRequest.d.ts +7 -7
- package/dist/api/request/GetRequest.js +16 -16
- package/dist/api/request/PostRequest.d.ts +7 -7
- package/dist/api/request/PostRequest.js +16 -16
- package/dist/api/request/PutRequest.d.ts +7 -7
- package/dist/api/request/PutRequest.js +16 -16
- package/dist/api/request/RequestAxiosCall.d.ts +7 -7
- package/dist/api/request/RequestAxiosCall.js +57 -57
- package/dist/api/request/crud/CrudManager.d.ts +8 -0
- package/dist/api/request/crud/CrudManager.js +3 -0
- package/dist/api/request/crud/CrudManager.js.map +1 -0
- package/dist/api/request/crud/CrudServiceManager.d.ts +19 -0
- package/dist/api/request/crud/CrudServiceManager.js +70 -0
- package/dist/api/request/crud/CrudServiceManager.js.map +1 -0
- package/dist/api/request/docs/DocumentationModels.d.ts +47 -47
- package/dist/api/request/docs/DocumentationModels.js +114 -114
- package/dist/api/request/docs/DocumentationRequest.d.ts +12 -12
- package/dist/api/request/docs/DocumentationRequest.js +126 -126
- package/dist/api/route/SimpleAPIRouter.d.ts +6 -6
- package/dist/api/route/SimpleAPIRouter.js +24 -24
- package/dist/database/mongoose/MongooseModelManager.d.ts +47 -43
- package/dist/database/mongoose/MongooseModelManager.js +65 -65
- package/dist/database/mongoose/MongooseModelManager.js.map +1 -1
- package/dist/database/redis/RedisConnection.d.ts +7 -7
- package/dist/database/redis/RedisConnection.js +17 -17
- package/dist/database/redis/RedisModelManager.d.ts +10 -10
- package/dist/database/redis/RedisModelManager.js +17 -17
- package/dist/database/sequelize/SequelizeConnection.d.ts +16 -16
- package/dist/database/sequelize/SequelizeConnection.js +22 -22
- package/dist/database/sequelize/SequelizeModelManager.d.ts +26 -26
- package/dist/database/sequelize/SequelizeModelManager.js +58 -58
- package/dist/index.d.ts +33 -31
- package/dist/index.js +69 -67
- package/dist/index.js.map +1 -1
- package/dist/log/Logger.d.ts +7 -7
- package/dist/log/Logger.js +28 -28
- package/dist/log/LoggerManager.d.ts +7 -7
- package/dist/log/LoggerManager.js +63 -63
- package/dist/log/LoggerWebSocket.d.ts +10 -10
- package/dist/log/LoggerWebSocket.js +15 -15
- package/dist/web3/Coin.d.ts +18 -18
- package/dist/web3/Coin.js +22 -22
- package/dist/web3/Coin.js.map +1 -1
- package/dist/web3/coingecko/CoingeckoPriceFinder.d.ts +10 -10
- package/dist/web3/coingecko/CoingeckoPriceFinder.js +88 -88
- package/package.json +25 -25
package/dist/api/APIService.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Express } from 'express';
|
|
2
|
-
import { APIRequest } from './APIRequest';
|
|
3
|
-
import { APIRouter } from './APIRouter';
|
|
4
|
-
import { ExpressConfiguration } from './ExpressConfiguration';
|
|
5
|
-
export declare namespace ITRMAPIServiceGlobal {
|
|
6
|
-
var memory: any;
|
|
7
|
-
var service: APIService | undefined;
|
|
8
|
-
var requests: any;
|
|
9
|
-
var routers: any;
|
|
10
|
-
var whitelist: string[];
|
|
11
|
-
var tools: any;
|
|
12
|
-
}
|
|
13
|
-
export declare interface APIServiceConfig {
|
|
14
|
-
name: string;
|
|
15
|
-
port: string | number;
|
|
16
|
-
express: ExpressConfiguration;
|
|
17
|
-
}
|
|
18
|
-
export declare interface APIServiceResponse {
|
|
19
|
-
status: string;
|
|
20
|
-
message: string;
|
|
21
|
-
error?: any;
|
|
22
|
-
}
|
|
23
|
-
export declare class APIService {
|
|
24
|
-
protected server: any;
|
|
25
|
-
protected app: Express;
|
|
26
|
-
protected name: string;
|
|
27
|
-
protected port: number | string;
|
|
28
|
-
protected config: ExpressConfiguration;
|
|
29
|
-
constructor(config: APIServiceConfig);
|
|
30
|
-
init(): void;
|
|
31
|
-
addRouter(router: APIRouter): void;
|
|
32
|
-
addRequest(request: APIRequest): void;
|
|
33
|
-
getServerInformation(): {
|
|
34
|
-
name: string;
|
|
35
|
-
port: string | number;
|
|
36
|
-
routers: any;
|
|
37
|
-
requests: any;
|
|
38
|
-
};
|
|
39
|
-
enableDocumentation(): void;
|
|
40
|
-
run(init: Function): Promise<APIServiceResponse>;
|
|
41
|
-
close(finish: Function): Promise<APIServiceResponse>;
|
|
42
|
-
}
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import { APIRequest } from './APIRequest';
|
|
3
|
+
import { APIRouter } from './APIRouter';
|
|
4
|
+
import { ExpressConfiguration } from './ExpressConfiguration';
|
|
5
|
+
export declare namespace ITRMAPIServiceGlobal {
|
|
6
|
+
var memory: any;
|
|
7
|
+
var service: APIService | undefined;
|
|
8
|
+
var requests: any;
|
|
9
|
+
var routers: any;
|
|
10
|
+
var whitelist: string[];
|
|
11
|
+
var tools: any;
|
|
12
|
+
}
|
|
13
|
+
export declare interface APIServiceConfig {
|
|
14
|
+
name: string;
|
|
15
|
+
port: string | number;
|
|
16
|
+
express: ExpressConfiguration;
|
|
17
|
+
}
|
|
18
|
+
export declare interface APIServiceResponse {
|
|
19
|
+
status: string;
|
|
20
|
+
message: string;
|
|
21
|
+
error?: any;
|
|
22
|
+
}
|
|
23
|
+
export declare class APIService {
|
|
24
|
+
protected server: any;
|
|
25
|
+
protected app: Express;
|
|
26
|
+
protected name: string;
|
|
27
|
+
protected port: number | string;
|
|
28
|
+
protected config: ExpressConfiguration;
|
|
29
|
+
constructor(config: APIServiceConfig);
|
|
30
|
+
init(): void;
|
|
31
|
+
addRouter(router: APIRouter): void;
|
|
32
|
+
addRequest(request: APIRequest): void;
|
|
33
|
+
getServerInformation(): {
|
|
34
|
+
name: string;
|
|
35
|
+
port: string | number;
|
|
36
|
+
routers: any;
|
|
37
|
+
requests: any;
|
|
38
|
+
};
|
|
39
|
+
enableDocumentation(): void;
|
|
40
|
+
run(init: Function): Promise<APIServiceResponse>;
|
|
41
|
+
close(finish: Function): Promise<APIServiceResponse>;
|
|
42
|
+
}
|
package/dist/api/APIService.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
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.APIService = exports.ITRMAPIServiceGlobal = void 0;
|
|
16
|
-
const express_1 = __importDefault(require("express"));
|
|
17
|
-
const DocumentationRequest_1 = require("./request/docs/DocumentationRequest");
|
|
18
|
-
var ITRMAPIServiceGlobal;
|
|
19
|
-
(function (ITRMAPIServiceGlobal) {
|
|
20
|
-
ITRMAPIServiceGlobal.memory = {};
|
|
21
|
-
ITRMAPIServiceGlobal.service = undefined;
|
|
22
|
-
ITRMAPIServiceGlobal.requests = {};
|
|
23
|
-
ITRMAPIServiceGlobal.routers = {};
|
|
24
|
-
ITRMAPIServiceGlobal.whitelist = [];
|
|
25
|
-
ITRMAPIServiceGlobal.tools = {};
|
|
26
|
-
})(ITRMAPIServiceGlobal
|
|
27
|
-
class APIService {
|
|
28
|
-
constructor(config) {
|
|
29
|
-
this.server = undefined;
|
|
30
|
-
this.app = (0, express_1.default)();
|
|
31
|
-
this.name = config.name;
|
|
32
|
-
this.port = config.port;
|
|
33
|
-
this.config = config.express;
|
|
34
|
-
}
|
|
35
|
-
init() {
|
|
36
|
-
ITRMAPIServiceGlobal.service = this;
|
|
37
|
-
this.config.apply(this.app);
|
|
38
|
-
this.app.get('/', (req, res) => {
|
|
39
|
-
return res.send('Server working!');
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
addRouter(router) {
|
|
43
|
-
ITRMAPIServiceGlobal.routers[router.path] = router;
|
|
44
|
-
this.app.use(router.path, router.router);
|
|
45
|
-
}
|
|
46
|
-
addRequest(request) {
|
|
47
|
-
ITRMAPIServiceGlobal.requests[request.method + "_" + request.path] = request;
|
|
48
|
-
request.addToApp(this.app);
|
|
49
|
-
}
|
|
50
|
-
getServerInformation() {
|
|
51
|
-
return {
|
|
52
|
-
name: this.name,
|
|
53
|
-
port: this.port,
|
|
54
|
-
routers: ITRMAPIServiceGlobal.routers,
|
|
55
|
-
requests: ITRMAPIServiceGlobal.requests
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
enableDocumentation() {
|
|
59
|
-
const swaggerUi = require('swagger-ui-express');
|
|
60
|
-
const documentationRequest = new DocumentationRequest_1.DocumentationRequest();
|
|
61
|
-
this.app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(documentationRequest.init()));
|
|
62
|
-
}
|
|
63
|
-
run(init) {
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
this.server = this.app.listen(this.port, () => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
console.log(`⚡️[server]: Server is running at http://localhost:${this.port}`);
|
|
67
|
-
try {
|
|
68
|
-
yield init();
|
|
69
|
-
resolve({ status: 'Ok', message: 'Server has been Initialized' });
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
reject({
|
|
73
|
-
status: 'Error',
|
|
74
|
-
message: 'An error has ocurred in the initialization function',
|
|
75
|
-
error: err
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
close(finish) {
|
|
82
|
-
return new Promise((resolve, reject) => {
|
|
83
|
-
this.server.close((err) => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (err)
|
|
85
|
-
reject({
|
|
86
|
-
status: 'Error',
|
|
87
|
-
message: 'An error has ocurred when closing Server',
|
|
88
|
-
error: err
|
|
89
|
-
});
|
|
90
|
-
try {
|
|
91
|
-
yield finish();
|
|
92
|
-
resolve({
|
|
93
|
-
status: 'Ok',
|
|
94
|
-
message: 'Server has been closed'
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
reject({
|
|
99
|
-
status: 'Error',
|
|
100
|
-
message: 'An error has ocurred in the closing function',
|
|
101
|
-
error: err
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.APIService = APIService;
|
|
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.APIService = exports.ITRMAPIServiceGlobal = void 0;
|
|
16
|
+
const express_1 = __importDefault(require("express"));
|
|
17
|
+
const DocumentationRequest_1 = require("./request/docs/DocumentationRequest");
|
|
18
|
+
var ITRMAPIServiceGlobal;
|
|
19
|
+
(function (ITRMAPIServiceGlobal) {
|
|
20
|
+
ITRMAPIServiceGlobal.memory = {};
|
|
21
|
+
ITRMAPIServiceGlobal.service = undefined;
|
|
22
|
+
ITRMAPIServiceGlobal.requests = {};
|
|
23
|
+
ITRMAPIServiceGlobal.routers = {};
|
|
24
|
+
ITRMAPIServiceGlobal.whitelist = [];
|
|
25
|
+
ITRMAPIServiceGlobal.tools = {};
|
|
26
|
+
})(ITRMAPIServiceGlobal || (exports.ITRMAPIServiceGlobal = ITRMAPIServiceGlobal = {}));
|
|
27
|
+
class APIService {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.server = undefined;
|
|
30
|
+
this.app = (0, express_1.default)();
|
|
31
|
+
this.name = config.name;
|
|
32
|
+
this.port = config.port;
|
|
33
|
+
this.config = config.express;
|
|
34
|
+
}
|
|
35
|
+
init() {
|
|
36
|
+
ITRMAPIServiceGlobal.service = this;
|
|
37
|
+
this.config.apply(this.app);
|
|
38
|
+
this.app.get('/', (req, res) => {
|
|
39
|
+
return res.send('Server working!');
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
addRouter(router) {
|
|
43
|
+
ITRMAPIServiceGlobal.routers[router.path] = router;
|
|
44
|
+
this.app.use(router.path, router.router);
|
|
45
|
+
}
|
|
46
|
+
addRequest(request) {
|
|
47
|
+
ITRMAPIServiceGlobal.requests[request.method + "_" + request.path] = request;
|
|
48
|
+
request.addToApp(this.app);
|
|
49
|
+
}
|
|
50
|
+
getServerInformation() {
|
|
51
|
+
return {
|
|
52
|
+
name: this.name,
|
|
53
|
+
port: this.port,
|
|
54
|
+
routers: ITRMAPIServiceGlobal.routers,
|
|
55
|
+
requests: ITRMAPIServiceGlobal.requests
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
enableDocumentation() {
|
|
59
|
+
const swaggerUi = require('swagger-ui-express');
|
|
60
|
+
const documentationRequest = new DocumentationRequest_1.DocumentationRequest();
|
|
61
|
+
this.app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(documentationRequest.init()));
|
|
62
|
+
}
|
|
63
|
+
run(init) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
this.server = this.app.listen(this.port, () => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
console.log(`⚡️[server]: Server is running at http://localhost:${this.port}`);
|
|
67
|
+
try {
|
|
68
|
+
yield init();
|
|
69
|
+
resolve({ status: 'Ok', message: 'Server has been Initialized' });
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
reject({
|
|
73
|
+
status: 'Error',
|
|
74
|
+
message: 'An error has ocurred in the initialization function',
|
|
75
|
+
error: err
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
close(finish) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
this.server.close((err) => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
if (err)
|
|
85
|
+
reject({
|
|
86
|
+
status: 'Error',
|
|
87
|
+
message: 'An error has ocurred when closing Server',
|
|
88
|
+
error: err
|
|
89
|
+
});
|
|
90
|
+
try {
|
|
91
|
+
yield finish();
|
|
92
|
+
resolve({
|
|
93
|
+
status: 'Ok',
|
|
94
|
+
message: 'Server has been closed'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
reject({
|
|
99
|
+
status: 'Error',
|
|
100
|
+
message: 'An error has ocurred in the closing function',
|
|
101
|
+
error: err
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.APIService = APIService;
|
|
109
109
|
//# sourceMappingURL=APIService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIService.js","sourceRoot":"","sources":["../../src/api/APIService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA8D;AAI9D,8EAA2E;AAE3E,IAAiB,oBAAoB,CAOpC;AAPD,WAAiB,oBAAoB;IACtB,2BAAM,GAAQ,EAAE,CAAC;IACjB,4BAAO,GAA2B,SAAS,CAAC;IAC5C,6BAAQ,GAAQ,EAAE,CAAC;IACnB,4BAAO,GAAQ,EAAE,CAAC;IAClB,8BAAS,GAAa,EAAE,CAAC;IACzB,0BAAK,GAAQ,EAAE,CAAC;AAC/B,CAAC,EAPgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"APIService.js","sourceRoot":"","sources":["../../src/api/APIService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA8D;AAI9D,8EAA2E;AAE3E,IAAiB,oBAAoB,CAOpC;AAPD,WAAiB,oBAAoB;IACtB,2BAAM,GAAQ,EAAE,CAAC;IACjB,4BAAO,GAA2B,SAAS,CAAC;IAC5C,6BAAQ,GAAQ,EAAE,CAAC;IACnB,4BAAO,GAAQ,EAAE,CAAC;IAClB,8BAAS,GAAa,EAAE,CAAC;IACzB,0BAAK,GAAQ,EAAE,CAAC;AAC/B,CAAC,EAPgB,oBAAoB,oCAApB,oBAAoB,QAOpC;AAcD,MAAa,UAAU;IAOnB,YAAY,MAAwB;QAN1B,WAAM,GAAQ,SAAS,CAAC;QACxB,QAAG,GAAY,IAAA,iBAAO,GAAE,CAAC;QAM/B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;IACjC,CAAC;IAEM,IAAI;QACP,oBAAoB,CAAC,OAAO,GAAG,IAAI,CAAC;QACpC,IAAI,C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import { Express } from 'express';
|
|
2
|
-
export interface ExpressConfiguration {
|
|
3
|
-
apply(app: Express): void;
|
|
4
|
-
}
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
export interface ExpressConfiguration {
|
|
3
|
+
apply(app: Express): void;
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ExpressConfiguration.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ServerOptions } from 'https';
|
|
3
|
-
import { APIService, APIServiceConfig, APIServiceResponse } from "./APIService";
|
|
4
|
-
export declare class HttpsAPIService extends APIService {
|
|
5
|
-
private httpsServer;
|
|
6
|
-
private options;
|
|
7
|
-
constructor(config: APIServiceConfig, options: ServerOptions);
|
|
8
|
-
init(): void;
|
|
9
|
-
run(init: Function): Promise<APIServiceResponse>;
|
|
10
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ServerOptions } from 'https';
|
|
3
|
+
import { APIService, APIServiceConfig, APIServiceResponse } from "./APIService";
|
|
4
|
+
export declare class HttpsAPIService extends APIService {
|
|
5
|
+
private httpsServer;
|
|
6
|
+
private options;
|
|
7
|
+
constructor(config: APIServiceConfig, options: ServerOptions);
|
|
8
|
+
init(): void;
|
|
9
|
+
run(init: Function): Promise<APIServiceResponse>;
|
|
10
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
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.HttpsAPIService = void 0;
|
|
16
|
-
const https_1 = __importDefault(require("https"));
|
|
17
|
-
const APIService_1 = require("./APIService");
|
|
18
|
-
class HttpsAPIService extends APIService_1.APIService {
|
|
19
|
-
constructor(config, options) {
|
|
20
|
-
super(config);
|
|
21
|
-
this.httpsServer = undefined;
|
|
22
|
-
this.options = options;
|
|
23
|
-
}
|
|
24
|
-
init() {
|
|
25
|
-
super.init();
|
|
26
|
-
this.httpsServer = https_1.default.createServer(this.options, this.app);
|
|
27
|
-
}
|
|
28
|
-
run(init) {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
this.server = this.httpsServer.listen(this.port, () => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
console.log(`⚡️[server]: Server is running at https://localhost:${this.port}`);
|
|
32
|
-
try {
|
|
33
|
-
yield init();
|
|
34
|
-
resolve({ status: 'Ok', message: 'Server has been Initialized' });
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
reject({
|
|
38
|
-
status: 'Error',
|
|
39
|
-
message: 'An error has ocurred in the initialization function',
|
|
40
|
-
error: err
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.HttpsAPIService = HttpsAPIService;
|
|
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.HttpsAPIService = void 0;
|
|
16
|
+
const https_1 = __importDefault(require("https"));
|
|
17
|
+
const APIService_1 = require("./APIService");
|
|
18
|
+
class HttpsAPIService extends APIService_1.APIService {
|
|
19
|
+
constructor(config, options) {
|
|
20
|
+
super(config);
|
|
21
|
+
this.httpsServer = undefined;
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
init() {
|
|
25
|
+
super.init();
|
|
26
|
+
this.httpsServer = https_1.default.createServer(this.options, this.app);
|
|
27
|
+
}
|
|
28
|
+
run(init) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
this.server = this.httpsServer.listen(this.port, () => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
console.log(`⚡️[server]: Server is running at https://localhost:${this.port}`);
|
|
32
|
+
try {
|
|
33
|
+
yield init();
|
|
34
|
+
resolve({ status: 'Ok', message: 'Server has been Initialized' });
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
reject({
|
|
38
|
+
status: 'Error',
|
|
39
|
+
message: 'An error has ocurred in the initialization function',
|
|
40
|
+
error: err
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.HttpsAPIService = HttpsAPIService;
|
|
48
48
|
//# sourceMappingURL=HttpsAPIService.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Response } from 'express';
|
|
2
|
-
export declare class ServerSentEventsManager {
|
|
3
|
-
private res;
|
|
4
|
-
constructor(res: Response, config?: any);
|
|
5
|
-
write(status: number, payload: string): void;
|
|
6
|
-
writeObject(status: number, payload: any): void;
|
|
7
|
-
end(status: number, payload: string): void;
|
|
8
|
-
}
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
export declare class ServerSentEventsManager {
|
|
3
|
+
private res;
|
|
4
|
+
constructor(res: Response, config?: any);
|
|
5
|
+
write(status: number, payload: string): void;
|
|
6
|
+
writeObject(status: number, payload: any): void;
|
|
7
|
+
end(status: number, payload: string): void;
|
|
8
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerSentEventsManager = void 0;
|
|
4
|
-
class ServerSentEventsManager {
|
|
5
|
-
constructor(res, config) {
|
|
6
|
-
config = config !== null && config !== void 0 ? config : {
|
|
7
|
-
'Cache-control': 'no-cahe',
|
|
8
|
-
'Content-Type': 'text/event-stream',
|
|
9
|
-
'Connection': 'keep-alive'
|
|
10
|
-
};
|
|
11
|
-
res.set(config);
|
|
12
|
-
res.flushHeaders();
|
|
13
|
-
this.res = res;
|
|
14
|
-
}
|
|
15
|
-
write(status, payload) {
|
|
16
|
-
this.res.status(status).write(payload);
|
|
17
|
-
}
|
|
18
|
-
writeObject(status, payload) {
|
|
19
|
-
this.res.status(status).write(JSON.stringify(payload));
|
|
20
|
-
}
|
|
21
|
-
end(status, payload) {
|
|
22
|
-
this.res.status(200).end(payload);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.ServerSentEventsManager = ServerSentEventsManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerSentEventsManager = void 0;
|
|
4
|
+
class ServerSentEventsManager {
|
|
5
|
+
constructor(res, config) {
|
|
6
|
+
config = config !== null && config !== void 0 ? config : {
|
|
7
|
+
'Cache-control': 'no-cahe',
|
|
8
|
+
'Content-Type': 'text/event-stream',
|
|
9
|
+
'Connection': 'keep-alive'
|
|
10
|
+
};
|
|
11
|
+
res.set(config);
|
|
12
|
+
res.flushHeaders();
|
|
13
|
+
this.res = res;
|
|
14
|
+
}
|
|
15
|
+
write(status, payload) {
|
|
16
|
+
this.res.status(status).write(payload);
|
|
17
|
+
}
|
|
18
|
+
writeObject(status, payload) {
|
|
19
|
+
this.res.status(status).write(JSON.stringify(payload));
|
|
20
|
+
}
|
|
21
|
+
end(status, payload) {
|
|
22
|
+
this.res.status(200).end(payload);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ServerSentEventsManager = ServerSentEventsManager;
|
|
26
26
|
//# sourceMappingURL=ServerSentEventsManager.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
export declare interface APICheckResult {
|
|
3
|
-
approved: boolean;
|
|
4
|
-
payload?: any;
|
|
5
|
-
rejection?: {
|
|
6
|
-
code: number;
|
|
7
|
-
payload: any;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare interface APICheckConfig {
|
|
11
|
-
check: string;
|
|
12
|
-
}
|
|
13
|
-
export interface APICheck {
|
|
14
|
-
getConfig(): APICheckConfig;
|
|
15
|
-
apply(config: APICheckConfig, req: Request): PromiseLike<APICheckResult>;
|
|
16
|
-
}
|
|
17
|
-
export interface Checkable {
|
|
18
|
-
addCheck(check: APICheck): void;
|
|
19
|
-
check(req: Request, res: Response, next: NextFunction): PromiseLike<void | Response>;
|
|
20
|
-
}
|
|
21
|
-
export declare class APIChecker {
|
|
22
|
-
private checks;
|
|
23
|
-
addCheck(check: APICheck): void;
|
|
24
|
-
applyChecks(req: Request): Promise<APICheckResult>;
|
|
25
|
-
reject(res: Response, result: APICheckResult): Response<any, Record<string, any>>;
|
|
26
|
-
}
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
export declare interface APICheckResult {
|
|
3
|
+
approved: boolean;
|
|
4
|
+
payload?: any;
|
|
5
|
+
rejection?: {
|
|
6
|
+
code: number;
|
|
7
|
+
payload: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare interface APICheckConfig {
|
|
11
|
+
check: string;
|
|
12
|
+
}
|
|
13
|
+
export interface APICheck {
|
|
14
|
+
getConfig(): APICheckConfig;
|
|
15
|
+
apply(config: APICheckConfig, req: Request): PromiseLike<APICheckResult>;
|
|
16
|
+
}
|
|
17
|
+
export interface Checkable {
|
|
18
|
+
addCheck(check: APICheck): void;
|
|
19
|
+
check(req: Request, res: Response, next: NextFunction): PromiseLike<void | Response>;
|
|
20
|
+
}
|
|
21
|
+
export declare class APIChecker {
|
|
22
|
+
private checks;
|
|
23
|
+
addCheck(check: APICheck): void;
|
|
24
|
+
applyChecks(req: Request): Promise<APICheckResult>;
|
|
25
|
+
reject(res: Response, result: APICheckResult): Response<any, Record<string, any>>;
|
|
26
|
+
}
|