|
|
|
@ -18,7 +18,7 @@ import config from 'config'; |
|
|
|
import { _logger } from '../config/logger'; |
|
|
|
import { JsExecutor, TbScript } from './jsExecutor'; |
|
|
|
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 { |
|
|
|
JsCompileRequest, |
|
|
|
@ -306,26 +306,14 @@ export class JsInvokeMessageProcessor { |
|
|
|
} |
|
|
|
|
|
|
|
private static createCompileResponse(scriptId: string, success: boolean, errorCode?: number, err?: any): JsCompileResponse { |
|
|
|
if (isNotUUID(scriptId)) { |
|
|
|
return { |
|
|
|
errorCode: errorCode, |
|
|
|
success: success, |
|
|
|
errorDetails: parseJsErrorDetails(err), |
|
|
|
scriptIdMSB: "0", |
|
|
|
scriptIdLSB: "0", |
|
|
|
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: "" |
|
|
|
}; |
|
|
|
} |
|
|
|
return { |
|
|
|
errorCode: errorCode, |
|
|
|
success: success, |
|
|
|
errorDetails: parseJsErrorDetails(err), |
|
|
|
scriptIdMSB: "0", |
|
|
|
scriptIdLSB: "0", |
|
|
|
scriptHash: scriptId |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
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 { |
|
|
|
if (isNotUUID(scriptId)) { |
|
|
|
return { |
|
|
|
success: success, |
|
|
|
scriptIdMSB: "0", |
|
|
|
scriptIdLSB: "0", |
|
|
|
scriptHash: scriptId, |
|
|
|
}; |
|
|
|
} else { // todo: remove in the next release
|
|
|
|
let scriptIdBits = UUIDToBits(scriptId); |
|
|
|
return { |
|
|
|
success: success, |
|
|
|
scriptIdMSB: scriptIdBits[0], |
|
|
|
scriptIdLSB: scriptIdBits[1], |
|
|
|
scriptHash: "" |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
success: success, |
|
|
|
scriptIdMSB: "0", |
|
|
|
scriptIdLSB: "0", |
|
|
|
scriptHash: scriptId, |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
private static getScriptId(request: TbMessage): string { |
|
|
|
|