javonet-nodejs-sdk 2.5.12 → 2.5.14

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 (212) hide show
  1. package/Binaries/Clr/Javonet.Clr.Utils.dll +0 -0
  2. package/Binaries/Clr/JavonetClrRuntime.dll +0 -0
  3. package/Binaries/Jvm/JavonetJvmRuntime.jar +0 -0
  4. package/Binaries/Native/Linux/ARM64/libJavonetActivationService.so +0 -0
  5. package/Binaries/Native/Linux/ARM64/libJavonetCppRuntimeNative.so +0 -0
  6. package/Binaries/Native/Linux/ARM64/libJavonetGoRuntimeNative.so +0 -0
  7. package/Binaries/Native/Linux/ARM64/libJavonetJvmRuntimeNative.so +0 -0
  8. package/Binaries/Native/Linux/ARM64/libJavonetNetcoreRuntimeNative.so +0 -0
  9. package/Binaries/Native/Linux/ARM64/libJavonetPythonRuntimeNative.so +0 -0
  10. package/Binaries/Native/Linux/ARM64/libJavonetRuby278RuntimeNative.so +0 -0
  11. package/Binaries/Native/Linux/ARM64/libJavonetRubyRuntimeNative.so +0 -0
  12. package/Binaries/Native/Linux/ARM64/libJavonetTcpClient.so +0 -0
  13. package/Binaries/Native/Linux/ARM64/libJavonetTcpTlsClient.so +0 -0
  14. package/Binaries/Native/Linux/ARM64/libUtils.so +0 -0
  15. package/Binaries/Native/Linux/ARM64/version.txt +1 -1
  16. package/Binaries/Native/Linux/X64/NativeUtilsUnitTests.xml +30 -30
  17. package/Binaries/Native/Linux/X64/libJavonetActivationService.so +0 -0
  18. package/Binaries/Native/Linux/X64/libJavonetCppRuntimeNative.so +0 -0
  19. package/Binaries/Native/Linux/X64/libJavonetGoRuntimeNative.so +0 -0
  20. package/Binaries/Native/Linux/X64/libJavonetJvmRuntimeNative.so +0 -0
  21. package/Binaries/Native/Linux/X64/libJavonetNetcoreRuntimeNative.so +0 -0
  22. package/Binaries/Native/Linux/X64/libJavonetNodejs1816RuntimeNative.so +0 -0
  23. package/Binaries/Native/Linux/X64/libJavonetNodejsRuntimeNative.so +0 -0
  24. package/Binaries/Native/Linux/X64/libJavonetPerlRuntimeNative.so +0 -0
  25. package/Binaries/Native/Linux/X64/libJavonetPythonRuntimeNative.so +0 -0
  26. package/Binaries/Native/Linux/X64/libJavonetRuby278RuntimeNative.so +0 -0
  27. package/Binaries/Native/Linux/X64/libJavonetRubyRuntimeNative.so +0 -0
  28. package/Binaries/Native/Linux/X64/libJavonetTcpClient.so +0 -0
  29. package/Binaries/Native/Linux/X64/libJavonetTcpTlsClient.so +0 -0
  30. package/Binaries/Native/Linux/X64/libUtils.so +0 -0
  31. package/Binaries/Native/Linux/X64/openssl3/libJavonetActivationService.so +0 -0
  32. package/Binaries/Native/Linux/X64/openssl3/libJavonetTcpTlsClient.so +0 -0
  33. package/Binaries/Native/Linux/X64/openssl3/libUtils.so +0 -0
  34. package/Binaries/Native/Linux/X64/version.txt +1 -1
  35. package/Binaries/Native/MacOs/X64/libJavonetActivationService.dylib +0 -0
  36. package/Binaries/Native/MacOs/X64/libJavonetCppRuntimeNative.dylib +0 -0
  37. package/Binaries/Native/MacOs/X64/libJavonetGoRuntimeNative.dylib +0 -0
  38. package/Binaries/Native/MacOs/X64/libJavonetJvmRuntimeNative.dylib +0 -0
  39. package/Binaries/Native/MacOs/X64/libJavonetNetcoreRuntimeNative.dylib +0 -0
  40. package/Binaries/Native/MacOs/X64/libJavonetNodejs1816RuntimeNative.dylib +0 -0
  41. package/Binaries/Native/MacOs/X64/libJavonetNodejsRuntimeNative.dylib +0 -0
  42. package/Binaries/Native/MacOs/X64/libJavonetPerlRuntimeNative.dylib +0 -0
  43. package/Binaries/Native/MacOs/X64/libJavonetPythonRuntimeNative.dylib +0 -0
  44. package/Binaries/Native/MacOs/X64/libJavonetRuby278RuntimeNative.dylib +0 -0
  45. package/Binaries/Native/MacOs/X64/libJavonetRubyRuntimeNative.dylib +0 -0
  46. package/Binaries/Native/MacOs/X64/libJavonetTcpClient.dylib +0 -0
  47. package/Binaries/Native/MacOs/X64/libJavonetTcpTlsClient.dylib +0 -0
  48. package/Binaries/Native/MacOs/X64/libUtils.dylib +0 -0
  49. package/Binaries/Native/MacOs/X64/version.txt +1 -1
  50. package/Binaries/Native/Windows/ARM64/JavonetActivationService.dll +0 -0
  51. package/Binaries/Native/Windows/ARM64/JavonetCppRuntimeNative.dll +0 -0
  52. package/Binaries/Native/Windows/ARM64/JavonetGoRuntimeNative.dll +0 -0
  53. package/Binaries/Native/Windows/ARM64/JavonetJvmRuntimeNative.dll +0 -0
  54. package/Binaries/Native/Windows/ARM64/JavonetNetcoreRuntimeNative.dll +0 -0
  55. package/Binaries/Native/Windows/ARM64/JavonetPythonRuntimeNative.dll +0 -0
  56. package/Binaries/Native/Windows/ARM64/JavonetRuby278RuntimeNative.dll +0 -0
  57. package/Binaries/Native/Windows/ARM64/JavonetRubyRuntimeNative.dll +0 -0
  58. package/Binaries/Native/Windows/ARM64/JavonetTcpClient.dll +0 -0
  59. package/Binaries/Native/Windows/ARM64/JavonetTcpTlsClient.dll +0 -0
  60. package/Binaries/Native/Windows/ARM64/Utils.dll +0 -0
  61. package/Binaries/Native/Windows/ARM64/version.txt +0 -0
  62. package/Binaries/Native/Windows/X64/JavonetActivationService.dll +0 -0
  63. package/Binaries/Native/Windows/X64/JavonetClrRuntimeNative.dll +0 -0
  64. package/Binaries/Native/Windows/X64/JavonetCppRuntimeNative.dll +0 -0
  65. package/Binaries/Native/Windows/X64/JavonetGoRuntimeNative.dll +0 -0
  66. package/Binaries/Native/Windows/X64/JavonetJvmRuntimeNative.dll +0 -0
  67. package/Binaries/Native/Windows/X64/JavonetNetcoreRuntimeNative.dll +0 -0
  68. package/Binaries/Native/Windows/X64/JavonetNodejs1816RuntimeNative.dll +0 -0
  69. package/Binaries/Native/Windows/X64/JavonetNodejsRuntimeNative.dll +0 -0
  70. package/Binaries/Native/Windows/X64/JavonetPerlRuntimeNative.dll +0 -0
  71. package/Binaries/Native/Windows/X64/JavonetPythonRuntimeNative.dll +0 -0
  72. package/Binaries/Native/Windows/X64/JavonetRuby278RuntimeNative.dll +0 -0
  73. package/Binaries/Native/Windows/X64/JavonetRubyRuntimeNative.dll +0 -0
  74. package/Binaries/Native/Windows/X64/JavonetTcpClient.dll +0 -0
  75. package/Binaries/Native/Windows/X64/JavonetTcpTlsClient.dll +0 -0
  76. package/Binaries/Native/Windows/X64/Utils.dll +0 -0
  77. package/Binaries/Native/Windows/X64/version.txt +1 -1
  78. package/Binaries/Native/Windows/X86/JavonetActivationService.dll +0 -0
  79. package/Binaries/Native/Windows/X86/JavonetClrRuntimeNative.dll +0 -0
  80. package/Binaries/Native/Windows/X86/JavonetCppRuntimeNative.dll +0 -0
  81. package/Binaries/Native/Windows/X86/JavonetGoRuntimeNative.dll +0 -0
  82. package/Binaries/Native/Windows/X86/JavonetJvmRuntimeNative.dll +0 -0
  83. package/Binaries/Native/Windows/X86/JavonetNetcoreRuntimeNative.dll +0 -0
  84. package/Binaries/Native/Windows/X86/JavonetPythonRuntimeNative.dll +0 -0
  85. package/Binaries/Native/Windows/X86/JavonetTcpClient.dll +0 -0
  86. package/Binaries/Native/Windows/X86/JavonetTcpTlsClient.dll +0 -0
  87. package/Binaries/Native/Windows/X86/Utils.dll +0 -0
  88. package/Binaries/Native/Windows/X86/version.txt +1 -1
  89. package/Binaries/Netcore/Javonet.Netcore.Core.dll +0 -0
  90. package/Binaries/Netcore/Javonet.Netcore.Utils.dll +0 -0
  91. package/Binaries/Nodejs/lib/core/interpreter/Interpreter.js +4 -0
  92. package/Binaries/Nodejs/lib/core/protocol/CommandDeserializer.js +30 -14
  93. package/Binaries/Nodejs/lib/core/protocol/CommandSerializer.js +38 -25
  94. package/Binaries/Nodejs/lib/core/protocol/TypeSerializer.js +1 -1
  95. package/Binaries/Nodejs/lib/core/webSocketClient/WebSocketClient.js +53 -48
  96. package/Binaries/Nodejs/lib/sdk/InvocationContext.js +3 -5
  97. package/Binaries/Nodejs/lib/sdk/RuntimeContext.js +2 -4
  98. package/Binaries/Perl/Linux/X64/deps/lib/perl5/Path/Tiny.pm +74 -15
  99. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Attribute-Util-1.07/install.json +1 -1
  100. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Capture-Tiny-0.50/install.json +1 -1
  101. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Class-Load-0.25/install.json +1 -1
  102. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Class-Load-XS-0.10/install.json +1 -1
  103. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Clone-0.47/install.json +1 -1
  104. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Data-Cmp-0.010/install.json +1 -1
  105. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Data-OptList-0.114/install.json +1 -1
  106. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Data-UUID-1.227/install.json +1 -1
  107. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Devel-GlobalDestruction-0.14/install.json +1 -1
  108. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Devel-OverloadInfo-0.007/install.json +1 -1
  109. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Devel-StackTrace-2.05/install.json +1 -1
  110. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Dist-CheckConflicts-0.11/install.json +1 -1
  111. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Eval-Closure-0.14/install.json +1 -1
  112. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/ExtUtils-Config-0.010/install.json +1 -1
  113. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/ExtUtils-Helpers-0.028/install.json +1 -1
  114. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/ExtUtils-InstallPaths-0.014/install.json +1 -1
  115. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/FFI-CheckLib-0.31/install.json +1 -1
  116. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/FFI-Platypus-2.10/install.json +1 -1
  117. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/File-Which-1.27/install.json +1 -1
  118. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/IPC-System-Simple-1.30/install.json +1 -1
  119. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/MRO-Compat-0.15/install.json +1 -1
  120. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Module-Build-0.4234/install.json +1 -1
  121. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Module-Build-Tiny-0.051/install.json +1 -1
  122. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Module-Implementation-0.09/install.json +1 -1
  123. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Module-Runtime-0.016/install.json +1 -1
  124. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Module-Runtime-Conflicts-0.003/install.json +1 -1
  125. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Moose-2.2207/install.json +1 -1
  126. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Nice-Try-v1.3.15/install.json +1 -1
  127. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/PPI-1.281/install.json +1 -1
  128. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/PPI-XS-0.910/install.json +1 -1
  129. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Package-DeprecationManager-0.18/install.json +1 -1
  130. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Package-Stash-0.40/install.json +1 -1
  131. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Package-Stash-XS-0.30/install.json +1 -1
  132. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Params-Util-1.102/install.json +1 -1
  133. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/{Path-Tiny-0.146 → Path-Tiny-0.148}/MYMETA.json +10 -6
  134. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Path-Tiny-0.148/install.json +1 -0
  135. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Safe-Isa-1.000010/install.json +1 -1
  136. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Scalar-List-Utils-1.68/install.json +1 -1
  137. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Scalar-Util-Numeric-0.40/install.json +1 -1
  138. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Scope-Guard-0.21/install.json +1 -1
  139. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Sub-Exporter-0.991/install.json +1 -1
  140. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Sub-Exporter-Progressive-0.001013/install.json +1 -1
  141. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Sub-Install-0.929/install.json +1 -1
  142. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Task-Weaken-1.06/install.json +1 -1
  143. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Test-Fatal-0.017/install.json +1 -1
  144. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Try-Tiny-0.32/install.json +1 -1
  145. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Want-0.29/install.json +1 -1
  146. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/YAML-PP-v0.39.0/install.json +1 -1
  147. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/aliased-0.34/install.json +1 -1
  148. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/autobox-v3.0.2/install.json +1 -1
  149. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Class/Load/XS/XS.so +0 -0
  150. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Data/UUID/UUID.so +0 -0
  151. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/FFI/Platypus/Platypus.so +0 -0
  152. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/List/Util/Util.so +0 -0
  153. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Moose/Moose.so +0 -0
  154. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/PPI/XS/XS.so +0 -0
  155. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Package/Stash/XS/XS.so +0 -0
  156. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Params/Util/Util.so +0 -0
  157. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Want/Want.so +0 -0
  158. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod +95 -95
  159. package/Binaries/Perl/Linux/X64/lib/Javonet/Core/Transmitter/PerlTransmitterWrapper.pm +10 -2
  160. package/Binaries/Perl/Linux/X64/lib/Javonet/Sdk/Core/PerlCommandType.pm +1 -1
  161. package/Binaries/Perl/Linux/X64/lib/Javonet/Sdk/Internal/InvocationContext.pm +53 -22
  162. package/Binaries/Perl/Linux/X64/lib/Javonet/Sdk/Internal/RuntimeContext.pm +17 -18
  163. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Attribute-Util-1.07/install.json +1 -1
  164. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Data-Cmp-0.010/install.json +1 -1
  165. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Data-UUID-1.227/install.json +1 -1
  166. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Nice-Try-v1.3.15/install.json +1 -1
  167. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/PPI-1.281/install.json +1 -1
  168. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/PPI-XS-0.910/install.json +1 -1
  169. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Safe-Isa-1.000010/install.json +1 -1
  170. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Scalar-Util-Numeric-0.40/install.json +1 -1
  171. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Test-Fatal-0.017/install.json +1 -1
  172. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/Want-0.29/install.json +1 -1
  173. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/YAML-PP-v0.39.0/install.json +1 -1
  174. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/.meta/autobox-v3.0.2/install.json +1 -1
  175. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/auto/Data/UUID/UUID.xs.dll +0 -0
  176. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/auto/PPI/XS/XS.xs.dll +0 -0
  177. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/auto/Scalar/Util/Numeric/Numeric.xs.dll +0 -0
  178. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/auto/Want/Want.xs.dll +0 -0
  179. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/auto/autobox/autobox.xs.dll +0 -0
  180. package/Binaries/Perl/Windows/X64/deps/lib/perl5/MSWin32-x64-multi-thread/perllocal.pod +25 -25
  181. package/Binaries/Perl/Windows/X64/lib/Javonet/Core/Transmitter/PerlTransmitterWrapper.pm +10 -2
  182. package/Binaries/Perl/Windows/X64/lib/Javonet/Sdk/Core/PerlCommandType.pm +1 -1
  183. package/Binaries/Perl/Windows/X64/lib/Javonet/Sdk/Internal/InvocationContext.pm +53 -22
  184. package/Binaries/Perl/Windows/X64/lib/Javonet/Sdk/Internal/RuntimeContext.pm +17 -18
  185. package/Binaries/Python/javonet/core/interpreter/Interpreter.py +28 -2
  186. package/Binaries/Python/javonet/core/protocol/CommandDeserializer.py +24 -10
  187. package/Binaries/Python/javonet/core/protocol/CommandSerializer.py +18 -17
  188. package/Binaries/Python/javonet/core/receiver/Receiver.py +20 -0
  189. package/Binaries/Python/javonet/utils/Command.py +23 -0
  190. package/Binaries/Python/javonet/utils/RuntimeName.py +3 -0
  191. package/Binaries/Python/javonet/utils/UtilsConst.py +42 -0
  192. package/Binaries/Python/javonet/utils/exception/ExceptionThrower.py +43 -39
  193. package/Binaries/Python/javonet/utils/messageHelper/MessageHelper.py +86 -0
  194. package/Binaries/Python/javonet/utils/messageHelper/__init__.py +0 -0
  195. package/Binaries/Ruby/Linux/X64/core/protocol/command_deserializer.rb +40 -33
  196. package/Binaries/Ruby/Linux/X64/core/protocol/command_serializer.rb +12 -19
  197. package/Binaries/Ruby/MacOs/X64/core/protocol/command_deserializer.rb +40 -33
  198. package/Binaries/Ruby/MacOs/X64/core/protocol/command_serializer.rb +12 -19
  199. package/Binaries/Ruby/Windows/X64/core/protocol/command_deserializer.rb +40 -33
  200. package/Binaries/Ruby/Windows/X64/core/protocol/command_serializer.rb +12 -19
  201. package/Binaries/version.txt +1 -1
  202. package/dist/Javonet.d.ts +34 -47
  203. package/dist/lib/core/interpreter/Interpreter.js +4 -0
  204. package/dist/lib/core/protocol/CommandDeserializer.js +30 -14
  205. package/dist/lib/core/protocol/CommandSerializer.js +38 -25
  206. package/dist/lib/core/protocol/TypeSerializer.js +1 -1
  207. package/dist/lib/core/webSocketClient/WebSocketClient.js +53 -48
  208. package/dist/lib/sdk/InvocationContext.js +3 -5
  209. package/dist/lib/sdk/RuntimeContext.js +2 -4
  210. package/lib/core/webSocketClient/WebSocketClient.js +53 -48
  211. package/package.json +1 -1
  212. package/Binaries/Perl/Linux/X64/deps/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Path-Tiny-0.146/install.json +0 -1
package/dist/Javonet.d.ts CHANGED
@@ -137,9 +137,8 @@ declare module "Binaries/Nodejs/lib/core/protocol/CommandDeserializer" {
137
137
  */
138
138
  deserialize(): Command;
139
139
  isAtEnd(): boolean;
140
- readObject(typeNum: any): any;
141
- readCommand(): any;
142
- readCommandRecursively(numberOfElementsInPayloadLeft: any, cmd: any): any;
140
+ readObject(typeNum: any): string | number | bigint | boolean | Command | (() => bigint) | null;
141
+ readCommand(): Command;
143
142
  readString(): string;
144
143
  readInt(): number;
145
144
  readBool(): boolean;
@@ -163,7 +162,7 @@ declare module "Binaries/Nodejs/lib/utils/CustomError" {
163
162
  declare module "Binaries/Nodejs/lib/core/protocol/TypeSerializer" {
164
163
  export = TypeSerializer;
165
164
  class TypeSerializer {
166
- static encodePrimitive(payload_item: any): Buffer<ArrayBuffer>;
165
+ static serializePrimitive(payload_item: any): Buffer<ArrayBuffer>;
167
166
  static serializeCommand(command: any): Buffer<ArrayBuffer>;
168
167
  static serializeString(string_value: any): Buffer<ArrayBuffer>;
169
168
  static serializeInt(int_value: any): Buffer<ArrayBuffer>;
@@ -194,9 +193,8 @@ declare module "Binaries/Nodejs/lib/utils/RuntimeName" {
194
193
  declare module "Binaries/Nodejs/lib/core/protocol/CommandSerializer" {
195
194
  export = CommandSerializer;
196
195
  class CommandSerializer {
197
- buffer: Int8Array<ArrayBuffer>;
198
- serialize(root_command: any, connectionData: any, runtimeVersion?: number): Int8Array<ArrayBuffer>;
199
- #private;
196
+ serialize(rootCommand: any, connectionData: any): Uint8Array<any>;
197
+ serializeRecursively(command: any, buffers: any): void;
200
198
  }
201
199
  }
202
200
  declare module "Binaries/Nodejs/lib/utils/ConnectionType" {
@@ -231,6 +229,12 @@ declare module "Binaries/Nodejs/lib/core/webSocketClient/WebSocketClient" {
231
229
  * @type {boolean}
232
230
  */
233
231
  isDisconnectedAfterMessage: boolean;
232
+ /**
233
+ * Connects to the WebSocket server.
234
+ * @async
235
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
236
+ */
237
+ connect(): Promise<WebSocket>;
234
238
  /**
235
239
  * Sends messageArray through websocket connection
236
240
  * @async
@@ -246,18 +250,9 @@ declare module "Binaries/Nodejs/lib/core/webSocketClient/WebSocketClient" {
246
250
  * Connects to the WebSocket server.
247
251
  * @private
248
252
  * @async
249
- * @returns {Promise<void>} - A promise that resolves when the connection is established.
253
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
250
254
  */
251
255
  private _connect;
252
- /**
253
- * Sends the data to the WebSocket server and listens for a response.
254
- * @private
255
- * @async
256
- * @param {string|Buffer|ArrayBuffer|Buffer[]} data - The data to send.
257
- * @param {Function} resolve - The resolve function for the Promise.
258
- * @param {Function} reject - The reject function for the Promise.
259
- */
260
- private _sendMessage;
261
256
  }
262
257
  }
263
258
  declare module "Binaries/Nodejs/lib/core/transmitter/TransmitterWebsocket" {
@@ -1635,7 +1630,7 @@ declare module "Binaries/Nodejs/lib/core/receiver/Receiver" {
1635
1630
  /**
1636
1631
  * @param {number[]} messageByteArray
1637
1632
  */
1638
- static sendCommand(messageByteArray: number[]): Int8Array<ArrayBuffer>;
1633
+ static sendCommand(messageByteArray: number[]): Uint8Array<any>;
1639
1634
  static heartBeat(messageByteArray: any): Int8Array<ArrayBuffer>;
1640
1635
  Receiver(): void;
1641
1636
  }
@@ -1982,9 +1977,8 @@ declare module "dist/lib/core/protocol/CommandDeserializer" {
1982
1977
  */
1983
1978
  deserialize(): Command;
1984
1979
  isAtEnd(): boolean;
1985
- readObject(typeNum: any): any;
1986
- readCommand(): any;
1987
- readCommandRecursively(numberOfElementsInPayloadLeft: any, cmd: any): any;
1980
+ readObject(typeNum: any): string | number | bigint | boolean | Command | (() => bigint) | null;
1981
+ readCommand(): Command;
1988
1982
  readString(): string;
1989
1983
  readInt(): number;
1990
1984
  readBool(): boolean;
@@ -2008,7 +2002,7 @@ declare module "dist/lib/utils/CustomError" {
2008
2002
  declare module "dist/lib/core/protocol/TypeSerializer" {
2009
2003
  export = TypeSerializer;
2010
2004
  class TypeSerializer {
2011
- static encodePrimitive(payload_item: any): Buffer<ArrayBuffer>;
2005
+ static serializePrimitive(payload_item: any): Buffer<ArrayBuffer>;
2012
2006
  static serializeCommand(command: any): Buffer<ArrayBuffer>;
2013
2007
  static serializeString(string_value: any): Buffer<ArrayBuffer>;
2014
2008
  static serializeInt(int_value: any): Buffer<ArrayBuffer>;
@@ -2039,9 +2033,8 @@ declare module "dist/lib/utils/RuntimeName" {
2039
2033
  declare module "dist/lib/core/protocol/CommandSerializer" {
2040
2034
  export = CommandSerializer;
2041
2035
  class CommandSerializer {
2042
- buffer: Int8Array<ArrayBuffer>;
2043
- serialize(root_command: any, connectionData: any, runtimeVersion?: number): Int8Array<ArrayBuffer>;
2044
- #private;
2036
+ serialize(rootCommand: any, connectionData: any): Uint8Array<any>;
2037
+ serializeRecursively(command: any, buffers: any): void;
2045
2038
  }
2046
2039
  }
2047
2040
  declare module "dist/lib/utils/ConnectionType" {
@@ -2076,6 +2069,12 @@ declare module "dist/lib/core/webSocketClient/WebSocketClient" {
2076
2069
  * @type {boolean}
2077
2070
  */
2078
2071
  isDisconnectedAfterMessage: boolean;
2072
+ /**
2073
+ * Connects to the WebSocket server.
2074
+ * @async
2075
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
2076
+ */
2077
+ connect(): Promise<WebSocket>;
2079
2078
  /**
2080
2079
  * Sends messageArray through websocket connection
2081
2080
  * @async
@@ -2091,18 +2090,9 @@ declare module "dist/lib/core/webSocketClient/WebSocketClient" {
2091
2090
  * Connects to the WebSocket server.
2092
2091
  * @private
2093
2092
  * @async
2094
- * @returns {Promise<void>} - A promise that resolves when the connection is established.
2093
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
2095
2094
  */
2096
2095
  private _connect;
2097
- /**
2098
- * Sends the data to the WebSocket server and listens for a response.
2099
- * @private
2100
- * @async
2101
- * @param {string|Buffer|ArrayBuffer|Buffer[]} data - The data to send.
2102
- * @param {Function} resolve - The resolve function for the Promise.
2103
- * @param {Function} reject - The reject function for the Promise.
2104
- */
2105
- private _sendMessage;
2106
2096
  }
2107
2097
  }
2108
2098
  declare module "dist/lib/core/transmitter/TransmitterWebsocket" {
@@ -3480,7 +3470,7 @@ declare module "dist/lib/core/receiver/Receiver" {
3480
3470
  /**
3481
3471
  * @param {number[]} messageByteArray
3482
3472
  */
3483
- static sendCommand(messageByteArray: number[]): Int8Array<ArrayBuffer>;
3473
+ static sendCommand(messageByteArray: number[]): Uint8Array<any>;
3484
3474
  static heartBeat(messageByteArray: any): Int8Array<ArrayBuffer>;
3485
3475
  Receiver(): void;
3486
3476
  }
@@ -4482,7 +4472,7 @@ declare module "lib/core/receiver/Receiver" {
4482
4472
  /**
4483
4473
  * @param {number[]} messageByteArray
4484
4474
  */
4485
- static sendCommand(messageByteArray: number[]): Int8Array<ArrayBuffer>;
4475
+ static sendCommand(messageByteArray: number[]): Uint8Array<any>;
4486
4476
  static heartBeat(messageByteArray: any): Int8Array<ArrayBuffer>;
4487
4477
  Receiver(): void;
4488
4478
  }
@@ -4538,6 +4528,12 @@ declare module "lib/core/webSocketClient/WebSocketClient" {
4538
4528
  * @type {boolean}
4539
4529
  */
4540
4530
  isDisconnectedAfterMessage: boolean;
4531
+ /**
4532
+ * Connects to the WebSocket server.
4533
+ * @async
4534
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
4535
+ */
4536
+ connect(): Promise<WebSocket>;
4541
4537
  /**
4542
4538
  * Sends messageArray through websocket connection
4543
4539
  * @async
@@ -4553,18 +4549,9 @@ declare module "lib/core/webSocketClient/WebSocketClient" {
4553
4549
  * Connects to the WebSocket server.
4554
4550
  * @private
4555
4551
  * @async
4556
- * @returns {Promise<void>} - A promise that resolves when the connection is established.
4552
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
4557
4553
  */
4558
4554
  private _connect;
4559
- /**
4560
- * Sends the data to the WebSocket server and listens for a response.
4561
- * @private
4562
- * @async
4563
- * @param {string|Buffer|ArrayBuffer|Buffer[]} data - The data to send.
4564
- * @param {Function} resolve - The resolve function for the Promise.
4565
- * @param {Function} reject - The reject function for the Promise.
4566
- */
4567
- private _sendMessage;
4568
4555
  }
4569
4556
  }
4570
4557
  declare module "lib/core/transmitter/TransmitterWebsocket" {
@@ -44,6 +44,8 @@ class Interpreter {
44
44
  if (_response) {
45
45
  const command = new CommandDeserializer(_response).deserialize()
46
46
  return command
47
+ } else {
48
+ throw new Error('Response not received from TransmitterWebsocket')
47
49
  }
48
50
  } catch (error) {
49
51
  // TODO: handle error exception log?
@@ -98,6 +100,8 @@ class Interpreter {
98
100
  if (_response) {
99
101
  const command = new CommandDeserializer(_response).deserialize()
100
102
  return command
103
+ } else {
104
+ throw new Error('Response not received from TransmitterWebsocket')
101
105
  }
102
106
  })
103
107
  .catch((error) => {
@@ -56,21 +56,37 @@ class CommandDeserializer {
56
56
  }
57
57
 
58
58
  readCommand() {
59
- const p = this.position
60
- const numberOfElementsInPayload = TypeDeserializer.deserializeInt(this.buffer.slice(p + 1, p + 5))
61
- const runtime = this.buffer[p + 5]
62
- const type = this.buffer[p + 6]
63
- this.position += 7
64
- const command = new Command(runtime, type, [])
65
- return this.readCommandRecursively(numberOfElementsInPayload, command)
66
- }
59
+ const p = this.position;
60
+ const numberOfElementsInPayload = TypeDeserializer.deserializeInt(this.buffer.slice(p + 1, p + 5));
61
+ const runtime = this.buffer[p + 5];
62
+ const commandType = this.buffer[p + 6];
63
+ this.position += 7;
64
+
65
+ const payload = new Array(numberOfElementsInPayload);
66
+ for (let i = 0; i < numberOfElementsInPayload; i++) {
67
+ payload[i] = this.readObject(this.buffer[this.position]);
68
+ }
67
69
 
68
- readCommandRecursively(numberOfElementsInPayloadLeft, cmd) {
69
- if (numberOfElementsInPayloadLeft === 0) return cmd
70
- const p = this.position
71
- cmd = cmd.addArgToPayload(this.readObject(this.buffer[p]))
72
- return this.readCommandRecursively(numberOfElementsInPayloadLeft - 1, cmd)
73
- }
70
+ return new Command(runtime, commandType, payload);
71
+ }
72
+
73
+ // old implementation
74
+ // readCommand() {
75
+ // const p = this.position
76
+ // const numberOfElementsInPayload = TypeDeserializer.deserializeInt(this.buffer.slice(p + 1, p + 5))
77
+ // const runtime = this.buffer[p + 5]
78
+ // const type = this.buffer[p + 6]
79
+ // this.position += 7
80
+ // const command = new Command(runtime, type, [])
81
+ // return this.readCommandRecursively(numberOfElementsInPayload, command)
82
+ // }
83
+ //
84
+ // readCommandRecursively(numberOfElementsInPayloadLeft, cmd) {
85
+ // if (numberOfElementsInPayloadLeft === 0) return cmd
86
+ // const p = this.position
87
+ // cmd = cmd.addArgToPayload(this.readObject(this.buffer[p]))
88
+ // return this.readCommandRecursively(numberOfElementsInPayloadLeft - 1, cmd)
89
+ // }
74
90
 
75
91
  readString() {
76
92
  let p = this.position
@@ -1,37 +1,50 @@
1
- const Command = require('../../utils/Command')
2
- const TypeEncoder = require('./TypeSerializer')
3
- const Runtime = require('../../utils/RuntimeName')
1
+
2
+ const Command = require('../../utils/Command');
3
+ const TypeSerializer = require('./TypeSerializer');
4
+ const RuntimeName = require('../../utils/RuntimeName');
4
5
 
5
6
  class CommandSerializer {
6
- buffer = new Int8Array(2)
7
-
8
- serialize(root_command, connectionData, runtimeVersion = 0) {
9
- this.buffer[0] = root_command.runtimeName
10
- this.buffer[1] = runtimeVersion
11
- this.#insertIntoBuffer(connectionData.serializeConnectionData())
12
- this.#insertIntoBuffer(new Int8Array([Runtime.Nodejs, root_command.commandType]))
13
- this.#serializeRecursively(root_command)
14
- return this.buffer
7
+ serialize(rootCommand, connectionData) {
8
+ const buffers = [];
9
+ // Write runtime name and a zero byte for runtime version.
10
+ buffers.push(Uint8Array.of(rootCommand.runtimeName, 0));
11
+
12
+ if (connectionData) {
13
+ buffers.push(connectionData.serializeConnectionData());
14
+ } else {
15
+
16
+ buffers.push(Uint8Array.of(0, 0, 0, 0, 0, 0, 0));
17
+ }
18
+
19
+ buffers.push(Uint8Array.of(RuntimeName.Nodejs, rootCommand.commandType));
20
+
21
+ this.serializeRecursively(rootCommand, buffers);
22
+
23
+ return concatenateUint8Arrays(buffers);
15
24
  }
16
25
 
17
- #serializeRecursively = function (root_command) {
18
- for (let cmd of root_command.payload) {
19
- if (cmd instanceof Command) {
20
- this.#insertIntoBuffer(TypeEncoder.serializeCommand(cmd))
21
- this.#serializeRecursively(cmd)
26
+ serializeRecursively(command, buffers) {
27
+ for (const item of command.payload) {
28
+ if (item instanceof Command) {
29
+ buffers.push(TypeSerializer.serializeCommand(item));
30
+ this.serializeRecursively(item, buffers);
22
31
  } else {
23
- let result = TypeEncoder.encodePrimitive(cmd)
24
- this.#insertIntoBuffer(result)
32
+ buffers.push(TypeSerializer.serializePrimitive(item));
25
33
  }
26
34
  }
27
35
  }
36
+ }
37
+
38
+ function concatenateUint8Arrays(arrays) {
39
+ let totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
40
+ const result = new Uint8Array(totalLength);
28
41
 
29
- #insertIntoBuffer = function (arg) {
30
- let newArray = new Int8Array(this.buffer.length + arg.length)
31
- newArray.set(this.buffer, 0)
32
- newArray.set(arg, this.buffer.length)
33
- this.buffer = newArray
42
+ let offset = 0;
43
+ for (const arr of arrays) {
44
+ result.set(arr, offset);
45
+ offset += arr.length;
34
46
  }
47
+ return result;
35
48
  }
36
49
 
37
- module.exports = CommandSerializer
50
+ module.exports = CommandSerializer;
@@ -7,7 +7,7 @@ const CustomError = require('../../utils/CustomError')
7
7
  const encoder = new TextEncoder()
8
8
 
9
9
  class TypeSerializer {
10
- static encodePrimitive(payload_item) {
10
+ static serializePrimitive(payload_item) {
11
11
  if (payload_item === null) {
12
12
  return TypeSerializer.serializeNull()
13
13
  }
@@ -38,7 +38,32 @@ class WebSocketClient {
38
38
  /**
39
39
  * @type {boolean}
40
40
  */
41
- this.isDisconnectedAfterMessage = options?.isDisconnectedAfterMessage ?? false
41
+ this.isDisconnectedAfterMessage = options?.isDisconnectedAfterMessage ?? true
42
+ }
43
+
44
+ /**
45
+ * Connects to the WebSocket server.
46
+ * @async
47
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
48
+ */
49
+ connect() {
50
+ return new Promise((resolve, reject) => {
51
+ const client = new WebSocket(this.url)
52
+
53
+ client.on(WebSocketStateEnum.OPEN, () => {
54
+ this.instance = client;
55
+ resolve(client);
56
+ })
57
+
58
+ // eslint-disable-next-line no-unused-vars
59
+ client.on(WebSocketStateEnum.ERROR, (error) => {
60
+ reject(error)
61
+ })
62
+
63
+ client.on(WebSocketStateEnum.CLOSE, () => {
64
+ reject(new Error("Connection closed before receiving message"))
65
+ })
66
+ });
42
67
  }
43
68
 
44
69
  /**
@@ -49,17 +74,23 @@ class WebSocketClient {
49
74
  */
50
75
  send(messageArray) {
51
76
  return new Promise((resolve, reject) => {
52
- try {
53
- if (this.isConnected) {
54
- this._sendMessage(messageArray, resolve, reject)
55
- } else {
56
- this._connect().then(() => {
57
- this._sendMessage(messageArray, resolve, reject)
58
- })
59
- }
60
- } catch (error) {
77
+ (this.instance ? Promise.resolve(this.instance) : this._connect()).then((client) => {
78
+ client.send(messageArray, (err) => {
79
+ if (err) {
80
+ reject(err)
81
+ }
82
+ })
83
+
84
+ client.on('message', (message) => {
85
+ resolve(message)
86
+
87
+ if (this.isDisconnectedAfterMessage) {
88
+ this.disconnect()
89
+ }
90
+ })
91
+ }).catch((error) => {
61
92
  reject(error)
62
- }
93
+ })
63
94
  })
64
95
  }
65
96
 
@@ -68,7 +99,8 @@ class WebSocketClient {
68
99
  */
69
100
  disconnect() {
70
101
  if (this.instance) {
71
- this.instance.terminate()
102
+ this.instance.close()
103
+ this.instance = null
72
104
  }
73
105
  this.isConnected = false
74
106
  }
@@ -77,55 +109,28 @@ class WebSocketClient {
77
109
  * Connects to the WebSocket server.
78
110
  * @private
79
111
  * @async
80
- * @returns {Promise<void>} - A promise that resolves when the connection is established.
112
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
81
113
  */
82
114
  _connect() {
83
115
  return new Promise((resolve, reject) => {
84
- this.instance = new WebSocket(this.url)
116
+ const client = new WebSocket(this.url)
85
117
 
86
- this.instance.on(WebSocketStateEnum.OPEN, () => {
118
+ client.on(WebSocketStateEnum.OPEN, () => {
87
119
  this.isConnected = true
88
- resolve()
120
+ this.instance = client;
121
+ resolve(client)
89
122
  })
90
123
 
91
124
  // eslint-disable-next-line no-unused-vars
92
- this.instance.on(WebSocketStateEnum.ERROR, (error) => {
93
- reject(null)
125
+ client.on(WebSocketStateEnum.ERROR, (error) => {
126
+ reject(error)
94
127
  })
95
128
 
96
- this.instance.on(WebSocketStateEnum.CLOSE, () => {
97
- this.isConnected = false
129
+ client.on(WebSocketStateEnum.CLOSE, () => {
130
+ reject(new Error("Connection closed before receiving message"))
98
131
  })
99
132
  })
100
133
  }
101
-
102
- /**
103
- * Sends the data to the WebSocket server and listens for a response.
104
- * @private
105
- * @async
106
- * @param {string|Buffer|ArrayBuffer|Buffer[]} data - The data to send.
107
- * @param {Function} resolve - The resolve function for the Promise.
108
- * @param {Function} reject - The reject function for the Promise.
109
- */
110
- _sendMessage(data, resolve, reject) {
111
- this.instance.send(data, (err) => {
112
- if (err) {
113
- reject(err)
114
- }
115
- })
116
-
117
- this.instance.on('message', (message) => {
118
- resolve(message)
119
-
120
- if (this.isDisconnectedAfterMessage) {
121
- this.disconnect()
122
- }
123
- })
124
-
125
- this.instance.on('error', (error) => {
126
- reject(error)
127
- })
128
- }
129
134
  }
130
135
 
131
136
  module.exports = WebSocketClient
@@ -408,16 +408,14 @@ class InvocationContext {
408
408
  } else if (typeof payloadItem === 'InvocationContext' || payloadItem instanceof InvocationContext) {
409
409
  return payloadItem.get_current_command()
410
410
  } else if (payloadItem instanceof Array) {
411
- for (let i = 0; i < payloadItem.length; i++) {
412
- payloadItem[i] = this.#encapsulatePayloadItem(payloadItem[i])
413
- }
414
- return new Command(this.runtimeName, CommandType.Array, payloadItem)
411
+ const copiedArray = payloadItem.map((item) => this.#encapsulatePayloadItem(item))
412
+ return new Command(this.runtimeName, CommandType.Array, copiedArray)
415
413
  } else if (typeof payloadItem === 'function') {
416
414
  let newArray = new Array(payloadItem.length + 1)
417
415
  for (let i = 0; i < newArray.length; i++) {
418
416
  newArray[i] = typeof Object
419
417
  }
420
- const args = [DelegatesCache.addDelegate(payloadItem), RuntimeName.Nodejs].push(...newArray);
418
+ const args = [DelegatesCache.addDelegate(payloadItem), RuntimeName.Nodejs].push(...newArray)
421
419
  return new Command(this.#runtimeName, CommandType.PassDelegate, args)
422
420
  } else {
423
421
  return new Command(this.runtimeName, CommandType.Value, [payloadItem])
@@ -276,10 +276,8 @@ class RuntimeContext {
276
276
  } else if (typeof payloadItem === 'InvocationContext' || payloadItem instanceof InvocationContext) {
277
277
  return payloadItem.get_current_command()
278
278
  } else if (payloadItem instanceof Array) {
279
- for (let i = 0; i < payloadItem.length; i++) {
280
- payloadItem[i] = this.#encapsulatePayloadItem(payloadItem[i])
281
- }
282
- return new Command(this.runtimeName, CommandType.Array, payloadItem)
279
+ const copiedArray = payloadItem.map((item) => this.#encapsulatePayloadItem(item))
280
+ return new Command(this.runtimeName, CommandType.Array, copiedArray)
283
281
  } else if (typeof payloadItem === 'function') {
284
282
  let newArray = new Array(payloadItem.length + 1)
285
283
  for (let i = 0; i < newArray.length; i++) {
@@ -38,7 +38,32 @@ class WebSocketClient {
38
38
  /**
39
39
  * @type {boolean}
40
40
  */
41
- this.isDisconnectedAfterMessage = options?.isDisconnectedAfterMessage ?? false
41
+ this.isDisconnectedAfterMessage = options?.isDisconnectedAfterMessage ?? true
42
+ }
43
+
44
+ /**
45
+ * Connects to the WebSocket server.
46
+ * @async
47
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
48
+ */
49
+ connect() {
50
+ return new Promise((resolve, reject) => {
51
+ const client = new WebSocket(this.url)
52
+
53
+ client.on(WebSocketStateEnum.OPEN, () => {
54
+ this.instance = client;
55
+ resolve(client);
56
+ })
57
+
58
+ // eslint-disable-next-line no-unused-vars
59
+ client.on(WebSocketStateEnum.ERROR, (error) => {
60
+ reject(error)
61
+ })
62
+
63
+ client.on(WebSocketStateEnum.CLOSE, () => {
64
+ reject(new Error("Connection closed before receiving message"))
65
+ })
66
+ });
42
67
  }
43
68
 
44
69
  /**
@@ -49,17 +74,23 @@ class WebSocketClient {
49
74
  */
50
75
  send(messageArray) {
51
76
  return new Promise((resolve, reject) => {
52
- try {
53
- if (this.isConnected) {
54
- this._sendMessage(messageArray, resolve, reject)
55
- } else {
56
- this._connect().then(() => {
57
- this._sendMessage(messageArray, resolve, reject)
58
- })
59
- }
60
- } catch (error) {
77
+ (this.instance ? Promise.resolve(this.instance) : this._connect()).then((client) => {
78
+ client.send(messageArray, (err) => {
79
+ if (err) {
80
+ reject(err)
81
+ }
82
+ })
83
+
84
+ client.on('message', (message) => {
85
+ resolve(message)
86
+
87
+ if (this.isDisconnectedAfterMessage) {
88
+ this.disconnect()
89
+ }
90
+ })
91
+ }).catch((error) => {
61
92
  reject(error)
62
- }
93
+ })
63
94
  })
64
95
  }
65
96
 
@@ -68,7 +99,8 @@ class WebSocketClient {
68
99
  */
69
100
  disconnect() {
70
101
  if (this.instance) {
71
- this.instance.terminate()
102
+ this.instance.close()
103
+ this.instance = null
72
104
  }
73
105
  this.isConnected = false
74
106
  }
@@ -77,55 +109,28 @@ class WebSocketClient {
77
109
  * Connects to the WebSocket server.
78
110
  * @private
79
111
  * @async
80
- * @returns {Promise<void>} - A promise that resolves when the connection is established.
112
+ * @returns {Promise<WebSocket>} - A promise that resolves when the connection is established.
81
113
  */
82
114
  _connect() {
83
115
  return new Promise((resolve, reject) => {
84
- this.instance = new WebSocket(this.url)
116
+ const client = new WebSocket(this.url)
85
117
 
86
- this.instance.on(WebSocketStateEnum.OPEN, () => {
118
+ client.on(WebSocketStateEnum.OPEN, () => {
87
119
  this.isConnected = true
88
- resolve()
120
+ this.instance = client;
121
+ resolve(client)
89
122
  })
90
123
 
91
124
  // eslint-disable-next-line no-unused-vars
92
- this.instance.on(WebSocketStateEnum.ERROR, (error) => {
93
- reject(null)
125
+ client.on(WebSocketStateEnum.ERROR, (error) => {
126
+ reject(error)
94
127
  })
95
128
 
96
- this.instance.on(WebSocketStateEnum.CLOSE, () => {
97
- this.isConnected = false
129
+ client.on(WebSocketStateEnum.CLOSE, () => {
130
+ reject(new Error("Connection closed before receiving message"))
98
131
  })
99
132
  })
100
133
  }
101
-
102
- /**
103
- * Sends the data to the WebSocket server and listens for a response.
104
- * @private
105
- * @async
106
- * @param {string|Buffer|ArrayBuffer|Buffer[]} data - The data to send.
107
- * @param {Function} resolve - The resolve function for the Promise.
108
- * @param {Function} reject - The reject function for the Promise.
109
- */
110
- _sendMessage(data, resolve, reject) {
111
- this.instance.send(data, (err) => {
112
- if (err) {
113
- reject(err)
114
- }
115
- })
116
-
117
- this.instance.on('message', (message) => {
118
- resolve(message)
119
-
120
- if (this.isDisconnectedAfterMessage) {
121
- this.disconnect()
122
- }
123
- })
124
-
125
- this.instance.on('error', (error) => {
126
- reject(error)
127
- })
128
- }
129
134
  }
130
135
 
131
136
  module.exports = WebSocketClient