Clear JS executor proto models
This commit is contained in:
		
							parent
							
								
									d35bdcc981
								
							
						
					
					
						commit
						0a969f22b3
					
				@ -16,8 +16,6 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export interface TbMessage {
 | 
			
		||||
    scriptIdMSB: string; // deprecated
 | 
			
		||||
    scriptIdLSB: string; // deprecated
 | 
			
		||||
    scriptHash: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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 } from './utils';
 | 
			
		||||
import { isString, parseJsErrorDetails, UUIDFromBuffer, UUIDToBits } from './utils';
 | 
			
		||||
import { IQueue } from '../queue/queue.models';
 | 
			
		||||
import {
 | 
			
		||||
    JsCompileRequest,
 | 
			
		||||
@ -310,8 +310,6 @@ export class JsInvokeMessageProcessor {
 | 
			
		||||
            errorCode: errorCode,
 | 
			
		||||
            success: success,
 | 
			
		||||
            errorDetails: parseJsErrorDetails(err),
 | 
			
		||||
            scriptIdMSB: "0",
 | 
			
		||||
            scriptIdLSB: "0",
 | 
			
		||||
            scriptHash: scriptId
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
@ -328,14 +326,12 @@ export class JsInvokeMessageProcessor {
 | 
			
		||||
    private static createReleaseResponse(scriptId: string, success: boolean): JsReleaseResponse {
 | 
			
		||||
        return {
 | 
			
		||||
            success: success,
 | 
			
		||||
            scriptIdMSB: "0",
 | 
			
		||||
            scriptIdLSB: "0",
 | 
			
		||||
            scriptHash: scriptId,
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static getScriptId(request: TbMessage): string {
 | 
			
		||||
        return request.scriptHash ? request.scriptHash : toUUIDString(request.scriptIdMSB, request.scriptIdLSB);
 | 
			
		||||
        return request.scriptHash;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private incrementUseScriptId(scriptId: string) {
 | 
			
		||||
 | 
			
		||||
@ -17,13 +17,6 @@
 | 
			
		||||
import Long from 'long';
 | 
			
		||||
import uuidParse from 'uuid-parse';
 | 
			
		||||
 | 
			
		||||
export function toUUIDString(mostSigBits: string, leastSigBits: string): string {
 | 
			
		||||
    const msbBytes = Long.fromValue(mostSigBits, false).toBytes(false);
 | 
			
		||||
    const lsbBytes = Long.fromValue(leastSigBits, false).toBytes(false);
 | 
			
		||||
    const uuidBytes = msbBytes.concat(lsbBytes);
 | 
			
		||||
    return uuidParse.unparse(uuidBytes as any);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function UUIDFromBuffer(buf: Buffer): string {
 | 
			
		||||
    return uuidParse.unparse(buf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user