javonet-nodejs-sdk 2.6.3 → 2.6.5
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/core/handler/AbstractHandler.cjs +4 -4
- package/dist/core/handler/GetInstanceMethodAsDelegateHandler.cjs +2 -4
- package/dist/core/handler/GetStaticMethodAsDelegateHandler.cjs +4 -2
- package/dist/core/handler/GetTypeHandler.cjs +3 -3
- package/dist/core/handler/Handler.cjs +15 -4
- package/dist/core/handler/LoadLibraryHandler.cjs +10 -6
- package/dist/core/interpreter/Interpreter.cjs +42 -16
- package/dist/core/protocol/CommandDeserializer.cjs +4 -4
- package/dist/core/protocol/CommandSerializer.cjs +7 -2
- package/dist/core/protocol/TypeDeserializer.cjs +11 -11
- package/dist/core/receiver/Receiver.cjs +7 -8
- package/dist/core/receiver/ReceiverNative.cjs +4 -2
- package/dist/core/transmitter/Transmitter.cjs +6 -6
- package/dist/core/transmitter/TransmitterWebsocket.cjs +2 -2
- package/dist/core/transmitter/TransmitterWebsocketBrowser.cjs +2 -2
- package/dist/core/transmitter/TransmitterWrapper.cjs +2 -1
- package/dist/core/webSocketClient/WebSocketClient.cjs +4 -4
- package/dist/core/webSocketClient/WebSocketClientBrowser.cjs +7 -7
- package/dist/sdk/ConfigRuntimeFactory.cjs +50 -47
- package/dist/sdk/InvocationContext.cjs +57 -40
- package/dist/sdk/Javonet.cjs +22 -0
- package/dist/sdk/RuntimeFactory.cjs +33 -1
- package/dist/sdk/configuration/Config.cjs +55 -0
- package/dist/sdk/configuration/ConfigPriority.cjs +38 -0
- package/dist/sdk/configuration/ConfigSourceResolver.cjs +100 -0
- package/dist/sdk/configuration/ConfigsDictionary.cjs +121 -0
- package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +121 -0
- package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +123 -0
- package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +125 -0
- package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +125 -0
- package/dist/sdk/tools/ComplexTypeResolver.cjs +28 -3
- package/dist/sdk/tools/JsonResolver.cjs +4 -1
- package/dist/types/core/handler/Handler.d.ts +3 -3
- package/dist/types/core/interpreter/Interpreter.d.ts +3 -3
- package/dist/types/core/protocol/CommandDeserializer.d.ts +3 -3
- package/dist/types/core/protocol/CommandSerializer.d.ts +3 -3
- package/dist/types/core/protocol/TypeDeserializer.d.ts +22 -22
- package/dist/types/core/receiver/Receiver.d.ts +6 -5
- package/dist/types/core/receiver/ReceiverNative.d.ts +6 -4
- package/dist/types/core/transmitter/Transmitter.d.ts +4 -4
- package/dist/types/core/transmitter/TransmitterWebsocket.d.ts +3 -3
- package/dist/types/core/transmitter/TransmitterWebsocketBrowser.d.ts +3 -3
- package/dist/types/core/transmitter/TransmitterWrapper.d.ts +3 -2
- package/dist/types/core/webSocketClient/WebSocketClient.d.ts +7 -7
- package/dist/types/core/webSocketClient/WebSocketClientBrowser.d.ts +9 -9
- package/dist/types/sdk/ConfigRuntimeFactory.d.ts +3 -0
- package/dist/types/sdk/InvocationContext.d.ts +7 -11
- package/dist/types/sdk/Javonet.d.ts +15 -1
- package/dist/types/sdk/RuntimeFactory.d.ts +14 -0
- package/dist/types/sdk/configuration/Config.d.ts +14 -0
- package/dist/types/sdk/configuration/ConfigPriority.d.ts +8 -0
- package/dist/types/sdk/configuration/ConfigSourceResolver.d.ts +7 -0
- package/dist/types/sdk/configuration/ConfigsDictionary.d.ts +30 -0
- package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +30 -0
- package/dist/types/sdk/configuration/configResolvers/ConnectionStringConfigResolver.d.ts +23 -0
- package/dist/types/sdk/configuration/configResolvers/JsonConfigResolver.d.ts +26 -0
- package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +32 -0
- package/dist/types/sdk/tools/ComplexTypeResolver.d.ts +2 -2
- package/dist/types/sdk/tools/JsonResolver.d.ts +4 -2
- package/dist/types/utils/Runtime.d.ts +4 -3
- package/dist/types/utils/RuntimeNameHandler.d.ts +5 -0
- package/dist/utils/RuntimeNameHandler.cjs +34 -0
- package/dist/utils/connectionData/InMemoryConnectionData.cjs +7 -1
- package/dist/utils/connectionData/WsConnectionData.cjs +6 -0
- package/dist/utils/exception/ExceptionSerializer.cjs +6 -2
- package/dist/utils/nodejs/connectionData/TcpConnectionData.cjs +15 -6
- package/lib/core/handler/AbstractHandler.js +7 -5
- package/lib/core/handler/AddEventListenerHandler.js +2 -3
- package/lib/core/handler/ArrayReferenceHandler.js +2 -3
- package/lib/core/handler/AsKwargsHandler.js +2 -2
- package/lib/core/handler/AsOutHandler.js +2 -3
- package/lib/core/handler/AsRefHandler.js +2 -3
- package/lib/core/handler/CreateNullHandler.js +2 -3
- package/lib/core/handler/ExceptionHandler.js +2 -3
- package/lib/core/handler/GenerateLibHandler.js +2 -3
- package/lib/core/handler/GetAsyncOperationResultHandler.js +2 -3
- package/lib/core/handler/GetEnumItemHandler.js +2 -3
- package/lib/core/handler/GetEnumNameHandler.js +2 -2
- package/lib/core/handler/GetEnumValueHandler.js +2 -3
- package/lib/core/handler/GetInstanceMethodAsDelegateHandler.js +3 -3
- package/lib/core/handler/GetModuleHandler.js +2 -2
- package/lib/core/handler/GetRefValueHandler.js +2 -3
- package/lib/core/handler/GetStaticFieldHandler.js +0 -1
- package/lib/core/handler/GetStaticMethodAsDelegateHandler.js +3 -1
- package/lib/core/handler/GetTypeHandler.js +3 -3
- package/lib/core/handler/Handler.js +47 -33
- package/lib/core/handler/HeartBeatHandler.js +2 -3
- package/lib/core/handler/InvokeGenericMethodHandler.js +2 -4
- package/lib/core/handler/InvokeGenericStaticMethodHandler.js +2 -3
- package/lib/core/handler/InvokeStaticMethodHandler.js +1 -1
- package/lib/core/handler/LoadLibraryHandler.js +15 -7
- package/lib/core/handler/OptimizeHandler.js +2 -3
- package/lib/core/handler/PluginWrapperHandler.js +2 -3
- package/lib/core/handler/ResolveReferenceHandler.js +1 -3
- package/lib/core/handler/RetrieveArrayHandler.js +2 -3
- package/lib/core/interpreter/Interpreter.js +47 -20
- package/lib/core/protocol/CommandDeserializer.js +4 -4
- package/lib/core/protocol/CommandSerializer.js +8 -2
- package/lib/core/protocol/TypeDeserializer.js +11 -11
- package/lib/core/receiver/Receiver.js +10 -13
- package/lib/core/receiver/ReceiverNative.js +4 -2
- package/lib/core/transmitter/Transmitter.js +7 -7
- package/lib/core/transmitter/TransmitterWebsocket.js +2 -2
- package/lib/core/transmitter/TransmitterWebsocketBrowser.js +2 -2
- package/lib/core/transmitter/TransmitterWrapper.js +2 -1
- package/lib/core/webSocketClient/WebSocketClient.js +5 -5
- package/lib/core/webSocketClient/WebSocketClientBrowser.js +10 -10
- package/lib/sdk/ActivatorDetails.js +1 -1
- package/lib/sdk/ConfigRuntimeFactory.js +65 -48
- package/lib/sdk/InvocationContext.js +58 -43
- package/lib/sdk/Javonet.js +31 -2
- package/lib/sdk/RuntimeContext.js +0 -7
- package/lib/sdk/RuntimeFactory.js +49 -1
- package/lib/sdk/configuration/Config.js +37 -0
- package/lib/sdk/configuration/ConfigPriority.js +9 -0
- package/lib/sdk/configuration/ConfigSourceResolver.js +84 -0
- package/lib/sdk/configuration/ConfigsDictionary.js +118 -0
- package/lib/sdk/configuration/configResolvers/ConfigResolver.js +109 -0
- package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +119 -0
- package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +99 -0
- package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +109 -0
- package/lib/sdk/tools/ActivationHelper.js +1 -1
- package/lib/sdk/tools/ComplexTypeResolver.js +22 -3
- package/lib/sdk/tools/JsonResolver.js +5 -1
- package/lib/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.js +1 -1
- package/lib/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.js +1 -1
- package/lib/sdk/tools/typeParsingFunctions/TypeParsingUtils.js +4 -1
- package/lib/utils/CommandType.js +1 -1
- package/lib/utils/CustomError.js +1 -1
- package/lib/utils/Runtime.js +11 -4
- package/lib/utils/RuntimeLoggerBrowser.js +0 -1
- package/lib/utils/RuntimeNameHandler.js +37 -0
- package/lib/utils/TypesHandler.js +11 -5
- package/lib/utils/connectionData/InMemoryConnectionData.js +8 -1
- package/lib/utils/connectionData/WsConnectionData.js +7 -0
- package/lib/utils/exception/ExceptionSerializer.js +6 -2
- package/lib/utils/nodejs/connectionData/TcpConnectionData.js +16 -6
- package/lib/utils/nodejs/uuid/v4.js +0 -1
- package/package.json +6 -2
|
@@ -42,8 +42,10 @@ let fs = null;
|
|
|
42
42
|
class JsonResolver {
|
|
43
43
|
/** @type {ConfigSource} */
|
|
44
44
|
jsonObject;
|
|
45
|
-
/** @type {string
|
|
45
|
+
/** @type {string} */
|
|
46
46
|
configSource;
|
|
47
|
+
/** @type {boolean} */
|
|
48
|
+
isConfigSourcePath = false;
|
|
47
49
|
/**
|
|
48
50
|
* @param {string | ConfigSource} configSource
|
|
49
51
|
*/
|
|
@@ -149,6 +151,7 @@ class JsonResolver {
|
|
|
149
151
|
fs = requireDynamic("fs");
|
|
150
152
|
}
|
|
151
153
|
if (fs?.existsSync(configSource)) {
|
|
154
|
+
this.isConfigSourcePath = true;
|
|
152
155
|
const jsonText = fs.readFileSync(configSource, "utf8");
|
|
153
156
|
if (isValidJson(jsonText)) {
|
|
154
157
|
const parsedFromFile = JSON.parse(jsonText);
|
|
@@ -8,13 +8,13 @@ export class Handler {
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {Command} command
|
|
10
10
|
*/
|
|
11
|
-
handleCommand(command: Command): Command
|
|
11
|
+
handleCommand(command: Command): Command | Promise<Command>;
|
|
12
12
|
/**
|
|
13
13
|
* @param {any} response
|
|
14
14
|
* @param {RuntimeName} runtimeName
|
|
15
|
-
* @returns {Command}
|
|
15
|
+
* @returns {Promise<Command> | Command}
|
|
16
16
|
*/
|
|
17
|
-
parseCommand(response: any, runtimeName: RuntimeName): Command;
|
|
17
|
+
parseCommand(response: any, runtimeName: RuntimeName): Promise<Command> | Command;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @typedef {import('../../types.d.ts').RuntimeName} RuntimeName
|
|
@@ -19,10 +19,10 @@ export class Interpreter {
|
|
|
19
19
|
execute(command: Command, connectionData: IConnectionData): Command | Promise<Command>;
|
|
20
20
|
/**
|
|
21
21
|
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @returns {Command}
|
|
22
|
+
* @param {Uint8Array} messageByteArray
|
|
23
|
+
* @returns {Promise<Command> | Command}
|
|
24
24
|
*/
|
|
25
|
-
process(messageByteArray:
|
|
25
|
+
process(messageByteArray: Uint8Array): Promise<Command> | Command;
|
|
26
26
|
}
|
|
27
27
|
export type IConnectionData = import("../../utils/connectionData/IConnectionData.js").IConnectionData;
|
|
28
28
|
export type RuntimeNameType = typeof import("../../types.d.ts").RuntimeName;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class CommandDeserializer {
|
|
2
2
|
/**
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {Uint8Array} byteArray
|
|
4
4
|
*/
|
|
5
|
-
constructor(
|
|
6
|
-
buffer:
|
|
5
|
+
constructor(byteArray: Uint8Array);
|
|
6
|
+
buffer: Uint8Array<ArrayBufferLike>;
|
|
7
7
|
command: Command;
|
|
8
8
|
position: number;
|
|
9
9
|
/**
|
|
@@ -5,12 +5,12 @@ export type IConnectionData = import("../../utils/connectionData/IConnectionData
|
|
|
5
5
|
export class CommandSerializer {
|
|
6
6
|
/**
|
|
7
7
|
* Serializes the root command with connection data and optional runtime version.
|
|
8
|
-
* @param {Command} rootCommand
|
|
8
|
+
* @param {Promise<Command> | Command} rootCommand
|
|
9
9
|
* @param {IConnectionData} connectionData
|
|
10
10
|
* @param {number} runtimeVersion
|
|
11
|
-
* @returns {
|
|
11
|
+
* @returns {Promise<Uint8Array> | Uint8Array}
|
|
12
12
|
*/
|
|
13
|
-
serialize(rootCommand: Command, connectionData: IConnectionData, runtimeVersion?: number):
|
|
13
|
+
serialize(rootCommand: Promise<Command> | Command, connectionData: IConnectionData, runtimeVersion?: number): Promise<Uint8Array> | Uint8Array;
|
|
14
14
|
/**
|
|
15
15
|
* Recursively serializes command payload.
|
|
16
16
|
* @param {Command} command
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
export class TypeDeserializer {
|
|
2
2
|
/**
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {Uint8Array} encodedCommand
|
|
4
4
|
* @returns {Command}
|
|
5
5
|
*/
|
|
6
|
-
static deserializeCommand(encodedCommand:
|
|
6
|
+
static deserializeCommand(encodedCommand: Uint8Array): Command;
|
|
7
7
|
/**
|
|
8
8
|
* @param {number} stringEncodingMode
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {Uint8Array} encodedString
|
|
10
10
|
*/
|
|
11
|
-
static deserializeString(stringEncodingMode: number, encodedString:
|
|
11
|
+
static deserializeString(stringEncodingMode: number, encodedString: Uint8Array): string;
|
|
12
12
|
/**
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {Uint8Array} encodedInt
|
|
14
14
|
*/
|
|
15
|
-
static deserializeInt(encodedInt:
|
|
15
|
+
static deserializeInt(encodedInt: Uint8Array): number;
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {Uint8Array} encodedBool
|
|
18
18
|
*/
|
|
19
|
-
static deserializeBool(encodedBool:
|
|
19
|
+
static deserializeBool(encodedBool: Uint8Array): boolean;
|
|
20
20
|
/**
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {Uint8Array} encodedFloat
|
|
22
22
|
*/
|
|
23
|
-
static deserializeFloat(encodedFloat:
|
|
23
|
+
static deserializeFloat(encodedFloat: Uint8Array): number;
|
|
24
24
|
/**
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {Uint8Array} encodedByte
|
|
26
26
|
*/
|
|
27
|
-
static deserializeByte(encodedByte:
|
|
27
|
+
static deserializeByte(encodedByte: Uint8Array): number;
|
|
28
28
|
/**
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {Uint8Array} encodedChar
|
|
30
30
|
*/
|
|
31
|
-
static deserializeChar(encodedChar:
|
|
31
|
+
static deserializeChar(encodedChar: Uint8Array): number;
|
|
32
32
|
/**
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {Uint8Array} encodedLongLong
|
|
34
34
|
*/
|
|
35
|
-
static deserializeLongLong(encodedLongLong:
|
|
35
|
+
static deserializeLongLong(encodedLongLong: Uint8Array): bigint;
|
|
36
36
|
/**
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {Uint8Array} encodedDouble
|
|
38
38
|
*/
|
|
39
|
-
static deserializeDouble(encodedDouble:
|
|
39
|
+
static deserializeDouble(encodedDouble: Uint8Array): number;
|
|
40
40
|
/**
|
|
41
|
-
* @param {
|
|
41
|
+
* @param {Uint8Array} encodedULLong
|
|
42
42
|
*/
|
|
43
|
-
static deserializeULLong(encodedULLong:
|
|
43
|
+
static deserializeULLong(encodedULLong: Uint8Array): bigint;
|
|
44
44
|
/**
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {Uint8Array} encodedUInt
|
|
46
46
|
*/
|
|
47
|
-
static deserializeUInt(encodedUInt:
|
|
47
|
+
static deserializeUInt(encodedUInt: Uint8Array): number;
|
|
48
48
|
static deserializeNull(encodedNull?: null): null;
|
|
49
49
|
}
|
|
50
50
|
import { Command } from '../../utils/Command.js';
|
|
@@ -2,14 +2,15 @@ export class Receiver {
|
|
|
2
2
|
static connectionData: InMemoryConnectionData;
|
|
3
3
|
static getRuntimeInfo(): string;
|
|
4
4
|
/**
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {Uint8Array} messageByteArray
|
|
6
|
+
* @returns {Promise<Uint8Array> | Uint8Array}
|
|
6
7
|
*/
|
|
7
|
-
static sendCommand(messageByteArray:
|
|
8
|
+
static sendCommand(messageByteArray: Uint8Array): Promise<Uint8Array> | Uint8Array;
|
|
8
9
|
/**
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
10
|
+
* @param {Uint8Array} messageByteArray
|
|
11
|
+
* @returns {Promise<Uint8Array> | Uint8Array}
|
|
11
12
|
*/
|
|
12
|
-
static heartBeat(messageByteArray:
|
|
13
|
+
static heartBeat(messageByteArray: Uint8Array): Promise<Uint8Array> | Uint8Array;
|
|
13
14
|
Receiver(): void;
|
|
14
15
|
}
|
|
15
16
|
import { InMemoryConnectionData } from '../../utils/connectionData/InMemoryConnectionData.js';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export class ReceiverNative {
|
|
2
2
|
/**
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {Uint8Array} messageByteArray
|
|
4
|
+
* @returns {Promise<Uint8Array> | Uint8Array}
|
|
4
5
|
*/
|
|
5
|
-
static sendCommand(messageByteArray:
|
|
6
|
+
static sendCommand(messageByteArray: Uint8Array): Promise<Uint8Array> | Uint8Array;
|
|
6
7
|
/**
|
|
7
|
-
* @param {
|
|
8
|
+
* @param {Uint8Array} messageByteArray
|
|
9
|
+
* @returns {Uint8Array | Promise<Uint8Array>}
|
|
8
10
|
*/
|
|
9
|
-
static heartBeat(messageByteArray:
|
|
11
|
+
static heartBeat(messageByteArray: Uint8Array): Uint8Array | Promise<Uint8Array>;
|
|
10
12
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class Transmitter {
|
|
2
2
|
/**
|
|
3
|
-
* @param {
|
|
4
|
-
* @returns {
|
|
3
|
+
* @param {Uint8Array} messageArray
|
|
4
|
+
* @returns {Uint8Array}
|
|
5
5
|
*/
|
|
6
|
-
static sendCommand(messageArray:
|
|
6
|
+
static sendCommand(messageArray: Uint8Array): Uint8Array;
|
|
7
7
|
/**
|
|
8
8
|
* @param {string} licenseKey
|
|
9
9
|
* @returns {void}
|
|
@@ -12,7 +12,7 @@ export class Transmitter {
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {string} configSource
|
|
14
14
|
* @returns {void}
|
|
15
|
-
|
|
15
|
+
*/
|
|
16
16
|
static setConfigSource(configSource: string): void;
|
|
17
17
|
/**
|
|
18
18
|
* @param {string} workingDirectory
|
|
@@ -16,10 +16,10 @@ export class TransmitterWebsocket {
|
|
|
16
16
|
static activate(): void;
|
|
17
17
|
/**
|
|
18
18
|
* @async
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {Uint8Array} messageByteArray
|
|
20
20
|
* @param {IConnectionData} connectionData
|
|
21
|
-
* @returns {Promise<
|
|
21
|
+
* @returns {Promise<Uint8Array>} responseByteArray
|
|
22
22
|
*/
|
|
23
|
-
static sendCommand(messageByteArray:
|
|
23
|
+
static sendCommand(messageByteArray: Uint8Array, connectionData: IConnectionData): Promise<Uint8Array>;
|
|
24
24
|
}
|
|
25
25
|
export type IConnectionData = import("../../utils/connectionData/IConnectionData.js").IConnectionData;
|
|
@@ -12,11 +12,11 @@ export class TransmitterWebsocketBrowser {
|
|
|
12
12
|
static activate(): void;
|
|
13
13
|
/**
|
|
14
14
|
* @async
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {Uint8Array} messageByteArray
|
|
16
16
|
* @param {IConnectionData} connectionData
|
|
17
|
-
* @returns {Promise<
|
|
17
|
+
* @returns {Promise<Uint8Array>} responseByteArray
|
|
18
18
|
*/
|
|
19
|
-
static sendCommand(messageByteArray:
|
|
19
|
+
static sendCommand(messageByteArray: Uint8Array, connectionData: IConnectionData): Promise<Uint8Array>;
|
|
20
20
|
/**
|
|
21
21
|
* @async
|
|
22
22
|
* @param {any} configSource
|
|
@@ -6,9 +6,10 @@ export class TransmitterWrapper {
|
|
|
6
6
|
*/
|
|
7
7
|
static activate(licenseKey: string): any;
|
|
8
8
|
/**
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {Uint8Array} messageArray
|
|
10
|
+
* @returns {Uint8Array}
|
|
10
11
|
*/
|
|
11
|
-
static sendCommand(messageArray:
|
|
12
|
+
static sendCommand(messageArray: Uint8Array): Uint8Array;
|
|
12
13
|
/**
|
|
13
14
|
* @param {string} configSource
|
|
14
15
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** @type {Record<string, wsClient>} */
|
|
2
2
|
export const clients: Record<string, wsClient>;
|
|
3
|
-
/** @type {Record<string, Array<{resolve: Function, reject: Function, messageArray:
|
|
3
|
+
/** @type {Record<string, Array<{resolve: Function, reject: Function, messageArray: Uint8Array}>>} */
|
|
4
4
|
export const messageQueue: Record<string, Array<{
|
|
5
5
|
resolve: Function;
|
|
6
6
|
reject: Function;
|
|
7
|
-
messageArray:
|
|
7
|
+
messageArray: Uint8Array;
|
|
8
8
|
}>>;
|
|
9
9
|
/** @type {Record<string, boolean>} */
|
|
10
10
|
export const processingQueues: Record<string, boolean>;
|
|
@@ -31,10 +31,10 @@ export class WebSocketClient {
|
|
|
31
31
|
/**
|
|
32
32
|
* Sends messageArray through websocket connection with guaranteed order preservation
|
|
33
33
|
* @async
|
|
34
|
-
* @param {
|
|
35
|
-
* @returns {Promise<
|
|
34
|
+
* @param {Uint8Array} messageArray
|
|
35
|
+
* @returns {Promise<Uint8Array>}
|
|
36
36
|
*/
|
|
37
|
-
send(messageArray:
|
|
37
|
+
send(messageArray: Uint8Array): Promise<Uint8Array>;
|
|
38
38
|
/**
|
|
39
39
|
* Processes message queue sequentially to maintain order
|
|
40
40
|
* @private
|
|
@@ -45,8 +45,8 @@ export class WebSocketClient {
|
|
|
45
45
|
* Sends a single message through websocket connection
|
|
46
46
|
* @private
|
|
47
47
|
* @async
|
|
48
|
-
* @param {
|
|
49
|
-
* @returns {Promise<
|
|
48
|
+
* @param {Uint8Array} messageArray
|
|
49
|
+
* @returns {Promise<Uint8Array>}
|
|
50
50
|
*/
|
|
51
51
|
private _send;
|
|
52
52
|
/**
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** @type {Record<string, WebSocket>} */
|
|
6
6
|
export const clients: Record<string, WebSocket>;
|
|
7
|
-
/** @type {Record<string, Array<{resolve: Function, reject: Function, messageArray:
|
|
7
|
+
/** @type {Record<string, Array<{resolve: Function, reject: Function, messageArray: Uint8Array}>>} */
|
|
8
8
|
export const messageQueue: Record<string, Array<{
|
|
9
9
|
resolve: Function;
|
|
10
10
|
reject: Function;
|
|
11
|
-
messageArray:
|
|
11
|
+
messageArray: Uint8Array;
|
|
12
12
|
}>>;
|
|
13
13
|
/** @type {Record<string, boolean>} */
|
|
14
14
|
export const processingQueues: Record<string, boolean>;
|
|
@@ -34,10 +34,10 @@ export class WebSocketClientBrowser {
|
|
|
34
34
|
/**
|
|
35
35
|
* Sends messageArray through websocket connection with guaranteed order preservation
|
|
36
36
|
* @async
|
|
37
|
-
* @param {
|
|
38
|
-
* @returns {Promise<
|
|
37
|
+
* @param {Uint8Array} messageArray
|
|
38
|
+
* @returns {Promise<Uint8Array>}
|
|
39
39
|
*/
|
|
40
|
-
send(messageArray:
|
|
40
|
+
send(messageArray: Uint8Array): Promise<Uint8Array>;
|
|
41
41
|
/**
|
|
42
42
|
* Processes message queue sequentially to maintain order
|
|
43
43
|
* @private
|
|
@@ -48,8 +48,8 @@ export class WebSocketClientBrowser {
|
|
|
48
48
|
* Sends a single message through websocket connection
|
|
49
49
|
* @private
|
|
50
50
|
* @async
|
|
51
|
-
* @param {
|
|
52
|
-
* @returns {Promise<
|
|
51
|
+
* @param {Uint8Array} messageArray
|
|
52
|
+
* @returns {Promise<Uint8Array>}
|
|
53
53
|
*/
|
|
54
54
|
private _sendSingle;
|
|
55
55
|
/**
|
|
@@ -67,8 +67,8 @@ export class WebSocketClientBrowser {
|
|
|
67
67
|
* Sends the data to the WebSocket server and listens for a response.
|
|
68
68
|
* @private
|
|
69
69
|
* @param {WebSocket} client
|
|
70
|
-
* @param {
|
|
71
|
-
* @param {(value:
|
|
70
|
+
* @param {Uint8Array} data
|
|
71
|
+
* @param {(value: Uint8Array) => void} resolve
|
|
72
72
|
* @param {(reason?: any) => void} reject
|
|
73
73
|
*/
|
|
74
74
|
private _sendMessage;
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
9
9
|
*/
|
|
10
10
|
export class ConfigRuntimeFactory {
|
|
11
|
+
static _IN_MEMORY_CONNECTION_TYPES: string[];
|
|
12
|
+
static _WEB_SOCKET_CONNECTION_TYPES: string[];
|
|
13
|
+
static _TCP_CONNECTION_TYPES: string[];
|
|
11
14
|
/**
|
|
12
15
|
* @param {ConfigSource | string} configSource
|
|
13
16
|
*/
|
|
@@ -31,11 +31,11 @@ export class InvocationContext {
|
|
|
31
31
|
* Commands are becoming nested through each invocation of methods on Invocation Context.
|
|
32
32
|
* Each invocation triggers the creation of new Invocation Context instance wrapping the current command with new parent command valid for invoked method.
|
|
33
33
|
* Developer can decide on any moment of the materialization for the context taking full control of the chunks of the expression being transferred and processed on target runtime.
|
|
34
|
-
* @returns {InvocationContext} the InvocationContext after executing the command.
|
|
34
|
+
* @returns {Promise<InvocationContext> | InvocationContext} the InvocationContext after executing the command.
|
|
35
35
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/execute-method)
|
|
36
36
|
* @method
|
|
37
37
|
*/
|
|
38
|
-
execute(): InvocationContext;
|
|
38
|
+
execute(): Promise<InvocationContext> | InvocationContext;
|
|
39
39
|
/**
|
|
40
40
|
* Invokes a static method on the target runtime.
|
|
41
41
|
* @param {string} methodName - The name of the method to invoke.
|
|
@@ -196,11 +196,11 @@ export class InvocationContext {
|
|
|
196
196
|
getInstanceMethodAsDelegate(methodName: string, ...args: any[]): InvocationContext | InvocationWsContext;
|
|
197
197
|
/**
|
|
198
198
|
* Retrieves the type of the object from the target runtime.
|
|
199
|
-
* @returns {string} The type of the object.
|
|
199
|
+
* @returns {Promise<string> | string} The type of the object.
|
|
200
200
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/type-handling/getting-object-type)
|
|
201
201
|
* @method
|
|
202
202
|
*/
|
|
203
|
-
getResultType(): string;
|
|
203
|
+
getResultType(): Promise<string> | string;
|
|
204
204
|
/**
|
|
205
205
|
* Retrieves the name of the runtime where the command is executed.
|
|
206
206
|
* @returns {number} The name of the runtime.
|
|
@@ -210,21 +210,17 @@ export class InvocationContext {
|
|
|
210
210
|
getRuntimeName(): number;
|
|
211
211
|
/**
|
|
212
212
|
* Retrieves an array from the target runtime.
|
|
213
|
-
* @returns {
|
|
214
|
-
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/arrays-and-collections/retrieve-array)
|
|
213
|
+
* @returns {Promise<any[]>}
|
|
215
214
|
* @method
|
|
216
215
|
*/
|
|
217
|
-
retrieveArray():
|
|
216
|
+
retrieveArray(): Promise<any[]>;
|
|
218
217
|
/**
|
|
219
218
|
* Returns the primitive value from the target runtime. This could be any primitive type in JavaScript,
|
|
220
219
|
* such as int, boolean, byte, char, long, double, float, etc.
|
|
221
|
-
* @returns {
|
|
220
|
+
* @returns {unknown} The value of the current command.
|
|
222
221
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/execute-method)
|
|
223
222
|
* @method
|
|
224
223
|
*/
|
|
225
|
-
/**
|
|
226
|
-
* @returns {unknown}
|
|
227
|
-
*/
|
|
228
224
|
getValue(): unknown;
|
|
229
225
|
[Symbol.iterator]: () => {
|
|
230
226
|
next: () => {
|
|
@@ -58,11 +58,25 @@ export class Javonet {
|
|
|
58
58
|
* @returns {void}
|
|
59
59
|
*/
|
|
60
60
|
static setJavonetWorkingDirectory(path: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a configuration to the ConfigSourceResolver with the specified priority and source.
|
|
63
|
+
* @param {number} priority - The priority of the configuration.
|
|
64
|
+
* @param {string} configSource - The configuration source.
|
|
65
|
+
*/
|
|
66
|
+
static addConfig(priority: number, configSource: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Initializes a RuntimeContext instance based on the specified configuration name.
|
|
69
|
+
* @param {string} configName - The name of the configuration to use.
|
|
70
|
+
* @returns {RuntimeContext} A RuntimeContext instance initialized with the specified configuration.
|
|
71
|
+
*/
|
|
72
|
+
static initializeRc(configName: string): RuntimeContext;
|
|
61
73
|
}
|
|
62
74
|
import { TcpConnectionData } from '../utils/nodejs/connectionData/TcpConnectionData.js';
|
|
63
75
|
import { WsConnectionData } from '../utils/connectionData/WsConnectionData.js';
|
|
64
76
|
import { CommandSerializer } from '../core/protocol/CommandSerializer.js';
|
|
65
77
|
import { CommandDeserializer } from '../core/protocol/CommandDeserializer.js';
|
|
78
|
+
import { ConfigPriority } from './configuration/ConfigPriority.js';
|
|
66
79
|
import { RuntimeFactory } from './RuntimeFactory.js';
|
|
67
80
|
import { ConfigRuntimeFactory } from './ConfigRuntimeFactory.js';
|
|
68
|
-
|
|
81
|
+
import { RuntimeContext } from './RuntimeContext.js';
|
|
82
|
+
export { TcpConnectionData, WsConnectionData, CommandSerializer, CommandDeserializer, ConfigPriority };
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
8
8
|
*/
|
|
9
9
|
export class RuntimeFactory {
|
|
10
|
+
/**
|
|
11
|
+
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules: any; }} config
|
|
12
|
+
*/
|
|
13
|
+
static initializeRuntimeContext(config: {
|
|
14
|
+
runtime: import("../types.js").RuntimeName;
|
|
15
|
+
connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData;
|
|
16
|
+
modules: any;
|
|
17
|
+
}): RuntimeContext;
|
|
10
18
|
/**
|
|
11
19
|
* @param {IConnectionData} connectionData
|
|
12
20
|
*/
|
|
@@ -54,6 +62,12 @@ export class RuntimeFactory {
|
|
|
54
62
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
55
63
|
*/
|
|
56
64
|
nodejs(): RuntimeContext;
|
|
65
|
+
/**
|
|
66
|
+
* Creates RuntimeContext instance to interact with the PHP runtime.
|
|
67
|
+
* @return {RuntimeContext} a RuntimeContext instance for the PHP runtime
|
|
68
|
+
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
69
|
+
*/
|
|
70
|
+
php(): RuntimeContext;
|
|
57
71
|
/**
|
|
58
72
|
* Creates RuntimeContext instance to interact with the Python runtime.
|
|
59
73
|
* @return {RuntimeContext} a RuntimeContext instance for the Python runtime
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class Config {
|
|
2
|
+
/**
|
|
3
|
+
* @param {*} runtime
|
|
4
|
+
* @param {*} connectionData
|
|
5
|
+
* @param {string} [plugins=""]
|
|
6
|
+
* @param {string} [modules=""]
|
|
7
|
+
*/
|
|
8
|
+
constructor(runtime: any, connectionData: any, plugins?: string, modules?: string);
|
|
9
|
+
runtime: any;
|
|
10
|
+
connectionData: any;
|
|
11
|
+
plugins: string;
|
|
12
|
+
modules: string;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export class ConfigSourceResolver {
|
|
2
|
+
static addConfigs(priority: any, configSource: any): void;
|
|
3
|
+
static getConfig(configName: any): any;
|
|
4
|
+
static clearConfigs(): void;
|
|
5
|
+
static _getConfigSourceAsString(configSource: any): any;
|
|
6
|
+
static _parseConfigsAndAddToCollection(priority: any, configString: any): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class ConfigsDictionary {
|
|
2
|
+
/** @type {Map<string, Map<number, any>>} */
|
|
3
|
+
static _configurations_collection: Map<string, Map<number, any>>;
|
|
4
|
+
/**
|
|
5
|
+
* Normalize priority to a numeric value.
|
|
6
|
+
* Accepts either a number or an object with a numeric `value` property.
|
|
7
|
+
* @param {any} priority
|
|
8
|
+
* @returns {number|undefined}
|
|
9
|
+
*/
|
|
10
|
+
static _normalizePriority(priority: any): number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Add a configuration for a given name and priority.
|
|
13
|
+
* If the same name+priority already exists, it will not be overwritten.
|
|
14
|
+
* @param {string} name
|
|
15
|
+
* @param {number|{value:number}} priority
|
|
16
|
+
* @param {*} config
|
|
17
|
+
*/
|
|
18
|
+
static addConfig(name: string, priority: number | {
|
|
19
|
+
value: number;
|
|
20
|
+
}, config: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve the configuration with the numerically smallest priority for the given name.
|
|
23
|
+
* Throws if name is invalid or no configuration is found.
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @returns {*}
|
|
26
|
+
*/
|
|
27
|
+
static getConfig(name: string): any;
|
|
28
|
+
/** Clear all stored configurations. */
|
|
29
|
+
static clearConfigs(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class ConfigResolver {
|
|
2
|
+
/**
|
|
3
|
+
* Parse a runtime string into the runtime enum/name using RuntimeNameHandler.
|
|
4
|
+
* @param {string} runtime
|
|
5
|
+
* @returns {*}
|
|
6
|
+
*/
|
|
7
|
+
static tryParseRuntime(runtime: string): any;
|
|
8
|
+
/**
|
|
9
|
+
* Build appropriate connection data object from a host string.
|
|
10
|
+
* - empty / null => InMemoryConnectionData
|
|
11
|
+
* - "inmemory" or "in-memory" => InMemoryConnectionData
|
|
12
|
+
* - ws:// or wss:// => WsConnectionData(fullAddress)
|
|
13
|
+
* - tcp://... => parsed by parseTcp
|
|
14
|
+
* - host:port or host:port/... => TcpConnectionData(host, port) if valid, otherwise InMemoryConnectionData
|
|
15
|
+
* @param {string} hostValue
|
|
16
|
+
* @returns {InMemoryConnectionData|WsConnectionData|TcpConnectionData}
|
|
17
|
+
*/
|
|
18
|
+
static buildConnectionData(hostValue: string): InMemoryConnectionData | WsConnectionData | TcpConnectionData;
|
|
19
|
+
/**
|
|
20
|
+
* Parse tcp address portion (after tcp://) into TcpConnectionData.
|
|
21
|
+
* Expected formats: host:port or host:port/...
|
|
22
|
+
* Throws Error on invalid format or port.
|
|
23
|
+
* @param {string} address
|
|
24
|
+
* @returns {TcpConnectionData}
|
|
25
|
+
*/
|
|
26
|
+
static parseTcp(address: string): TcpConnectionData;
|
|
27
|
+
}
|
|
28
|
+
import { InMemoryConnectionData } from '../../../utils/connectionData/InMemoryConnectionData.js';
|
|
29
|
+
import { WsConnectionData } from '../../../utils/connectionData/WsConnectionData.js';
|
|
30
|
+
import { TcpConnectionData } from '../../../utils/nodejs/connectionData/TcpConnectionData.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class ConnectionStringConfigResolver extends ConfigResolver {
|
|
2
|
+
/**
|
|
3
|
+
* Parse and add multiple configuration lines from a connection string source.
|
|
4
|
+
* @param {any} priority
|
|
5
|
+
* @param {string} connectionStringSource
|
|
6
|
+
*/
|
|
7
|
+
static addConfigs(priority: any, connectionStringSource: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Extract and set temporary license key from a line like "licensekey=VALUE;..."
|
|
10
|
+
* @param {string} line
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
private static _setLicenseKey;
|
|
14
|
+
/**
|
|
15
|
+
* Parse semicolon-separated key=value tokens into an object.
|
|
16
|
+
* Ignores malformed tokens and logs them.
|
|
17
|
+
* @param {string} line
|
|
18
|
+
* @returns {Record<string, string>}
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
private static _parseKeyValues;
|
|
22
|
+
}
|
|
23
|
+
import { ConfigResolver } from './ConfigResolver.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class JsonConfigResolver extends ConfigResolver {
|
|
2
|
+
/**
|
|
3
|
+
* Parse and add configurations from a JSON object.
|
|
4
|
+
* @param {any} priority
|
|
5
|
+
* @param {Record<string, unknown>} jsonObject
|
|
6
|
+
*/
|
|
7
|
+
static addConfigs(priority: any, jsonObject: Record<string, unknown>): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get a required string property from an object, trimmed.
|
|
10
|
+
* Throws if missing or empty.
|
|
11
|
+
* @param {Record<string, unknown>} obj
|
|
12
|
+
* @param {string} property
|
|
13
|
+
* @returns {string}
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
private static _getRequiredString;
|
|
17
|
+
/**
|
|
18
|
+
* Get an optional string property; return empty string when missing or not a string.
|
|
19
|
+
* @param {Record<string, unknown>} obj
|
|
20
|
+
* @param {string} property
|
|
21
|
+
* @returns {string}
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
private static _getOptionalString;
|
|
25
|
+
}
|
|
26
|
+
import { ConfigResolver } from './ConfigResolver.js';
|