@gurezo/web-serial-rxjs 3.0.0 → 3.1.0

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.
Files changed (34) hide show
  1. package/README.ja.md +17 -10
  2. package/README.md +21 -12
  3. package/dist/errors/serial-error-code.d.ts +28 -19
  4. package/dist/errors/serial-error-code.d.ts.map +1 -1
  5. package/dist/errors/serial-error-context.d.ts +21 -7
  6. package/dist/errors/serial-error-context.d.ts.map +1 -1
  7. package/dist/errors/serial-error.d.ts +19 -20
  8. package/dist/errors/serial-error.d.ts.map +1 -1
  9. package/dist/index.d.ts +36 -12
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.mjs +215 -43
  12. package/dist/index.mjs.map +3 -3
  13. package/dist/internal/assert-never.d.ts +9 -0
  14. package/dist/internal/assert-never.d.ts.map +1 -1
  15. package/dist/internal/strip-ansi-sequences.d.ts +25 -0
  16. package/dist/internal/strip-ansi-sequences.d.ts.map +1 -0
  17. package/dist/session/create-serial-session.d.ts +1 -1
  18. package/dist/session/create-serial-session.d.ts.map +1 -1
  19. package/dist/session/index.d.ts +2 -1
  20. package/dist/session/index.d.ts.map +1 -1
  21. package/dist/session/internal/validate-serial-port-filters.d.ts.map +1 -1
  22. package/dist/session/is-connected-session-state.d.ts +11 -0
  23. package/dist/session/is-connected-session-state.d.ts.map +1 -0
  24. package/dist/session/normalize-serial-error.d.ts +1 -1
  25. package/dist/session/normalize-serial-error.d.ts.map +1 -1
  26. package/dist/session/serial-session-options.d.ts +41 -34
  27. package/dist/session/serial-session-options.d.ts.map +1 -1
  28. package/dist/session/serial-session-state.d.ts +3 -2
  29. package/dist/session/serial-session-state.d.ts.map +1 -1
  30. package/dist/session/serial-session.d.ts +46 -14
  31. package/dist/session/serial-session.d.ts.map +1 -1
  32. package/dist/terminal/create-terminal-buffer.d.ts +12 -1
  33. package/dist/terminal/create-terminal-buffer.d.ts.map +1 -1
  34. package/package.json +1 -1
package/README.ja.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img src="https://raw.githubusercontent.com/gurezo/web-serial-rxjs/main/packages/web-serial-rxjs/web-serial-rxjs-icon.png" alt="web-serial-rxjs プロジェクトアイコン" width="512" />
5
5
  </p>
6
6
 
7
- Web Serial API を最小限の Session 指向 RxJS 表面でラップする TypeScript ライブラリです。v2 では単一の `SerialSession` を公開し、`state$` / `isConnected$` / `receive$` / `lines$` / `errors$` を購読するだけで UI を駆動できます。read loop や送信キューの自前実装は不要です。
7
+ Web Serial API を最小限の Session 指向 RxJS 表面でラップする TypeScript ライブラリです。公開 API は単一の `SerialSession` を提供し、`state$`(canonical lifecycle state)/ `errors$`(error event channel)/ `receive$` / `lines$` を購読するだけで UI を駆動できます。read loop や送信キューの自前実装は不要です。
8
8
 
9
9
  ## ブラウザサポート
10
10
 
@@ -21,9 +21,13 @@ Web Serial API は**デスクトップ**ブラウザでのみサポートされ
21
21
 
22
22
  `connect$` の前の feature detection には `SerialSession.isBrowserSupported()`(同期的に `boolean`)を使います。
23
23
 
24
+ ## 接続状態(ライフサイクル UI)
25
+
26
+ ライフサイクル UI には **`state$`** の `state.status` narrowing を canonical API として使用してください。boolean だけ必要な場合は `state$` から derive してください。`isConnected$` は v3.x では引き続き利用可能ですが **非推奨** です。詳細は [v3 移行ガイド](./docs/guide/ja/migration-v3.md#6-isconnected-の非推奨化) を参照してください。
27
+
24
28
  ## 接続中のポート情報(デバイス識別)
25
29
 
26
- `connect$` 成功後は `getPortInfo()` または `portInfo$` `SerialPort.getInfo()` と同じスナップショット(例: 利用可能な場合の USB ベンダ/プロダクト ID)を取得できます。未接続時は `null` です。`getCurrentPort()` は接続中のみ内部の `SerialPort` を返します。`close()` は直接呼ばず、ライフサイクルは `disconnect$` に任せてください。
30
+ `connect$` 成功後、`state$` `state.status === SerialSessionStatus.Connected` で handling する場合は **`state.portInfo`** を canonical API として使用してください。`getPortInfo()` `portInfo$` v3.x では引き続き利用可能ですが **非推奨** です。`state$` narrowing へ移行してください。`getCurrentPort()` は削除されました。詳細は [v3 移行ガイド](./docs/guide/ja/migration-v3.md#7-getcurrentport-の削除) を参照してください。
27
31
 
28
32
  ## 受信の replay(`receive$` と `receiveReplay$`)
29
33
 
@@ -31,7 +35,7 @@ Web Serial API は**デスクトップ**ブラウザでのみサポートされ
31
35
 
32
36
  ## `receive$` と `lines$`
33
37
 
34
- 購読するストリームはユースケースに合わせて選んでください。**`lines$`** をターミナル表示に使うと `\r` が失われ再描画できず、シェル出力(例: `ls -la` の整形)が崩れます。詳細は [概要](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.ja.md) を参照してください。
38
+ 購読するストリームはユースケースに合わせて選んでください。**`lines$`** をターミナル表示に使うと `\r` が失われ再描画できず、シェル出力(例: `ls -la` の整形)が崩れます。詳細は [概要](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/overview.md) を参照してください。
35
39
 
36
40
  ### `receive$`(raw ストリーム)
37
41
 
@@ -83,18 +87,21 @@ pnpm add rxjs
83
87
 
84
88
  ## 次に読むもの
85
89
 
86
- - **v2 の全体像**(機能一覧、`SerialSession` 早見表、`SerialSessionState`、最小サンプル): [SerialSession(v2)の概要](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.ja.md)([English](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.md))
87
- - 最短でポートを開く手順: [クイックスタート](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/QUICK_START.ja.md)
90
+ - **API の全体像**(機能一覧、`SerialSession` 早見表、`SerialSessionState`、最小サンプル): [SerialSession の概要](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/overview.md)([English](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/overview.md))
91
+ - 最短でポートを開く手順: [クイックスタート](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/quick-start.md)
88
92
 
89
93
  ## ドキュメント
90
94
 
91
95
  | ドキュメント | 用途 |
92
96
  | --- | --- |
93
- | [全体像](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.ja.md) | 機能と v2 `SerialSession` / `SerialSessionState` の対応表 |
94
- | [クイックスタート](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/QUICK_START.ja.md) | ポートを開いて購読までを最短で |
95
- | [高度な使用方法](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/ADVANCED_USAGE.ja.md) | 行フレーミング、擬似リクエスト/レス、リカバリ |
96
- | [API リファレンス](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/API_REFERENCE.ja.md) | オプション、`SerialError`、型の詳細 |
97
- | [v1 → v2 マイグレーション](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/MIGRATION_V2.ja.md) | 廃止された v1 API の置き換え |
97
+ | [日本語 Guide 索引](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/README.md) | Getting Started の読み順と一覧 |
98
+ | [English Guide 索引](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/README.md) | Getting Started reading order and full index |
99
+ | [全体像](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/overview.md) | 機能と `SerialSession` / `SerialSessionState` の対応表 |
100
+ | [クイックスタート](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/quick-start.md) | ポートを開いて購読までを最短で |
101
+ | [高度な使用方法](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/advanced-usage.md) | 行フレーミング、擬似リクエスト/レス、リカバリ |
102
+ | [API の概念と設計メモ](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/concepts.md) | オプション、`SerialError`、型の表形式補足 |
103
+ | [v2 → v3 マイグレーション](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/migration-v3.md) | `state$` discriminated union、`SerialSessionStatus`、`context.cause` |
104
+ | [v1 → v2 マイグレーション](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/migration-v2.md) | 廃止された v1 API の置き換え |
98
105
  | **リポジトリ [README](https://github.com/gurezo/web-serial-rxjs/blob/main/README.ja.md)** | モノレポ構成、**`apps/` のサンプル**、貢献、MCP、プロジェクトアイコン |
99
106
 
100
107
  ## ライセンス
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img src="https://raw.githubusercontent.com/gurezo/web-serial-rxjs/main/packages/web-serial-rxjs/web-serial-rxjs-icon.png" alt="@gurezo/web-serial-rxjs project icon" width="512" />
5
5
  </p>
6
6
 
7
- A TypeScript library that wraps the Web Serial API with a minimal, session-oriented RxJS surface. The v2 API exposes a single `SerialSession` so applications can drive their UI from `state$` + `isConnected$` + `receive$` + `lines$` + `errors$`, without rebuilding read loops or send queues themselves.
7
+ A TypeScript library that wraps the Web Serial API with a minimal, session-oriented RxJS surface. The public API exposes a single `SerialSession` so applications can drive their UI from `state$` (canonical lifecycle state) + `errors$` (error event channel) + `receive$` + `lines$`, without rebuilding read loops or send queues themselves.
8
8
 
9
9
  ## Browser support
10
10
 
@@ -21,9 +21,13 @@ Supported desktop browsers:
21
21
 
22
22
  `SerialSession.isBrowserSupported()` returns a synchronous `boolean` for feature detection before `connect$`.
23
23
 
24
+ ## Connection state (lifecycle UI)
25
+
26
+ Prefer **`state$`** with `state.status` narrowing as the canonical API for lifecycle UI. Derive a boolean from `state$` when you only need a connected flag. `isConnected$` remains available in v3.x but is **deprecated** — see [Migrating to v3](./docs/guide/en/migration-v3.md#6-isconnected-deprecation).
27
+
24
28
  ## Port info (device identification)
25
29
 
26
- After a successful `connect$`, use `getPortInfo()` or subscribe to `portInfo$` for the `SerialPort.getInfo()` snapshot (e.g. USB vendor/product IDs when the device exposes them). Both yield `null` when disconnected. `getCurrentPort()` returns the underlying `SerialPort` while connected; do not call `close()` on it—use `disconnect$` for lifecycle.
30
+ After a successful `connect$`, use `state.portInfo` when handling `state$` with `state.status === SerialSessionStatus.Connected` — this is the canonical API. `getPortInfo()` and `portInfo$` remain available in v3.x but are **deprecated**; migrate to `state$` narrowing. `getCurrentPort()` has been removed; see [Migrating to v3 getCurrentPort() removal](./docs/guide/en/migration-v3.md#7-getcurrentport-removal).
27
31
 
28
32
  ## Receive replay (`receive$` vs `receiveReplay$`)
29
33
 
@@ -31,7 +35,7 @@ After a successful `connect$`, use `getPortInfo()` or subscribe to `portInfo$` f
31
35
 
32
36
  ## `receive$` vs `lines$`
33
37
 
34
- Pick the stream that matches your use case. Using **`lines$`** for a terminal mirror drops `\r` and redraw behaviour, which breaks shells and tools that rely on carriage-return updates ([overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.md)).
38
+ Pick the stream that matches your use case. Using **`lines$`** for a terminal mirror drops `\r` and redraw behaviour, which breaks shells and tools that rely on carriage-return updates ([overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/overview.md)).
35
39
 
36
40
  ### `receive$` (raw stream)
37
41
 
@@ -83,20 +87,25 @@ pnpm add rxjs
83
87
 
84
88
  ## Where to go next
85
89
 
86
- - Full **v2 API map** (features, `SerialSession` table, `SerialSessionState`, minimal example): [SerialSession (v2) overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.md) ([日本語](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.ja.md))
87
- - Shortest path to an open port: [Quick Start](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/QUICK_START.md)
88
- - Browse as one integrated site (TypeDoc): [web-serial-rxjs API Documentation](https://gurezo.github.io/web-serial-rxjs/)
90
+ - Full **API map** (features, `SerialSession` table, `SerialSessionState`, minimal example): [SerialSession overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/overview.md) ([日本語](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/ja/overview.md))
91
+ - Shortest path to an open port: [Quick Start](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/quick-start.md)
92
+ - Browse the published documentation site: [web-serial-rxjs Documentation](https://gurezo.github.io/web-serial-rxjs/)
93
+ - Browse API Reference (TypeDoc): [web-serial-rxjs API Documentation](https://gurezo.github.io/web-serial-rxjs/api/)
89
94
 
90
95
  ## Documentation
91
96
 
92
97
  | Doc | Use it for |
93
98
  | --- | --- |
94
- | [TypeDoc top page](https://gurezo.github.io/web-serial-rxjs/) | Start from OVERVIEW and move to guides/API in one site |
95
- | [Overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/OVERVIEW.md) | Features and the v2 `SerialSession` / `SerialSessionState` map |
96
- | [Quick Start](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/QUICK_START.md) | Open a port and wire subscriptions end-to-end |
97
- | [Advanced Usage](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/ADVANCED_USAGE.md) | Line framing, request/response-style flows, recovery |
98
- | [API Reference](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/API_REFERENCE.md) | `SerialSessionOptions`, `SerialError`, and formal details |
99
- | [v1 → v2 migration](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/MIGRATION_V2.md) | Replacing the removed v1 `SerialClient` / `ShellClient` API |
99
+ | [Documentation home](https://gurezo.github.io/web-serial-rxjs/) | Site landing with Guide (ja/en) and API Reference |
100
+ | [English Guide (site)](https://gurezo.github.io/web-serial-rxjs/guide/en/README.html) | Getting Started reading order on the published site |
101
+ | [API Reference (site)](https://gurezo.github.io/web-serial-rxjs/api/index.html) | English TypeDoc API Reference |
102
+ | [English Guide index](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/README.md) | Getting Started reading order and full index |
103
+ | [Overview](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/overview.md) | Features and the `SerialSession` / `SerialSessionState` map |
104
+ | [Quick Start](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/quick-start.md) | Open a port and wire subscriptions end-to-end |
105
+ | [Advanced Usage](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/advanced-usage.md) | Line framing, request/response-style flows, recovery |
106
+ | [API concepts and design notes](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/concepts.md) | `SerialSessionOptions`, `SerialError`, and formal details |
107
+ | [v2 → v3 migration](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/migration-v3.md) | `state$` discriminated union, `SerialSessionStatus`, `context.cause` |
108
+ | [v1 → v2 migration](https://github.com/gurezo/web-serial-rxjs/blob/main/packages/web-serial-rxjs/docs/guide/en/migration-v2.md) | Replacing the removed v1 `SerialClient` / `ShellClient` API |
100
109
  | [Repository README](https://github.com/gurezo/web-serial-rxjs/blob/main/README.md) | Monorepo layout, **examples** under `apps/`, contributing, MCP, and project icon |
101
110
 
102
111
  ## License
@@ -28,28 +28,32 @@ export declare const SerialErrorCode: {
28
28
  /**
29
29
  * Browser does not support the Web Serial API.
30
30
  *
31
- * This error occurs when attempting to use serial port functionality in a browser
32
- * that doesn't support the Web Serial API. Supported desktop browsers are Chrome,
33
- * Edge, Opera, and Firefox 151+. Safari and mobile browsers are not supported.
31
+ * Emitted on `connect$` when `navigator.serial` is unavailable.
34
32
  *
35
33
  * **Suggested action**: Inform the user to use a supported browser.
34
+ *
35
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/438 | Issue #438}
36
36
  */
37
37
  readonly BROWSER_NOT_SUPPORTED: "BROWSER_NOT_SUPPORTED";
38
38
  /**
39
39
  * Serial port is not available.
40
40
  *
41
- * This error occurs when a requested port cannot be accessed, such as when
42
- * getting previously granted ports fails or when the port is already in use
43
- * by another application.
41
+ * **Reserved not emitted in v3.x.** The current implementation uses only
42
+ * `navigator.serial.requestPort`; there is no `getPorts` API path. Scheduled
43
+ * for removal in the next major version.
44
+ *
45
+ * **Suggested action**: Handle port acquisition failures with
46
+ * {@link SerialErrorCode.PORT_OPEN_FAILED} or
47
+ * {@link SerialErrorCode.OPERATION_CANCELLED} instead.
44
48
  *
45
- * **Suggested action**: Check if the port is available or being used by another application.
49
+ * @deprecated Not emitted at runtime in v3.x. Will be removed in the next major version.
50
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/438 | Issue #438}
46
51
  */
47
52
  readonly PORT_NOT_AVAILABLE: "PORT_NOT_AVAILABLE";
48
53
  /**
49
54
  * Failed to open the serial port.
50
55
  *
51
- * This error occurs when the port cannot be opened, typically due to incorrect
52
- * connection parameters, hardware issues, or permission problems.
56
+ * Emitted on `connect$` when `port.open()` rejects.
53
57
  *
54
58
  * **Suggested action**: Verify connection parameters and check hardware connections.
55
59
  */
@@ -57,8 +61,8 @@ export declare const SerialErrorCode: {
57
61
  /**
58
62
  * Serial port is already open.
59
63
  *
60
- * This error occurs when attempting to open a port that is already connected.
61
- * Only one connection can be active at a time per SerialClient instance.
64
+ * Emitted on `connect$` when the session is not in `'idle'` or `'error'`
65
+ * (non-fatal; session state is unchanged).
62
66
  *
63
67
  * **Suggested action**: Disconnect the current port before connecting a new one.
64
68
  */
@@ -66,10 +70,10 @@ export declare const SerialErrorCode: {
66
70
  /**
67
71
  * Serial port is not open.
68
72
  *
69
- * This error occurs when attempting to read from or write to a port that hasn't
70
- * been opened yet. The port must be connected before performing I/O operations.
73
+ * Emitted when `send$` or `disconnect$` is called in an invalid session
74
+ * state (for example before `connect$` completes).
71
75
  *
72
- * **Suggested action**: Call {@link SerialClient.connect} before reading or writing.
76
+ * **Suggested action**: Call {@link SerialSession.connect$} before sending data.
73
77
  */
74
78
  readonly PORT_NOT_OPEN: "PORT_NOT_OPEN";
75
79
  /**
@@ -122,8 +126,12 @@ export declare const SerialErrorCode: {
122
126
  /**
123
127
  * Operation timed out before completion.
124
128
  *
125
- * This error occurs when an operation waits for a condition (for example, prompt
126
- * detection) and the timeout period elapses first.
129
+ * **Reserved not emitted in v3.x.** No timeout / prompt detection /
130
+ * transaction API exists yet. Scheduled for removal in the next major version
131
+ * unless a future API adopts this code.
132
+ *
133
+ * @deprecated Not emitted at runtime in v3.x. Will be removed in the next major version.
134
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/438 | Issue #438}
127
135
  */
128
136
  readonly OPERATION_TIMEOUT: "OPERATION_TIMEOUT";
129
137
  /**
@@ -202,10 +210,11 @@ export declare const SerialErrorCode: {
202
210
  /**
203
211
  * Unknown error occurred.
204
212
  *
205
- * This error code is used for errors that don't fit into any other category.
206
- * The original error details may be available in the error's message or originalError property.
213
+ * Emitted as a fallback when dispose or disconnect encounters an error that
214
+ * cannot be classified more specifically. The underlying failure is on
215
+ * {@link SerialError.context | context.cause}.
207
216
  *
208
- * **Suggested action**: Check the error message and originalError for more details.
217
+ * **Suggested action**: Check the error message and `context.cause` for more details.
209
218
  */
210
219
  readonly UNKNOWN: "UNKNOWN";
211
220
  };
@@ -1 +1 @@
1
- {"version":3,"file":"serial-error-code.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;OAOG;;CAEK,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"serial-error-code.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;OAQG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;CAEK,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
@@ -5,12 +5,26 @@ import { SerialErrorCode } from './serial-error-code';
5
5
  export type SerialErrorCauseContext = {
6
6
  readonly cause: unknown;
7
7
  };
8
+ /**
9
+ * Machine-readable constraint identifiers for factory-time validation errors.
10
+ */
11
+ export type ValidationErrorConstraint = 'at-least-one-usb-id' | 'usb-id-0-65535' | 'positive-safe-integer' | 'receive-replay-buffer-size-range' | 'receive-replay-max-chars-range' | 'non-negative-safe-integer';
12
+ /**
13
+ * Structured metadata for `INVALID_*` validation errors thrown at session
14
+ * factory time. {@link SerialError.message} remains human-readable.
15
+ */
16
+ export type ValidationErrorContext = {
17
+ readonly field: string;
18
+ readonly value: unknown;
19
+ readonly constraint: ValidationErrorConstraint;
20
+ readonly filterIndex?: number;
21
+ };
8
22
  /**
9
23
  * Maps each {@link SerialErrorCode} to its structured context shape.
10
24
  *
11
25
  * Codes mapped to `undefined` have no machine-readable metadata beyond
12
- * {@link SerialError.message}. Overflow codes expose configured limits so
13
- * callers do not need to parse error messages.
26
+ * {@link SerialError.message}. Overflow and validation codes expose structured
27
+ * metadata so callers do not need to parse error messages.
14
28
  */
15
29
  export interface SerialErrorContextMap {
16
30
  [SerialErrorCode.BROWSER_NOT_SUPPORTED]: undefined;
@@ -21,16 +35,16 @@ export interface SerialErrorContextMap {
21
35
  [SerialErrorCode.READ_FAILED]: SerialErrorCauseContext;
22
36
  [SerialErrorCode.WRITE_FAILED]: SerialErrorCauseContext;
23
37
  [SerialErrorCode.CONNECTION_LOST]: SerialErrorCauseContext;
24
- [SerialErrorCode.INVALID_FILTER_OPTIONS]: undefined;
38
+ [SerialErrorCode.INVALID_FILTER_OPTIONS]: ValidationErrorContext;
25
39
  [SerialErrorCode.OPERATION_CANCELLED]: SerialErrorCauseContext;
26
40
  [SerialErrorCode.OPERATION_TIMEOUT]: undefined;
27
41
  [SerialErrorCode.LINE_BUFFER_OVERFLOW]: {
28
42
  readonly maxChars: number;
29
43
  };
30
- [SerialErrorCode.INVALID_RECEIVE_REPLAY_OPTIONS]: undefined;
31
- [SerialErrorCode.INVALID_TERMINAL_BUFFER_OPTIONS]: undefined;
32
- [SerialErrorCode.INVALID_LINE_BUFFER_OPTIONS]: undefined;
33
- [SerialErrorCode.INVALID_CONNECTION_OPTIONS]: undefined;
44
+ [SerialErrorCode.INVALID_RECEIVE_REPLAY_OPTIONS]: ValidationErrorContext;
45
+ [SerialErrorCode.INVALID_TERMINAL_BUFFER_OPTIONS]: ValidationErrorContext;
46
+ [SerialErrorCode.INVALID_LINE_BUFFER_OPTIONS]: ValidationErrorContext;
47
+ [SerialErrorCode.INVALID_CONNECTION_OPTIONS]: ValidationErrorContext;
34
48
  [SerialErrorCode.RECEIVE_REPLAY_BUFFER_OVERFLOW]: {
35
49
  readonly maxChars: number;
36
50
  readonly bufferSize: number;
@@ -1 +1 @@
1
- {"version":3,"file":"serial-error-context.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAAE,SAAS,CAAC;IACnD,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IAC9D,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC5D,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC/C,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;IAC3C,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACvD,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACxD,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC3D,CAAC,eAAe,CAAC,sBAAsB,CAAC,EAAE,SAAS,CAAC;IACpD,CAAC,eAA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AA2B,CAAC,EAAE,sBAAsB,CAAC;IACtE,CAAC,eAAe,CAAC,0BAA0B,CAAC,EAAE,sBAAsB,CAAC;IACrE,CAAC,eAAe,CAAC,8BAA8B,CAAC,EAAE;QAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC9C,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACpD;AAYD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,GACpB,IAAI,IAAI,MAAM;KACd,CAAC,IAAI,MAAM,qBAAqB,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,uBAAuB,GACzF,CAAC,GACD,KAAK,GAAG,qBAAqB,CAAC,CAAC,CAAC;CACrC,CAEA"}
@@ -1,7 +1,7 @@
1
1
  import { SerialErrorCode } from './serial-error-code';
2
- import { type SerialErrorCauseContext, type SerialErrorContextMap } from './serial-error-context';
2
+ import { type SerialErrorCauseContext, type SerialErrorContextMap, type ValidationErrorConstraint, type ValidationErrorContext } from './serial-error-context';
3
3
  export { SerialErrorCode };
4
- export type { SerialErrorCauseContext, SerialErrorContextMap };
4
+ export type { SerialErrorCauseContext, SerialErrorContextMap, ValidationErrorConstraint, ValidationErrorContext, };
5
5
  /**
6
6
  * Custom error class for serial port operations.
7
7
  *
@@ -11,26 +11,21 @@ export type { SerialErrorCauseContext, SerialErrorContextMap };
11
11
  *
12
12
  * @example
13
13
  * ```typescript
14
- * try {
15
- * await client.connect().toPromise();
16
- * } catch (error) {
17
- * if (error instanceof SerialError) {
14
+ * session.errors$.subscribe((error) => {
15
+ * if (error.is(SerialErrorCode.READ_FAILED)) {
18
16
  * console.error(`Error code: ${error.code}`);
19
17
  * console.error(`Message: ${error.message}`);
20
- * if (error.originalError) {
21
- * console.error(`Original error:`, error.originalError);
22
- * }
18
+ * console.error(`Cause:`, error.context.cause);
19
+ * }
23
20
  *
24
- * if (error.is(SerialErrorCode.LINE_BUFFER_OVERFLOW)) {
25
- * console.error(`maxChars: ${error.context.maxChars}`);
26
- * }
21
+ * if (error.is(SerialErrorCode.LINE_BUFFER_OVERFLOW)) {
22
+ * console.error(`maxChars: ${error.context.maxChars}`);
23
+ * }
27
24
  *
28
- * // Check specific error code
29
- * if (error.is(SerialErrorCode.BROWSER_NOT_SUPPORTED)) {
30
- * // Handle browser not supported
31
- * }
25
+ * if (error.is(SerialErrorCode.BROWSER_NOT_SUPPORTED)) {
26
+ * // Handle browser not supported
32
27
  * }
33
- * }
28
+ * });
34
29
  * ```
35
30
  */
36
31
  export declare class SerialError<TCode extends SerialErrorCode = SerialErrorCode> extends Error {
@@ -65,9 +60,13 @@ export declare class SerialError<TCode extends SerialErrorCode = SerialErrorCode
65
60
  *
66
61
  * @param code - The error code identifying the type of error
67
62
  * @param message - A human-readable error message
68
- * @param originalError - The original error that caused this SerialError, if any
69
- * @param context - Structured metadata for the error code. When omitted, cause-bearing
70
- * codes derive `{ cause }` from `originalError`.
63
+ * @param originalError - The original error that caused this SerialError, if any.
64
+ * @deprecated Prefer passing `{ cause }` via {@link context}. When omitted,
65
+ * cause-bearing codes derive `{ cause }` from this argument for backward
66
+ * compatibility.
67
+ * @param context - Structured metadata for the error code. For cause-bearing
68
+ * codes, pass `{ cause }` here. When omitted, cause-bearing codes derive
69
+ * `{ cause }` from the legacy {@link originalError} argument.
71
70
  */
72
71
  constructor(code: TCode, message: string, originalError?: Error, context?: SerialErrorContextMap[TCode]);
73
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"serial-error.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC3B,MAAM,wBAAw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EAAE,KAAK,CAAC;IAE5B;;;;;OAKG;IACH,SAAgB,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAEtD;;;;;;;;;OASG;IACH,SAAgB,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtC;;;;;;;;;;;;OAYG;gBAED,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,KAAK,EACrB,OAAO,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC;IAgCxC;;;;;;;;;;;;;;;;;;OAkBG;IACI,EAAE,CAAC,CAAC,SAAS,eAAe,EACjC,IAAI,EAAE,CAAC,GACN,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC;CAG1B"}
package/dist/index.d.ts CHANGED
@@ -6,25 +6,30 @@
6
6
  * A TypeScript library that wraps the Web Serial API with a minimal,
7
7
  * RxJS-based session surface.
8
8
  *
9
- * ## Public API (v2)
9
+ * ## Public API
10
10
  *
11
- * The v2 public API intentionally exposes a single, session-oriented surface
12
- * so that apps (Angular, Vue, React, Svelte, vanilla JS/TS) can drive their
13
- * UI entirely from `state$` + `isConnected$` + `receive$` + `terminalText$` + `lines$` + `errors$` without rebuilding any
14
- * state, read loops, or write queues themselves.
11
+ * The public API exposes a single, session-oriented surface so that apps
12
+ * (Angular, Vue, React, Svelte, vanilla JS/TS) can drive their UI from
13
+ * `state$` (canonical lifecycle discriminated union) + `errors$` (error event
14
+ * channel) + `receive$` + `terminalText$` + `lines$` without rebuilding state,
15
+ * read loops, or write queues. Derive convenience booleans from `state$`
16
+ * narrowing; `isConnected$` is deprecated in v3.x.
15
17
  *
16
18
  * - {@link createSerialSession} - factory for a {@link SerialSession}
17
19
  * - {@link createTerminalBuffer} - terminal-style display text from {@link SerialSession.receive$}
18
20
  * - {@link TerminalBufferOptions} - memory limits for terminal display text
19
21
  * - {@link LineBufferOptions} - memory limits for lines$ incomplete line tail
20
22
  * - {@link SerialSession} - the runtime interface
21
- * - {@link SerialSessionOptions} - connection options
23
+ * - {@link SerialSessionOptions} - factory options (connection + features)
22
24
  * - {@link SerialPayload} - payload accepted by {@link SerialSession.send$}
23
25
  * - {@link SerialConnectionOptions} - `port.open` connection parameters (excluding filters)
26
+ * - {@link SerialSessionFeatureOptions} - library-specific session feature options
24
27
  * - {@link SerialSessionStatus} - lifecycle status literals for `state$.status`
25
28
  * - {@link SerialSessionState} - discriminated union emitted by `state$`
29
+ * - {@link isConnectedSessionState} - type predicate for connected `state$` narrowing in RxJS pipelines
26
30
  * - {@link SerialError} / {@link SerialErrorCode} - unified error surface
27
31
  * - {@link SerialErrorContextMap} - structured metadata per error code
32
+ * - {@link ValidationErrorContext} - machine-readable validation error metadata
28
33
  *
29
34
  * ## Browser Support
30
35
  *
@@ -45,16 +50,35 @@
45
50
  *
46
51
  * @example
47
52
  * ```typescript
48
- * import { createSerialSession } from '@gurezo/web-serial-rxjs';
53
+ * import { filter } from 'rxjs';
54
+ * import {
55
+ * createSerialSession,
56
+ * isConnectedSessionState,
57
+ * SerialSessionStatus,
58
+ * SerialErrorCode,
59
+ * } from '@gurezo/web-serial-rxjs';
49
60
  *
50
61
  * const session = createSerialSession({ baudRate: 115200 });
51
62
  *
52
63
  * if (!session.isBrowserSupported()) {
53
64
  * console.error('Web Serial API is not supported in this browser');
54
65
  * } else {
55
- * session.state$.subscribe((state) => console.log('state:', state));
66
+ * session.state$.subscribe((state) => {
67
+ * if (state.status === SerialSessionStatus.Connected) {
68
+ * console.log('port:', state.portInfo);
69
+ * }
70
+ * });
71
+ * session.state$
72
+ * .pipe(filter(isConnectedSessionState))
73
+ * .subscribe((state) => {
74
+ * console.log('port:', state.portInfo);
75
+ * });
56
76
  * session.receive$.subscribe((chunk) => console.log('rx:', chunk));
57
- * session.errors$.subscribe((error) => console.error('err:', error));
77
+ * session.errors$.subscribe((error) => {
78
+ * if (error.is(SerialErrorCode.READ_FAILED)) {
79
+ * console.error(error.context.cause);
80
+ * }
81
+ * });
58
82
  *
59
83
  * session.connect$().subscribe();
60
84
  * session.send$('hello\r\n').subscribe();
@@ -62,10 +86,10 @@
62
86
  * ```
63
87
  */
64
88
  export { assertNever } from './internal/assert-never';
65
- export { createSerialSession, SerialSessionStatus, DEFAULT_LINE_BUFFER_OPTIONS, resolveSerialSessionOptions, MAX_RECEIVE_REPLAY_BUFFER_SIZE, MAX_RECEIVE_REPLAY_MAX_CHARS } from './session';
66
- export type { SerialSession, SerialSessionState, IdleSessionState, ConnectingSessionState, ConnectedSessionState, DisconnectingSessionState, UnsupportedSessionState, ErrorSessionState, DisposedSessionState, SerialSessionOptions, SerialSessionReceiveReplayOptions, ResolvedSerialSessionOptions, SerialPayload, SerialConnectionOptions, LineBufferOptions, } from './session';
89
+ export { createSerialSession, SerialSessionStatus, isConnectedSessionState, DEFAULT_LINE_BUFFER_OPTIONS, resolveSerialSessionOptions, MAX_RECEIVE_REPLAY_BUFFER_SIZE, MAX_RECEIVE_REPLAY_MAX_CHARS } from './session';
90
+ export type { SerialSession, SerialSessionState, IdleSessionState, ConnectingSessionState, ConnectedSessionState, DisconnectingSessionState, UnsupportedSessionState, ErrorSessionState, DisposedSessionState, SerialSessionOptions, SerialSessionFeatureOptions, SerialSessionReceiveReplayOptions, ResolvedSerialSessionOptions, SerialPayload, SerialConnectionOptions, LineBufferOptions, } from './session';
67
91
  export { SerialError } from './errors/serial-error';
68
- export type { SerialErrorCauseContext, SerialErrorContextMap } from './errors/serial-error';
92
+ export type { SerialErrorCauseContext, SerialErrorContextMap, ValidationErrorConstraint, ValidationErrorContext, } from './errors/serial-error';
69
93
  export { SerialErrorCode } from './errors/serial-error-code';
70
94
  export { createTerminalBuffer, DEFAULT_TERMINAL_BUFFER_OPTIONS } from './terminal/create-terminal-buffer';
71
95
  export type { TerminalBuffer, TerminalBufferOptions } from './terminal/create-terminal-buffer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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