node-opcua-service-discovery 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/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.
package/dist/bonjour.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * @module node-opcua-service-discovery
3
- */
4
1
  import * as bonjour from "bonjour";
5
2
  export declare function acquireBonjour(): bonjour.Bonjour;
6
3
  export declare function releaseBonjour(): void;
package/dist/bonjour.js CHANGED
@@ -14,12 +14,11 @@ exports.BonjourHolder = exports._announceServerOnMulticastSubnet = exports.sameA
14
14
  * @module node-opcua-service-discovery
15
15
  */
16
16
  // tslint:disable:no-console
17
- const bonjour = require("bonjour");
18
17
  const util_1 = require("util");
19
- const util_2 = require("util");
20
18
  const node_opcua_assert_1 = require("node-opcua-assert");
21
19
  const node_opcua_debug_1 = require("node-opcua-debug");
22
20
  const node_opcua_object_registry_1 = require("node-opcua-object-registry");
21
+ const bonjour = require("bonjour");
23
22
  const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
24
23
  const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
25
24
  let gBonjour;
@@ -39,10 +38,14 @@ function releaseBonjour() {
39
38
  gBonjourRefCount--;
40
39
  (0, node_opcua_assert_1.assert)(gBonjourRefCount >= 0);
41
40
  if (gBonjourRefCount === 0) {
42
- // will start the Bonjour service
43
- registry.unregister(gBonjour);
44
- gBonjour.destroy();
41
+ if (!gBonjour) {
42
+ throw new Error("internal error");
43
+ }
44
+ const tmp = gBonjour;
45
45
  gBonjour = undefined;
46
+ // will stop the Bonjour service
47
+ tmp.destroy();
48
+ registry.unregister(tmp);
46
49
  }
47
50
  }
48
51
  exports.releaseBonjour = releaseBonjour;
@@ -121,16 +124,16 @@ class BonjourHolder {
121
124
  const this_service = this._service;
122
125
  this._service = undefined;
123
126
  this._multicastDNS = undefined;
127
+ releaseBonjour();
124
128
  this.announcement = undefined;
125
129
  const proxy = (callback) => {
126
130
  this_service.stop(() => {
127
131
  callback();
128
132
  });
129
133
  };
130
- const stop = (0, util_2.promisify)(proxy);
134
+ const stop = (0, util_1.promisify)(proxy);
131
135
  yield stop.call(this);
132
- releaseBonjour();
133
- yield new Promise(resolve => setTimeout(resolve, 20));
136
+ //xx await new Promise((resolve) => setTimeout(resolve, 20));
134
137
  debugLog("stop announcement completed");
135
138
  }
136
139
  });
@@ -1 +1 @@
1
- {"version":3,"file":"bonjour.js","sourceRoot":"","sources":["../source/bonjour.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,4BAA4B;AAC5B,mCAAmC;AACnC,+BAAmC;AACnC,+BAAiC;AAEjC,yDAA2C;AAC3C,uDAAiE;AACjE,2EAA4D;AAE5D,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAE3C,IAAI,QAAqC,CAAC;AAC1C,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,QAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC;AAEtC,SAAgB,cAAc;IAC1B,IAAI,gBAAgB,KAAK,CAAC,EAAE;QACxB,iCAAiC;QACjC,QAAQ,GAAG,OAAO,EAAE,CAAC;QACrB,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC/B;IACD,gBAAgB,EAAE,CAAC;IACnB,OAAO,QAAS,CAAC;AACrB,CAAC;AARD,wCAQC;AAED,SAAgB,cAAc;IAC1B,gBAAgB,EAAE,CAAC;IACnB,IAAA,0BAAM,EAAC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AQ,EAAE;gBACf,iEAAiE;gBACjE,gCAAgC;gBAChC,MAAM,YAAY,GAAG,IAAI,CAAC,QAA+B,CAAC;gBAC1D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC1B,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;gBAC/B,cAAc,EAAE,CAAC;gBAEjB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;gBAC9B,MAAM,KAAK,GAAG,CAAC,QAA+B,EAAE,EAAE;oBAC9C,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE;wBACnB,QAAQ,EAAE,CAAC;oBACf,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC;gBACF,MAAM,IAAI,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,6DAA6D;gBAC7D,QAAQ,CAAC,6BAA6B,CAAC,CAAC;aAC3C;QACL,CAAC;KAAA;IAEM,4CAA4C,CAAC,QAAqC;QACrF,QAAQ,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ;AA5DD,sCA4DC;AAED,aAAa,CAAC,SAAS,CAAC,uCAAuC,GAAG,IAAA,kBAAW,EAAC,aAAa,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;AACnI,aAAa,CAAC,SAAS,CAAC,4CAA4C,GAAG,IAAA,kBAAW,EAC9E,aAAa,CAAC,SAAS,CAAC,gCAAgC,CAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-service-discovery",
3
- "version": "2.56.2",
3
+ "version": "2.61.0",
4
4
  "description": "pure nodejs OPCUA SDK - module -service-discovery",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
@@ -14,16 +14,16 @@
14
14
  "@types/bonjour": "^3.5.9",
15
15
  "bonjour": "^3.5.0",
16
16
  "node-opcua-assert": "2.55.0",
17
- "node-opcua-basic-types": "2.56.0",
17
+ "node-opcua-basic-types": "2.61.0",
18
18
  "node-opcua-binary-stream": "2.55.0",
19
- "node-opcua-data-model": "2.56.0",
20
- "node-opcua-debug": "2.55.0",
21
- "node-opcua-factory": "2.56.0",
22
- "node-opcua-nodeid": "2.55.0",
23
- "node-opcua-object-registry": "2.56.0",
24
- "node-opcua-service-endpoints": "2.56.2",
25
- "node-opcua-service-secure-channel": "2.56.2",
26
- "node-opcua-types": "2.56.2"
19
+ "node-opcua-data-model": "2.61.0",
20
+ "node-opcua-debug": "2.61.0",
21
+ "node-opcua-factory": "2.61.0",
22
+ "node-opcua-nodeid": "2.61.0",
23
+ "node-opcua-object-registry": "2.61.0",
24
+ "node-opcua-service-endpoints": "2.61.0",
25
+ "node-opcua-service-secure-channel": "2.61.0",
26
+ "node-opcua-types": "2.61.0"
27
27
  },
28
28
  "author": "Etienne Rossignon",
29
29
  "license": "MIT",
@@ -40,5 +40,5 @@
40
40
  "internet of things"
41
41
  ],
42
42
  "homepage": "http://node-opcua.github.io/",
43
- "gitHead": "45dbf2f65d96a91fae6e884bb5006af4249cf1fa"
43
+ "gitHead": "dd8776f047686ca791989f27e11ee48bfd8b61b7"
44
44
  }
package/source/bonjour.ts CHANGED
@@ -2,13 +2,12 @@
2
2
  * @module node-opcua-service-discovery
3
3
  */
4
4
  // tslint:disable:no-console
5
- import * as bonjour from "bonjour";
6
- import { callbackify } from "util";
7
- import { promisify } from "util";
5
+ import { callbackify, promisify } from "util";
8
6
 
9
7
  import { assert } from "node-opcua-assert";
10
8
  import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
11
9
  import { ObjectRegistry } from "node-opcua-object-registry";
10
+ import * as bonjour from "bonjour";
12
11
 
13
12
  const debugLog = make_debugLog(__filename);
14
13
  const doDebug = checkDebugFlag(__filename);
@@ -32,10 +31,14 @@ export function releaseBonjour() {
32
31
  gBonjourRefCount--;
33
32
  assert(gBonjourRefCount >= 0);
34
33
  if (gBonjourRefCount === 0) {
35
- // will start the Bonjour service
36
- registry.unregister(gBonjour);
37
- gBonjour!.destroy();
34
+ if (!gBonjour) {
35
+ throw new Error("internal error");
36
+ }
37
+ const tmp = gBonjour;
38
38
  gBonjour = undefined;
39
+ // will stop the Bonjour service
40
+ tmp!.destroy();
41
+ registry.unregister(tmp);
39
42
  }
40
43
  }
41
44
 
@@ -133,7 +136,7 @@ export class BonjourHolder {
133
136
  public isStarted(): boolean {
134
137
  return !!this._multicastDNS;
135
138
  }
136
-
139
+
137
140
  public _announcedOnMulticastSubnetWithCallback(options: Announcement, callback: (err: Error | null, result?: boolean) => void) {
138
141
  callback(new Error("Internal Error"));
139
142
  }
@@ -144,9 +147,11 @@ export class BonjourHolder {
144
147
  if (this._service) {
145
148
  // due to a wrong declaration of Service.stop in the d.ts file we
146
149
  // need to use a workaround here
147
- const this_service = (this._service as any) as ServiceFixed;
150
+ const this_service = this._service as any as ServiceFixed;
148
151
  this._service = undefined;
149
152
  this._multicastDNS = undefined;
153
+ releaseBonjour();
154
+
150
155
  this.announcement = undefined;
151
156
  const proxy = (callback: (err?: Error) => void) => {
152
157
  this_service.stop(() => {
@@ -155,8 +160,7 @@ export class BonjourHolder {
155
160
  };
156
161
  const stop = promisify(proxy);
157
162
  await stop.call(this);
158
- releaseBonjour();
159
- await new Promise(resolve => setTimeout(resolve, 20));
163
+ //xx await new Promise((resolve) => setTimeout(resolve, 20));
160
164
  debugLog("stop announcement completed");
161
165
  }
162
166
  }
package/source/index.ts CHANGED
@@ -1,35 +1,35 @@
1
- /**
2
- * @module node-opcua-service-discovery
3
- */
4
-
5
- export {
6
- RegisteredServer,
7
- RegisterServerRequest,
8
- RegisterServerResponse,
9
- MdnsDiscoveryConfiguration,
10
- RegisterServer2Request,
11
- RegisterServer2Response,
12
-
13
- RegisterServerRequestOptions,
14
- RegisterServer2RequestOptions,
15
-
16
- FindServersRequest,
17
- FindServersRequestOptions,
18
- FindServersResponse,
19
-
20
- FindServersOnNetworkRequest,
21
- FindServersOnNetworkRequestOptions,
22
- FindServersOnNetworkResponse,
23
-
24
- ServerOnNetwork
25
- } from "node-opcua-types";
26
-
27
- export { serverCapabilities } from "./server_capabilities";
28
- export {
29
- acquireBonjour,
30
- Announcement,
31
- releaseBonjour,
32
- BonjourHolder,
33
- sameAnnouncement,
34
- _announceServerOnMulticastSubnet
35
- }from "./bonjour";
1
+ /**
2
+ * @module node-opcua-service-discovery
3
+ */
4
+
5
+ export {
6
+ RegisteredServer,
7
+ RegisterServerRequest,
8
+ RegisterServerResponse,
9
+ MdnsDiscoveryConfiguration,
10
+ RegisterServer2Request,
11
+ RegisterServer2Response,
12
+
13
+ RegisterServerRequestOptions,
14
+ RegisterServer2RequestOptions,
15
+
16
+ FindServersRequest,
17
+ FindServersRequestOptions,
18
+ FindServersResponse,
19
+
20
+ FindServersOnNetworkRequest,
21
+ FindServersOnNetworkRequestOptions,
22
+ FindServersOnNetworkResponse,
23
+
24
+ ServerOnNetwork
25
+ } from "node-opcua-types";
26
+
27
+ export { serverCapabilities } from "./server_capabilities";
28
+ export {
29
+ acquireBonjour,
30
+ Announcement,
31
+ releaseBonjour,
32
+ BonjourHolder,
33
+ sameAnnouncement,
34
+ _announceServerOnMulticastSubnet
35
+ }from "./bonjour";
@@ -1,27 +1,27 @@
1
- /**
2
- * @module node-opcua-service-discovery
3
- */
4
-
5
- // see most up to date version at http://www.opcfoundation.org/UA/schemas/1.04/ServerCapabilities.csv
6
- export const serverCapabilities = [
7
-
8
- "NA", // No capability information is available. Cannot be used in combination with any other capability.
9
- "DA", // Provides current data.
10
- "HD", // Provides historical data.
11
- "AC", // Provides alarms and conditions that may require operator interaction.
12
- "HE", // Provides historical alarms and events.
13
- "GDS", // Supports the Global Discovery Server information model.
14
- "LDS", // Only supports the Discovery Services. Cannot be used in combination with any other capability.
15
- "DI", // Supports the Device Integration (DI) information model (see DI).
16
- "ADI", // Supports the Analyser Device Integration (ADI) information model (see ADI).
17
- "FDI", // Supports the Field Device Integration (FDI) information model (see FDI).
18
- "FDIC", // Supports the Field Device Integration (FDI) Communication Server information model (see FDI).
19
- "PLC", // Supports the PLCopen information model (see PLCopen).
20
- "S95", // Supports the ISA95 information model (see ISA-95).
21
-
22
- // new in 1.04
23
- "RCP", // Supports the reverse connect capabilities defined in Part 6.
24
- "PUB", // Supports the Publisher capabilities defined in Part 14.
25
- "SUB", // Supports the Publisher capabilities defined in Part 14.
26
-
27
- ];
1
+ /**
2
+ * @module node-opcua-service-discovery
3
+ */
4
+
5
+ // see most up to date version at http://www.opcfoundation.org/UA/schemas/1.04/ServerCapabilities.csv
6
+ export const serverCapabilities = [
7
+
8
+ "NA", // No capability information is available. Cannot be used in combination with any other capability.
9
+ "DA", // Provides current data.
10
+ "HD", // Provides historical data.
11
+ "AC", // Provides alarms and conditions that may require operator interaction.
12
+ "HE", // Provides historical alarms and events.
13
+ "GDS", // Supports the Global Discovery Server information model.
14
+ "LDS", // Only supports the Discovery Services. Cannot be used in combination with any other capability.
15
+ "DI", // Supports the Device Integration (DI) information model (see DI).
16
+ "ADI", // Supports the Analyser Device Integration (ADI) information model (see ADI).
17
+ "FDI", // Supports the Field Device Integration (FDI) information model (see FDI).
18
+ "FDIC", // Supports the Field Device Integration (FDI) Communication Server information model (see FDI).
19
+ "PLC", // Supports the PLCopen information model (see PLCopen).
20
+ "S95", // Supports the ISA95 information model (see ISA-95).
21
+
22
+ // new in 1.04
23
+ "RCP", // Supports the reverse connect capabilities defined in Part 6.
24
+ "PUB", // Supports the Publisher capabilities defined in Part 14.
25
+ "SUB", // Supports the Publisher capabilities defined in Part 14.
26
+
27
+ ];