node-hp-scan-to 1.2.2 → 1.3.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.
- package/LICENSE +21 -0
- package/README.md +47 -10
- package/dist/Destination.js +36 -84
- package/dist/Destination.js.map +1 -1
- package/dist/DeviceCapabilities.d.ts +4 -0
- package/dist/DeviceCapabilities.js +3 -0
- package/dist/DeviceCapabilities.js.map +1 -0
- package/dist/DiscoveryTree.d.ts +16 -0
- package/dist/DiscoveryTree.js +38 -0
- package/dist/DiscoveryTree.js.map +1 -0
- package/dist/Event.d.ts +1 -1
- package/dist/Event.js +24 -39
- package/dist/Event.js.map +1 -1
- package/dist/EventTable.d.ts +5 -0
- package/dist/EventTable.js +24 -18
- package/dist/EventTable.js.map +1 -1
- package/dist/HPApi.d.ts +26 -18
- package/dist/HPApi.js +386 -461
- package/dist/HPApi.js.map +1 -1
- package/dist/Job.d.ts +8 -7
- package/dist/Job.js +69 -86
- package/dist/Job.js.map +1 -1
- package/dist/JpegUtil.js +73 -82
- package/dist/JpegUtil.js.map +1 -1
- package/dist/KnownShortcut.d.ts +1 -0
- package/dist/KnownShortcut.js +3 -0
- package/dist/KnownShortcut.js.map +1 -0
- package/dist/PathHelper.d.ts +2 -1
- package/dist/PathHelper.js +41 -68
- package/dist/PathHelper.js.map +1 -1
- package/dist/ScanCaps.d.ts +7 -0
- package/dist/ScanCaps.js +17 -0
- package/dist/ScanCaps.js.map +1 -0
- package/dist/ScanContent.js +18 -73
- package/dist/ScanContent.js.map +1 -1
- package/dist/ScanJobManifest.d.ts +23 -0
- package/dist/ScanJobManifest.js +24 -0
- package/dist/ScanJobManifest.js.map +1 -0
- package/dist/ScanJobSettings.d.ts +3 -1
- package/dist/ScanJobSettings.js +48 -88
- package/dist/ScanJobSettings.js.map +1 -1
- package/dist/ScanStatus.d.ts +1 -0
- package/dist/ScanStatus.js +27 -28
- package/dist/ScanStatus.js.map +1 -1
- package/dist/WalkupScanDestination.d.ts +11 -13
- package/dist/WalkupScanDestination.js +32 -35
- package/dist/WalkupScanDestination.js.map +1 -1
- package/dist/WalkupScanDestinations.d.ts +1 -0
- package/dist/WalkupScanDestinations.js +21 -18
- package/dist/WalkupScanDestinations.js.map +1 -1
- package/dist/WalkupScanManifest.d.ts +23 -0
- package/dist/WalkupScanManifest.js +25 -0
- package/dist/WalkupScanManifest.js.map +1 -0
- package/dist/WalkupScanToCompCaps.d.ts +12 -0
- package/dist/WalkupScanToCompCaps.js +20 -0
- package/dist/WalkupScanToCompCaps.js.map +1 -0
- package/dist/WalkupScanToCompDestination.d.ts +10 -14
- package/dist/WalkupScanToCompDestination.js +32 -38
- package/dist/WalkupScanToCompDestination.js.map +1 -1
- package/dist/WalkupScanToCompDestinations.d.ts +1 -0
- package/dist/WalkupScanToCompDestinations.js +21 -18
- package/dist/WalkupScanToCompDestinations.js.map +1 -1
- package/dist/WalkupScanToCompEvent.d.ts +2 -1
- package/dist/WalkupScanToCompEvent.js +14 -11
- package/dist/WalkupScanToCompEvent.js.map +1 -1
- package/dist/WalkupScanToCompManifest.d.ts +23 -0
- package/dist/WalkupScanToCompManifest.js +25 -0
- package/dist/WalkupScanToCompManifest.js.map +1 -0
- package/dist/delay.d.ts +1 -0
- package/dist/delay.js +10 -0
- package/dist/delay.js.map +1 -0
- package/dist/fixJpegSize.d.ts +19 -0
- package/dist/fixJpegSize.js +292 -0
- package/dist/fixJpegSize.js.map +1 -0
- package/dist/index.js +209 -607
- package/dist/index.js.map +1 -1
- package/dist/listening.d.ts +9 -0
- package/dist/listening.js +108 -0
- package/dist/listening.js.map +1 -0
- package/dist/models/Destination.d.ts +8 -0
- package/dist/models/Destination.js +68 -0
- package/dist/models/Destination.js.map +1 -0
- package/dist/models/DiscoveryTree.d.ts +16 -0
- package/dist/models/DiscoveryTree.js +38 -0
- package/dist/models/DiscoveryTree.js.map +1 -0
- package/dist/models/Event.d.ts +21 -0
- package/dist/models/Event.js +32 -0
- package/dist/models/Event.js.map +1 -0
- package/dist/models/EventTable.d.ts +16 -0
- package/dist/models/EventTable.js +33 -0
- package/dist/models/EventTable.js.map +1 -0
- package/dist/models/Job.d.ts +37 -0
- package/dist/models/Job.js +78 -0
- package/dist/models/Job.js.map +1 -0
- package/dist/models/ScanCaps.d.ts +7 -0
- package/dist/models/ScanCaps.js +17 -0
- package/dist/models/ScanCaps.js.map +1 -0
- package/dist/models/ScanJobManifest.d.ts +23 -0
- package/dist/models/ScanJobManifest.js +24 -0
- package/dist/models/ScanJobManifest.js.map +1 -0
- package/dist/models/ScanJobSettings.d.ts +8 -0
- package/dist/models/ScanJobSettings.js +56 -0
- package/dist/models/ScanJobSettings.js.map +1 -0
- package/dist/models/WalkupScanDestination.d.ts +22 -0
- package/dist/models/WalkupScanDestination.js +38 -0
- package/dist/models/WalkupScanDestination.js.map +1 -0
- package/dist/models/WalkupScanDestinations.d.ts +12 -0
- package/dist/models/WalkupScanDestinations.js +30 -0
- package/dist/models/WalkupScanDestinations.js.map +1 -0
- package/dist/models/WalkupScanManifest.d.ts +23 -0
- package/dist/models/WalkupScanManifest.js +25 -0
- package/dist/models/WalkupScanManifest.js.map +1 -0
- package/dist/models/WalkupScanToCompCaps.d.ts +12 -0
- package/dist/models/WalkupScanToCompCaps.js +20 -0
- package/dist/models/WalkupScanToCompCaps.js.map +1 -0
- package/dist/models/WalkupScanToCompDestination.d.ts +22 -0
- package/dist/models/WalkupScanToCompDestination.js +38 -0
- package/dist/models/WalkupScanToCompDestination.js.map +1 -0
- package/dist/models/WalkupScanToCompDestinations.d.ts +12 -0
- package/dist/models/WalkupScanToCompDestinations.js +30 -0
- package/dist/models/WalkupScanToCompDestinations.js.map +1 -0
- package/dist/models/WalkupScanToCompEvent.d.ts +11 -0
- package/dist/models/WalkupScanToCompEvent.js +20 -0
- package/dist/models/WalkupScanToCompEvent.js.map +1 -0
- package/dist/models/WalkupScanToCompManifest.d.ts +23 -0
- package/dist/models/WalkupScanToCompManifest.js +25 -0
- package/dist/models/WalkupScanToCompManifest.js.map +1 -0
- package/dist/readDeviceCapabilities.d.ts +2 -0
- package/dist/readDeviceCapabilities.js +41 -0
- package/dist/readDeviceCapabilities.js.map +1 -0
- package/dist/scanProcess.d.ts +19 -0
- package/dist/scanProcess.js +292 -0
- package/dist/scanProcess.js.map +1 -0
- package/dist/scanProcessing.d.ts +20 -0
- package/dist/scanProcessing.js +320 -0
- package/dist/scanProcessing.js.map +1 -0
- package/dist/src/Destination.d.ts +8 -0
- package/dist/src/Destination.js +68 -0
- package/dist/src/Destination.js.map +1 -0
- package/dist/src/DiscoveryTree.d.ts +16 -0
- package/dist/src/DiscoveryTree.js +38 -0
- package/dist/src/DiscoveryTree.js.map +1 -0
- package/dist/src/Event.d.ts +21 -0
- package/dist/src/Event.js +32 -0
- package/dist/src/Event.js.map +1 -0
- package/dist/src/EventTable.d.ts +16 -0
- package/dist/src/EventTable.js +33 -0
- package/dist/src/EventTable.js.map +1 -0
- package/dist/src/HPApi.d.ts +50 -0
- package/dist/src/HPApi.js +454 -0
- package/dist/src/HPApi.js.map +1 -0
- package/dist/src/Job.d.ts +37 -0
- package/dist/src/Job.js +78 -0
- package/dist/src/Job.js.map +1 -0
- package/dist/src/JpegUtil.d.ts +26 -0
- package/dist/src/JpegUtil.js +229 -0
- package/dist/src/JpegUtil.js.map +1 -0
- package/dist/src/KnownShortcut.d.ts +1 -0
- package/dist/src/KnownShortcut.js +3 -0
- package/dist/src/KnownShortcut.js.map +1 -0
- package/dist/src/PathHelper.d.ts +6 -0
- package/dist/src/PathHelper.js +52 -0
- package/dist/src/PathHelper.js.map +1 -0
- package/dist/src/ScanCaps.d.ts +7 -0
- package/dist/src/ScanCaps.js +17 -0
- package/dist/src/ScanCaps.js.map +1 -0
- package/dist/src/ScanJobManifest.d.ts +23 -0
- package/dist/src/ScanJobManifest.js +24 -0
- package/dist/src/ScanJobManifest.js.map +1 -0
- package/dist/src/ScanJobSettings.d.ts +8 -0
- package/dist/src/ScanJobSettings.js +56 -0
- package/dist/src/ScanJobSettings.js.map +1 -0
- package/dist/src/ScanStatus.d.ts +19 -0
- package/dist/src/ScanStatus.js +35 -0
- package/dist/src/ScanStatus.js.map +1 -0
- package/dist/src/WalkupScanDestination.d.ts +22 -0
- package/dist/src/WalkupScanDestination.js +38 -0
- package/dist/src/WalkupScanDestination.js.map +1 -0
- package/dist/src/WalkupScanDestinations.d.ts +12 -0
- package/dist/src/WalkupScanDestinations.js +30 -0
- package/dist/src/WalkupScanDestinations.js.map +1 -0
- package/dist/src/WalkupScanManifest.d.ts +23 -0
- package/dist/src/WalkupScanManifest.js +25 -0
- package/dist/src/WalkupScanManifest.js.map +1 -0
- package/dist/src/WalkupScanToCompCaps.d.ts +12 -0
- package/dist/src/WalkupScanToCompCaps.js +20 -0
- package/dist/src/WalkupScanToCompCaps.js.map +1 -0
- package/dist/src/WalkupScanToCompDestination.d.ts +22 -0
- package/dist/src/WalkupScanToCompDestination.js +38 -0
- package/dist/src/WalkupScanToCompDestination.js.map +1 -0
- package/dist/src/WalkupScanToCompDestinations.d.ts +12 -0
- package/dist/src/WalkupScanToCompDestinations.js +30 -0
- package/dist/src/WalkupScanToCompDestinations.js.map +1 -0
- package/dist/src/WalkupScanToCompEvent.d.ts +11 -0
- package/dist/src/WalkupScanToCompEvent.js +20 -0
- package/dist/src/WalkupScanToCompEvent.js.map +1 -0
- package/dist/src/WalkupScanToCompManifest.d.ts +23 -0
- package/dist/src/WalkupScanToCompManifest.js +25 -0
- package/dist/src/WalkupScanToCompManifest.js.map +1 -0
- package/dist/src/delay.d.ts +1 -0
- package/dist/src/delay.js +10 -0
- package/dist/src/delay.js.map +1 -0
- package/dist/test/DiscoveryTree.test.d.ts +1 -0
- package/dist/test/DiscoveryTree.test.js +68 -0
- package/dist/test/DiscoveryTree.test.js.map +1 -0
- package/dist/test/EtagEventTable.test.d.ts +1 -0
- package/dist/test/EtagEventTable.test.js +93 -0
- package/dist/test/EtagEventTable.test.js.map +1 -0
- package/dist/test/Job.test.d.ts +1 -0
- package/dist/test/Job.test.js +104 -0
- package/dist/test/Job.test.js.map +1 -0
- package/dist/test/JpegUtil.test.d.ts +1 -0
- package/dist/test/JpegUtil.test.js +51 -0
- package/dist/test/JpegUtil.test.js.map +1 -0
- package/dist/test/PathHelper.test.d.ts +1 -0
- package/dist/test/PathHelper.test.js +99 -0
- package/dist/test/PathHelper.test.js.map +1 -0
- package/dist/test/ScanJobManifest.test.d.ts +1 -0
- package/dist/test/ScanJobManifest.test.js +56 -0
- package/dist/test/ScanJobManifest.test.js.map +1 -0
- package/dist/test/ScanJobSettings.test.d.ts +1 -0
- package/dist/test/ScanJobSettings.test.js +53 -0
- package/dist/test/ScanJobSettings.test.js.map +1 -0
- package/dist/test/ScanStatus.test.d.ts +1 -0
- package/dist/test/ScanStatus.test.js +75 -0
- package/dist/test/ScanStatus.test.js.map +1 -0
- package/dist/test/WalkupScanDestination.test.d.ts +1 -0
- package/dist/test/WalkupScanDestination.test.js +80 -0
- package/dist/test/WalkupScanDestination.test.js.map +1 -0
- package/dist/test/WalkupScanDestinations.test.d.ts +1 -0
- package/dist/test/WalkupScanDestinations.test.js +68 -0
- package/dist/test/WalkupScanDestinations.test.js.map +1 -0
- package/dist/test/WalkupScanManifest.test.d.ts +1 -0
- package/dist/test/WalkupScanManifest.test.js +46 -0
- package/dist/test/WalkupScanManifest.test.js.map +1 -0
- package/dist/test/WalkupScanToCompCaps.test.d.ts +1 -0
- package/dist/test/WalkupScanToCompCaps.test.js +56 -0
- package/dist/test/WalkupScanToCompCaps.test.js.map +1 -0
- package/dist/test/WalkupScanToCompDestination.test.d.ts +1 -0
- package/dist/test/WalkupScanToCompDestination.test.js +58 -0
- package/dist/test/WalkupScanToCompDestination.test.js.map +1 -0
- package/dist/test/WalkupScanToCompDestinations.test.d.ts +1 -0
- package/dist/test/WalkupScanToCompDestinations.test.js +58 -0
- package/dist/test/WalkupScanToCompDestinations.test.js.map +1 -0
- package/dist/test/WalkupScanToCompEvent.test.d.ts +1 -0
- package/dist/test/WalkupScanToCompEvent.test.js +46 -0
- package/dist/test/WalkupScanToCompEvent.test.js.map +1 -0
- package/dist/test/WalkupScanToCompManifest.test.d.ts +1 -0
- package/dist/test/WalkupScanToCompManifest.test.js +46 -0
- package/dist/test/WalkupScanToCompManifest.test.js.map +1 -0
- package/dist/test/clean.d.ts +1 -0
- package/dist/test/clean.js +21 -0
- package/dist/test/clean.js.map +1 -0
- package/package.json +27 -18
- package/src/Destination.ts +1 -1
- package/src/DeviceCapabilities.ts +4 -0
- package/src/DiscoveryTree.ts +56 -0
- package/src/Event.ts +17 -7
- package/src/EventTable.ts +20 -0
- package/src/HPApi.ts +245 -103
- package/src/Job.ts +51 -29
- package/src/JpegUtil.ts +8 -4
- package/src/KnownShortcut.ts +6 -0
- package/src/PathHelper.ts +47 -13
- package/src/ScanCaps.ts +19 -0
- package/src/ScanContent.ts +4 -1
- package/src/ScanJobManifest.ts +55 -0
- package/src/ScanJobSettings.ts +18 -3
- package/src/ScanStatus.ts +9 -0
- package/src/WalkupScanDestination.ts +42 -18
- package/src/WalkupScanDestinations.ts +12 -0
- package/src/WalkupScanManifest.ts +59 -0
- package/src/WalkupScanToCompCaps.ts +36 -0
- package/src/WalkupScanToCompDestination.ts +38 -24
- package/src/WalkupScanToCompDestinations.ts +12 -0
- package/src/WalkupScanToCompEvent.ts +15 -3
- package/src/WalkupScanToCompManifest.ts +59 -0
- package/src/delay.ts +5 -0
- package/src/index.ts +267 -465
- package/src/listening.ts +145 -0
- package/src/readDeviceCapabilities.ts +46 -0
- package/src/scanProcessing.ts +535 -0
- package/tsconfig.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Emmanuel Counasse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# node-hp-scan-to
|
|
2
2
|
|
|
3
|
+

|
|
3
4
|
[](https://app.travis-ci.com/manuc66/node-hp-scan-to)
|
|
5
|
+

|
|
4
6
|
[](https://www.npmjs.com/package/node-hp-scan-to)
|
|
5
7
|
[](https://hub.docker.com/repository/docker/manuc66/node-hp-scan-to)
|
|
6
8
|
[](https://gitter.im/node-hp-scan-to/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
9
|
+
[](https://www.codefactor.io/repository/github/manuc66/node-hp-scan-to)
|
|
10
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fmanuc66%2Fnode-hp-scan-to?ref=badge_shield)
|
|
7
11
|
|
|
8
12
|
Little command line program that allow to send scan from device to computer.
|
|
9
13
|
|
|
@@ -15,8 +19,11 @@ Developed and tested for the following HP All-in-One Printers:
|
|
|
15
19
|
- HP Smart Tank Plus 570 series
|
|
16
20
|
|
|
17
21
|
The following printer are also working:
|
|
18
|
-
-
|
|
22
|
+
- HP Deskjet 3050 All-in-One Printer - J610a
|
|
23
|
+
- HP Officejet 5230
|
|
24
|
+
- HP Officejet 6700 premium
|
|
19
25
|
- HP Officejet 5740
|
|
26
|
+
- HP Officejet 6950
|
|
20
27
|
- HP OfficeJet Pro 8025e
|
|
21
28
|
|
|
22
29
|
There are good chances it also works on your HP All-in-One Printer.
|
|
@@ -24,7 +31,34 @@ For this purpose, the original HP Windows application's interaction with the dev
|
|
|
24
31
|
|
|
25
32
|
This project is not endorsed by nor affiliated with HP.
|
|
26
33
|
|
|
34
|
+
## Supported features
|
|
35
|
+
- ✔️ JPG scan output
|
|
36
|
+
- ✔️ PDF document scan output
|
|
37
|
+
- ✔️ Scan from automatic document feeder
|
|
38
|
+
- ✔️ Dual side with automatic document feeder
|
|
39
|
+
- ✔️ Multi page from platen
|
|
40
|
+
- ✔️ Automatic IP address discovery
|
|
41
|
+
- ✔️ Prebuilt Docker images (multi arch)
|
|
42
|
+
- ✔️ Command line support (Cross platform)
|
|
43
|
+
- ✔️ Customizable file names
|
|
44
|
+
- ✔️ Customizable resolution
|
|
45
|
+
- ✔️ Customizable label on the device
|
|
46
|
+
|
|
27
47
|
## Usage
|
|
48
|
+
|
|
49
|
+
### Command line
|
|
50
|
+
`npx node-hp-scan-to`
|
|
51
|
+
|
|
52
|
+
- `-ip` or `--address` followed by the ip address of the printer, i.e. `-ip 192.168.0.5`. This overrides `-p`.
|
|
53
|
+
- `-l` or `--label` The label to display on the printer (default is the hostname).
|
|
54
|
+
- `-n` or `--name` followed by the printer name, it probably contains spaces, so it needs to be quoted, i.e. `-name "Officejet 6500 E710n-z"`
|
|
55
|
+
- `-d` or `--directory` followed by the directory path where the scanned documents should be saved, i.e. `-d ~/Documents/Scans`. Defaults to `/tmp/scan-to-pc<random value>` when not set.
|
|
56
|
+
- `-t` or `--temp-directory` Temp directory used for processing. Defaults to `/tmp/scan-to-pc<random value>` when not set.
|
|
57
|
+
- `-p` or `--pattern` followed by the pattern for the filename without file extension, i.e. `"scan"_dd.mm.yyyy_hh:MM:ss` to name the scanned file `scan_19.04.2021_17:26:47`. Date and time patterns are replaced by the current date and time, text that should not be replaced need to be inside quotes. Documentation for the pattern can be found [here](https://www.npmjs.com/package/dateformat) in the section `Mask options`. Defaults to `scan<increasing number>_page<page number>` when not set.
|
|
58
|
+
- `-r` or `--resolution` Resolution in DPI of the scans (defaults is 200).
|
|
59
|
+
- `-D, --debug"` enables debug logs.
|
|
60
|
+
|
|
61
|
+
If you wish to test it by cloning this repository:
|
|
28
62
|
```sh
|
|
29
63
|
git clone ...
|
|
30
64
|
cd node-hp-scan-to
|
|
@@ -34,13 +68,6 @@ yarn build
|
|
|
34
68
|
node dist/index.js -ip 192.168.1.4 # or -n "Officejet 6500 E710n-z"
|
|
35
69
|
```
|
|
36
70
|
|
|
37
|
-
### Command line options
|
|
38
|
-
- `-ip` or `--address` followed by the ip address of the printer, i.e. `-ip 192.168.0.5`. This overrides `-p`.
|
|
39
|
-
- `-n` or `--name` followed by the printer name, it probably contains spaces, so it needs to be quoted, i.e. `-name "Officejet 6500 E710n-z"`
|
|
40
|
-
- `-d` or `--directory` followed by the directory path where the scanned documents should be saved, i.e. `-d ~/Documents/Scans`. Defaults to `/tmp/scan-to-pc<random value>` when not set.
|
|
41
|
-
- `-p` or `--pattern` followed by the pattern for the filename without file extension, i.e. `"scan"_dd.mm.yyyy_hh:MM:ss` to name the scanned file `scan_19.04.2021_17:26:47`. Date and time patterns are replaced by the current date and time, text that should not be replaced need to be inside quotes. Documentation for the pattern can be found [here](https://www.npmjs.com/package/dateformat) in the section `Mask options`. Defaults to `scan<increasing number>_page<page number>` when not set.
|
|
42
|
-
- `-D, --debug"` enables debug logs.
|
|
43
|
-
|
|
44
71
|
### Run with docker
|
|
45
72
|
Be aware that with docker you have to specify the ip address of the printer via the `IP` environment variable, because
|
|
46
73
|
bonjour service discovery uses multicast network traffic which by default doesn't work in docker.
|
|
@@ -49,7 +76,7 @@ You could however use docker's macvlan networking, this way you can use service
|
|
|
49
76
|
All scanned files are written to the volume `/scan`, the filename can be changed with the `PATTERN` environment variable.
|
|
50
77
|
For the correct permissions to the volume set the environment variables `PUID` and `PGID`.
|
|
51
78
|
|
|
52
|
-
|
|
79
|
+
__To enable debug logs set the environment variable `CMDLINE` to `-D`.__ Can also be used for any other command line parameters.
|
|
53
80
|
|
|
54
81
|
The name shown on the printer's display is the hostname of the docker container, which defaults to a random value, so you may want to specify it via the `-hostname` argument.
|
|
55
82
|
|
|
@@ -87,8 +114,18 @@ Then run `docker-compose up -d --build`.
|
|
|
87
114
|
To
|
|
88
115
|
|
|
89
116
|
Public Pre-built Docker image:
|
|
90
|
-
- https://hub.docker.com/repository/docker/manuc66/node-hp-scan-to
|
|
117
|
+
- https://hub.docker.com/repository/docker/manuc66/node-hp-scan-to (take master: `docker pull manuc66/node-hp-scan-to:master`)
|
|
91
118
|
|
|
92
119
|
## Debugging
|
|
93
120
|
I'm using Visual Studio Code to debug this application, so instead of running ts-node just enter `code .` and press F5 to start debugging.
|
|
94
121
|
You may want to set your printers ip or name in `.vscode/launch.json`.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## 💖 Support this project
|
|
125
|
+
If this project helped you save money or time or simply makes your life also easier, you can give me a cup of coffee =)
|
|
126
|
+
|
|
127
|
+
- [](https://www.paypal.me/manuc66)
|
|
128
|
+
- Bitcoin — You can send me bitcoins at this address: `33gxVjey6g4Beha26fSQZLFfWWndT1oY3F`
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fmanuc66%2Fnode-hp-scan-to?ref=badge_large)
|
package/dist/Destination.js
CHANGED
|
@@ -22,95 +22,47 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
26
|
+
const xml2js_1 = require("xml2js");
|
|
27
|
+
const util = __importStar(require("util"));
|
|
28
|
+
const parser = new xml2js_1.Parser();
|
|
29
|
+
class Destination {
|
|
30
|
+
constructor(name, hostname, toComp) {
|
|
67
31
|
this.name = name;
|
|
68
32
|
this.hostname = hostname;
|
|
69
33
|
this.linkType = "Network";
|
|
70
34
|
this.toComp = toComp;
|
|
71
35
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return [2 /*return*/, xml.replace(/WalkupScan/g, "WalkupScanToComp")];
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return [2 /*return*/, xml];
|
|
107
|
-
}
|
|
108
|
-
return [2 /*return*/];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
return Destination;
|
|
114
|
-
}());
|
|
36
|
+
async toXML() {
|
|
37
|
+
let rawDestination = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
38
|
+
if (this.toComp) {
|
|
39
|
+
rawDestination +=
|
|
40
|
+
'<WalkupScanDestination xmlns="http://www.hp.com/schemas/imaging/con/ledm/walkupscan/2010/09/28" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
|
41
|
+
'xsi:schemaLocation="http://www.hp.com/schemas/imaging/con/ledm/walkupscan/2010/09/28 WalkupScan.xsd">\n';
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
rawDestination +=
|
|
45
|
+
'<WalkupScanDestination xmlns="http://www.hp.com/schemas/imaging/con/rest/walkupscan/2009/09/21" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \n' +
|
|
46
|
+
'xsi:schemaLocation="http://www.hp.com/schemas/imaging/con/rest/walkupscan/2009/09/21 WalkupScanDestinations.xsd">\n';
|
|
47
|
+
}
|
|
48
|
+
rawDestination +=
|
|
49
|
+
'\t<Hostname xmlns="http://www.hp.com/schemas/imaging/con/dictionaries/2009/04/06"></Hostname>\n' +
|
|
50
|
+
'\t<Name xmlns="http://www.hp.com/schemas/imaging/con/dictionaries/1.0/"></Name>\n' +
|
|
51
|
+
"\t<LinkType>Network</LinkType>\n" +
|
|
52
|
+
"</WalkupScanDestination>";
|
|
53
|
+
const parsed = await util.promisify(parser.parseString)(rawDestination);
|
|
54
|
+
parsed.WalkupScanDestination.Hostname[0]._ = this.hostname;
|
|
55
|
+
parsed.WalkupScanDestination.Name[0]._ = this.name;
|
|
56
|
+
parsed.WalkupScanDestination.LinkType[0] = this.linkType;
|
|
57
|
+
let builder = new xml2js_1.Builder();
|
|
58
|
+
let xml = builder.buildObject(parsed);
|
|
59
|
+
if (this.toComp) {
|
|
60
|
+
return xml.replace(/WalkupScan/g, "WalkupScanToComp");
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return xml;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
115
67
|
exports.default = Destination;
|
|
116
68
|
//# sourceMappingURL=Destination.js.map
|
package/dist/Destination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Destination.js","sourceRoot":"","sources":["../src/Destination.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"Destination.js","sourceRoot":"","sources":["../src/Destination.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,mCAAyC;AACzC,2CAA6B;AAE7B,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAU5B,MAAqB,WAAW;IAM9B,YAAY,IAAY,EAAE,QAAgB,EAAE,MAAe;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,cAAc,GAAW,0CAA0C,CAAC;QACxE,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,cAAc;gBACZ,wJAAwJ;oBACxJ,yGAAyG,CAAC;SAC7G;aAAM;YACL,cAAc;gBACZ,0JAA0J;oBAC1J,qHAAqH,CAAC;SACzH;QAED,cAAc;YACZ,iGAAiG;gBACjG,mFAAmF;gBACnF,kCAAkC;gBAClC,0BAA0B,CAAC;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CACjC,MAAM,CAAC,WAAW,CACnB,CAAC,cAAc,CAAC,CAAC;QAElB,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3D,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QACnD,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAEzD,IAAI,OAAO,GAAG,IAAI,gBAAO,EAAE,CAAC;QAC5B,IAAI,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;SACvD;aAAM;YACL,OAAO,GAAG,CAAC;SACZ;IACH,CAAC;CACF;AA/CD,8BA+CC","sourcesContent":["\"use strict\";\n\nimport { Parser, Builder } from \"xml2js\";\nimport * as util from \"util\";\n\nconst parser = new Parser();\n\ntype WalkupScanDestinationData = {\n WalkupScanDestination: {\n Hostname: { _: string }[];\n Name: { _: string }[];\n LinkType: string[];\n };\n};\n\nexport default class Destination {\n private readonly name: string;\n private readonly hostname: string;\n private readonly linkType: string;\n private readonly toComp: boolean;\n\n constructor(name: string, hostname: string, toComp: boolean) {\n this.name = name;\n this.hostname = hostname;\n this.linkType = \"Network\";\n this.toComp = toComp;\n }\n\n async toXML() {\n let rawDestination: string = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\n if (this.toComp) {\n rawDestination +=\n '<WalkupScanDestination xmlns=\"http://www.hp.com/schemas/imaging/con/ledm/walkupscan/2010/09/28\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ' +\n 'xsi:schemaLocation=\"http://www.hp.com/schemas/imaging/con/ledm/walkupscan/2010/09/28 WalkupScan.xsd\">\\n';\n } else {\n rawDestination +=\n '<WalkupScanDestination xmlns=\"http://www.hp.com/schemas/imaging/con/rest/walkupscan/2009/09/21\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \\n' +\n 'xsi:schemaLocation=\"http://www.hp.com/schemas/imaging/con/rest/walkupscan/2009/09/21 WalkupScanDestinations.xsd\">\\n';\n }\n\n rawDestination +=\n '\\t<Hostname xmlns=\"http://www.hp.com/schemas/imaging/con/dictionaries/2009/04/06\"></Hostname>\\n' +\n '\\t<Name xmlns=\"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/\"></Name>\\n' +\n \"\\t<LinkType>Network</LinkType>\\n\" +\n \"</WalkupScanDestination>\";\n\n const parsed = await util.promisify<string, WalkupScanDestinationData>(\n parser.parseString\n )(rawDestination);\n\n parsed.WalkupScanDestination.Hostname[0]._ = this.hostname;\n parsed.WalkupScanDestination.Name[0]._ = this.name;\n parsed.WalkupScanDestination.LinkType[0] = this.linkType;\n\n let builder = new Builder();\n let xml = builder.buildObject(parsed);\n if (this.toComp) {\n return xml.replace(/WalkupScan/g, \"WalkupScanToComp\");\n } else {\n return xml;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceCapabilities.js","sourceRoot":"","sources":["../src/DeviceCapabilities.ts"],"names":[],"mappings":"","sourcesContent":["export interface DeviceCapabilities {\n supportsMultiItemScanFromPlaten: boolean;\n useWalkupScanToComp: boolean;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DiscoveryTreeData {
|
|
2
|
+
"ledm:DiscoveryTree": {
|
|
3
|
+
"ledm:SupportedIfc": {
|
|
4
|
+
"ledm:ManifestURI": string[];
|
|
5
|
+
"dd:ResourceType": string[];
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export default class DiscoveryTree {
|
|
10
|
+
private readonly data;
|
|
11
|
+
constructor(data: DiscoveryTreeData);
|
|
12
|
+
static createDiscoveryTree(content: string): Promise<DiscoveryTree>;
|
|
13
|
+
get WalkupScanToCompManifestURI(): string | null;
|
|
14
|
+
get WalkupScanManifestURI(): string | null;
|
|
15
|
+
get ScanJobManifestURI(): string | null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const xml2js_1 = require("xml2js");
|
|
4
|
+
const parser = new xml2js_1.Parser();
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const parseString = (0, util_1.promisify)(parser.parseString);
|
|
7
|
+
class DiscoveryTree {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createDiscoveryTree(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new DiscoveryTree(parsed);
|
|
14
|
+
}
|
|
15
|
+
get WalkupScanToCompManifestURI() {
|
|
16
|
+
const hpLedmWalkupScanToCompManifest = this.data["ledm:DiscoveryTree"]["ledm:SupportedIfc"].find((x) => x["dd:ResourceType"][0] === "ledm:hpLedmWalkupScanToCompManifest");
|
|
17
|
+
if (hpLedmWalkupScanToCompManifest !== undefined) {
|
|
18
|
+
return hpLedmWalkupScanToCompManifest["ledm:ManifestURI"][0];
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
get WalkupScanManifestURI() {
|
|
23
|
+
const hpLedmWalkupScanToCompManifest = this.data["ledm:DiscoveryTree"]["ledm:SupportedIfc"].find((x) => x["dd:ResourceType"][0] === "hpCnxWalkupScanManifest");
|
|
24
|
+
if (hpLedmWalkupScanToCompManifest === undefined) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return hpLedmWalkupScanToCompManifest["ledm:ManifestURI"][0];
|
|
28
|
+
}
|
|
29
|
+
get ScanJobManifestURI() {
|
|
30
|
+
const hpLedmWalkupScanToCompManifest = this.data["ledm:DiscoveryTree"]["ledm:SupportedIfc"].find((x) => x["dd:ResourceType"][0] === "ledm:hpLedmScanJobManifest");
|
|
31
|
+
if (hpLedmWalkupScanToCompManifest === undefined) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return hpLedmWalkupScanToCompManifest["ledm:ManifestURI"][0];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = DiscoveryTree;
|
|
38
|
+
//# sourceMappingURL=DiscoveryTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiscoveryTree.js","sourceRoot":"","sources":["../src/DiscoveryTree.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAA4B,MAAM,CAAC,WAAW,CAAC,CAAC;AAW7E,MAAqB,aAAa;IAGhC,YAAY,IAAuB;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAe;QAC9C,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,2BAA2B;QAC7B,MAAM,8BAA8B,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CACpE,mBAAmB,CACpB,CAAC,IAAI,CACJ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,qCAAqC,CACzE,CAAC;QACF,IAAI,8BAA8B,KAAK,SAAS,EAAE;YAChD,OAAO,8BAA8B,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9D;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,qBAAqB;QACvB,MAAM,8BAA8B,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CACpE,mBAAmB,CACpB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAAC,CAAC;QACrE,IAAI,8BAA8B,KAAK,SAAS,EAAE;YAChD,OAAO,IAAI,CAAC;SACb;QACD,OAAO,8BAA8B,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,kBAAkB;QACpB,MAAM,8BAA8B,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CACpE,mBAAmB,CACpB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,4BAA4B,CAAC,CAAC;QACxE,IAAI,8BAA8B,KAAK,SAAS,EAAE;YAChD,OAAO,IAAI,CAAC;SACb;QACD,OAAO,8BAA8B,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAxCD,gCAwCC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, DiscoveryTreeData>(parser.parseString);\n\nexport interface DiscoveryTreeData {\n \"ledm:DiscoveryTree\": {\n \"ledm:SupportedIfc\": {\n \"ledm:ManifestURI\": string[];\n \"dd:ResourceType\": string[];\n }[];\n };\n}\n\nexport default class DiscoveryTree {\n private readonly data: DiscoveryTreeData;\n\n constructor(data: DiscoveryTreeData) {\n this.data = data;\n }\n static async createDiscoveryTree(content: string): Promise<DiscoveryTree> {\n const parsed = await parseString(content);\n return new DiscoveryTree(parsed);\n }\n\n get WalkupScanToCompManifestURI(): string | null {\n const hpLedmWalkupScanToCompManifest = this.data[\"ledm:DiscoveryTree\"][\n \"ledm:SupportedIfc\"\n ].find(\n (x) => x[\"dd:ResourceType\"][0] === \"ledm:hpLedmWalkupScanToCompManifest\"\n );\n if (hpLedmWalkupScanToCompManifest !== undefined) {\n return hpLedmWalkupScanToCompManifest[\"ledm:ManifestURI\"][0];\n }\n return null;\n }\n get WalkupScanManifestURI(): string | null {\n const hpLedmWalkupScanToCompManifest = this.data[\"ledm:DiscoveryTree\"][\n \"ledm:SupportedIfc\"\n ].find((x) => x[\"dd:ResourceType\"][0] === \"hpCnxWalkupScanManifest\");\n if (hpLedmWalkupScanToCompManifest === undefined) {\n return null;\n }\n return hpLedmWalkupScanToCompManifest[\"ledm:ManifestURI\"][0];\n }\n get ScanJobManifestURI(): string | null {\n const hpLedmWalkupScanToCompManifest = this.data[\"ledm:DiscoveryTree\"][\n \"ledm:SupportedIfc\"\n ].find((x) => x[\"dd:ResourceType\"][0] === \"ledm:hpLedmScanJobManifest\");\n if (hpLedmWalkupScanToCompManifest === undefined) {\n return null;\n }\n return hpLedmWalkupScanToCompManifest[\"ledm:ManifestURI\"][0];\n }\n}\n"]}
|
package/dist/Event.d.ts
CHANGED
package/dist/Event.js
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
class Event {
|
|
4
|
+
constructor(data) {
|
|
5
5
|
this.data = data;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return this.data["dd:AgingStamp"][0];
|
|
17
|
-
},
|
|
18
|
-
enumerable: false,
|
|
19
|
-
configurable: true
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(Event.prototype, "destinationURI", {
|
|
22
|
-
get: function () {
|
|
23
|
-
var destination = this.data["ev:Payload"].find(function (v) { return v["dd:ResourceType"]["0"].includes("Destination"); });
|
|
7
|
+
get unqualifiedEventCategory() {
|
|
8
|
+
return this.data["dd:UnqualifiedEventCategory"][0];
|
|
9
|
+
}
|
|
10
|
+
get agingStamp() {
|
|
11
|
+
return this.data["dd:AgingStamp"][0];
|
|
12
|
+
}
|
|
13
|
+
get destinationURI() {
|
|
14
|
+
if (this.data.hasOwnProperty("ev:Payload")) {
|
|
15
|
+
const destination = this.data["ev:Payload"].find((v) => v["dd:ResourceType"]["0"].includes("Destination"));
|
|
24
16
|
return destination ? destination["dd:ResourceURI"]["0"] : undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var compEvent = this.data["ev:Payload"].find(function (v) { return v["dd:ResourceType"]["0"].includes("CompEvent"); });
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
get compEventURI() {
|
|
21
|
+
if (this.data.hasOwnProperty("ev:Payload")) {
|
|
22
|
+
const compEvent = this.data["ev:Payload"].find((v) => v["dd:ResourceType"]["0"].includes("CompEvent"));
|
|
32
23
|
return compEvent ? compEvent["dd:ResourceURI"]["0"] : undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
enumerable: false,
|
|
42
|
-
configurable: true
|
|
43
|
-
});
|
|
44
|
-
return Event;
|
|
45
|
-
}());
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
get isScanEvent() {
|
|
28
|
+
return this.unqualifiedEventCategory === "ScanEvent";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
46
31
|
exports.default = Event;
|
|
47
32
|
//# sourceMappingURL=Event.js.map
|
package/dist/Event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAeb;
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAeb,MAAqB,KAAK;IAExB,YAAY,IAAe;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,cAAc;QAChB,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE;YAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACrD,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAClD,CAAC;YAEF,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACrE;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,YAAY;QACd,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE;YAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACnD,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAChD,CAAC;YAEF,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACjE;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,wBAAwB,KAAK,WAAW,CAAC;IACvD,CAAC;CACF;AAvCD,wBAuCC","sourcesContent":["\"use strict\";\n\nexport type EventData = {\n \"dd:UnqualifiedEventCategory\": string[];\n \"dd:AgingStamp\": string[];\n \"ev:Payload\": {\n \"dd:ResourceURI\": {\n \"0\": string;\n };\n \"dd:ResourceType\": {\n \"0\": string;\n };\n }[];\n};\n\nexport default class Event {\n private readonly data: EventData;\n constructor(data: EventData) {\n this.data = data;\n }\n\n get unqualifiedEventCategory(): string {\n return this.data[\"dd:UnqualifiedEventCategory\"][0];\n }\n\n get agingStamp(): string {\n return this.data[\"dd:AgingStamp\"][0];\n }\n\n get destinationURI(): string | undefined {\n if (this.data.hasOwnProperty(\"ev:Payload\")) {\n const destination = this.data[\"ev:Payload\"].find((v) =>\n v[\"dd:ResourceType\"][\"0\"].includes(\"Destination\")\n );\n\n return destination ? destination[\"dd:ResourceURI\"][\"0\"] : undefined;\n }\n return undefined;\n }\n\n get compEventURI(): string | undefined {\n if (this.data.hasOwnProperty(\"ev:Payload\")) {\n const compEvent = this.data[\"ev:Payload\"].find((v) =>\n v[\"dd:ResourceType\"][\"0\"].includes(\"CompEvent\")\n );\n\n return compEvent ? compEvent[\"dd:ResourceURI\"][\"0\"] : undefined;\n }\n return undefined;\n }\n\n get isScanEvent(): boolean {\n return this.unqualifiedEventCategory === \"ScanEvent\";\n }\n}\n"]}
|
package/dist/EventTable.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import Event, { EventData } from "./Event";
|
|
2
|
+
export interface EtagEventTable {
|
|
3
|
+
etag: string;
|
|
4
|
+
eventTable: EventTable;
|
|
5
|
+
}
|
|
2
6
|
export interface EventTableData {
|
|
3
7
|
"ev:EventTable"?: {
|
|
4
8
|
"ev:Event"?: EventData[];
|
|
@@ -7,5 +11,6 @@ export interface EventTableData {
|
|
|
7
11
|
export default class EventTable {
|
|
8
12
|
private readonly data;
|
|
9
13
|
constructor(data: EventTableData);
|
|
14
|
+
static createEtagEventTable(content: string, etagReceived: string): Promise<EtagEventTable>;
|
|
10
15
|
get events(): Event[];
|
|
11
16
|
}
|
package/dist/EventTable.js
CHANGED
|
@@ -3,25 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const Event_1 = __importDefault(require("./Event"));
|
|
7
|
+
const xml2js_1 = require("xml2js");
|
|
8
|
+
const parser = new xml2js_1.Parser();
|
|
9
|
+
const util_1 = require("util");
|
|
10
|
+
const parseString = (0, util_1.promisify)(parser.parseString);
|
|
11
|
+
class EventTable {
|
|
12
|
+
constructor(data) {
|
|
9
13
|
this.data = data;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
15
|
+
static async createEtagEventTable(content, etagReceived) {
|
|
16
|
+
const parsed = await parseString(content);
|
|
17
|
+
return {
|
|
18
|
+
etag: etagReceived,
|
|
19
|
+
eventTable: new EventTable(parsed),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
get events() {
|
|
23
|
+
let eventTable = this.data["ev:EventTable"];
|
|
24
|
+
if (eventTable != null && eventTable["ev:Event"] != null) {
|
|
25
|
+
return eventTable["ev:Event"].map((x) => new Event_1.default(x));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
26
32
|
exports.default = EventTable;
|
|
27
33
|
//# sourceMappingURL=EventTable.js.map
|
package/dist/EventTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventTable.js","sourceRoot":"","sources":["../src/EventTable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,
|
|
1
|
+
{"version":3,"file":"EventTable.js","sourceRoot":"","sources":["../src/EventTable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,oDAA2C;AAC3C,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAyB,MAAM,CAAC,WAAW,CAAC,CAAC;AAa1E,MAAqB,UAAU;IAE7B,YAAY,IAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAC/B,OAAe,EACf,YAAoB;QAEpB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC;SACnC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5C,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE;YACxD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,eAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACxD;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AAzBD,6BAyBC","sourcesContent":["\"use strict\";\n\nimport Event, { EventData } from \"./Event\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, EventTableData>(parser.parseString);\n\nexport interface EtagEventTable {\n etag: string;\n eventTable: EventTable;\n}\n\nexport interface EventTableData {\n \"ev:EventTable\"?: {\n \"ev:Event\"?: EventData[];\n };\n}\n\nexport default class EventTable {\n private readonly data: EventTableData;\n constructor(data: EventTableData) {\n this.data = data;\n }\n\n static async createEtagEventTable(\n content: string,\n etagReceived: string\n ): Promise<EtagEventTable> {\n const parsed = await parseString(content);\n return {\n etag: etagReceived,\n eventTable: new EventTable(parsed),\n };\n }\n\n get events() {\n let eventTable = this.data[\"ev:EventTable\"];\n if (eventTable != null && eventTable[\"ev:Event\"] != null) {\n return eventTable[\"ev:Event\"].map((x) => new Event(x));\n } else {\n return [];\n }\n }\n}\n"]}
|
package/dist/HPApi.d.ts
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AxiosRequestHeaders } from "axios";
|
|
4
|
-
import EventTable from "./EventTable";
|
|
1
|
+
import { RawAxiosRequestHeaders } from "axios";
|
|
2
|
+
import { EtagEventTable } from "./EventTable";
|
|
5
3
|
import Job from "./Job";
|
|
6
4
|
import ScanStatus from "./ScanStatus";
|
|
5
|
+
import WalkupScanDestination from "./WalkupScanDestination";
|
|
6
|
+
import WalkupScanToCompDestination from "./WalkupScanToCompDestination";
|
|
7
7
|
import WalkupScanDestinations from "./WalkupScanDestinations";
|
|
8
8
|
import WalkupScanToCompDestinations from "./WalkupScanToCompDestinations";
|
|
9
9
|
import ScanJobSettings from "./ScanJobSettings";
|
|
10
10
|
import Destination from "./Destination";
|
|
11
11
|
import WalkupScanToCompEvent from "./WalkupScanToCompEvent";
|
|
12
|
+
import DiscoveryTree from "./DiscoveryTree";
|
|
13
|
+
import WalkupScanToCompManifest from "./WalkupScanToCompManifest";
|
|
14
|
+
import WalkupScanToCompCaps from "./WalkupScanToCompCaps";
|
|
15
|
+
import WalkupScanManifest from "./WalkupScanManifest";
|
|
16
|
+
import ScanJobManifest from "./ScanJobManifest";
|
|
17
|
+
import ScanCaps from "./ScanCaps";
|
|
12
18
|
export default class HPApi {
|
|
13
|
-
static
|
|
19
|
+
static setDeviceIP(ip: string): void;
|
|
14
20
|
static setDebug(dbg: boolean): void;
|
|
15
21
|
private static logDebug;
|
|
16
22
|
private static callAxios;
|
|
17
|
-
static
|
|
23
|
+
static isAlive(timeout?: number | null): Promise<boolean>;
|
|
24
|
+
static waitDeviceUp(deviceUpPollingInterval: number): Promise<void>;
|
|
25
|
+
static getDiscoveryTree(): Promise<DiscoveryTree>;
|
|
26
|
+
static getWalkupScanDestinations(uri?: string): Promise<WalkupScanDestinations>;
|
|
18
27
|
static getWalkupScanToCompDestinations(): Promise<WalkupScanToCompDestinations>;
|
|
19
|
-
static
|
|
28
|
+
static getWalkupScanManifest(uri: string): Promise<WalkupScanManifest>;
|
|
29
|
+
static getWalkupScanToCompManifest(uri: string): Promise<WalkupScanToCompManifest>;
|
|
30
|
+
static getScanJobManifest(uri: string): Promise<ScanJobManifest>;
|
|
31
|
+
static getScanCaps(uri: string): Promise<ScanCaps>;
|
|
32
|
+
static getWalkupScanToCompCaps(uri: string): Promise<WalkupScanToCompCaps>;
|
|
20
33
|
static getWalkupScanToCompEvent(compEventURI: string): Promise<WalkupScanToCompEvent>;
|
|
21
|
-
static removeDestination(walkupScanDestination: WalkupScanDestination): Promise<boolean>;
|
|
22
|
-
static
|
|
23
|
-
static
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}>;
|
|
27
|
-
static placeETagHeader(etag: string, headers: AxiosRequestHeaders): AxiosRequestHeaders;
|
|
34
|
+
static removeDestination(walkupScanDestination: WalkupScanDestination | WalkupScanToCompDestination): Promise<boolean>;
|
|
35
|
+
static registerWalkupScanDestination(destination: Destination): Promise<string>;
|
|
36
|
+
static registerWalkupScanToCompDestination(destination: Destination): Promise<string>;
|
|
37
|
+
static getEvents(etag?: string, decisecondTimeout?: number): Promise<EtagEventTable>;
|
|
38
|
+
static placeETagHeader(etag: string, headers: RawAxiosRequestHeaders): RawAxiosRequestHeaders;
|
|
28
39
|
static appendTimeout(url: string, timeout?: number | null): string;
|
|
29
40
|
static getDestination(destinationURL: string): Promise<WalkupScanDestination | WalkupScanToCompDestination>;
|
|
30
|
-
static createWalkupScanDestination(content: string): Promise<WalkupScanDestination>;
|
|
31
|
-
static createWalkupScanToCompDestination(content: string): Promise<WalkupScanToCompDestination>;
|
|
32
|
-
static createWalkupScanToCompEvent(content: string): Promise<WalkupScanToCompEvent>;
|
|
33
41
|
static getScanStatus(): Promise<ScanStatus>;
|
|
34
|
-
static delay(t: number): Promise<
|
|
42
|
+
static delay(t: number): Promise<void>;
|
|
35
43
|
static postJob(job: ScanJobSettings): Promise<string>;
|
|
36
44
|
/**
|
|
37
45
|
* @param jobURL
|