@sebbo2002/node-pyatv 4.3.4-develop.4 → 5.1.0-develop.1

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 (94) hide show
  1. package/.mocharc.yml +3 -3
  2. package/.nycrc +1 -0
  3. package/CHANGELOG.md +31 -0
  4. package/dist/bin/check.js +2 -6
  5. package/dist/bin/check.js.map +1 -1
  6. package/dist/examples/push.js +2 -6
  7. package/dist/examples/push.js.map +1 -1
  8. package/dist/lib/device-event.d.ts +2 -2
  9. package/dist/lib/device-event.js +1 -3
  10. package/dist/lib/device-event.js.map +1 -1
  11. package/dist/lib/device-events.d.ts +2 -2
  12. package/dist/lib/device-events.js +38 -40
  13. package/dist/lib/device-events.js.map +1 -1
  14. package/dist/lib/device.d.ts +47 -2
  15. package/dist/lib/device.js +99 -46
  16. package/dist/lib/device.js.map +1 -1
  17. package/dist/lib/fake-spawn.js +7 -14
  18. package/dist/lib/fake-spawn.js.map +1 -1
  19. package/dist/lib/index.d.ts +6 -5
  20. package/dist/lib/index.js +6 -22
  21. package/dist/lib/index.js.map +1 -1
  22. package/dist/lib/instance.d.ts +2 -2
  23. package/dist/lib/instance.js +40 -32
  24. package/dist/lib/instance.js.map +1 -1
  25. package/dist/lib/tools.d.ts +1 -1
  26. package/dist/lib/tools.js +24 -34
  27. package/dist/lib/tools.js.map +1 -1
  28. package/dist/lib/types.d.ts +24 -0
  29. package/dist/lib/types.js +20 -23
  30. package/dist/lib/types.js.map +1 -1
  31. package/docs/coverage/block-navigation.js +8 -0
  32. package/docs/coverage/cobertura-coverage.xml +2818 -1534
  33. package/docs/coverage/device-event.ts.html +64 -59
  34. package/docs/coverage/device-events.ts.html +215 -210
  35. package/docs/coverage/device.ts.html +931 -740
  36. package/docs/coverage/fake-spawn.ts.html +102 -97
  37. package/docs/coverage/favicon.png +0 -0
  38. package/docs/coverage/index.html +74 -69
  39. package/docs/coverage/index.ts.html +63 -49
  40. package/docs/coverage/instance.ts.html +256 -224
  41. package/docs/coverage/sort-arrow-sprite.png +0 -0
  42. package/docs/coverage/sorter.js +26 -0
  43. package/docs/coverage/tools.ts.html +310 -305
  44. package/docs/coverage/types.ts.html +204 -121
  45. package/docs/reference/assets/highlight.css +11 -25
  46. package/docs/reference/assets/main.js +4 -2
  47. package/docs/reference/assets/search.js +1 -1
  48. package/docs/reference/assets/style.css +424 -538
  49. package/docs/reference/classes/NodePyATVDevice.html +1136 -126
  50. package/docs/reference/classes/NodePyATVDeviceEvent.html +111 -10
  51. package/docs/reference/classes/NodePyATVInstance.html +227 -0
  52. package/docs/reference/enums/NodePyATVDeviceState.html +93 -1
  53. package/docs/reference/enums/NodePyATVExecutableType.html +65 -0
  54. package/docs/reference/enums/NodePyATVKeys.html +212 -1
  55. package/docs/reference/enums/NodePyATVListenerState.html +79 -1
  56. package/docs/reference/enums/NodePyATVMediaType.html +79 -1
  57. package/docs/reference/enums/NodePyATVPowerState.html +65 -1
  58. package/docs/reference/enums/NodePyATVProtocol.html +79 -1
  59. package/docs/reference/enums/NodePyATVRepeatState.html +72 -1
  60. package/docs/reference/enums/NodePyATVShuffleState.html +72 -1
  61. package/docs/reference/index.html +61 -53
  62. package/docs/reference/interfaces/NodePyATVDeviceOptions.html +229 -1
  63. package/docs/reference/interfaces/NodePyATVFindAndInstanceOptions.html +190 -1
  64. package/docs/reference/interfaces/NodePyATVFindOptions.html +120 -1
  65. package/docs/reference/interfaces/NodePyATVGetStateOptions.html +62 -1
  66. package/docs/reference/interfaces/NodePyATVInstanceOptions.html +110 -1
  67. package/docs/reference/interfaces/NodePyATVService.html +69 -0
  68. package/docs/reference/interfaces/NodePyATVState.html +160 -1
  69. package/docs/reference/interfaces/NodePyATVVersionResponse.html +69 -1
  70. package/docs/reference/modules.html +104 -1
  71. package/docs/reference/types/NodePyATVEventValueType.html +64 -0
  72. package/docs/tests/index.html +1 -1
  73. package/docs/tests/mochawesome.json +1074 -784
  74. package/package.json +18 -15
  75. package/release.config.cjs +56 -0
  76. package/src/bin/check.ts +1 -1
  77. package/src/examples/push.ts +1 -1
  78. package/src/lib/device-event.ts +2 -2
  79. package/src/lib/device-events.ts +4 -4
  80. package/src/lib/device.ts +65 -3
  81. package/src/lib/index.ts +20 -17
  82. package/src/lib/instance.ts +31 -22
  83. package/src/lib/tools.ts +1 -1
  84. package/src/lib/types.ts +26 -0
  85. package/test/device-event.ts +2 -2
  86. package/test/device-events.ts +2 -2
  87. package/test/device.ts +127 -4
  88. package/test/instance.ts +128 -42
  89. package/test/tools.ts +2 -2
  90. package/tsconfig.json +1 -1
  91. package/docs/reference/assets/icons.css +0 -1043
  92. package/docs/reference/assets/icons.png +0 -0
  93. package/docs/reference/assets/icons@2x.png +0 -0
  94. package/docs/reference/classes/default.html +0 -50
package/package.json CHANGED
@@ -9,32 +9,34 @@
9
9
  },
10
10
  "description": "A lightweight wrapper around pyatv…",
11
11
  "devDependencies": {
12
- "@amanda-mitchell/semantic-release-npm-multiple": "^3.2.1",
13
- "@qiwi/semantic-release-gh-pages-plugin": "^5.2.2",
12
+ "@amanda-mitchell/semantic-release-npm-multiple": "^3.5.0",
13
+ "@qiwi/semantic-release-gh-pages-plugin": "^5.2.3",
14
14
  "@semantic-release/changelog": "^6.0.1",
15
15
  "@semantic-release/exec": "^6.0.3",
16
16
  "@semantic-release/git": "^10.0.1",
17
17
  "@types/mocha": "^9.1.1",
18
- "@types/node": "^17.0.31",
19
- "@types/semver": "^7.3.9",
20
- "@typescript-eslint/eslint-plugin": "^5.22.0",
21
- "@typescript-eslint/parser": "^5.22.0",
22
- "eslint": "^8.16.0",
23
- "eslint-plugin-jsonc": "^2.3.0",
18
+ "@types/node": "^18.0.0",
19
+ "@types/semver": "^7.3.10",
20
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
21
+ "@typescript-eslint/parser": "^5.30.5",
22
+ "c8": "^7.11.3",
23
+ "eslint": "^8.19.0",
24
+ "eslint-plugin-jsonc": "^2.3.1",
25
+ "esm": "^3.2.25",
24
26
  "license-checker": "^25.0.1",
25
27
  "mocha": "^10.0.0",
26
28
  "mochawesome": "^7.1.3",
27
- "nyc": "^15.1.0",
28
29
  "semantic-release": "^19.0.3",
29
30
  "semantic-release-license": "^1.0.3",
30
31
  "source-map-support": "^0.5.21",
31
- "ts-node": "^10.8.0",
32
- "typedoc": "^0.22.17",
33
- "typescript": "^4.7.2"
32
+ "ts-node": "^10.8.2",
33
+ "typedoc": "^0.23.5",
34
+ "typescript": "^4.7.4"
34
35
  },
35
36
  "engines": {
36
- "node": ">=12.0.0"
37
+ "node": "^12.20.0 || >=14.13.1"
37
38
  },
39
+ "homepage": "https://github.com/sebbo2002/js-template#readme",
38
40
  "license": "MIT",
39
41
  "main": "./dist/lib/index.js",
40
42
  "name": "@sebbo2002/node-pyatv",
@@ -47,7 +49,7 @@
47
49
  "build": "tsc",
48
50
  "build-all": "./.github/workflows/build.sh",
49
51
  "check": "./check.sh",
50
- "coverage": "nyc mocha",
52
+ "coverage": "c8 mocha",
51
53
  "develop": "ts-node ./src/bin/start.ts",
52
54
  "example": "node ./dist/examples/push.js",
53
55
  "license-check": "license-checker --production --summary",
@@ -55,5 +57,6 @@
55
57
  "postinstall": "./check.sh",
56
58
  "test": "mocha"
57
59
  },
58
- "version": "4.3.4-develop.4"
60
+ "type": "module",
61
+ "version": "5.1.0-develop.1"
59
62
  }
@@ -0,0 +1,56 @@
1
+ const configuration = {
2
+ 'branches': [
3
+ 'main',
4
+ {
5
+ 'name': 'develop',
6
+ 'channel': 'next',
7
+ 'prerelease': true
8
+ }
9
+ ],
10
+ 'plugins': []
11
+ };
12
+
13
+ configuration.plugins.push(['@semantic-release/commit-analyzer', {
14
+ 'releaseRules': [
15
+ {'type': 'chore', 'scope': 'deps', 'release': 'patch'},
16
+ {'type': 'chore', 'scope': 'package', 'release': 'patch'},
17
+ {'type': 'build', 'scope': 'deps', 'release': 'patch'},
18
+ {'type': 'docs', 'release': 'patch'}
19
+ ]
20
+ }]);
21
+
22
+ configuration.plugins.push('@semantic-release/release-notes-generator');
23
+
24
+ configuration.plugins.push('@semantic-release/changelog');
25
+
26
+ configuration.plugins.push('semantic-release-license');
27
+
28
+ configuration.plugins.push(['@amanda-mitchell/semantic-release-npm-multiple', {
29
+ 'registries': {
30
+ 'github': {},
31
+ 'public': {}
32
+ }
33
+ }]);
34
+
35
+ configuration.plugins.push(['@semantic-release/exec', {
36
+ 'prepareCmd': './.github/workflows/build.sh'
37
+ }]);
38
+
39
+ configuration.plugins.push(['@semantic-release/github', {
40
+ 'labels': false,
41
+ 'assignees': process.env.GH_OWNER
42
+ }]);
43
+
44
+ configuration.plugins.push(['@semantic-release/git', {
45
+ 'assets': ['CHANGELOG.md', 'LICENSE'],
46
+ 'message': 'chore(release): :bookmark: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
47
+ }]);
48
+
49
+ configuration.plugins.push(['@qiwi/semantic-release-gh-pages-plugin', {
50
+ 'msg': 'docs: Updated for <%= nextRelease.gitTag %>',
51
+ 'src': './docs',
52
+ 'dst': `./${process.env.BRANCH}`,
53
+ 'pullTagsBranch': 'main'
54
+ }]);
55
+
56
+ module.exports = configuration;
package/src/bin/check.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import NodePyATVInstance from '../lib/instance';
3
+ import NodePyATVInstance from '../lib/instance.js';
4
4
 
5
5
  (async () => {
6
6
  try {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // import pyatv, {NodePyATVDeviceEvent} from '@sebbo2002/node-pyatv';
4
- import pyatv, {NodePyATVDeviceEvent} from '../lib/index';
4
+ import pyatv, {NodePyATVDeviceEvent} from '../lib/index.js';
5
5
 
6
6
  (async () => {
7
7
  const devices = await pyatv.find(/*{debug: true}*/);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- import {NodePyATVDevice} from '../lib';
4
- import {NodePyATVEventValueType, NodePyATVStateIndex} from './types';
3
+ import {NodePyATVDevice} from '../lib/index.js';
4
+ import type {NodePyATVEventValueType, NodePyATVStateIndex} from './types.js';
5
5
 
6
6
  export default class NodePyATVDeviceEvent {
7
7
  protected readonly values: {key: NodePyATVStateIndex, old: NodePyATVEventValueType, new: NodePyATVEventValueType, device: NodePyATVDevice};
@@ -7,13 +7,13 @@ import {
7
7
  NodePyATVListenerState,
8
8
  NodePyATVState,
9
9
  NodePyATVStateIndex
10
- } from './types';
10
+ } from './types.js';
11
11
  import {ChildProcess} from 'child_process';
12
12
 
13
13
  import {EventEmitter} from 'events';
14
- import {NodePyATVDevice, NodePyATVDeviceEvent} from '../lib';
15
- import {addRequestId, debug, execute, getParamters, parseState, removeRequestId} from './tools';
16
- import {FakeChildProcess} from './fake-spawn';
14
+ import {NodePyATVDevice, NodePyATVDeviceEvent} from '../lib/index.js';
15
+ import {addRequestId, debug, execute, getParamters, parseState, removeRequestId} from './tools.js';
16
+ import {FakeChildProcess} from './fake-spawn.js';
17
17
 
18
18
  /**
19
19
  * @internal
package/src/lib/device.ts CHANGED
@@ -10,12 +10,13 @@ import {
10
10
  NodePyATVMediaType,
11
11
  NodePyATVProtocol,
12
12
  NodePyATVRepeatState,
13
+ NodePyATVService,
13
14
  NodePyATVShuffleState,
14
15
  NodePyATVState
15
- } from './types';
16
+ } from './types.js';
16
17
 
17
- import { addRequestId, getParamters, parseState, removeRequestId, request } from './tools';
18
- import { NodePyATVDeviceEvent, NodePyATVDeviceEvents } from '../lib';
18
+ import { addRequestId, getParamters, parseState, removeRequestId, request } from './tools.js';
19
+ import { NodePyATVDeviceEvent, NodePyATVDeviceEvents } from '../lib/index.js';
19
20
  import { EventEmitter } from 'events';
20
21
 
21
22
  /**
@@ -74,6 +75,67 @@ export default class NodePyATVDevice implements EventEmitter{
74
75
  return this.options.protocol;
75
76
  }
76
77
 
78
+ /**
79
+ * Get the model identifier of the device. Only set, if the
80
+ * device was found using [[find()]]. Requires pyatv ≧ 0.10.3.
81
+ *
82
+ * @example device.model → "Gen4K"
83
+ */
84
+ get model(): string | undefined {
85
+ return this.options.model;
86
+ }
87
+
88
+ /**
89
+ * Get the model name of the device. Only set, if the device
90
+ * was found with [[find()]]. Requires pyatv ≧ 0.10.3.
91
+ *
92
+ * @example device.modelName → "Apple TV 4K"
93
+ */
94
+ get modelName(): string | undefined {
95
+ return this.options.modelName;
96
+ }
97
+
98
+ /**
99
+ * Get the operating system of the device. Only set, if the
100
+ * device was found with [[find()]]. Requires pyatv ≧ 0.10.3.
101
+ *
102
+ * @example device.os → "TvOS"
103
+ */
104
+ get os(): string | undefined {
105
+ return this.options.os;
106
+ }
107
+
108
+ /**
109
+ * Get the device version. Only set, if the device was found
110
+ * during a scan using [[find()]]. Requires pyatv ≧ 0.10.3.
111
+ *
112
+ * @example device.version → "15.5.1"
113
+ */
114
+ get version(): string | undefined {
115
+ return this.options.version;
116
+ }
117
+
118
+ /**
119
+ * Returns a list of services supported by the device. Ony set, if
120
+ * the device was found during a scan using [[find()]]. Requires
121
+ * pyatv ≧ 0.10.3.
122
+ *
123
+ * @example device.services → [
124
+ * {
125
+ * "protocol": "airplay",
126
+ * "port": 7000
127
+ * },
128
+ * {
129
+ * "protocol": "dmap",
130
+ * "port": 3689
131
+ * }
132
+ * ]
133
+ */
134
+ get services(): NodePyATVService[] | undefined {
135
+ return this.options.services;
136
+ }
137
+
138
+
77
139
  /**
78
140
  * Returns true, if debugging is enabled. Returns the custom
79
141
  * logging method, if one was specified. Otherwise, if debug
package/src/lib/index.ts CHANGED
@@ -1,26 +1,29 @@
1
1
  'use strict';
2
2
 
3
3
  export {
4
- NodePyATVProtocol,
5
- NodePyATVMediaType,
4
+ NodePyATVDeviceOptions,
6
5
  NodePyATVDeviceState,
7
- NodePyATVRepeatState,
8
- NodePyATVShuffleState,
9
- NodePyATVKeys,
10
- NodePyATVInstanceOptions,
11
- NodePyATVVersionResponse,
12
- NodePyATVFindOptions,
6
+ NodePyATVEventValueType,
7
+ NodePyATVExecutableType,
13
8
  NodePyATVFindAndInstanceOptions,
14
- NodePyATVDeviceOptions,
9
+ NodePyATVFindOptions,
15
10
  NodePyATVGetStateOptions,
16
- NodePyATVState,
17
- NodePyATVPowerState,
11
+ NodePyATVInstanceOptions,
12
+ NodePyATVKeys,
18
13
  NodePyATVListenerState,
19
- NodePyATVEventValueType,
20
- } from './types';
14
+ NodePyATVMediaType,
15
+ NodePyATVPowerState,
16
+ NodePyATVProtocol,
17
+ NodePyATVRepeatState,
18
+ NodePyATVService,
19
+ NodePyATVShuffleState,
20
+ NodePyATVState,
21
+ NodePyATVVersionResponse
22
+ } from './types.js';
21
23
 
22
- export {default as NodePyATVDeviceEvent} from './device-event';
23
- export {default as NodePyATVDeviceEvents} from './device-events';
24
- export {default as NodePyATVDevice} from './device';
24
+ export {default as NodePyATVDeviceEvent} from './device-event.js';
25
+ export {default as NodePyATVDeviceEvents} from './device-events.js';
26
+ export {default as NodePyATVDevice} from './device.js';
27
+ export {default as NodePyATVInstance} from './instance.js';
25
28
 
26
- export {default} from './instance';
29
+ export {default} from './instance.js';
@@ -1,17 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  import semver from 'semver';
4
+ import { dirname } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { promises as fsPromises } from 'fs';
4
7
 
5
8
  import {
6
9
  NodePyATVDeviceOptions,
7
10
  NodePyATVExecutableType,
8
11
  NodePyATVFindAndInstanceOptions,
9
12
  NodePyATVInstanceOptions,
13
+ NodePyATVInternalScanDevice,
10
14
  NodePyATVVersionResponse
11
- } from './types';
15
+ } from './types.js';
12
16
 
13
- import {addRequestId, debug, getParamters, removeRequestId, request} from './tools';
14
- import {NodePyATVDevice} from '../lib';
17
+ import { addRequestId, debug, getParamters, removeRequestId, request } from './tools.js';
18
+ import { NodePyATVDevice } from '../lib/index.js';
19
+
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = dirname(__filename);
15
22
 
16
23
  /**
17
24
  * Default class exported by `@sebbo2002/node-pyatv`. Use [[find]] to scan for devices in your local network. Use
@@ -30,7 +37,7 @@ export default class NodePyATVInstance {
30
37
  *
31
38
  * @param options
32
39
  */
33
- public static async check(options: NodePyATVInstanceOptions = {}): Promise<void> {
40
+ public static async check (options: NodePyATVInstanceOptions = {}): Promise<void> {
34
41
  const versions = await this.version(options);
35
42
  if (!versions.pyatv) {
36
43
  throw new Error('Unable to find pyatv. Is it installed?');
@@ -41,8 +48,7 @@ export default class NodePyATVInstance {
41
48
 
42
49
  try {
43
50
  await this.find(options);
44
- }
45
- catch (error) {
51
+ } catch (error) {
46
52
  throw new Error(`Unable to scan for devices: ${String(error).replace('Error: ', '')}`);
47
53
  }
48
54
  }
@@ -53,15 +59,14 @@ export default class NodePyATVInstance {
53
59
  *
54
60
  * @param options
55
61
  */
56
- public static async version(options: NodePyATVInstanceOptions = {}): Promise<NodePyATVVersionResponse> {
62
+ public static async version (options: NodePyATVInstanceOptions = {}): Promise<NodePyATVVersionResponse> {
57
63
  const id = addRequestId();
58
64
  let pyatv = null;
59
65
  let module = null;
60
66
 
61
67
  try {
62
68
  pyatv = await request(id, NodePyATVExecutableType.atvremote, ['--version'], options) as string;
63
- }
64
- catch (error) {
69
+ } catch (error) {
65
70
  debug(id, `Unable to get pyatv version due to ${error}`, options);
66
71
  }
67
72
 
@@ -74,10 +79,9 @@ export default class NodePyATVInstance {
74
79
  }
75
80
 
76
81
  try {
77
- // eslint-disable-next-line @typescript-eslint/no-var-requires
78
- module = require(__dirname + '/../../package.json').version || null;
79
- }
80
- catch (error) {
82
+ const json = JSON.parse(await fsPromises.readFile(__dirname + '/../../package.json', 'utf8'));
83
+ module = json?.version || null;
84
+ } catch (error) {
81
85
  debug(id, `Unable to get module version due to ${error}`, options);
82
86
  }
83
87
  if (module && !semver.valid(module)) {
@@ -105,7 +109,7 @@ export default class NodePyATVInstance {
105
109
  *
106
110
  * @param options
107
111
  */
108
- public static async find(options: NodePyATVFindAndInstanceOptions = {}): Promise<NodePyATVDevice[]> {
112
+ public static async find (options: NodePyATVFindAndInstanceOptions = {}): Promise<NodePyATVDevice[]> {
109
113
  const id = addRequestId();
110
114
  const parameters = getParamters(options);
111
115
 
@@ -114,11 +118,16 @@ export default class NodePyATVInstance {
114
118
  throw new Error(`Unable to parse pyatv response: ${JSON.stringify(result, null, ' ')}`);
115
119
  }
116
120
 
117
- const objects = result.devices.map((device: { address: string, identifier: string, name: string }) =>
121
+ const objects = result.devices.map((device: NodePyATVInternalScanDevice) =>
118
122
  this.device(Object.assign({}, options, {
119
123
  host: device.address,
120
124
  id: device.identifier,
121
- name: device.name
125
+ name: device.name,
126
+ model: device.device_info?.model,
127
+ modelName: device.device_info?.model_str,
128
+ os: device.device_info?.operating_system,
129
+ version: device.device_info?.version,
130
+ services: device.services
122
131
  }))
123
132
  );
124
133
 
@@ -132,7 +141,7 @@ export default class NodePyATVInstance {
132
141
  *
133
142
  * @param options
134
143
  */
135
- public static device(options: NodePyATVDeviceOptions): NodePyATVDevice {
144
+ public static device (options: NodePyATVDeviceOptions): NodePyATVDevice {
136
145
  return new NodePyATVDevice(options);
137
146
  }
138
147
 
@@ -148,7 +157,7 @@ export default class NodePyATVInstance {
148
157
  * ```
149
158
  * @param options
150
159
  */
151
- public constructor(options: NodePyATVInstanceOptions = {}) {
160
+ public constructor (options: NodePyATVInstanceOptions = {}) {
152
161
  this.options = Object.assign({}, options);
153
162
  }
154
163
 
@@ -158,7 +167,7 @@ export default class NodePyATVInstance {
158
167
  *
159
168
  * @param options
160
169
  */
161
- public async check(options: NodePyATVInstanceOptions = {}): Promise<void> {
170
+ public async check (options: NodePyATVInstanceOptions = {}): Promise<void> {
162
171
  return NodePyATVInstance.check(Object.assign({}, this.options, options));
163
172
  }
164
173
 
@@ -168,7 +177,7 @@ export default class NodePyATVInstance {
168
177
  *
169
178
  * @param options
170
179
  */
171
- public async version(options: NodePyATVInstanceOptions = {}): Promise<NodePyATVVersionResponse> {
180
+ public async version (options: NodePyATVInstanceOptions = {}): Promise<NodePyATVVersionResponse> {
172
181
  return NodePyATVInstance.version(Object.assign({}, this.options, options));
173
182
  }
174
183
 
@@ -186,7 +195,7 @@ export default class NodePyATVInstance {
186
195
  *
187
196
  * @param options
188
197
  */
189
- public async find(options: NodePyATVFindAndInstanceOptions = {}): Promise<NodePyATVDevice[]> {
198
+ public async find (options: NodePyATVFindAndInstanceOptions = {}): Promise<NodePyATVDevice[]> {
190
199
  return NodePyATVInstance.find(Object.assign({}, this.options, options));
191
200
  }
192
201
 
@@ -196,7 +205,7 @@ export default class NodePyATVInstance {
196
205
  *
197
206
  * @param options
198
207
  */
199
- public device(options: NodePyATVDeviceOptions): NodePyATVDevice {
208
+ public device (options: NodePyATVDeviceOptions): NodePyATVDevice {
200
209
  return NodePyATVInstance.device(Object.assign({}, this.options, options));
201
210
  }
202
211
  }
package/src/lib/tools.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  NodePyATVInternalState,
9
9
  NodePyATVMediaType, NodePyATVPowerState, NodePyATVRepeatState, NodePyATVShuffleState,
10
10
  NodePyATVState
11
- } from './types';
11
+ } from './types.js';
12
12
 
13
13
  import {ChildProcess, spawn, SpawnOptions} from 'child_process';
14
14
  import {FakeChildProcess} from './fake-spawn';
package/src/lib/types.ts CHANGED
@@ -147,12 +147,38 @@ export interface NodePyATVFindAndInstanceOptions extends NodePyATVInstanceOption
147
147
  export interface NodePyATVDeviceOptions extends NodePyATVFindAndInstanceOptions {
148
148
  host: string;
149
149
  name: string;
150
+ model?: string;
151
+ modelName?: string;
152
+ os?: string;
153
+ version?: string;
154
+ services?: NodePyATVService[];
150
155
  }
151
156
 
152
157
  export interface NodePyATVGetStateOptions {
153
158
  maxAge?: number;
154
159
  }
155
160
 
161
+ export interface NodePyATVService {
162
+ protocol: NodePyATVProtocol;
163
+ port: number;
164
+ }
165
+
166
+ /**
167
+ * @internal
168
+ */
169
+ export interface NodePyATVInternalScanDevice {
170
+ name: string;
171
+ address: string;
172
+ identifier: string;
173
+ device_info?: {
174
+ model: string;
175
+ model_str: string;
176
+ operating_system: string;
177
+ version: string;
178
+ };
179
+ services?: NodePyATVService[];
180
+ }
181
+
156
182
  /**
157
183
  * @internal
158
184
  */
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  import assert from 'assert';
4
- import NodePyATVDevice from '../src/lib/device';
5
- import NodePyATVDeviceEvent from '../src/lib/device-event';
4
+ import NodePyATVDevice from '../src/lib/device.js';
5
+ import NodePyATVDeviceEvent from '../src/lib/device-event.js';
6
6
 
7
7
  describe('NodePyATVDeviceEvent', function () {
8
8
  describe('get key()', function () {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  import assert from 'assert';
4
- import {createFakeSpawn} from '../src/lib/fake-spawn';
5
- import {NodePyATVDeviceEvent, NodePyATVPowerState, NodePyATVDevice} from '../src/lib';
4
+ import {createFakeSpawn} from '../src/lib/fake-spawn.js';
5
+ import {NodePyATVDeviceEvent, NodePyATVPowerState, NodePyATVDevice} from '../src/lib/index.js';
6
6
 
7
7
  describe('NodePyATVDeviceEvents', function () {
8
8
  describe('applyStateAndEmitEvents()', function () {