javonet-nodejs-sdk 2.6.2 → 2.6.4

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 (172) hide show
  1. package/dist/core/handler/AbstractHandler.cjs +4 -4
  2. package/dist/core/handler/AddEventListenerHandler.cjs +36 -0
  3. package/dist/core/handler/ArrayReferenceHandler.cjs +36 -0
  4. package/dist/core/handler/AsKwargsHandler.cjs +36 -0
  5. package/dist/core/handler/AsOutHandler.cjs +36 -0
  6. package/dist/core/handler/AsRefHandler.cjs +36 -0
  7. package/dist/core/handler/CreateNullHandler.cjs +36 -0
  8. package/dist/core/handler/ExceptionHandler.cjs +36 -0
  9. package/dist/core/handler/GenerateLibHandler.cjs +36 -0
  10. package/dist/core/handler/GetAsyncOperationResultHandler.cjs +36 -0
  11. package/dist/core/handler/GetEnumItemHandler.cjs +36 -0
  12. package/dist/core/handler/GetEnumNameHandler.cjs +36 -0
  13. package/dist/core/handler/GetEnumValueHandler.cjs +36 -0
  14. package/dist/core/handler/GetGlobalFieldHandler.cjs +63 -0
  15. package/dist/core/handler/GetInstanceMethodAsDelegateHandler.cjs +2 -4
  16. package/dist/core/handler/GetModuleHandler.cjs +36 -0
  17. package/dist/core/handler/GetRefValueHandler.cjs +36 -0
  18. package/dist/core/handler/GetResultTypeHandler.cjs +43 -0
  19. package/dist/core/handler/GetStaticMethodAsDelegateHandler.cjs +4 -2
  20. package/dist/core/handler/GetTypeHandler.cjs +3 -3
  21. package/dist/core/handler/Handler.cjs +55 -11
  22. package/dist/core/handler/HeartBeatHandler.cjs +36 -0
  23. package/dist/core/handler/InvokeGenericMethodHandler.cjs +36 -0
  24. package/dist/core/handler/InvokeGenericStaticMethodHandler.cjs +36 -0
  25. package/dist/core/handler/OptimizeHandler.cjs +36 -0
  26. package/dist/core/handler/PluginWrapperHandler.cjs +36 -0
  27. package/dist/core/handler/RetrieveArrayHandler.cjs +36 -0
  28. package/dist/core/transmitter/Transmitter.cjs +4 -4
  29. package/dist/sdk/ActivatorDetails.cjs +37 -0
  30. package/dist/sdk/ConfigRuntimeFactory.cjs +50 -47
  31. package/dist/sdk/InvocationContext.cjs +91 -0
  32. package/dist/sdk/Javonet.cjs +22 -1
  33. package/dist/sdk/RuntimeContext.cjs +19 -0
  34. package/dist/sdk/RuntimeFactory.cjs +33 -1
  35. package/dist/sdk/configuration/Config.cjs +55 -0
  36. package/dist/sdk/configuration/ConfigPriority.cjs +38 -0
  37. package/dist/sdk/configuration/ConfigSourceResolver.cjs +100 -0
  38. package/dist/sdk/configuration/ConfigsDictionary.cjs +121 -0
  39. package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +121 -0
  40. package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +123 -0
  41. package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +125 -0
  42. package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +125 -0
  43. package/dist/sdk/tools/ComplexTypeResolver.cjs +114 -0
  44. package/dist/sdk/tools/JsonResolver.cjs +4 -1
  45. package/dist/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.cjs +44 -0
  46. package/dist/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.cjs +44 -0
  47. package/dist/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.cjs +44 -0
  48. package/dist/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.cjs +44 -0
  49. package/dist/sdk/tools/typeParsingFunctions/TypeParsingUtils.cjs +34 -0
  50. package/dist/types/core/handler/AddEventListenerHandler.d.ts +7 -0
  51. package/dist/types/core/handler/ArrayReferenceHandler.d.ts +7 -0
  52. package/dist/types/core/handler/AsKwargsHandler.d.ts +7 -0
  53. package/dist/types/core/handler/AsOutHandler.d.ts +7 -0
  54. package/dist/types/core/handler/AsRefHandler.d.ts +7 -0
  55. package/dist/types/core/handler/CreateNullHandler.d.ts +7 -0
  56. package/dist/types/core/handler/ExceptionHandler.d.ts +7 -0
  57. package/dist/types/core/handler/GenerateLibHandler.d.ts +7 -0
  58. package/dist/types/core/handler/GetAsyncOperationResultHandler.d.ts +7 -0
  59. package/dist/types/core/handler/GetEnumItemHandler.d.ts +7 -0
  60. package/dist/types/core/handler/GetEnumNameHandler.d.ts +7 -0
  61. package/dist/types/core/handler/GetEnumValueHandler.d.ts +7 -0
  62. package/dist/types/core/handler/GetGlobalFieldHandler.d.ts +13 -0
  63. package/dist/types/core/handler/GetModuleHandler.d.ts +7 -0
  64. package/dist/types/core/handler/GetRefValueHandler.d.ts +7 -0
  65. package/dist/types/core/handler/GetResultTypeHandler.d.ts +18 -0
  66. package/dist/types/core/handler/HeartBeatHandler.d.ts +7 -0
  67. package/dist/types/core/handler/InvokeGenericMethodHandler.d.ts +7 -0
  68. package/dist/types/core/handler/InvokeGenericStaticMethodHandler.d.ts +7 -0
  69. package/dist/types/core/handler/OptimizeHandler.d.ts +7 -0
  70. package/dist/types/core/handler/PluginWrapperHandler.d.ts +7 -0
  71. package/dist/types/core/handler/RetrieveArrayHandler.d.ts +7 -0
  72. package/dist/types/core/transmitter/Transmitter.d.ts +1 -1
  73. package/dist/types/sdk/ActivatorDetails.d.ts +12 -0
  74. package/dist/types/sdk/ConfigRuntimeFactory.d.ts +3 -0
  75. package/dist/types/sdk/InvocationContext.d.ts +22 -0
  76. package/dist/types/sdk/Javonet.d.ts +15 -1
  77. package/dist/types/sdk/RuntimeContext.d.ts +8 -0
  78. package/dist/types/sdk/RuntimeFactory.d.ts +14 -0
  79. package/dist/types/sdk/configuration/Config.d.ts +14 -0
  80. package/dist/types/sdk/configuration/ConfigPriority.d.ts +8 -0
  81. package/dist/types/sdk/configuration/ConfigSourceResolver.d.ts +7 -0
  82. package/dist/types/sdk/configuration/ConfigsDictionary.d.ts +30 -0
  83. package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +30 -0
  84. package/dist/types/sdk/configuration/configResolvers/ConnectionStringConfigResolver.d.ts +23 -0
  85. package/dist/types/sdk/configuration/configResolvers/JsonConfigResolver.d.ts +26 -0
  86. package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +32 -0
  87. package/dist/types/sdk/tools/ComplexTypeResolver.d.ts +28 -0
  88. package/dist/types/sdk/tools/JsonResolver.d.ts +4 -2
  89. package/dist/types/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.d.ts +11 -0
  90. package/dist/types/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.d.ts +11 -0
  91. package/dist/types/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.d.ts +11 -0
  92. package/dist/types/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.d.ts +11 -0
  93. package/dist/types/sdk/tools/typeParsingFunctions/TypeParsingUtils.d.ts +1 -0
  94. package/dist/types/utils/CommandType.d.ts +3 -0
  95. package/dist/types/utils/IsThenable.d.ts +6 -0
  96. package/dist/types/utils/Runtime.d.ts +4 -3
  97. package/dist/types/utils/RuntimeNameHandler.d.ts +5 -0
  98. package/dist/utils/CommandType.cjs +4 -1
  99. package/dist/utils/IsThenable.cjs +30 -0
  100. package/dist/utils/RuntimeNameHandler.cjs +34 -0
  101. package/dist/utils/connectionData/InMemoryConnectionData.cjs +7 -1
  102. package/dist/utils/connectionData/WsConnectionData.cjs +6 -0
  103. package/dist/utils/exception/ExceptionSerializer.cjs +6 -2
  104. package/dist/utils/nodejs/connectionData/TcpConnectionData.cjs +15 -6
  105. package/lib/core/handler/AbstractHandler.js +7 -5
  106. package/lib/core/handler/AddEventListenerHandler.js +11 -0
  107. package/lib/core/handler/ArrayReferenceHandler.js +11 -0
  108. package/lib/core/handler/AsKwargsHandler.js +11 -0
  109. package/lib/core/handler/AsOutHandler.js +11 -0
  110. package/lib/core/handler/AsRefHandler.js +11 -0
  111. package/lib/core/handler/CreateNullHandler.js +11 -0
  112. package/lib/core/handler/ExceptionHandler.js +11 -0
  113. package/lib/core/handler/GenerateLibHandler.js +11 -0
  114. package/lib/core/handler/GetAsyncOperationResultHandler.js +11 -0
  115. package/lib/core/handler/GetEnumItemHandler.js +11 -0
  116. package/lib/core/handler/GetEnumNameHandler.js +11 -0
  117. package/lib/core/handler/GetEnumValueHandler.js +11 -0
  118. package/lib/core/handler/GetGlobalFieldHandler.js +44 -0
  119. package/lib/core/handler/GetInstanceMethodAsDelegateHandler.js +3 -3
  120. package/lib/core/handler/GetModuleHandler.js +11 -0
  121. package/lib/core/handler/GetRefValueHandler.js +11 -0
  122. package/lib/core/handler/GetResultTypeHandler.js +29 -0
  123. package/lib/core/handler/GetStaticFieldHandler.js +0 -1
  124. package/lib/core/handler/GetStaticMethodAsDelegateHandler.js +3 -1
  125. package/lib/core/handler/GetTypeHandler.js +3 -3
  126. package/lib/core/handler/Handler.js +55 -11
  127. package/lib/core/handler/HeartBeatHandler.js +11 -0
  128. package/lib/core/handler/InvokeGenericMethodHandler.js +11 -0
  129. package/lib/core/handler/InvokeGenericStaticMethodHandler.js +11 -0
  130. package/lib/core/handler/InvokeStaticMethodHandler.js +1 -1
  131. package/lib/core/handler/OptimizeHandler.js +11 -0
  132. package/lib/core/handler/PluginWrapperHandler.js +11 -0
  133. package/lib/core/handler/ResolveReferenceHandler.js +1 -3
  134. package/lib/core/handler/RetrieveArrayHandler.js +11 -0
  135. package/lib/core/receiver/Receiver.js +5 -7
  136. package/lib/core/transmitter/Transmitter.js +5 -5
  137. package/lib/core/webSocketClient/WebSocketClientBrowser.js +2 -2
  138. package/lib/sdk/ActivatorDetails.js +15 -0
  139. package/lib/sdk/ConfigRuntimeFactory.js +65 -48
  140. package/lib/sdk/InvocationContext.js +95 -0
  141. package/lib/sdk/Javonet.js +31 -3
  142. package/lib/sdk/RuntimeContext.js +21 -0
  143. package/lib/sdk/RuntimeFactory.js +49 -1
  144. package/lib/sdk/configuration/Config.js +37 -0
  145. package/lib/sdk/configuration/ConfigPriority.js +9 -0
  146. package/lib/sdk/configuration/ConfigSourceResolver.js +84 -0
  147. package/lib/sdk/configuration/ConfigsDictionary.js +118 -0
  148. package/lib/sdk/configuration/configResolvers/ConfigResolver.js +109 -0
  149. package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +119 -0
  150. package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +99 -0
  151. package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +109 -0
  152. package/lib/sdk/tools/ActivationHelper.js +1 -1
  153. package/lib/sdk/tools/ComplexTypeResolver.js +103 -0
  154. package/lib/sdk/tools/JsonResolver.js +5 -1
  155. package/lib/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.js +25 -0
  156. package/lib/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.js +25 -0
  157. package/lib/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.js +25 -0
  158. package/lib/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.js +25 -0
  159. package/lib/sdk/tools/typeParsingFunctions/TypeParsingUtils.js +13 -0
  160. package/lib/utils/CommandType.js +3 -0
  161. package/lib/utils/CustomError.js +1 -1
  162. package/lib/utils/IsThenable.js +10 -0
  163. package/lib/utils/Runtime.js +11 -4
  164. package/lib/utils/RuntimeLoggerBrowser.js +0 -1
  165. package/lib/utils/RuntimeNameHandler.js +37 -0
  166. package/lib/utils/TypesHandler.js +11 -5
  167. package/lib/utils/connectionData/InMemoryConnectionData.js +8 -1
  168. package/lib/utils/connectionData/WsConnectionData.js +7 -0
  169. package/lib/utils/exception/ExceptionSerializer.js +6 -2
  170. package/lib/utils/nodejs/connectionData/TcpConnectionData.js +16 -6
  171. package/lib/utils/nodejs/uuid/v4.js +0 -1
  172. package/package.json +4 -2
@@ -11,8 +11,10 @@ export class JsonResolver {
11
11
  constructor(configSource: string | ConfigSource);
12
12
  /** @type {ConfigSource} */
13
13
  jsonObject: ConfigSource;
14
- /** @type {string | ConfigSource} */
15
- configSource: string | ConfigSource;
14
+ /** @type {string} */
15
+ configSource: string;
16
+ /** @type {boolean} */
17
+ isConfigSourcePath: boolean;
16
18
  /**
17
19
  * @returns {Partial<Runtimes>}
18
20
  */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @param {InvocationContext} invocationContext - InvocationContext pointing to the target object
3
+ * @returns {Date} A JavaScript Date parsed from the Java timestamp
4
+ */
5
+ export function parseDate(invocationContext: InvocationContext): Date;
6
+ /**
7
+ * Mapping of parsing functions for different type signatures.
8
+ * @type {Map<string, (invocationContext: InvocationContext) => unknown>}
9
+ */
10
+ export const JavaTypeParsingFunctions: Map<string, (invocationContext: InvocationContext) => unknown>;
11
+ export type InvocationContext = import("../../InvocationContext.js").InvocationContext;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @param {InvocationContext} invocationContext - InvocationContext pointing to the target object
3
+ * @returns {Date} A JavaScript Date parsed from the Java timestamp
4
+ */
5
+ export function parseDate(invocationContext: InvocationContext): Date;
6
+ /**
7
+ * Mapping of parsing functions for different type signatures.
8
+ * @type {Map<string, (invocationContext: InvocationContext) => unknown>}
9
+ */
10
+ export const NetcoreTypeParsingFunctions: Map<string, (invocationContext: InvocationContext) => unknown>;
11
+ export type InvocationContext = import("../../InvocationContext.js").InvocationContext;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @param {InvocationContext} invocationContext - InvocationContext pointing to the target object
3
+ * @returns {Date} A JavaScript Date parsed from the Java timestamp
4
+ */
5
+ export function parseDate(invocationContext: InvocationContext): Date;
6
+ /**
7
+ * Mapping of parsing functions for different type signatures.
8
+ * @type {Map<string, (invocationContext: InvocationContext) => unknown>}
9
+ */
10
+ export const NodejsTypeParsingFunctions: Map<string, (invocationContext: InvocationContext) => unknown>;
11
+ export type InvocationContext = import("../../InvocationContext.js").InvocationContext;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @param {InvocationContext} invocationContext - InvocationContext pointing to the target object
3
+ * @returns {Date} A JavaScript Date parsed from the Java timestamp
4
+ */
5
+ export function parseDatetime(invocationContext: InvocationContext): Date;
6
+ /**
7
+ * Mapping of parsing functions for different type signatures.
8
+ * @type {Map<string, (invocationContext: InvocationContext) => unknown>}
9
+ */
10
+ export const PythonTypeParsingFunctions: Map<string, (invocationContext: InvocationContext) => unknown>;
11
+ export type InvocationContext = import("../../InvocationContext.js").InvocationContext;
@@ -0,0 +1 @@
1
+ export function handleResultWithAction(result: any, action: (arg0: any) => any): any;
@@ -44,4 +44,7 @@ export namespace CommandType {
44
44
  let AddEventListener: 42;
45
45
  let PluginWrapper: 43;
46
46
  let GetAsyncOperationResult: 44;
47
+ let AsKwargs: 45;
48
+ let GetResultType: 46;
49
+ let GetGlobalField: 47;
47
50
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if a value is a thenable.
3
+ * @param {any} value - The value to check.
4
+ * @returns {boolean} True if the value is a thenable, false otherwise.
5
+ */
6
+ export function isThenable(value: any): boolean;
@@ -18,6 +18,7 @@ export function isEsmRuntime(): boolean;
18
18
  * @returns {string}
19
19
  */
20
20
  export function getRuntimeExtension(): string;
21
- export function getRequire(callerPath: string): any;
22
- export function getDirname(): any;
23
- export function getDependency(dependencyName: string, callerPathOrUrl: string): string;
21
+ export function getRequire(callerPath?: string): any;
22
+ export function getDirname(): string | Error;
23
+ export function getDependency(dependencyName: string, callerPathOrUrl?: string): string;
24
+ export type ConfigSource = import("../types.js").ConfigSource;
@@ -8,4 +8,9 @@ export class RuntimeNameHandler {
8
8
  * @returns {RuntimeType}
9
9
  */
10
10
  static getName(runtimeName: number): RuntimeType;
11
+ /**
12
+ * @param {string} name
13
+ * @returns {number}
14
+ */
15
+ static getRuntime: (name: string) => number;
11
16
  }
@@ -68,7 +68,10 @@ const CommandType = (
68
68
  ConvertType: 41,
69
69
  AddEventListener: 42,
70
70
  PluginWrapper: 43,
71
- GetAsyncOperationResult: 44
71
+ GetAsyncOperationResult: 44,
72
+ AsKwargs: 45,
73
+ GetResultType: 46,
74
+ GetGlobalField: 47
72
75
  }
73
76
  );
74
77
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var IsThenable_exports = {};
20
+ __export(IsThenable_exports, {
21
+ isThenable: () => isThenable
22
+ });
23
+ module.exports = __toCommonJS(IsThenable_exports);
24
+ function isThenable(value) {
25
+ return value !== null && typeof value === "object" && "then" in value;
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ isThenable
30
+ });
@@ -55,6 +55,40 @@ class RuntimeNameHandler {
55
55
  throw new Error("Invalid runtime name.");
56
56
  }
57
57
  }
58
+ /**
59
+ * @param {string} name
60
+ * @returns {number}
61
+ */
62
+ static getRuntime = (name) => {
63
+ if (!name || name.trim() === "") {
64
+ throw new Error("Runtime name cannot be null or whitespace.");
65
+ }
66
+ const normalized = name.trim().toLowerCase();
67
+ switch (normalized) {
68
+ case "clr":
69
+ return import_RuntimeName.RuntimeName.Clr;
70
+ case "go":
71
+ return import_RuntimeName.RuntimeName.Go;
72
+ case "jvm":
73
+ return import_RuntimeName.RuntimeName.Jvm;
74
+ case "netcore":
75
+ return import_RuntimeName.RuntimeName.Netcore;
76
+ case "perl":
77
+ return import_RuntimeName.RuntimeName.Perl;
78
+ case "python":
79
+ return import_RuntimeName.RuntimeName.Python;
80
+ case "ruby":
81
+ return import_RuntimeName.RuntimeName.Ruby;
82
+ case "nodejs":
83
+ return import_RuntimeName.RuntimeName.Nodejs;
84
+ case "php":
85
+ return import_RuntimeName.RuntimeName.Php;
86
+ case "python27":
87
+ return import_RuntimeName.RuntimeName.Python27;
88
+ default:
89
+ throw new Error(`${name} is not a supported runtime.`);
90
+ }
91
+ };
58
92
  }
59
93
  // Annotate the CommonJS export names for ESM import in node:
60
94
  0 && (module.exports = {
@@ -27,7 +27,7 @@ class InMemoryConnectionData extends import_IConnectionData.IConnectionData {
27
27
  constructor() {
28
28
  super();
29
29
  this._connectionType = import_ConnectionType.ConnectionType.IN_MEMORY;
30
- this._hostname = "";
30
+ this._hostname = "inMemory";
31
31
  }
32
32
  /**
33
33
  * @returns {ConnectionType}
@@ -55,6 +55,12 @@ class InMemoryConnectionData extends import_IConnectionData.IConnectionData {
55
55
  equals(other) {
56
56
  return other instanceof InMemoryConnectionData;
57
57
  }
58
+ /**
59
+ * @returns {string}
60
+ */
61
+ toString() {
62
+ return this.hostname;
63
+ }
58
64
  }
59
65
  // Annotate the CommonJS export names for ESM import in node:
60
66
  0 && (module.exports = {
@@ -58,6 +58,12 @@ class WsConnectionData extends import_IConnectionData.IConnectionData {
58
58
  equals(other) {
59
59
  return other instanceof WsConnectionData && this._hostname === other.hostname;
60
60
  }
61
+ /**
62
+ * @returns {string}
63
+ */
64
+ toString() {
65
+ return this.hostname;
66
+ }
61
67
  }
62
68
  // Annotate the CommonJS export names for ESM import in node:
63
69
  0 && (module.exports = {
@@ -35,7 +35,9 @@ class ExceptionSerializer {
35
35
  try {
36
36
  this.serializeStackTrace(exception, stackClasses, stackMethods, stackLines, stackFiles);
37
37
  exceptionCommand = exceptionCommand.addArgToPayload(this.getExceptionCode(exception));
38
- exceptionCommand = exceptionCommand.addArgToPayload(command ? command.toString() : "Command is null");
38
+ exceptionCommand = exceptionCommand.addArgToPayload(
39
+ command ? command.toString() : "Command is null"
40
+ );
39
41
  exceptionCommand = exceptionCommand.addArgToPayload(exception.name);
40
42
  exceptionCommand = exceptionCommand.addArgToPayload(exception.message);
41
43
  exceptionCommand = exceptionCommand.addArgToPayload(stackClasses.join("|"));
@@ -45,7 +47,9 @@ class ExceptionSerializer {
45
47
  } catch (e) {
46
48
  exceptionCommand = new import_Command.Command(import_RuntimeName.RuntimeName.Nodejs, import_CommandType.CommandType.Exception, []);
47
49
  exceptionCommand = exceptionCommand.addArgToPayload(this.getExceptionCode(e));
48
- exceptionCommand = exceptionCommand.addArgToPayload(command ? command.toString() : "Command is null");
50
+ exceptionCommand = exceptionCommand.addArgToPayload(
51
+ command ? command.toString() : "Command is null"
52
+ );
49
53
  exceptionCommand = exceptionCommand.addArgToPayload("Node.js Exception Serialization Error");
50
54
  exceptionCommand = exceptionCommand.addArgToPayload(e.message);
51
55
  exceptionCommand = exceptionCommand.addArgToPayload("ExceptionSerializer");
@@ -81,13 +81,16 @@ class TcpConnectionData extends import_IConnectionData.IConnectionData {
81
81
  return hostname;
82
82
  } else {
83
83
  const dns = requireDynamic("dns");
84
- return dns.resolve4(hostname, (err, addresses) => {
85
- if (err) {
86
- console.error(err);
87
- return "";
84
+ return dns.resolve4(
85
+ hostname,
86
+ (err, addresses) => {
87
+ if (err) {
88
+ console.error(err);
89
+ return "";
90
+ }
91
+ return addresses[0];
88
92
  }
89
- return addresses[0];
90
- });
93
+ );
91
94
  }
92
95
  }
93
96
  return "";
@@ -124,6 +127,12 @@ class TcpConnectionData extends import_IConnectionData.IConnectionData {
124
127
  #getPortBytes() {
125
128
  return [this._port & 255, this._port >> 8];
126
129
  }
130
+ /**
131
+ * @returns {string}
132
+ */
133
+ toString() {
134
+ return `${this.ipAddress}:${this._port}`;
135
+ }
127
136
  }
128
137
  // Annotate the CommonJS export names for ESM import in node:
129
138
  0 && (module.exports = {
@@ -39,16 +39,18 @@ class AbstractHandler {
39
39
  }
40
40
 
41
41
  /**
42
- *
43
- * @param {*} error
44
- * @param {*} class_name
45
- * @returns
42
+ *
43
+ * @param {*} error
44
+ * @param {*} class_name
45
+ * @returns
46
46
  */
47
47
  process_stack_trace(error, class_name) {
48
48
  let stackTraceArray = error.stack.split('\n').map((/** @type {string} */ frame) => frame.trim())
49
49
  stackTraceArray.forEach((/** @type {string} */ str, /** @type {number} */ index) => {
50
50
  if (str.includes(class_name)) {
51
- stackTraceArray = stackTraceArray.slice(0, index).filter((/** @type {string} */ s) => !s.includes(class_name))
51
+ stackTraceArray = stackTraceArray
52
+ .slice(0, index)
53
+ .filter((/** @type {string} */ s) => !s.includes(class_name))
52
54
  }
53
55
  })
54
56
  error.stack = stackTraceArray.join(' \n ')
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class AddEventListenerHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class ArrayReferenceHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class AsKwargsHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class AsOutHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class AsRefHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class CreateNullHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class ExceptionHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GenerateLibHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetAsyncOperationResultHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetEnumItemHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetEnumNameHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetEnumValueHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,44 @@
1
+ import { AbstractHandler } from './AbstractHandler.js'
2
+
3
+ /**
4
+ * @typedef {import('../../utils/Command.js').Command} Command
5
+ */
6
+
7
+ class GetGlobalFieldHandler extends AbstractHandler {
8
+ requiredParametersCount = 1
9
+
10
+ constructor() {
11
+ super()
12
+ }
13
+
14
+ /**
15
+ * @param {Command} command
16
+ * @returns {any}
17
+ */
18
+ process(command) {
19
+ try {
20
+ if (command.payload.length < this.requiredParametersCount) {
21
+ throw new Error('Invoke Global Field parameters mismatch')
22
+ }
23
+ const { payload } = command
24
+ const fieldName = payload[0]
25
+
26
+ if (fieldName in global && typeof global[fieldName] !== 'function') {
27
+ return global[fieldName]
28
+ } else {
29
+ const fields = Object.getOwnPropertyNames(global).filter(
30
+ (property) => typeof global[property] !== 'function'
31
+ )
32
+ let message = `Field ${fieldName} not found in global. Available fields:\n`
33
+ fields.forEach((field) => {
34
+ message += `${field}\n`
35
+ })
36
+ throw new Error(message)
37
+ }
38
+ } catch (error) {
39
+ throw this.process_stack_trace(error, this.constructor.name)
40
+ }
41
+ }
42
+ }
43
+
44
+ export { GetGlobalFieldHandler }
@@ -66,9 +66,9 @@ class GetInstanceMethodAsDelegateHandler extends AbstractHandler {
66
66
  * @returns {Error} The error with detailed message.
67
67
  */
68
68
  createMethodNotFoundError(type, methodName) {
69
- const methods = Object.getOwnPropertyNames(/** @type {{prototype: Object}} */ (type).prototype).filter(
70
- (key) => typeof /** @type {any} */ (type).prototype[key] === 'function'
71
- )
69
+ const methods = Object.getOwnPropertyNames(
70
+ /** @type {{prototype: Object}} */ (type).prototype
71
+ ).filter((key) => typeof (/** @type {any} */ (type).prototype[key]) === 'function')
72
72
  const availableMethods = methods.map((name) => `${name}()`)
73
73
  const message = `Method ${methodName} not found in class ${/** @type {{name: string}} */ (type).name}. Available instance public methods:\n${availableMethods.join('\n')}`
74
74
  return new Error(message)
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetModuleHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+ import { AbstractHandler } from './AbstractHandler.js'
3
+
4
+ export class GetRefValueHandler extends AbstractHandler {
5
+ /**
6
+ * @param {any} command
7
+ */
8
+ handleCommand(command) {
9
+ throw new Error(`${this.constructor.name} is not implemented in Node.js`)
10
+ }
11
+ }
@@ -0,0 +1,29 @@
1
+ // @ts-check
2
+ import { TypesHandler } from '../../utils/TypesHandler.js'
3
+ import { AbstractHandler } from './AbstractHandler.js'
4
+
5
+ /**
6
+ * @typedef {import('../../utils/Command.js').Command} Command
7
+ */
8
+
9
+ /**
10
+ * GetResultTypeHandler class handles the conversion of JType to Type.
11
+ */
12
+ class GetResultTypeHandler extends AbstractHandler {
13
+ constructor() {
14
+ super()
15
+ /** @type {number} */
16
+ this.requiredParametersCount = 1
17
+ }
18
+
19
+ /**
20
+ * Processes the given command to convert JType to Type.
21
+ * @param {Command} command - The command to process.
22
+ * @returns {any} The converted type.
23
+ */
24
+ process(command) {
25
+ return command.payload[0].constructor.name
26
+ }
27
+ }
28
+
29
+ export { GetResultTypeHandler }
@@ -43,4 +43,3 @@ class GetStaticFieldHandler extends AbstractHandler {
43
43
  }
44
44
 
45
45
  export { GetStaticFieldHandler }
46
-
@@ -64,7 +64,9 @@ class GetStaticMethodAsDelegateHandler extends AbstractHandler {
64
64
  * @returns {Error} The error with detailed message.
65
65
  */
66
66
  createMethodNotFoundError(type, methodName) {
67
- const methods = Object.keys(type).filter((key) => typeof /** @type {any} */ (type)[key] === 'function')
67
+ const methods = Object.keys(type).filter(
68
+ (key) => typeof (/** @type {any} */ (type)[key]) === 'function'
69
+ )
68
70
  const availableMethods = methods.map((name) => `${name}()`)
69
71
  const message = `Method ${methodName} not found in class ${/** @type {{name: string}} */ (type).name}. Available public static methods:\n${availableMethods.join('\n')}`
70
72
  return new Error(message)
@@ -22,9 +22,9 @@ class GetTypeHandler extends AbstractHandler {
22
22
  }
23
23
 
24
24
  /**
25
- *
26
- * @param {Command} command
27
- * @returns
25
+ *
26
+ * @param {Command} command
27
+ * @returns
28
28
  */
29
29
  process(command) {
30
30
  try {