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.
Files changed (100) hide show
  1. package/dist/core/handler/ArraySetItemHandler.cjs +9 -8
  2. package/dist/core/handler/AsDtoHandler.cjs +36 -0
  3. package/dist/core/handler/AsKwargsHandler.cjs +1 -1
  4. package/dist/core/handler/DtoPropertyHandler.cjs +36 -0
  5. package/dist/core/handler/Handler.cjs +14 -9
  6. package/dist/core/handler/PassDelegateHandler.cjs +1 -1
  7. package/dist/core/handler/ProjectResultAsDtoHandler.cjs +66 -0
  8. package/dist/core/handler/SetInstanceFieldHandler.cjs +1 -1
  9. package/dist/core/handler/SetStaticFieldHandler.cjs +6 -6
  10. package/dist/core/interpreter/Interpreter.cjs +14 -2
  11. package/dist/core/protocol/CommandDeserializer.cjs +8 -0
  12. package/dist/core/protocol/TypeDeserializer.cjs +4 -0
  13. package/dist/core/protocol/TypeSerializer.cjs +10 -5
  14. package/dist/core/webSocketClient/WebSocketClient.cjs +23 -5
  15. package/dist/core/webSocketClient/WebSocketClientBrowser.cjs +23 -5
  16. package/dist/plugins/PluginImplementationRegistry.cjs +214 -0
  17. package/dist/plugins/PluginPayloadBuilder.cjs +76 -0
  18. package/dist/plugins/PluginRegistry.cjs +255 -0
  19. package/dist/plugins/index.cjs +51 -0
  20. package/dist/plugins/interfaces/ICommunityPlugin.cjs +44 -0
  21. package/dist/plugins/interfaces/ICommunityReceivingPlugin.cjs +62 -0
  22. package/dist/plugins/interfaces/ICommunitySendingPlugin.cjs +59 -0
  23. package/dist/plugins/settings/BasePluginSettings.cjs +67 -0
  24. package/dist/plugins/settings/JwtGraftocodePluginSettings.cjs +40 -0
  25. package/dist/sdk/InvocationContext.cjs +133 -12
  26. package/dist/sdk/RuntimeContext.cjs +27 -9
  27. package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +7 -6
  28. package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +2 -2
  29. package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +2 -2
  30. package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +3 -3
  31. package/dist/sdk/tools/DtoHelper.cjs +100 -0
  32. package/dist/types/core/handler/ArraySetItemHandler.d.ts +1 -1
  33. package/dist/types/core/handler/AsDtoHandler.d.ts +7 -0
  34. package/dist/types/core/handler/AsKwargsHandler.d.ts +1 -1
  35. package/dist/types/core/handler/DtoPropertyHandler.d.ts +7 -0
  36. package/dist/types/core/handler/ProjectResultAsDtoHandler.d.ts +9 -0
  37. package/dist/types/core/handler/SetInstanceFieldHandler.d.ts +1 -1
  38. package/dist/types/core/handler/SetStaticFieldHandler.d.ts +1 -1
  39. package/dist/types/core/interpreter/Interpreter.d.ts +3 -3
  40. package/dist/types/core/protocol/CommandDeserializer.d.ts +1 -0
  41. package/dist/types/core/protocol/TypeDeserializer.d.ts +1 -0
  42. package/dist/types/core/protocol/TypeSerializer.d.ts +1 -0
  43. package/dist/types/plugins/PluginImplementationRegistry.d.ts +121 -0
  44. package/dist/types/plugins/PluginPayloadBuilder.d.ts +32 -0
  45. package/dist/types/plugins/PluginRegistry.d.ts +157 -0
  46. package/dist/types/plugins/index.d.ts +8 -0
  47. package/dist/types/plugins/interfaces/ICommunityPlugin.d.ts +14 -0
  48. package/dist/types/plugins/interfaces/ICommunityReceivingPlugin.d.ts +50 -0
  49. package/dist/types/plugins/interfaces/ICommunitySendingPlugin.d.ts +27 -0
  50. package/dist/types/plugins/settings/BasePluginSettings.d.ts +45 -0
  51. package/dist/types/plugins/settings/JwtGraftocodePluginSettings.d.ts +32 -0
  52. package/dist/types/sdk/InvocationContext.d.ts +20 -2
  53. package/dist/types/sdk/RuntimeContext.d.ts +6 -0
  54. package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +3 -6
  55. package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +2 -1
  56. package/dist/types/sdk/tools/DtoHelper.d.ts +35 -0
  57. package/dist/types/utils/Command.d.ts +5 -0
  58. package/dist/types/utils/CommandType.d.ts +3 -0
  59. package/dist/types/utils/Type.d.ts +2 -1
  60. package/dist/utils/Command.cjs +40 -0
  61. package/dist/utils/CommandType.cjs +4 -1
  62. package/dist/utils/Type.cjs +2 -1
  63. package/lib/core/handler/ArraySetItemHandler.js +11 -10
  64. package/lib/core/handler/AsDtoHandler.js +11 -0
  65. package/lib/core/handler/AsKwargsHandler.js +1 -1
  66. package/lib/core/handler/DtoPropertyHandler.js +11 -0
  67. package/lib/core/handler/Handler.js +16 -7
  68. package/lib/core/handler/PassDelegateHandler.js +2 -1
  69. package/lib/core/handler/ProjectResultAsDtoHandler.js +47 -0
  70. package/lib/core/handler/SetInstanceFieldHandler.js +1 -1
  71. package/lib/core/handler/SetStaticFieldHandler.js +6 -6
  72. package/lib/core/interpreter/Interpreter.js +18 -4
  73. package/lib/core/protocol/CommandDeserializer.js +9 -0
  74. package/lib/core/protocol/TypeDeserializer.js +5 -0
  75. package/lib/core/protocol/TypeSerializer.js +11 -8
  76. package/lib/core/webSocketClient/WebSocketClient.js +30 -5
  77. package/lib/core/webSocketClient/WebSocketClientBrowser.js +29 -5
  78. package/lib/plugins/PluginImplementationRegistry.js +231 -0
  79. package/lib/plugins/PluginPayloadBuilder.js +60 -0
  80. package/lib/plugins/PluginRegistry.js +295 -0
  81. package/lib/plugins/index.js +29 -0
  82. package/lib/plugins/interfaces/ICommunityPlugin.js +25 -0
  83. package/lib/plugins/interfaces/ICommunityReceivingPlugin.js +57 -0
  84. package/lib/plugins/interfaces/ICommunitySendingPlugin.js +42 -0
  85. package/lib/plugins/settings/BasePluginSettings.js +79 -0
  86. package/lib/plugins/settings/JwtGraftocodePluginSettings.js +43 -0
  87. package/lib/sdk/InvocationContext.js +149 -14
  88. package/lib/sdk/RuntimeContext.js +33 -9
  89. package/lib/sdk/configuration/configResolvers/ConfigResolver.js +14 -8
  90. package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +2 -2
  91. package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +2 -2
  92. package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +5 -5
  93. package/lib/sdk/tools/DtoHelper.js +90 -0
  94. package/lib/utils/Command.js +47 -0
  95. package/lib/utils/CommandType.js +3 -0
  96. package/lib/utils/Type.js +2 -1
  97. package/package.json +5 -1
  98. package/dist/sdk/tools/ActivationHelper.cjs +0 -66
  99. package/dist/types/sdk/tools/ActivationHelper.d.ts +0 -20
  100. package/lib/sdk/tools/ActivationHelper.js +0 -51
@@ -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
  }
@@ -50,4 +50,7 @@ export const CommandType = /** @type {const} */ ({
50
50
  GetGlobalField: 47,
51
51
  RegisterForUpdate: 48,
52
52
  ValueForUpdate: 49,
53
+ AsDto: 50,
54
+ DtoProperty: 51,
55
+ ProjectResultAsDto: 52,
53
56
  })
package/lib/utils/Type.js CHANGED
@@ -12,5 +12,6 @@ export const Type = /** @type {const} */ ({
12
12
  JAVONET_UNSIGNED_LONG_LONG: 9,
13
13
  JAVONET_UNSIGNED_INTEGER: 10,
14
14
  JAVONET_NULL: 11,
15
- JAVONET_VOID: 12,
15
+ JAVONET_UNDEFINED: 12,
16
+ JAVONET_VOID: 13,
16
17
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javonet-nodejs-sdk",
3
- "version": "2.6.13",
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 }