bonjour-hap 3.8.0-beta.0 → 3.9.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.
Files changed (2) hide show
  1. package/index.d.ts +66 -0
  2. package/package.json +7 -5
package/index.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ import { SocketOptions } from "dgram";
2
+
3
+ export type BonjourFindOptions = {
4
+ type: string;
5
+ subtypes?: string[];
6
+ protocol?: "tcp" | "udp";
7
+ txt?: Record<string, any>;
8
+ };
9
+
10
+ export interface BonjourService {
11
+ name: string;
12
+ type: string;
13
+ protocol: "tcp" | "udp";
14
+ host: string;
15
+ port: number;
16
+ addresses: string[];
17
+ txt: Record<string, string>;
18
+ rawTxt?: Buffer;
19
+ }
20
+
21
+ export interface MulticastOptions extends SocketOptions {
22
+ multicastAddress?: string;
23
+ multicastInterface?: string;
24
+ multicastTTL?: number;
25
+ reuseAddr?: boolean;
26
+ }
27
+
28
+ export class Browser {
29
+ start(): void;
30
+ stop(): void;
31
+ update(): void;
32
+ on(event: "up" | "down", listener: (service: BonjourService) => void): this;
33
+ }
34
+
35
+ export class Advertisement {
36
+ stop(): void;
37
+ start(): void;
38
+ update(txt: Record<string, string>): void;
39
+ on(event: "error", listener: (err: Error) => void): this;
40
+ }
41
+
42
+ export interface PublishOptions {
43
+ name: string;
44
+ type: string;
45
+ subtypes?: string[];
46
+ port: number;
47
+ host?: string;
48
+ txt?: Record<string, string>;
49
+ protocol?: "tcp" | "udp";
50
+ }
51
+
52
+ export default class Bonjour {
53
+ constructor(options?: MulticastOptions);
54
+
55
+ publish(options: PublishOptions): Advertisement;
56
+ unpublishAll(callback?: () => void): void;
57
+ find(
58
+ options: BonjourFindOptions,
59
+ onUp?: (service: BonjourService) => void
60
+ ): Browser;
61
+ findOne(
62
+ options: BonjourFindOptions,
63
+ callback: (service: BonjourService) => void
64
+ ): Browser;
65
+ destroy(): void;
66
+ }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "bonjour-hap",
3
- "version": "3.8.0-beta.0",
3
+ "version": "3.9.0",
4
4
  "description": "A Bonjour/Zeroconf implementation in pure JavaScript (for HAP)",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
7
8
  "license": "MIT",
8
9
  "scripts": {
@@ -37,6 +38,7 @@
37
38
  "LICENSE",
38
39
  "package.json",
39
40
  "index.js",
41
+ "index.d.ts",
40
42
  "README.md"
41
43
  ],
42
44
  "dependencies": {
@@ -47,9 +49,9 @@
47
49
  },
48
50
  "devDependencies": {
49
51
  "after-all": "^2.0.2",
50
- "standard": "^17.1.0",
51
- "tape": "^5.8.1",
52
- "nyc": "^17.0.0",
53
- "rimraf": "^5.0.7"
52
+ "standard": "^17.1.2",
53
+ "tape": "^5.9.0",
54
+ "nyc": "^17.1.0",
55
+ "rimraf": "^6.0.1"
54
56
  }
55
57
  }