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.
Files changed (139) hide show
  1. package/dist/core/handler/AbstractHandler.cjs +4 -4
  2. package/dist/core/handler/GetInstanceMethodAsDelegateHandler.cjs +2 -4
  3. package/dist/core/handler/GetStaticMethodAsDelegateHandler.cjs +4 -2
  4. package/dist/core/handler/GetTypeHandler.cjs +3 -3
  5. package/dist/core/handler/Handler.cjs +15 -4
  6. package/dist/core/handler/LoadLibraryHandler.cjs +10 -6
  7. package/dist/core/interpreter/Interpreter.cjs +42 -16
  8. package/dist/core/protocol/CommandDeserializer.cjs +4 -4
  9. package/dist/core/protocol/CommandSerializer.cjs +7 -2
  10. package/dist/core/protocol/TypeDeserializer.cjs +11 -11
  11. package/dist/core/receiver/Receiver.cjs +7 -8
  12. package/dist/core/receiver/ReceiverNative.cjs +4 -2
  13. package/dist/core/transmitter/Transmitter.cjs +6 -6
  14. package/dist/core/transmitter/TransmitterWebsocket.cjs +2 -2
  15. package/dist/core/transmitter/TransmitterWebsocketBrowser.cjs +2 -2
  16. package/dist/core/transmitter/TransmitterWrapper.cjs +2 -1
  17. package/dist/core/webSocketClient/WebSocketClient.cjs +4 -4
  18. package/dist/core/webSocketClient/WebSocketClientBrowser.cjs +7 -7
  19. package/dist/sdk/ConfigRuntimeFactory.cjs +50 -47
  20. package/dist/sdk/InvocationContext.cjs +57 -40
  21. package/dist/sdk/Javonet.cjs +22 -0
  22. package/dist/sdk/RuntimeFactory.cjs +33 -1
  23. package/dist/sdk/configuration/Config.cjs +55 -0
  24. package/dist/sdk/configuration/ConfigPriority.cjs +38 -0
  25. package/dist/sdk/configuration/ConfigSourceResolver.cjs +100 -0
  26. package/dist/sdk/configuration/ConfigsDictionary.cjs +121 -0
  27. package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +121 -0
  28. package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +123 -0
  29. package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +125 -0
  30. package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +125 -0
  31. package/dist/sdk/tools/ComplexTypeResolver.cjs +28 -3
  32. package/dist/sdk/tools/JsonResolver.cjs +4 -1
  33. package/dist/types/core/handler/Handler.d.ts +3 -3
  34. package/dist/types/core/interpreter/Interpreter.d.ts +3 -3
  35. package/dist/types/core/protocol/CommandDeserializer.d.ts +3 -3
  36. package/dist/types/core/protocol/CommandSerializer.d.ts +3 -3
  37. package/dist/types/core/protocol/TypeDeserializer.d.ts +22 -22
  38. package/dist/types/core/receiver/Receiver.d.ts +6 -5
  39. package/dist/types/core/receiver/ReceiverNative.d.ts +6 -4
  40. package/dist/types/core/transmitter/Transmitter.d.ts +4 -4
  41. package/dist/types/core/transmitter/TransmitterWebsocket.d.ts +3 -3
  42. package/dist/types/core/transmitter/TransmitterWebsocketBrowser.d.ts +3 -3
  43. package/dist/types/core/transmitter/TransmitterWrapper.d.ts +3 -2
  44. package/dist/types/core/webSocketClient/WebSocketClient.d.ts +7 -7
  45. package/dist/types/core/webSocketClient/WebSocketClientBrowser.d.ts +9 -9
  46. package/dist/types/sdk/ConfigRuntimeFactory.d.ts +3 -0
  47. package/dist/types/sdk/InvocationContext.d.ts +7 -11
  48. package/dist/types/sdk/Javonet.d.ts +15 -1
  49. package/dist/types/sdk/RuntimeFactory.d.ts +14 -0
  50. package/dist/types/sdk/configuration/Config.d.ts +14 -0
  51. package/dist/types/sdk/configuration/ConfigPriority.d.ts +8 -0
  52. package/dist/types/sdk/configuration/ConfigSourceResolver.d.ts +7 -0
  53. package/dist/types/sdk/configuration/ConfigsDictionary.d.ts +30 -0
  54. package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +30 -0
  55. package/dist/types/sdk/configuration/configResolvers/ConnectionStringConfigResolver.d.ts +23 -0
  56. package/dist/types/sdk/configuration/configResolvers/JsonConfigResolver.d.ts +26 -0
  57. package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +32 -0
  58. package/dist/types/sdk/tools/ComplexTypeResolver.d.ts +2 -2
  59. package/dist/types/sdk/tools/JsonResolver.d.ts +4 -2
  60. package/dist/types/utils/Runtime.d.ts +4 -3
  61. package/dist/types/utils/RuntimeNameHandler.d.ts +5 -0
  62. package/dist/utils/RuntimeNameHandler.cjs +34 -0
  63. package/dist/utils/connectionData/InMemoryConnectionData.cjs +7 -1
  64. package/dist/utils/connectionData/WsConnectionData.cjs +6 -0
  65. package/dist/utils/exception/ExceptionSerializer.cjs +6 -2
  66. package/dist/utils/nodejs/connectionData/TcpConnectionData.cjs +15 -6
  67. package/lib/core/handler/AbstractHandler.js +7 -5
  68. package/lib/core/handler/AddEventListenerHandler.js +2 -3
  69. package/lib/core/handler/ArrayReferenceHandler.js +2 -3
  70. package/lib/core/handler/AsKwargsHandler.js +2 -2
  71. package/lib/core/handler/AsOutHandler.js +2 -3
  72. package/lib/core/handler/AsRefHandler.js +2 -3
  73. package/lib/core/handler/CreateNullHandler.js +2 -3
  74. package/lib/core/handler/ExceptionHandler.js +2 -3
  75. package/lib/core/handler/GenerateLibHandler.js +2 -3
  76. package/lib/core/handler/GetAsyncOperationResultHandler.js +2 -3
  77. package/lib/core/handler/GetEnumItemHandler.js +2 -3
  78. package/lib/core/handler/GetEnumNameHandler.js +2 -2
  79. package/lib/core/handler/GetEnumValueHandler.js +2 -3
  80. package/lib/core/handler/GetInstanceMethodAsDelegateHandler.js +3 -3
  81. package/lib/core/handler/GetModuleHandler.js +2 -2
  82. package/lib/core/handler/GetRefValueHandler.js +2 -3
  83. package/lib/core/handler/GetStaticFieldHandler.js +0 -1
  84. package/lib/core/handler/GetStaticMethodAsDelegateHandler.js +3 -1
  85. package/lib/core/handler/GetTypeHandler.js +3 -3
  86. package/lib/core/handler/Handler.js +47 -33
  87. package/lib/core/handler/HeartBeatHandler.js +2 -3
  88. package/lib/core/handler/InvokeGenericMethodHandler.js +2 -4
  89. package/lib/core/handler/InvokeGenericStaticMethodHandler.js +2 -3
  90. package/lib/core/handler/InvokeStaticMethodHandler.js +1 -1
  91. package/lib/core/handler/LoadLibraryHandler.js +15 -7
  92. package/lib/core/handler/OptimizeHandler.js +2 -3
  93. package/lib/core/handler/PluginWrapperHandler.js +2 -3
  94. package/lib/core/handler/ResolveReferenceHandler.js +1 -3
  95. package/lib/core/handler/RetrieveArrayHandler.js +2 -3
  96. package/lib/core/interpreter/Interpreter.js +47 -20
  97. package/lib/core/protocol/CommandDeserializer.js +4 -4
  98. package/lib/core/protocol/CommandSerializer.js +8 -2
  99. package/lib/core/protocol/TypeDeserializer.js +11 -11
  100. package/lib/core/receiver/Receiver.js +10 -13
  101. package/lib/core/receiver/ReceiverNative.js +4 -2
  102. package/lib/core/transmitter/Transmitter.js +7 -7
  103. package/lib/core/transmitter/TransmitterWebsocket.js +2 -2
  104. package/lib/core/transmitter/TransmitterWebsocketBrowser.js +2 -2
  105. package/lib/core/transmitter/TransmitterWrapper.js +2 -1
  106. package/lib/core/webSocketClient/WebSocketClient.js +5 -5
  107. package/lib/core/webSocketClient/WebSocketClientBrowser.js +10 -10
  108. package/lib/sdk/ActivatorDetails.js +1 -1
  109. package/lib/sdk/ConfigRuntimeFactory.js +65 -48
  110. package/lib/sdk/InvocationContext.js +58 -43
  111. package/lib/sdk/Javonet.js +31 -2
  112. package/lib/sdk/RuntimeContext.js +0 -7
  113. package/lib/sdk/RuntimeFactory.js +49 -1
  114. package/lib/sdk/configuration/Config.js +37 -0
  115. package/lib/sdk/configuration/ConfigPriority.js +9 -0
  116. package/lib/sdk/configuration/ConfigSourceResolver.js +84 -0
  117. package/lib/sdk/configuration/ConfigsDictionary.js +118 -0
  118. package/lib/sdk/configuration/configResolvers/ConfigResolver.js +109 -0
  119. package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +119 -0
  120. package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +99 -0
  121. package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +109 -0
  122. package/lib/sdk/tools/ActivationHelper.js +1 -1
  123. package/lib/sdk/tools/ComplexTypeResolver.js +22 -3
  124. package/lib/sdk/tools/JsonResolver.js +5 -1
  125. package/lib/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.js +1 -1
  126. package/lib/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.js +1 -1
  127. package/lib/sdk/tools/typeParsingFunctions/TypeParsingUtils.js +4 -1
  128. package/lib/utils/CommandType.js +1 -1
  129. package/lib/utils/CustomError.js +1 -1
  130. package/lib/utils/Runtime.js +11 -4
  131. package/lib/utils/RuntimeLoggerBrowser.js +0 -1
  132. package/lib/utils/RuntimeNameHandler.js +37 -0
  133. package/lib/utils/TypesHandler.js +11 -5
  134. package/lib/utils/connectionData/InMemoryConnectionData.js +8 -1
  135. package/lib/utils/connectionData/WsConnectionData.js +7 -0
  136. package/lib/utils/exception/ExceptionSerializer.js +6 -2
  137. package/lib/utils/nodejs/connectionData/TcpConnectionData.js +16 -6
  138. package/lib/utils/nodejs/uuid/v4.js +0 -1
  139. package/package.json +6 -2
@@ -55,10 +55,10 @@ class AbstractHandler {
55
55
  }
56
56
  }
57
57
  /**
58
- *
59
- * @param {*} error
60
- * @param {*} class_name
61
- * @returns
58
+ *
59
+ * @param {*} error
60
+ * @param {*} class_name
61
+ * @returns
62
62
  */
63
63
  process_stack_trace(error, class_name) {
64
64
  let stackTraceArray = error.stack.split("\n").map((frame) => frame.trim());
@@ -77,10 +77,8 @@ class GetInstanceMethodAsDelegateHandler extends import_AbstractHandler.Abstract
77
77
  const methods = Object.getOwnPropertyNames(
78
78
  /** @type {{prototype: Object}} */
79
79
  type.prototype
80
- ).filter(
81
- (key) => typeof /** @type {any} */
82
- type.prototype[key] === "function"
83
- );
80
+ ).filter((key) => typeof /** @type {any} */
81
+ type.prototype[key] === "function");
84
82
  const availableMethods = methods.map((name) => `${name}()`);
85
83
  const message = `Method ${methodName} not found in class ${/** @type {{name: string}} */
86
84
  type.name}. Available instance public methods:
@@ -70,8 +70,10 @@ class GetStaticMethodAsDelegateHandler extends import_AbstractHandler.AbstractHa
70
70
  * @returns {Error} The error with detailed message.
71
71
  */
72
72
  createMethodNotFoundError(type, methodName) {
73
- const methods = Object.keys(type).filter((key) => typeof /** @type {any} */
74
- type[key] === "function");
73
+ const methods = Object.keys(type).filter(
74
+ (key) => typeof /** @type {any} */
75
+ type[key] === "function"
76
+ );
75
77
  const availableMethods = methods.map((name) => `${name}()`);
76
78
  const message = `Method ${methodName} not found in class ${/** @type {{name: string}} */
77
79
  type.name}. Available public static methods:
@@ -36,9 +36,9 @@ class GetTypeHandler extends import_AbstractHandler.AbstractHandler {
36
36
  this.loadLibaryHandler = new import_LoadLibraryHandler.LoadLibraryHandler();
37
37
  }
38
38
  /**
39
- *
40
- * @param {Command} command
41
- * @returns
39
+ *
40
+ * @param {Command} command
41
+ * @returns
42
42
  */
43
43
  process(command) {
44
44
  try {
@@ -146,10 +146,16 @@ class Handler {
146
146
  handleCommand(command) {
147
147
  try {
148
148
  if (command.commandType === import_CommandType.CommandType.RetrieveArray) {
149
- let responseArray = handlers[import_CommandType.CommandType.Reference].handleCommand(command.payload[0]);
150
- return import_Command.Command.createArrayResponse(responseArray, command.runtimeName);
149
+ const responseArray = handlers[import_CommandType.CommandType.Reference].handleCommand(command.payload[0]);
150
+ if (responseArray instanceof Promise) {
151
+ return responseArray.then((resolvedResponseArray) => {
152
+ return import_Command.Command.createArrayResponse(resolvedResponseArray, command.runtimeName);
153
+ });
154
+ } else {
155
+ return import_Command.Command.createArrayResponse(responseArray, command.runtimeName);
156
+ }
151
157
  }
152
- let response = handlers[command.commandType].handleCommand(command);
158
+ const response = handlers[command.commandType].handleCommand(command);
153
159
  return this.parseCommand(response, command.runtimeName);
154
160
  } catch (e) {
155
161
  return import_ExceptionSerializer.ExceptionSerializer.serializeException(e, command);
@@ -158,9 +164,14 @@ class Handler {
158
164
  /**
159
165
  * @param {any} response
160
166
  * @param {RuntimeName} runtimeName
161
- * @returns {Command}
167
+ * @returns {Promise<Command> | Command}
162
168
  */
163
169
  parseCommand(response, runtimeName) {
170
+ if (response instanceof Promise) {
171
+ return response.then((resolvedResponse) => {
172
+ return this.parseCommand(resolvedResponse, runtimeName);
173
+ });
174
+ }
164
175
  if (import_TypesHandler.TypesHandler.isPrimitiveOrNullOrUndefined(response)) {
165
176
  return import_Command.Command.createResponse(response, runtimeName);
166
177
  } else {
@@ -23,6 +23,8 @@ __export(LoadLibraryHandler_exports, {
23
23
  module.exports = __toCommonJS(LoadLibraryHandler_exports);
24
24
  var import_Runtime = require("../../utils/Runtime.cjs");
25
25
  var import_AbstractHandler = require("./AbstractHandler.cjs");
26
+ var import_fs = require("fs");
27
+ var import_path = require("path");
26
28
  const import_meta = {};
27
29
  const dynamicImport = (0, import_Runtime.getRequire)(import_meta.url);
28
30
  class LoadLibraryHandler extends import_AbstractHandler.AbstractHandler {
@@ -41,6 +43,13 @@ class LoadLibraryHandler extends import_AbstractHandler.AbstractHandler {
41
43
  }
42
44
  let { payload } = command;
43
45
  let [lib] = payload;
46
+ if (!lib) {
47
+ throw new Error("Cannot load module: Library path is required but was not provided");
48
+ }
49
+ const absolutePath = (0, import_path.resolve)(lib);
50
+ if (!(0, import_fs.existsSync)(lib) && !(0, import_fs.existsSync)(absolutePath)) {
51
+ throw new Error(`Cannot load module: Library not found: ${lib}`);
52
+ }
44
53
  let pathArray = lib.split(/[/\\]/);
45
54
  let libraryName = pathArray.length > 1 ? pathArray[pathArray.length - 1] : pathArray[0];
46
55
  libraryName = libraryName.replace(".js", "");
@@ -49,12 +58,7 @@ class LoadLibraryHandler extends import_AbstractHandler.AbstractHandler {
49
58
  moduleExports = dynamicImport(lib);
50
59
  LoadLibraryHandler.loadedLibraries.push(lib);
51
60
  } catch (error) {
52
- try {
53
- const modulePath = `${process.cwd()}/${lib}`;
54
- moduleExports = dynamicImport(modulePath);
55
- } catch (error2) {
56
- throw this.process_stack_trace(error2, this.constructor.name);
57
- }
61
+ throw Error("Cannot load module: " + lib + "\n" + error);
58
62
  }
59
63
  global[libraryName] = moduleExports;
60
64
  for (const [key, value] of Object.entries(moduleExports)) {
@@ -30,8 +30,8 @@ var import_TransmitterWebsocketBrowser = require("../transmitter/TransmitterWebs
30
30
  var import_TransmitterWebsocket = require("../transmitter/TransmitterWebsocket.cjs");
31
31
  var import_Handler = require("../handler/Handler.cjs");
32
32
  const import_meta = {};
33
- let _Receiver = null;
34
- let _Transmitter = null;
33
+ let _Receiver;
34
+ let _Transmitter;
35
35
  let _TransmitterWebsocket = null;
36
36
  if (!_TransmitterWebsocket) {
37
37
  _TransmitterWebsocket = (0, import_Runtime.isNodejsRuntime)() ? import_TransmitterWebsocket.TransmitterWebsocket : import_TransmitterWebsocketBrowser.TransmitterWebsocketBrowser;
@@ -58,7 +58,10 @@ class Interpreter {
58
58
  let messageByteArray = new import_CommandSerializer.CommandSerializer().serialize(command, connectionData);
59
59
  let responseByteArray = void 0;
60
60
  if (connectionData.connectionType === import_ConnectionType.ConnectionType.WEB_SOCKET) {
61
- const _response = await _TransmitterWebsocket?.sendCommand(messageByteArray, connectionData);
61
+ const _response = await _TransmitterWebsocket?.sendCommand(
62
+ await messageByteArray,
63
+ connectionData
64
+ );
62
65
  if (_response) {
63
66
  const command2 = new import_CommandDeserializer.CommandDeserializer(_response).deserialize();
64
67
  return command2;
@@ -74,13 +77,13 @@ class Interpreter {
74
77
  const { Receiver } = require("../receiver/Receiver.cjs");
75
78
  _Receiver = Receiver;
76
79
  }
77
- responseByteArray = await _Receiver?.sendCommand(messageByteArray);
80
+ responseByteArray = await _Receiver?.sendCommand(await messageByteArray);
78
81
  } else {
79
82
  if (!_Transmitter) {
80
83
  const { Transmitter } = require("../transmitter/Transmitter.cjs");
81
84
  _Transmitter = Transmitter;
82
85
  }
83
- responseByteArray = await _Transmitter?.sendCommand(messageByteArray);
86
+ responseByteArray = await _Transmitter?.sendCommand(await messageByteArray);
84
87
  }
85
88
  }
86
89
  if (!responseByteArray) {
@@ -103,37 +106,60 @@ class Interpreter {
103
106
  let responseByteArray = void 0;
104
107
  if (connectionData.connectionType === import_ConnectionType.ConnectionType.WEB_SOCKET) {
105
108
  throw new Error("Not supported");
106
- }
107
- if (connectionData.connectionType === import_ConnectionType.ConnectionType.IN_MEMORY) {
109
+ } else {
108
110
  if (!(0, import_Runtime.isNodejsRuntime)()) {
109
111
  throw new Error("InMemory is only allowed in Nodejs runtime");
110
112
  }
111
- if (command.runtimeName === import_RuntimeName.RuntimeName.Nodejs) {
113
+ if (command.runtimeName === import_RuntimeName.RuntimeName.Nodejs && connectionData.connectionType === import_ConnectionType.ConnectionType.IN_MEMORY) {
112
114
  if (!_Receiver) {
113
115
  const { Receiver } = require("../receiver/Receiver.cjs");
114
116
  _Receiver = Receiver;
115
117
  }
116
- responseByteArray = _Receiver?.sendCommand(messageByteArray);
118
+ if (!_Receiver) {
119
+ throw new Error("Receiver is undefined");
120
+ }
121
+ if (messageByteArray instanceof Uint8Array) {
122
+ responseByteArray = _Receiver.sendCommand(messageByteArray);
123
+ } else {
124
+ responseByteArray = messageByteArray.then((resolvedMessage) => {
125
+ return _Receiver.sendCommand(resolvedMessage);
126
+ });
127
+ }
117
128
  } else {
118
129
  if (!_Transmitter) {
119
130
  const { Transmitter } = require("../transmitter/Transmitter.cjs");
120
131
  _Transmitter = Transmitter;
121
132
  }
122
- responseByteArray = _Transmitter?.sendCommand(messageByteArray);
133
+ if (!_Transmitter) {
134
+ throw new Error("Transmitter is undefined");
135
+ }
136
+ if (messageByteArray instanceof Uint8Array) {
137
+ responseByteArray = _Transmitter.sendCommand(messageByteArray);
138
+ } else {
139
+ responseByteArray = messageByteArray.then((resolvedMessage) => {
140
+ return _Transmitter.sendCommand(resolvedMessage);
141
+ });
142
+ }
143
+ }
144
+ if (!responseByteArray) {
145
+ throw new Error("No response received from Transmitter");
146
+ }
147
+ if (responseByteArray instanceof Promise) {
148
+ return responseByteArray.then((resolvedResponse) => {
149
+ return new import_CommandDeserializer.CommandDeserializer(resolvedResponse).deserialize();
150
+ });
151
+ } else {
152
+ return new import_CommandDeserializer.CommandDeserializer(responseByteArray).deserialize();
123
153
  }
124
154
  }
125
- if (!responseByteArray) {
126
- throw new Error("No response received from Transmitter");
127
- }
128
- return new import_CommandDeserializer.CommandDeserializer(responseByteArray).deserialize();
129
155
  } catch (error) {
130
156
  throw error;
131
157
  }
132
158
  }
133
159
  /**
134
160
  *
135
- * @param {Int8Array} messageByteArray
136
- * @returns {Command}
161
+ * @param {Uint8Array} messageByteArray
162
+ * @returns {Promise<Command> | Command}
137
163
  */
138
164
  process(messageByteArray) {
139
165
  try {
@@ -26,11 +26,11 @@ var import_Type = require("../../utils/Type.cjs");
26
26
  var import_TypeDeserializer = require("./TypeDeserializer.cjs");
27
27
  class CommandDeserializer {
28
28
  /**
29
- * @param {Int8Array} buffer
29
+ * @param {Uint8Array} byteArray
30
30
  */
31
- constructor(buffer) {
32
- this.buffer = buffer;
33
- this.command = new import_Command.Command(buffer[0], buffer[10], []);
31
+ constructor(byteArray) {
32
+ this.buffer = byteArray;
33
+ this.command = new import_Command.Command(this.buffer[0], this.buffer[10], []);
34
34
  this.position = 11;
35
35
  }
36
36
  /**
@@ -30,13 +30,18 @@ var import_TypesHandler = require("../../utils/TypesHandler.cjs");
30
30
  class CommandSerializer {
31
31
  /**
32
32
  * Serializes the root command with connection data and optional runtime version.
33
- * @param {Command} rootCommand
33
+ * @param {Promise<Command> | Command} rootCommand
34
34
  * @param {IConnectionData} connectionData
35
35
  * @param {number} runtimeVersion
36
- * @returns {Int8Array}
36
+ * @returns {Promise<Uint8Array> | Uint8Array}
37
37
  */
38
38
  serialize(rootCommand, connectionData, runtimeVersion = 0) {
39
39
  const buffers = [];
40
+ if (rootCommand instanceof Promise) {
41
+ return rootCommand.then((resolvedCommand) => {
42
+ return this.serialize(resolvedCommand, connectionData, runtimeVersion);
43
+ });
44
+ }
40
45
  buffers.push(Uint8Array.of(rootCommand.runtimeName, runtimeVersion));
41
46
  if (connectionData) {
42
47
  buffers.push(connectionData.serializeConnectionData());
@@ -26,7 +26,7 @@ var import_buffer = require("buffer");
26
26
  var import_StringEncodingMode = require("../../utils/StringEncodingMode.cjs");
27
27
  class TypeDeserializer {
28
28
  /**
29
- * @param {Int8Array} encodedCommand
29
+ * @param {Uint8Array} encodedCommand
30
30
  * @returns {Command}
31
31
  */
32
32
  static deserializeCommand(encodedCommand) {
@@ -34,7 +34,7 @@ class TypeDeserializer {
34
34
  }
35
35
  /**
36
36
  * @param {number} stringEncodingMode
37
- * @param {Int8Array} encodedString
37
+ * @param {Uint8Array} encodedString
38
38
  */
39
39
  static deserializeString(stringEncodingMode, encodedString) {
40
40
  switch (stringEncodingMode) {
@@ -62,55 +62,55 @@ class TypeDeserializer {
62
62
  }
63
63
  }
64
64
  /**
65
- * @param {Int8Array} encodedInt
65
+ * @param {Uint8Array} encodedInt
66
66
  */
67
67
  static deserializeInt(encodedInt) {
68
68
  return encodedInt[0] & 255 | (encodedInt[1] & 255) << 8 | (encodedInt[2] & 255) << 16 | (encodedInt[3] & 255) << 24;
69
69
  }
70
70
  /**
71
- * @param {Int8Array} encodedBool
71
+ * @param {Uint8Array} encodedBool
72
72
  */
73
73
  static deserializeBool(encodedBool) {
74
74
  return encodedBool[0] === 1;
75
75
  }
76
76
  /**
77
- * @param {Int8Array} encodedFloat
77
+ * @param {Uint8Array} encodedFloat
78
78
  */
79
79
  static deserializeFloat(encodedFloat) {
80
80
  return import_buffer.Buffer.from(encodedFloat).readFloatLE();
81
81
  }
82
82
  /**
83
- * @param {Int8Array} encodedByte
83
+ * @param {Uint8Array} encodedByte
84
84
  */
85
85
  static deserializeByte(encodedByte) {
86
86
  return import_buffer.Buffer.from(encodedByte).readUint8();
87
87
  }
88
88
  /**
89
- * @param {Int8Array} encodedChar
89
+ * @param {Uint8Array} encodedChar
90
90
  */
91
91
  static deserializeChar(encodedChar) {
92
92
  return import_buffer.Buffer.from(encodedChar).readUint8();
93
93
  }
94
94
  /**
95
- * @param {Int8Array} encodedLongLong
95
+ * @param {Uint8Array} encodedLongLong
96
96
  */
97
97
  static deserializeLongLong(encodedLongLong) {
98
98
  return import_buffer.Buffer.from(encodedLongLong).readBigInt64LE();
99
99
  }
100
100
  /**
101
- * @param {Int8Array} encodedDouble
101
+ * @param {Uint8Array} encodedDouble
102
102
  */
103
103
  static deserializeDouble(encodedDouble) {
104
104
  return import_buffer.Buffer.from(encodedDouble).readDoubleLE();
105
105
  }
106
106
  /**
107
- * @param {Int8Array} encodedULLong
107
+ * @param {Uint8Array} encodedULLong
108
108
  */
109
109
  static deserializeULLong(encodedULLong) {
110
110
  return import_buffer.Buffer.from(encodedULLong).readBigUInt64LE();
111
111
  }
112
112
  /**
113
- * @param {Int8Array} encodedUInt
113
+ * @param {Uint8Array} encodedUInt
114
114
  */
115
115
  static deserializeUInt(encodedUInt) {
116
116
  return import_buffer.Buffer.from(encodedUInt).readUIntLE(0, 4);
@@ -38,14 +38,13 @@ class Receiver {
38
38
  return import_RuntimeLogger.RuntimeLogger.getRuntimeInfo();
39
39
  }
40
40
  /**
41
- * @param {Int8Array} messageByteArray
41
+ * @param {Uint8Array} messageByteArray
42
+ * @returns {Promise<Uint8Array> | Uint8Array}
42
43
  */
43
44
  static sendCommand(messageByteArray) {
44
45
  try {
45
- return new import_CommandSerializer.CommandSerializer().serialize(
46
- new import_Interpreter.Interpreter().process(messageByteArray),
47
- this.connectionData
48
- );
46
+ let command = new import_Interpreter.Interpreter().process(messageByteArray);
47
+ return new import_CommandSerializer.CommandSerializer().serialize(command, this.connectionData);
49
48
  } catch (error) {
50
49
  const exceptionCommand = import_ExceptionSerializer.ExceptionSerializer.serializeException(
51
50
  error,
@@ -55,11 +54,11 @@ class Receiver {
55
54
  }
56
55
  }
57
56
  /**
58
- * @param {Int8Array} messageByteArray
59
- * @returns {Int8Array}
57
+ * @param {Uint8Array} messageByteArray
58
+ * @returns {Promise<Uint8Array> | Uint8Array}
60
59
  */
61
60
  static heartBeat(messageByteArray) {
62
- let response = new Int8Array(2);
61
+ let response = new Uint8Array(2);
63
62
  response[0] = messageByteArray[11];
64
63
  response[1] = messageByteArray[12] - 2;
65
64
  return response;
@@ -24,13 +24,15 @@ module.exports = __toCommonJS(ReceiverNative_exports);
24
24
  var import_Receiver = require("./Receiver.cjs");
25
25
  class ReceiverNative {
26
26
  /**
27
- * @param {Int8Array} messageByteArray
27
+ * @param {Uint8Array} messageByteArray
28
+ * @returns {Promise<Uint8Array> | Uint8Array}
28
29
  */
29
30
  static sendCommand(messageByteArray) {
30
31
  return import_Receiver.Receiver.sendCommand(messageByteArray);
31
32
  }
32
33
  /**
33
- * @param {Int8Array} messageByteArray
34
+ * @param {Uint8Array} messageByteArray
35
+ * @returns {Uint8Array | Promise<Uint8Array>}
34
36
  */
35
37
  static heartBeat(messageByteArray) {
36
38
  return import_Receiver.Receiver.heartBeat(messageByteArray);
@@ -24,14 +24,14 @@ module.exports = __toCommonJS(Transmitter_exports);
24
24
  var import_TransmitterWrapper = require("./TransmitterWrapper.cjs");
25
25
  class Transmitter {
26
26
  /**
27
- * @param {Int8Array} messageArray
28
- * @returns {Int8Array}
27
+ * @param {Uint8Array} messageArray
28
+ * @returns {Uint8Array}
29
29
  */
30
30
  static sendCommand(messageArray) {
31
31
  return import_TransmitterWrapper.TransmitterWrapper.sendCommand(messageArray);
32
32
  }
33
33
  /**
34
- * @param {string} licenseKey
34
+ * @param {string} licenseKey
35
35
  * @returns {void}
36
36
  */
37
37
  static activate(licenseKey) {
@@ -40,13 +40,13 @@ class Transmitter {
40
40
  /**
41
41
  * @param {string} configSource
42
42
  * @returns {void}
43
- */
43
+ */
44
44
  static setConfigSource(configSource) {
45
45
  return import_TransmitterWrapper.TransmitterWrapper.setConfigSource(configSource);
46
46
  }
47
47
  /**
48
- * @param {string} workingDirectory
49
- * @returns
48
+ * @param {string} workingDirectory
49
+ * @returns
50
50
  */
51
51
  static setJavonetWorkingDirectory(workingDirectory) {
52
52
  return import_TransmitterWrapper.TransmitterWrapper.setJavonetWorkingDirectory(workingDirectory);
@@ -40,9 +40,9 @@ class TransmitterWebsocket {
40
40
  }
41
41
  /**
42
42
  * @async
43
- * @param {Int8Array} messageByteArray
43
+ * @param {Uint8Array} messageByteArray
44
44
  * @param {IConnectionData} connectionData
45
- * @returns {Promise<Int8Array>} responseByteArray
45
+ * @returns {Promise<Uint8Array>} responseByteArray
46
46
  */
47
47
  static sendCommand(messageByteArray, connectionData) {
48
48
  const { hostname } = connectionData;
@@ -35,9 +35,9 @@ class TransmitterWebsocketBrowser {
35
35
  }
36
36
  /**
37
37
  * @async
38
- * @param {Int8Array} messageByteArray
38
+ * @param {Uint8Array} messageByteArray
39
39
  * @param {IConnectionData} connectionData
40
- * @returns {Promise<Int8Array>} responseByteArray
40
+ * @returns {Promise<Uint8Array>} responseByteArray
41
41
  */
42
42
  static async sendCommand(messageByteArray, connectionData) {
43
43
  const { hostname } = connectionData;
@@ -65,7 +65,8 @@ class TransmitterWrapper {
65
65
  return library.activate(licenseKey);
66
66
  }
67
67
  /**
68
- * @param {Int8Array} messageArray
68
+ * @param {Uint8Array} messageArray
69
+ * @returns {Uint8Array}
69
70
  */
70
71
  static sendCommand(messageArray) {
71
72
  this.loadNativeLibrary();
@@ -62,8 +62,8 @@ class WebSocketClient {
62
62
  /**
63
63
  * Sends messageArray through websocket connection with guaranteed order preservation
64
64
  * @async
65
- * @param {Int8Array} messageArray
66
- * @returns {Promise<Int8Array>}
65
+ * @param {Uint8Array} messageArray
66
+ * @returns {Promise<Uint8Array>}
67
67
  */
68
68
  send(messageArray) {
69
69
  return new Promise((resolve, reject) => {
@@ -104,8 +104,8 @@ class WebSocketClient {
104
104
  * Sends a single message through websocket connection
105
105
  * @private
106
106
  * @async
107
- * @param {Int8Array} messageArray
108
- * @returns {Promise<Int8Array>}
107
+ * @param {Uint8Array} messageArray
108
+ * @returns {Promise<Uint8Array>}
109
109
  */
110
110
  _send(messageArray) {
111
111
  return new Promise((resolve, reject) => {
@@ -60,8 +60,8 @@ class WebSocketClientBrowser {
60
60
  /**
61
61
  * Sends messageArray through websocket connection with guaranteed order preservation
62
62
  * @async
63
- * @param {Int8Array} messageArray
64
- * @returns {Promise<Int8Array>}
63
+ * @param {Uint8Array} messageArray
64
+ * @returns {Promise<Uint8Array>}
65
65
  */
66
66
  send(messageArray) {
67
67
  return new Promise((resolve, reject) => {
@@ -102,8 +102,8 @@ class WebSocketClientBrowser {
102
102
  * Sends a single message through websocket connection
103
103
  * @private
104
104
  * @async
105
- * @param {Int8Array} messageArray
106
- * @returns {Promise<Int8Array>}
105
+ * @param {Uint8Array} messageArray
106
+ * @returns {Promise<Uint8Array>}
107
107
  */
108
108
  _sendSingle(messageArray) {
109
109
  return new Promise((resolve, reject) => {
@@ -162,8 +162,8 @@ class WebSocketClientBrowser {
162
162
  * Sends the data to the WebSocket server and listens for a response.
163
163
  * @private
164
164
  * @param {WebSocket} client
165
- * @param {Int8Array} data
166
- * @param {(value: Int8Array) => void} resolve
165
+ * @param {Uint8Array} data
166
+ * @param {(value: Uint8Array) => void} resolve
167
167
  * @param {(reason?: any) => void} reject
168
168
  */
169
169
  _sendMessage(client, data, resolve, reject) {
@@ -174,7 +174,7 @@ class WebSocketClientBrowser {
174
174
  if (!message?.data) {
175
175
  return reject(new Error("Invalid message received"));
176
176
  }
177
- const byteArray = new Int8Array(message?.data);
177
+ const byteArray = new Uint8Array(message?.data);
178
178
  resolve(byteArray);
179
179
  if (this.isDisconnectedAfterMessage) {
180
180
  this.disconnect();