javonet-nodejs-sdk 2.6.13 → 2.6.15
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/handler/ArraySetItemHandler.cjs +9 -8
- package/dist/core/handler/AsDtoHandler.cjs +36 -0
- package/dist/core/handler/AsKwargsHandler.cjs +1 -1
- package/dist/core/handler/DtoPropertyHandler.cjs +36 -0
- package/dist/core/handler/Handler.cjs +14 -9
- package/dist/core/handler/PassDelegateHandler.cjs +1 -1
- package/dist/core/handler/ProjectResultAsDtoHandler.cjs +66 -0
- package/dist/core/handler/SetInstanceFieldHandler.cjs +1 -1
- package/dist/core/handler/SetStaticFieldHandler.cjs +6 -6
- package/dist/core/interpreter/Interpreter.cjs +14 -2
- package/dist/core/protocol/CommandDeserializer.cjs +8 -0
- package/dist/core/protocol/TypeDeserializer.cjs +4 -0
- package/dist/core/protocol/TypeSerializer.cjs +10 -5
- package/dist/core/webSocketClient/WebSocketClient.cjs +23 -5
- package/dist/core/webSocketClient/WebSocketClientBrowser.cjs +23 -5
- package/dist/plugins/PluginImplementationRegistry.cjs +214 -0
- package/dist/plugins/PluginPayloadBuilder.cjs +76 -0
- package/dist/plugins/PluginRegistry.cjs +255 -0
- package/dist/plugins/index.cjs +51 -0
- package/dist/plugins/interfaces/ICommunityPlugin.cjs +44 -0
- package/dist/plugins/interfaces/ICommunityReceivingPlugin.cjs +62 -0
- package/dist/plugins/interfaces/ICommunitySendingPlugin.cjs +59 -0
- package/dist/plugins/settings/BasePluginSettings.cjs +67 -0
- package/dist/plugins/settings/JwtGraftocodePluginSettings.cjs +40 -0
- package/dist/sdk/InvocationContext.cjs +133 -12
- package/dist/sdk/RuntimeContext.cjs +27 -9
- package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +7 -6
- package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +2 -2
- package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +2 -2
- package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +3 -3
- package/dist/sdk/tools/DtoHelper.cjs +100 -0
- package/dist/types/core/handler/ArraySetItemHandler.d.ts +1 -1
- package/dist/types/core/handler/AsDtoHandler.d.ts +7 -0
- package/dist/types/core/handler/AsKwargsHandler.d.ts +1 -1
- package/dist/types/core/handler/DtoPropertyHandler.d.ts +7 -0
- package/dist/types/core/handler/ProjectResultAsDtoHandler.d.ts +9 -0
- package/dist/types/core/handler/SetInstanceFieldHandler.d.ts +1 -1
- package/dist/types/core/handler/SetStaticFieldHandler.d.ts +1 -1
- package/dist/types/core/interpreter/Interpreter.d.ts +3 -3
- package/dist/types/core/protocol/CommandDeserializer.d.ts +1 -0
- package/dist/types/core/protocol/TypeDeserializer.d.ts +1 -0
- package/dist/types/core/protocol/TypeSerializer.d.ts +1 -0
- package/dist/types/plugins/PluginImplementationRegistry.d.ts +121 -0
- package/dist/types/plugins/PluginPayloadBuilder.d.ts +32 -0
- package/dist/types/plugins/PluginRegistry.d.ts +157 -0
- package/dist/types/plugins/index.d.ts +8 -0
- package/dist/types/plugins/interfaces/ICommunityPlugin.d.ts +14 -0
- package/dist/types/plugins/interfaces/ICommunityReceivingPlugin.d.ts +50 -0
- package/dist/types/plugins/interfaces/ICommunitySendingPlugin.d.ts +27 -0
- package/dist/types/plugins/settings/BasePluginSettings.d.ts +45 -0
- package/dist/types/plugins/settings/JwtGraftocodePluginSettings.d.ts +32 -0
- package/dist/types/sdk/InvocationContext.d.ts +20 -2
- package/dist/types/sdk/RuntimeContext.d.ts +6 -0
- package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +3 -6
- package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +2 -1
- package/dist/types/sdk/tools/DtoHelper.d.ts +35 -0
- package/dist/types/utils/Command.d.ts +5 -0
- package/dist/types/utils/CommandType.d.ts +3 -0
- package/dist/types/utils/Type.d.ts +2 -1
- package/dist/utils/Command.cjs +40 -0
- package/dist/utils/CommandType.cjs +4 -1
- package/dist/utils/Type.cjs +2 -1
- package/lib/core/handler/ArraySetItemHandler.js +11 -10
- package/lib/core/handler/AsDtoHandler.js +11 -0
- package/lib/core/handler/AsKwargsHandler.js +1 -1
- package/lib/core/handler/DtoPropertyHandler.js +11 -0
- package/lib/core/handler/Handler.js +16 -7
- package/lib/core/handler/PassDelegateHandler.js +2 -1
- package/lib/core/handler/ProjectResultAsDtoHandler.js +47 -0
- package/lib/core/handler/SetInstanceFieldHandler.js +1 -1
- package/lib/core/handler/SetStaticFieldHandler.js +6 -6
- package/lib/core/interpreter/Interpreter.js +18 -4
- package/lib/core/protocol/CommandDeserializer.js +9 -0
- package/lib/core/protocol/TypeDeserializer.js +5 -0
- package/lib/core/protocol/TypeSerializer.js +11 -8
- package/lib/core/webSocketClient/WebSocketClient.js +30 -5
- package/lib/core/webSocketClient/WebSocketClientBrowser.js +29 -5
- package/lib/plugins/PluginImplementationRegistry.js +231 -0
- package/lib/plugins/PluginPayloadBuilder.js +60 -0
- package/lib/plugins/PluginRegistry.js +295 -0
- package/lib/plugins/index.js +29 -0
- package/lib/plugins/interfaces/ICommunityPlugin.js +25 -0
- package/lib/plugins/interfaces/ICommunityReceivingPlugin.js +57 -0
- package/lib/plugins/interfaces/ICommunitySendingPlugin.js +42 -0
- package/lib/plugins/settings/BasePluginSettings.js +79 -0
- package/lib/plugins/settings/JwtGraftocodePluginSettings.js +43 -0
- package/lib/sdk/InvocationContext.js +149 -14
- package/lib/sdk/RuntimeContext.js +33 -9
- package/lib/sdk/configuration/configResolvers/ConfigResolver.js +14 -8
- package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +2 -2
- package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +2 -2
- package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +5 -5
- package/lib/sdk/tools/DtoHelper.js +90 -0
- package/lib/utils/Command.js +47 -0
- package/lib/utils/CommandType.js +3 -0
- package/lib/utils/Type.js +2 -1
- package/package.json +5 -1
- package/dist/sdk/tools/ActivationHelper.cjs +0 -66
- package/dist/types/sdk/tools/ActivationHelper.d.ts +0 -20
- package/lib/sdk/tools/ActivationHelper.js +0 -51
package/lib/utils/Command.js
CHANGED
|
@@ -69,4 +69,51 @@ export class Command {
|
|
|
69
69
|
return new Command(this.runtimeName, this.commandType, [current_command].concat(this.payload))
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns string representation of the Command instance for debugging purposes.
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
toString() {
|
|
78
|
+
try {
|
|
79
|
+
let result = ' { '
|
|
80
|
+
result += `RuntimeName: ${this.runtimeName}, `
|
|
81
|
+
result += `CommandType: ${this.commandType}, `
|
|
82
|
+
result += 'Payload: \n'
|
|
83
|
+
result += ' ['
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @type {string | any[]}
|
|
87
|
+
*/
|
|
88
|
+
const payload = this.payload || []
|
|
89
|
+
const len = payload.length
|
|
90
|
+
|
|
91
|
+
if (len > 0) {
|
|
92
|
+
result += '\n'
|
|
93
|
+
for (let i = 0; i < len; i++) {
|
|
94
|
+
const item = payload[i]
|
|
95
|
+
let itemStr
|
|
96
|
+
if (item === null || item === undefined) {
|
|
97
|
+
itemStr = 'null'
|
|
98
|
+
} else if (typeof item === 'string') {
|
|
99
|
+
itemStr = ` "${item}"`
|
|
100
|
+
} else if (item instanceof Command) {
|
|
101
|
+
itemStr = item.toString().replace(/\n/g, '\n ')
|
|
102
|
+
} else {
|
|
103
|
+
itemStr = ' ' + String(item)
|
|
104
|
+
}
|
|
105
|
+
result += ' ' + itemStr
|
|
106
|
+
result += i < len - 1 ? ',\n' : '\n'
|
|
107
|
+
}
|
|
108
|
+
result += ' ]\n'
|
|
109
|
+
} else {
|
|
110
|
+
result += ' ]\n'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
result += ' }'
|
|
114
|
+
return result
|
|
115
|
+
} catch (ex) {
|
|
116
|
+
return 'Error while converting command to string:' + (ex);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
72
119
|
}
|
package/lib/utils/CommandType.js
CHANGED
package/lib/utils/Type.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "javonet-nodejs-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.15",
|
|
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.",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"browser": "./lib/sdk/Javonet.js",
|
|
25
25
|
"require": "./dist/sdk/Javonet.cjs"
|
|
26
26
|
},
|
|
27
|
+
"./plugins": {
|
|
28
|
+
"import": "./lib/plugins/index.js",
|
|
29
|
+
"browser": "./lib/plugins/index.js"
|
|
30
|
+
},
|
|
27
31
|
"./lib/utils/CreateRequire.node.js": {
|
|
28
32
|
"browser": "./lib/utils/CreateRequire.browser.js",
|
|
29
33
|
"node": "./lib/utils/CreateRequire.node.js",
|
|
@@ -1,66 +0,0 @@
|
|
|
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 ActivationHelper_exports = {};
|
|
20
|
-
__export(ActivationHelper_exports, {
|
|
21
|
-
ActivationHelper: () => ActivationHelper
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(ActivationHelper_exports);
|
|
24
|
-
var import_Runtime = require("../../utils/Runtime.cjs");
|
|
25
|
-
class ActivationHelper {
|
|
26
|
-
/** @type {string} */
|
|
27
|
-
static temporaryLicenseKey = "License key not set";
|
|
28
|
-
/**
|
|
29
|
-
* @param {string} value
|
|
30
|
-
*/
|
|
31
|
-
static setTemporaryLicenseKey(value) {
|
|
32
|
-
if (!value || value === "your-license-key") {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
ActivationHelper.temporaryLicenseKey = value;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @returns {string}
|
|
39
|
-
*/
|
|
40
|
-
static getTemporaryLicenseKey() {
|
|
41
|
-
return ActivationHelper.temporaryLicenseKey;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @returns {Promise<string>}
|
|
45
|
-
*/
|
|
46
|
-
static async getLicenseKey() {
|
|
47
|
-
try {
|
|
48
|
-
return ActivationHelper._getLicenseKeyFromFile();
|
|
49
|
-
} catch {
|
|
50
|
-
return ActivationHelper.temporaryLicenseKey;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @returns {string}
|
|
55
|
-
*/
|
|
56
|
-
static _getLicenseKeyFromFile() {
|
|
57
|
-
if (!(0, import_Runtime.isBrowserRuntime)()) {
|
|
58
|
-
throw new Error("ActivationHelper is not supported in the browser runtime.");
|
|
59
|
-
}
|
|
60
|
-
return "";
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
ActivationHelper
|
|
66
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export class ActivationHelper {
|
|
2
|
-
/** @type {string} */
|
|
3
|
-
static temporaryLicenseKey: string;
|
|
4
|
-
/**
|
|
5
|
-
* @param {string} value
|
|
6
|
-
*/
|
|
7
|
-
static setTemporaryLicenseKey(value: string): void;
|
|
8
|
-
/**
|
|
9
|
-
* @returns {string}
|
|
10
|
-
*/
|
|
11
|
-
static getTemporaryLicenseKey(): string;
|
|
12
|
-
/**
|
|
13
|
-
* @returns {Promise<string>}
|
|
14
|
-
*/
|
|
15
|
-
static getLicenseKey(): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
static _getLicenseKeyFromFile(): string;
|
|
20
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { isBrowserRuntime } from '../../utils/Runtime.js'
|
|
3
|
-
|
|
4
|
-
class ActivationHelper {
|
|
5
|
-
/** @type {string} */
|
|
6
|
-
static temporaryLicenseKey = 'License key not set'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {string} value
|
|
10
|
-
*/
|
|
11
|
-
static setTemporaryLicenseKey(value) {
|
|
12
|
-
if (!value || value === 'your-license-key') {
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
// TODO: Uncomment this when we have a way to send messages to App Insights
|
|
16
|
-
// if (ActivationHelper.temporaryLicenseKey !== value) {
|
|
17
|
-
// SdkMessageHelper.sendExceptionToAppInsights('SdkMessage', 'Activation');
|
|
18
|
-
// }
|
|
19
|
-
ActivationHelper.temporaryLicenseKey = value
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
static getTemporaryLicenseKey() {
|
|
26
|
-
return ActivationHelper.temporaryLicenseKey
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @returns {Promise<string>}
|
|
31
|
-
*/
|
|
32
|
-
static async getLicenseKey() {
|
|
33
|
-
try {
|
|
34
|
-
return ActivationHelper._getLicenseKeyFromFile()
|
|
35
|
-
} catch {
|
|
36
|
-
return ActivationHelper.temporaryLicenseKey
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @returns {string}
|
|
42
|
-
*/
|
|
43
|
-
static _getLicenseKeyFromFile() {
|
|
44
|
-
if (!isBrowserRuntime()) {
|
|
45
|
-
throw new Error('ActivationHelper is not supported in the browser runtime.')
|
|
46
|
-
}
|
|
47
|
-
return ''
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { ActivationHelper }
|