node-opcua-address-space 2.98.2 → 2.99.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.98.2",
3
+ "version": "2.99.0",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space",
5
5
  "main": "./dist/src/index_current.js",
6
6
  "types": "./dist/source/index.d.ts",
@@ -22,36 +22,36 @@
22
22
  "chalk": "4.1.2",
23
23
  "dequeue": "^1.0.5",
24
24
  "lodash": "4.17.21",
25
- "node-opcua-address-space-base": "2.98.2",
25
+ "node-opcua-address-space-base": "2.99.0",
26
26
  "node-opcua-assert": "2.98.1",
27
- "node-opcua-basic-types": "2.98.1",
27
+ "node-opcua-basic-types": "2.99.0",
28
28
  "node-opcua-binary-stream": "2.98.1",
29
- "node-opcua-client-dynamic-extension-object": "2.98.2",
29
+ "node-opcua-client-dynamic-extension-object": "2.99.0",
30
30
  "node-opcua-constants": "2.98.1",
31
31
  "node-opcua-crypto": "^2.1.2",
32
- "node-opcua-data-access": "2.98.2",
33
- "node-opcua-data-model": "2.98.1",
34
- "node-opcua-data-value": "2.98.1",
35
- "node-opcua-date-time": "2.98.1",
36
- "node-opcua-debug": "2.98.1",
32
+ "node-opcua-data-access": "2.99.0",
33
+ "node-opcua-data-model": "2.99.0",
34
+ "node-opcua-data-value": "2.99.0",
35
+ "node-opcua-date-time": "2.99.0",
36
+ "node-opcua-debug": "2.99.0",
37
37
  "node-opcua-enum": "2.98.1",
38
- "node-opcua-extension-object": "2.98.1",
39
- "node-opcua-factory": "2.98.1",
40
- "node-opcua-nodeid": "2.98.1",
41
- "node-opcua-nodeset-ua": "2.98.2",
42
- "node-opcua-numeric-range": "2.98.1",
43
- "node-opcua-object-registry": "2.98.1",
44
- "node-opcua-pseudo-session": "2.98.2",
45
- "node-opcua-service-browse": "2.98.2",
46
- "node-opcua-service-call": "2.98.2",
47
- "node-opcua-service-history": "2.98.2",
48
- "node-opcua-service-translate-browse-path": "2.98.2",
49
- "node-opcua-service-write": "2.98.2",
38
+ "node-opcua-extension-object": "2.99.0",
39
+ "node-opcua-factory": "2.99.0",
40
+ "node-opcua-nodeid": "2.99.0",
41
+ "node-opcua-nodeset-ua": "2.99.0",
42
+ "node-opcua-numeric-range": "2.99.0",
43
+ "node-opcua-object-registry": "2.99.0",
44
+ "node-opcua-pseudo-session": "2.99.0",
45
+ "node-opcua-service-browse": "2.99.0",
46
+ "node-opcua-service-call": "2.99.0",
47
+ "node-opcua-service-history": "2.99.0",
48
+ "node-opcua-service-translate-browse-path": "2.99.0",
49
+ "node-opcua-service-write": "2.99.0",
50
50
  "node-opcua-status-code": "2.98.1",
51
- "node-opcua-types": "2.98.2",
51
+ "node-opcua-types": "2.99.0",
52
52
  "node-opcua-utils": "2.98.1",
53
- "node-opcua-variant": "2.98.1",
54
- "node-opcua-xml2json": "2.98.2",
53
+ "node-opcua-variant": "2.99.0",
54
+ "node-opcua-xml2json": "2.99.0",
55
55
  "semver": "^7.3.8",
56
56
  "set-prototype-of": "^1.0.0",
57
57
  "thenify": "^3.3.1",
@@ -60,11 +60,11 @@
60
60
  "devDependencies": {
61
61
  "mocha": "^10.2.0",
62
62
  "node-opcua-benchmarker": "2.98.1",
63
- "node-opcua-leak-detector": "2.98.1",
64
- "node-opcua-nodesets": "2.98.2",
65
- "node-opcua-packet-analyzer": "2.98.1",
66
- "node-opcua-service-filter": "2.98.2",
67
- "node-opcua-test-fixtures": "2.98.2",
63
+ "node-opcua-leak-detector": "2.99.0",
64
+ "node-opcua-nodesets": "2.99.0",
65
+ "node-opcua-packet-analyzer": "2.99.0",
66
+ "node-opcua-service-filter": "2.99.0",
67
+ "node-opcua-test-fixtures": "2.99.0",
68
68
  "should": "^13.2.3",
69
69
  "sinon": "^15.0.3",
70
70
  "source-map-support": "^0.5.21"
@@ -84,7 +84,7 @@
84
84
  "internet of things"
85
85
  ],
86
86
  "homepage": "http://node-opcua.github.io/",
87
- "gitHead": "6df8aa25475ba1235e585566cb2dec68b7e7a85f",
87
+ "gitHead": "90ce9f5b44d74198d84a384de622dfa94fd05c0c",
88
88
  "files": [
89
89
  "dist",
90
90
  "distHelpers",
@@ -94,6 +94,7 @@
94
94
  "nodeJS.d.ts",
95
95
  "nodeJS.js",
96
96
  "testHelpers.js",
97
- "testHelpers.d.ts"
97
+ "testHelpers.d.ts",
98
+ "source_nodejs"
98
99
  ]
99
100
  }
@@ -261,9 +261,9 @@ function makeNodeSetParserEngine(addressSpace: IAddressSpace, options: NodeSetLo
261
261
  // istanbul ignore next
262
262
  if (!existingNamespace) {
263
263
  errorLog(
264
- "Please ensure that the required namespace ",
264
+ "Please ensure that the required namespace",
265
265
  requiredModel.modelUri,
266
- "is loaded firs when loading ",
266
+ "is loaded first when loading",
267
267
  model.modelUri
268
268
  );
269
269
  throw new Error("LoadNodeSet : Cannot find namespace for " + requiredModel.modelUri);
@@ -271,8 +271,7 @@ function makeNodeSetParserEngine(addressSpace: IAddressSpace, options: NodeSetLo
271
271
  /**
272
272
  * from https://reference.opcfoundation.org/Core/docs/Part6/F.2/
273
273
  * The version of the model defined in the UANodeSet.
274
- * This is a human readable string and not intended for programmatic comparisons.
275
- *
274
+ * This is a human-readable string and not intended for programmatic comparisons.
276
275
  */
277
276
  const isLowerVersion = (existingVersion: string, requiredVersion: string): boolean => {
278
277
  const existingSemver = makeSemverCompatible(existingVersion);
@@ -294,7 +293,7 @@ function makeNodeSetParserEngine(addressSpace: IAddressSpace, options: NodeSetLo
294
293
  errorLog(
295
294
  "Expecting ",
296
295
  requiredModel.modelUri,
297
- " with publicationDatea at least ",
296
+ " with publicationDate at least ",
298
297
  requiredModel.publicationDate.toUTCString(),
299
298
  " but namespace publicationDate is ",
300
299
  existingNamespace.publicationDate.toUTCString()
@@ -0,0 +1,60 @@
1
+ import * as fs from "fs";
2
+ import { callbackify } from "util";
3
+
4
+ import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
5
+ import { IAddressSpace } from "node-opcua-address-space-base";
6
+
7
+ import { generateAddressSpaceRaw } from "..";
8
+ import { NodeSetLoaderOptions } from "../source/interfaces/nodeset_loader_options";
9
+
10
+ const doDebug = checkDebugFlag(__filename);
11
+ const debugLog = make_debugLog(__filename);
12
+ const errorLog = make_errorLog(__filename);
13
+
14
+ export async function readNodeSet2XmlFile(xmlFile: string): Promise<string> {
15
+ // istanbul ignore next
16
+ if (!fs.existsSync(xmlFile)) {
17
+ const msg = "[NODE-OPCUA-E02] generateAddressSpace : cannot find nodeset2 xml file at " + xmlFile;
18
+ errorLog(msg);
19
+ throw new Error(msg);
20
+ }
21
+ debugLog(" parsing ", xmlFile);
22
+ const xmlData = await fs.promises.readFile(xmlFile, "utf-8");
23
+ return xmlData;
24
+ }
25
+ export function generateAddressSpace(
26
+ addressSpace: IAddressSpace,
27
+ xmlFiles: string | string[],
28
+ callback: (err?: Error) => void
29
+ ): void;
30
+ export function generateAddressSpace(
31
+ addressSpace: IAddressSpace,
32
+ xmlFiles: string | string[],
33
+ options: NodeSetLoaderOptions | undefined,
34
+ callback: (err?: Error) => void
35
+ ): void;
36
+ export function generateAddressSpace(
37
+ addressSpace: IAddressSpace,
38
+ xmlFiles: string | string[],
39
+ options?: NodeSetLoaderOptions
40
+ ): Promise<void>;
41
+ export function generateAddressSpace(
42
+ ... args: any[]
43
+ ): any {
44
+ const addressSpace = args[0] as IAddressSpace;
45
+ const xmlFiles = args[1] as string | string[];
46
+ if (args.length === 4) {
47
+ const options = args[2] as NodeSetLoaderOptions | undefined;
48
+ const callback = args[3] as (err?: Error) => void;
49
+ callbackify(generateAddressSpaceRaw)(addressSpace, xmlFiles, readNodeSet2XmlFile, options ||{}, callback!);
50
+ } else {
51
+ const options = {};
52
+ const callback = args[2] as (err?: Error) => void;
53
+ callbackify(generateAddressSpaceRaw)(addressSpace, xmlFiles, readNodeSet2XmlFile, options, callback!);
54
+ }
55
+ }
56
+
57
+ // tslint:disable:no-var-requires
58
+ // tslint:disable:max-line-length
59
+ const thenify = require("thenify");
60
+ (module.exports as any).generateAddressSpace = thenify.withCallback((module.exports as any).generateAddressSpace);
@@ -0,0 +1 @@
1
+ export * from "./generate_address_space";