badmfck-api-server 2.4.7 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/apiServer/APIService.js +8 -4
- package/dist/apiServer/APIService.js.map +1 -0
- package/dist/apiServer/BaseEndpoint.js +1 -0
- package/dist/apiServer/BaseEndpoint.js.map +1 -0
- package/dist/apiServer/BaseService.js +1 -0
- package/dist/apiServer/BaseService.js.map +1 -0
- package/dist/apiServer/ClusterService.d.ts +18 -5
- package/dist/apiServer/ClusterService.js +45 -14
- package/dist/apiServer/ClusterService.js.map +1 -0
- package/dist/apiServer/DocumentService.js +1 -0
- package/dist/apiServer/DocumentService.js.map +1 -0
- package/dist/apiServer/HUBService.d.ts +11 -4
- package/dist/apiServer/HUBService.js +79 -18
- package/dist/apiServer/HUBService.js.map +1 -0
- package/dist/apiServer/LocalRequest.js +1 -0
- package/dist/apiServer/LocalRequest.js.map +1 -0
- package/dist/apiServer/LogService.js +1 -0
- package/dist/apiServer/LogService.js.map +1 -0
- package/dist/apiServer/MysqlService.js +4 -3
- package/dist/apiServer/MysqlService.js.map +1 -0
- package/dist/apiServer/WSAPITransport.js +1 -0
- package/dist/apiServer/WSAPITransport.js.map +1 -0
- package/dist/apiServer/WebSocketHandler.d.ts +0 -0
- package/dist/apiServer/WebSocketHandler.js +2 -0
- package/dist/apiServer/WebSocketHandler.js.map +1 -0
- package/dist/apiServer/WebsocketService.js +1 -0
- package/dist/apiServer/WebsocketService.js.map +1 -0
- package/dist/apiServer/cluster/HUBConnection.d.ts +25 -25
- package/dist/apiServer/cluster/HUBConnection.js +107 -88
- package/dist/apiServer/cluster/HUBConnection.js.map +1 -0
- package/dist/apiServer/cluster/HUBHandlres.d.ts +0 -0
- package/dist/apiServer/cluster/HUBHandlres.js +2 -0
- package/dist/apiServer/cluster/HUBHandlres.js.map +1 -0
- package/dist/apiServer/deployment/Deployment.js +1 -0
- package/dist/apiServer/deployment/Deployment.js.map +1 -0
- package/dist/apiServer/helper/DataProvider.js +1 -0
- package/dist/apiServer/helper/DataProvider.js.map +1 -0
- package/dist/apiServer/helper/Sleep.d.ts +1 -0
- package/dist/apiServer/helper/Sleep.js +6 -0
- package/dist/apiServer/helper/Sleep.js.map +1 -0
- package/dist/apiServer/helper/UID.js +1 -0
- package/dist/apiServer/helper/UID.js.map +1 -0
- package/dist/apiServer/helper/Validator.js +1 -0
- package/dist/apiServer/helper/Validator.js.map +1 -0
- package/dist/apiServer/monitor/Monitor.js +1 -0
- package/dist/apiServer/monitor/Monitor.js.map +1 -0
- package/dist/apiServer/routes/Liveness.js +1 -0
- package/dist/apiServer/routes/Liveness.js.map +1 -0
- package/dist/apiServer/routes/Readiness.js +1 -0
- package/dist/apiServer/routes/Readiness.js.map +1 -0
- package/dist/apiServer/structures/DefaultErrors.js +1 -0
- package/dist/apiServer/structures/DefaultErrors.js.map +1 -0
- package/dist/apiServer/structures/HTTPStatus.js +1 -0
- package/dist/apiServer/structures/HTTPStatus.js.map +1 -0
- package/dist/apiServer/structures/Interfaces.js +1 -0
- package/dist/apiServer/structures/Interfaces.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +2 -2
@@ -83,7 +83,7 @@ async function Initializer(services) {
|
|
83
83
|
exports.Initializer = Initializer;
|
84
84
|
class APIService extends BaseService_1.BaseService {
|
85
85
|
static nextLogID = 0;
|
86
|
-
version = "2.
|
86
|
+
version = "2.5.0";
|
87
87
|
options;
|
88
88
|
monitor;
|
89
89
|
monitorIndexFile;
|
@@ -274,14 +274,17 @@ class APIService extends BaseService_1.BaseService {
|
|
274
274
|
this.options.onError(e);
|
275
275
|
if (this.monitor)
|
276
276
|
this.monitor.registrateFatalError(ep);
|
277
|
-
|
278
|
-
httpStatus: 500,
|
277
|
+
let data = {
|
279
278
|
error: {
|
280
279
|
code: 10002,
|
281
280
|
message: "Internal server error",
|
281
|
+
httpStatus: 500,
|
282
282
|
details: `${e}`
|
283
283
|
}
|
284
|
-
}
|
284
|
+
};
|
285
|
+
if (DefaultErrors_1.ErrorUtils.isError(e))
|
286
|
+
data = { error: e };
|
287
|
+
this.sendResponse(req.get("Referer") ?? "", res, data, tme, ep, log, httpRequest);
|
285
288
|
return;
|
286
289
|
}
|
287
290
|
this.sendResponse(req.get("Referer") ?? "", res, result, tme, ep, log, httpRequest);
|
@@ -451,3 +454,4 @@ class APIService extends BaseService_1.BaseService {
|
|
451
454
|
}
|
452
455
|
}
|
453
456
|
exports.APIService = APIService;
|
457
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQVBJU2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hcGlTZXJ2ZXIvQVBJU2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHNEQUF3RDtBQUN4RCwrQ0FBeUQ7QUFDekQsZ0RBQXVCO0FBRXZCLGlEQUE0RDtBQUM1RCw0RUFBc0U7QUFFdEUsbURBQWtDO0FBQ2xDLDZDQUF5RDtBQUN6RCwrQ0FBMkM7QUFDM0MsZ0RBQXVCO0FBQ3ZCLG9EQUE0QjtBQUM1Qiw0Q0FBbUI7QUFDbkIsNEVBQTJDO0FBQzNDLDRDQUFtQjtBQUNuQixnREFBNEM7QUFDNUMsa0RBQThDO0FBQzlDLGdEQUF1QjtBQWtDdkIsU0FBZ0IsaUJBQWlCO0lBQ2hDLE9BQU87UUFDTixJQUFJLEVBQUUsSUFBSTtRQUNWLFlBQVksRUFBRSxPQUFPO1FBQ3JCLGlCQUFpQixFQUFFO1lBQ2xCLHVCQUF1QjtTQUN2QjtRQUNELFNBQVMsRUFBRSxFQUFFO1FBQ2IsU0FBUyxFQUFDLE1BQU07UUFDaEIsWUFBWSxFQUFFLFVBQVUsR0FBNkI7WUFDcEQsSUFBQSxvQkFBTyxFQUFDLGtCQUFrQixFQUFDLEdBQUcsQ0F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0W2ldPXRoaXMuY2hlY2tEYXRhTGVuZ3RoKGRhdGFbaV0scmVzdWx0W2ldLGx2bCsxKTtcblx0XHRcdFx0YXJyY250LS07XG5cdFx0XHRcdGlmKGFycmNudDw9MCl7XG5cdFx0XHRcdFx0cmVzdWx0W1wiLi4uXCJdPVwiLi4uIHRvdGFsOiBcIitBcnJheS5pc0FycmF5KGRhdGEpP2RhdGEubGVuZ3RoOk9iamVjdC5rZXlzKGRhdGEpLmxlbmd0aDtcblx0XHRcdFx0XHRicmVhaztcblx0XHRcdFx0fVxuXHRcdFx0fVxuXHRcdH1cblx0XHRyZXR1cm4gcmVzdWx0ID8/IG51bGw7XG5cdH1cblxufVxuIl19
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"APIService.js","sourceRoot":"","sources":["../../src/apiServer/APIService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwD;AACxD,+CAAyD;AACzD,gDAAuB;AAEvB,iDAA4D;AAC5D,4EAAsE;AAEtE,mDAAkC;AAClC,6CAAyD;AACzD,+CAA2C;AAC3C,gDAAuB;AACvB,oDAA4B;AAC5B,4CAAmB;AACnB,4EAA2C;AAC3C,4CAAmB;AACnB,gDAA4C;AAC5C,kDAA8C;AAC9C,gDAAuB;AAiCvB,SAAgB,iBAAiB;IAChC,OAAO;QACN,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,OAAO;QACrB,iBAAiB,EAAE;YAClB,uBAAuB;SACvB;QACD,SAAS,EAAE,EAAE;QACb,SAAS,EAAC,MAAM;QAChB,YAAY,EAAE,UAAU,GAA6B;YACpD,IAAA,oBAAO,EAAC,kBAAkB,EAAC,GAAG,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,EAAC,UAAS,GAAO;YACvB,IAAA,qBAAQ,EAAC,kBAAkB,EAAC,GAAG,CAAC,CAAC;QAClC,CAAC;QACD,uBAAuB,EAAC,KAAK;QAC7B,SAAS,EAAC,EAAE,GAAC,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AAQ,EAAC;YAC3B,IAAG,CAAC,MAAM;gBACT,MAAM,GAAC,EAAE,CAAC;YACX,IAAI,MAAM,GAAG,GAAG,CAAC;YACjB,KAAI,IAAI,CAAC,IAAI,IAAI,EAAC;gBACjB,MAAM,CAAC,CAAC,CAAC,GAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,MAAM,CAAC,CAAC,CAAC,EAAC,GAAG,GAAC,CAAC,CAAC,CAAC;gBACxD,MAAM,EAAE,CAAC;gBACT,IAAG,MAAM,IAAE,CAAC,EAAC;oBACZ,MAAM,CAAC,KAAK,CAAC,GAAC,aAAa,GAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC,CAAA,IAAI,CAAC,MAAM,CAAA,CAAC,CAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;oBACrF,MAAM;iBACN;aACD;SACD;QACD,OAAO,MAAM,IAAI,IAAI,CAAC;IACvB,CAAC;;AAvcF,gCAycC","sourcesContent":["import express, { Application, Response } from 'express'\nimport { BaseService, IBaseService } from './BaseService'\nimport cors from 'cors'\nimport { IncomingMessage } from 'http'\nimport { BaseEndpoint, IBaseEndpoint } from './BaseEndpoint'\nimport DefaultErrors, { ErrorUtils } from './structures/DefaultErrors'\nimport { HTTPRequestVO, IError, TransferPacketVO } from './structures/Interfaces'\nimport {Req} from \"badmfck-signal\"\nimport { logCrit, logError, logInfo } from './LogService'\nimport { Monitor } from './monitor/Monitor'\nimport path from \"path\"\nimport crypto from \"crypto\";\nimport fs from \"fs\"\nimport fileUpload from 'express-fileupload'\nimport os from \"os\"\nimport { Liveness } from './routes/Liveness'\nimport { Readiness } from './routes/Readiness'\nimport http from 'http'\n\nexport interface APIServiceNetworkLogItem{\t\n\tid:number,\n\tcreated:number,\n\ttime:number,\n\treferer?:string,\n\trequest:{[key:string]:any},\n\tresponse:{[key:string]:any}\n\terror?:string|null\n}\n\nexport interface APIServiceOptions{\n\tport:number,\n\tbaseEndPoint:string // \"/api/\"\n\tcorsHostWhiteList:string[],\n\tendpoints:IBaseEndpoint[],\n\tjsonLimit:string // \"10mb\"\n\tonNetworkLog?:((log:APIServiceNetworkLogItem)=>void)|null\n\tonError?:((...rest:any[])=>void)|null\n\tisProductionEnvironment:boolean,\n\tinterceptor?:IBaseEndpoint,\n\tpostproducer?:(req:HTTPRequestVO|undefined|null,res:Response,data:TransferPacketVO<any>,requestTime:number,endpoint?:string,log?:APIServiceNetworkLogItem|null)=>Promise<TransferPacketVO>\n\tpreproducer?:(req:HTTPRequestVO|undefined|null)=>any\n\t\n\tmonitor?:{login:string,password:string}[]\n\t//deployment?:{login:string,password:string}\n\tappVersion?:string\n\n\tfileTempDir:string;\n\tfileLimit:number // b\n}\n\nexport function getDefaultOptions():APIServiceOptions{\n\treturn {\n\t\tport: 8091,\n\t\tbaseEndPoint: '/api/',\n\t\tcorsHostWhiteList: [\n\t\t\t'http://localhost:3000',\n\t\t],\n\t\tendpoints: [],\n\t\tjsonLimit:\"10mb\",\n\t\tonNetworkLog: function (log: APIServiceNetworkLogItem): void {\n\t\t\tlogInfo(\"${APIService.js}\",log)\n\t\t},\n\t\tonError:function(err:any){\n\t\t\tlogError(\"${APIService.js}\",err);\n\t\t},\n\t\tisProductionEnvironment:false,\n\t\tfileLimit:50*1024*1024,\n\t\tfileTempDir:path.resolve(os.tmpdir(),\"fileTempDir\")\n\t}\n}\n\nexport const REQ_CREATE_NET_LOG:Req<void,APIServiceNetworkLogItem> = new Req(undefined,\"REQ_CREATE_NET_LOG\");\nexport const REQ_HTTP_LOG:Req<void,APIServiceNetworkLogItem[]> = new Req(undefined,\"REQ_HTTP_LOG\");\nexport const REQ_HTTP_REQUESTS_COUNT:Req<void,number> = new Req(undefined,\"REQ_HTTP_REQUESTS_COUNT\");\nexport const REQ_HTTP_SERVER:Req<void,{express:Application,http:http.Server}> = new Req(undefined,\"REQ_HTTP_SERVER\");\nexport const REQ_INTERNAL_CALL:Req<HTTPRequestVO,IError|any> = new Req(undefined,\"REQ_INTERNAL_CALL\");\n\n\nconst activeServices:String[]=[]\nconst entryPoints:String[]=[]\n\nexport async function Initializer(services:IBaseService[]){\n for (let i of services) { await i.init();activeServices.push(i.getName()) }\n for (let i of services) { i.applicationReady() }\n}\n\nexport class APIService extends BaseService {\n\n\t// NET LOG\n\tprivate static nextLogID=0;\n\tprivate version = \"2.4.9\"\n\tprivate options:APIServiceOptions;\n\tprivate monitor?:Monitor\n\tprivate monitorIndexFile?:Buffer\n\tprivate started:Date = new Date();\n\tprivate requestsCount=0;\n\tprivate server=http\n\n\tnetLog:APIServiceNetworkLogItem[]=[];\n\n\tconstructor(options?:APIServiceOptions|null) {\n\t\tsuper('HTTP Service')\n\t\tthis.options=options ?? getDefaultOptions();\n\t\tif(!this.options.corsHostWhiteList)\n\t\t\tthis.options.corsHostWhiteList=[];\n\t\tconst self = \"http://localhost:\"+this.options.port;\n\t\tif(!this.options.corsHostWhiteList.find(val=>val===self))\n\t\t\tthis.options.corsHostWhiteList.push()\n\n\t\tif(this.options.monitor && this.options.monitor.length>0){\n\t\t\tthis.monitor=new Monitor();\n\t\t\tthis.options.endpoints.push(this.monitor)\n\t\t\tconsole.warn(\"Service Monitor initialized\")\n\t\t\tconsole.warn(\"monitor links:\")\n\t\t\tfor(let i of this.options.monitor){\n\t\t\t\tconst hash = crypto.createHash(\"sha256\").update(i.login+i.password).digest().toString(\"hex\")\n\t\t\t\tconsole.warn(i.login+\" -> /sm-\"+hash)\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t// create liveness, readiness\n\t\tthis.options.endpoints.push(new Liveness(this.started),new Readiness(this.started))\n\t\tREQ_HTTP_REQUESTS_COUNT.listener = async () => this.requestsCount;\n\t}\n\n\n\toverride async init(): Promise<void> {\n\n\t\tREQ_HTTP_LOG.listener=async ignore=>this.netLog;\n\t\tREQ_CREATE_NET_LOG.listener = async ignore=>{\n\t\t\tconst log:APIServiceNetworkLogItem = {\n\t\t\t\tcreated: +new Date(),\n\t\t\t\ttime: 0,\n\t\t\t\trequest: {},\n\t\t\t\tresponse: {},\n\t\t\t\terror:null,\n\t\t\t\tid: APIService.nextLogID++\n\t\t\t}\n\t\t\tthis.netLog.push(log)\n\t\t\tif(this.netLog.length>1000)\n\t\t\t\tthis.netLog.shift()\n\t\t\treturn log;\n\t\t}\n\n\t\t// internal call\n\t\tREQ_INTERNAL_CALL.listener = async (req)=>{\n\t\t\tfor(let i of this.options.endpoints){\n\t\t\t\tif(!i || !i.endpoints)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor(let j of i.endpoints){\n\t\t\t\t\tlet ep = BaseEndpoint.getEntryPoint()+j.endpoint;\n\t\t\t\t\tep = ep.replaceAll(\"//\",\"/\")\n\t\t\t\t\tif(ep=== req.endpoint){\n\t\t\t\t\t\tconst response = await i.execute(req)\n\t\t\t\t\t\tif(response.error)\n\t\t\t\t\t\t\treturn response.error;\n\t\t\t\t\t\treturn response.data;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {error:DefaultErrors.UNKNOWN_REQUEST,data:null,httpStatus:404}\n\t\t}\n\n\t\t// initialize express\n\t\tconst app = express()\n\t\tconst server = http.createServer(app);\n\n\t\tREQ_HTTP_SERVER.listener = async ignore=>{return {express:app,http:server}};\n\n\t\tif(this.options.isProductionEnvironment)\n\t\t\tapp.set(\"env\",'production');\n\n\t\tapp.use(express.json({ limit: '10mb' })) // for parsing application/json\n\t\tapp.use(express.urlencoded({ limit: '10mb', extended: true })) // for parsing application/x-www-form-urlencoded\n\n\t\tapp.use(fileUpload({\n\t\t\tlimitHandler: (req, res, next)=>{\n\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,{\n\t\t\t\t\terror:DefaultErrors.FILE_TOO_LARGE,\n\t\t\t\t\tdata:null,\n\t\t\t\t\thttpStatus:413,\n\t\t\t\t},+new Date(),req.path);\n\t\t\t},\n\t\t\tlimits: { fileSize: this.options.fileLimit },\n\t\t\tuseTempFiles: true,\n\t\t\turiDecodeFileNames: true,\n\t\t\ttempFileDir: this.options.fileTempDir,\n\t\t\t//safeFileNames: true,\n\t\t\tabortOnLimit:true\n\t\t}))\n\n\t\tapp.use(async (err:any,req:any,resp:any,next:any)=>{\n\t\t\t\n\t\t\tif(!err){\n\t\t\t\tnext();\n\t\t\t\treturn\n\t\t\t}\n\t\t\t\t//request start time\n\t\t\tconst tme = +new Date();\n\t\t\tconst log = await REQ_CREATE_NET_LOG.request();\n\t\t\tlog.request={\n\t\t\t\tmethod:req.method,\n\t\t\t\tdata:\"\",\n\t\t\t\tparams:req.params\n\t\t\t}\n\n\t\t\tlet responseError=DefaultErrors.UNKNOWN_REQUEST;\n\t\t\tif (typeof err === \"object\" && err.status === 400 && 'body' in err && err.type === 'entity.parse.failed') {\n\t\t\t\tresponseError = DefaultErrors.JSON_MALFORMED\n\t\t\t}\n \n\n\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",resp,{\n\t\t\t\terror:responseError,\n\t\t\t\tdata:null,\n\t\t\t\thttpStatus:400\n\t\t\t},tme,\"\",log)\n\n\t\t})\n\n\t\tconst corsOptions = {\n\t\t\torigin: (origin: any, callback: any) => {\n\t\t\t\tconst originIsWhitelisted = this.options.corsHostWhiteList.includes(origin)\n\t\t\t\tcallback(null, originIsWhitelisted)\n\t\t\t},\n\t\t\tcredentials: true\n\t\t}\n\t\tapp.use(cors(corsOptions))\n\n\t\t// registrate endpoints\n\t\tBaseEndpoint.setEntryPoint(this.options.baseEndPoint)\n\t\t\n\t\tfor(let i of this.options.endpoints){\n\t\t\tawait i.init();\n\t\t\tif(!i.endpoints)\n\t\t\t\tcontinue;\n\t\t\tfor(let j of i.endpoints){\n\t\t\t\tlet ep = BaseEndpoint.getEntryPoint()+j.endpoint;\n\t\t\t\tep = ep.replaceAll(\"//\",\"/\")\n\t\t\t\t\n\n\t\t\t\t// incoming request\n\t\t\t\tapp.all(ep,async (req,res)=>{\n\t\t\t\t\tthis.requestsCount++;\n\t\t\t\t\tconst tme = +new Date();\n\t\t\t\t\tlet log:APIServiceNetworkLogItem|null = null;\n\t\t\t\t\tif(!i.ignoreHttpLogging){\n\t\t\t\t\t\tlog = await REQ_CREATE_NET_LOG.request();\n\t\t\t\t\t\tlog.request={\n\t\t\t\t\t\t\turl:req.url,\n\t\t\t\t\t\t\tmethod:req.method,\n\t\t\t\t\t\t\tdata:this.checkDataLength(req.body),\n\t\t\t\t\t\t\tparams:this.checkDataLength(req.params)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst execute = async ()=>{\n\n\t\t\t\t\t\tconst body = req.body;\n\t\t\t\t\t\tif(req.query && typeof req.query === \"object\"){\n\t\t\t\t\t\t\tfor(let i in req.query){\n\t\t\t\t\t\t\t\tbody[i]=req.query[i];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst httpRequest:HTTPRequestVO = {\n\t\t\t\t\t\t\traw:req as IncomingMessage,\n\t\t\t\t\t\t\tmethod:req.method,\n\t\t\t\t\t\t\tdata:req.body,\n\t\t\t\t\t\t\tparams:req.params,\n\t\t\t\t\t\t\theaders:req.headers as any,\n\t\t\t\t\t\t\tendpoint:ep,\n\t\t\t\t\t\t\tfiles:req.files ?? null,\n\t\t\t\t\t\t\treferer:req.get(\"Referer\"),\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(this.options.preproducer){\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tconst preproducerResult = await this.options.preproducer(httpRequest);\n\t\t\t\t\t\t\tif(preproducerResult)\n\t\t\t\t\t\t\t\thttpRequest.preproducerResult = preproducerResult;\n\t\t\t\t\t\t\t}catch(e){\n\t\t\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,{error:{code:10002,message:\"Internal server error\",details:`${e}`},data:null,httpStatus:500},tme,ep,log,httpRequest);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet result\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t// Execute interceptor if exists\n\t\t\t\t\t\t\tif(!j.ignoreInterceptor){\n\t\t\t\t\t\t\t\tlet interceptorResult;\n\t\t\t\t\t\t\t\tif(this.options.interceptor){\n\t\t\t\t\t\t\t\t\tinterceptorResult=await this.options.interceptor.execute(httpRequest);\n\t\t\t\t\t\t\t\t\tif(interceptorResult.error && !j.allowInterceptorError){\n\t\t\t\t\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,interceptorResult,tme,ep,log,httpRequest);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thttpRequest.interceptorResult = interceptorResult\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Precheck\n\t\t\t\t\t\t\tif(i === this.monitor)\n\t\t\t\t\t\t\t\thttpRequest.precheck={data:this.options.monitor}\n\n\t\t\t\t\t\t\tconst precheck=await i.precheck(httpRequest)\n\t\t\t\t\t\t\tif(precheck && precheck.error){\n\t\t\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,precheck,tme,ep,log,httpRequest);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thttpRequest.precheck=precheck;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// If interceptor has no errors, execute main handler\n\t\t\t\t\t\t\tresult = await i.execute(httpRequest)\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t}catch(e){\n\t\t\t\t\t\t\tconsole.error(e);\n\t\t\t\t\t\t\tif(this.options.onError)\n\t\t\t\t\t\t\t\tthis.options.onError(e)\n\t\t\t\t\t\t\tif(this.monitor)\n\t\t\t\t\t\t\t\tthis.monitor.registrateFatalError(ep);\n\t\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,{\n\t\t\t\t\t\t\t\thttpStatus:500,\n\t\t\t\t\t\t\t\terror:{\n\t\t\t\t\t\t\t\t\tcode:10002,\n\t\t\t\t\t\t\t\t\tmessage:\"Internal server error\",\n\t\t\t\t\t\t\t\t\tdetails:`${e}`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},tme,ep,log,httpRequest);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,result,tme,ep,log,httpRequest);\n\t\t\t\t\t}\n\n\t\t\t\t\texecute()\n\t\t\t\t});// handle incoming request\n\n\t\t\t}\n\t\t}\n\n\t\n\n\t\t// final handler\n\t\tapp.use((req, res, next) => {\n\t\t\t\n\t\t\tconst tme = +new Date()\n\n\t\t\tif(this.monitor && this.options && this.options.monitor){\n\t\t\t\t//check if requesting monitor\n\t\t\t\tif(req.method===\"GET\"){\n\t\t\t\t\t\n\t\t\t\t\tlet monitorRequest=false;\n\t\t\t\t\tfor(let i of this.options.monitor){\n\t\t\t\t\t\tconst hash = crypto.createHash(\"sha256\").update(i.login+i.password).digest().toString(\"hex\")\n\t\t\t\t\t\tif(req.originalUrl.endsWith(\"/sm-\"+hash)){\n\t\t\t\t\t\t\tmonitorRequest=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(monitorRequest){\n\t\t\t\t\t\t// send index Thu, 16 Nov 2023 23:33:35 GMT\n\t\t\t\t\t\tconst date = new Date();\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tif(!this.monitorIndexFile)\n\t\t\t\t\t\t\tthis.monitorIndexFile = fs.readFileSync(path.resolve(__dirname,\"monitor\",\"index.html\"));\n\t\t\t\t\t\t\tres.setHeader(\"Content-Type\",\"text/html\")\n\t\t\t\t\t\t\tres.setHeader(\"Content-Length\",this.monitorIndexFile.byteLength)\n\t\t\t\t\t\t\tres.status(200).send(this.monitorIndexFile);\n\t\t\t\t\t\t}catch(e){\n\t\t\t\t\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,{\n\t\t\t\t\t\t\t\terror:{\n\t\t\t\t\t\t\t\t\tcode:10002,\n\t\t\t\t\t\t\t\t\tmessage:\"Internal server error\",\n\t\t\t\t\t\t\t\t\tdetails:`${e}`\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata:null,\n\t\t\t\t\t\t\t\thttpStatus:500\n\t\t\t\t\t\t\t},tme,req.path);\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\n\t\t\tthis.sendResponse(req.get(\"Referer\")??\"\",res,{\n\t\t\t\terror:DefaultErrors.UNKNOWN_REQUEST,\n\t\t\t\tdata:null,\n\t\t\t\thttpStatus:404\n\t\t\t},tme,req.path);\n\t\t})\n\n\t\tserver.listen(this.options.port, () => {\n\t\t\tlogCrit('${APIService.js}','API Service started at: '+this.options.port+\", with base endpoint:\"+this.options.baseEndPoint+\", ver.: \"+this.version)\n\t\t})\n\n\t\t/*app.listen(this.options.port, () => {\n\t\t\tlogCrit('${APIService.js}','API Service started at: '+this.options.port+\", with base endpoint:\"+this.options.baseEndPoint+\", ver.: \"+this.version)\n\t\t})*/\n\t}\n\n\tasync sendResponse(ref:string,res:Response,data:TransferPacketVO<any>,requestTime:number,endpoint?:string,log?:APIServiceNetworkLogItem|null,req?:HTTPRequestVO){\n\n\t\tif(this.options.postproducer){\n\t\t\ttry{\n\t\t\t\tdata = await this.options.postproducer(req,res,data,requestTime,endpoint,log);\n\t\t\t}catch(e){\n\t\t\t\tlogError(\"Postproducer error\",e)\n\t\t\t}\n\t\t}\n\n\t\tif(ErrorUtils.isError(data))\n\t\t\tdata = {error:data as IError,data:null}\n\t\t\n data.responseTime = (+new Date()) - requestTime;\n data.core = this.version\n data.endpoint = endpoint ?? \"no_endpoint\"\n\t\t\n\t\tif(this.options.appVersion)\n\t\t\tdata.version=this.options.appVersion\n\n\t\t\n\t\tif(log){\n\t\t\tlog.time = data.responseTime\n\t\t\tlog.referer=ref;\n\t\t}\n\n\t\tif(this.monitor)\n\t\t\tthis.monitor.registrateResponse(data.endpoint,data.responseTime)\n\n if(res.destroyed || res.closed){\n\n\t\t\tif(log)\n\t\t\t\tlog.error = \"Connection already closed, can't send response for: \"+data.endpoint\n\t\t\tif(this.options.onError)\n \tthis.options.onError(\"Connection already closed, can't send response: \"+data.endpoint,data)\n \n\t\t\tif(this.monitor)\n\t\t\t\tthis.monitor.registrateError(data.endpoint);\n\n }else{\n\t\t\ttry{\n\n\t\t\t\tif(data.file){\n\n\t\t\t\t\tres.sendFile(data.file,err=>{\n\t\t\t\t\t\tif(err){\n\t\t\t\t\t\t\tif(log)\n\t\t\t\t\t\t\t\tlog.error = \"Can't send file: \"+data.file\n\t\t\t\t\t\t\tif(this.options.onError)\n\t\t\t\t\t\t\t\tthis.options.onError(\"Can't send file: \"+data.file,err)\n\t\t\t\t\t\t\tif(this.monitor && data.endpoint)\n\t\t\t\t\t\t\t\tthis.monitor.registrateAPIError(data.endpoint);\n\n\t\t\t\t\t\t\tthis.sendResponse(ref,res,{\n\t\t\t\t\t\t\t\terror:DefaultErrors.CANT_SEND_FILE,\n\t\t\t\t\t\t\t\tdata:null,\n\t\t\t\t\t\t\t\thttpStatus:500\n\t\t\t\t\t\t\t},requestTime,data.endpoint);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t})\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(data.redirect){\n\t\t\t\t\tres.redirect(data.redirect);\n\t\t\t\t\tif(log)\n\t\t\t\t\t\tlog.response = {redirect:data.redirect}\n\t\t\t\t}else{\n\t\t\t\t\t// setup headers\n\t\t\t\t\tif(data.headers){\n\t\t\t\t\t\tfor(let i in data.headers)\n\t\t\t\t\t\t\tres.setHeader(i,data.headers[i]);\n\t\t\t\t\t}\n\n\t\t\t\t\tif(data.error && data.error.httpStatus && data.error.httpStatus>99)\n\t\t\t\t\t\tres.statusCode = data.error.httpStatus\n\t\t\t\t\telse\n\t\t\t\t\t\tres.statusCode=data.httpStatus ?? 200\n\t\t\t\t\t\n\t\t\t\t\tif(data.rawResponse){\n\t\t\t\t\t\tres.send(data.data)\n\t\t\t\t\t\tif(log)\n\t\t\t\t\t\t\tlog.response = this.checkDataLength(data)\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tres.send(data);\n\t\t\t\t\t\tif(log)\n\t\t\t\t\t\t\tlog.response = this.checkDataLength(data)\n\n\t\t\t\t\t\tif(data.error && this.monitor)\n\t\t\t\t\t\t\tthis.monitor.registrateAPIError(data.endpoint)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(e){\n\t\t\t\tif(this.options.onError)\n\t\t\t\t\tthis.options.onError(\"Can't send response\",e);\n\t\t\t\tif(log)\n\t\t\t\t\tlog.error=\"Can't send response\"\n\t\t\t\tif(this.monitor)\n\t\t\t\t\tthis.monitor.registrateError(data.endpoint);\n\t\t\t}\n\t\t}\n\n\t\t// show log\n\t\tif(this.options.onNetworkLog && log)\n\t\t\tthis.options.onNetworkLog(log)\n }\n\n\n\tcheckDataLength(data:any,result?:any,lvl?:number):any{\n\t\t\n\t\tif(!lvl)\n\t\t\tlvl=0;\n\n\t\tif(typeof data !== \"object\"){\n\t\t\tif(typeof data===\"string\" && data.length>1024)\n\t\t\t\treturn data.substring(0,1000)+\"... (total:\" + data.length + \")\"\n\t\t\treturn data;\n\t\t}\n\n\t\tif(typeof data === \"object\"){\n\t\t\tif(!result)\n\t\t\t\tresult={};\n\t\t\tlet arrcnt = 100;\n\t\t\tfor(let i in data){\n\t\t\t\tresult[i]=this.checkDataLength(data[i],result[i],lvl+1);\n\t\t\t\tarrcnt--;\n\t\t\t\tif(arrcnt<=0){\n\t\t\t\t\tresult[\"...\"]=\"... total: \"+Array.isArray(data)?data.length:Object.keys(data).length;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result ?? null;\n\t}\n\n}\n"]}
|
@@ -80,3 +80,4 @@ class BaseEndpoint {
|
|
80
80
|
}
|
81
81
|
}
|
82
82
|
exports.BaseEndpoint = BaseEndpoint;
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFzZUVuZHBvaW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FwaVNlcnZlci9CYXNlRW5kcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsNkNBQXlEO0FBQ3pELCtFQUF1RDtBQXFCdkQsTUFBYSxZQUFZO0lBRWIsc0JBQXNCLEdBQVUsRUFBRSxDQUFDO0lBRTNDLFNBQVMsQ0FBb0I7SUFDdEIsaUJBQWlCLEdBQUcsS0FBSyxDQUFBO0lBQ3hCLE1BQU0sQ0FBQyxVQUFVLEdBQVEsR0FBRyxDQUFDO0lBQzdCLFFBQVEsR0FBQyxFQUFFLENBQUE7SUFJbkIsTUFBTSxDQUFDLGFBQWEsR0FBQyxDQUFDLEVBQVMsRUFBQyxFQUFFO1FBQzlCLElBQUksQ0FBQyxVQUFVLEdBQUcsRUFBRSxDQUFDO1FBQ3JCLElBQUcsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsRUFBQztZQUM5QixJQUFJLENBQUMsVUFBVSxJQUFFLEdBQUcsQ0FBQTtTQUN2QjtRQUNELElBQUcsQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLEdBQUcsQ0FBQztZQUNsQixJQUFJLENBQUMsVUFBVSxHQUFDLEdBQUcsR0FBQyxFQUFFLENBQUM7SUFDL0IsQ0FBQyxDQUFBO0lBQ0Q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biAgICBcblxuICAgIHJlZ2lzdGVyRW5kcG9pbnRzKGVuZHBvaW50czpJRW5kcG9pbnRIYW5kbGVyW10pe1xuICAgICAgICBmb3IobGV0IGkgb2YgZW5kcG9pbnRzKXtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgLy8gYmFzZSBwb2ludFxuICAgICAgICAgICAgaWYoaS5lbmRwb2ludD09PVwiXCIgfHwgaS5lbmRwb2ludD09PVwiL1wiKXtcbiAgICAgICAgICAgICAgICBsZXQgZW1wdHk9aS5lbmRwb2ludCA9PT0gXCJcIjtcbiAgICAgICAgICAgICAgICBpLmVuZHBvaW50PXRoaXMuZW5kcG9pbnRcbiAgICAgICAgICAgICAgICBpZihpLmVuZHBvaW50LmVuZHNXaXRoKFwiL1wiKSAmJiBlbXB0eSlcbiAgICAgICAgICAgICAgICAgICAgaS5lbmRwb2ludD1pLmVuZHBvaW50LnN1YnN0cmluZygwLGkuZW5kcG9pbnQubGVuZ3RoLTEpXG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmKGkuZW5kcG9pbnQuc3RhcnRzV2l0aChcIi9cIikpXG4gICAgICAgICAgICAgICAgaS5lbmRwb2ludCA9IGkuZW5kcG9pbnQuc3Vic3RyaW5nKDEpXG4gICAgICAgICAgICBpZihpLmVuZHBvaW50LmVuZHNXaXRoKFwiL1wiKSlcbiAgICAgICAgICAgICAgICBpLmVuZHBvaW50PWkuZW5kcG9pbnQuc3Vic3RyaW5nKDAsaS5lbmRwb2ludC5sZW5ndGgtMSlcblxuICAgICAgICAgICAgaWYoIWkuaW5kZXBlbmRlZClcbiAgICAgICAgICAgICAgICBpLmVuZHBvaW50ID0gdGhpcy5lbmRwb2ludCtpLmVuZHBvaW50XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5lbmRwb2ludHMgPWVuZHBvaW50cztcbiAgICB9XG5cbiAgICBcbiAgICBhc3luYyBpbml0KCl7XG4gICAgICAgIGl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4gICAgICAgICAgICAgICAgbGV0IHRhcmdldEVQID0gQmFzZUVuZHBvaW50LmVudHJ5cG9pbnQraS5lbmRwb2ludFxuICAgICAgICAgICAgICAgIHRhcmdldEVQID0gdGFyZ2V0RVAucmVwbGFjZUFsbChcIi8vXCIsXCIvXCIpXG4gICAgICAgICAgICAgICAgaWYoIHRhcmdldEVQID09PSByZXEuZW5kcG9pbnQgJiYgaS5oYW5kbGVyICYmIHR5cGVvZiBpLmhhbmRsZXIgPT09XCJmdW5jdGlvblwiKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5oYW5kbGVyLmNhbGwodGhpcyxyZXEpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsb2dXYXJuKFwiJHtCYXNlRW5kcG9pbnQuanN9XCIsXCJVbmhhbmRsZWQgZW50cnlwb2ludDogXCIrdGhpcy5lbmRwb2ludClcbiAgICAgICAgXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBlcnJvcjpEZWZhdWx0RXJyb3JzLk5PVF9JTVBMRU1FTlRFRCxcbiAgICAgICAgICAgIGRhdGE6bnVsbFxuICAgICAgICB9XG4gICAgfVxufSJdfQ==
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"BaseEndpoint.js","sourceRoot":"","sources":["../../src/apiServer/BaseEndpoint.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyD;AACzD,+EAAuD;AAqBvD,MAAa,YAAY;IAEb,sBAAsB,GAAU,EAAE,CAAC;IAE3C,SAAS,CAAoB;IACtB,iBAAiB,GAAG,KAAK,CAAA;IACxB,MAAM,CAAC,UAAU,GAAQ,GAAG,CAAC;IAC7B,QAAQ,GAAC,EAAE,CAAA;IAInB,MAAM,CAAC,aAAa,GAAC,CAAC,EAAS,EAAC,EAAE;QAC9B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,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;gBACxB,IAAI,QAAQ,GAAG,YAAY,CAAC,UAAU,GAAC,CAAC,CAAC,QAAQ,CAAA;gBACjD,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAC,GAAG,CAAC,CAAA;gBACxC,IAAI,QAAQ,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI,UAAU;oBACxE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAC,GAAG,CAAC,CAAA;aACtC;SACJ;QAED,IAAA,oBAAO,EAAC,oBAAoB,EAAC,wBAAwB,GAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEpE,OAAO;YACH,KAAK,EAAC,uBAAa,CAAC,eAAe;YACnC,IAAI,EAAC,IAAI;SACZ,CAAA;IACL,CAAC;;AAzFL,oCA0FC","sourcesContent":["import { logCrit, logInfo, logWarn } from \"./LogService\";\nimport DefaultErrors from \"./structures/DefaultErrors\";\nimport { HTTPRequestVO, TransferPacketVO } from \"./structures/Interfaces\";\n\n\nexport interface IBaseEndpoint{\n endpoints?:IEndpointHandler[]\n execute:(req:HTTPRequestVO)=>Promise<TransferPacketVO<any>>\n precheck:(req:HTTPRequestVO)=>Promise<TransferPacketVO<any>|null>\n init:() => Promise<void>\n ignoreHttpLogging:boolean,\n}\n\nexport interface IEndpointHandler{\n endpoint:string,\n handler?:(req:HTTPRequestVO)=>Promise<TransferPacketVO<any>>\n ignoreInterceptor?:boolean\n independed?:boolean\n allowInterceptorError?:boolean\n httpMethod?:\"GET\"|\"POST\"|\"PUT\"|\"DELETE\"\n}\n\nexport class BaseEndpoint implements IBaseEndpoint{\n\n private inializedEndpointNames:String[]=[];\n\n endpoints?:IEndpointHandler[]\n public ignoreHttpLogging = false\n private static entrypoint:string=\"/\";\n private endpoint=\"\"\n \n\n // global entrypoint\n static setEntryPoint=(ep:string)=>{\n this.entrypoint = ep;\n if(!this.entrypoint.endsWith(\"/\")){\n this.entrypoint+=\"/\"\n }\n if(!ep.startsWith(\"/\"))\n this.entrypoint=\"/\"+ep;\n }\n static getEntryPoint=():string=>{\n return this.entrypoint;\n }\n \n constructor(endpoint:string){\n if(endpoint.startsWith(\"/\"))\n endpoint=endpoint.substring(1)\n if(!endpoint.endsWith(\"/\"))\n endpoint=endpoint+\"/\"\n this.endpoint=endpoint;\n }\n \n\n registerEndpoints(endpoints:IEndpointHandler[]){\n for(let i of endpoints){\n \n // base point\n if(i.endpoint===\"\" || i.endpoint===\"/\"){\n let empty=i.endpoint === \"\";\n i.endpoint=this.endpoint\n if(i.endpoint.endsWith(\"/\") && empty)\n i.endpoint=i.endpoint.substring(0,i.endpoint.length-1)\n continue;\n }\n\n if(i.endpoint.startsWith(\"/\"))\n i.endpoint = i.endpoint.substring(1)\n if(i.endpoint.endsWith(\"/\"))\n i.endpoint=i.endpoint.substring(0,i.endpoint.length-1)\n\n if(!i.independed)\n i.endpoint = this.endpoint+i.endpoint\n }\n this.endpoints =endpoints;\n }\n\n \n async init(){\n if(!this.endpoints){\n logCrit(\"${BaseEndpoint.js}\",\"No endpoints registered for \"+this.endpoint)\n return;\n }\n for(let i of this.endpoints){\n logInfo(\"${BaseEndpoint.js}\",\"endpoint: \"+i.endpoint+\" initalized, ignoreInterceptor: \"+(i.ignoreInterceptor ?? \"false\"));\n this.inializedEndpointNames.push(i.endpoint+\" ignore interceptor: \"+(i.ignoreInterceptor ?? \"false\"))\n }\n };\n\n getInitalizedEndpointNames():String[]{\n return this.inializedEndpointNames;\n }\n\n async precheck(req:HTTPRequestVO):Promise<TransferPacketVO<any>|null>{return null}\n\n async execute(req:HTTPRequestVO):Promise<TransferPacketVO<any>>{\n if(this.endpoints && this.endpoints.length>0){\n for(let i of this.endpoints){\n let targetEP = BaseEndpoint.entrypoint+i.endpoint\n targetEP = targetEP.replaceAll(\"//\",\"/\")\n if( targetEP === req.endpoint && i.handler && typeof i.handler ===\"function\")\n return i.handler.call(this,req)\n }\n }\n\n logWarn(\"${BaseEndpoint.js}\",\"Unhandled entrypoint: \"+this.endpoint)\n \n return {\n error:DefaultErrors.NOT_IMPLEMENTED,\n data:null\n }\n }\n}"]}
|
@@ -15,3 +15,4 @@ class BaseService {
|
|
15
15
|
applicationReady() { }
|
16
16
|
}
|
17
17
|
exports.BaseService = BaseService;
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFzZVNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXBpU2VydmVyL0Jhc2VTZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQU1BLE1BQWEsV0FBVztJQUVaLElBQUksQ0FBUTtJQUN0QixZQUFhLElBQVk7UUFDdkIsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUE7SUFDbEIsQ0FBQztJQUVELEtBQUssQ0FBQyxJQUFJO1FBQ1IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLEdBQUMsSUFBSSxDQUFDLElBQUksR0FBQyxjQUFjLENBQUMsQ0FBQztJQUNwRCxDQUFDO0lBRUQsT0FBTztRQUNMLE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQztJQUNuQixDQUFDO0lBRUQsZ0JBQWdCLEtBQVksQ0FBQztDQUM5QjtBQWhCRCxrQ0FnQkMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIElCYXNlU2VydmljZSB7XG4gIGluaXQ6ICgpID0+IFByb21pc2U8dm9pZD5cbiAgYXBwbGljYXRpb25SZWFkeTogKCkgPT4gdm9pZFxuICBnZXROYW1lOiAoKSA9PiBzdHJpbmdcbn1cblxuZXhwb3J0IGNsYXNzIEJhc2VTZXJ2aWNlIGltcGxlbWVudHMgSUJhc2VTZXJ2aWNlIHtcblxuICBwcm90ZWN0ZWQgbmFtZTogc3RyaW5nXG4gIGNvbnN0cnVjdG9yIChuYW1lOiBzdHJpbmcpIHtcbiAgICB0aGlzLm5hbWUgPSBuYW1lXG4gIH1cblxuICBhc3luYyBpbml0ICgpOiBQcm9taXNlPHZvaWQ+IHsgXG4gICAgY29uc29sZS5sb2coXCJTZXJ2aWNlOiBcIit0aGlzLm5hbWUrXCIgaW5pdGlhbGl6ZWRcIik7XG4gIH1cbiAgXG4gIGdldE5hbWUoKTpzdHJpbmd7XG4gICAgcmV0dXJuIHRoaXMubmFtZTtcbiAgfVxuXG4gIGFwcGxpY2F0aW9uUmVhZHkgKCk6IHZvaWQgeyB9XG59XG4iXX0=
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../../src/apiServer/BaseService.ts"],"names":[],"mappings":";;;AAMA,MAAa,WAAW;IAEZ,IAAI,CAAQ;IACtB,YAAa,IAAY;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,CAAC,GAAG,CAAC,WAAW,GAAC,IAAI,CAAC,IAAI,GAAC,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,gBAAgB,KAAY,CAAC;CAC9B;AAhBD,kCAgBC","sourcesContent":["export interface IBaseService {\n init: () => Promise<void>\n applicationReady: () => void\n getName: () => string\n}\n\nexport class BaseService implements IBaseService {\n\n protected name: string\n constructor (name: string) {\n this.name = name\n }\n\n async init (): Promise<void> { \n console.log(\"Service: \"+this.name+\" initialized\");\n }\n \n getName():string{\n return this.name;\n }\n\n applicationReady (): void { }\n}\n"]}
|
@@ -1,17 +1,30 @@
|
|
1
1
|
import { BaseService } from "./BaseService";
|
2
2
|
import { HUBConnection } from "./cluster/HUBConnection";
|
3
3
|
import Signal, { Req } from "badmfck-signal";
|
4
|
-
|
4
|
+
import { HUBServiceOptions, IWebsocketPacket } from "./HUBService";
|
5
|
+
export interface IParty {
|
6
|
+
name: string;
|
7
|
+
handlers: (Signal<IWebsocketPacket> | Req<IWebsocketPacket, any>)[];
|
8
|
+
}
|
9
|
+
export interface IPartyHost {
|
10
|
+
url: string;
|
11
|
+
publicKey: string;
|
5
12
|
id: string;
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
13
|
+
}
|
14
|
+
export interface ClusterServiceOptions extends HUBServiceOptions {
|
15
|
+
targetID: string;
|
16
|
+
targetPublicKey: string;
|
17
|
+
targetURL: string;
|
18
|
+
party: IParty[];
|
10
19
|
}
|
11
20
|
export declare class ClusterService extends BaseService {
|
12
21
|
options: ClusterServiceOptions;
|
13
22
|
ws: HUBConnection | null;
|
23
|
+
handlers: (Signal<IWebsocketPacket> | Req<IWebsocketPacket, any>)[];
|
24
|
+
parites: Map<string, IPartyHost>;
|
14
25
|
constructor(opt: ClusterServiceOptions);
|
15
26
|
init(): Promise<void>;
|
27
|
+
close(): Promise<void>;
|
16
28
|
connectToHUB(): Promise<void>;
|
29
|
+
addPartyHost(party: IPartyHost): void;
|
17
30
|
}
|
@@ -8,37 +8,63 @@ const ws_1 = __importDefault(require("ws"));
|
|
8
8
|
const BaseService_1 = require("./BaseService");
|
9
9
|
const LogService_1 = require("./LogService");
|
10
10
|
const HUBConnection_1 = require("./cluster/HUBConnection");
|
11
|
+
const badmfck_signal_1 = __importDefault(require("badmfck-signal"));
|
12
|
+
const DefaultErrors_1 = require("./structures/DefaultErrors");
|
13
|
+
const Sleep_1 = require("./helper/Sleep");
|
11
14
|
class ClusterService extends BaseService_1.BaseService {
|
12
15
|
options;
|
13
16
|
ws = null;
|
17
|
+
handlers = [];
|
18
|
+
parites = new Map();
|
14
19
|
constructor(opt) {
|
15
20
|
super("ClusterService");
|
16
21
|
this.options = opt;
|
17
|
-
|
18
|
-
|
22
|
+
this.handlers = [
|
23
|
+
new badmfck_signal_1.default("S_PARTY_AVAILABLE", undefined, async (req) => {
|
24
|
+
this.addPartyHost(req.data);
|
25
|
+
})
|
26
|
+
];
|
19
27
|
}
|
20
28
|
async init() {
|
21
29
|
(0, LogService_1.logInfo)("ClusterService: initialized");
|
22
30
|
this.connectToHUB();
|
23
31
|
}
|
32
|
+
async close() {
|
33
|
+
(0, LogService_1.logInfo)("ClusterService: closing");
|
34
|
+
if (this.ws)
|
35
|
+
this.ws.close();
|
36
|
+
this.parites.clear();
|
37
|
+
}
|
24
38
|
async connectToHUB() {
|
25
39
|
(0, LogService_1.logInfo)("ClusterService: connecting to HUB");
|
26
40
|
if (this.ws)
|
27
41
|
this.ws.close();
|
28
42
|
this.ws = new HUBConnection_1.HUBConnection({
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
direction: "outgoing",
|
44
|
+
ws: new ws_1.default(this.options.targetURL),
|
45
|
+
hostID: this.options.hostID,
|
46
|
+
hostPrivateKey: this.options.hostPrivateKey,
|
47
|
+
hostPublicKey: this.options.hostPublicKey,
|
48
|
+
hostURL: this.options.hostURL,
|
49
|
+
targetID: this.options.targetID,
|
50
|
+
targetPublicKey: this.options.targetPublicKey,
|
51
|
+
targetURL: this.options.targetURL,
|
52
|
+
handlers: this.handlers,
|
53
|
+
onAuthorized: async () => {
|
54
|
+
(0, LogService_1.logInfo)("ClusterService: connected to HUB");
|
55
|
+
await (0, Sleep_1.Sleep)(1000);
|
56
|
+
const parites = this.options.party.map((party) => party.name);
|
57
|
+
const response = await this.ws?.send({
|
58
|
+
method: "REQ_PARTY",
|
59
|
+
data: parites,
|
60
|
+
callbackID: 1
|
41
61
|
});
|
62
|
+
if (DefaultErrors_1.ErrorUtils.isError(response)) {
|
63
|
+
(0, LogService_1.logError)("ClusterService: error while registrating parties", response);
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
for (let i of response)
|
67
|
+
this.addPartyHost(i);
|
42
68
|
},
|
43
69
|
onClose: () => {
|
44
70
|
console.log("ClusterService: connection to HUB closed");
|
@@ -46,5 +72,10 @@ class ClusterService extends BaseService_1.BaseService {
|
|
46
72
|
},
|
47
73
|
});
|
48
74
|
}
|
75
|
+
addPartyHost(party) {
|
76
|
+
(0, LogService_1.logInfo)("ClusterService: add party host", party);
|
77
|
+
this.parites.set(party.id, party);
|
78
|
+
}
|
49
79
|
}
|
50
80
|
exports.ClusterService = ClusterService;
|
81
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2x1c3RlclNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXBpU2VydmVyL0NsdXN0ZXJTZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLDRDQUF3QztBQUN4QywrQ0FBNEM7QUFDNUMsNkNBQWlEO0FBQ2pELDJEQUF3RTtBQUV4RSxvRUFBNkM7QUFFN0MsOERBQXdEO0FBQ3hELDBDQUF1QztBQTJCdkMsTUFBYSxjQUFlLFNBQVEseUJBQVc7SUFHM0MsT0FBTyxDQUF1QjtJQUM5QixFQUFFLEdBQW9CLElBQUksQ0FBQztJQUMzQixRQUFRLEdBQThELEVBQUUsQ0FBQztJQUN6RSxPQUFPLEdBQTBCLElBQUksR0FBRyxFQUFFLENBQUM7SUFFM0MsWUFBWSxHQUF5QjtRQUNqQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtRQUN2QixJQUFJLENBQUMsT0FBTyxHQUFHLEdBQUcsQ0FBQztRQUVuQixJQUFJLENBQUMsUUFBUSxHQUFHO1lBQ1osSUFBSSx3QkFBTSxDQUFtQixtQkFBbUIsRUFBQyxTQUFTLEVBQUMsS0FBSyxFQUFFLEdBQUcsRUFBQyxFQUFFO2dCQUVwRSxJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQ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gICAgICAgICAgaG9zdFByaXZhdGVLZXk6dGhpcy5vcHRpb25zLmhvc3RQcml2YXRlS2V5LFxuICAgICAgICAgICAgaG9zdFB1YmxpY0tleTp0aGlzLm9wdGlvbnMuaG9zdFB1YmxpY0tleSxcbiAgICAgICAgICAgIGhvc3RVUkw6dGhpcy5vcHRpb25zLmhvc3RVUkwsXG5cbiAgICAgICAgICAgIHRhcmdldElEOnRoaXMub3B0aW9ucy50YXJnZXRJRCxcbiAgICAgICAgICAgIHRhcmdldFB1YmxpY0tleTp0aGlzLm9wdGlvbnMudGFyZ2V0UHVibGljS2V5LFxuICAgICAgICAgICAgdGFyZ2V0VVJMOnRoaXMub3B0aW9ucy50YXJnZXRVUkwsXG5cbiAgICAgICAgICAgIGhhbmRsZXJzOnRoaXMuaGFuZGxlcnMsXG5cbiAgICAgICAgICAgIG9uQXV0aG9yaXplZDphc3luYyAoKT0+e1xuICAgICAgICAgICAgICAgIGxvZ0luZm8oXCJDbHVzdGVyU2VydmljZTogY29ubmVjdGVkIHRvIEhVQlwiKVxuXG4gICAgICAgICAgICAgICAgYXdhaXQgU2xlZXAoMTAwMClcblxuICAgICAgICAgICAgICAgIC8vIHJlZ2lzdHJhdGUgcGFydGllc1xuICAgICAgICAgICAgICAgIGNvbnN0IHBhcml0ZXMgPSB0aGlzLm9wdGlvbnMucGFydHkubWFwKChwYXJ0eSk9PnBhcnR5Lm5hbWUpO1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgdGhpcy53cz8uc2VuZCh7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogXCJSRVFfUEFSVFlcIixcbiAgICAgICAgICAgICAgICAgICAgZGF0YTogcGFyaXRlcyxcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tJRDoxXG4gICAgICAgICAgICAgICAgfSkgYXMgSVBhcnR5SG9zdFtdXG5cbiAgICAgICAgICAgICAgICBpZihFcnJvclV0aWxzLmlzRXJyb3IocmVzcG9uc2UpKXtcbiAgICAgICAgICAgICAgICAgICAgbG9nRXJyb3IoXCJDbHVzdGVyU2VydmljZTogZXJyb3Igd2hpbGUgcmVnaXN0cmF0aW5nIHBhcnRpZXNcIixyZXNwb25zZSlcbiAgICAgICAgICAgICAgICAgICAgLy90b2RvIHJldGFrZSBwYXJpdGVzXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgZm9yKGxldCBpIG9mIHJlc3BvbnNlKVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZFBhcnR5SG9zdChpKTtcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgICAgIFxuICAgICAgICAgICAgb25DbG9zZTooKT0+e1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiQ2x1c3RlclNlcnZpY2U6IGNvbm5lY3Rpb24gdG8gSFVCIGNsb3NlZFwiKVxuICAgICAgICAgICAgICAgIHRoaXMuY29ubmVjdFRvSFVCKCk7XG4gICAgICAgICAgICB9LFxuICAgICAgICB9KVxuICAgIH1cblxuXG4gICAgYWRkUGFydHlIb3N0KHBhcnR5OklQYXJ0eUhvc3Qpe1xuICAgICAgICBsb2dJbmZvKFwiQ2x1c3RlclNlcnZpY2U6IGFkZCBwYXJ0eSBob3N0XCIscGFydHkpXG4gICAgICAgIHRoaXMucGFyaXRlcy5zZXQocGFydHkuaWQscGFydHkpO1xuICAgIH1cblxufSJdfQ==
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ClusterService.js","sourceRoot":"","sources":["../../src/apiServer/ClusterService.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAwC;AACxC,+CAA4C;AAC5C,6CAAiD;AACjD,2DAAwE;AAIxE,8DAAwD;AACxD,0CAAuC;AA2BvC,MAAa,cAAe,SAAQ,yBAAW;IAG3C,OAAO,CAAuB;IAC9B,EAAE,GAAoB,IAAI,CAAC;IAE3B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M,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC;oBACjC,MAAM,EAAE,WAAW;oBACnB,IAAI,EAAE,OAAO;oBACb,UAAU,EAAC,CAAC;iBACf,CAAiB,CAAA;gBAElB,IAAG,0BAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAC;oBAC5B,IAAA,qBAAQ,EAAC,kDAAkD,EAAC,QAAQ,CAAC,CAAA;oBAErE,OAAO;iBACV;gBAED,KAAI,IAAI,CAAC,IAAI,QAAQ;oBACjB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC7B,CAAC;YAGD,OAAO,EAAC,GAAE,EAAE;gBACR,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAA;gBACvD,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAGD,YAAY,CAAC,IAAe;QACxB,IAAA,oBAAO,EAAC,gCAAgC,EAAC,IAAI,CAAC,CAAA;IAClD,CAAC;CAEJ;AA5ED,wCA4EC","sourcesContent":["import WebSocket, { RawData } from \"ws\";\nimport { BaseService } from \"./BaseService\";\nimport { logError, logInfo } from \"./LogService\";\nimport { HUBConnection, IClusterPacket } from \"./cluster/HUBConnection\";\nimport { privateDecrypt } from \"crypto\";\nimport Signal, { Req } from \"badmfck-signal\";\nimport { HUBServiceOptions, IWebsocketPacket } from \"./HUBService\";\nimport { ErrorUtils } from \"./structures/DefaultErrors\";\nimport { Sleep } from \"./helper/Sleep\";\n\n\nexport interface IParty{\n name:string,\n handlers:(Signal<IWebsocketPacket>|Req<IWebsocketPacket,any>)[],\n}\n\nexport interface IPartyHost{\n url:string,\n\tpublicKey:string,\n\tid:string\t\n}\n\n/**\n * ClusterServiceOptions\n * id: string - id of the service, must be sha256 hash or stronger\n * \n */\nexport interface ClusterServiceOptions extends HUBServiceOptions{\n \n targetID:string,\n targetPublicKey:string,\n targetURL:string,\n party:IParty[], // list of ids of parties that I can connect to\n}\n\nexport class ClusterService extends BaseService{\n \n \n options:ClusterServiceOptions;\n ws:HUBConnection|null=null;\n\n parites:Map<string,IParty> = new Map();\n\n constructor(opt:ClusterServiceOptions){\n super(\"ClusterService\")\n this.options = opt;\n }\n\n async init(){\n logInfo(\"ClusterService: initialized\")\n this.connectToHUB();\n }\n\n async connectToHUB(){\n\n logInfo(\"ClusterService: connecting to HUB\")\n\n if(this.ws)\n this.ws.close();\n \n this.ws = new HUBConnection({\n direction:\"outgoing\",\n ws:new WebSocket(this.options.targetURL),\n\n hostID:this.options.hostID,\n hostPrivateKey:this.options.hostPrivateKey,\n hostPublicKey:this.options.hostPublicKey,\n hostURL:this.options.hostURL,\n\n targetID:this.options.targetID,\n targetPublicKey:this.options.targetPublicKey,\n targetURL:this.options.targetURL,\n\n handlers:[],\n\n onAuthorized:async ()=>{\n logInfo(\"ClusterService: connected to HUB\")\n\n await Sleep(1000)\n\n // registrate parties\n const parites = this.options.party.map((party)=>party.name);\n const response = await this.ws?.send({\n method: \"REQ_PARTY\",\n data: parites,\n callbackID:1\n }) as IPartyHost[]\n\n if(ErrorUtils.isError(response)){\n logError(\"ClusterService: error while registrating parties\",response)\n //todo retake parites\n return;\n }\n \n for(let i of response)\n this.addPartyHost(i);\n },\n\n \n onClose:()=>{\n console.log(\"ClusterService: connection to HUB closed\")\n this.connectToHUB();\n },\n })\n }\n\n\n addPartyHost(host:IPartyHost){\n logInfo(\"ClusterService: add party host\",host)\n }\n\n}"]}
|
@@ -180,3 +180,4 @@ new DocumentGenerator({
|
|
180
180
|
savePath: "./bin/",
|
181
181
|
savePathFileName: "doc.json",
|
182
182
|
});
|
183
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRG9jdW1lbnRTZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FwaVNlcnZlci9Eb2N1bWVudFNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXB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,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAErE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IAEM,gBAAgB;QACtB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CA0DD;AAhSD,8CAgSC;AAGD,IAAI,iBAAiB,CAAC;IACrB,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,UAAU;CAC5B,CAAC,CAAC","sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport { parse, Spec } from \"comment-parser\";\n\n//TODO: api endpoint, sourcepath, .doc file - from config\n\ndeclare type DocumentGeneratorConfig = {\n\tsourcePath: string;\n\tapiEndpoint: string;\n\tsavePath: string;\n\tsavePathFileName: string;\n};\n\ndeclare type DocumentGeneratorDocumentation = {\n\t[baseEndpointName: string]: {\n\t\t[endPointName: string]: DocumentGeneratorDocumentationEndpoint;\n\t};\n};\n\ndeclare type DocumentGeneratorDocumentationEndpoint = {\n\thandler: string;\n\tfullPath: string;\n\tignoreInterceptor?: string;\n\n\tdescription?: string;\n\tparameters: DocumentGeneratorDocumentationEndpointParameter[];\n\treturns?: Omit<DocumentGeneratorDocumentationEndpointParameter, \"optional\">;\n\texample?: string[];\n\tthrows?: Omit<DocumentGeneratorDocumentationEndpointParameter, \"optional\">[];\n};\n\ndeclare type DocumentGeneratorDocumentationEndpointParameter = {\n\tname: string;\n\ttype: string;\n\tdescription: string;\n\toptional?: boolean;\n};\n\nexport class DocumentGenerator {\n\tprivate documentation: DocumentGeneratorDocumentation = {};\n\tprivate config: DocumentGeneratorConfig;\n\n\tconstructor(config: DocumentGeneratorConfig) {\n\t\tthis.config = config;\n\n\t\tthis.generateDocumentation();\n\t}\n\n\tprivate getFiles(): string[] {\n\t\treturn fs.readdirSync(this.config.sourcePath);\n\t}\n\n\tprivate getFileContent(file: string) {\n\t\treturn fs.readFileSync(path.resolve(this.config.sourcePath, file), \"utf-8\");\n\t}\n\n\tprivate generateDocumentation = () => {\n\t\tfor (const file of this.getFiles()) {\n\t\t\tconst fileContent = this.getFileContent(file);\n\n\t\t\t// get base endpoint\n\t\t\tconst baseEndpoint = fileContent.match(/super\\(['\"](.*?)['\"]\\)/);\n\t\t\tif (!baseEndpoint) {\n\t\t\t\tconsole.error(`No base endpoint found in ${file}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst nodeEndpoint = this.config.apiEndpoint + \"/\" + baseEndpoint[1];\n\n\t\t\t// get all endpoints\n\t\t\tconst regex = /{\\s*endpoint:\\s*\"(.*?)\",\\s*handler:\\s*this\\.(.*?)(?:,\\s*ignoreInterceptor:\\s*(true|false))?\\s*}/g;\n\n\t\t\tconst endpoints = fileContent.matchAll(regex);\n\n\t\t\tfor (const match of endpoints) {\n\t\t\t\tconst endpointName: string = match[1];\n\t\t\t\tconst handler = match[2];\n\t\t\t\tconst ignoreInterceptor = match[3];\n\n\t\t\t\tif (!this.documentation.hasOwnProperty(nodeEndpoint)) {\n\t\t\t\t\tthis.documentation[nodeEndpoint] = {};\n\t\t\t\t}\n\n\t\t\t\tconst endpoint: DocumentGeneratorDocumentationEndpoint = {\n\t\t\t\t\thandler,\n\t\t\t\t\tignoreInterceptor,\n\t\t\t\t\tfullPath: nodeEndpoint + \"/\" + endpointName,\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tparameters: [],\n\t\t\t\t};\n\n\t\t\t\tthis.documentation[nodeEndpoint][endpointName] = this.parseEndPointComments(\n\t\t\t\t\tthis.getCommentsByEndpoint(fileContent, handler),\n\t\t\t\t\tendpoint,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.saveDocumentation();\n\n\t\tconsole.log(\"Documentation generated and saved successfully\");\n\t};\n\n\tprivate getCommentsByEndpoint(fileContent: string, handler: string): string {\n\t\tlet comments: string = \"\";\n\n\t\t//TODO: change to regex\n\t\t//const regex = new RegExp(`/\\\\*\\\\*([\\\\s\\\\S]*?)\\\\*/\\\\s*async\\\\s+${handler}\\\\s*\\\\(`, \"g\");\n\t\t//const regex = new RegExp(`/\\\\*\\\\*([\\\\s\\\\S]*?)\\\\*\\\\/\\\\s*async\\\\s+${handler}\\\\s*\\\\(`, \"g\");\n\t\t//const match2 = fileContent.match(regex);\n\n\t\t//if (match2) {\n\t\t// \tcomments = match2[0];\n\t\t// \t// formatJavaDoc(match2[0], description);\n\t\t//}\n\n\t\tconst regex = new RegExp(`(async )*${handler}(\\\\s*)\\\\(`, \"g\");\n\t\tconst match = fileContent.match(regex);\n\n\t\tif (match) {\n\t\t\t// const indexHandler = fileContent.indexOf(`async ${handler}(`);\n\t\t\tconst indexHandler = fileContent.indexOf(`${match[0]}`);\n\n\t\t\t// if (indexHandler === -1) {\n\t\t\t// \tindexHandler = fileContent.indexOf(`${handler}(`);\n\t\t\t// }\n\n\t\t\tif (indexHandler != -1) {\n\t\t\t\tconst indexCommentStart = fileContent.lastIndexOf(\"/**\", indexHandler);\n\t\t\t\tif (indexCommentStart != -1) {\n\t\t\t\t\tconst indexCommentEnd = fileContent.indexOf(\"*/\", indexCommentStart);\n\n\t\t\t\t\tif (indexCommentEnd != -1) {\n\t\t\t\t\t\tconst commentsSubstring = fileContent.substring(indexCommentStart, indexCommentEnd + 2);\n\n\t\t\t\t\t\tif (commentsSubstring) {\n\t\t\t\t\t\t\tconst regexToCheckCommentWithMethod = new RegExp(\n\t\t\t\t\t\t\t\t`${commentsSubstring.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}([\\\\s]*?)(async )*${handler}(\\\\s*)\\\\(`,\n\t\t\t\t\t\t\t\t\"g\",\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst matchToCheckCommentWithMethod = fileContent.match(regexToCheckCommentWithMethod);\n\n\t\t\t\t\t\t\tif (matchToCheckCommentWithMethod) {\n\t\t\t\t\t\t\t\tcomments = commentsSubstring;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn comments;\n\t}\n\n\tprivate parseEndPointComments(\n\t\tcomments: string,\n\t\tendpoint: DocumentGeneratorDocumentationEndpoint,\n\t): DocumentGeneratorDocumentationEndpoint {\n\t\tif (comments) {\n\t\t\tconst parsed = parse(comments, { spacing: \"preserve\" });\n\t\t\tif (parsed[0]) {\n\t\t\t\tconst firstParsed = parsed[0];\n\t\t\t\t// console.log(firstParsed.tags);\n\n\t\t\t\tendpoint.description = this.tagModifications(firstParsed.description);\n\n\t\t\t\tfirstParsed.tags.forEach((tag) => {\n\t\t\t\t\tendpoint = this.tagToEndpoint(tag, endpoint);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn endpoint;\n\t}\n\n\t/**\n\t * From comment-parser library to json\n\t *\n\t * @param tag\n\t * @param endpoint\n\t * @returns\n\t */\n\tprivate tagToEndpoint(\n\t\ttag: Spec,\n\t\tendpoint: DocumentGeneratorDocumentationEndpoint,\n\t): DocumentGeneratorDocumentationEndpoint {\n\t\tswitch (tag.tag) {\n\t\t\tcase \"param\":\n\t\t\t\tendpoint.parameters.push({\n\t\t\t\t\tname: this.tagModifications(tag.name, \"name\"),\n\t\t\t\t\ttype: tag.type,\n\t\t\t\t\tdescription: this.tagModifications(tag.description),\n\t\t\t\t\toptional: tag.optional,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"description\":\n\t\t\t\tendpoint.description = this.tagModifications(tag.description);\n\t\t\t\tbreak;\n\t\t\tcase \"example\":\n\t\t\t\tif (!endpoint.example) {\n\t\t\t\t\tendpoint.example = [];\n\t\t\t\t}\n\n\t\t\t\tendpoint.example.push(this.tagModifications(tag.description));\n\t\t\t\tbreak;\n\t\t\tcase \"returns\":\n\t\t\t\tendpoint.returns = {\n\t\t\t\t\tname: this.tagModifications(tag.name, \"name\"),\n\t\t\t\t\ttype: tag.type,\n\t\t\t\t\tdescription: this.tagModifications(tag.description),\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase \"throws\":\n\t\t\t\tif (!endpoint.throws) {\n\t\t\t\t\tendpoint.throws = [];\n\t\t\t\t}\n\n\t\t\t\tendpoint.throws.push({\n\t\t\t\t\tname: this.tagModifications(tag.name, \"name\"),\n\t\t\t\t\ttype: tag.type,\n\t\t\t\t\tdescription: this.tagModifications(tag.description),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn endpoint;\n\t}\n\n\t/**\n\t *\n\t * modification after comment-parser library parsings with \"-\" in description\n\t *\n\t * @param text\n\t * @param field\n\t * @returns\n\t */\n\tprivate tagModifications(text: string, field: string = \"description\"): string {\n\t\tswitch (field) {\n\t\t\tcase \"description\":\n\t\t\t\ttext = text\n\t\t\t\t\t.trim()\n\t\t\t\t\t.replace(/^(\\-.)/, \"\")\n\t\t\t\t\t.trim();\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"name\":\n\t\t\t\tif (text === \"-\") {\n\t\t\t\t\ttext = \"\";\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn text;\n\t}\n\n\tprivate saveDocumentation(): void {\n\t\t// const formatForSave = { data: this.documentation };\n\t\tconst formatForSave = this.documentation;\n\t\tconst filePath = this.config.savePath + this.config.savePathFileName;\n\n\t\tfs.writeFileSync(filePath, JSON.stringify(formatForSave, null, 2));\n\t}\n\n\tpublic getDocumentation(): DocumentGeneratorDocumentation {\n\t\treturn this.documentation;\n\t}\n\n\t// const formatJavaDoc = (comment, finalDescription) => {\n\t// \t// Регулярные выражения для различных частей комментария\n\t// \tconst descriptionRegex = /\\/\\*\\*([\\s\\S]*?)(?=\\s*\\*\\s*@|\\s*\\*\\/)/g;\n\t// \tconst paramRegex = /@param\\s+(\\w+)\\s+([^\\s]+)\\s*-\\s*(.+?)(?=\\s+\\*|$)/g;\n\t// \tconst returnRegex = /@returns?\\s+([^\\s]+)\\s*-\\s*(.+?)(?=\\s+\\*|$)/g;\n\t// \tconst throwsRegex = /@throws\\s+([^\\s]+)\\s*-\\s*(.+?)(?=\\s+\\*|$)/g;\n\t// \tconst seeRegex = /@see\\s+([^\\s]+)(?=\\s+\\*|$)/g;\n\n\t// \t// Извлекаем описание\n\t// \tconst descriptionMatch = descriptionRegex.exec(comment);\n\t// \tconst description = descriptionMatch ? descriptionMatch[1].trim().replace(/\\*\\s+/g, \"\").replace(/\\n/g, \" \") : \"\";\n\n\t// \tfinalDescription.info = description;\n\n\t// \t// Извлекаем параметры\n\t// \tconst params = [];\n\t// \tlet paramMatch;\n\t// \twhile ((paramMatch = paramRegex.exec(comment)) !== null) {\n\t// \t\tparams.push({\n\t// \t\t\tname: paramMatch[1],\n\t// \t\t\ttype: paramMatch[2],\n\t// \t\t\tdescription: paramMatch[3].trim(),\n\t// \t\t});\n\t// \t}\n\t// \tdescription.params = params;\n\n\t// \t// Извлекаем возвращаемое значение\n\t// \tconst returnMatch = returnRegex.exec(comment);\n\t// \tconst returnType = returnMatch ? returnMatch[1] : \"\";\n\t// \tconst returnDescription = returnMatch ? returnMatch[2].trim() : \"\";\n\n\t// \tfinalDescription.return = {\n\t// \t\ttype: returnType,\n\t// \t\tdescription: returnDescription,\n\t// \t};\n\n\t// \t// Извлекаем исключения\n\t// \tconst throws = [];\n\t// \tlet throwsMatch;\n\t// \twhile ((throwsMatch = throwsRegex.exec(comment)) !== null) {\n\t// \t\tthrows.push({\n\t// \t\t\texception: throwsMatch[1],\n\t// \t\t\tdescription: throwsMatch[2].trim(),\n\t// \t\t});\n\t// \t}\n\t// \tdescription.throws = throws;\n\n\t// \t// Извлекаем теги @see\n\t// \tconst seeReferences = [];\n\t// \tlet seeMatch;\n\t// \twhile ((seeMatch = seeRegex.exec(comment)) !== null) {\n\t// \t\tseeReferences.push(seeMatch[1]);\n\t// \t}\n\n\t// \tdescription.see = seeReferences;\n\t// };\n}\n\n// const documentGenerator =\nnew DocumentGenerator({\n\tsourcePath: \"./src/api\",\n\tapiEndpoint: \"api/v1\",\n\tsavePath: \"./bin/\",\n\tsavePathFileName: \"doc.json\",\n});\n\n// console.log(documentGenerator.getDocumentation());"]}
|
@@ -3,9 +3,10 @@ import { HUBConnection } from "./cluster/HUBConnection";
|
|
3
3
|
import Signal, { Req } from "badmfck-signal";
|
4
4
|
import { IError } from "./structures/Interfaces";
|
5
5
|
export interface HUBServiceOptions {
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
hostID: string;
|
7
|
+
hostPublicKey: string;
|
8
|
+
hostPrivateKey: string;
|
9
|
+
hostURL: string;
|
9
10
|
}
|
10
11
|
export interface IClusterNode {
|
11
12
|
clusterID: string;
|
@@ -13,6 +14,12 @@ export interface IClusterNode {
|
|
13
14
|
publicKey: string;
|
14
15
|
privateKey: string;
|
15
16
|
ws: HUBConnection[];
|
17
|
+
watchlist: string[];
|
18
|
+
}
|
19
|
+
export interface IWebsocketPacket<T = any> {
|
20
|
+
data: T;
|
21
|
+
authorized: boolean;
|
22
|
+
connection: HUBConnection;
|
16
23
|
}
|
17
24
|
export declare const REQ_CLUSTER_NODE: Req<string, IError | {
|
18
25
|
url: string;
|
@@ -21,7 +28,7 @@ export declare const REQ_CLUSTER_NODE: Req<string, IError | {
|
|
21
28
|
export declare class HUBService extends BaseService {
|
22
29
|
options: HUBServiceOptions;
|
23
30
|
nodes: Map<string, IClusterNode>;
|
24
|
-
handlers: (Signal<
|
31
|
+
handlers: (Signal<IWebsocketPacket> | Req<IWebsocketPacket, any>)[];
|
25
32
|
constructor(options: HUBServiceOptions);
|
26
33
|
init(): Promise<void>;
|
27
34
|
applicationReady(): Promise<void>;
|