javonet-nodejs-sdk 2.6.12 → 2.6.13

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.
@@ -26,14 +26,21 @@ var import_AbstractHandler = require("./AbstractHandler.cjs");
26
26
  class DestructReferenceHandler extends import_AbstractHandler.AbstractHandler {
27
27
  constructor() {
28
28
  super();
29
+ this.requiredParametersCount = 1;
29
30
  }
30
31
  /**
31
32
  * @param {Command} command
32
33
  */
33
34
  process(command) {
34
35
  try {
35
- let cache = import_ReferencesCache.ReferencesCache.getInstance();
36
- return cache.deleteReference(command.payload[0]);
36
+ if (command.payload.length < this.requiredParametersCount) {
37
+ return false;
38
+ }
39
+ const referenceId = command.payload[0];
40
+ if (referenceId == null || typeof referenceId !== "string") {
41
+ return false;
42
+ }
43
+ return import_ReferencesCache.ReferencesCache.getInstance().deleteReference(referenceId);
37
44
  } catch (error) {
38
45
  throw this.process_stack_trace(error, this.constructor.name);
39
46
  }
@@ -51,12 +51,15 @@ class ReferencesCache {
51
51
  return _cache[id];
52
52
  }
53
53
  /**
54
- * @param {string} id
55
- * @returns {number}
54
+ * @param {string} reference_guid
55
+ * @returns {boolean}
56
56
  */
57
- deleteReference(id) {
58
- delete _cache[id];
59
- return 0;
57
+ deleteReference(reference_guid) {
58
+ if (reference_guid == null || typeof reference_guid !== "string") {
59
+ return false;
60
+ }
61
+ delete _cache[reference_guid];
62
+ return true;
60
63
  }
61
64
  }
62
65
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,6 +22,7 @@ __export(Javonet_exports, {
22
22
  CommandSerializer: () => import_CommandSerializer.CommandSerializer,
23
23
  ComplexTypeResolver: () => import_ComplexTypeResolver.ComplexTypeResolver,
24
24
  ConfigPriority: () => import_ConfigPriority.ConfigPriority,
25
+ InvocationContext: () => import_InvocationContext.InvocationContext,
25
26
  Javonet: () => Javonet,
26
27
  RuntimeContext: () => import_RuntimeContext.RuntimeContext,
27
28
  TcpConnectionData: () => import_TcpConnectionData.TcpConnectionData,
@@ -42,6 +43,7 @@ var import_UtilsConst = require("../utils/UtilsConst.cjs");
42
43
  var import_ConfigSourceResolver = require("./configuration/ConfigSourceResolver.cjs");
43
44
  var import_ConfigPriority = require("./configuration/ConfigPriority.cjs");
44
45
  var import_ComplexTypeResolver = require("./tools/ComplexTypeResolver.cjs");
46
+ var import_InvocationContext = require("./InvocationContext.cjs");
45
47
  class Javonet {
46
48
  /**
47
49
  * Initializes Javonet using an in-memory channel on the same machine.
@@ -139,6 +141,7 @@ class Javonet {
139
141
  CommandSerializer,
140
142
  ComplexTypeResolver,
141
143
  ConfigPriority,
144
+ InvocationContext,
142
145
  Javonet,
143
146
  RuntimeContext,
144
147
  TcpConnectionData,
@@ -3,9 +3,10 @@ export type Command = import("../../utils/Command.js").Command;
3
3
  * @typedef {import('../../utils/Command.js').Command} Command
4
4
  */
5
5
  export class DestructReferenceHandler extends AbstractHandler {
6
+ requiredParametersCount: number;
6
7
  /**
7
8
  * @param {Command} command
8
9
  */
9
- process(command: Command): number;
10
+ process(command: Command): boolean;
10
11
  }
11
12
  import { AbstractHandler } from './AbstractHandler.js';
@@ -17,8 +17,8 @@ export class ReferencesCache {
17
17
  */
18
18
  resolveReference(id: string): any;
19
19
  /**
20
- * @param {string} id
21
- * @returns {number}
20
+ * @param {string} reference_guid
21
+ * @returns {boolean}
22
22
  */
23
- deleteReference(id: string): number;
23
+ deleteReference(reference_guid: string): boolean;
24
24
  }
@@ -73,6 +73,7 @@ export class Javonet {
73
73
  static initializeRc(configName: string): RuntimeContext;
74
74
  }
75
75
  import { RuntimeContext } from './RuntimeContext.js';
76
+ import { InvocationContext } from './InvocationContext.js';
76
77
  import { TcpConnectionData } from '../utils/nodejs/connectionData/TcpConnectionData.js';
77
78
  import { WsConnectionData } from '../utils/connectionData/WsConnectionData.js';
78
79
  import { CommandSerializer } from '../core/protocol/CommandSerializer.js';
@@ -81,4 +82,4 @@ import { ConfigPriority } from './configuration/ConfigPriority.js';
81
82
  import { ComplexTypeResolver } from './tools/ComplexTypeResolver.js';
82
83
  import { RuntimeFactory } from './RuntimeFactory.js';
83
84
  import { ConfigRuntimeFactory } from './ConfigRuntimeFactory.js';
84
- export { RuntimeContext, TcpConnectionData, WsConnectionData, CommandSerializer, CommandDeserializer, ConfigPriority, ComplexTypeResolver };
85
+ export { RuntimeContext, InvocationContext, TcpConnectionData, WsConnectionData, CommandSerializer, CommandDeserializer, ConfigPriority, ComplexTypeResolver };
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { ReferencesCache } from '../referenceCache/ReferencesCache.js'
3
2
  import { AbstractHandler } from './AbstractHandler.js'
4
3
 
@@ -9,6 +8,7 @@ import { AbstractHandler } from './AbstractHandler.js'
9
8
  class DestructReferenceHandler extends AbstractHandler {
10
9
  constructor() {
11
10
  super()
11
+ this.requiredParametersCount = 1
12
12
  }
13
13
 
14
14
  /**
@@ -16,8 +16,16 @@ class DestructReferenceHandler extends AbstractHandler {
16
16
  */
17
17
  process(command) {
18
18
  try {
19
- let cache = ReferencesCache.getInstance()
20
- return cache.deleteReference(command.payload[0])
19
+ if (command.payload.length < this.requiredParametersCount) {
20
+ return false
21
+ }
22
+
23
+ const referenceId = command.payload[0]
24
+ if (referenceId == null || typeof referenceId !== 'string') {
25
+ return false
26
+ }
27
+
28
+ return ReferencesCache.getInstance().deleteReference(referenceId)
21
29
  } catch (error) {
22
30
  throw this.process_stack_trace(error, this.constructor.name)
23
31
  }
@@ -41,12 +41,16 @@ class ReferencesCache {
41
41
  }
42
42
 
43
43
  /**
44
- * @param {string} id
45
- * @returns {number}
44
+ * @param {string} reference_guid
45
+ * @returns {boolean}
46
46
  */
47
- deleteReference(id) {
48
- delete _cache[id]
49
- return 0
47
+ deleteReference(reference_guid) {
48
+ if (reference_guid == null || typeof reference_guid !== 'string') {
49
+ return false
50
+ }
51
+
52
+ delete _cache[reference_guid]
53
+ return true
50
54
  }
51
55
  }
52
56
 
@@ -13,6 +13,7 @@ import { UtilsConst } from '../utils/UtilsConst.js'
13
13
  import { ConfigSourceResolver } from './configuration/ConfigSourceResolver.js'
14
14
  import { ConfigPriority } from './configuration/ConfigPriority.js'
15
15
  import { ComplexTypeResolver } from './tools/ComplexTypeResolver.js'
16
+ import { InvocationContext } from './InvocationContext.js'
16
17
 
17
18
  /** @typedef {import('../types.d.ts').ConfigSource} ConfigSource */
18
19
 
@@ -129,6 +130,7 @@ class Javonet {
129
130
  export {
130
131
  Javonet,
131
132
  RuntimeContext,
133
+ InvocationContext,
132
134
  TcpConnectionData,
133
135
  WsConnectionData,
134
136
  CommandSerializer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javonet-nodejs-sdk",
3
- "version": "2.6.12",
3
+ "version": "2.6.13",
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.",