webserial-core 1.2.0 → 2.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → LICENSE.md} +1 -1
- package/README.md +142 -287
- package/dist/adapters/web-bluetooth/WebBluetoothProvider.d.ts +19 -0
- package/dist/adapters/web-bluetooth/index.d.ts +6 -0
- package/dist/adapters/web-usb/WebUsbProvider.d.ts +127 -0
- package/dist/adapters/web-usb/index.d.ts +6 -0
- package/dist/adapters/websocket/WebSocketProvider.d.ts +20 -0
- package/dist/adapters/websocket/index.d.ts +6 -0
- package/dist/core/AbstractSerialDevice.d.ts +108 -0
- package/dist/core/SerialEventEmitter.d.ts +37 -0
- package/dist/core/SerialRegistry.d.ts +53 -0
- package/dist/errors/index.d.ts +40 -0
- package/dist/index.d.ts +10 -0
- package/dist/parsers/DelimiterParser.d.ts +22 -0
- package/dist/parsers/FixedLengthParser.d.ts +23 -0
- package/dist/parsers/RawParser.d.ts +22 -0
- package/dist/parsers/index.d.ts +7 -0
- package/dist/queue/CommandQueue.d.ts +98 -0
- package/dist/types/index.d.ts +124 -0
- package/dist/webserial-core.cjs +1 -0
- package/dist/webserial-core.mjs +853 -0
- package/dist/webserial-core.umd.js +1 -0
- package/package.json +62 -68
- package/dist/types/Core.d.ts +0 -268
- package/dist/types/Core.d.ts.map +0 -1
- package/dist/types/Devices.d.ts +0 -62
- package/dist/types/Devices.d.ts.map +0 -1
- package/dist/types/Dispatcher.d.ts +0 -98
- package/dist/types/Dispatcher.d.ts.map +0 -1
- package/dist/types/SerialError.d.ts +0 -61
- package/dist/types/SerialError.d.ts.map +0 -1
- package/dist/types/SerialEvent.d.ts +0 -4
- package/dist/types/SerialEvent.d.ts.map +0 -1
- package/dist/types/Socket.d.ts +0 -29
- package/dist/types/Socket.d.ts.map +0 -1
- package/dist/types/main.d.ts +0 -15
- package/dist/types/main.d.ts.map +0 -1
- package/dist/types/utils.d.ts +0 -3
- package/dist/types/utils.d.ts.map +0 -1
- package/dist/webserial-core.js +0 -1236
- package/dist/webserial-core.js.map +0 -1
- package/dist/webserial-core.umd.cjs +0 -5
- package/dist/webserial-core.umd.cjs.map +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error codes for serial communication errors
|
|
3
|
-
*/
|
|
4
|
-
export declare enum SerialErrorCode {
|
|
5
|
-
CONNECTION_FAILED = "CONNECTION_FAILED",
|
|
6
|
-
DISCONNECTION_FAILED = "DISCONNECTION_FAILED",
|
|
7
|
-
WRITE_FAILED = "WRITE_FAILED",
|
|
8
|
-
READ_FAILED = "READ_FAILED",
|
|
9
|
-
TIMEOUT = "TIMEOUT",
|
|
10
|
-
PORT_NOT_FOUND = "PORT_NOT_FOUND",
|
|
11
|
-
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
12
|
-
DEVICE_NOT_SUPPORTED = "DEVICE_NOT_SUPPORTED",
|
|
13
|
-
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
|
|
14
|
-
SOCKET_ERROR = "SOCKET_ERROR",
|
|
15
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Custom error class for WebSerial operations
|
|
19
|
-
* Provides structured error information with codes and context
|
|
20
|
-
* @extends Error
|
|
21
|
-
*/
|
|
22
|
-
export declare class SerialError extends Error {
|
|
23
|
-
/**
|
|
24
|
-
* Error code identifying the type of error
|
|
25
|
-
*/
|
|
26
|
-
readonly code: SerialErrorCode;
|
|
27
|
-
/**
|
|
28
|
-
* Additional context about the error
|
|
29
|
-
*/
|
|
30
|
-
readonly context?: Record<string, unknown>;
|
|
31
|
-
/**
|
|
32
|
-
* Timestamp when the error occurred
|
|
33
|
-
*/
|
|
34
|
-
readonly timestamp: Date;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new SerialError
|
|
37
|
-
* @param message - Human-readable error message
|
|
38
|
-
* @param code - Error code from SerialErrorCode enum
|
|
39
|
-
* @param context - Additional context information
|
|
40
|
-
* @example
|
|
41
|
-
* ```typescript
|
|
42
|
-
* throw new SerialError(
|
|
43
|
-
* 'Failed to connect to device',
|
|
44
|
-
* SerialErrorCode.CONNECTION_FAILED,
|
|
45
|
-
* { port: 'COM3', baudRate: 9600 }
|
|
46
|
-
* );
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
constructor(message: string, code?: SerialErrorCode, context?: Record<string, unknown>);
|
|
50
|
-
/**
|
|
51
|
-
* Returns a JSON representation of the error
|
|
52
|
-
* @returns Serialized error object
|
|
53
|
-
*/
|
|
54
|
-
toJSON(): Record<string, unknown>;
|
|
55
|
-
/**
|
|
56
|
-
* Returns a formatted string representation of the error
|
|
57
|
-
* @returns Formatted error string
|
|
58
|
-
*/
|
|
59
|
-
toString(): string;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=SerialError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SerialError.d.ts","sourceRoot":"","sources":["../../lib/SerialError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACzB,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC;;OAEG;IACH,SAAgB,IAAI,EAAE,eAAe,CAAC;IAEtC;;OAEG;IACH,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD;;OAEG;IACH,SAAgB,SAAS,EAAE,IAAI,CAAC;IAEhC;;;;;;;;;;;;;OAaG;gBAED,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,eAA+C,EACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAcnC;;;OAGG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAWjC;;;OAGG;IACH,QAAQ,IAAI,MAAM;CAInB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SerialEvent.d.ts","sourceRoot":"","sources":["../../lib/SerialEvent.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,WAAW,CAAC,WAAW,CAAE,YAAW,WAAW;gBAClE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;CAGnD"}
|
package/dist/types/Socket.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ManagerOptions, SocketOptions } from "socket.io-client";
|
|
2
|
-
interface SocketResponseData {
|
|
3
|
-
name: string;
|
|
4
|
-
uuid: string;
|
|
5
|
-
deviceNumber: number;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
declare class MySocket {
|
|
9
|
-
#private;
|
|
10
|
-
constructor(uri?: string, options?: Partial<ManagerOptions & SocketOptions>);
|
|
11
|
-
set uri(uri: string);
|
|
12
|
-
get uri(): string;
|
|
13
|
-
set options(options: Partial<ManagerOptions & SocketOptions>);
|
|
14
|
-
get options(): Partial<ManagerOptions & SocketOptions>;
|
|
15
|
-
get socketId(): string | null;
|
|
16
|
-
configure(uri?: string, options?: Partial<ManagerOptions & SocketOptions>): void;
|
|
17
|
-
disconnect(): void;
|
|
18
|
-
prepare(): void;
|
|
19
|
-
connectDevice(config: object): void;
|
|
20
|
-
disconnectDevice(config: object): void;
|
|
21
|
-
disconnectAllDevices(): void;
|
|
22
|
-
write(data: object): void;
|
|
23
|
-
onResponse(data: SocketResponseData): void;
|
|
24
|
-
isConnected(): boolean;
|
|
25
|
-
isDisconnected(): boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare const Socket: MySocket;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=Socket.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Socket.d.ts","sourceRoot":"","sources":["../../lib/Socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,cAAc,EAAE,aAAa,EAA4B,MAAM,kBAAkB,CAAC;AAI/F,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AASD,cAAM,QAAQ;;gBAWA,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC;IA4B3E,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,EAOlB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC,EAK3D;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC,CAErD;IAED,IAAI,QAAQ,IAAI,MAAM,GAAG,IAAI,CAE5B;IAED,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC,GAAG,IAAI;IAYhF,UAAU;IAcV,OAAO;IAaP,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOnC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOtC,oBAAoB,IAAI,IAAI;IAO5B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOzB,UAAU,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAW1C,WAAW,IAAI,OAAO;IAItB,cAAc,IAAI,OAAO;CAG1B;AAED,eAAO,MAAM,MAAM,UAAiB,CAAC"}
|
package/dist/types/main.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license webserial-core
|
|
3
|
-
* webserial-core
|
|
4
|
-
*
|
|
5
|
-
* Created by (c) Danidoble.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
export { Core } from "./Core";
|
|
11
|
-
export { Devices } from "./Devices";
|
|
12
|
-
export { Dispatcher } from "./Dispatcher";
|
|
13
|
-
export { Socket } from "./Socket";
|
|
14
|
-
export { SerialError, SerialErrorCode } from "./SerialError";
|
|
15
|
-
//# sourceMappingURL=main.d.ts.map
|
package/dist/types/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../lib/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/types/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,CAAC,EAAE,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpD;AAKD,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
|