node-opcua-service-call 2.56.2 → 2.61.0

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/.mocharc.yml ADDED
@@ -0,0 +1,10 @@
1
+ require:
2
+ - ../../node_modules/source-map-support/register
3
+ - ../../node_modules/ts-node/register
4
+ - ../../node_modules/should
5
+ timeout: 60000
6
+ extension:
7
+ - ts
8
+ - js
9
+ bail: true
10
+ parallel: true
package/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014-2021 Etienne Rossignon
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-2021 Etienne Rossignon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,13 +1,13 @@
1
- const generator = require("node-opcua-generator");
2
- require("node-opcua-basic-types");
3
- require("node-opcua-variant");
4
-
5
- generator.registerObject("Argument");
6
- // Call service
7
- generator.registerObject("CallMethodRequest");
8
- generator.registerObject("CallMethodResult");
9
- generator.registerObject("CallRequest");
10
- generator.registerObject("CallResponse");
11
-
12
-
13
-
1
+ const generator = require("node-opcua-generator");
2
+ require("node-opcua-basic-types");
3
+ require("node-opcua-variant");
4
+
5
+ generator.registerObject("Argument");
6
+ // Call service
7
+ generator.registerObject("CallMethodRequest");
8
+ generator.registerObject("CallMethodResult");
9
+ generator.registerObject("CallRequest");
10
+ generator.registerObject("CallResponse");
11
+
12
+
13
+
package/dist/imports.js CHANGED
@@ -14,34 +14,29 @@ Object.defineProperty(exports, "CallMethodRequest", { enumerable: true, get: fun
14
14
  Object.defineProperty(exports, "CallRequest", { enumerable: true, get: function () { return node_opcua_types_2.CallRequest; } });
15
15
  Object.defineProperty(exports, "CallMethodResult", { enumerable: true, get: function () { return node_opcua_types_2.CallMethodResult; } });
16
16
  Object.defineProperty(exports, "CallResponse", { enumerable: true, get: function () { return node_opcua_types_2.CallResponse; } });
17
- ///
18
- function constructHookArgument(options) {
19
- options = options || { dataType: node_opcua_variant_1.DataType.Null };
20
- let dataType = options.dataType;
21
- if (dataType) {
22
- if (typeof dataType === "string") {
23
- dataType = (0, node_opcua_nodeid_1.resolveNodeId)(dataType);
24
- }
25
- else if (dataType instanceof node_opcua_nodeid_1.NodeId) {
26
- // nothing
27
- }
28
- else if (dataType.value) {
29
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(dataType, "namespace"));
30
- dataType = (0, node_opcua_nodeid_1.coerceNodeId)(dataType.value, dataType.namespace);
31
- }
32
- else {
33
- (0, node_opcua_assert_1.assert)(typeof dataType === "number");
34
- }
35
- options.dataType = dataType;
17
+ function _coerceToNodeId(n) {
18
+ const dataType = n;
19
+ if (!dataType) {
20
+ return new node_opcua_nodeid_1.NodeId();
36
21
  }
37
- if (options.valueRank === undefined) {
38
- options.valueRank = -1;
22
+ if (typeof dataType === "string") {
23
+ return (0, node_opcua_nodeid_1.resolveNodeId)(dataType);
39
24
  }
40
- // fix missing ArrayDimension (The value is an array with one dimension.)
41
- if (options.valueRank !== 1 || !options.arrayDimensions) {
42
- options.arrayDimensions = [0];
25
+ if (dataType instanceof node_opcua_nodeid_1.NodeId) {
26
+ return dataType;
43
27
  }
44
- return options;
28
+ if (Object.prototype.hasOwnProperty.call(dataType, "value")) {
29
+ const a = dataType;
30
+ return (0, node_opcua_nodeid_1.coerceNodeId)(a.value, a.namespace);
31
+ }
32
+ (0, node_opcua_assert_1.assert)(typeof dataType === "number");
33
+ return (0, node_opcua_nodeid_1.coerceNodeId)(dataType);
34
+ }
35
+ function constructHookArgument(_options) {
36
+ const options = _options || { valueRank: -1, dataType: node_opcua_variant_1.DataType.Null };
37
+ const dataType = _coerceToNodeId(options.dataType || node_opcua_variant_1.DataType.Null);
38
+ (0, node_opcua_variant_1.verifyRankAndDimensions)(options);
39
+ return Object.assign(Object.assign({}, options), { dataType });
45
40
  }
46
41
  node_opcua_types_1.Argument.schema.const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S,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,6BAAQ,CAAC,IAAI,EAAE,CAAC;IAEvE,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,IAAI,6BAAQ,CAAC,IAAI,CAAC,CAAC;IACpE,IAAA,4CAAuB,EAAC,OAAO,CAAC,CAAC;IACjC,uCAAY,OAAO,KAAE,QAAQ,IAAG;AACpC,CAAC;AAED,2BAAQ,CAAC,MAAM,CAAC,aAAa,GAAG,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-service-call",
3
- "version": "2.56.2",
3
+ "version": "2.61.0",
4
4
  "description": "pure nodejs OPCUA SDK - module -service-call",
5
5
  "scripts": {
6
6
  "test": "mocha",
@@ -13,16 +13,16 @@
13
13
  "types": "./dist/index.d.ts",
14
14
  "dependencies": {
15
15
  "node-opcua-assert": "2.55.0",
16
- "node-opcua-basic-types": "2.56.0",
16
+ "node-opcua-basic-types": "2.61.0",
17
17
  "node-opcua-binary-stream": "2.55.0",
18
- "node-opcua-factory": "2.56.0",
19
- "node-opcua-nodeid": "2.55.0",
20
- "node-opcua-service-secure-channel": "2.56.2",
21
- "node-opcua-types": "2.56.2",
22
- "node-opcua-variant": "2.56.0"
18
+ "node-opcua-factory": "2.61.0",
19
+ "node-opcua-nodeid": "2.61.0",
20
+ "node-opcua-service-secure-channel": "2.61.0",
21
+ "node-opcua-types": "2.61.0",
22
+ "node-opcua-variant": "2.61.0"
23
23
  },
24
24
  "devDependencies": {
25
- "node-opcua-packet-analyzer": "2.56.0",
25
+ "node-opcua-packet-analyzer": "2.61.0",
26
26
  "node-opcua-status-code": "2.56.0",
27
27
  "should": "^13.2.3"
28
28
  },
@@ -41,5 +41,5 @@
41
41
  "internet of things"
42
42
  ],
43
43
  "homepage": "http://node-opcua.github.io/",
44
- "gitHead": "45dbf2f65d96a91fae6e884bb5006af4249cf1fa"
44
+ "gitHead": "dd8776f047686ca791989f27e11ee48bfd8b61b7"
45
45
  }
package/source/imports.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * @module node-opcua-service-browse
3
3
  */
4
4
  import { assert } from "node-opcua-assert";
5
- import { coerceNodeId, NodeId, resolveNodeId } from "node-opcua-nodeid";
5
+ import { coerceNodeId, NodeId, NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
6
6
  import { Argument } from "node-opcua-types";
7
- import { DataType } from "node-opcua-variant";
7
+ import { DataType, verifyRankAndDimensions } from "node-opcua-variant";
8
8
 
9
9
  export {
10
10
  Argument,
@@ -19,32 +19,41 @@ export {
19
19
  } from "node-opcua-types";
20
20
 
21
21
  ///
22
- function constructHookArgument(options?: { dataType: any; valueRank?: number; arrayDimensions?: any }): any {
23
- options = options || { dataType: DataType.Null };
22
+ interface constructHookArgumentOptions {
23
+ dataType: DataType | NodeIdLike | string;
24
+ valueRank?: number;
25
+ arrayDimensions?: number[];
26
+ }
27
+ interface constructHookArgumentOptions2 {
28
+ dataType: NodeId;
29
+ valueRank?: number;
30
+ arrayDimensions?: number[];
31
+ }
32
+ function _coerceToNodeId(n: NodeId | string | DataType): NodeId {
33
+ const dataType: NodeId | string | DataType = n;
24
34
 
25
- let dataType = options.dataType;
26
- if (dataType) {
27
- if (typeof dataType === "string") {
28
- dataType = resolveNodeId(dataType);
29
- } else if (dataType instanceof NodeId) {
30
- // nothing
31
- } else if (dataType.value) {
32
- assert(Object.prototype.hasOwnProperty.call(dataType, "namespace"));
33
- dataType = coerceNodeId(dataType.value, dataType.namespace);
34
- } else {
35
- assert(typeof dataType === "number");
36
- }
37
- options.dataType = dataType;
35
+ if (!dataType) {
36
+ return new NodeId();
38
37
  }
39
- if (options.valueRank === undefined) {
40
- options.valueRank = -1;
38
+ if (typeof dataType === "string") {
39
+ return resolveNodeId(dataType);
41
40
  }
42
- // fix missing ArrayDimension (The value is an array with one dimension.)
43
- if (options.valueRank !== 1 || !options.arrayDimensions) {
44
- options.arrayDimensions = [0];
41
+ if (dataType instanceof NodeId) {
42
+ return dataType;
45
43
  }
44
+ if (Object.prototype.hasOwnProperty.call(dataType, "value")) {
45
+ const a = dataType as unknown as { value: unknown; namespace?: number };
46
+ return coerceNodeId(a.value, a.namespace);
47
+ }
48
+ assert(typeof dataType === "number");
49
+ return coerceNodeId(dataType);
50
+ }
51
+ function constructHookArgument(_options?: constructHookArgumentOptions): constructHookArgumentOptions2 {
52
+ const options = _options || { valueRank: -1, dataType: DataType.Null };
46
53
 
47
- return options;
54
+ const dataType = _coerceToNodeId(options.dataType || DataType.Null);
55
+ verifyRankAndDimensions(options);
56
+ return { ...options, dataType };
48
57
  }
49
58
 
50
59
  Argument.schema.constructHook = constructHookArgument;
package/source/index.ts CHANGED
@@ -1,36 +1,36 @@
1
- /**
2
- * @module node-opcua-service-browse
3
- */
4
- /**
5
- *
6
- * This Service is used to call (invoke) a list of Methods. Each method call is invoked within the context
7
- * of an existing Session. If the Session is terminated, the results of the method’s execution cannot be
8
- * returned to the Client and are discarded. This is independent of the task actually performed at the
9
- * Server.
10
- * This Service provides for passing input and output arguments to/from a method. These arguments
11
- * are defined by Properties of the method.
12
- *
13
- */
14
- /*
15
- *
16
- *
17
- * extract from OPCUA Specification Part 4 Release 1.02 page 61:
18
- *
19
- * 5.11 **Method Service Set**
20
- *
21
- * 5.11.1 Overview
22
- * Methods represent the function calls of Objects. They are defined in Part 3. Methods are invoked
23
- * and return only after completion (successful or unsuccessful). Execution times for methods may
24
- * vary, depending on the function that they perform.
25
- * The Method Service Set defines the means to invoke methods. A method shall be a component of an
26
- * Object. Discovery is provided through the Browse and Query Services. Clients discover the methods
27
- * supported by a Server by browsing for the owning Objects References that identify their supported
28
- * methods.
29
- * Because Methods may control some aspect of plant operations, method invocation may depend on
30
- * environmental or other conditions. This may be especially true when attempting to re -invoke a
31
- * method immediately after it has completed execution. Conditions that are required to invoke the
32
- * method might not yet have returned to the state that permits the method to start again.
33
- *
34
- *
35
- */
36
- export * from "./imports";
1
+ /**
2
+ * @module node-opcua-service-browse
3
+ */
4
+ /**
5
+ *
6
+ * This Service is used to call (invoke) a list of Methods. Each method call is invoked within the context
7
+ * of an existing Session. If the Session is terminated, the results of the method’s execution cannot be
8
+ * returned to the Client and are discarded. This is independent of the task actually performed at the
9
+ * Server.
10
+ * This Service provides for passing input and output arguments to/from a method. These arguments
11
+ * are defined by Properties of the method.
12
+ *
13
+ */
14
+ /*
15
+ *
16
+ *
17
+ * extract from OPCUA Specification Part 4 Release 1.02 page 61:
18
+ *
19
+ * 5.11 **Method Service Set**
20
+ *
21
+ * 5.11.1 Overview
22
+ * Methods represent the function calls of Objects. They are defined in Part 3. Methods are invoked
23
+ * and return only after completion (successful or unsuccessful). Execution times for methods may
24
+ * vary, depending on the function that they perform.
25
+ * The Method Service Set defines the means to invoke methods. A method shall be a component of an
26
+ * Object. Discovery is provided through the Browse and Query Services. Clients discover the methods
27
+ * supported by a Server by browsing for the owning Objects References that identify their supported
28
+ * methods.
29
+ * Because Methods may control some aspect of plant operations, method invocation may depend on
30
+ * environmental or other conditions. This may be especially true when attempting to re -invoke a
31
+ * method immediately after it has completed execution. Conditions that are required to invoke the
32
+ * method might not yet have returned to the state that permits the method to start again.
33
+ *
34
+ *
35
+ */
36
+ export * from "./imports";