node-opcua-service-call 2.59.0 → 2.62.4

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/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.constructHook = constructHookArgument;
47
42
  //# sourceMappingURL=imports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imports.js","sourceRoot":"","sources":["../source/imports.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,yDAAwE;AACxE,uDAA4C;AAC5C,2DAA8C;AAE9C,qDAU0B;AATtB,4GAAA,QAAQ,OAAA;AAER,qHAAA,iBAAiB,OAAA;AAEjB,+GAAA,WAAW,OAAA;AAEX,oHAAA,gBAAgB,OAAA;AAEhB,gHAAA,YAAY,OAAA;AAGhB,GAAG;AACH,SAAS,qBAAqB,CAAC,OAAsE;IACjG,OAAO,GAAG,OAAO,IAAI,EAAE,QAAQ,EAAE,6BAAQ,CAAC,IAAI,EAAE,CAAC;IAEjD,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAChC,IAAI,QAAQ,EAAE;QACV,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAC9B,QAAQ,GAAG,IAAA,iCAAa,EAAC,QAAQ,CAAC,CAAC;SACtC;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Q,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAA,iCAAa,EAAC,QAAQ,CAAC,CAAC;KAClC;IACD,IAAI,QAAQ,YAAY,0BAAM,EAAE;QAC5B,OAAO,QAAQ,CAAC;KACnB;IACD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;QACzD,MAAM,CAAC,GAAG,QAA6D,CAAC;QACxE,OAAO,IAAA,gCAAY,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;KAC7C;IACD,IAAA,0BAAM,EAAC,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACrC,OAAO,IAAA,gCAAY,EAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AACD,SAAS,qBAAqB,CAAC,QAAuC;IAClE,MAAM,OAAO,GAAG,QAAQ,IAAI,EAAE,SAAS,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.59.0",
3
+ "version": "2.62.4",
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.57.0",
16
+ "node-opcua-basic-types": "2.62.4",
17
17
  "node-opcua-binary-stream": "2.55.0",
18
- "node-opcua-factory": "2.57.0",
19
- "node-opcua-nodeid": "2.55.0",
20
- "node-opcua-service-secure-channel": "2.59.0",
21
- "node-opcua-types": "2.59.0",
22
- "node-opcua-variant": "2.59.0"
18
+ "node-opcua-factory": "2.62.4",
19
+ "node-opcua-nodeid": "2.62.4",
20
+ "node-opcua-service-secure-channel": "2.62.4",
21
+ "node-opcua-types": "2.62.4",
22
+ "node-opcua-variant": "2.62.4"
23
23
  },
24
24
  "devDependencies": {
25
- "node-opcua-packet-analyzer": "2.57.0",
25
+ "node-opcua-packet-analyzer": "2.62.4",
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": "ea10265745d3d4b8af249a4e13288ad71232706f"
44
+ "gitHead": "b4cb2b2e4ce2b141614dbcb02a3e385c747ac1a1"
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;