@ceralive/cerastream 2026.7.6 → 2026.8.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.
package/dist/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  /**
3
3
  * Thrown by every contract-stub function body (Task 17). The schema in this
4
4
  * package is real and frozen; the IPC client/transport is implemented in Task 31.
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
  export class NotImplementedError extends Error {
8
8
  constructor(symbol) {
9
9
  super(`${symbol}: not yet implemented`);
10
- this.name = "NotImplementedError";
10
+ this.name = 'NotImplementedError';
11
11
  }
12
12
  }
13
13
  /**
@@ -25,7 +25,7 @@ export class CerastreamRpcError extends Error {
25
25
  requestId;
26
26
  constructor(code, message, dataCode, requestId) {
27
27
  super(message);
28
- this.name = "CerastreamRpcError";
28
+ this.name = 'CerastreamRpcError';
29
29
  this.code = code;
30
30
  this.dataCode = dataCode;
31
31
  this.requestId = requestId;
@@ -53,11 +53,11 @@ export class CerastreamRpcError extends Error {
53
53
  * not-open connection.
54
54
  */
55
55
  export const CERASTREAM_CONNECT_ERROR_CODES = [
56
- "absent",
57
- "refused",
58
- "unreachable",
59
- "lost",
60
- "closed",
56
+ 'absent',
57
+ 'refused',
58
+ 'unreachable',
59
+ 'lost',
60
+ 'closed',
61
61
  ];
62
62
  /**
63
63
  * Thrown when the control connection is lost (socket closed/errored) while a
@@ -70,9 +70,9 @@ export class CerastreamConnectionError extends Error {
70
70
  code;
71
71
  /** The underlying transport error, when there was one. */
72
72
  cause;
73
- constructor(message, cause, code = "unreachable") {
73
+ constructor(message, cause, code = 'unreachable') {
74
74
  super(message);
75
- this.name = "CerastreamConnectionError";
75
+ this.name = 'CerastreamConnectionError';
76
76
  this.code = code;
77
77
  this.cause = cause;
78
78
  }
@@ -81,21 +81,21 @@ export class CerastreamConnectionError extends Error {
81
81
  export class CerastreamTimeoutError extends Error {
82
82
  constructor(method, timeoutMs) {
83
83
  super(`request \`${method}\` timed out after ${timeoutMs}ms`);
84
- this.name = "CerastreamTimeoutError";
84
+ this.name = 'CerastreamTimeoutError';
85
85
  }
86
86
  }
87
87
  // ---- Tier 1: synchronous RPC errors (error response) ----
88
88
  // Stable string `error.data.code` namespaced cerastream.<domain>.<reason>.
89
89
  export const rpcErrorCodeSchema = z.enum([
90
- "cerastream.protocol.unsupported_version",
91
- "cerastream.params.invalid",
92
- "cerastream.state.not_streaming",
93
- "cerastream.state.already_streaming",
94
- "cerastream.device.not_found",
95
- "cerastream.audio.device_not_found",
96
- "cerastream.bitrate.out_of_range",
97
- "cerastream.preview.unsupported_tier",
98
- "cerastream.internal",
90
+ 'cerastream.protocol.unsupported_version',
91
+ 'cerastream.params.invalid',
92
+ 'cerastream.state.not_streaming',
93
+ 'cerastream.state.already_streaming',
94
+ 'cerastream.device.not_found',
95
+ 'cerastream.audio.device_not_found',
96
+ 'cerastream.bitrate.out_of_range',
97
+ 'cerastream.preview.unsupported_tier',
98
+ 'cerastream.internal',
99
99
  ]);
100
100
  /**
101
101
  * Numeric JSON-RPC `error.code` for each Tier 1 string code (schema.md Error
@@ -103,42 +103,42 @@ export const rpcErrorCodeSchema = z.enum([
103
103
  * `-32603` are the reserved invalid-params / internal-error codes.
104
104
  */
105
105
  export const RPC_ERROR_NUMERIC = {
106
- "cerastream.protocol.unsupported_version": -32000,
107
- "cerastream.params.invalid": -32602,
108
- "cerastream.state.not_streaming": -32001,
109
- "cerastream.state.already_streaming": -32002,
110
- "cerastream.device.not_found": -32003,
111
- "cerastream.audio.device_not_found": -32006,
112
- "cerastream.bitrate.out_of_range": -32004,
113
- "cerastream.preview.unsupported_tier": -32005,
114
- "cerastream.internal": -32603,
106
+ 'cerastream.protocol.unsupported_version': -32000,
107
+ 'cerastream.params.invalid': -32602,
108
+ 'cerastream.state.not_streaming': -32001,
109
+ 'cerastream.state.already_streaming': -32002,
110
+ 'cerastream.device.not_found': -32003,
111
+ 'cerastream.audio.device_not_found': -32006,
112
+ 'cerastream.bitrate.out_of_range': -32004,
113
+ 'cerastream.preview.unsupported_tier': -32005,
114
+ 'cerastream.internal': -32603,
115
115
  };
116
116
  // ---- Tier 2: asynchronous runtime error-event codes ----
117
117
  // Maps 1:1 onto CeraUI's PROCESS_ERROR_CODES (the TRANSITIONAL stderr table) so
118
118
  // Task 32 is a table swap, not a rewrite (ADR-0002 Error-Code Namespace).
119
119
  export const processErrorCodeSchema = z.enum([
120
- "srtla_initial_connect_failed",
121
- "srtla_no_connections",
122
- "capture_audio_error",
123
- "capture_video_error",
124
- "pipeline_stall",
125
- "srt_connect_failed",
126
- "srt_connection_lost",
120
+ 'srtla_initial_connect_failed',
121
+ 'srtla_no_connections',
122
+ 'capture_audio_error',
123
+ 'capture_video_error',
124
+ 'pipeline_stall',
125
+ 'srt_connect_failed',
126
+ 'srt_connection_lost',
127
127
  // TERMINAL, unlike capture_video_error: the device is still on the bus but the
128
128
  // engine has exhausted recovery, so a UI that keeps showing "reconnecting"
129
129
  // would be lying. Always carries a captureUnrecoverableReasonSchema `reason`.
130
- "capture_unrecoverable",
130
+ 'capture_unrecoverable',
131
131
  ]);
132
132
  /**
133
133
  * Why a capture device became `capture_unrecoverable` — the `reason` field of the
134
134
  * `error` event. Mirrors the Rust `CaptureUnrecoverableReason`.
135
135
  */
136
136
  export const captureUnrecoverableReasonSchema = z.enum([
137
- "node_absent_reprobe_disabled",
138
- "reprobe_no_reenumeration",
139
- "reprobe_identity_changed",
140
- "reprobe_node_still_absent",
141
- "reprobe_unavailable",
137
+ 'node_absent_reprobe_disabled',
138
+ 'reprobe_no_reenumeration',
139
+ 'reprobe_identity_changed',
140
+ 'reprobe_node_still_absent',
141
+ 'reprobe_unavailable',
142
142
  ]);
143
143
  /** Origin of a Tier 2 runtime error (the notification channel CeraUI routes on). */
144
- export const processErrorSourceSchema = z.enum(["srtla", "engine"]);
144
+ export const processErrorSourceSchema = z.enum(['srtla', 'engine']);