New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yume-chan/adb-daemon-webusb

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yume-chan/adb-daemon-webusb - npm Package Compare versions

Comparing version 0.0.0-next-20240917062356 to 0.0.0-next-20241129144018

esm/observer.d.ts

59

CHANGELOG.md
# Change Log - @yume-chan/adb-daemon-webusb
## 0.0.0-next-20240917062356
## 0.0.0-next-20241129144018
### Major Changes
- 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
- 53688d3: Use PNPM workspace and Changesets to manage the monorepo.

@@ -13,6 +13,13 @@ Because Changesets doesn't support alpha versions (`0.x.x`), this version is `1.0.0`. Future versions will follow SemVer rules, for example, breaking API changes will introduce a new major version.

- Updated dependencies [53688d3]
- @yume-chan/stream-extra@0.0.0-next-20240917062356
- @yume-chan/struct@0.0.0-next-20240917062356
- @yume-chan/adb@0.0.0-next-20240917062356
- db8466f: Accept standard `USBDeviceFilter` type and fill in default interface filters automatically
- db8466f: Throw `DeviceBusyError` when interface can't be claimed
- Updated dependencies [53688d3]
- Updated dependencies [db8466f]
- Updated dependencies [db8466f]
- Updated dependencies [ea5002b]
- Updated dependencies [db8466f]
- @yume-chan/stream-extra@0.0.0-next-20241129144018
- @yume-chan/struct@0.0.0-next-20241129144018
- @yume-chan/event@0.0.0-next-20241129144018
- @yume-chan/adb@0.0.0-next-20241129144018

@@ -33,3 +40,3 @@ This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.

- Fix `AdbDaemonWebUsbDeviceManager.getDevices` doesn't match auto-generated serial number against `filters.serialNumber` (if the device doesn't have a serial number)
- Fix `AdbDaemonWebUsbDeviceManager.getDevices` doesn't match auto-generated serial number against `filters.serialNumber` (if the device doesn't have a serial number)

@@ -42,5 +49,5 @@ ## 0.0.22

- Check incoming packet size to prevent Chrome from crashing
- Add `exclusionFilters` option to `AdbDaemonWebUsbDeviceManager#requestDevice` method
- `AdbDaemonWebUsbDevice` will generate a fake serial number from vid and pid if the device serial number is empty
- Check incoming packet size to prevent Chrome from crashing
- Add `exclusionFilters` option to `AdbDaemonWebUsbDeviceManager#requestDevice` method
- `AdbDaemonWebUsbDevice` will generate a fake serial number from vid and pid if the device serial number is empty

@@ -59,7 +66,7 @@ ## 0.0.21

- Use ECMAScript private class fields syntax (supported by Chrome 74, Firefox 90, Safari 14.1 and Node.js 12.0.0).
- Rename package to `@yume-chan/adb-daemon-webusb` following the renaming of `AdbDaemonTransport`.
- Rename `AdbWebUsbBackend` to `AdbDaemonWebUsbDevice` following the renaming of `AdbDaemonTransport`.
- Add Support for detecting device disconnects. It no longer throws an `NetworkError` when the device is disconnected.
- Add `filters` parameter to `AdbDaemonWebUsbDeviceManager#getDevices`. The filtration is manually implemented because WebUSB's `getDevice` API doesn't support filters.
- Use ECMAScript private class fields syntax (supported by Chrome 74, Firefox 90, Safari 14.1 and Node.js 12.0.0).
- Rename package to `@yume-chan/adb-daemon-webusb` following the renaming of `AdbDaemonTransport`.
- Rename `AdbWebUsbBackend` to `AdbDaemonWebUsbDevice` following the renaming of `AdbDaemonTransport`.
- Add Support for detecting device disconnects. It no longer throws an `NetworkError` when the device is disconnected.
- Add `filters` parameter to `AdbDaemonWebUsbDeviceManager#getDevices`. The filtration is manually implemented because WebUSB's `getDevice` API doesn't support filters.

@@ -72,4 +79,4 @@ ## 0.0.19

- Remove stream queuing
- Add the `AdbWebUsbBackendManager` class to simplify the usage with custom WebUSB implementations (for example the `usb` NPM package).
- Remove stream queuing
- Add the `AdbWebUsbBackendManager` class to simplify the usage with custom WebUSB implementations (for example the `usb` NPM package).

@@ -82,3 +89,3 @@ ## 0.0.18

- Add an option to specify USB filters
- Add an option to specify USB filters

@@ -91,3 +98,3 @@ ## 0.0.17

- Update to use new stream util package
- Update to use new stream util package

@@ -100,3 +107,3 @@ ## 0.0.16

- Upgrade TypeScript to 4.7.2 to enable Node.js ESM
- Upgrade TypeScript to 4.7.2 to enable Node.js ESM

@@ -109,3 +116,3 @@ ## 0.0.15

- Improve connection lifecycle handling
- Improve connection lifecycle handling

@@ -124,3 +131,3 @@ ## 0.0.14

- Workaround an issue in Chrome where `transferIn` never returns `babble` on Windows
- Workaround an issue in Chrome where `transferIn` never returns `babble` on Windows

@@ -139,5 +146,5 @@ ## 0.0.12

- Update to use Web Streams API
- Improve compatibility with Node.js 12 ESM format
- Update license year
- Update to use Web Streams API
- Improve compatibility with Node.js 12 ESM format
- Update license year

@@ -150,3 +157,3 @@ ## 0.0.10

- Remove `encodeUtf8()` and `decodeUtf8()` from `AdbBackend`
- Remove `encodeUtf8()` and `decodeUtf8()` from `AdbBackend`

@@ -153,0 +160,0 @@ ## 0.0.9

@@ -20,10 +20,3 @@ import type { AdbDaemonDevice, AdbPacketData, AdbPacketInit } from "@yume-chan/adb";

get readable(): ReadableStream<AdbPacketData>;
get writable(): WritableStream<Consumable<{
command: number;
arg0: number;
arg1: number;
checksum: number;
magic: number;
payload: Uint8Array;
}>>;
get writable(): WritableStream<Consumable<AdbPacketInit>>;
constructor(device: AdbDaemonWebUsbDevice, inEndpoint: USBEndpoint, outEndpoint: USBEndpoint, usbManager: USB);

@@ -45,4 +38,2 @@ }

* Open the device and create a new connection to the ADB Daemon.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/create-connection/)
*/

@@ -49,0 +40,0 @@ connect(): Promise<AdbDaemonWebUsbConnection>;

import { AdbPacketHeader, AdbPacketSerializeStream, unreachable, } from "@yume-chan/adb";
import { DuplexStreamFactory, MaybeConsumable, ReadableStream, pipeFrom, } from "@yume-chan/stream-extra";
import { EMPTY_UINT8_ARRAY } from "@yume-chan/struct";
import { EmptyUint8Array } from "@yume-chan/struct";
import { findUsbAlternateInterface, findUsbEndpoints, getSerialNumber, isErrorName, } from "./utils.js";

@@ -112,3 +112,3 @@ /**

if (zeroMask && (chunk.length & zeroMask) === 0) {
await device.raw.transferOut(outEndpoint.endpointNumber, EMPTY_UINT8_ARRAY);
await device.raw.transferOut(outEndpoint.endpointNumber, EmptyUint8Array);
}

@@ -146,3 +146,3 @@ }

else {
packet.payload = EMPTY_UINT8_ARRAY;
packet.payload = EmptyUint8Array;
}

@@ -227,4 +227,2 @@ return packet;

* Open the device and create a new connection to the ADB Daemon.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/create-connection/)
*/

@@ -231,0 +229,0 @@ async connect() {

export * from "./device.js";
export * from "./manager.js";
export * from "./utils.js";
export * from "./watcher.js";
export * from "./observer.js";
//# sourceMappingURL=index.d.ts.map
export * from "./device.js";
export * from "./manager.js";
export * from "./utils.js";
export * from "./watcher.js";
export * from "./observer.js";
//# sourceMappingURL=index.js.map
import { AdbDaemonWebUsbDevice } from "./device.js";
import { AdbDaemonWebUsbDeviceObserver } from "./observer.js";
export declare namespace AdbDaemonWebUsbDeviceManager {

@@ -8,5 +9,2 @@ interface RequestDeviceOptions {

}
/**
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/device-manager/)
*/
export declare class AdbDaemonWebUsbDeviceManager {

@@ -27,4 +25,2 @@ #private;

* Call `USB#requestDevice()` to prompt the user to select a device.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/request-device/)
*/

@@ -34,7 +30,6 @@ requestDevice(options?: AdbDaemonWebUsbDeviceManager.RequestDeviceOptions): Promise<AdbDaemonWebUsbDevice | undefined>;

* Get all connected and requested devices that match the specified filters.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/get-devices/)
*/
getDevices(filters?: USBDeviceFilter[]): Promise<AdbDaemonWebUsbDevice[]>;
trackDevices(filters?: USBDeviceFilter[]): AdbDaemonWebUsbDeviceObserver;
}
//# sourceMappingURL=manager.d.ts.map
import { AdbDaemonWebUsbDevice, toAdbDeviceFilters } from "./device.js";
import { findUsbAlternateInterface, getSerialNumber, isErrorName, } from "./utils.js";
/**
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/device-manager/)
*/
import { AdbDaemonWebUsbDeviceObserver } from "./observer.js";
import { isErrorName, matchesFilters } from "./utils.js";
export class AdbDaemonWebUsbDeviceManager {

@@ -26,4 +24,2 @@ /**

* Call `USB#requestDevice()` to prompt the user to select a device.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/request-device/)
*/

@@ -51,29 +47,9 @@ async requestDevice(options = {}) {

return devices
.filter((device) => {
for (const filter of filters) {
if (filter.vendorId !== undefined &&
device.vendorId !== filter.vendorId) {
continue;
}
if (filter.productId !== undefined &&
device.productId !== filter.productId) {
continue;
}
if (filter.serialNumber !== undefined &&
getSerialNumber(device) !== filter.serialNumber) {
continue;
}
try {
findUsbAlternateInterface(device, filters);
return true;
}
catch {
continue;
}
}
return false;
})
.filter((device) => matchesFilters(device, filters))
.map((device) => new AdbDaemonWebUsbDevice(device, filters, this.#usbManager));
}
trackDevices(filters) {
return new AdbDaemonWebUsbDeviceObserver(this.#usbManager, filters);
}
}
//# sourceMappingURL=manager.js.map

@@ -25,2 +25,3 @@ export declare function isErrorName(e: unknown, name: string): e is Error;

};
export declare function matchesFilters(device: USBDevice, filters: (USBDeviceFilter & UsbInterfaceFilter)[]): boolean;
//# sourceMappingURL=utils.d.ts.map

@@ -68,2 +68,26 @@ export function isErrorName(e, name) {

}
export function matchesFilters(device, filters) {
for (const filter of filters) {
if (filter.vendorId !== undefined &&
device.vendorId !== filter.vendorId) {
continue;
}
if (filter.productId !== undefined &&
device.productId !== filter.productId) {
continue;
}
if (filter.serialNumber !== undefined &&
getSerialNumber(device) !== filter.serialNumber) {
continue;
}
try {
findUsbAlternateInterface(device, filters);
return true;
}
catch {
continue;
}
}
return false;
}
//# sourceMappingURL=utils.js.map
{
"name": "@yume-chan/adb-daemon-webusb",
"version": "0.0.0-next-20240917062356",
"version": "0.0.0-next-20241129144018",
"description": "Adb daemon transport connection for `@yume-chan/adb` using WebUSB API.",

@@ -30,13 +30,14 @@ "keywords": [

"@types/w3c-web-usb": "^1.0.10",
"@yume-chan/adb": "^0.0.0-next-20240917062356",
"@yume-chan/stream-extra": "^0.0.0-next-20240917062356",
"@yume-chan/struct": "^0.0.0-next-20240917062356"
"@yume-chan/adb": "^0.0.0-next-20241129144018",
"@yume-chan/event": "^0.0.0-next-20241129144018",
"@yume-chan/stream-extra": "^0.0.0-next-20241129144018",
"@yume-chan/struct": "^0.0.0-next-20241129144018"
},
"devDependencies": {
"@types/node": "^22.5.5",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"@types/node": "^22.10.0",
"prettier": "^3.4.1",
"typescript": "^5.7.2",
"@yume-chan/test-runner": "^1.0.0",
"@yume-chan/eslint-config": "^1.0.0",
"@yume-chan/tsconfig": "^1.0.0",
"@yume-chan/test-runner": "^1.0.0"
"@yume-chan/tsconfig": "^1.0.0"
},

@@ -43,0 +44,0 @@ "scripts": {

@@ -33,3 +33,3 @@ <p align="center">

Check the latest documentation at https://docs.tangoapp.dev/tango/daemon/usb/device-manager/
Check the latest documentation at https://docs.tangoapp.dev/tango/daemon/usb/

@@ -36,0 +36,0 @@ ## Sponsors

@@ -23,3 +23,3 @@ import type {

import type { ExactReadable } from "@yume-chan/struct";
import { EMPTY_UINT8_ARRAY } from "@yume-chan/struct";
import { EmptyUint8Array } from "@yume-chan/struct";

@@ -189,3 +189,3 @@ import type { UsbInterfaceFilter } from "./utils.js";

outEndpoint.endpointNumber,
EMPTY_UINT8_ARRAY,
EmptyUint8Array,
);

@@ -239,3 +239,3 @@ }

} else {
packet.payload = EMPTY_UINT8_ARRAY;
packet.payload = EmptyUint8Array;
}

@@ -350,4 +350,2 @@

* Open the device and create a new connection to the ADB Daemon.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/create-connection/)
*/

@@ -354,0 +352,0 @@ async connect(): Promise<AdbDaemonWebUsbConnection> {

export * from "./device.js";
export * from "./manager.js";
export * from "./utils.js";
export * from "./watcher.js";
export * from "./observer.js";
import { AdbDaemonWebUsbDevice, toAdbDeviceFilters } from "./device.js";
import {
findUsbAlternateInterface,
getSerialNumber,
isErrorName,
} from "./utils.js";
import { AdbDaemonWebUsbDeviceObserver } from "./observer.js";
import { isErrorName, matchesFilters } from "./utils.js";

@@ -15,5 +12,2 @@ export namespace AdbDaemonWebUsbDeviceManager {

/**
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/device-manager/)
*/
export class AdbDaemonWebUsbDeviceManager {

@@ -43,4 +37,2 @@ /**

* Call `USB#requestDevice()` to prompt the user to select a device.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/request-device/)
*/

@@ -70,4 +62,2 @@ async requestDevice(

* Get all connected and requested devices that match the specified filters.
*
* [Online Documentation](https://docs.tangoapp.dev/tango/daemon/usb/get-devices/)
*/

@@ -82,32 +72,3 @@ getDevices(filters?: USBDeviceFilter[]): Promise<AdbDaemonWebUsbDevice[]>;

return devices
.filter((device) => {
for (const filter of filters) {
if (
filter.vendorId !== undefined &&
device.vendorId !== filter.vendorId
) {
continue;
}
if (
filter.productId !== undefined &&
device.productId !== filter.productId
) {
continue;
}
if (
filter.serialNumber !== undefined &&
getSerialNumber(device) !== filter.serialNumber
) {
continue;
}
try {
findUsbAlternateInterface(device, filters);
return true;
} catch {
continue;
}
}
return false;
})
.filter((device) => matchesFilters(device, filters))
.map(

@@ -122,2 +83,6 @@ (device) =>

}
trackDevices(filters?: USBDeviceFilter[]): AdbDaemonWebUsbDeviceObserver {
return new AdbDaemonWebUsbDeviceObserver(this.#usbManager, filters);
}
}

@@ -102,1 +102,35 @@ export function isErrorName(e: unknown, name: string): e is Error {

}
export function matchesFilters(
device: USBDevice,
filters: (USBDeviceFilter & UsbInterfaceFilter)[],
) {
for (const filter of filters) {
if (
filter.vendorId !== undefined &&
device.vendorId !== filter.vendorId
) {
continue;
}
if (
filter.productId !== undefined &&
device.productId !== filter.productId
) {
continue;
}
if (
filter.serialNumber !== undefined &&
getSerialNumber(device) !== filter.serialNumber
) {
continue;
}
try {
findUsbAlternateInterface(device, filters);
return true;
} catch {
continue;
}
}
return false;
}

@@ -11,14 +11,3 @@ {

]
},
"references": [
{
"path": "../adb/tsconfig.build.json"
},
{
"path": "../stream-extra/tsconfig.build.json"
},
{
"path": "../struct/tsconfig.build.json"
}
]
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc