Clear JS executor dependencies and code
This commit is contained in:
parent
0a1f377347
commit
d35bdcc981
@ -18,7 +18,7 @@ import config from 'config';
|
|||||||
import { _logger } from '../config/logger';
|
import { _logger } from '../config/logger';
|
||||||
import { JsExecutor, TbScript } from './jsExecutor';
|
import { JsExecutor, TbScript } from './jsExecutor';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import { isString, parseJsErrorDetails, toUUIDString, UUIDFromBuffer, UUIDToBits, isNotUUID } from './utils';
|
import { isString, parseJsErrorDetails, toUUIDString, UUIDFromBuffer, UUIDToBits } from './utils';
|
||||||
import { IQueue } from '../queue/queue.models';
|
import { IQueue } from '../queue/queue.models';
|
||||||
import {
|
import {
|
||||||
JsCompileRequest,
|
JsCompileRequest,
|
||||||
@ -306,7 +306,6 @@ export class JsInvokeMessageProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static createCompileResponse(scriptId: string, success: boolean, errorCode?: number, err?: any): JsCompileResponse {
|
private static createCompileResponse(scriptId: string, success: boolean, errorCode?: number, err?: any): JsCompileResponse {
|
||||||
if (isNotUUID(scriptId)) {
|
|
||||||
return {
|
return {
|
||||||
errorCode: errorCode,
|
errorCode: errorCode,
|
||||||
success: success,
|
success: success,
|
||||||
@ -315,17 +314,6 @@ export class JsInvokeMessageProcessor {
|
|||||||
scriptIdLSB: "0",
|
scriptIdLSB: "0",
|
||||||
scriptHash: scriptId
|
scriptHash: scriptId
|
||||||
};
|
};
|
||||||
} else { // this is for backward compatibility (to be able to work with tb-node of previous version) - todo: remove in the next release
|
|
||||||
let scriptIdBits = UUIDToBits(scriptId);
|
|
||||||
return {
|
|
||||||
errorCode: errorCode,
|
|
||||||
success: success,
|
|
||||||
errorDetails: parseJsErrorDetails(err),
|
|
||||||
scriptIdMSB: scriptIdBits[0],
|
|
||||||
scriptIdLSB: scriptIdBits[1],
|
|
||||||
scriptHash: ""
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createInvokeResponse(result: string | undefined, success: boolean, errorCode?: number, err?: any): JsInvokeResponse {
|
private static createInvokeResponse(result: string | undefined, success: boolean, errorCode?: number, err?: any): JsInvokeResponse {
|
||||||
@ -338,22 +326,12 @@ export class JsInvokeMessageProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static createReleaseResponse(scriptId: string, success: boolean): JsReleaseResponse {
|
private static createReleaseResponse(scriptId: string, success: boolean): JsReleaseResponse {
|
||||||
if (isNotUUID(scriptId)) {
|
|
||||||
return {
|
return {
|
||||||
success: success,
|
success: success,
|
||||||
scriptIdMSB: "0",
|
scriptIdMSB: "0",
|
||||||
scriptIdLSB: "0",
|
scriptIdLSB: "0",
|
||||||
scriptHash: scriptId,
|
scriptHash: scriptId,
|
||||||
};
|
};
|
||||||
} else { // todo: remove in the next release
|
|
||||||
let scriptIdBits = UUIDToBits(scriptId);
|
|
||||||
return {
|
|
||||||
success: success,
|
|
||||||
scriptIdMSB: scriptIdBits[0],
|
|
||||||
scriptIdLSB: scriptIdBits[1],
|
|
||||||
scriptHash: ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getScriptId(request: TbMessage): string {
|
private static getScriptId(request: TbMessage): string {
|
||||||
|
|||||||
@ -59,10 +59,6 @@ export function parseJsErrorDetails(err: any): string | undefined {
|
|||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNotUUID(candidate: string) {
|
|
||||||
return candidate.length != 36 || !candidate.includes('-');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isNotEmptyStr(value: any): boolean {
|
export function isNotEmptyStr(value: any): boolean {
|
||||||
return typeof value === 'string' && value.trim().length > 0;
|
return typeof value === 'string' && value.trim().length > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,17 +13,12 @@
|
|||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sqs": "^3.682.0",
|
|
||||||
"@azure/service-bus": "^7.9.5",
|
|
||||||
"@google-cloud/pubsub": "^4.8.0",
|
|
||||||
"amqplib": "^0.10.4",
|
|
||||||
"config": "^3.3.12",
|
"config": "^3.3.12",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"kafkajs": "^2.2.4",
|
"kafkajs": "^2.2.4",
|
||||||
"long": "^5.2.3",
|
"long": "^5.2.3",
|
||||||
"uuid-parse": "^1.1.0",
|
"uuid-parse": "^1.1.0",
|
||||||
"uuid-random": "^1.3.2",
|
|
||||||
"winston": "^3.16.0",
|
"winston": "^3.16.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0"
|
"winston-daily-rotate-file": "^5.0.0"
|
||||||
},
|
},
|
||||||
@ -36,7 +31,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/amqplib": "^0.10.5",
|
|
||||||
"@types/config": "^3.3.5",
|
"@types/config": "^3.3.5",
|
||||||
"@types/express": "~4.17.21",
|
"@types/express": "~4.17.21",
|
||||||
"@types/node": "~20.17.6",
|
"@types/node": "~20.17.6",
|
||||||
|
|||||||
@ -35,7 +35,6 @@ import { KeyObject } from 'tls';
|
|||||||
|
|
||||||
import process, { exit, kill } from 'process';
|
import process, { exit, kill } from 'process';
|
||||||
|
|
||||||
// TODO: remove dependencies for other queue types
|
|
||||||
export class KafkaTemplate implements IQueue {
|
export class KafkaTemplate implements IQueue {
|
||||||
|
|
||||||
private logger = _logger(`kafkaTemplate`);
|
private logger = _logger(`kafkaTemplate`);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user