javonet-nodejs-sdk 2.5.16 → 2.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/delegatesCache/DelegatesCache.cjs +1 -5
- package/dist/core/handler/AbstractHandler.cjs +1 -3
- package/dist/core/handler/ArrayGetItemHandler.cjs +1 -3
- package/dist/core/handler/ArrayGetRankHandler.cjs +1 -3
- package/dist/core/handler/ArrayGetSizeHandler.cjs +1 -3
- package/dist/core/handler/ArraySetItemHandler.cjs +1 -3
- package/dist/core/handler/CreateClassInstanceHandler.cjs +1 -3
- package/dist/core/handler/EnableTypeHandler.cjs +1 -3
- package/dist/core/handler/GetGlobalStaticFieldHandler.cjs +1 -3
- package/dist/core/handler/GetInstanceFieldHandler.cjs +1 -3
- package/dist/core/handler/GetStaticFieldHandler.cjs +1 -3
- package/dist/core/handler/GetStaticMethodAsDelegateHandler.cjs +2 -4
- package/dist/core/handler/InvokeGlobalFunctionHandler.cjs +1 -3
- package/dist/core/handler/InvokeInstanceMethodHandler.cjs +1 -3
- package/dist/core/handler/InvokeStaticMethodHandler.cjs +1 -3
- package/dist/core/handler/LoadLibraryHandler.cjs +7 -10
- package/dist/core/handler/PassDelegateHandler.cjs +2 -4
- package/dist/core/handler/SetGlobalStaticFieldHandler.cjs +1 -3
- package/dist/core/handler/SetInstanceFieldHandler.cjs +1 -3
- package/dist/core/handler/SetStaticFieldHandler.cjs +1 -3
- package/dist/core/interpreter/Interpreter.cjs +2 -6
- package/dist/core/namespaceCache/NamespaceCache.cjs +7 -10
- package/dist/core/receiver/Receiver.cjs +2 -4
- package/dist/core/transmitter/Transmitter.cjs +3 -5
- package/dist/core/typeCache/TypeCache.cjs +7 -10
- package/dist/sdk/ConfigRuntimeFactory.cjs +78 -89
- package/dist/sdk/InvocationContext.cjs +170 -202
- package/dist/sdk/RuntimeContext.cjs +78 -94
- package/dist/types/utils/CreateRequire.browser.d.ts +1 -0
- package/dist/types/utils/CreateRequire.node.d.ts +2 -0
- package/dist/types/utils/Runtime.d.ts +2 -2
- package/dist/utils/CreateRequire.browser.cjs +30 -0
- package/dist/utils/CreateRequire.node.cjs +28 -0
- package/dist/utils/Runtime.cjs +24 -18
- package/dist/utils/RuntimeLogger.cjs +2 -4
- package/dist/utils/RuntimeLoggerBrowser.cjs +1 -3
- package/dist/utils/nodejs/connectionData/TcpConnectionData.cjs +12 -22
- package/lib/utils/CreateRequire.browser.js +5 -0
- package/lib/utils/CreateRequire.node.js +3 -0
- package/lib/utils/Runtime.js +24 -5
- package/package.json +10 -1
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,19 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
19
|
var NamespaceCache_exports = {};
|
|
22
20
|
__export(NamespaceCache_exports, {
|
|
23
21
|
NamespaceCache: () => NamespaceCache
|
|
24
22
|
});
|
|
25
23
|
module.exports = __toCommonJS(NamespaceCache_exports);
|
|
26
|
-
|
|
24
|
+
class NamespaceCache {
|
|
25
|
+
static _instance = null;
|
|
26
|
+
namespaceCache = [];
|
|
27
27
|
constructor() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_NamespaceCache._instance = this;
|
|
28
|
+
if (NamespaceCache._instance === null) {
|
|
29
|
+
NamespaceCache._instance = this;
|
|
31
30
|
}
|
|
32
|
-
return
|
|
31
|
+
return NamespaceCache._instance;
|
|
33
32
|
}
|
|
34
33
|
cacheNamespace(namespaceRegex) {
|
|
35
34
|
this.namespaceCache.push(namespaceRegex);
|
|
@@ -52,9 +51,7 @@ const _NamespaceCache = class _NamespaceCache {
|
|
|
52
51
|
this.namespaceCache = [];
|
|
53
52
|
return 0;
|
|
54
53
|
}
|
|
55
|
-
}
|
|
56
|
-
__publicField(_NamespaceCache, "_instance", null);
|
|
57
|
-
let NamespaceCache = _NamespaceCache;
|
|
54
|
+
}
|
|
58
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
56
|
0 && (module.exports = {
|
|
60
57
|
NamespaceCache
|
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,20 +16,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
19
|
var Receiver_exports = {};
|
|
22
20
|
__export(Receiver_exports, {
|
|
23
21
|
Receiver: () => Receiver
|
|
24
22
|
});
|
|
25
23
|
module.exports = __toCommonJS(Receiver_exports);
|
|
26
|
-
const import_meta = {};
|
|
27
24
|
var import_Interpreter = require("../interpreter/Interpreter.cjs");
|
|
28
25
|
var import_CommandSerializer = require("../protocol/CommandSerializer.cjs");
|
|
29
26
|
var import_Runtime = require("../../utils/Runtime.cjs");
|
|
30
27
|
var import_InMemoryConnectionData = require("../../utils/connectionData/InMemoryConnectionData.cjs");
|
|
28
|
+
const import_meta = {};
|
|
31
29
|
let _RuntimeLogger = null;
|
|
32
30
|
const requireDynamic = (0, import_Runtime.getRequire)(import_meta.url);
|
|
33
31
|
class Receiver {
|
|
32
|
+
static connectionData = new import_InMemoryConnectionData.InMemoryConnectionData();
|
|
34
33
|
Receiver() {
|
|
35
34
|
if (!_RuntimeLogger) {
|
|
36
35
|
const { RuntimeLogger } = require("../../utils/RuntimeLogger.cjs");
|
|
@@ -58,7 +57,6 @@ class Receiver {
|
|
|
58
57
|
return response;
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
__publicField(Receiver, "connectionData", new import_InMemoryConnectionData.InMemoryConnectionData());
|
|
62
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
61
|
0 && (module.exports = {
|
|
64
62
|
Receiver
|
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
19
|
var Transmitter_exports = {};
|
|
22
20
|
__export(Transmitter_exports, {
|
|
23
21
|
Transmitter: () => Transmitter
|
|
@@ -28,6 +26,9 @@ class Transmitter {
|
|
|
28
26
|
static sendCommand(messageArray) {
|
|
29
27
|
return import_TransmitterWrapper.TransmitterWrapper.sendCommand(messageArray);
|
|
30
28
|
}
|
|
29
|
+
static activate = function(licenseKey) {
|
|
30
|
+
return import_TransmitterWrapper.TransmitterWrapper.activate(licenseKey);
|
|
31
|
+
};
|
|
31
32
|
static setConfigSource(configSource) {
|
|
32
33
|
return import_TransmitterWrapper.TransmitterWrapper.setConfigSource(configSource);
|
|
33
34
|
}
|
|
@@ -35,9 +36,6 @@ class Transmitter {
|
|
|
35
36
|
return import_TransmitterWrapper.TransmitterWrapper.setJavonetWorkingDirectory(workingDirectory);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
__publicField(Transmitter, "activate", function(licenseKey) {
|
|
39
|
-
return import_TransmitterWrapper.TransmitterWrapper.activate(licenseKey);
|
|
40
|
-
});
|
|
41
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
40
|
0 && (module.exports = {
|
|
43
41
|
Transmitter
|
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,19 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
19
|
var TypeCache_exports = {};
|
|
22
20
|
__export(TypeCache_exports, {
|
|
23
21
|
TypeCache: () => TypeCache
|
|
24
22
|
});
|
|
25
23
|
module.exports = __toCommonJS(TypeCache_exports);
|
|
26
|
-
|
|
24
|
+
class TypeCache {
|
|
25
|
+
static _instance = null;
|
|
26
|
+
typeCache = [];
|
|
27
27
|
constructor() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_TypeCache._instance = this;
|
|
28
|
+
if (TypeCache._instance === null) {
|
|
29
|
+
TypeCache._instance = this;
|
|
31
30
|
}
|
|
32
|
-
return
|
|
31
|
+
return TypeCache._instance;
|
|
33
32
|
}
|
|
34
33
|
cacheType(typRegex) {
|
|
35
34
|
this.typeCache.push(typRegex);
|
|
@@ -52,9 +51,7 @@ const _TypeCache = class _TypeCache {
|
|
|
52
51
|
this.typeCache = [];
|
|
53
52
|
return 0;
|
|
54
53
|
}
|
|
55
|
-
}
|
|
56
|
-
__publicField(_TypeCache, "_instance", null);
|
|
57
|
-
let TypeCache = _TypeCache;
|
|
54
|
+
}
|
|
58
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
56
|
0 && (module.exports = {
|
|
60
57
|
TypeCache
|
|
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __typeError = (msg) => {
|
|
7
|
-
throw TypeError(msg);
|
|
8
|
-
};
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
6
|
var __export = (target, all) => {
|
|
11
7
|
for (var name in all)
|
|
12
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,16 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
22
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
25
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
26
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
27
19
|
var ConfigRuntimeFactory_exports = {};
|
|
28
20
|
__export(ConfigRuntimeFactory_exports, {
|
|
29
21
|
ConfigRuntimeFactory: () => ConfigRuntimeFactory
|
|
30
22
|
});
|
|
31
23
|
module.exports = __toCommonJS(ConfigRuntimeFactory_exports);
|
|
32
|
-
const import_meta = {};
|
|
33
24
|
var import_WsConnectionData = require("../utils/connectionData/WsConnectionData.cjs");
|
|
34
25
|
var import_TcpConnectionData = require("../utils/nodejs/connectionData/TcpConnectionData.cjs");
|
|
35
26
|
var import_RuntimeName = require("../utils/RuntimeName.cjs");
|
|
@@ -39,17 +30,16 @@ var import_ConfigSourceResolver = require("./tools/browser/ConfigSourceResolver.
|
|
|
39
30
|
var import_Runtime = require("../utils/Runtime.cjs");
|
|
40
31
|
var import_JsonFileResolver = require("./tools/nodejs/JsonFileResolver.cjs");
|
|
41
32
|
var import_InMemoryConnectionData = require("../utils/connectionData/InMemoryConnectionData.cjs");
|
|
42
|
-
|
|
33
|
+
const import_meta = {};
|
|
43
34
|
const requireDynamic = (0, import_Runtime.getRequire)(import_meta.url);
|
|
44
35
|
class ConfigRuntimeFactory {
|
|
36
|
+
/** @type {import('../core/transmitter/Transmitter.js') | null} */
|
|
37
|
+
transmitter = null;
|
|
45
38
|
/**
|
|
46
39
|
* @param {object | string} configSource
|
|
47
40
|
* @param {import('../core/transmitter/Transmitter.js') | null} transmitter
|
|
48
41
|
*/
|
|
49
42
|
constructor(configSource, transmitter = null) {
|
|
50
|
-
__privateAdd(this, _ConfigRuntimeFactory_instances);
|
|
51
|
-
/** @type {import('../core/transmitter/Transmitter.js') | null} */
|
|
52
|
-
__publicField(this, "transmitter", null);
|
|
53
43
|
this.configSource = configSource;
|
|
54
44
|
this.transmitter = transmitter;
|
|
55
45
|
if ((0, import_Runtime.isNodejsRuntime)()) {
|
|
@@ -63,7 +53,7 @@ class ConfigRuntimeFactory {
|
|
|
63
53
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
64
54
|
*/
|
|
65
55
|
clr(configName = "default") {
|
|
66
|
-
return
|
|
56
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Clr, configName);
|
|
67
57
|
}
|
|
68
58
|
/**
|
|
69
59
|
* Creates RuntimeContext instance to interact with the JVM runtime.
|
|
@@ -72,7 +62,7 @@ class ConfigRuntimeFactory {
|
|
|
72
62
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
73
63
|
*/
|
|
74
64
|
jvm(configName = "default") {
|
|
75
|
-
return
|
|
65
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Jvm, configName);
|
|
76
66
|
}
|
|
77
67
|
/**
|
|
78
68
|
* Creates RuntimeContext instance to interact with the .NET runtime.
|
|
@@ -81,7 +71,7 @@ class ConfigRuntimeFactory {
|
|
|
81
71
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
82
72
|
*/
|
|
83
73
|
netcore(configName = "default") {
|
|
84
|
-
return
|
|
74
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Netcore, configName);
|
|
85
75
|
}
|
|
86
76
|
/**
|
|
87
77
|
* Creates RuntimeContext instance to interact with the Perl runtime.
|
|
@@ -90,7 +80,7 @@ class ConfigRuntimeFactory {
|
|
|
90
80
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
91
81
|
*/
|
|
92
82
|
perl(configName = "default") {
|
|
93
|
-
return
|
|
83
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Perl, configName);
|
|
94
84
|
}
|
|
95
85
|
/**
|
|
96
86
|
* Creates RuntimeContext instance to interact with the Python runtime.
|
|
@@ -99,7 +89,7 @@ class ConfigRuntimeFactory {
|
|
|
99
89
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
100
90
|
*/
|
|
101
91
|
python(configName = "default") {
|
|
102
|
-
return
|
|
92
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Python, configName);
|
|
103
93
|
}
|
|
104
94
|
/**
|
|
105
95
|
* Creates RuntimeContext instance to interact with the Ruby runtime.
|
|
@@ -108,7 +98,7 @@ class ConfigRuntimeFactory {
|
|
|
108
98
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
109
99
|
*/
|
|
110
100
|
ruby(configName = "default") {
|
|
111
|
-
return
|
|
101
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Ruby, configName);
|
|
112
102
|
}
|
|
113
103
|
/**
|
|
114
104
|
* Creates RuntimeContext instance to interact with Node.js runtime.
|
|
@@ -117,7 +107,7 @@ class ConfigRuntimeFactory {
|
|
|
117
107
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
118
108
|
*/
|
|
119
109
|
nodejs(configName = "default") {
|
|
120
|
-
return
|
|
110
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Nodejs, configName);
|
|
121
111
|
}
|
|
122
112
|
/**
|
|
123
113
|
* Creates RuntimeContext instance to interact with the Python 2.7 runtime.
|
|
@@ -126,83 +116,82 @@ class ConfigRuntimeFactory {
|
|
|
126
116
|
* @see [Javonet Guides](https://www.javonet.com/guides/v2/javascript/foundations/runtime-context)
|
|
127
117
|
*/
|
|
128
118
|
python27(configName = "default") {
|
|
129
|
-
return
|
|
119
|
+
return this.#getRuntimeContext(import_RuntimeName.RuntimeName.Python27, configName);
|
|
130
120
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
121
|
+
/**
|
|
122
|
+
* @param {number} runtime
|
|
123
|
+
* @param {string} configName
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
#getRuntimeContext(runtime, configName = "default") {
|
|
127
|
+
if ((0, import_Runtime.isBrowserRuntime)()) {
|
|
128
|
+
const jfr = new import_ConfigSourceResolver.ConfigSourceResolver(this.configSource);
|
|
129
|
+
const connType = jfr.getChannelType(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName);
|
|
130
|
+
let connData = null;
|
|
131
|
+
if (connType === "webSocket") {
|
|
132
|
+
connData = new import_WsConnectionData.WsConnectionData(
|
|
133
|
+
jfr.getChannelHost(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName)
|
|
134
|
+
);
|
|
135
|
+
} else {
|
|
136
|
+
throw new Error("Unsupported connection type: " + connType);
|
|
137
|
+
}
|
|
138
|
+
const rtmCtx = import_RuntimeContext.RuntimeContext.getInstance(runtime, connData);
|
|
139
|
+
this.#loadModules(runtime, configName, jfr, rtmCtx);
|
|
140
|
+
return rtmCtx;
|
|
141
|
+
}
|
|
142
|
+
if ((0, import_Runtime.isNodejsRuntime)()) {
|
|
143
|
+
let jfr = new import_JsonFileResolver.JsonFileResolver(this.configSource);
|
|
144
|
+
try {
|
|
145
|
+
const licenseKey = jfr.getLicenseKey();
|
|
146
|
+
this.transmitter?.activate(licenseKey);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
let rtmCtx = null;
|
|
151
|
+
let connData = null;
|
|
152
|
+
let connType = jfr.getChannelType(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName);
|
|
153
|
+
if (connType === "inMemory") {
|
|
154
|
+
connData = new import_InMemoryConnectionData.InMemoryConnectionData();
|
|
155
|
+
} else if (connType === "tcp") {
|
|
156
|
+
connData = new import_TcpConnectionData.TcpConnectionData(
|
|
157
|
+
jfr.getChannelHost(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName),
|
|
158
|
+
jfr.getChannelPort(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName)
|
|
159
|
+
);
|
|
160
|
+
} else if (connType === "webSocket") {
|
|
161
|
+
connData = new import_WsConnectionData.WsConnectionData(
|
|
162
|
+
jfr.getChannelHost(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName)
|
|
163
|
+
);
|
|
164
|
+
} else {
|
|
165
|
+
throw new Error("Unsupported connection type: " + connType);
|
|
166
|
+
}
|
|
167
|
+
rtmCtx = import_RuntimeContext.RuntimeContext.getInstance(runtime, connData);
|
|
168
|
+
this.#loadModules(runtime, configName, jfr, rtmCtx);
|
|
169
|
+
return rtmCtx;
|
|
149
170
|
}
|
|
150
|
-
const rtmCtx = import_RuntimeContext.RuntimeContext.getInstance(runtime, connData);
|
|
151
|
-
__privateMethod(this, _ConfigRuntimeFactory_instances, loadModules_fn).call(this, runtime, configName, jfr, rtmCtx);
|
|
152
|
-
return rtmCtx;
|
|
153
171
|
}
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
// @ts-ignore
|
|
173
|
+
#loadModules(runtime, configName, jfr, rtmCtx) {
|
|
156
174
|
try {
|
|
157
|
-
const
|
|
158
|
-
|
|
175
|
+
const modules = jfr.getModules(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName).split(",").filter((module2) => module2.trim() !== "");
|
|
176
|
+
if ((0, import_Runtime.isNodejsRuntime)()) {
|
|
177
|
+
if (typeof this.configSource !== "string") {
|
|
178
|
+
throw new Error("configSource is not a string");
|
|
179
|
+
}
|
|
180
|
+
const path = requireDynamic("path");
|
|
181
|
+
const configDirectoryAbsolutePath = path?.dirname(this.configSource);
|
|
182
|
+
modules.forEach((module2) => {
|
|
183
|
+
if (path?.isAbsolute(module2)) {
|
|
184
|
+
rtmCtx.loadLibrary(module2);
|
|
185
|
+
} else {
|
|
186
|
+
rtmCtx.loadLibrary(path?.join(configDirectoryAbsolutePath, module2));
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
159
190
|
} catch (error) {
|
|
160
191
|
throw error;
|
|
161
192
|
}
|
|
162
|
-
let rtmCtx = null;
|
|
163
|
-
let connData = null;
|
|
164
|
-
let connType = jfr.getChannelType(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName);
|
|
165
|
-
if (connType === "inMemory") {
|
|
166
|
-
connData = new import_InMemoryConnectionData.InMemoryConnectionData();
|
|
167
|
-
} else if (connType === "tcp") {
|
|
168
|
-
connData = new import_TcpConnectionData.TcpConnectionData(
|
|
169
|
-
jfr.getChannelHost(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName),
|
|
170
|
-
jfr.getChannelPort(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName)
|
|
171
|
-
);
|
|
172
|
-
} else if (connType === "webSocket") {
|
|
173
|
-
connData = new import_WsConnectionData.WsConnectionData(
|
|
174
|
-
jfr.getChannelHost(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName)
|
|
175
|
-
);
|
|
176
|
-
} else {
|
|
177
|
-
throw new Error("Unsupported connection type: " + connType);
|
|
178
|
-
}
|
|
179
|
-
rtmCtx = import_RuntimeContext.RuntimeContext.getInstance(runtime, connData);
|
|
180
|
-
__privateMethod(this, _ConfigRuntimeFactory_instances, loadModules_fn).call(this, runtime, configName, jfr, rtmCtx);
|
|
181
|
-
return rtmCtx;
|
|
182
193
|
}
|
|
183
|
-
}
|
|
184
|
-
// @ts-ignore
|
|
185
|
-
loadModules_fn = function(runtime, configName, jfr, rtmCtx) {
|
|
186
|
-
try {
|
|
187
|
-
const modules = jfr.getModules(import_RuntimeNameHandler.RuntimeNameHandler.getName(runtime), configName).split(",").filter((module2) => module2.trim() !== "");
|
|
188
|
-
if ((0, import_Runtime.isNodejsRuntime)()) {
|
|
189
|
-
if (typeof this.configSource !== "string") {
|
|
190
|
-
throw new Error("configSource is not a string");
|
|
191
|
-
}
|
|
192
|
-
const path = requireDynamic("path");
|
|
193
|
-
const configDirectoryAbsolutePath = path?.dirname(this.configSource);
|
|
194
|
-
modules.forEach((module2) => {
|
|
195
|
-
if (path?.isAbsolute(module2)) {
|
|
196
|
-
rtmCtx.loadLibrary(module2);
|
|
197
|
-
} else {
|
|
198
|
-
rtmCtx.loadLibrary(path?.join(configDirectoryAbsolutePath, module2));
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
} catch (error) {
|
|
203
|
-
throw error;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
194
|
+
}
|
|
206
195
|
// Annotate the CommonJS export names for ESM import in node:
|
|
207
196
|
0 && (module.exports = {
|
|
208
197
|
ConfigRuntimeFactory
|