bonjour-hap 3.9.2-beta.1 → 3.9.2-beta.2
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/lib/Registry.js +2 -3
- package/lib/Server.js +1 -2
- package/lib/helpers.js +3 -4
- package/package.json +2 -3
package/lib/Registry.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const flatten = require('array-flatten').flatten
|
|
4
3
|
const Service = require('./Service.js')
|
|
5
4
|
const Prober = require('./Prober.js')
|
|
6
5
|
|
|
@@ -45,14 +44,14 @@ Registry.prototype = {
|
|
|
45
44
|
return service._activated // ignore services not currently starting or started
|
|
46
45
|
})
|
|
47
46
|
|
|
48
|
-
const records =
|
|
47
|
+
const records = services.map(function (service) {
|
|
49
48
|
service.deactivate()
|
|
50
49
|
const records = service._records(true)
|
|
51
50
|
records.forEach(function (record) {
|
|
52
51
|
record.ttl = 0 // prepare goodbye message
|
|
53
52
|
})
|
|
54
53
|
return records
|
|
55
|
-
})
|
|
54
|
+
}).flat()
|
|
56
55
|
|
|
57
56
|
if (records.length === 0) { return cb && cb() }
|
|
58
57
|
|
package/lib/Server.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const multicastdns = require('multicast-dns')
|
|
4
4
|
const dnsEqual = require('./utils/dnsEqual')
|
|
5
|
-
const flatten = require('array-flatten').flatten
|
|
6
5
|
const helpers = require('./helpers.js')
|
|
7
6
|
|
|
8
7
|
const Server = function (opts) {
|
|
@@ -22,7 +21,7 @@ Server.prototype = {
|
|
|
22
21
|
|
|
23
22
|
// generate the answers section
|
|
24
23
|
const answers = type === 'ANY'
|
|
25
|
-
?
|
|
24
|
+
? Object.keys(this.registry).map(this._recordsFor.bind(this, name)).flat()
|
|
26
25
|
: this._recordsFor(name, type)
|
|
27
26
|
|
|
28
27
|
if (answers.length === 0) return
|
package/lib/helpers.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const deepEqual = require('fast-deep-equal')
|
|
4
4
|
|
|
5
|
+
module.exports = {
|
|
5
6
|
isDuplicateRecord: function (a) {
|
|
6
7
|
return function (b) {
|
|
7
8
|
return a.type === b.type &&
|
|
@@ -9,7 +10,6 @@ module.exports = {
|
|
|
9
10
|
deepEqual(a.data, b.data)
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
|
-
|
|
13
13
|
unique: function () {
|
|
14
14
|
const set = []
|
|
15
15
|
return function (obj) {
|
|
@@ -18,5 +18,4 @@ module.exports = {
|
|
|
18
18
|
return true
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonjour-hap",
|
|
3
|
-
"version": "3.9.2-beta.
|
|
3
|
+
"version": "3.9.2-beta.2",
|
|
4
4
|
"description": "A Bonjour/Zeroconf implementation in pure JavaScript (for HAP)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"
|
|
47
|
-
"deep-equal": "^2.2.3",
|
|
46
|
+
"fast-deep-equal": "^3.1.3",
|
|
48
47
|
"multicast-dns": "^7.2.5",
|
|
49
48
|
"multicast-dns-service-types": "^1.1.0"
|
|
50
49
|
},
|