node-hp-scan-to 1.3.0 → 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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- 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/package.json +1 -1
- package/src/index.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -190,7 +190,7 @@ async function main() {
|
|
|
190
190
|
label: options.label || getConfig("label") || os_1.default.hostname(),
|
|
191
191
|
};
|
|
192
192
|
const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);
|
|
193
|
-
const scanConfig = getScanConfiguration(
|
|
193
|
+
const scanConfig = getScanConfiguration(options);
|
|
194
194
|
await listenCmd(registrationConfig, scanConfig, deviceUpPollingInterval);
|
|
195
195
|
});
|
|
196
196
|
commander_1.program.addCommand(cmdListen, { isDefault: true });
|
|
@@ -209,7 +209,7 @@ async function main() {
|
|
|
209
209
|
const isDebug = getIsDebug(parentOption);
|
|
210
210
|
HPApi_1.default.setDebug(isDebug);
|
|
211
211
|
const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);
|
|
212
|
-
const scanConfig = getScanConfiguration(
|
|
212
|
+
const scanConfig = getScanConfiguration(options);
|
|
213
213
|
const adfScanConfig = {
|
|
214
214
|
...scanConfig,
|
|
215
215
|
isDuplex: options.isDuplex || getConfig("autoscan_duplex") || false,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,sDAAsD;AAEtD,YA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I,SAAS,CAAC,0BAA0B,CAAC,IAAI,IAAI;YAC1E,cAAc,EACZ,OAAO,CAAC,cAAc,IAAI,SAAS,CAAC,yBAAyB,CAAC,IAAI,IAAI;SACzE,CAAC;QAEF,MAAM,cAAc,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACL,mBAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAEnC,MAAM,qBAAqB,GAAG,mBAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC3E,qBAAqB;SAClB,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAC7B,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACL,mBAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAE1C,MAAM,mBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n// noinspection XmlDeprecatedElement,HtmlDeprecatedTag\n\n\"use strict\";\n\nimport os from \"os\";\nimport { Command, Option, OptionValues, program } from \"commander\";\nimport Bonjour from \"bonjour\";\nimport config from \"config\";\nimport HPApi from \"./HPApi\";\nimport PathHelper from \"./PathHelper\";\nimport { delay } from \"./delay\";\nimport { readDeviceCapabilities } from \"./readDeviceCapabilities\";\nimport { clearRegistrations, RegistrationConfig, waitScanEvent } from \"./listening\";\nimport { AdfAutoScanConfig, DirectoryConfig, saveScan, ScanConfig, scanFromAdf, waitAdfLoaded } from \"./scanProcessing\";\n\nlet iteration = 0;\n\nasync function listenCmd(\n registrationConfig: RegistrationConfig,\n scanConfig: ScanConfig,\n deviceUpPollingInterval: number\n) {\n // first make sure the device is reachable\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n let deviceUp = true;\n\n const folder = await PathHelper.getOutputFolder(\n scanConfig.directoryConfig.directory\n );\n console.log(`Target folder: ${folder}`);\n\n const tempFolder = await PathHelper.getOutputFolder(\n scanConfig.directoryConfig.tempDirectory\n );\n console.log(`Temp folder: ${tempFolder}`);\n\n const deviceCapabilities = await readDeviceCapabilities();\n\n let scanCount = 0;\n let keepActive = true;\n let errorCount = 0;\n while (keepActive) {\n console.log(`Running iteration: ${iteration} - errorCount: ${errorCount}`);\n try {\n const event = await waitScanEvent(deviceCapabilities, registrationConfig);\n scanCount++;\n console.log(`Scan event captured, saving scan #${scanCount}`);\n await saveScan(\n event,\n folder,\n tempFolder,\n scanCount,\n deviceCapabilities,\n scanConfig\n );\n } catch (e) {\n console.log(e);\n if (await HPApi.isAlive()) {\n errorCount++;\n } else {\n deviceUp = false;\n }\n }\n\n if (errorCount === 50) {\n keepActive = false;\n }\n\n if (!deviceUp) {\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n } else {\n await delay(1000);\n }\n }\n}\n\nasync function adfAutoscanCmd(\n adfAutoScanConfig: AdfAutoScanConfig,\n deviceUpPollingInterval: number\n) {\n // first make sure the device is reachable\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n let deviceUp = true;\n\n const folder = await PathHelper.getOutputFolder(\n adfAutoScanConfig.directoryConfig.directory\n );\n console.log(`Target folder: ${folder}`);\n\n const tempFolder = await PathHelper.getOutputFolder(\n adfAutoScanConfig.directoryConfig.tempDirectory\n );\n console.log(`Temp folder: ${tempFolder}`);\n\n let scanCount = 0;\n let keepActive = true;\n let errorCount = 0;\n while (keepActive) {\n console.log(`Running iteration: ${iteration} - errorCount: ${errorCount}`);\n try {\n await waitAdfLoaded(\n adfAutoScanConfig.pollingInterval,\n adfAutoScanConfig.startScanDelay\n );\n\n scanCount++;\n\n console.log(`Scan event captured, saving scan #${scanCount}`);\n\n await scanFromAdf(scanCount, folder, tempFolder, adfAutoScanConfig);\n } catch (e) {\n console.log(e);\n if (await HPApi.isAlive()) {\n errorCount++;\n } else {\n deviceUp = false;\n }\n }\n\n if (errorCount === 50) {\n keepActive = false;\n }\n\n if (!deviceUp) {\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n } else {\n await delay(1000);\n }\n }\n}\n\nasync function clearRegistrationsCmd(cmd: Command) {\n const parentOption = cmd.parent!.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n await clearRegistrations();\n}\n\nfunction findOfficejetIp(deviceNamePrefix: string): Promise<string> {\n return new Promise((resolve) => {\n const bonjour = Bonjour();\n console.log(\"Searching device...\");\n let browser = bonjour.find(\n {\n type: \"http\",\n },\n (service) => {\n console.log(\".\");\n if (\n service.name.startsWith(deviceNamePrefix) &&\n service.port === 80 &&\n service.type === \"http\" &&\n service.addresses != null\n ) {\n browser.stop();\n bonjour.destroy();\n console.log(`Found: ${service.name}`);\n resolve(service.addresses[0]);\n }\n }\n );\n browser.start();\n });\n}\n\nfunction getConfig<T>(name: string): T | undefined {\n return config.has(name) ? config.get<T>(name) : undefined;\n}\n\nfunction setupScanParameters(command: Command): Command {\n command.option(\n \"-d, --directory <dir>\",\n \"Directory where scans are saved (default: /tmp/scan-to-pc<random>)\"\n );\n command.option(\n \"-t, --temp-directory <dir>\",\n \"Temp directory used for processing (default: /tmp/scan-to-pc<random>)\"\n );\n command.option(\n \"-p, --pattern <pattern>\",\n 'Pattern for filename (i.e. \"scan\"_dd.mm.yyyy_hh:MM:ss, without this its scanPage<number>)'\n );\n command.option(\n \"-r, --resolution <dpi>\",\n \"Resolution in DPI of the scans (default: 200)\"\n );\n return command;\n}\n\nfunction setupParameterOpts(command: Command): Command {\n command.option(\n \"-ip, --address <ip>\",\n \"IP address of the device (this overrides -p)\"\n );\n command.option(\n \"--device-up-polling-interval <deviceUpPollingInterval>\",\n \"Device up polling interval in milliseconds\",\n parseFloat\n );\n command.option(\n \"-n, --name <name>\",\n \"Name of the device for service discovery\"\n ); // i.e. 'Deskjet 3520 series'\n\n command.option(\"-D, --debug\", \"Enable debug\");\n return command;\n}\n\nasync function getDeviceIp(options: OptionValues) {\n let ip = options.address || getConfig(\"ip\");\n if (!ip) {\n const name = options.name || getConfig(\"name\");\n ip = await findOfficejetIp(name || \"HP Smart Tank Plus 570 series\");\n }\n console.log(`Using device ip: ${ip}`);\n return ip;\n}\n\nfunction getIsDebug(options: OptionValues) {\n const debug =\n options.debug != null ? true : getConfig<boolean>(\"debug\") || false;\n\n if (debug) {\n console.log(`IsDebug: ${debug}`);\n }\n return debug;\n}\n\nfunction getScanConfiguration(parentOption: OptionValues) {\n const directoryConfig: DirectoryConfig = {\n directory: parentOption.directory || getConfig(\"directory\"),\n tempDirectory: parentOption.tempDirectory || getConfig(\"tempDirectory\"),\n filePattern: parentOption.pattern || getConfig(\"pattern\"),\n };\n\n const scanConfig: ScanConfig = {\n resolution: parseInt(\n parentOption.resolution || getConfig(\"resolution\") || 200,\n 10\n ),\n directoryConfig,\n };\n return scanConfig;\n}\n\nfunction getDeviceUpPollingInterval(parentOption: OptionValues) {\n return (\n parentOption.deviceUpPollingInterval ||\n getConfig(\"deviceUpPollingInterval\") ||\n 1000\n );\n}\n\n\nasync function main() {\n setupParameterOpts(program);\n const cmdListen = program.createCommand(\"listen\");\n setupScanParameters(cmdListen)\n .description(\"Listen the device for new scan job to save to this target\")\n .option(\n \"-l, --label <label>\",\n \"The label to display on the device (the default is the hostname)\"\n )\n .action(async (options, cmd) => {\n const parentOption = cmd.parent.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n\n const registrationConfig: RegistrationConfig = {\n label: options.label || getConfig(\"label\") || os.hostname(),\n };\n\n const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);\n\n const scanConfig = getScanConfiguration(parentOption);\n\n await listenCmd(registrationConfig, scanConfig, deviceUpPollingInterval);\n });\n program.addCommand(cmdListen, { isDefault: true });\n\n const cmdAdfAutoscan = program.createCommand(\"adf-autoscan\");\n setupScanParameters(cmdAdfAutoscan)\n .addOption(\n new Option(\"--duplex\", \"If specified, the scan will be in duplex\")\n )\n .addOption(\n new Option(\n \"--pdf\",\n \"If specified, the scan result will be a pdf document, the default is multiple jpeg files\"\n )\n )\n .addOption(\n new Option(\n \"--pollingInterval <pollingInterval>\",\n \"Time interval in millisecond between each lookup for content in the automatic document feeder\",\n )\n )\n .description(\n \"Automatically trigger a new scan job to this target once paper is detected in the automatic document feeder (adf)\"\n )\n .addOption(\n new Option(\n \"--start-scan-delay <startScanDelay>\",\n \"Once document are detected to be in the adf, this specify the wait delay in millisecond before triggering the scan\",\n )\n )\n .description(\n \"Automatically trigger a new scan job to this target once paper is detected in the automatic document feeder (adf)\"\n )\n .action(async (options, cmd) => {\n const parentOption = cmd.parent.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n\n const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);\n\n const scanConfig = getScanConfiguration(parentOption);\n\n const adfScanConfig: AdfAutoScanConfig = {\n ...scanConfig,\n isDuplex: options.isDuplex || getConfig(\"autoscan_duplex\") || false,\n generatePdf: options.pdf || getConfig(\"autoscan_pdf\") || false,\n pollingInterval:\n options.pollingInterval || getConfig(\"autoscan_pollingInterval\") || 1000,\n startScanDelay:\n options.startScanDelay || getConfig(\"autoscan_startScanDelay\") || 5000,\n };\n\n await adfAutoscanCmd(adfScanConfig, deviceUpPollingInterval);\n });\n program.addCommand(cmdAdfAutoscan);\n\n const cmdClearRegistrations = program.createCommand(\"clear-registrations\");\n cmdClearRegistrations\n .description(\"Clear the list or registered target on the device\")\n .action(async (options, cmd) => {\n await clearRegistrationsCmd(cmd);\n });\n program.addCommand(cmdClearRegistrations);\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((err) => console.log(err));\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,sDAAsD;AAEtD,YAAY,CAAC;;;;;AAEb,4CAAoB;AACpB,yCAAmE;AACnE,sDAA8B;AAC9B,oDAA4B;AAC5B,oDAA4B;AAC5B,8DAAsC;AACtC,mCAAgC;AAChC,qEAAkE;AAClE,2CAAoF;AACpF,qDAAwH;AAExH,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB,KAAK,UAAU,SAAS,CACtB,kBAAsC,EACtC,UAAsB,EACtB,uBAA+B;IAE/B,0CAA0C;IAC1C,MAAM,eAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;IAClD,IAAI,QAAQ,GAAG,IAAI,CAAC;IAEpB,MAAM,MAAM,GAAG,MAAM,oBAAU,CAAC,eAAe,CAC7C,UAAU,CAAC,eAAe,CAAC,SAAS,CACrC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAC;IAExC,MAAM,UAAU,GAAG,MAAM,oBAAU,CAAC,eAAe,CACjD,UAAU,CAAC,eAAe,CAAC,aAAa,CACzC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAE1C,MAAM,kBAAkB,GAAG,MAAM,IAAA,+CAAsB,GAAE,CAAC;IAE1D,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,OAAO,UAAU,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,sBAAsB,SAAS,kBAAkB,UAAU,EAAE,CAAC,CAAC;QAC3E,IAAI;YACF,MAAM,KAAK,GAAG,MAAM,IAAA,yBAAa,EAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAA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C,QAAQ,IAAI,SAAS,CAAC,iBAAiB,CAAC,IAAI,KAAK;YACnE,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI,SAAS,CAAC,cAAc,CAAC,IAAI,KAAK;YAC9D,eAAe,EACb,OAAO,CAAC,eAAe,IAAI,SAAS,CAAC,0BAA0B,CAAC,IAAI,IAAI;YAC1E,cAAc,EACZ,OAAO,CAAC,cAAc,IAAI,SAAS,CAAC,yBAAyB,CAAC,IAAI,IAAI;SACzE,CAAC;QAEF,MAAM,cAAc,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACL,mBAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAEnC,MAAM,qBAAqB,GAAG,mBAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC3E,qBAAqB;SAClB,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAC7B,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACL,mBAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAE1C,MAAM,mBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n// noinspection XmlDeprecatedElement,HtmlDeprecatedTag\n\n\"use strict\";\n\nimport os from \"os\";\nimport { Command, Option, OptionValues, program } from \"commander\";\nimport Bonjour from \"bonjour\";\nimport config from \"config\";\nimport HPApi from \"./HPApi\";\nimport PathHelper from \"./PathHelper\";\nimport { delay } from \"./delay\";\nimport { readDeviceCapabilities } from \"./readDeviceCapabilities\";\nimport { clearRegistrations, RegistrationConfig, waitScanEvent } from \"./listening\";\nimport { AdfAutoScanConfig, DirectoryConfig, saveScan, ScanConfig, scanFromAdf, waitAdfLoaded } from \"./scanProcessing\";\n\nlet iteration = 0;\n\nasync function listenCmd(\n registrationConfig: RegistrationConfig,\n scanConfig: ScanConfig,\n deviceUpPollingInterval: number\n) {\n // first make sure the device is reachable\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n let deviceUp = true;\n\n const folder = await PathHelper.getOutputFolder(\n scanConfig.directoryConfig.directory\n );\n console.log(`Target folder: ${folder}`);\n\n const tempFolder = await PathHelper.getOutputFolder(\n scanConfig.directoryConfig.tempDirectory\n );\n console.log(`Temp folder: ${tempFolder}`);\n\n const deviceCapabilities = await readDeviceCapabilities();\n\n let scanCount = 0;\n let keepActive = true;\n let errorCount = 0;\n while (keepActive) {\n console.log(`Running iteration: ${iteration} - errorCount: ${errorCount}`);\n try {\n const event = await waitScanEvent(deviceCapabilities, registrationConfig);\n scanCount++;\n console.log(`Scan event captured, saving scan #${scanCount}`);\n await saveScan(\n event,\n folder,\n tempFolder,\n scanCount,\n deviceCapabilities,\n scanConfig\n );\n } catch (e) {\n console.log(e);\n if (await HPApi.isAlive()) {\n errorCount++;\n } else {\n deviceUp = false;\n }\n }\n\n if (errorCount === 50) {\n keepActive = false;\n }\n\n if (!deviceUp) {\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n } else {\n await delay(1000);\n }\n }\n}\n\nasync function adfAutoscanCmd(\n adfAutoScanConfig: AdfAutoScanConfig,\n deviceUpPollingInterval: number\n) {\n // first make sure the device is reachable\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n let deviceUp = true;\n\n const folder = await PathHelper.getOutputFolder(\n adfAutoScanConfig.directoryConfig.directory\n );\n console.log(`Target folder: ${folder}`);\n\n const tempFolder = await PathHelper.getOutputFolder(\n adfAutoScanConfig.directoryConfig.tempDirectory\n );\n console.log(`Temp folder: ${tempFolder}`);\n\n let scanCount = 0;\n let keepActive = true;\n let errorCount = 0;\n while (keepActive) {\n console.log(`Running iteration: ${iteration} - errorCount: ${errorCount}`);\n try {\n await waitAdfLoaded(\n adfAutoScanConfig.pollingInterval,\n adfAutoScanConfig.startScanDelay\n );\n\n scanCount++;\n\n console.log(`Scan event captured, saving scan #${scanCount}`);\n\n await scanFromAdf(scanCount, folder, tempFolder, adfAutoScanConfig);\n } catch (e) {\n console.log(e);\n if (await HPApi.isAlive()) {\n errorCount++;\n } else {\n deviceUp = false;\n }\n }\n\n if (errorCount === 50) {\n keepActive = false;\n }\n\n if (!deviceUp) {\n await HPApi.waitDeviceUp(deviceUpPollingInterval);\n } else {\n await delay(1000);\n }\n }\n}\n\nasync function clearRegistrationsCmd(cmd: Command) {\n const parentOption = cmd.parent!.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n await clearRegistrations();\n}\n\nfunction findOfficejetIp(deviceNamePrefix: string): Promise<string> {\n return new Promise((resolve) => {\n const bonjour = Bonjour();\n console.log(\"Searching device...\");\n let browser = bonjour.find(\n {\n type: \"http\",\n },\n (service) => {\n console.log(\".\");\n if (\n service.name.startsWith(deviceNamePrefix) &&\n service.port === 80 &&\n service.type === \"http\" &&\n service.addresses != null\n ) {\n browser.stop();\n bonjour.destroy();\n console.log(`Found: ${service.name}`);\n resolve(service.addresses[0]);\n }\n }\n );\n browser.start();\n });\n}\n\nfunction getConfig<T>(name: string): T | undefined {\n return config.has(name) ? config.get<T>(name) : undefined;\n}\n\nfunction setupScanParameters(command: Command): Command {\n command.option(\n \"-d, --directory <dir>\",\n \"Directory where scans are saved (default: /tmp/scan-to-pc<random>)\"\n );\n command.option(\n \"-t, --temp-directory <dir>\",\n \"Temp directory used for processing (default: /tmp/scan-to-pc<random>)\"\n );\n command.option(\n \"-p, --pattern <pattern>\",\n 'Pattern for filename (i.e. \"scan\"_dd.mm.yyyy_hh:MM:ss, without this its scanPage<number>)'\n );\n command.option(\n \"-r, --resolution <dpi>\",\n \"Resolution in DPI of the scans (default: 200)\"\n );\n return command;\n}\n\nfunction setupParameterOpts(command: Command): Command {\n command.option(\n \"-ip, --address <ip>\",\n \"IP address of the device (this overrides -p)\"\n );\n command.option(\n \"--device-up-polling-interval <deviceUpPollingInterval>\",\n \"Device up polling interval in milliseconds\",\n parseFloat\n );\n command.option(\n \"-n, --name <name>\",\n \"Name of the device for service discovery\"\n ); // i.e. 'Deskjet 3520 series'\n\n command.option(\"-D, --debug\", \"Enable debug\");\n return command;\n}\n\nasync function getDeviceIp(options: OptionValues) {\n let ip = options.address || getConfig(\"ip\");\n if (!ip) {\n const name = options.name || getConfig(\"name\");\n ip = await findOfficejetIp(name || \"HP Smart Tank Plus 570 series\");\n }\n console.log(`Using device ip: ${ip}`);\n return ip;\n}\n\nfunction getIsDebug(options: OptionValues) {\n const debug =\n options.debug != null ? true : getConfig<boolean>(\"debug\") || false;\n\n if (debug) {\n console.log(`IsDebug: ${debug}`);\n }\n return debug;\n}\n\nfunction getScanConfiguration(parentOption: OptionValues) {\n const directoryConfig: DirectoryConfig = {\n directory: parentOption.directory || getConfig(\"directory\"),\n tempDirectory: parentOption.tempDirectory || getConfig(\"tempDirectory\"),\n filePattern: parentOption.pattern || getConfig(\"pattern\"),\n };\n\n const scanConfig: ScanConfig = {\n resolution: parseInt(\n parentOption.resolution || getConfig(\"resolution\") || 200,\n 10\n ),\n directoryConfig,\n };\n return scanConfig;\n}\n\nfunction getDeviceUpPollingInterval(parentOption: OptionValues) {\n return (\n parentOption.deviceUpPollingInterval ||\n getConfig(\"deviceUpPollingInterval\") ||\n 1000\n );\n}\n\n\nasync function main() {\n setupParameterOpts(program);\n const cmdListen = program.createCommand(\"listen\");\n setupScanParameters(cmdListen)\n .description(\"Listen the device for new scan job to save to this target\")\n .option(\n \"-l, --label <label>\",\n \"The label to display on the device (the default is the hostname)\"\n )\n .action(async (options, cmd) => {\n const parentOption = cmd.parent.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n\n const registrationConfig: RegistrationConfig = {\n label: options.label || getConfig(\"label\") || os.hostname(),\n };\n\n const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);\n\n const scanConfig = getScanConfiguration(options);\n\n await listenCmd(registrationConfig, scanConfig, deviceUpPollingInterval);\n });\n program.addCommand(cmdListen, { isDefault: true });\n\n const cmdAdfAutoscan = program.createCommand(\"adf-autoscan\");\n setupScanParameters(cmdAdfAutoscan)\n .addOption(\n new Option(\"--duplex\", \"If specified, the scan will be in duplex\")\n )\n .addOption(\n new Option(\n \"--pdf\",\n \"If specified, the scan result will be a pdf document, the default is multiple jpeg files\"\n )\n )\n .addOption(\n new Option(\n \"--pollingInterval <pollingInterval>\",\n \"Time interval in millisecond between each lookup for content in the automatic document feeder\",\n )\n )\n .description(\n \"Automatically trigger a new scan job to this target once paper is detected in the automatic document feeder (adf)\"\n )\n .addOption(\n new Option(\n \"--start-scan-delay <startScanDelay>\",\n \"Once document are detected to be in the adf, this specify the wait delay in millisecond before triggering the scan\",\n )\n )\n .description(\n \"Automatically trigger a new scan job to this target once paper is detected in the automatic document feeder (adf)\"\n )\n .action(async (options, cmd) => {\n const parentOption = cmd.parent.opts();\n\n const ip = await getDeviceIp(parentOption);\n HPApi.setDeviceIP(ip);\n\n const isDebug = getIsDebug(parentOption);\n HPApi.setDebug(isDebug);\n\n const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);\n\n const scanConfig = getScanConfiguration(options);\n\n const adfScanConfig: AdfAutoScanConfig = {\n ...scanConfig,\n isDuplex: options.isDuplex || getConfig(\"autoscan_duplex\") || false,\n generatePdf: options.pdf || getConfig(\"autoscan_pdf\") || false,\n pollingInterval:\n options.pollingInterval || getConfig(\"autoscan_pollingInterval\") || 1000,\n startScanDelay:\n options.startScanDelay || getConfig(\"autoscan_startScanDelay\") || 5000,\n };\n\n await adfAutoscanCmd(adfScanConfig, deviceUpPollingInterval);\n });\n program.addCommand(cmdAdfAutoscan);\n\n const cmdClearRegistrations = program.createCommand(\"clear-registrations\");\n cmdClearRegistrations\n .description(\"Clear the list or registered target on the device\")\n .action(async (options, cmd) => {\n await clearRegistrationsCmd(cmd);\n });\n program.addCommand(cmdClearRegistrations);\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((err) => console.log(err));\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
this.hostname = hostname;
|
|
33
|
+
this.linkType = "Network";
|
|
34
|
+
this.toComp = toComp;
|
|
35
|
+
}
|
|
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
|
+
}
|
|
67
|
+
exports.default = Destination;
|
|
68
|
+
//# sourceMappingURL=Destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Destination.js","sourceRoot":"","sources":["../../src/models/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,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":"D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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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type EventData = {
|
|
2
|
+
"dd:UnqualifiedEventCategory": string[];
|
|
3
|
+
"dd:AgingStamp": string[];
|
|
4
|
+
"ev:Payload": {
|
|
5
|
+
"dd:ResourceURI": {
|
|
6
|
+
"0": string;
|
|
7
|
+
};
|
|
8
|
+
"dd:ResourceType": {
|
|
9
|
+
"0": string;
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export default class Event {
|
|
14
|
+
private readonly data;
|
|
15
|
+
constructor(data: EventData);
|
|
16
|
+
get unqualifiedEventCategory(): string;
|
|
17
|
+
get agingStamp(): string;
|
|
18
|
+
get destinationURI(): string | undefined;
|
|
19
|
+
get compEventURI(): string | undefined;
|
|
20
|
+
get isScanEvent(): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Event {
|
|
4
|
+
constructor(data) {
|
|
5
|
+
this.data = data;
|
|
6
|
+
}
|
|
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"));
|
|
16
|
+
return destination ? destination["dd:ResourceURI"]["0"] : undefined;
|
|
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"));
|
|
23
|
+
return compEvent ? compEvent["dd:ResourceURI"]["0"] : undefined;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
get isScanEvent() {
|
|
28
|
+
return this.unqualifiedEventCategory === "ScanEvent";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = Event;
|
|
32
|
+
//# sourceMappingURL=Event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Event, { EventData } from "./Event";
|
|
2
|
+
export interface EtagEventTable {
|
|
3
|
+
etag: string;
|
|
4
|
+
eventTable: EventTable;
|
|
5
|
+
}
|
|
6
|
+
export interface EventTableData {
|
|
7
|
+
"ev:EventTable"?: {
|
|
8
|
+
"ev:Event"?: EventData[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export default class EventTable {
|
|
12
|
+
private readonly data;
|
|
13
|
+
constructor(data: EventTableData);
|
|
14
|
+
static createEtagEventTable(content: string, etagReceived: string): Promise<EtagEventTable>;
|
|
15
|
+
get events(): Event[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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) {
|
|
13
|
+
this.data = data;
|
|
14
|
+
}
|
|
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
|
+
}
|
|
32
|
+
exports.default = EventTable;
|
|
33
|
+
//# sourceMappingURL=EventTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTable.js","sourceRoot":"","sources":["../../src/models/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"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface JobData {
|
|
2
|
+
"j:Job": {
|
|
3
|
+
ScanJob: {
|
|
4
|
+
PreScanPage?: {
|
|
5
|
+
PageState: string[];
|
|
6
|
+
BinaryURL: string[];
|
|
7
|
+
PageNumber: string[];
|
|
8
|
+
BufferInfo: {
|
|
9
|
+
ImageWidth: string[];
|
|
10
|
+
ImageHeight: string[];
|
|
11
|
+
ScanSettings: {
|
|
12
|
+
XResolution: string[];
|
|
13
|
+
YResolution: string[];
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
}[];
|
|
17
|
+
PostScanPage?: {
|
|
18
|
+
PageNumber: string[];
|
|
19
|
+
}[];
|
|
20
|
+
}[];
|
|
21
|
+
"j:JobState": string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default class Job {
|
|
25
|
+
private readonly data;
|
|
26
|
+
constructor(data: JobData);
|
|
27
|
+
static createJob(content: string): Promise<Job>;
|
|
28
|
+
get currentPageNumber(): string | null;
|
|
29
|
+
get totalPageNumber(): number | null;
|
|
30
|
+
get jobState(): "Completed" | "Processing" | "ReadyToUpload" | "Canceled" | string;
|
|
31
|
+
get pageState(): string | null;
|
|
32
|
+
get binaryURL(): string | null;
|
|
33
|
+
get imageWidth(): number | null;
|
|
34
|
+
get imageHeight(): number | null;
|
|
35
|
+
get xResolution(): number | null;
|
|
36
|
+
get yResolution(): number | null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 Job {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createJob(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new Job(parsed);
|
|
14
|
+
}
|
|
15
|
+
get currentPageNumber() {
|
|
16
|
+
let preScanPage = this.data["j:Job"].ScanJob[0].PreScanPage;
|
|
17
|
+
if (preScanPage) {
|
|
18
|
+
return preScanPage[0].PageNumber[0];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
get totalPageNumber() {
|
|
25
|
+
if (this.data["j:Job"].ScanJob[0].PostScanPage) {
|
|
26
|
+
return parseInt(this.data["j:Job"].ScanJob[0].PostScanPage[0].PageNumber[0], 10);
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
get jobState() {
|
|
31
|
+
return this.data["j:Job"]["j:JobState"][0];
|
|
32
|
+
}
|
|
33
|
+
get pageState() {
|
|
34
|
+
let preScanPage = this.data["j:Job"].ScanJob[0].PreScanPage;
|
|
35
|
+
if (preScanPage) {
|
|
36
|
+
return preScanPage[0].PageState[0];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
get binaryURL() {
|
|
43
|
+
if (this.data["j:Job"].ScanJob[0].PreScanPage) {
|
|
44
|
+
return this.data["j:Job"].ScanJob[0].PreScanPage[0].BinaryURL[0];
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
get imageWidth() {
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
50
|
+
if (!this.data["j:Job"].ScanJob[0].hasOwnProperty("PreScanPage")) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return parseInt((_e = (_d = (_c = (_b = (_a = this.data["j:Job"].ScanJob[0].PreScanPage) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.BufferInfo) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.ImageWidth[0]) !== null && _e !== void 0 ? _e : "");
|
|
54
|
+
}
|
|
55
|
+
get imageHeight() {
|
|
56
|
+
if (this.data["j:Job"].ScanJob[0].PreScanPage) {
|
|
57
|
+
return parseInt(this.data["j:Job"].ScanJob[0].PreScanPage[0].BufferInfo[0]
|
|
58
|
+
.ImageHeight[0]);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
get xResolution() {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
|
+
if (this.data["j:Job"].ScanJob[0].PreScanPage) {
|
|
65
|
+
return parseInt((_g = (_f = (_e = (_d = (_c = (_b = (_a = this.data["j:Job"].ScanJob[0].PreScanPage) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.BufferInfo) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.ScanSettings) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.XResolution[0]) !== null && _g !== void 0 ? _g : "");
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
get yResolution() {
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
71
|
+
if (this.data["j:Job"].ScanJob[0].hasOwnProperty("PreScanPage")) {
|
|
72
|
+
return parseInt((_g = (_f = (_e = (_d = (_c = (_b = (_a = this.data["j:Job"].ScanJob[0].PreScanPage) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.BufferInfo) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.ScanSettings) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.YResolution[0]) !== null && _g !== void 0 ? _g : "");
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = Job;
|
|
78
|
+
//# sourceMappingURL=Job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Job.js","sourceRoot":"","sources":["../../src/models/Job.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;AA0BnE,MAAqB,GAAG;IAEtB,YAAY,IAAa;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAe;QACpC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,iBAAiB;QACnB,IAAI,WAAW,GAAG,IAAI,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;QACb,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE;YAC/D,OAAO,QAAQ,CACb,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,0CAAG,CAAC,CAAC,0CAAE,UAAU,0CAAG,CAAC,CAAC,0CAC3D,YAAY,0CAAG,CAAC,CAAC,0CAAE,WAAW,CAAC,CAAC,CAAC,mCAAI,EAAE,CAC5C,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3FD,sBA2FC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, JobData>(parser.parseString);\n\nexport interface JobData {\n \"j:Job\": {\n ScanJob: {\n PreScanPage?: {\n PageState: string[];\n BinaryURL: string[];\n PageNumber: string[];\n BufferInfo: {\n ImageWidth: string[];\n ImageHeight: string[];\n ScanSettings: {\n XResolution: string[];\n YResolution: string[];\n }[];\n }[];\n }[];\n PostScanPage?: {\n PageNumber: string[];\n }[];\n }[];\n \"j:JobState\": string[];\n };\n}\n\nexport default class Job {\n private readonly data: JobData;\n constructor(data: JobData) {\n this.data = data;\n }\n\n static async createJob(content: string): Promise<Job> {\n const parsed = await parseString(content);\n return new Job(parsed);\n }\n\n get currentPageNumber(): string | null {\n let preScanPage = this.data[\"j:Job\"].ScanJob[0].PreScanPage;\n if (preScanPage) {\n return preScanPage[0].PageNumber[0];\n } else {\n return null;\n }\n }\n\n get totalPageNumber(): number | null {\n if (this.data[\"j:Job\"].ScanJob[0].PostScanPage) {\n return parseInt(\n this.data[\"j:Job\"].ScanJob[0].PostScanPage[0].PageNumber[0],\n 10\n );\n }\n return null;\n }\n\n get jobState():\n | \"Completed\"\n | \"Processing\"\n | \"ReadyToUpload\"\n | \"Canceled\"\n | string {\n return this.data[\"j:Job\"][\"j:JobState\"][0];\n }\n\n get pageState(): string | null {\n let preScanPage = this.data[\"j:Job\"].ScanJob[0].PreScanPage;\n if (preScanPage) {\n return preScanPage[0].PageState[0];\n } else {\n return null;\n }\n }\n\n get binaryURL(): string | null {\n if (this.data[\"j:Job\"].ScanJob[0].PreScanPage) {\n return this.data[\"j:Job\"].ScanJob[0].PreScanPage[0].BinaryURL[0];\n }\n return null;\n }\n\n get imageWidth(): number | null {\n if (!this.data[\"j:Job\"].ScanJob[0].hasOwnProperty(\"PreScanPage\")) {\n return null;\n }\n return parseInt(\n this.data[\"j:Job\"].ScanJob[0].PreScanPage?.[0]?.BufferInfo?.[0]\n ?.ImageWidth[0] ?? \"\"\n );\n }\n get imageHeight(): number | null {\n if (this.data[\"j:Job\"].ScanJob[0].PreScanPage) {\n return parseInt(\n this.data[\"j:Job\"].ScanJob[0].PreScanPage[0].BufferInfo[0]\n .ImageHeight[0]\n );\n }\n return null;\n }\n get xResolution(): number | null {\n if (this.data[\"j:Job\"].ScanJob[0].PreScanPage) {\n return parseInt(\n this.data[\"j:Job\"].ScanJob[0].PreScanPage?.[0]?.BufferInfo?.[0]\n ?.ScanSettings?.[0]?.XResolution[0] ?? \"\"\n );\n }\n return null;\n }\n get yResolution(): number | null {\n if (this.data[\"j:Job\"].ScanJob[0].hasOwnProperty(\"PreScanPage\")) {\n return parseInt(\n this.data[\"j:Job\"].ScanJob[0].PreScanPage?.[0]?.BufferInfo?.[0]\n ?.ScanSettings?.[0]?.YResolution[0] ?? \"\"\n );\n }\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 ScanCaps {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createScanCaps(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new ScanCaps(parsed);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = ScanCaps;
|
|
17
|
+
//# sourceMappingURL=ScanCaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScanCaps.js","sourceRoot":"","sources":["../../src/models/ScanCaps.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAuB,MAAM,CAAC,WAAW,CAAC,CAAC;AAGxE,MAAqB,QAAQ;IAG3B,YAAY,IAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,OAAe;QACzC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF;AAXD,2BAWC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, ScanCapsData>(parser.parseString);\nexport interface ScanCapsData {}\n\nexport default class ScanCaps {\n private readonly data: ScanCapsData;\n\n constructor(data: ScanCapsData) {\n this.data = data;\n }\n\n static async createScanCaps(content: string): Promise<ScanCaps> {\n const parsed = await parseString(content);\n return new ScanCaps(parsed);\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ScanJobManifestData {
|
|
2
|
+
"man:Manifest": {
|
|
3
|
+
"map:ResourceMap": {
|
|
4
|
+
"map:ResourceLink": {
|
|
5
|
+
"dd:ResourceURI": string[];
|
|
6
|
+
}[];
|
|
7
|
+
"map:ResourceNode": {
|
|
8
|
+
"map:ResourceLink": {
|
|
9
|
+
"dd:ResourceURI": string[];
|
|
10
|
+
}[];
|
|
11
|
+
"map:ResourceType": {
|
|
12
|
+
"scan:ScanResourceType": string[];
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export default class ScanJobManifest {
|
|
19
|
+
private readonly data;
|
|
20
|
+
constructor(data: ScanJobManifestData);
|
|
21
|
+
static createScanJobManifest(content: string): Promise<ScanJobManifest>;
|
|
22
|
+
get ScanCapsURI(): string | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 ScanJobManifest {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createScanJobManifest(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new ScanJobManifest(parsed);
|
|
14
|
+
}
|
|
15
|
+
get ScanCapsURI() {
|
|
16
|
+
const scanCaps = this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceNode"].find((x) => x["map:ResourceType"][0]["scan:ScanResourceType"][0] === "ScanCaps");
|
|
17
|
+
if (scanCaps === undefined) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceLink"][0]["dd:ResourceURI"][0] + scanCaps["map:ResourceLink"][0]["dd:ResourceURI"][0]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = ScanJobManifest;
|
|
24
|
+
//# sourceMappingURL=ScanJobManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScanJobManifest.js","sourceRoot":"","sources":["../../src/models/ScanJobManifest.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAA8B,MAAM,CAAC,WAAW,CAAC,CAAC;AAoB/E,MAAqB,eAAe;IAGlC,YAAY,IAAyB;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAChC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,WAAW;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAChE,kBAAkB,CACnB,CAAC,IAAI,CACJ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAC3E,CAAC;QAEF,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACtE,gBAAgB,CACjB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;IACJ,CAAC;CACF;AA9BD,kCA8BC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, ScanJobManifestData>(parser.parseString);\n\nexport interface ScanJobManifestData {\n \"man:Manifest\": {\n \"map:ResourceMap\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceNode\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceType\": {\n \"scan:ScanResourceType\": string[];\n }[];\n }[];\n }[];\n };\n}\n\nexport default class ScanJobManifest {\n private readonly data: ScanJobManifestData;\n\n constructor(data: ScanJobManifestData) {\n this.data = data;\n }\n static async createScanJobManifest(\n content: string\n ): Promise<ScanJobManifest> {\n const parsed = await parseString(content);\n return new ScanJobManifest(parsed);\n }\n\n get ScanCapsURI(): string | null {\n const scanCaps = this.data[\"man:Manifest\"][\"map:ResourceMap\"][\"0\"][\n \"map:ResourceNode\"\n ].find(\n (x) => x[\"map:ResourceType\"][0][\"scan:ScanResourceType\"][0] === \"ScanCaps\"\n );\n\n if (scanCaps === undefined) {\n return null;\n }\n\n return (\n this.data[\"man:Manifest\"][\"map:ResourceMap\"][\"0\"][\"map:ResourceLink\"][0][\n \"dd:ResourceURI\"\n ][0] + scanCaps[\"map:ResourceLink\"][0][\"dd:ResourceURI\"][0]\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default class ScanJobSettings {
|
|
2
|
+
private readonly inputSource;
|
|
3
|
+
private readonly contentType;
|
|
4
|
+
private readonly resolution;
|
|
5
|
+
private readonly isDuplex;
|
|
6
|
+
constructor(inputSource: "Adf" | "Platen", contentType: "Document" | "Photo", resolution: number, isDuplex: boolean);
|
|
7
|
+
toXML(): Promise<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const xml2js = require("xml2js");
|
|
4
|
+
const parser = new xml2js.Parser();
|
|
5
|
+
const util = require("util");
|
|
6
|
+
class ScanJobSettings {
|
|
7
|
+
constructor(inputSource, contentType, resolution, isDuplex) {
|
|
8
|
+
this.inputSource = inputSource;
|
|
9
|
+
this.contentType = contentType;
|
|
10
|
+
this.resolution = resolution;
|
|
11
|
+
this.isDuplex = isDuplex;
|
|
12
|
+
}
|
|
13
|
+
async toXML() {
|
|
14
|
+
let rawJob = '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
15
|
+
'<ScanSettings xmlns="http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19 Scan Schema - 0.26.xsd">\n' +
|
|
16
|
+
"\t<XResolution>200</XResolution>\n" +
|
|
17
|
+
"\t<YResolution>200</YResolution>\n" +
|
|
18
|
+
"\t<XStart>33</XStart>\n" +
|
|
19
|
+
"\t<YStart>0</YStart>\n" +
|
|
20
|
+
"\t<Width>2481</Width>\n" +
|
|
21
|
+
"\t<Height>3507</Height>\n" +
|
|
22
|
+
"\t<Format>Jpeg</Format>\n" +
|
|
23
|
+
"\t<CompressionQFactor>0</CompressionQFactor>\n" +
|
|
24
|
+
"\t<ColorSpace>Color</ColorSpace>\n" +
|
|
25
|
+
"\t<BitDepth>8</BitDepth>\n" +
|
|
26
|
+
"\t<InputSource>Adf</InputSource>\n" +
|
|
27
|
+
"\t<GrayRendering>NTSC</GrayRendering>\n" +
|
|
28
|
+
"\t<ToneMap>\n" +
|
|
29
|
+
"\t\t<Gamma>1000</Gamma>\n" +
|
|
30
|
+
"\t\t<Brightness>1000</Brightness>\n" +
|
|
31
|
+
"\t\t<Contrast>1000</Contrast>\n" +
|
|
32
|
+
"\t\t<Highlite>179</Highlite>\n" +
|
|
33
|
+
"\t\t<Shadow>25</Shadow>\n" +
|
|
34
|
+
"\t\t<Threshold>0</Threshold>\n" +
|
|
35
|
+
"\t</ToneMap>\n" +
|
|
36
|
+
"\t<SharpeningLevel>128</SharpeningLevel>\n" +
|
|
37
|
+
"\t<NoiseRemoval>0</NoiseRemoval>\n" +
|
|
38
|
+
"\t<ContentType>Document</ContentType>\n" +
|
|
39
|
+
"</ScanSettings>";
|
|
40
|
+
const parsed = await util.promisify(parser.parseString)(rawJob);
|
|
41
|
+
parsed.ScanSettings.XResolution[0] = this.resolution;
|
|
42
|
+
parsed.ScanSettings.YResolution[0] = this.resolution;
|
|
43
|
+
parsed.ScanSettings.InputSource[0] = this.inputSource;
|
|
44
|
+
if (this.inputSource === "Adf" && this.isDuplex) {
|
|
45
|
+
parsed.ScanSettings["AdfOptions"] = [{ AdfOption: ["Duplex"] }];
|
|
46
|
+
}
|
|
47
|
+
parsed.ScanSettings.ContentType[0] = this.contentType;
|
|
48
|
+
let builder = new xml2js.Builder({
|
|
49
|
+
xmldec: { version: "1.0", encoding: "UTF-8", standalone: false },
|
|
50
|
+
renderOpts: { pretty: true, indent: "\t", newline: "\n" },
|
|
51
|
+
});
|
|
52
|
+
return builder.buildObject(parsed);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.default = ScanJobSettings;
|
|
56
|
+
//# sourceMappingURL=ScanJobSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScanJobSettings.js","sourceRoot":"","sources":["../../src/models/ScanJobSettings.ts"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAqB,eAAe;IAMlC,YACE,WAA6B,EAC7B,WAAiC,EACjC,UAAkB,EAClB,QAAiB;QAEjB,IAAI,CAAC,W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AAI,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;YAChE,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;SAC1D,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAjED,kCAiEC","sourcesContent":["const xml2js = require(\"xml2js\");\nconst parser = new xml2js.Parser();\nconst util = require(\"util\");\n\nexport default class ScanJobSettings {\n private readonly inputSource: \"Adf\" | \"Platen\";\n private readonly contentType: \"Document\" | \"Photo\";\n private readonly resolution: number;\n private readonly isDuplex: boolean;\n\n constructor(\n inputSource: \"Adf\" | \"Platen\",\n contentType: \"Document\" | \"Photo\",\n resolution: number,\n isDuplex: boolean\n ) {\n this.inputSource = inputSource;\n this.contentType = contentType;\n this.resolution = resolution;\n this.isDuplex = isDuplex;\n }\n\n async toXML(): Promise<string> {\n let rawJob =\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' +\n '<ScanSettings xmlns=\"http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19 Scan Schema - 0.26.xsd\">\\n' +\n \"\\t<XResolution>200</XResolution>\\n\" +\n \"\\t<YResolution>200</YResolution>\\n\" +\n \"\\t<XStart>33</XStart>\\n\" +\n \"\\t<YStart>0</YStart>\\n\" +\n \"\\t<Width>2481</Width>\\n\" +\n \"\\t<Height>3507</Height>\\n\" +\n \"\\t<Format>Jpeg</Format>\\n\" +\n \"\\t<CompressionQFactor>0</CompressionQFactor>\\n\" +\n \"\\t<ColorSpace>Color</ColorSpace>\\n\" +\n \"\\t<BitDepth>8</BitDepth>\\n\" +\n \"\\t<InputSource>Adf</InputSource>\\n\" +\n \"\\t<GrayRendering>NTSC</GrayRendering>\\n\" +\n \"\\t<ToneMap>\\n\" +\n \"\\t\\t<Gamma>1000</Gamma>\\n\" +\n \"\\t\\t<Brightness>1000</Brightness>\\n\" +\n \"\\t\\t<Contrast>1000</Contrast>\\n\" +\n \"\\t\\t<Highlite>179</Highlite>\\n\" +\n \"\\t\\t<Shadow>25</Shadow>\\n\" +\n \"\\t\\t<Threshold>0</Threshold>\\n\" +\n \"\\t</ToneMap>\\n\" +\n \"\\t<SharpeningLevel>128</SharpeningLevel>\\n\" +\n \"\\t<NoiseRemoval>0</NoiseRemoval>\\n\" +\n \"\\t<ContentType>Document</ContentType>\\n\" +\n \"</ScanSettings>\";\n\n const parsed = await util.promisify(parser.parseString)(rawJob);\n\n parsed.ScanSettings.XResolution[0] = this.resolution;\n parsed.ScanSettings.YResolution[0] = this.resolution;\n\n parsed.ScanSettings.InputSource[0] = this.inputSource;\n if (this.inputSource === \"Adf\" && this.isDuplex) {\n parsed.ScanSettings[\"AdfOptions\"] = [{ AdfOption: [\"Duplex\"] }];\n }\n parsed.ScanSettings.ContentType[0] = this.contentType;\n\n let builder = new xml2js.Builder({\n xmldec: { version: \"1.0\", encoding: \"UTF-8\", standalone: false },\n renderOpts: { pretty: true, indent: \"\\t\", newline: \"\\n\" },\n });\n\n return builder.buildObject(parsed);\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { KnownShortcut } from "../KnownShortcut";
|
|
2
|
+
export interface WalkupScanDestinationData {
|
|
3
|
+
"dd:Name": string[];
|
|
4
|
+
"dd3:Hostname": string[];
|
|
5
|
+
"dd:ResourceURI": string[];
|
|
6
|
+
"wus:WalkupScanSettings": {
|
|
7
|
+
"scantype:ScanSettings": {
|
|
8
|
+
"dd:ScanPlexMode": string[];
|
|
9
|
+
}[];
|
|
10
|
+
"wus:Shortcut": KnownShortcut[];
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export default class WalkupScanDestination {
|
|
14
|
+
private readonly data;
|
|
15
|
+
constructor(data: WalkupScanDestinationData);
|
|
16
|
+
static createWalkupScanDestination(content: string): Promise<WalkupScanDestination>;
|
|
17
|
+
get name(): string;
|
|
18
|
+
get hostname(): string;
|
|
19
|
+
get resourceURI(): string;
|
|
20
|
+
get shortcut(): null | KnownShortcut;
|
|
21
|
+
get scanPlexMode(): string | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const xml2js_1 = require("xml2js");
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const parser = new xml2js_1.Parser();
|
|
6
|
+
const parseString = (0, util_1.promisify)(parser.parseString);
|
|
7
|
+
class WalkupScanDestination {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanDestination(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanDestination(parsed["wus:WalkupScanDestinations"]["wus:WalkupScanDestination"][0]);
|
|
14
|
+
}
|
|
15
|
+
get name() {
|
|
16
|
+
return this.data["dd:Name"][0];
|
|
17
|
+
}
|
|
18
|
+
get hostname() {
|
|
19
|
+
return this.data["dd3:Hostname"][0];
|
|
20
|
+
}
|
|
21
|
+
get resourceURI() {
|
|
22
|
+
return this.data["dd:ResourceURI"][0];
|
|
23
|
+
}
|
|
24
|
+
get shortcut() {
|
|
25
|
+
if (this.data.hasOwnProperty("wus:WalkupScanSettings")) {
|
|
26
|
+
return this.data["wus:WalkupScanSettings"]["0"]["wus:Shortcut"][0];
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
get scanPlexMode() {
|
|
31
|
+
if (this.data.hasOwnProperty("wus:WalkupScanSettings")) {
|
|
32
|
+
return this.data["wus:WalkupScanSettings"]["0"]["scantype:ScanSettings"][0]["dd:ScanPlexMode"][0];
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = WalkupScanDestination;
|
|
38
|
+
//# sourceMappingURL=WalkupScanDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanDestination.js","sourceRoot":"","sources":["../../src/models/WalkupScanDestination.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,+BAAiC;AAGjC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAoBF,MAAqB,qBAAqB;IAExC,YAAY,IAA+B;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,2BAA2B,CACtC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,qBAAqB,CAC9B,MAAM,CAAC,4BAA4B,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC;IACJ,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,EAAE;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;SACpE;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,YAAY;QACd,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,EAAE;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAC7C,uBAAuB,CACxB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzCD,wCAyCC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nimport { promisify } from \"util\";\nimport { KnownShortcut } from \"../KnownShortcut\";\n\nconst parser = new Parser();\nconst parseString = promisify<string, WalkupScanDestinationsData>(\n parser.parseString\n);\n\ninterface WalkupScanDestinationsData {\n \"wus:WalkupScanDestinations\": {\n \"wus:WalkupScanDestination\": WalkupScanDestinationData[];\n };\n}\n\nexport interface WalkupScanDestinationData {\n \"dd:Name\": string[];\n \"dd3:Hostname\": string[];\n \"dd:ResourceURI\": string[];\n \"wus:WalkupScanSettings\": {\n \"scantype:ScanSettings\": {\n \"dd:ScanPlexMode\": string[];\n }[];\n \"wus:Shortcut\": KnownShortcut[];\n }[];\n}\n\nexport default class WalkupScanDestination {\n private readonly data: WalkupScanDestinationData;\n constructor(data: WalkupScanDestinationData) {\n this.data = data;\n }\n static async createWalkupScanDestination(\n content: string\n ): Promise<WalkupScanDestination> {\n const parsed = await parseString(content);\n return new WalkupScanDestination(\n parsed[\"wus:WalkupScanDestinations\"][\"wus:WalkupScanDestination\"][0]\n );\n }\n\n get name(): string {\n return this.data[\"dd:Name\"][0];\n }\n\n get hostname(): string {\n return this.data[\"dd3:Hostname\"][0];\n }\n\n get resourceURI(): string {\n return this.data[\"dd:ResourceURI\"][0];\n }\n\n get shortcut(): null | KnownShortcut {\n if (this.data.hasOwnProperty(\"wus:WalkupScanSettings\")) {\n return this.data[\"wus:WalkupScanSettings\"][\"0\"][\"wus:Shortcut\"][0];\n }\n return null;\n }\n\n get scanPlexMode(): string | null {\n if (this.data.hasOwnProperty(\"wus:WalkupScanSettings\")) {\n return this.data[\"wus:WalkupScanSettings\"][\"0\"][\n \"scantype:ScanSettings\"\n ][0][\"dd:ScanPlexMode\"][0];\n }\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import WalkupScanDestination, { WalkupScanDestinationData } from "./WalkupScanDestination";
|
|
2
|
+
export interface WalkupScanDestinationsData {
|
|
3
|
+
"wus:WalkupScanDestinations": {
|
|
4
|
+
"wus:WalkupScanDestination": WalkupScanDestinationData[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export default class WalkupScanDestinations {
|
|
8
|
+
private readonly data;
|
|
9
|
+
constructor(data: WalkupScanDestinationsData);
|
|
10
|
+
static createWalkupScanDestinations(content: string): Promise<WalkupScanDestinations>;
|
|
11
|
+
get destinations(): WalkupScanDestination[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const xml2js_1 = require("xml2js");
|
|
7
|
+
const parser = new xml2js_1.Parser();
|
|
8
|
+
const util_1 = require("util");
|
|
9
|
+
const parseString = (0, util_1.promisify)(parser.parseString);
|
|
10
|
+
const WalkupScanDestination_1 = __importDefault(require("./WalkupScanDestination"));
|
|
11
|
+
class WalkupScanDestinations {
|
|
12
|
+
constructor(data) {
|
|
13
|
+
this.data = data;
|
|
14
|
+
}
|
|
15
|
+
static async createWalkupScanDestinations(content) {
|
|
16
|
+
const parsed = await parseString(content);
|
|
17
|
+
return new WalkupScanDestinations(parsed);
|
|
18
|
+
}
|
|
19
|
+
get destinations() {
|
|
20
|
+
let walkupScanDestinations = this.data["wus:WalkupScanDestinations"];
|
|
21
|
+
if (walkupScanDestinations.hasOwnProperty("wus:WalkupScanDestination")) {
|
|
22
|
+
return walkupScanDestinations["wus:WalkupScanDestination"].map((x) => new WalkupScanDestination_1.default(x));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = WalkupScanDestinations;
|
|
30
|
+
//# sourceMappingURL=WalkupScanDestinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanDestinations.js","sourceRoot":"","sources":["../../src/models/WalkupScanDestinations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAEF,oFAEiC;AAQjC,MAAqB,sBAAsB;IAEzC,YAAY,IAAgC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,4BAA4B,CACvC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,YAAY;QACd,IAAI,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrE,IAAI,sBAAsB,CAAC,cAAc,CAAC,2BAA2B,CAAC,EAAE;YACtE,OAAO,sBAAsB,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAC5D,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,+BAAqB,CAAC,CAAC,CAAC,CACpC,CAAC;SACH;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AAtBD,yCAsBC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanDestinationsData>(\n parser.parseString\n);\n\nimport WalkupScanDestination, {\n WalkupScanDestinationData,\n} from \"./WalkupScanDestination\";\n\nexport interface WalkupScanDestinationsData {\n \"wus:WalkupScanDestinations\": {\n \"wus:WalkupScanDestination\": WalkupScanDestinationData[];\n };\n}\n\nexport default class WalkupScanDestinations {\n private readonly data: WalkupScanDestinationsData;\n constructor(data: WalkupScanDestinationsData) {\n this.data = data;\n }\n static async createWalkupScanDestinations(\n content: string\n ): Promise<WalkupScanDestinations> {\n const parsed = await parseString(content);\n return new WalkupScanDestinations(parsed);\n }\n\n get destinations(): WalkupScanDestination[] {\n let walkupScanDestinations = this.data[\"wus:WalkupScanDestinations\"];\n if (walkupScanDestinations.hasOwnProperty(\"wus:WalkupScanDestination\")) {\n return walkupScanDestinations[\"wus:WalkupScanDestination\"].map(\n (x) => new WalkupScanDestination(x)\n );\n } else {\n return [];\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface WalkupScanManifestData {
|
|
2
|
+
"man:Manifest": {
|
|
3
|
+
"map:ResourceMap": {
|
|
4
|
+
"map:ResourceLink": {
|
|
5
|
+
"dd:ResourceURI": string[];
|
|
6
|
+
}[];
|
|
7
|
+
"map:ResourceNode": {
|
|
8
|
+
"map:ResourceLink": {
|
|
9
|
+
"dd:ResourceURI": string[];
|
|
10
|
+
}[];
|
|
11
|
+
"map:ResourceType": {
|
|
12
|
+
"wus:WalkupScanResourceType": string[];
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export default class WalkupScanManifest {
|
|
19
|
+
private readonly data;
|
|
20
|
+
constructor(data: WalkupScanManifestData);
|
|
21
|
+
static createWalkupScanManifest(content: string): Promise<WalkupScanManifest>;
|
|
22
|
+
get walkupScanDestinationsURI(): string | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 WalkupScanManifest {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanManifest(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanManifest(parsed);
|
|
14
|
+
}
|
|
15
|
+
get walkupScanDestinationsURI() {
|
|
16
|
+
const walkupScanToCompCaps = this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceNode"].find((x) => x["map:ResourceType"][0]["wus:WalkupScanResourceType"][0] ===
|
|
17
|
+
"WalkupScanDestinations");
|
|
18
|
+
if (walkupScanToCompCaps === undefined) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceLink"][0]["dd:ResourceURI"][0] + walkupScanToCompCaps["map:ResourceLink"][0]["dd:ResourceURI"][0]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = WalkupScanManifest;
|
|
25
|
+
//# sourceMappingURL=WalkupScanManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanManifest.js","sourceRoot":"","sources":["../../src/models/WalkupScanManifest.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAoBF,MAAqB,kBAAkB;IAGrC,YAAY,IAA4B;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,wBAAwB,CACnC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,yBAAyB;QAC3B,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CACvE,GAAG,CACJ,CAAC,kBAAkB,CAAC,CAAC,IAAI,CACxB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;YACzD,wBAAwB,CAC3B,CAAC;QAEF,IAAI,oBAAoB,KAAK,SAAS,EAAE;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACtE,gBAAgB,CACjB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;CACF;AAhCD,qCAgCC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanManifestData>(\n parser.parseString\n);\n\nexport interface WalkupScanManifestData {\n \"man:Manifest\": {\n \"map:ResourceMap\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceNode\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceType\": {\n \"wus:WalkupScanResourceType\": string[];\n }[];\n }[];\n }[];\n };\n}\n\nexport default class WalkupScanManifest {\n private readonly data: WalkupScanManifestData;\n\n constructor(data: WalkupScanManifestData) {\n this.data = data;\n }\n static async createWalkupScanManifest(\n content: string\n ): Promise<WalkupScanManifest> {\n const parsed = await parseString(content);\n return new WalkupScanManifest(parsed);\n }\n\n get walkupScanDestinationsURI(): string | null {\n const walkupScanToCompCaps = this.data[\"man:Manifest\"][\"map:ResourceMap\"][\n \"0\"\n ][\"map:ResourceNode\"].find(\n (x) =>\n x[\"map:ResourceType\"][0][\"wus:WalkupScanResourceType\"][0] ===\n \"WalkupScanDestinations\"\n );\n\n if (walkupScanToCompCaps === undefined) {\n return null;\n }\n\n return (\n this.data[\"man:Manifest\"][\"map:ResourceMap\"][\"0\"][\"map:ResourceLink\"][0][\n \"dd:ResourceURI\"\n ][0] + walkupScanToCompCaps[\"map:ResourceLink\"][0][\"dd:ResourceURI\"][0]\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface WalkupScanToCompCapsData {
|
|
2
|
+
"wus:WalkupScanToCompCaps": {
|
|
3
|
+
"wus:MaxNetworkDestinations": string[];
|
|
4
|
+
"wus:SupportsMultiItemScanFromPlaten": string[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export default class WalkupScanToCompCaps {
|
|
8
|
+
private readonly data;
|
|
9
|
+
constructor(data: WalkupScanToCompCapsData);
|
|
10
|
+
static createWalkupScanToCompCaps(content: string): Promise<WalkupScanToCompCaps>;
|
|
11
|
+
get supportsMultiItemScanFromPlaten(): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 WalkupScanToCompCaps {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanToCompCaps(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanToCompCaps(parsed);
|
|
14
|
+
}
|
|
15
|
+
get supportsMultiItemScanFromPlaten() {
|
|
16
|
+
return (this.data["wus:WalkupScanToCompCaps"]["wus:SupportsMultiItemScanFromPlaten"]["0"] === "true");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = WalkupScanToCompCaps;
|
|
20
|
+
//# sourceMappingURL=WalkupScanToCompCaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanToCompCaps.js","sourceRoot":"","sources":["../../src/models/WalkupScanToCompCaps.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAQF,MAAqB,oBAAoB;IAGvC,YAAY,IAA8B;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,0BAA0B,CACrC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,+BAA+B;QACjC,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CACnC,qCAAqC,CACtC,CAAC,GAAG,CAAC,KAAK,MAAM,CAClB,CAAC;IACJ,CAAC;CACF;AArBD,uCAqBC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanToCompCapsData>(\n parser.parseString\n);\nexport interface WalkupScanToCompCapsData {\n \"wus:WalkupScanToCompCaps\": {\n \"wus:MaxNetworkDestinations\": string[];\n \"wus:SupportsMultiItemScanFromPlaten\": string[];\n };\n}\n\nexport default class WalkupScanToCompCaps {\n private readonly data: WalkupScanToCompCapsData;\n\n constructor(data: WalkupScanToCompCapsData) {\n this.data = data;\n }\n\n static async createWalkupScanToCompCaps(\n content: string\n ): Promise<WalkupScanToCompCaps> {\n const parsed = await parseString(content);\n return new WalkupScanToCompCaps(parsed);\n }\n\n get supportsMultiItemScanFromPlaten(): boolean {\n return (\n this.data[\"wus:WalkupScanToCompCaps\"][\n \"wus:SupportsMultiItemScanFromPlaten\"\n ][\"0\"] === \"true\"\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { KnownShortcut } from "../KnownShortcut";
|
|
2
|
+
export interface WalkupScanToCompDestinationData {
|
|
3
|
+
"dd:Name": string[];
|
|
4
|
+
"dd:ResourceURI": string[];
|
|
5
|
+
"dd3:Hostname": string[];
|
|
6
|
+
"wus:WalkupScanToCompSettings": {
|
|
7
|
+
"scantype:ScanSettings": {
|
|
8
|
+
"dd:ScanPlexMode": string[];
|
|
9
|
+
}[];
|
|
10
|
+
"wus:Shortcut": KnownShortcut[];
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export default class WalkupScanToCompDestination {
|
|
14
|
+
private readonly data;
|
|
15
|
+
constructor(data: WalkupScanToCompDestinationData);
|
|
16
|
+
static createWalkupScanToCompDestination(content: string): Promise<WalkupScanToCompDestination>;
|
|
17
|
+
get name(): string;
|
|
18
|
+
get hostname(): string;
|
|
19
|
+
get resourceURI(): string;
|
|
20
|
+
get shortcut(): null | KnownShortcut;
|
|
21
|
+
get scanPlexMode(): string | null;
|
|
22
|
+
}
|
|
@@ -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 WalkupScanToCompDestination {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanToCompDestination(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanToCompDestination(parsed["wus:WalkupScanToCompDestination"]);
|
|
14
|
+
}
|
|
15
|
+
get name() {
|
|
16
|
+
return this.data["dd:Name"][0];
|
|
17
|
+
}
|
|
18
|
+
get hostname() {
|
|
19
|
+
return this.data["dd3:Hostname"][0];
|
|
20
|
+
}
|
|
21
|
+
get resourceURI() {
|
|
22
|
+
return this.data["dd:ResourceURI"][0];
|
|
23
|
+
}
|
|
24
|
+
get shortcut() {
|
|
25
|
+
if (this.data.hasOwnProperty("wus:WalkupScanToCompSettings")) {
|
|
26
|
+
return this.data["wus:WalkupScanToCompSettings"]["0"]["wus:Shortcut"][0];
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
get scanPlexMode() {
|
|
31
|
+
if (this.data.hasOwnProperty("wus:WalkupScanToCompSettings")) {
|
|
32
|
+
return (this.data["wus:WalkupScanToCompSettings"]["0"]["scantype:ScanSettings"]["0"]["dd:ScanPlexMode"][0] || null);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = WalkupScanToCompDestination;
|
|
38
|
+
//# sourceMappingURL=WalkupScanToCompDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanToCompDestination.js","sourceRoot":"","sources":["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E,GAAG,CACJ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAChC,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3CD,8CA2CC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nimport { KnownShortcut } from \"../KnownShortcut\";\nconst parseString = promisify<string, WalkupScanToCompDestinationRoot>(\n parser.parseString\n);\n\ninterface WalkupScanToCompDestinationRoot {\n \"wus:WalkupScanToCompDestination\": WalkupScanToCompDestinationData;\n}\n\nexport interface WalkupScanToCompDestinationData {\n \"dd:Name\": string[];\n \"dd:ResourceURI\": string[];\n \"dd3:Hostname\": string[];\n \"wus:WalkupScanToCompSettings\": {\n \"scantype:ScanSettings\": {\n \"dd:ScanPlexMode\": string[];\n }[];\n \"wus:Shortcut\": KnownShortcut[];\n }[];\n}\n\nexport default class WalkupScanToCompDestination {\n private readonly data: WalkupScanToCompDestinationData;\n constructor(data: WalkupScanToCompDestinationData) {\n this.data = data;\n }\n static async createWalkupScanToCompDestination(\n content: string\n ): Promise<WalkupScanToCompDestination> {\n const parsed = await parseString(content);\n return new WalkupScanToCompDestination(\n parsed[\"wus:WalkupScanToCompDestination\"]\n );\n }\n\n get name(): string {\n return this.data[\"dd:Name\"][0];\n }\n\n get hostname(): string {\n return this.data[\"dd3:Hostname\"][0];\n }\n\n get resourceURI(): string {\n return this.data[\"dd:ResourceURI\"][0];\n }\n\n get shortcut(): null | KnownShortcut {\n if (this.data.hasOwnProperty(\"wus:WalkupScanToCompSettings\")) {\n return this.data[\"wus:WalkupScanToCompSettings\"][\"0\"][\"wus:Shortcut\"][0];\n }\n return null;\n }\n\n get scanPlexMode(): string | null {\n if (this.data.hasOwnProperty(\"wus:WalkupScanToCompSettings\")) {\n return (\n this.data[\"wus:WalkupScanToCompSettings\"][\"0\"][\"scantype:ScanSettings\"][\n \"0\"\n ][\"dd:ScanPlexMode\"][0] || null\n );\n }\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import WalkupScanToCompDestination, { WalkupScanToCompDestinationData } from "./WalkupScanToCompDestination";
|
|
2
|
+
export interface WalkupScanToCompDestinationsData {
|
|
3
|
+
"wus:WalkupScanToCompDestinations": {
|
|
4
|
+
"wus:WalkupScanToCompDestination": WalkupScanToCompDestinationData[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export default class WalkupScanToCompDestinations {
|
|
8
|
+
private readonly data;
|
|
9
|
+
constructor(data: WalkupScanToCompDestinationsData);
|
|
10
|
+
static createWalkupScanToCompDestinations(content: string): Promise<WalkupScanToCompDestinations>;
|
|
11
|
+
get destinations(): WalkupScanToCompDestination[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const xml2js_1 = require("xml2js");
|
|
7
|
+
const parser = new xml2js_1.Parser();
|
|
8
|
+
const util_1 = require("util");
|
|
9
|
+
const parseString = (0, util_1.promisify)(parser.parseString);
|
|
10
|
+
const WalkupScanToCompDestination_1 = __importDefault(require("./WalkupScanToCompDestination"));
|
|
11
|
+
class WalkupScanToCompDestinations {
|
|
12
|
+
constructor(data) {
|
|
13
|
+
this.data = data;
|
|
14
|
+
}
|
|
15
|
+
static async createWalkupScanToCompDestinations(content) {
|
|
16
|
+
const parsed = await parseString(content);
|
|
17
|
+
return new WalkupScanToCompDestinations(parsed);
|
|
18
|
+
}
|
|
19
|
+
get destinations() {
|
|
20
|
+
let walkupScanToCompDestinations = this.data["wus:WalkupScanToCompDestinations"];
|
|
21
|
+
if (walkupScanToCompDestinations.hasOwnProperty("wus:WalkupScanToCompDestination")) {
|
|
22
|
+
return walkupScanToCompDestinations["wus:WalkupScanToCompDestination"].map((x) => new WalkupScanToCompDestination_1.default(x));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = WalkupScanToCompDestinations;
|
|
30
|
+
//# sourceMappingURL=WalkupScanToCompDestinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanToCompDestinations.js","sourceRoot":"","sources":["../../src/models/WalkupScanToCompDestinations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAEF,gGAEuC;AAQvC,MAAqB,4BAA4B;IAE/C,YAAY,IAAsC;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAC7C,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,YAAY;QACd,IAAI,4BAA4B,GAC9B,IAAI,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAChD,IACE,4BAA4B,CAAC,cAAc,CACzC,iCAAiC,CAClC,EACD;YACA,OAAO,4BAA4B,CACjC,iCAAiC,CAClC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,qCAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;SAClD;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AA3BD,+CA2BC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanToCompDestinationsData>(\n parser.parseString\n);\n\nimport WalkupScanToCompDestination, {\n WalkupScanToCompDestinationData,\n} from \"./WalkupScanToCompDestination\";\n\nexport interface WalkupScanToCompDestinationsData {\n \"wus:WalkupScanToCompDestinations\": {\n \"wus:WalkupScanToCompDestination\": WalkupScanToCompDestinationData[];\n };\n}\n\nexport default class WalkupScanToCompDestinations {\n private readonly data: WalkupScanToCompDestinationsData;\n constructor(data: WalkupScanToCompDestinationsData) {\n this.data = data;\n }\n static async createWalkupScanToCompDestinations(\n content: string\n ): Promise<WalkupScanToCompDestinations> {\n const parsed = await parseString(content);\n return new WalkupScanToCompDestinations(parsed);\n }\n\n get destinations(): WalkupScanToCompDestination[] {\n let walkupScanToCompDestinations =\n this.data[\"wus:WalkupScanToCompDestinations\"];\n if (\n walkupScanToCompDestinations.hasOwnProperty(\n \"wus:WalkupScanToCompDestination\"\n )\n ) {\n return walkupScanToCompDestinations[\n \"wus:WalkupScanToCompDestination\"\n ].map((x) => new WalkupScanToCompDestination(x));\n } else {\n return [];\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface WalkupScanToCompEventData {
|
|
2
|
+
"wus:WalkupScanToCompEvent": {
|
|
3
|
+
"wus:WalkupScanToCompEventType": string[];
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export default class WalkupScanToCompEvent {
|
|
7
|
+
private readonly data;
|
|
8
|
+
constructor(data: WalkupScanToCompEventData);
|
|
9
|
+
static createWalkupScanToCompEvent(content: string): Promise<WalkupScanToCompEvent>;
|
|
10
|
+
get eventType(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 WalkupScanToCompEvent {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanToCompEvent(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanToCompEvent(parsed);
|
|
14
|
+
}
|
|
15
|
+
get eventType() {
|
|
16
|
+
return this.data["wus:WalkupScanToCompEvent"]["wus:WalkupScanToCompEventType"][0];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = WalkupScanToCompEvent;
|
|
20
|
+
//# sourceMappingURL=WalkupScanToCompEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanToCompEvent.js","sourceRoot":"","sources":["../../src/models/WalkupScanToCompEvent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAQF,MAAqB,qBAAqB;IAExC,YAAY,IAA+B;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,OAAe;QACtD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAC3C,+BAA+B,CAChC,CAAC,CAAC,CAAC,CAAC;IACP,CAAC;CACF;AAfD,wCAeC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanToCompEventData>(\n parser.parseString\n);\n\nexport interface WalkupScanToCompEventData {\n \"wus:WalkupScanToCompEvent\": {\n \"wus:WalkupScanToCompEventType\": string[];\n };\n}\n\nexport default class WalkupScanToCompEvent {\n private readonly data: WalkupScanToCompEventData;\n constructor(data: WalkupScanToCompEventData) {\n this.data = data;\n }\n static async createWalkupScanToCompEvent(content: string) {\n const parsed = await parseString(content);\n return new WalkupScanToCompEvent(parsed);\n }\n\n get eventType(): string {\n return this.data[\"wus:WalkupScanToCompEvent\"][\n \"wus:WalkupScanToCompEventType\"\n ][0];\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface WalkupScanToCompManifestData {
|
|
2
|
+
"man:Manifest": {
|
|
3
|
+
"map:ResourceMap": {
|
|
4
|
+
"map:ResourceLink": {
|
|
5
|
+
"dd:ResourceURI": string[];
|
|
6
|
+
}[];
|
|
7
|
+
"map:ResourceNode": {
|
|
8
|
+
"map:ResourceLink": {
|
|
9
|
+
"dd:ResourceURI": string[];
|
|
10
|
+
}[];
|
|
11
|
+
"map:ResourceType": {
|
|
12
|
+
"wus:WalkupScanToCompResourceType": string[];
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export default class WalkupScanToCompManifest {
|
|
19
|
+
private readonly data;
|
|
20
|
+
constructor(data: WalkupScanToCompManifestData);
|
|
21
|
+
static createWalkupScanToCompManifest(content: string): Promise<WalkupScanToCompManifest>;
|
|
22
|
+
get WalkupScanToCompCapsURI(): string | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 WalkupScanToCompManifest {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
static async createWalkupScanToCompManifest(content) {
|
|
12
|
+
const parsed = await parseString(content);
|
|
13
|
+
return new WalkupScanToCompManifest(parsed);
|
|
14
|
+
}
|
|
15
|
+
get WalkupScanToCompCapsURI() {
|
|
16
|
+
const walkupScanToCompCaps = this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceNode"].find((x) => x["map:ResourceType"][0]["wus:WalkupScanToCompResourceType"][0] ===
|
|
17
|
+
"WalkupScanToCompCaps");
|
|
18
|
+
if (walkupScanToCompCaps === undefined) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (this.data["man:Manifest"]["map:ResourceMap"]["0"]["map:ResourceLink"][0]["dd:ResourceURI"][0] + walkupScanToCompCaps["map:ResourceLink"][0]["dd:ResourceURI"][0]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = WalkupScanToCompManifest;
|
|
25
|
+
//# sourceMappingURL=WalkupScanToCompManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalkupScanToCompManifest.js","sourceRoot":"","sources":["../../src/models/WalkupScanToCompManifest.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,mCAAgC;AAChC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;AAC5B,+BAAiC;AACjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC;AAoBF,MAAqB,wBAAwB;IAG3C,YAAY,IAAkC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,8BAA8B,CACzC,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,uBAAuB;QACzB,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CACvE,GAAG,CACJ,CAAC,kBAAkB,CAAC,CAAC,IAAI,CACxB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC;YAC/D,sBAAsB,CACzB,CAAC;QAEF,IAAI,oBAAoB,KAAK,SAAS,EAAE;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACtE,gBAAgB,CACjB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;CACF;AAhCD,2CAgCC","sourcesContent":["\"use strict\";\nimport { Parser } from \"xml2js\";\nconst parser = new Parser();\nimport { promisify } from \"util\";\nconst parseString = promisify<string, WalkupScanToCompManifestData>(\n parser.parseString\n);\n\nexport interface WalkupScanToCompManifestData {\n \"man:Manifest\": {\n \"map:ResourceMap\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceNode\": {\n \"map:ResourceLink\": {\n \"dd:ResourceURI\": string[];\n }[];\n \"map:ResourceType\": {\n \"wus:WalkupScanToCompResourceType\": string[];\n }[];\n }[];\n }[];\n };\n}\n\nexport default class WalkupScanToCompManifest {\n private readonly data: WalkupScanToCompManifestData;\n\n constructor(data: WalkupScanToCompManifestData) {\n this.data = data;\n }\n static async createWalkupScanToCompManifest(\n content: string\n ): Promise<WalkupScanToCompManifest> {\n const parsed = await parseString(content);\n return new WalkupScanToCompManifest(parsed);\n }\n\n get WalkupScanToCompCapsURI(): string | null {\n const walkupScanToCompCaps = this.data[\"man:Manifest\"][\"map:ResourceMap\"][\n \"0\"\n ][\"map:ResourceNode\"].find(\n (x) =>\n x[\"map:ResourceType\"][0][\"wus:WalkupScanToCompResourceType\"][0] ===\n \"WalkupScanToCompCaps\"\n );\n\n if (walkupScanToCompCaps === undefined) {\n return null;\n }\n\n return (\n this.data[\"man:Manifest\"][\"map:ResourceMap\"][\"0\"][\"map:ResourceLink\"][0][\n \"dd:ResourceURI\"\n ][0] + walkupScanToCompCaps[\"map:ResourceLink\"][0][\"dd:ResourceURI\"][0]\n );\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -281,7 +281,7 @@ async function main() {
|
|
|
281
281
|
|
|
282
282
|
const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);
|
|
283
283
|
|
|
284
|
-
const scanConfig = getScanConfiguration(
|
|
284
|
+
const scanConfig = getScanConfiguration(options);
|
|
285
285
|
|
|
286
286
|
await listenCmd(registrationConfig, scanConfig, deviceUpPollingInterval);
|
|
287
287
|
});
|
|
@@ -327,7 +327,7 @@ async function main() {
|
|
|
327
327
|
|
|
328
328
|
const deviceUpPollingInterval = getDeviceUpPollingInterval(parentOption);
|
|
329
329
|
|
|
330
|
-
const scanConfig = getScanConfiguration(
|
|
330
|
+
const scanConfig = getScanConfiguration(options);
|
|
331
331
|
|
|
332
332
|
const adfScanConfig: AdfAutoScanConfig = {
|
|
333
333
|
...scanConfig,
|