hb-nb-tools 2.0.0-0 → 2.0.0-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/cli/nb.js CHANGED
@@ -5,6 +5,11 @@
5
5
  // Command line interface to Nuki bridge HTTP API.
6
6
  // Copyright © 2018-2024 Erik Baauw. All rights reserved.
7
7
 
8
- import { NbTool } from '../index.js'
8
+ import { createRequire } from 'node:module'
9
9
 
10
- new NbTool(import.meta.dirname).main()
10
+ import { NbTool } from 'hb-nb-tools/NbTool'
11
+
12
+ const require = createRequire(import.meta.url)
13
+ const packageJson = require('../package.json')
14
+
15
+ new NbTool(packageJson).main()
package/index.js CHANGED
@@ -5,32 +5,5 @@
5
5
 
6
6
  /** Homebridge NB Tools.
7
7
  *
8
- * @module hbNbTools
8
+ * @module hb-nb-tools
9
9
  */
10
-
11
- /** Nuki bridge HTTP API client.
12
- * <br>See {@link NbClient}.
13
- * @name NbClient
14
- * @type {Class}
15
- * @memberof module:hbNbTools
16
- */
17
- export { NbClient } from './lib/NbClient.js'
18
-
19
- /** Parser and validator for command-line arguments.
20
- * <br>See {@link NbDiscovery}.
21
- * @name NbDiscovery
22
- * @type {Class}
23
- * @memberof module:hbNbTools
24
- */
25
- export { NbDiscovery } from './lib/NbDiscovery.js'
26
-
27
- /** Command-line tool.
28
- * <br>See {@link NbListener}.
29
- * @name NbListener
30
- * @type {Class}
31
- * @memberof module:hbNbTools
32
- */
33
- export { NbListener } from './lib/NbListener.js'
34
-
35
- // Command-line tools.
36
- export { NbTool } from './lib/NbTool.js'
package/jsdoc.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "plugins": [
3
+ "plugins/markdown"
4
+ ],
5
+ "rescurseDepth": 10,
6
+ "source": {
7
+ "include": [
8
+ "README.md",
9
+ "index.js",
10
+ "lib",
11
+ "cli",
12
+ "node_modules/hb-lib-tools/lib/HttpClient.js"
13
+ ]
14
+ },
15
+ "opts": {
16
+ "recurse": true
17
+ },
18
+ "templates": {
19
+ "monospaceLinks": true
20
+ }
21
+ }
package/lib/NbClient.js CHANGED
@@ -6,10 +6,26 @@
6
6
  import { createHash, randomInt } from 'node:crypto'
7
7
  import tweetnacl from 'tweetnacl'
8
8
 
9
- import { HttpClient, JsonFormatter, OptionParser, toHexString } from 'hb-lib-tools'
9
+ import { toHexString } from 'hb-lib-tools'
10
+ import { HttpClient } from 'hb-lib-tools/HttpClient'
11
+ import { JsonFormatter } from 'hb-lib-tools/JsonFormatter'
12
+ import { OptionParser } from 'hb-lib-tools/OptionParser'
10
13
 
11
14
  const { secretbox, randomBytes } = tweetnacl
12
15
 
16
+ /** Nuki bridge HTTP API client.
17
+ * <br>See {@link NbClient}.
18
+ * @name NbClient
19
+ * @type {Class}
20
+ * @memberof module:hb-nb-tools
21
+ */
22
+
23
+ /** Nuki bridge HTTP API client.
24
+ *
25
+ * See the [Nuki bridge HTTP API](https://developer.nuki.io/page/nuki-bridge-http-api-1-13/4)
26
+ * documentation for a better understanding of the API.
27
+ * @extends HttpClient
28
+ */
13
29
  class NbClient extends HttpClient {
14
30
  static get DeviceTypes () {
15
31
  return {
@@ -3,8 +3,22 @@
3
3
  //
4
4
  // Homebridge NB Tools.
5
5
 
6
- import { HttpClient, OptionParser } from 'hb-lib-tools'
6
+ import { HttpClient } from 'hb-lib-tools/HttpClient'
7
+ import { OptionParser } from 'hb-lib-tools/OptionParser'
7
8
 
9
+ /** Nuki bridge discovery.
10
+ * <br>See {@link NbDiscovery}.
11
+ * @name NbDiscovery
12
+ * @type {Class}
13
+ * @memberof module:hb-nb-tools
14
+ */
15
+
16
+ /** Class for discovery of Nuki bridges.
17
+ *
18
+ * See the [Nuki bridge HTTP API](https://developer.nuki.io/page/nuki-bridge-http-api-1-13/4)
19
+ * documentation for a better understanding of the API.
20
+ * @extends HttpClient
21
+ */
8
22
  class NbDiscovery extends HttpClient {
9
23
  constructor (params = {}) {
10
24
  const config = {
package/lib/NbListener.js CHANGED
@@ -6,10 +6,23 @@
6
6
  import { EventEmitter } from 'node:events'
7
7
  import { createServer } from 'node:http'
8
8
 
9
- import { OptionParser } from 'hb-lib-tools'
9
+ import { OptionParser } from 'hb-lib-tools/OptionParser'
10
10
 
11
- import { NbClient } from '../index.js'
11
+ import { NbClient } from 'hb-nb-tools/NbClient'
12
12
 
13
+ /** Listerner for Nuki bridge callbacks.
14
+ * <br>See {@link NbListener}.
15
+ * @name NbListener
16
+ * @type {Class}
17
+ * @memberof module:hb-nb-tools
18
+ */
19
+
20
+ /** Class for listening to Nuki bridge callbacks.
21
+ *
22
+ * See the [Nuki bridge HTTP API](https://developer.nuki.io/page/nuki-bridge-http-api-1-13/4)
23
+ * documentation for a better understanding of the API.
24
+ * @extends EventEmitter
25
+ */
13
26
  class NbListener extends EventEmitter {
14
27
  constructor (port = 0) {
15
28
  super()
package/lib/NbTool.js CHANGED
@@ -3,11 +3,14 @@
3
3
  //
4
4
  // Command line interface to Nuki bridge HTTP API.
5
5
 
6
- import {
7
- CommandLineParser, CommandLineTool, JsonFormatter, OptionParser
8
- } from 'hb-lib-tools'
9
-
10
- import { NbClient, NbDiscovery, NbListener } from '../index.js'
6
+ import { CommandLineParser } from 'hb-lib-tools/CommandLineParser'
7
+ import { CommandLineTool } from 'hb-lib-tools/CommandLineTool'
8
+ import { JsonFormatter } from 'hb-lib-tools/JsonFormatter'
9
+ import { OptionParser } from 'hb-lib-tools/OptionParser'
10
+
11
+ import { NbClient } from 'hb-nb-tools/NbClient'
12
+ import { NbDiscovery } from 'hb-nb-tools/NbDiscovery'
13
+ import { NbListener } from 'hb-nb-tools/NbListener'
11
14
 
12
15
  const { b, u } = CommandLineTool
13
16
  const { UsageError } = CommandLineParser
package/package.json CHANGED
@@ -3,9 +3,11 @@
3
3
  "description": "Homebridge NB Tools",
4
4
  "author": "Erik Baauw",
5
5
  "license": "Apache-2.0",
6
- "version": "2.0.0-0",
6
+ "version": "2.0.0-2",
7
7
  "type": "module",
8
- "main": "index.js",
8
+ "exports": {
9
+ "./*": "./lib/*.js"
10
+ },
9
11
  "keywords": [
10
12
  "nuki",
11
13
  "smart-lock",
@@ -19,11 +21,11 @@
19
21
  "node": "^20||^18"
20
22
  },
21
23
  "dependencies": {
22
- "hb-lib-tools": "~2.0.0-0",
24
+ "hb-lib-tools": "~2.0.0-2",
23
25
  "tweetnacl": "~1.0.3"
24
26
  },
25
27
  "scripts": {
26
- "prepare": "standard",
28
+ "prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
27
29
  "test": "standard && echo \"Error: no test specified\" && exit 1"
28
30
  },
29
31
  "repository": {
@@ -33,5 +35,15 @@
33
35
  "bugs": {
34
36
  "url": "https://github.com/ebaauw/hb-nb-tools/issues"
35
37
  },
36
- "homepage": "https://github.com/ebaauw/hb-nb-tools#readme"
38
+ "homepage": "https://github.com/ebaauw/hb-nb-tools#readme",
39
+ "funding": [
40
+ {
41
+ "type": "github",
42
+ "url": "https://github.com/sponsors/ebaauw"
43
+ },
44
+ {
45
+ "type": "paypal",
46
+ "url": "https://www.paypal.me/ebaauw/EUR"
47
+ }
48
+ ]
37
49
  }