@ecobridge.xyz/devicemanager 3.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/.gitea/workflows/default_nottags.yaml +66 -0
- package/.gitea/workflows/default_tags.yaml +124 -0
- package/.vscode/launch.json +11 -0
- package/.vscode/settings.json +26 -0
- package/changelog.md +91 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/device/device.classes.device.d.ts +205 -0
- package/dist_ts/device/device.classes.device.js +344 -0
- package/dist_ts/devicemanager.classes.devicemanager.d.ts +210 -0
- package/dist_ts/devicemanager.classes.devicemanager.js +835 -0
- package/dist_ts/discovery/discovery.classes.homeassistant.d.ts +101 -0
- package/dist_ts/discovery/discovery.classes.homeassistant.js +313 -0
- package/dist_ts/discovery/discovery.classes.mdns.d.ts +90 -0
- package/dist_ts/discovery/discovery.classes.mdns.js +291 -0
- package/dist_ts/discovery/discovery.classes.networkscanner.d.ts +64 -0
- package/dist_ts/discovery/discovery.classes.networkscanner.js +535 -0
- package/dist_ts/discovery/discovery.classes.ssdp.d.ts +112 -0
- package/dist_ts/discovery/discovery.classes.ssdp.js +255 -0
- package/dist_ts/factories/index.d.ts +190 -0
- package/dist_ts/factories/index.js +350 -0
- package/dist_ts/features/feature.abstract.d.ts +118 -0
- package/dist_ts/features/feature.abstract.js +172 -0
- package/dist_ts/features/feature.camera.d.ts +95 -0
- package/dist_ts/features/feature.camera.js +162 -0
- package/dist_ts/features/feature.climate.d.ts +174 -0
- package/dist_ts/features/feature.climate.js +328 -0
- package/dist_ts/features/feature.cover.d.ts +121 -0
- package/dist_ts/features/feature.cover.js +217 -0
- package/dist_ts/features/feature.fan.d.ts +127 -0
- package/dist_ts/features/feature.fan.js +235 -0
- package/dist_ts/features/feature.light.d.ts +156 -0
- package/dist_ts/features/feature.light.js +296 -0
- package/dist_ts/features/feature.lock.d.ts +103 -0
- package/dist_ts/features/feature.lock.js +170 -0
- package/dist_ts/features/feature.playback.d.ts +98 -0
- package/dist_ts/features/feature.playback.js +191 -0
- package/dist_ts/features/feature.power.d.ts +79 -0
- package/dist_ts/features/feature.power.js +173 -0
- package/dist_ts/features/feature.print.d.ts +78 -0
- package/dist_ts/features/feature.print.js +226 -0
- package/dist_ts/features/feature.scan.d.ts +79 -0
- package/dist_ts/features/feature.scan.js +315 -0
- package/dist_ts/features/feature.sensor.d.ts +95 -0
- package/dist_ts/features/feature.sensor.js +147 -0
- package/dist_ts/features/feature.snmp.d.ts +88 -0
- package/dist_ts/features/feature.snmp.js +175 -0
- package/dist_ts/features/feature.switch.d.ts +75 -0
- package/dist_ts/features/feature.switch.js +126 -0
- package/dist_ts/features/feature.volume.d.ts +104 -0
- package/dist_ts/features/feature.volume.js +186 -0
- package/dist_ts/features/index.d.ts +19 -0
- package/dist_ts/features/index.js +23 -0
- package/dist_ts/helpers/helpers.iprange.d.ts +35 -0
- package/dist_ts/helpers/helpers.iprange.js +151 -0
- package/dist_ts/helpers/helpers.retry.d.ts +25 -0
- package/dist_ts/helpers/helpers.retry.js +69 -0
- package/dist_ts/index.d.ts +15 -0
- package/dist_ts/index.js +40 -0
- package/dist_ts/interfaces/feature.interfaces.d.ts +255 -0
- package/dist_ts/interfaces/feature.interfaces.js +6 -0
- package/dist_ts/interfaces/homeassistant.interfaces.d.ts +550 -0
- package/dist_ts/interfaces/homeassistant.interfaces.js +111 -0
- package/dist_ts/interfaces/index.d.ts +330 -0
- package/dist_ts/interfaces/index.js +16 -0
- package/dist_ts/interfaces/smarthome.interfaces.d.ts +282 -0
- package/dist_ts/interfaces/smarthome.interfaces.js +7 -0
- package/dist_ts/paths.d.ts +1 -0
- package/dist_ts/paths.js +3 -0
- package/dist_ts/plugins.d.ts +23 -0
- package/dist_ts/plugins.js +30 -0
- package/dist_ts/protocols/index.d.ts +12 -0
- package/dist_ts/protocols/index.js +21 -0
- package/dist_ts/protocols/protocol.escl.d.ts +58 -0
- package/dist_ts/protocols/protocol.escl.js +364 -0
- package/dist_ts/protocols/protocol.homeassistant.d.ts +248 -0
- package/dist_ts/protocols/protocol.homeassistant.js +611 -0
- package/dist_ts/protocols/protocol.ipp.d.ts +45 -0
- package/dist_ts/protocols/protocol.ipp.js +284 -0
- package/dist_ts/protocols/protocol.nut.d.ts +160 -0
- package/dist_ts/protocols/protocol.nut.js +364 -0
- package/dist_ts/protocols/protocol.sane.d.ts +104 -0
- package/dist_ts/protocols/protocol.sane.js +597 -0
- package/dist_ts/protocols/protocol.snmp.d.ts +133 -0
- package/dist_ts/protocols/protocol.snmp.js +333 -0
- package/dist_ts/protocols/protocol.upnp.d.ts +207 -0
- package/dist_ts/protocols/protocol.upnp.js +442 -0
- package/dist_ts/protocols/protocol.upssnmp.d.ts +160 -0
- package/dist_ts/protocols/protocol.upssnmp.js +263 -0
- package/npmextra.json +24 -0
- package/package.json +39 -0
- package/readme.hints.md +115 -0
- package/readme.md +624 -0
- package/test/test.ts +261 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/device/device.classes.device.ts +454 -0
- package/ts/devicemanager.classes.devicemanager.ts +1219 -0
- package/ts/discovery/discovery.classes.homeassistant.ts +376 -0
- package/ts/discovery/discovery.classes.mdns.ts +347 -0
- package/ts/discovery/discovery.classes.networkscanner.ts +648 -0
- package/ts/discovery/discovery.classes.ssdp.ts +357 -0
- package/ts/factories/index.ts +696 -0
- package/ts/features/feature.abstract.ts +251 -0
- package/ts/features/feature.camera.ts +214 -0
- package/ts/features/feature.climate.ts +407 -0
- package/ts/features/feature.cover.ts +278 -0
- package/ts/features/feature.fan.ts +296 -0
- package/ts/features/feature.light.ts +369 -0
- package/ts/features/feature.lock.ts +223 -0
- package/ts/features/feature.playback.ts +246 -0
- package/ts/features/feature.power.ts +231 -0
- package/ts/features/feature.print.ts +297 -0
- package/ts/features/feature.scan.ts +370 -0
- package/ts/features/feature.sensor.ts +202 -0
- package/ts/features/feature.snmp.ts +235 -0
- package/ts/features/feature.switch.ts +170 -0
- package/ts/features/feature.volume.ts +256 -0
- package/ts/features/index.ts +25 -0
- package/ts/helpers/helpers.iprange.ts +172 -0
- package/ts/helpers/helpers.retry.ts +100 -0
- package/ts/index.ts +165 -0
- package/ts/interfaces/feature.interfaces.ts +359 -0
- package/ts/interfaces/homeassistant.interfaces.ts +666 -0
- package/ts/interfaces/index.ts +421 -0
- package/ts/interfaces/smarthome.interfaces.ts +421 -0
- package/ts/paths.ts +5 -0
- package/ts/plugins.ts +41 -0
- package/ts/protocols/index.ts +59 -0
- package/ts/protocols/protocol.escl.ts +439 -0
- package/ts/protocols/protocol.homeassistant.ts +737 -0
- package/ts/protocols/protocol.ipp.ts +329 -0
- package/ts/protocols/protocol.nut.ts +471 -0
- package/ts/protocols/protocol.sane.ts +694 -0
- package/ts/protocols/protocol.snmp.ts +439 -0
- package/ts/protocols/protocol.upnp.ts +627 -0
- package/ts/protocols/protocol.upssnmp.ts +377 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Default (not tags)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags-ignore:
|
|
6
|
+
- '**'
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
|
10
|
+
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@code.foss.global/${{gitea.repository}}.git
|
|
11
|
+
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
|
12
|
+
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
|
13
|
+
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
|
14
|
+
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
security:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
continue-on-error: true
|
|
20
|
+
container:
|
|
21
|
+
image: ${{ env.IMAGE }}
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v3
|
|
25
|
+
|
|
26
|
+
- name: Install pnpm and npmci
|
|
27
|
+
run: |
|
|
28
|
+
pnpm install -g pnpm
|
|
29
|
+
pnpm install -g @ship.zone/npmci
|
|
30
|
+
|
|
31
|
+
- name: Run npm prepare
|
|
32
|
+
run: npmci npm prepare
|
|
33
|
+
|
|
34
|
+
- name: Audit production dependencies
|
|
35
|
+
run: |
|
|
36
|
+
npmci command npm config set registry https://registry.npmjs.org
|
|
37
|
+
npmci command pnpm audit --audit-level=high --prod
|
|
38
|
+
continue-on-error: true
|
|
39
|
+
|
|
40
|
+
- name: Audit development dependencies
|
|
41
|
+
run: |
|
|
42
|
+
npmci command npm config set registry https://registry.npmjs.org
|
|
43
|
+
npmci command pnpm audit --audit-level=high --dev
|
|
44
|
+
continue-on-error: true
|
|
45
|
+
|
|
46
|
+
test:
|
|
47
|
+
if: ${{ always() }}
|
|
48
|
+
needs: security
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
container:
|
|
51
|
+
image: ${{ env.IMAGE }}
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v3
|
|
55
|
+
|
|
56
|
+
- name: Test stable
|
|
57
|
+
run: |
|
|
58
|
+
npmci node install stable
|
|
59
|
+
npmci npm install
|
|
60
|
+
npmci npm test
|
|
61
|
+
|
|
62
|
+
- name: Test build
|
|
63
|
+
run: |
|
|
64
|
+
npmci node install stable
|
|
65
|
+
npmci npm install
|
|
66
|
+
npmci npm build
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
name: Default (tags)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '*'
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
|
10
|
+
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@code.foss.global/${{gitea.repository}}.git
|
|
11
|
+
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
|
12
|
+
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
|
13
|
+
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
|
14
|
+
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
security:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
continue-on-error: true
|
|
20
|
+
container:
|
|
21
|
+
image: ${{ env.IMAGE }}
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v3
|
|
25
|
+
|
|
26
|
+
- name: Prepare
|
|
27
|
+
run: |
|
|
28
|
+
pnpm install -g pnpm
|
|
29
|
+
pnpm install -g @ship.zone/npmci
|
|
30
|
+
npmci npm prepare
|
|
31
|
+
|
|
32
|
+
- name: Audit production dependencies
|
|
33
|
+
run: |
|
|
34
|
+
npmci command npm config set registry https://registry.npmjs.org
|
|
35
|
+
npmci command pnpm audit --audit-level=high --prod
|
|
36
|
+
continue-on-error: true
|
|
37
|
+
|
|
38
|
+
- name: Audit development dependencies
|
|
39
|
+
run: |
|
|
40
|
+
npmci command npm config set registry https://registry.npmjs.org
|
|
41
|
+
npmci command pnpm audit --audit-level=high --dev
|
|
42
|
+
continue-on-error: true
|
|
43
|
+
|
|
44
|
+
test:
|
|
45
|
+
if: ${{ always() }}
|
|
46
|
+
needs: security
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
container:
|
|
49
|
+
image: ${{ env.IMAGE }}
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v3
|
|
53
|
+
|
|
54
|
+
- name: Prepare
|
|
55
|
+
run: |
|
|
56
|
+
pnpm install -g pnpm
|
|
57
|
+
pnpm install -g @ship.zone/npmci
|
|
58
|
+
npmci npm prepare
|
|
59
|
+
|
|
60
|
+
- name: Test stable
|
|
61
|
+
run: |
|
|
62
|
+
npmci node install stable
|
|
63
|
+
npmci npm install
|
|
64
|
+
npmci npm test
|
|
65
|
+
|
|
66
|
+
- name: Test build
|
|
67
|
+
run: |
|
|
68
|
+
npmci node install stable
|
|
69
|
+
npmci npm install
|
|
70
|
+
npmci npm build
|
|
71
|
+
|
|
72
|
+
release:
|
|
73
|
+
needs: test
|
|
74
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
container:
|
|
77
|
+
image: ${{ env.IMAGE }}
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/checkout@v3
|
|
81
|
+
|
|
82
|
+
- name: Prepare
|
|
83
|
+
run: |
|
|
84
|
+
pnpm install -g pnpm
|
|
85
|
+
pnpm install -g @ship.zone/npmci
|
|
86
|
+
npmci npm prepare
|
|
87
|
+
|
|
88
|
+
- name: Release
|
|
89
|
+
run: |
|
|
90
|
+
npmci node install stable
|
|
91
|
+
npmci npm publish
|
|
92
|
+
|
|
93
|
+
metadata:
|
|
94
|
+
needs: test
|
|
95
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
96
|
+
runs-on: ubuntu-latest
|
|
97
|
+
container:
|
|
98
|
+
image: ${{ env.IMAGE }}
|
|
99
|
+
continue-on-error: true
|
|
100
|
+
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v3
|
|
103
|
+
|
|
104
|
+
- name: Prepare
|
|
105
|
+
run: |
|
|
106
|
+
pnpm install -g pnpm
|
|
107
|
+
pnpm install -g @ship.zone/npmci
|
|
108
|
+
npmci npm prepare
|
|
109
|
+
|
|
110
|
+
- name: Code quality
|
|
111
|
+
run: |
|
|
112
|
+
npmci command npm install -g typescript
|
|
113
|
+
npmci npm install
|
|
114
|
+
|
|
115
|
+
- name: Trigger
|
|
116
|
+
run: npmci trigger
|
|
117
|
+
|
|
118
|
+
- name: Build docs and upload artifacts
|
|
119
|
+
run: |
|
|
120
|
+
npmci node install stable
|
|
121
|
+
npmci npm install
|
|
122
|
+
pnpm install -g @git.zone/tsdoc
|
|
123
|
+
npmci command tsdoc
|
|
124
|
+
continue-on-error: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"json.schemas": [
|
|
3
|
+
{
|
|
4
|
+
"fileMatch": ["/npmextra.json"],
|
|
5
|
+
"schema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"npmci": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"description": "settings for npmci"
|
|
11
|
+
},
|
|
12
|
+
"gitzone": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"description": "settings for gitzone",
|
|
15
|
+
"properties": {
|
|
16
|
+
"projectType": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["website", "element", "service", "npm", "wcc"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
package/changelog.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2026-01-12 - 3.0.2 - fix(devicemanager)
|
|
4
|
+
no changes detected - nothing to commit
|
|
5
|
+
|
|
6
|
+
- git diff indicates no modifications, additions, or deletions
|
|
7
|
+
- no files were changed in the provided diff
|
|
8
|
+
|
|
9
|
+
## 2026-01-12 - 3.0.1 - fix(release)
|
|
10
|
+
add npm registries to release config and expand documentation for UniversalDevice architecture and smart-home features
|
|
11
|
+
|
|
12
|
+
- npmextra.json: add "registries" to release configuration to publish to both Verdaccio (https://verdaccio.lossless.digital) and the npm registry
|
|
13
|
+
- readme.hints.md: rewritten/expanded implementation notes to describe the UniversalDevice architecture, composable features (including smart-home types like light, switch, sensor, climate, cover, lock, fan, camera), protocols, discovery, factories, interfaces, and testing guidance
|
|
14
|
+
- readme.md: add factory usage examples including smart-home factory functions, update txtRecords usage (rp) in examples, and small copy/emoji edits
|
|
15
|
+
|
|
16
|
+
## 2026-01-10 - 3.0.0 - BREAKING CHANGE(devicemanager)
|
|
17
|
+
migrate tests to new UniversalDevice/feature-based API, add device factories, SNMP protocol/feature and IP helper utilities
|
|
18
|
+
|
|
19
|
+
- Replace protocol-specific device classes (Scanner, Printer) with UniversalDevice and feature objects (ScanFeature, PrintFeature, PlaybackFeature, VolumeFeature, PowerFeature, SnmpFeature)
|
|
20
|
+
- Add device factory functions: createScanner, createPrinter, createSpeaker, createUpsDevice
|
|
21
|
+
- Add DeviceManager.getDevices selector and updated selectDevice behavior (throws when no match)
|
|
22
|
+
- Expose SnmpProtocol and other protocol implementations
|
|
23
|
+
- Introduce IP helper utilities: isValidIp, cidrToIps, getLocalSubnet
|
|
24
|
+
- Update tests and logging to use feature-based APIs and factories (selectFeature/getFeature, hasFeature, featureCount)
|
|
25
|
+
|
|
26
|
+
## 2026-01-09 - 2.3.1 - fix(readme)
|
|
27
|
+
update README to comprehensive, TypeScript-first documentation covering installation, quick start, examples, API usage, events, error handling, requirements, credits, and legal/company information
|
|
28
|
+
|
|
29
|
+
- Rewrote readme.md with ~590 additional lines to provide a full usage guide and examples
|
|
30
|
+
- Added installation instructions for pnpm, npm, and yarn and badges for npm and license
|
|
31
|
+
- Documented OOP usage pattern (Discovery → Selection → Feature → Operation), event handling, and error handling examples
|
|
32
|
+
- Clarified requirements (Node.js 18+, TypeScript 5.0+), credits, license, trademark and company contact information
|
|
33
|
+
- Docs-only change — no code or API modifications
|
|
34
|
+
|
|
35
|
+
## 2026-01-09 - 2.3.0 - feat(devicemanager)
|
|
36
|
+
add selector-based device APIs, selectFeature helper, convenience discovery methods, and ESCL scan completion fallback
|
|
37
|
+
|
|
38
|
+
- Introduce IDeviceSelector and add selector support to getDevices(selector) to filter devices by id,address,name,model,manufacturer and feature capabilities.
|
|
39
|
+
- Add selectDevice(selector) which returns exactly one device (throws if none) and logs a warning if multiple matches are returned without a unique identifier.
|
|
40
|
+
- Deprecate getDevice(id) and getDeviceByAddress(address) in favor of selector-based retrieval methods.
|
|
41
|
+
- Add private matchesSelector(...) implementing exact identity checks (id,address), case-insensitive partial attribute matching (name, model, manufacturer), and feature availability checks (hasFeature, hasFeatures, hasAnyFeature).
|
|
42
|
+
- Add selectFeature(type) on devices to provide fail-fast access to a required feature (throws if missing).
|
|
43
|
+
- Add discoverScanners(subnet, options) and discoverPrinters(subnet, options) convenience methods that run targeted network scans and return discovered scanners or printers respectively.
|
|
44
|
+
- Improve ESCL protocol waitForScanComplete to attempt a direct download first (which triggers/blocks on many scanners) and fall back to polling if direct download fails or returns empty data.
|
|
45
|
+
|
|
46
|
+
## 2026-01-09 - 2.2.0 - feat(smarthome)
|
|
47
|
+
add smart home features and Home Assistant integration (WebSocket protocol, discovery, factories, interfaces)
|
|
48
|
+
|
|
49
|
+
- Add concrete smart home feature implementations: light, climate, sensor, switch, cover, lock, fan, camera.
|
|
50
|
+
- Introduce Home Assistant WebSocket protocol handler (protocol.homeassistant) and Home Assistant discovery via mDNS (discovery.classes.homeassistant).
|
|
51
|
+
- Add generic smart home interfaces and Home Assistant-specific interfaces (smarthome.interfaces, homeassistant.interfaces) and export them.
|
|
52
|
+
- Add smart home factories to create devices for discovered/declared smart home entities and export factory helpers.
|
|
53
|
+
- Update plugins to include WebSocket (ws) and add ws dependency and @types/ws in package.json.
|
|
54
|
+
|
|
55
|
+
## 2026-01-09 - 2.1.0 - feat(devicemanager)
|
|
56
|
+
prefer higher-priority discovery source when resolving device names and track per-device name source
|
|
57
|
+
|
|
58
|
+
- Add TNameSource type and NAME_SOURCE_PRIORITY to rank name sources (generic, manual, airplay, chromecast, mdns, dlna, sonos).
|
|
59
|
+
- Replace chooseBestName with shouldUpdateName that validates 'real' names and uses source priority when deciding to update a device name.
|
|
60
|
+
- Add nameSourceByIp map to track which discovery source provided the current name and persist updates during registration.
|
|
61
|
+
- Register devices with an explicit nameSource (e.g. 'mdns', 'dlna', 'sonos', 'manual') and map speaker protocols to appropriate name sources.
|
|
62
|
+
- Ensure manual additions use 'manual' source and non-real names default to 'generic'.
|
|
63
|
+
- Clear nameSourceByIp entries when devices are removed/disconnected and on shutdown.
|
|
64
|
+
|
|
65
|
+
## 2026-01-09 - 2.0.0 - BREAKING CHANGE(core)
|
|
66
|
+
rework core device architecture: consolidate protocols into a protocols/ module, introduce UniversalDevice + factories, and remove many legacy device-specific classes (breaking API changes)
|
|
67
|
+
|
|
68
|
+
- Consolidated protocol implementations into ts/protocols and added protocols/index.ts for unified exports.
|
|
69
|
+
- Added device factory layer at ts/factories/index.ts to create UniversalDevice instances with appropriate features.
|
|
70
|
+
- Introduced protocols/protocol.upssnmp.ts (UPS SNMP handler) and other protocol reorganizations.
|
|
71
|
+
- Removed legacy concrete device classes and related files (Device abstract, Scanner, Printer, SnmpDevice, UpsDevice, DlnaRenderer/Server, Speaker and Sonos/AirPlay/Chromecast implementations).
|
|
72
|
+
- Updated top-level ts/index.ts exports to prefer UniversalDevice, factories and the new protocols module.
|
|
73
|
+
- Updated feature and discovery modules to import protocols from the new protocols index (import path changes).
|
|
74
|
+
- BREAKING: Consumers must update imports and device creation flows to use the new factories/UniversalDevice and protocols exports instead of the removed legacy classes.
|
|
75
|
+
|
|
76
|
+
## 2026-01-09 - 1.1.0 - feat(devicemanager)
|
|
77
|
+
Introduce a UniversalDevice architecture with composable Feature system; add extensive new device/protocol support and discovery/refactors
|
|
78
|
+
|
|
79
|
+
- Add UniversalDevice class and Feature abstraction with concrete features: scan, print, playback, volume, power, snmp, dlna-render/serve.
|
|
80
|
+
- Add SSDP discovery and DLNA implementations (renderer + server) and integrate SSDP into DeviceManager.
|
|
81
|
+
- Add speaker subsystem and concrete speaker implementations: Sonos, AirPlay, Chromecast, plus generic Speaker API and Volume/Playback features.
|
|
82
|
+
- Add SNMP feature and SNMP device handling plus UPS support (NUT and UPS SNMP handlers and UpsDevice).
|
|
83
|
+
- Refactor protocol implementations: move/replace scanner/printer protocol code into protocols/ (eSCL, SANE, IPP) and update network scanner to probe additional ports (AirPlay, Sonos, Chromecast) and device types.
|
|
84
|
+
- Update exports (ts/index.ts) to expose new modules, types and helpers; update plugins import handling (node-ssdp default export compatibility).
|
|
85
|
+
- Add developer docs readme.hints.md describing new architecture and feature APIs, and various helper fixes (iprange/os import, typed socket handlers).
|
|
86
|
+
|
|
87
|
+
## 2026-01-09 - 1.0.1 - initial
|
|
88
|
+
Initial project release.
|
|
89
|
+
|
|
90
|
+
- Project initialized (initial commit).
|
|
91
|
+
- Duplicate initial commits consolidated into this release.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* autocreated commitinfo by @push.rocks/commitinfo
|
|
3
|
+
*/
|
|
4
|
+
export const commitinfo = {
|
|
5
|
+
name: '@ecobridge.xyz/devicemanager',
|
|
6
|
+
version: '3.0.2',
|
|
7
|
+
description: 'a device manager for talking to devices on network and over usb'
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSw4QkFBOEI7SUFDcEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLGlFQUFpRTtDQUMvRSxDQUFBIn0=
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Device class
|
|
3
|
+
* A device is a network endpoint that can have multiple features (capabilities)
|
|
4
|
+
*/
|
|
5
|
+
import * as plugins from '../plugins.js';
|
|
6
|
+
import type { TFeatureType, IFeatureInfo, IDiscoveredFeature } from '../interfaces/feature.interfaces.js';
|
|
7
|
+
import type { TDeviceStatus, IRetryOptions } from '../interfaces/index.js';
|
|
8
|
+
import { Feature, type TDeviceReference } from '../features/feature.abstract.js';
|
|
9
|
+
/**
|
|
10
|
+
* Serializable device information
|
|
11
|
+
*/
|
|
12
|
+
export interface IUniversalDeviceInfo {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
address: string;
|
|
16
|
+
port: number;
|
|
17
|
+
status: TDeviceStatus;
|
|
18
|
+
manufacturer?: string;
|
|
19
|
+
model?: string;
|
|
20
|
+
serialNumber?: string;
|
|
21
|
+
firmwareVersion?: string;
|
|
22
|
+
features: IFeatureInfo[];
|
|
23
|
+
featureTypes: TFeatureType[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for creating a device
|
|
27
|
+
*/
|
|
28
|
+
export interface IDeviceCreateOptions {
|
|
29
|
+
name?: string;
|
|
30
|
+
manufacturer?: string;
|
|
31
|
+
model?: string;
|
|
32
|
+
serialNumber?: string;
|
|
33
|
+
firmwareVersion?: string;
|
|
34
|
+
retryOptions?: IRetryOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Universal Device - represents any network device with composable features
|
|
38
|
+
*
|
|
39
|
+
* Instead of having separate Scanner, Printer, Speaker classes, a Device can have
|
|
40
|
+
* any combination of features (scan, print, playback, volume, etc.)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // A multifunction printer/scanner
|
|
45
|
+
* const mfp = new UniversalDevice('192.168.1.100', 80);
|
|
46
|
+
* mfp.addFeature(new ScanFeature(mfp, 80));
|
|
47
|
+
* mfp.addFeature(new PrintFeature(mfp, 631));
|
|
48
|
+
*
|
|
49
|
+
* // Check capabilities
|
|
50
|
+
* if (mfp.hasFeature('scan') && mfp.hasFeature('print')) {
|
|
51
|
+
* const scanFeature = mfp.getFeature<ScanFeature>('scan');
|
|
52
|
+
* await scanFeature.scan({ format: 'pdf' });
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class UniversalDevice extends plugins.events.EventEmitter {
|
|
57
|
+
/**
|
|
58
|
+
* Unique device identifier
|
|
59
|
+
* Format: {address}:{port} or custom ID from discovery
|
|
60
|
+
*/
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Human-readable device name
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/**
|
|
67
|
+
* Device network address (IP or hostname)
|
|
68
|
+
*/
|
|
69
|
+
readonly address: string;
|
|
70
|
+
/**
|
|
71
|
+
* Primary device port
|
|
72
|
+
*/
|
|
73
|
+
readonly port: number;
|
|
74
|
+
/**
|
|
75
|
+
* Device manufacturer
|
|
76
|
+
*/
|
|
77
|
+
manufacturer?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Device model
|
|
80
|
+
*/
|
|
81
|
+
model?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Device serial number
|
|
84
|
+
*/
|
|
85
|
+
serialNumber?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Device firmware version
|
|
88
|
+
*/
|
|
89
|
+
firmwareVersion?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Current device status
|
|
92
|
+
*/
|
|
93
|
+
protected _status: TDeviceStatus;
|
|
94
|
+
/**
|
|
95
|
+
* Map of features by type
|
|
96
|
+
*/
|
|
97
|
+
protected _features: Map<TFeatureType, Feature>;
|
|
98
|
+
/**
|
|
99
|
+
* Retry options for features
|
|
100
|
+
*/
|
|
101
|
+
protected _retryOptions: IRetryOptions;
|
|
102
|
+
constructor(address: string, port: number, options?: IDeviceCreateOptions);
|
|
103
|
+
/**
|
|
104
|
+
* Get current device status
|
|
105
|
+
*/
|
|
106
|
+
get status(): TDeviceStatus;
|
|
107
|
+
/**
|
|
108
|
+
* Set device status
|
|
109
|
+
*/
|
|
110
|
+
set status(value: TDeviceStatus);
|
|
111
|
+
/**
|
|
112
|
+
* Check if device is online
|
|
113
|
+
*/
|
|
114
|
+
get isOnline(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Add a feature to the device
|
|
117
|
+
*/
|
|
118
|
+
addFeature(feature: Feature): void;
|
|
119
|
+
/**
|
|
120
|
+
* Remove a feature from the device
|
|
121
|
+
*/
|
|
122
|
+
removeFeature(type: TFeatureType): Promise<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* Check if device has a specific feature
|
|
125
|
+
*/
|
|
126
|
+
hasFeature(type: TFeatureType): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Check if device has all specified features
|
|
129
|
+
*/
|
|
130
|
+
hasFeatures(types: TFeatureType[]): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Check if device has any of the specified features
|
|
133
|
+
*/
|
|
134
|
+
hasAnyFeature(types: TFeatureType[]): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Get a feature by type (returns undefined if not available)
|
|
137
|
+
*/
|
|
138
|
+
getFeature<T extends Feature>(type: TFeatureType): T | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Select a feature by type (throws if not available).
|
|
141
|
+
* Use this when you expect the device to have this feature and want fail-fast behavior.
|
|
142
|
+
*
|
|
143
|
+
* @param type The feature type to select
|
|
144
|
+
* @returns The feature instance
|
|
145
|
+
* @throws Error if the device does not have this feature
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const scanFeature = device.selectFeature<ScanFeature>('scan');
|
|
150
|
+
* await scanFeature.connect();
|
|
151
|
+
* const result = await scanFeature.scan({ source: 'flatbed' });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
selectFeature<T extends Feature>(type: TFeatureType): T;
|
|
155
|
+
/**
|
|
156
|
+
* Get all features
|
|
157
|
+
*/
|
|
158
|
+
getFeatures(): Feature[];
|
|
159
|
+
/**
|
|
160
|
+
* Get all feature types
|
|
161
|
+
*/
|
|
162
|
+
getFeatureTypes(): TFeatureType[];
|
|
163
|
+
/**
|
|
164
|
+
* Get feature count
|
|
165
|
+
*/
|
|
166
|
+
get featureCount(): number;
|
|
167
|
+
/**
|
|
168
|
+
* Connect all features
|
|
169
|
+
*/
|
|
170
|
+
connect(): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Connect a specific feature
|
|
173
|
+
*/
|
|
174
|
+
connectFeature(type: TFeatureType): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Disconnect all features
|
|
177
|
+
*/
|
|
178
|
+
disconnect(): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Disconnect a specific feature
|
|
181
|
+
*/
|
|
182
|
+
disconnectFeature(type: TFeatureType): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Get device reference for features
|
|
185
|
+
*/
|
|
186
|
+
getDeviceReference(): TDeviceReference;
|
|
187
|
+
/**
|
|
188
|
+
* Get serializable device info
|
|
189
|
+
*/
|
|
190
|
+
getDeviceInfo(): IUniversalDeviceInfo;
|
|
191
|
+
/**
|
|
192
|
+
* Get retry options for features
|
|
193
|
+
*/
|
|
194
|
+
get retryOptions(): IRetryOptions;
|
|
195
|
+
/**
|
|
196
|
+
* Create a device from discovered features
|
|
197
|
+
*/
|
|
198
|
+
static fromDiscovery(id: string, name: string, address: string, port: number, discoveredFeatures: IDiscoveredFeature[], options?: IDeviceCreateOptions): UniversalDevice;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Check if a device has a specific feature (type guard)
|
|
202
|
+
*/
|
|
203
|
+
export declare function deviceHasFeature<T extends Feature>(device: UniversalDevice, type: TFeatureType): device is UniversalDevice & {
|
|
204
|
+
getFeature(type: TFeatureType): T;
|
|
205
|
+
};
|