javonet-nodejs-sdk 2.6.5 → 2.6.6
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.
|
@@ -23,6 +23,7 @@ __export(RuntimeFactory_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(RuntimeFactory_exports);
|
|
24
24
|
var import_RuntimeName = require("../utils/RuntimeName.cjs");
|
|
25
25
|
var import_RuntimeContext = require("./RuntimeContext.cjs");
|
|
26
|
+
var import_ConnectionType = require("../utils/ConnectionType.cjs");
|
|
26
27
|
class RuntimeFactory {
|
|
27
28
|
/**
|
|
28
29
|
* @param {IConnectionData} connectionData
|
|
@@ -103,27 +104,24 @@ class RuntimeFactory {
|
|
|
103
104
|
return import_RuntimeContext.RuntimeContext.getInstance(import_RuntimeName.RuntimeName.Python27, this.connectionData);
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
|
-
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules:
|
|
107
|
+
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules: string; }} config
|
|
107
108
|
*/
|
|
108
109
|
static initializeRuntimeContext(config) {
|
|
109
110
|
const rtmCtx = import_RuntimeContext.RuntimeContext.getInstance(config.runtime, config.connectionData);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
modules.forEach((module2) => {
|
|
119
|
-
const isAbsolute = pathModule ? pathModule.isAbsolute(module2) : module2.startsWith("/") || /^[A-Za-z]:\\/.test(module2);
|
|
120
|
-
if (isAbsolute) {
|
|
121
|
-
rtmCtx.loadLibrary(module2);
|
|
122
|
-
} else {
|
|
123
|
-
const resolved = pathModule ? pathModule.join(process.cwd(), module2) : `${process.cwd()}/${module2}`;
|
|
124
|
-
rtmCtx.loadLibrary(resolved);
|
|
111
|
+
if (config.connectionData.connectionType === import_ConnectionType.ConnectionType.IN_MEMORY) {
|
|
112
|
+
const modules = (config.modules || "").split(",").map((m) => m.trim()).filter((m) => m !== "");
|
|
113
|
+
let pathModule = null;
|
|
114
|
+
try {
|
|
115
|
+
const _require = typeof require !== "undefined" ? require : eval("require");
|
|
116
|
+
pathModule = _require("path");
|
|
117
|
+
} catch (e) {
|
|
118
|
+
pathModule = null;
|
|
125
119
|
}
|
|
126
|
-
|
|
120
|
+
modules.forEach((module2) => {
|
|
121
|
+
const fullPath = pathModule ? pathModule.resolve(module2) : module2;
|
|
122
|
+
rtmCtx.loadLibrary(fullPath);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
127
125
|
return rtmCtx;
|
|
128
126
|
}
|
|
129
127
|
}
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export class RuntimeFactory {
|
|
10
10
|
/**
|
|
11
|
-
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules:
|
|
11
|
+
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules: string; }} config
|
|
12
12
|
*/
|
|
13
13
|
static initializeRuntimeContext(config: {
|
|
14
14
|
runtime: import("../types.js").RuntimeName;
|
|
15
15
|
connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData;
|
|
16
|
-
modules:
|
|
16
|
+
modules: string;
|
|
17
17
|
}): RuntimeContext;
|
|
18
18
|
/**
|
|
19
19
|
* @param {IConnectionData} connectionData
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//@ts-check
|
|
2
2
|
import { RuntimeName } from '../utils/RuntimeName.js'
|
|
3
3
|
import { RuntimeContext } from './RuntimeContext.js'
|
|
4
|
+
import { ConnectionType } from '../utils/ConnectionType.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {import('../utils/connectionData/IConnectionData.js').IConnectionData} IConnectionData
|
|
@@ -100,41 +101,35 @@ export class RuntimeFactory {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
|
-
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules:
|
|
104
|
+
* @param {{ runtime: import("../types.js").RuntimeName; connectionData: import("../utils/connectionData/IConnectionData.js").IConnectionData; modules: string; }} config
|
|
104
105
|
*/
|
|
105
106
|
static initializeRuntimeContext(config) {
|
|
106
107
|
const rtmCtx = RuntimeContext.getInstance(config.runtime, config.connectionData)
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
.
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
if (config.connectionData.connectionType === ConnectionType.IN_MEMORY) {
|
|
110
|
+
const modules = (config.modules || '')
|
|
111
|
+
.split(',')
|
|
112
|
+
.map((m) => m.trim())
|
|
113
|
+
.filter((m) => m !== '')
|
|
114
|
+
|
|
115
|
+
// try to get Node's path module; if unavailable, fall back to simple checks
|
|
116
|
+
let pathModule = null
|
|
117
|
+
try {
|
|
118
|
+
// eslint-disable-next-line no-eval
|
|
119
|
+
const _require = typeof require !== 'undefined' ? require : eval('require')
|
|
120
|
+
pathModule = _require('path')
|
|
121
|
+
} catch (e) {
|
|
122
|
+
pathModule = null
|
|
123
|
+
}
|
|
112
124
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} catch (e) {
|
|
120
|
-
pathModule = null
|
|
125
|
+
modules.forEach((module) => {
|
|
126
|
+
const fullPath = pathModule
|
|
127
|
+
? pathModule.resolve(module)
|
|
128
|
+
: module
|
|
129
|
+
rtmCtx.loadLibrary(fullPath)
|
|
130
|
+
})
|
|
121
131
|
}
|
|
122
132
|
|
|
123
|
-
modules.forEach((/** @type {string} */ module) => {
|
|
124
|
-
const isAbsolute = pathModule
|
|
125
|
-
? pathModule.isAbsolute(module)
|
|
126
|
-
: module.startsWith('/') || /^[A-Za-z]:\\/.test(module)
|
|
127
|
-
|
|
128
|
-
if (isAbsolute) {
|
|
129
|
-
rtmCtx.loadLibrary(module)
|
|
130
|
-
} else {
|
|
131
|
-
const resolved = pathModule
|
|
132
|
-
? pathModule.join(process.cwd(), module)
|
|
133
|
-
: `${process.cwd()}/${module}`
|
|
134
|
-
rtmCtx.loadLibrary(resolved)
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
133
|
return rtmCtx
|
|
139
134
|
}
|
|
140
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "javonet-nodejs-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.6",
|
|
4
4
|
"description": "Javonet allows you to reference and use modules or packages written in (Java/Kotlin/Groovy/Clojure, C#/VB.NET, Ruby, Perl, Python, JavaScript/TypeScript) like they were created in your technology. It works on Linux/Windows and MacOS for applications created in JVM, CLR/Netcore, Perl, Python, Ruby, NodeJS, C++ or GoLang and gives you unparalleled freedom and flexibility with native performance in building your mixed-technologies products. Let it be accessing best AI or cryptography libraries, devices SDKs, legacy client modules, internal custom packages or anything from public repositories available on NPM, Nuget, PyPI, Maven/Gradle, RubyGems or GitHub. Get free from programming languages barriers today! For more information check out our guides at https://www.javonet.com/guides/v2/",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "SdNCenter Sp. z o. o.",
|