@signalwire/js 4.0.0-dev-20260401154549 → 4.0.0-dev-20260410161202
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/browser.mjs +3912 -825
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +3914 -824
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +3625 -580
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +911 -129
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +910 -128
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3614 -572
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-MaKNoyky.mjs → operators-BwHr2-zw.mjs} +49 -2
- package/dist/operators-BwHr2-zw.mjs.map +1 -0
- package/dist/{operators-DuprVgnV.cjs → operators-C3TtzZHH.cjs} +72 -1
- package/dist/operators-C3TtzZHH.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/operators-DuprVgnV.cjs.map +0 -1
- package/dist/operators-MaKNoyky.mjs.map +0 -1
package/dist/operators/index.cjs
CHANGED
package/dist/operators/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as filterNull, n as filterAs, r as ifIsMap, t as throwOnRPCError } from "../operators-
|
|
1
|
+
import { a as filterNull, n as filterAs, r as ifIsMap, t as throwOnRPCError } from "../operators-BwHr2-zw.mjs";
|
|
2
2
|
|
|
3
3
|
export { filterAs, filterNull, ifIsMap, throwOnRPCError };
|
|
@@ -163,6 +163,16 @@ var VertoInviteHandlerError = class extends Error {
|
|
|
163
163
|
this.name = "VertoInviteHandlerError";
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
+
var VertoAttachHandlerError = class extends Error {
|
|
167
|
+
constructor(error = null, options) {
|
|
168
|
+
super("Error handling Verto attach", {
|
|
169
|
+
...options,
|
|
170
|
+
cause: options?.cause ?? (error instanceof Error ? error : void 0)
|
|
171
|
+
});
|
|
172
|
+
this.error = error;
|
|
173
|
+
this.name = "VertoAttachHandlerError";
|
|
174
|
+
}
|
|
175
|
+
};
|
|
166
176
|
var ValidationError = class extends Error {
|
|
167
177
|
constructor(message, options) {
|
|
168
178
|
super(message, options);
|
|
@@ -207,6 +217,43 @@ var DPoPInitError = class extends Error {
|
|
|
207
217
|
this.name = "DPoPInitError";
|
|
208
218
|
}
|
|
209
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* Error thrown when a recovery attempt fails.
|
|
222
|
+
*
|
|
223
|
+
* Carries the recovery action and attempt number for diagnostic purposes.
|
|
224
|
+
*/
|
|
225
|
+
var RecoveryError = class extends Error {
|
|
226
|
+
constructor(action, attempt, originalError) {
|
|
227
|
+
super(`Recovery failed: ${action} (attempt ${attempt})`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
228
|
+
this.action = action;
|
|
229
|
+
this.attempt = attempt;
|
|
230
|
+
this.originalError = originalError;
|
|
231
|
+
this.name = "RecoveryError";
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Error thrown when getUserMedia fails with OverconstrainedError
|
|
236
|
+
* and all fallback levels have been exhausted.
|
|
237
|
+
*/
|
|
238
|
+
var OverconstrainedFallbackError = class extends Error {
|
|
239
|
+
constructor(deviceKind, originalError) {
|
|
240
|
+
super(`All constraint fallback levels exhausted for ${deviceKind}`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
241
|
+
this.deviceKind = deviceKind;
|
|
242
|
+
this.originalError = originalError;
|
|
243
|
+
this.name = "OverconstrainedFallbackError";
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Error thrown when the preflight connectivity test fails.
|
|
248
|
+
*/
|
|
249
|
+
var PreflightError = class extends Error {
|
|
250
|
+
constructor(phase, originalError) {
|
|
251
|
+
super(`Preflight test failed during ${phase}`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
252
|
+
this.phase = phase;
|
|
253
|
+
this.originalError = originalError;
|
|
254
|
+
this.name = "PreflightError";
|
|
255
|
+
}
|
|
256
|
+
};
|
|
210
257
|
var DeviceTokenError = class extends Error {
|
|
211
258
|
constructor(message, originalError) {
|
|
212
259
|
super(message, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
@@ -390,5 +437,5 @@ function throwOnRPCError() {
|
|
|
390
437
|
}
|
|
391
438
|
|
|
392
439
|
//#endregion
|
|
393
|
-
export {
|
|
394
|
-
//# sourceMappingURL=operators-
|
|
440
|
+
export { TokenRefreshError as A, RecoveryError as C, StorageNotAvailableError as D, SerializationError as E, VertoAttachHandlerError as F, VertoInviteHandlerError as I, VertoPongError as L, UnexpectedError as M, UnimplementedError as N, StorageReadError as O, ValidationError as P, WebSocketConnectionError as R, RPCTimeoutError as S, RequestTimeoutError as T, JSONRPCError as _, filterNull as a, OverconstrainedFallbackError as b, CallCreateError as c, DPoPInitError as d, DependencyError as f, InvalidParams as g, InvalidCredentialsError as h, getValueFrom as i, TransportConnectionError as j, StorageWriteError as k, CollectionFetchError as l, DeviceTokenError as m, filterAs as n, getLogger as o, DeserializationError as p, ifIsMap as r, AuthStateHandlerError as s, throwOnRPCError as t, ConversationError as u, MediaTrackError as v, RequestError as w, PreflightError as x, MessageParseError as y, WebSocketTimeoutError as z };
|
|
441
|
+
//# sourceMappingURL=operators-BwHr2-zw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators-BwHr2-zw.mjs","names":["at?: string","requestId: string","timeoutMs: number","error: unknown","storageType: string","key: string","originalError: Error","description: string","message: string","direction: 'inbound' | 'outbound'","code: number | string","data?: unknown","requestId?: string","originalError: unknown","operation: string","kind: string","action: string","attempt: number","originalError?: unknown","deviceKind: string","phase: string","userLogger: SDKLogger | null","debugOptions: LoggerOptions['debug']","wsTraffic: InternalSDKLogger['wsTraffic']","logger","filter","map"],"sources":["../src/core/errors.ts","../src/utils/logger.ts","../src/operators/filterNull.ts","../src/utils/getValueFrom.ts","../src/operators/filterEventAs.ts","../src/operators/throwOnRPCError.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n constructor(\n public at?: string,\n options?: ErrorOptions\n ) {\n super(`Unexpected Error${at ? ` at ${at}` : ''}`, options);\n this.name = 'UnexpectedError';\n }\n}\n\nexport class UnimplementedError extends Error {\n constructor(\n public reason = 'Not Implemented',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'UnimplementedError';\n }\n}\n\nexport class NotConnectedError extends Error {\n constructor(\n public reason = 'Not Connected',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'NotConnectedError';\n }\n}\n\nexport class InvalidCredentialsError extends Error {\n constructor(\n public reason = 'Invalid Credentials',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'InvalidCredentialsError';\n }\n}\n\nexport class WebSocketConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketConnectionError';\n }\n}\n\nexport class TransportConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'TransportConnectionError';\n }\n}\n\nexport class WebSocketTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketTimeoutError';\n }\n}\n\nexport class RequestTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestTimeoutError';\n }\n}\n\nexport class RequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestError';\n }\n}\n\nexport class InvalidListenerError extends Error {\n constructor(options?: ErrorOptions) {\n super('listener is not a function', options);\n this.name = 'InvalidListenerError';\n }\n}\n\nexport class RPCTimeoutError extends Error {\n constructor(\n public requestId: string,\n public timeoutMs: number,\n options?: ErrorOptions\n ) {\n super(`RPC request ${requestId} timed out after ${timeoutMs}ms`, options);\n this.name = 'RPCTimeoutError';\n }\n}\n\nexport class AuthStateHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling authorization state update', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'AuthStateHandlerError';\n }\n}\n\nexport class InvalidStateTransitionError extends Error {\n constructor(\n public currentState: string,\n public targetState: string,\n options?: ErrorOptions\n ) {\n super(\n `Invalid transition: cannot transition from \"${currentState}\" to \"${targetState}\"`,\n options\n );\n this.name = 'InvalidStateTransitionError';\n }\n}\n\nexport class InvalidOptionError extends Error {\n constructor(\n public value: string,\n public availableOptions: string[],\n options?: ErrorOptions\n ) {\n super(\n `Invalid option: \"${value}\" must be one of the available options: ${availableOptions.join(', ')}`,\n options\n );\n this.name = 'InvalidOptionError';\n }\n}\n\nexport class StorageNotAvailableError extends Error {\n constructor(\n public storageType: string = 'localStorage',\n options?: ErrorOptions\n ) {\n super(`${storageType} is not available in this environment`, options);\n this.name = 'StorageNotAvailableError';\n }\n}\n\nexport class SerializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to serialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'SerializationError';\n }\n}\n\nexport class DeserializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to deserialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'DeserializationError';\n }\n}\n\nexport class StorageWriteError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to write to storage for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageWriteError';\n }\n}\n\nexport class StorageReadError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to read from storage \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageReadError';\n }\n}\n\nexport class InvalidStorageValueError extends Error {\n constructor(\n public key: string,\n public valueType: string,\n options?: ErrorOptions\n ) {\n super(\n `Cannot serialize value of type \"${valueType}\" for key \"${key}\": This type cannot be serialized to JSON`,\n options\n );\n this.name = 'InvalidStorageValueError';\n }\n}\n\nexport class DependencyError extends Error {\n constructor(\n public description: string,\n options?: ErrorOptions\n ) {\n super(`Dependency ${description} is not set or available.`, options);\n this.name = 'DependencyError';\n }\n}\n\nexport class DeviceNotFoundError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'DeviceNotFoundError';\n }\n}\n\n// =============================================================================\n// CALL ERROR TYPES\n// =============================================================================\n\n/**\n * Semantic category of a call-lifecycle error.\n *\n * - `'media'` – RTCPeerConnection / media device failure\n * - `'signaling'` – Verto / JSON-RPC protocol error\n * - `'timeout'` – Call setup timed out waiting for a response\n * - `'rejected'` – Remote side rejected the call\n * - `'network'` – Transport lost during an active call\n * - `'internal'` – Unexpected / unknown error\n */\nexport type CallErrorKind = 'media' | 'signaling' | 'timeout' | 'rejected' | 'network' | 'internal';\n\n/**\n * Structured error emitted on `call.errors$`.\n *\n * Provides actionable metadata so consumers can react without\n * resorting to `instanceof` checks on raw `Error` objects.\n */\nexport interface CallError {\n /** Semantic category of the error. */\n readonly kind: CallErrorKind;\n /**\n * Whether the error terminates the call.\n * When `true`, the call will automatically transition to `'failed'`\n * and be destroyed — no further action is needed from the consumer.\n */\n readonly fatal: boolean;\n /** The underlying error. */\n readonly error: Error;\n /** ID of the call that produced this error. */\n readonly callId: string;\n}\n\nexport class CallCreateError extends Error {\n constructor(\n public message: string,\n public error: unknown = null,\n public direction: 'inbound' | 'outbound' = 'outbound',\n options?: ErrorOptions\n ) {\n super(message, {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'CallCreateError';\n }\n}\n\nexport class JSONRPCError extends Error {\n constructor(\n public code: number | string,\n message: string,\n public data?: unknown,\n options?: ErrorOptions,\n public requestId?: string\n ) {\n super(message, options);\n this.name = 'JSONRPCError';\n }\n}\n\nexport class InvalidParams extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'InvalidParams';\n }\n}\n\nexport class ConversationError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'ConversationError';\n }\n}\n\nexport class VertoInviteHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto invite', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoInviteHandlerError';\n }\n}\n\nexport class VertoAttachHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto attach', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoAttachHandlerError';\n }\n}\n\nexport class HttpRequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'HttpRequestError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'ValidationError';\n }\n}\n\nexport class VertoPongError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to send Verto pong - call may disconnect', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'VertoPongError';\n }\n}\n\nexport class MessageParseError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to parse incoming WebSocket message', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MessageParseError';\n }\n}\n\nexport class CollectionFetchError extends Error {\n constructor(\n public operation: string,\n public originalError: unknown\n ) {\n super(`Collection fetch failed during ${operation}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'CollectionFetchError';\n }\n}\n\nexport class MediaTrackError extends Error {\n constructor(\n public operation: string,\n public kind: string,\n public originalError: unknown\n ) {\n super(`Media track ${operation} failed for ${kind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MediaTrackError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DPoPInitError extends Error {\n constructor(\n public originalError: unknown,\n message = 'Failed to initialize DPoP key pair'\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DPoPInitError';\n }\n}\n\n// =============================================================================\n// RESILIENCE ERROR TYPES\n// =============================================================================\n\n/**\n * Error thrown when a recovery attempt fails.\n *\n * Carries the recovery action and attempt number for diagnostic purposes.\n */\nexport class RecoveryError extends Error {\n constructor(\n public action: string,\n public attempt: number,\n public originalError?: unknown\n ) {\n super(`Recovery failed: ${action} (attempt ${attempt})`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'RecoveryError';\n }\n}\n\n/**\n * Error thrown when getUserMedia fails with OverconstrainedError\n * and all fallback levels have been exhausted.\n */\nexport class OverconstrainedFallbackError extends Error {\n constructor(\n public deviceKind: string,\n public originalError?: unknown\n ) {\n super(`All constraint fallback levels exhausted for ${deviceKind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'OverconstrainedFallbackError';\n }\n}\n\n/**\n * Error thrown when the preflight connectivity test fails.\n */\nexport class PreflightError extends Error {\n constructor(\n public phase: string,\n public originalError?: unknown\n ) {\n super(`Preflight test failed during ${phase}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'PreflightError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DeviceTokenError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DeviceTokenError';\n }\n}\n\nexport class TokenRefreshError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'TokenRefreshError';\n }\n}\n","import log from 'loglevel';\n\ninterface LogFn {\n <T extends object>(obj: T, msg?: string, ...args: unknown[]): void;\n (obj: unknown, msg?: string, ...args: unknown[]): void;\n (msg: string, ...args: unknown[]): void;\n}\nexport interface SDKLogger {\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n debug: LogFn;\n trace: LogFn;\n}\n\nexport interface WsTrafficOptions {\n type: 'send' | 'recv' | 'http';\n payload: unknown;\n}\n\nexport interface LoggerOptions {\n /** @internal */\n devTools?: boolean;\n /** @internal */\n debug?: {\n logWsTraffic?: boolean;\n };\n /** @internal */\n logger?: SDKLogger;\n}\n\nexport interface InternalSDKLogger extends SDKLogger {\n wsTraffic: (options: WsTrafficOptions) => void;\n}\n\nconst datetime = () => new Date().toISOString();\nconst defaultLogger = log.getLogger('signalwire');\n\nconst originalFactory = defaultLogger.methodFactory;\ndefaultLogger.methodFactory = (methodName, logLevel, loggerName) => {\n const rawMethod = originalFactory(methodName, logLevel, loggerName);\n\n return function (...args: unknown[]) {\n args.unshift(datetime(), '-');\n // eslint-disable-next-line prefer-spread\n rawMethod.apply(undefined, args);\n };\n};\n\nconst defaultLoggerLevel = defaultLogger.levels.DEBUG;\ndefaultLogger.setLevel(defaultLoggerLevel);\n\nlet userLogger: SDKLogger | null;\nconst setLogger = (logger: SDKLogger | null): void => {\n userLogger = logger;\n};\n\nlet debugOptions: LoggerOptions['debug'] = {};\nconst setDebugOptions = (options: unknown): void => {\n if (options == null) {\n debugOptions = {};\n return;\n }\n debugOptions = {\n ...debugOptions,\n ...options\n } as LoggerOptions['debug'];\n};\n\nconst getLoggerInstance = (): SDKLogger => {\n return userLogger ?? (defaultLogger as unknown as SDKLogger);\n};\n\nconst shouldStringify = (payload: WsTrafficOptions['payload']) => {\n //@ts-expect-error we don;t cara that payload is unknown\n if ('method' in payload && payload.method === 'signalwire.ping') {\n return false;\n }\n\n return true;\n};\n\nconst wsTraffic: InternalSDKLogger['wsTraffic'] = ({ type, payload }) => {\n const logger = getLoggerInstance();\n const { logWsTraffic } = debugOptions ?? {};\n\n if (!logWsTraffic) {\n return undefined;\n }\n\n const msg = shouldStringify(payload) ? JSON.stringify(payload, null, 2) : payload;\n\n return logger.debug(`${type.toUpperCase()}: \\n`, msg, '\\n');\n};\n\nconst getLogger = (): InternalSDKLogger => {\n const logger = getLoggerInstance();\n\n return new Proxy(logger, {\n get(target, prop: keyof InternalSDKLogger, receiver) {\n if (prop === 'wsTraffic') {\n return wsTraffic;\n }\n\n return Reflect.get(target, prop, receiver);\n }\n }) as InternalSDKLogger;\n};\n\nexport { setLogger, getLogger, setDebugOptions };\n","import { filter } from 'rxjs';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * RxJS operator that filters out `null` and `undefined` values with type narrowing.\n *\n * @example\n * ```ts\n * source$.pipe(filterNull()).subscribe(value => {\n * // value is guaranteed non-null\n * });\n * ```\n */\nexport function filterNull<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((value): value is T => value != null);\n}\n","export const getValueFrom = <T = unknown>(\n obj: unknown,\n path: string,\n defaultValue?: T\n): T | undefined => {\n const keys = path.split('.');\n let result = obj;\n for (const key of keys) {\n if (result && typeof result === 'object' && key in result) {\n result = (result as Record<string, unknown>)[key];\n } else {\n return defaultValue;\n }\n }\n return (result === undefined ? defaultValue : result) as T;\n};\n","import { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\nimport { getValueFrom } from '../utils/getValueFrom';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * Type helper to extract nested property types using dot notation.\n * Supports up to 4 levels of nesting.\n *\n * @example\n * type Example = { a: { b: { c: string } } }\n * type Result = PathValue<Example, 'a.b.c'> // string\n */\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n// Usage:\n// source$.pipe(\n// isEvent(\n// (event) => event.type === 'call.started',\n// (event) => ({ id: event.id, timestamp: event.timestamp })\n// )\n// );\n\n/**\n * RxJS operator that filters events based on a predicate and maps matching events.\n *\n * This operator combines filter and map operations:\n * 1. Only events that match the predicate are emitted\n * 2. Matching events are transformed using the map function\n *\n * @template TInput - The type of input events\n * @template TOutput - The type of output after mapping\n * @param predicate - Function to test each event. Returns true to include the event.\n * @param mapFn - Function to transform matching events\n * @returns An operator function that filters and maps events\n *\n * @example\n * ```typescript\n * interface CallEvent {\n * type: 'call.started' | 'call.ended';\n * id: string;\n * timestamp: number;\n * }\n *\n * events$.pipe(\n * isEvent(\n * (event: CallEvent) => event.type === 'call.started',\n * (event: CallEvent) => ({ id: event.id, timestamp: event.timestamp })\n * )\n * ).subscribe(startEvent => {\n * console.log('Call started:', startEvent);\n * });\n * ```\n */\nexport function ifIsMap<TInput, TOutput>(\n predicate: (event: unknown) => event is TInput,\n mapFn: (event: TInput) => TOutput\n): OperatorFunction<unknown, TOutput> {\n return pipe(filter(predicate), map(mapFn));\n}\n\n/**\n * Generic RxJS operator that filters events using a type guard and extracts a property.\n *\n * This is the generic version that works with any type, not just JSONRPCRequest.\n * Use this when you need to filter and extract properties from already-narrowed types.\n *\n * **Type inference**: The output type is automatically inferred from the input type and path!\n *\n * @template TInput - The type to narrow to (via type guard)\n * @template TPath - The dot-notation path to extract (inferred from parameter)\n * @param predicate - Type guard function to filter events\n * @param resultPath - Dot-notation path to extract (e.g., 'params', 'params.data')\n * @returns An operator function that filters and extracts\n *\n * @example\n * ```typescript\n * interface EventParams {\n * event_type: string;\n * data: { value: number };\n * }\n *\n * const isAuthEvent = (e: unknown): e is EventParams =>\n * typeof e === 'object' && e !== null && 'event_type' in e;\n *\n * // Type of 'data' is automatically inferred as { value: number }\n * params$.pipe(\n * filterAs(isAuthEvent, 'data')\n * ).subscribe(data => {\n * console.log('Event data:', data.value); // TypeScript knows about .value!\n * });\n *\n * // Deeply nested properties are also inferred\n * params$.pipe(\n * filterAs(isAuthEvent, 'data.value')\n * ).subscribe(value => {\n * console.log(value); // Type is 'number'\n * });\n * ```\n */\nexport function filterAs<TInput, TPath extends string>(\n predicate: (event: unknown) => event is TInput,\n resultPath: TPath\n): OperatorFunction<unknown, PathValue<TInput, TPath>> {\n return pipe(\n ifIsMap(predicate, (event) => {\n const result = getValueFrom<PathValue<TInput, TPath>>(event, resultPath);\n return result;\n }),\n filter((value): value is PathValue<TInput, TPath> => value !== undefined)\n );\n}\n","import { map, type OperatorFunction } from 'rxjs';\n\nimport { JSONRPCError } from '../core/errors';\nimport { getLogger } from '../utils/logger';\n\nimport type { JSONRPCResponse } from '../core/RPCMessages/types/base';\n\nconst logger = getLogger();\n\n/**\n * RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error.\n * Passes successful responses through unchanged.\n */\nexport function throwOnRPCError<T extends JSONRPCResponse>(): OperatorFunction<T, T> {\n return map((response: T) => {\n if (response.error) {\n logger.error('[throwOnRPCError] RPC error response:', {\n code: response.error.code,\n message: response.error.message,\n data: response.error.data\n });\n\n throw new JSONRPCError(response.error.code, response.error.message, response.error.data);\n }\n logger.debug('[throwOnRPCError] RPC successful response:', response);\n return response;\n });\n}\n"],"mappings":";;;;;AAAA,IAAa,kBAAb,cAAqC,MAAM;CACzC,YACE,AAAOA,IACP,SACA;AACA,QAAM,mBAAmB,KAAK,OAAO,OAAO,MAAM,QAAQ;EAHnD;AAIP,OAAK,OAAO;;;AAIhB,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YACE,AAAO,SAAS,mBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAchB,IAAa,0BAAb,cAA6C,MAAM;CACjD,YACE,AAAO,SAAS,uBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,wBAAb,cAA2C,MAAM;CA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AM;IACrB,SAAS,SAAS,MAAM;IACxB,MAAM,SAAS,MAAM;IACtB,CAAC;AAEF,SAAM,IAAI,aAAa,SAAS,MAAM,MAAM,SAAS,MAAM,SAAS,SAAS,MAAM,KAAK;;AAE1F,SAAO,MAAM,8CAA8C,SAAS;AACpE,SAAO;GACP"}
|
|
@@ -191,6 +191,16 @@ var VertoInviteHandlerError = class extends Error {
|
|
|
191
191
|
this.name = "VertoInviteHandlerError";
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
+
var VertoAttachHandlerError = class extends Error {
|
|
195
|
+
constructor(error = null, options) {
|
|
196
|
+
super("Error handling Verto attach", {
|
|
197
|
+
...options,
|
|
198
|
+
cause: options?.cause ?? (error instanceof Error ? error : void 0)
|
|
199
|
+
});
|
|
200
|
+
this.error = error;
|
|
201
|
+
this.name = "VertoAttachHandlerError";
|
|
202
|
+
}
|
|
203
|
+
};
|
|
194
204
|
var ValidationError = class extends Error {
|
|
195
205
|
constructor(message, options) {
|
|
196
206
|
super(message, options);
|
|
@@ -235,6 +245,43 @@ var DPoPInitError = class extends Error {
|
|
|
235
245
|
this.name = "DPoPInitError";
|
|
236
246
|
}
|
|
237
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Error thrown when a recovery attempt fails.
|
|
250
|
+
*
|
|
251
|
+
* Carries the recovery action and attempt number for diagnostic purposes.
|
|
252
|
+
*/
|
|
253
|
+
var RecoveryError = class extends Error {
|
|
254
|
+
constructor(action, attempt, originalError) {
|
|
255
|
+
super(`Recovery failed: ${action} (attempt ${attempt})`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
256
|
+
this.action = action;
|
|
257
|
+
this.attempt = attempt;
|
|
258
|
+
this.originalError = originalError;
|
|
259
|
+
this.name = "RecoveryError";
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Error thrown when getUserMedia fails with OverconstrainedError
|
|
264
|
+
* and all fallback levels have been exhausted.
|
|
265
|
+
*/
|
|
266
|
+
var OverconstrainedFallbackError = class extends Error {
|
|
267
|
+
constructor(deviceKind, originalError) {
|
|
268
|
+
super(`All constraint fallback levels exhausted for ${deviceKind}`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
269
|
+
this.deviceKind = deviceKind;
|
|
270
|
+
this.originalError = originalError;
|
|
271
|
+
this.name = "OverconstrainedFallbackError";
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Error thrown when the preflight connectivity test fails.
|
|
276
|
+
*/
|
|
277
|
+
var PreflightError = class extends Error {
|
|
278
|
+
constructor(phase, originalError) {
|
|
279
|
+
super(`Preflight test failed during ${phase}`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
280
|
+
this.phase = phase;
|
|
281
|
+
this.originalError = originalError;
|
|
282
|
+
this.name = "PreflightError";
|
|
283
|
+
}
|
|
284
|
+
};
|
|
238
285
|
var DeviceTokenError = class extends Error {
|
|
239
286
|
constructor(message, originalError) {
|
|
240
287
|
super(message, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
@@ -496,12 +543,30 @@ Object.defineProperty(exports, 'MessageParseError', {
|
|
|
496
543
|
return MessageParseError;
|
|
497
544
|
}
|
|
498
545
|
});
|
|
546
|
+
Object.defineProperty(exports, 'OverconstrainedFallbackError', {
|
|
547
|
+
enumerable: true,
|
|
548
|
+
get: function () {
|
|
549
|
+
return OverconstrainedFallbackError;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
Object.defineProperty(exports, 'PreflightError', {
|
|
553
|
+
enumerable: true,
|
|
554
|
+
get: function () {
|
|
555
|
+
return PreflightError;
|
|
556
|
+
}
|
|
557
|
+
});
|
|
499
558
|
Object.defineProperty(exports, 'RPCTimeoutError', {
|
|
500
559
|
enumerable: true,
|
|
501
560
|
get: function () {
|
|
502
561
|
return RPCTimeoutError;
|
|
503
562
|
}
|
|
504
563
|
});
|
|
564
|
+
Object.defineProperty(exports, 'RecoveryError', {
|
|
565
|
+
enumerable: true,
|
|
566
|
+
get: function () {
|
|
567
|
+
return RecoveryError;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
505
570
|
Object.defineProperty(exports, 'RequestError', {
|
|
506
571
|
enumerable: true,
|
|
507
572
|
get: function () {
|
|
@@ -568,6 +633,12 @@ Object.defineProperty(exports, 'ValidationError', {
|
|
|
568
633
|
return ValidationError;
|
|
569
634
|
}
|
|
570
635
|
});
|
|
636
|
+
Object.defineProperty(exports, 'VertoAttachHandlerError', {
|
|
637
|
+
enumerable: true,
|
|
638
|
+
get: function () {
|
|
639
|
+
return VertoAttachHandlerError;
|
|
640
|
+
}
|
|
641
|
+
});
|
|
571
642
|
Object.defineProperty(exports, 'VertoInviteHandlerError', {
|
|
572
643
|
enumerable: true,
|
|
573
644
|
get: function () {
|
|
@@ -634,4 +705,4 @@ Object.defineProperty(exports, 'throwOnRPCError', {
|
|
|
634
705
|
return throwOnRPCError;
|
|
635
706
|
}
|
|
636
707
|
});
|
|
637
|
-
//# sourceMappingURL=operators-
|
|
708
|
+
//# sourceMappingURL=operators-C3TtzZHH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators-C3TtzZHH.cjs","names":["at?: string","requestId: string","timeoutMs: number","error: unknown","storageType: string","key: string","originalError: Error","description: string","message: string","direction: 'inbound' | 'outbound'","code: number | string","data?: unknown","requestId?: string","originalError: unknown","operation: string","kind: string","action: string","attempt: number","originalError?: unknown","deviceKind: string","phase: string","log","userLogger: SDKLogger | null","debugOptions: LoggerOptions['debug']","wsTraffic: InternalSDKLogger['wsTraffic']","logger"],"sources":["../src/core/errors.ts","../src/utils/logger.ts","../src/operators/filterNull.ts","../src/utils/getValueFrom.ts","../src/operators/filterEventAs.ts","../src/operators/throwOnRPCError.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n constructor(\n public at?: string,\n options?: ErrorOptions\n ) {\n super(`Unexpected Error${at ? ` at ${at}` : ''}`, options);\n this.name = 'UnexpectedError';\n }\n}\n\nexport class UnimplementedError extends Error {\n constructor(\n public reason = 'Not Implemented',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'UnimplementedError';\n }\n}\n\nexport class NotConnectedError extends Error {\n constructor(\n public reason = 'Not Connected',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'NotConnectedError';\n }\n}\n\nexport class InvalidCredentialsError extends Error {\n constructor(\n public reason = 'Invalid Credentials',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'InvalidCredentialsError';\n }\n}\n\nexport class WebSocketConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketConnectionError';\n }\n}\n\nexport class TransportConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'TransportConnectionError';\n }\n}\n\nexport class WebSocketTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketTimeoutError';\n }\n}\n\nexport class RequestTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestTimeoutError';\n }\n}\n\nexport class RequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestError';\n }\n}\n\nexport class InvalidListenerError extends Error {\n constructor(options?: ErrorOptions) {\n super('listener is not a function', options);\n this.name = 'InvalidListenerError';\n }\n}\n\nexport class RPCTimeoutError extends Error {\n constructor(\n public requestId: string,\n public timeoutMs: number,\n options?: ErrorOptions\n ) {\n super(`RPC request ${requestId} timed out after ${timeoutMs}ms`, options);\n this.name = 'RPCTimeoutError';\n }\n}\n\nexport class AuthStateHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling authorization state update', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'AuthStateHandlerError';\n }\n}\n\nexport class InvalidStateTransitionError extends Error {\n constructor(\n public currentState: string,\n public targetState: string,\n options?: ErrorOptions\n ) {\n super(\n `Invalid transition: cannot transition from \"${currentState}\" to \"${targetState}\"`,\n options\n );\n this.name = 'InvalidStateTransitionError';\n }\n}\n\nexport class InvalidOptionError extends Error {\n constructor(\n public value: string,\n public availableOptions: string[],\n options?: ErrorOptions\n ) {\n super(\n `Invalid option: \"${value}\" must be one of the available options: ${availableOptions.join(', ')}`,\n options\n );\n this.name = 'InvalidOptionError';\n }\n}\n\nexport class StorageNotAvailableError extends Error {\n constructor(\n public storageType: string = 'localStorage',\n options?: ErrorOptions\n ) {\n super(`${storageType} is not available in this environment`, options);\n this.name = 'StorageNotAvailableError';\n }\n}\n\nexport class SerializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to serialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'SerializationError';\n }\n}\n\nexport class DeserializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to deserialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'DeserializationError';\n }\n}\n\nexport class StorageWriteError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to write to storage for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageWriteError';\n }\n}\n\nexport class StorageReadError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to read from storage \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageReadError';\n }\n}\n\nexport class InvalidStorageValueError extends Error {\n constructor(\n public key: string,\n public valueType: string,\n options?: ErrorOptions\n ) {\n super(\n `Cannot serialize value of type \"${valueType}\" for key \"${key}\": This type cannot be serialized to JSON`,\n options\n );\n this.name = 'InvalidStorageValueError';\n }\n}\n\nexport class DependencyError extends Error {\n constructor(\n public description: string,\n options?: ErrorOptions\n ) {\n super(`Dependency ${description} is not set or available.`, options);\n this.name = 'DependencyError';\n }\n}\n\nexport class DeviceNotFoundError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'DeviceNotFoundError';\n }\n}\n\n// =============================================================================\n// CALL ERROR TYPES\n// =============================================================================\n\n/**\n * Semantic category of a call-lifecycle error.\n *\n * - `'media'` – RTCPeerConnection / media device failure\n * - `'signaling'` – Verto / JSON-RPC protocol error\n * - `'timeout'` – Call setup timed out waiting for a response\n * - `'rejected'` – Remote side rejected the call\n * - `'network'` – Transport lost during an active call\n * - `'internal'` – Unexpected / unknown error\n */\nexport type CallErrorKind = 'media' | 'signaling' | 'timeout' | 'rejected' | 'network' | 'internal';\n\n/**\n * Structured error emitted on `call.errors$`.\n *\n * Provides actionable metadata so consumers can react without\n * resorting to `instanceof` checks on raw `Error` objects.\n */\nexport interface CallError {\n /** Semantic category of the error. */\n readonly kind: CallErrorKind;\n /**\n * Whether the error terminates the call.\n * When `true`, the call will automatically transition to `'failed'`\n * and be destroyed — no further action is needed from the consumer.\n */\n readonly fatal: boolean;\n /** The underlying error. */\n readonly error: Error;\n /** ID of the call that produced this error. */\n readonly callId: string;\n}\n\nexport class CallCreateError extends Error {\n constructor(\n public message: string,\n public error: unknown = null,\n public direction: 'inbound' | 'outbound' = 'outbound',\n options?: ErrorOptions\n ) {\n super(message, {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'CallCreateError';\n }\n}\n\nexport class JSONRPCError extends Error {\n constructor(\n public code: number | string,\n message: string,\n public data?: unknown,\n options?: ErrorOptions,\n public requestId?: string\n ) {\n super(message, options);\n this.name = 'JSONRPCError';\n }\n}\n\nexport class InvalidParams extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'InvalidParams';\n }\n}\n\nexport class ConversationError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'ConversationError';\n }\n}\n\nexport class VertoInviteHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto invite', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoInviteHandlerError';\n }\n}\n\nexport class VertoAttachHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto attach', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoAttachHandlerError';\n }\n}\n\nexport class HttpRequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'HttpRequestError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'ValidationError';\n }\n}\n\nexport class VertoPongError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to send Verto pong - call may disconnect', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'VertoPongError';\n }\n}\n\nexport class MessageParseError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to parse incoming WebSocket message', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MessageParseError';\n }\n}\n\nexport class CollectionFetchError extends Error {\n constructor(\n public operation: string,\n public originalError: unknown\n ) {\n super(`Collection fetch failed during ${operation}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'CollectionFetchError';\n }\n}\n\nexport class MediaTrackError extends Error {\n constructor(\n public operation: string,\n public kind: string,\n public originalError: unknown\n ) {\n super(`Media track ${operation} failed for ${kind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MediaTrackError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DPoPInitError extends Error {\n constructor(\n public originalError: unknown,\n message = 'Failed to initialize DPoP key pair'\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DPoPInitError';\n }\n}\n\n// =============================================================================\n// RESILIENCE ERROR TYPES\n// =============================================================================\n\n/**\n * Error thrown when a recovery attempt fails.\n *\n * Carries the recovery action and attempt number for diagnostic purposes.\n */\nexport class RecoveryError extends Error {\n constructor(\n public action: string,\n public attempt: number,\n public originalError?: unknown\n ) {\n super(`Recovery failed: ${action} (attempt ${attempt})`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'RecoveryError';\n }\n}\n\n/**\n * Error thrown when getUserMedia fails with OverconstrainedError\n * and all fallback levels have been exhausted.\n */\nexport class OverconstrainedFallbackError extends Error {\n constructor(\n public deviceKind: string,\n public originalError?: unknown\n ) {\n super(`All constraint fallback levels exhausted for ${deviceKind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'OverconstrainedFallbackError';\n }\n}\n\n/**\n * Error thrown when the preflight connectivity test fails.\n */\nexport class PreflightError extends Error {\n constructor(\n public phase: string,\n public originalError?: unknown\n ) {\n super(`Preflight test failed during ${phase}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'PreflightError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DeviceTokenError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DeviceTokenError';\n }\n}\n\nexport class TokenRefreshError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'TokenRefreshError';\n }\n}\n","import log from 'loglevel';\n\ninterface LogFn {\n <T extends object>(obj: T, msg?: string, ...args: unknown[]): void;\n (obj: unknown, msg?: string, ...args: unknown[]): void;\n (msg: string, ...args: unknown[]): void;\n}\nexport interface SDKLogger {\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n debug: LogFn;\n trace: LogFn;\n}\n\nexport interface WsTrafficOptions {\n type: 'send' | 'recv' | 'http';\n payload: unknown;\n}\n\nexport interface LoggerOptions {\n /** @internal */\n devTools?: boolean;\n /** @internal */\n debug?: {\n logWsTraffic?: boolean;\n };\n /** @internal */\n logger?: SDKLogger;\n}\n\nexport interface InternalSDKLogger extends SDKLogger {\n wsTraffic: (options: WsTrafficOptions) => void;\n}\n\nconst datetime = () => new Date().toISOString();\nconst defaultLogger = log.getLogger('signalwire');\n\nconst originalFactory = defaultLogger.methodFactory;\ndefaultLogger.methodFactory = (methodName, logLevel, loggerName) => {\n const rawMethod = originalFactory(methodName, logLevel, loggerName);\n\n return function (...args: unknown[]) {\n args.unshift(datetime(), '-');\n // eslint-disable-next-line prefer-spread\n rawMethod.apply(undefined, args);\n };\n};\n\nconst defaultLoggerLevel = defaultLogger.levels.DEBUG;\ndefaultLogger.setLevel(defaultLoggerLevel);\n\nlet userLogger: SDKLogger | null;\nconst setLogger = (logger: SDKLogger | null): void => {\n userLogger = logger;\n};\n\nlet debugOptions: LoggerOptions['debug'] = {};\nconst setDebugOptions = (options: unknown): void => {\n if (options == null) {\n debugOptions = {};\n return;\n }\n debugOptions = {\n ...debugOptions,\n ...options\n } as LoggerOptions['debug'];\n};\n\nconst getLoggerInstance = (): SDKLogger => {\n return userLogger ?? (defaultLogger as unknown as SDKLogger);\n};\n\nconst shouldStringify = (payload: WsTrafficOptions['payload']) => {\n //@ts-expect-error we don;t cara that payload is unknown\n if ('method' in payload && payload.method === 'signalwire.ping') {\n return false;\n }\n\n return true;\n};\n\nconst wsTraffic: InternalSDKLogger['wsTraffic'] = ({ type, payload }) => {\n const logger = getLoggerInstance();\n const { logWsTraffic } = debugOptions ?? {};\n\n if (!logWsTraffic) {\n return undefined;\n }\n\n const msg = shouldStringify(payload) ? JSON.stringify(payload, null, 2) : payload;\n\n return logger.debug(`${type.toUpperCase()}: \\n`, msg, '\\n');\n};\n\nconst getLogger = (): InternalSDKLogger => {\n const logger = getLoggerInstance();\n\n return new Proxy(logger, {\n get(target, prop: keyof InternalSDKLogger, receiver) {\n if (prop === 'wsTraffic') {\n return wsTraffic;\n }\n\n return Reflect.get(target, prop, receiver);\n }\n }) as InternalSDKLogger;\n};\n\nexport { setLogger, getLogger, setDebugOptions };\n","import { filter } from 'rxjs';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * RxJS operator that filters out `null` and `undefined` values with type narrowing.\n *\n * @example\n * ```ts\n * source$.pipe(filterNull()).subscribe(value => {\n * // value is guaranteed non-null\n * });\n * ```\n */\nexport function filterNull<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((value): value is T => value != null);\n}\n","export const getValueFrom = <T = unknown>(\n obj: unknown,\n path: string,\n defaultValue?: T\n): T | undefined => {\n const keys = path.split('.');\n let result = obj;\n for (const key of keys) {\n if (result && typeof result === 'object' && key in result) {\n result = (result as Record<string, unknown>)[key];\n } else {\n return defaultValue;\n }\n }\n return (result === undefined ? defaultValue : result) as T;\n};\n","import { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\nimport { getValueFrom } from '../utils/getValueFrom';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * Type helper to extract nested property types using dot notation.\n * Supports up to 4 levels of nesting.\n *\n * @example\n * type Example = { a: { b: { c: string } } }\n * type Result = PathValue<Example, 'a.b.c'> // string\n */\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n// Usage:\n// source$.pipe(\n// isEvent(\n// (event) => event.type === 'call.started',\n// (event) => ({ id: event.id, timestamp: event.timestamp })\n// )\n// );\n\n/**\n * RxJS operator that filters events based on a predicate and maps matching events.\n *\n * This operator combines filter and map operations:\n * 1. Only events that match the predicate are emitted\n * 2. Matching events are transformed using the map function\n *\n * @template TInput - The type of input events\n * @template TOutput - The type of output after mapping\n * @param predicate - Function to test each event. Returns true to include the event.\n * @param mapFn - Function to transform matching events\n * @returns An operator function that filters and maps events\n *\n * @example\n * ```typescript\n * interface CallEvent {\n * type: 'call.started' | 'call.ended';\n * id: string;\n * timestamp: number;\n * }\n *\n * events$.pipe(\n * isEvent(\n * (event: CallEvent) => event.type === 'call.started',\n * (event: CallEvent) => ({ id: event.id, timestamp: event.timestamp })\n * )\n * ).subscribe(startEvent => {\n * console.log('Call started:', startEvent);\n * });\n * ```\n */\nexport function ifIsMap<TInput, TOutput>(\n predicate: (event: unknown) => event is TInput,\n mapFn: (event: TInput) => TOutput\n): OperatorFunction<unknown, TOutput> {\n return pipe(filter(predicate), map(mapFn));\n}\n\n/**\n * Generic RxJS operator that filters events using a type guard and extracts a property.\n *\n * This is the generic version that works with any type, not just JSONRPCRequest.\n * Use this when you need to filter and extract properties from already-narrowed types.\n *\n * **Type inference**: The output type is automatically inferred from the input type and path!\n *\n * @template TInput - The type to narrow to (via type guard)\n * @template TPath - The dot-notation path to extract (inferred from parameter)\n * @param predicate - Type guard function to filter events\n * @param resultPath - Dot-notation path to extract (e.g., 'params', 'params.data')\n * @returns An operator function that filters and extracts\n *\n * @example\n * ```typescript\n * interface EventParams {\n * event_type: string;\n * data: { value: number };\n * }\n *\n * const isAuthEvent = (e: unknown): e is EventParams =>\n * typeof e === 'object' && e !== null && 'event_type' in e;\n *\n * // Type of 'data' is automatically inferred as { value: number }\n * params$.pipe(\n * filterAs(isAuthEvent, 'data')\n * ).subscribe(data => {\n * console.log('Event data:', data.value); // TypeScript knows about .value!\n * });\n *\n * // Deeply nested properties are also inferred\n * params$.pipe(\n * filterAs(isAuthEvent, 'data.value')\n * ).subscribe(value => {\n * console.log(value); // Type is 'number'\n * });\n * ```\n */\nexport function filterAs<TInput, TPath extends string>(\n predicate: (event: unknown) => event is TInput,\n resultPath: TPath\n): OperatorFunction<unknown, PathValue<TInput, TPath>> {\n return pipe(\n ifIsMap(predicate, (event) => {\n const result = getValueFrom<PathValue<TInput, TPath>>(event, resultPath);\n return result;\n }),\n filter((value): value is PathValue<TInput, TPath> => value !== undefined)\n );\n}\n","import { map, type OperatorFunction } from 'rxjs';\n\nimport { JSONRPCError } from '../core/errors';\nimport { getLogger } from '../utils/logger';\n\nimport type { JSONRPCResponse } from '../core/RPCMessages/types/base';\n\nconst logger = getLogger();\n\n/**\n * RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error.\n * Passes successful responses through unchanged.\n */\nexport function throwOnRPCError<T extends JSONRPCResponse>(): OperatorFunction<T, T> {\n return map((response: T) => {\n if (response.error) {\n logger.error('[throwOnRPCError] RPC error response:', {\n code: response.error.code,\n message: response.error.message,\n data: response.error.data\n });\n\n throw new JSONRPCError(response.error.code, response.error.message, response.error.data);\n }\n logger.debug('[throwOnRPCError] RPC successful response:', response);\n return response;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAa,kBAAb,cAAqC,MAAM;CACzC,YACE,AAAOA,IACP,SACA;AACA,QAAM,mBAAmB,KAAK,OAAO,OAAO,MAAM,QAAQ;EAHnD;AAIP,OAAK,OAAO;;;AAIhB,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YACE,AAAO,SAAS,mBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAchB,IAAa,0BAAb,cAA6C,MAAM;CACjD,YACE,AAAO,SAAS,uBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,wBAAb,cAA2C,MAAM;CAC/C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;A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@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operators-DuprVgnV.cjs","names":["at?: string","requestId: string","timeoutMs: number","error: unknown","storageType: string","key: string","originalError: Error","description: string","message: string","direction: 'inbound' | 'outbound'","code: number | string","data?: unknown","requestId?: string","originalError: unknown","operation: string","kind: string","originalError?: unknown","log","userLogger: SDKLogger | null","debugOptions: LoggerOptions['debug']","wsTraffic: InternalSDKLogger['wsTraffic']","logger"],"sources":["../src/core/errors.ts","../src/utils/logger.ts","../src/operators/filterNull.ts","../src/utils/getValueFrom.ts","../src/operators/filterEventAs.ts","../src/operators/throwOnRPCError.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n constructor(\n public at?: string,\n options?: ErrorOptions\n ) {\n super(`Unexpected Error${at ? ` at ${at}` : ''}`, options);\n this.name = 'UnexpectedError';\n }\n}\n\nexport class UnimplementedError extends Error {\n constructor(\n public reason = 'Not Implemented',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'UnimplementedError';\n }\n}\n\nexport class NotConnectedError extends Error {\n constructor(\n public reason = 'Not Connected',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'NotConnectedError';\n }\n}\n\nexport class InvalidCredentialsError extends Error {\n constructor(\n public reason = 'Invalid Credentials',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'InvalidCredentialsError';\n }\n}\n\nexport class WebSocketConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketConnectionError';\n }\n}\n\nexport class TransportConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'TransportConnectionError';\n }\n}\n\nexport class WebSocketTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketTimeoutError';\n }\n}\n\nexport class RequestTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestTimeoutError';\n }\n}\n\nexport class RequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestError';\n }\n}\n\nexport class InvalidListenerError extends Error {\n constructor(options?: ErrorOptions) {\n super('listener is not a function', options);\n this.name = 'InvalidListenerError';\n }\n}\n\nexport class RPCTimeoutError extends Error {\n constructor(\n public requestId: string,\n public timeoutMs: number,\n options?: ErrorOptions\n ) {\n super(`RPC request ${requestId} timed out after ${timeoutMs}ms`, options);\n this.name = 'RPCTimeoutError';\n }\n}\n\nexport class AuthStateHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling authorization state update', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'AuthStateHandlerError';\n }\n}\n\nexport class InvalidStateTransitionError extends Error {\n constructor(\n public currentState: string,\n public targetState: string,\n options?: ErrorOptions\n ) {\n super(\n `Invalid transition: cannot transition from \"${currentState}\" to \"${targetState}\"`,\n options\n );\n this.name = 'InvalidStateTransitionError';\n }\n}\n\nexport class InvalidOptionError extends Error {\n constructor(\n public value: string,\n public availableOptions: string[],\n options?: ErrorOptions\n ) {\n super(\n `Invalid option: \"${value}\" must be one of the available options: ${availableOptions.join(', ')}`,\n options\n );\n this.name = 'InvalidOptionError';\n }\n}\n\nexport class StorageNotAvailableError extends Error {\n constructor(\n public storageType: string = 'localStorage',\n options?: ErrorOptions\n ) {\n super(`${storageType} is not available in this environment`, options);\n this.name = 'StorageNotAvailableError';\n }\n}\n\nexport class SerializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to serialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'SerializationError';\n }\n}\n\nexport class DeserializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to deserialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'DeserializationError';\n }\n}\n\nexport class StorageWriteError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to write to storage for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageWriteError';\n }\n}\n\nexport class StorageReadError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to read from storage \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageReadError';\n }\n}\n\nexport class InvalidStorageValueError extends Error {\n constructor(\n public key: string,\n public valueType: string,\n options?: ErrorOptions\n ) {\n super(\n `Cannot serialize value of type \"${valueType}\" for key \"${key}\": This type cannot be serialized to JSON`,\n options\n );\n this.name = 'InvalidStorageValueError';\n }\n}\n\nexport class DependencyError extends Error {\n constructor(\n public description: string,\n options?: ErrorOptions\n ) {\n super(`Dependency ${description} is not set or available.`, options);\n this.name = 'DependencyError';\n }\n}\n\nexport class DeviceNotFoundError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'DeviceNotFoundError';\n }\n}\n\n// =============================================================================\n// CALL ERROR TYPES\n// =============================================================================\n\n/**\n * Semantic category of a call-lifecycle error.\n *\n * - `'media'` – RTCPeerConnection / media device failure\n * - `'signaling'` – Verto / JSON-RPC protocol error\n * - `'timeout'` – Call setup timed out waiting for a response\n * - `'rejected'` – Remote side rejected the call\n * - `'network'` – Transport lost during an active call\n * - `'internal'` – Unexpected / unknown error\n */\nexport type CallErrorKind = 'media' | 'signaling' | 'timeout' | 'rejected' | 'network' | 'internal';\n\n/**\n * Structured error emitted on `call.errors$`.\n *\n * Provides actionable metadata so consumers can react without\n * resorting to `instanceof` checks on raw `Error` objects.\n */\nexport interface CallError {\n /** Semantic category of the error. */\n readonly kind: CallErrorKind;\n /**\n * Whether the error terminates the call.\n * When `true`, the call will automatically transition to `'failed'`\n * and be destroyed — no further action is needed from the consumer.\n */\n readonly fatal: boolean;\n /** The underlying error. */\n readonly error: Error;\n /** ID of the call that produced this error. */\n readonly callId: string;\n}\n\nexport class CallCreateError extends Error {\n constructor(\n public message: string,\n public error: unknown = null,\n public direction: 'inbound' | 'outbound' = 'outbound',\n options?: ErrorOptions\n ) {\n super(message, {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'CallCreateError';\n }\n}\n\nexport class JSONRPCError extends Error {\n constructor(\n public code: number | string,\n message: string,\n public data?: unknown,\n options?: ErrorOptions,\n public requestId?: string\n ) {\n super(message, options);\n this.name = 'JSONRPCError';\n }\n}\n\nexport class InvalidParams extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'InvalidParams';\n }\n}\n\nexport class ConversationError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'ConversationError';\n }\n}\n\nexport class VertoInviteHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto invite', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoInviteHandlerError';\n }\n}\n\nexport class HttpRequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'HttpRequestError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'ValidationError';\n }\n}\n\nexport class VertoPongError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to send Verto pong - call may disconnect', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'VertoPongError';\n }\n}\n\nexport class MessageParseError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to parse incoming WebSocket message', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MessageParseError';\n }\n}\n\nexport class CollectionFetchError extends Error {\n constructor(\n public operation: string,\n public originalError: unknown\n ) {\n super(`Collection fetch failed during ${operation}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'CollectionFetchError';\n }\n}\n\nexport class MediaTrackError extends Error {\n constructor(\n public operation: string,\n public kind: string,\n public originalError: unknown\n ) {\n super(`Media track ${operation} failed for ${kind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MediaTrackError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DPoPInitError extends Error {\n constructor(\n public originalError: unknown,\n message = 'Failed to initialize DPoP key pair'\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DPoPInitError';\n }\n}\n\nexport class DeviceTokenError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DeviceTokenError';\n }\n}\n\nexport class TokenRefreshError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'TokenRefreshError';\n }\n}\n","import log from 'loglevel';\n\ninterface LogFn {\n <T extends object>(obj: T, msg?: string, ...args: unknown[]): void;\n (obj: unknown, msg?: string, ...args: unknown[]): void;\n (msg: string, ...args: unknown[]): void;\n}\nexport interface SDKLogger {\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n debug: LogFn;\n trace: LogFn;\n}\n\nexport interface WsTrafficOptions {\n type: 'send' | 'recv' | 'http';\n payload: unknown;\n}\n\nexport interface LoggerOptions {\n /** @internal */\n devTools?: boolean;\n /** @internal */\n debug?: {\n logWsTraffic?: boolean;\n };\n /** @internal */\n logger?: SDKLogger;\n}\n\nexport interface InternalSDKLogger extends SDKLogger {\n wsTraffic: (options: WsTrafficOptions) => void;\n}\n\nconst datetime = () => new Date().toISOString();\nconst defaultLogger = log.getLogger('signalwire');\n\nconst originalFactory = defaultLogger.methodFactory;\ndefaultLogger.methodFactory = (methodName, logLevel, loggerName) => {\n const rawMethod = originalFactory(methodName, logLevel, loggerName);\n\n return function (...args: unknown[]) {\n args.unshift(datetime(), '-');\n // eslint-disable-next-line prefer-spread\n rawMethod.apply(undefined, args);\n };\n};\n\nconst defaultLoggerLevel = defaultLogger.levels.DEBUG;\ndefaultLogger.setLevel(defaultLoggerLevel);\n\nlet userLogger: SDKLogger | null;\nconst setLogger = (logger: SDKLogger | null): void => {\n userLogger = logger;\n};\n\nlet debugOptions: LoggerOptions['debug'] = {};\nconst setDebugOptions = (options: unknown): void => {\n if (options == null) {\n debugOptions = {};\n return;\n }\n debugOptions = {\n ...debugOptions,\n ...options\n } as LoggerOptions['debug'];\n};\n\nconst getLoggerInstance = (): SDKLogger => {\n return userLogger ?? (defaultLogger as unknown as SDKLogger);\n};\n\nconst shouldStringify = (payload: WsTrafficOptions['payload']) => {\n //@ts-expect-error we don;t cara that payload is unknown\n if ('method' in payload && payload.method === 'signalwire.ping') {\n return false;\n }\n\n return true;\n};\n\nconst wsTraffic: InternalSDKLogger['wsTraffic'] = ({ type, payload }) => {\n const logger = getLoggerInstance();\n const { logWsTraffic } = debugOptions ?? {};\n\n if (!logWsTraffic) {\n return undefined;\n }\n\n const msg = shouldStringify(payload) ? JSON.stringify(payload, null, 2) : payload;\n\n return logger.debug(`${type.toUpperCase()}: \\n`, msg, '\\n');\n};\n\nconst getLogger = (): InternalSDKLogger => {\n const logger = getLoggerInstance();\n\n return new Proxy(logger, {\n get(target, prop: keyof InternalSDKLogger, receiver) {\n if (prop === 'wsTraffic') {\n return wsTraffic;\n }\n\n return Reflect.get(target, prop, receiver);\n }\n }) as InternalSDKLogger;\n};\n\nexport { setLogger, getLogger, setDebugOptions };\n","import { filter } from 'rxjs';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * RxJS operator that filters out `null` and `undefined` values with type narrowing.\n *\n * @example\n * ```ts\n * source$.pipe(filterNull()).subscribe(value => {\n * // value is guaranteed non-null\n * });\n * ```\n */\nexport function filterNull<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((value): value is T => value != null);\n}\n","export const getValueFrom = <T = unknown>(\n obj: unknown,\n path: string,\n defaultValue?: T\n): T | undefined => {\n const keys = path.split('.');\n let result = obj;\n for (const key of keys) {\n if (result && typeof result === 'object' && key in result) {\n result = (result as Record<string, unknown>)[key];\n } else {\n return defaultValue;\n }\n }\n return (result === undefined ? defaultValue : result) as T;\n};\n","import { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\nimport { getValueFrom } from '../utils/getValueFrom';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * Type helper to extract nested property types using dot notation.\n * Supports up to 4 levels of nesting.\n *\n * @example\n * type Example = { a: { b: { c: string } } }\n * type Result = PathValue<Example, 'a.b.c'> // string\n */\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n// Usage:\n// source$.pipe(\n// isEvent(\n// (event) => event.type === 'call.started',\n// (event) => ({ id: event.id, timestamp: event.timestamp })\n// )\n// );\n\n/**\n * RxJS operator that filters events based on a predicate and maps matching events.\n *\n * This operator combines filter and map operations:\n * 1. Only events that match the predicate are emitted\n * 2. Matching events are transformed using the map function\n *\n * @template TInput - The type of input events\n * @template TOutput - The type of output after mapping\n * @param predicate - Function to test each event. Returns true to include the event.\n * @param mapFn - Function to transform matching events\n * @returns An operator function that filters and maps events\n *\n * @example\n * ```typescript\n * interface CallEvent {\n * type: 'call.started' | 'call.ended';\n * id: string;\n * timestamp: number;\n * }\n *\n * events$.pipe(\n * isEvent(\n * (event: CallEvent) => event.type === 'call.started',\n * (event: CallEvent) => ({ id: event.id, timestamp: event.timestamp })\n * )\n * ).subscribe(startEvent => {\n * console.log('Call started:', startEvent);\n * });\n * ```\n */\nexport function ifIsMap<TInput, TOutput>(\n predicate: (event: unknown) => event is TInput,\n mapFn: (event: TInput) => TOutput\n): OperatorFunction<unknown, TOutput> {\n return pipe(filter(predicate), map(mapFn));\n}\n\n/**\n * Generic RxJS operator that filters events using a type guard and extracts a property.\n *\n * This is the generic version that works with any type, not just JSONRPCRequest.\n * Use this when you need to filter and extract properties from already-narrowed types.\n *\n * **Type inference**: The output type is automatically inferred from the input type and path!\n *\n * @template TInput - The type to narrow to (via type guard)\n * @template TPath - The dot-notation path to extract (inferred from parameter)\n * @param predicate - Type guard function to filter events\n * @param resultPath - Dot-notation path to extract (e.g., 'params', 'params.data')\n * @returns An operator function that filters and extracts\n *\n * @example\n * ```typescript\n * interface EventParams {\n * event_type: string;\n * data: { value: number };\n * }\n *\n * const isAuthEvent = (e: unknown): e is EventParams =>\n * typeof e === 'object' && e !== null && 'event_type' in e;\n *\n * // Type of 'data' is automatically inferred as { value: number }\n * params$.pipe(\n * filterAs(isAuthEvent, 'data')\n * ).subscribe(data => {\n * console.log('Event data:', data.value); // TypeScript knows about .value!\n * });\n *\n * // Deeply nested properties are also inferred\n * params$.pipe(\n * filterAs(isAuthEvent, 'data.value')\n * ).subscribe(value => {\n * console.log(value); // Type is 'number'\n * });\n * ```\n */\nexport function filterAs<TInput, TPath extends string>(\n predicate: (event: unknown) => event is TInput,\n resultPath: TPath\n): OperatorFunction<unknown, PathValue<TInput, TPath>> {\n return pipe(\n ifIsMap(predicate, (event) => {\n const result = getValueFrom<PathValue<TInput, TPath>>(event, resultPath);\n return result;\n }),\n filter((value): value is PathValue<TInput, TPath> => value !== undefined)\n );\n}\n","import { map, type OperatorFunction } from 'rxjs';\n\nimport { JSONRPCError } from '../core/errors';\nimport { getLogger } from '../utils/logger';\n\nimport type { JSONRPCResponse } from '../core/RPCMessages/types/base';\n\nconst logger = getLogger();\n\n/**\n * RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error.\n * Passes successful responses through unchanged.\n */\nexport function throwOnRPCError<T extends JSONRPCResponse>(): OperatorFunction<T, T> {\n return map((response: T) => {\n if (response.error) {\n logger.error('[throwOnRPCError] RPC error response:', {\n code: response.error.code,\n message: response.error.message,\n data: response.error.data\n });\n\n throw new JSONRPCError(response.error.code, response.error.message, response.error.data);\n }\n logger.debug('[throwOnRPCError] RPC successful response:', response);\n return response;\n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SAAS,MAAM,SAAS,SAAS,MAAM,KAAK;;AAE1F,SAAO,MAAM,8CAA8C,SAAS;AACpE,SAAO;GACP"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operators-MaKNoyky.mjs","names":["at?: string","requestId: string","timeoutMs: number","error: unknown","storageType: string","key: string","originalError: Error","description: string","message: string","direction: 'inbound' | 'outbound'","code: number | string","data?: unknown","requestId?: string","originalError: unknown","operation: string","kind: string","originalError?: unknown","userLogger: SDKLogger | null","debugOptions: LoggerOptions['debug']","wsTraffic: InternalSDKLogger['wsTraffic']","logger","filter","map"],"sources":["../src/core/errors.ts","../src/utils/logger.ts","../src/operators/filterNull.ts","../src/utils/getValueFrom.ts","../src/operators/filterEventAs.ts","../src/operators/throwOnRPCError.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n constructor(\n public at?: string,\n options?: ErrorOptions\n ) {\n super(`Unexpected Error${at ? ` at ${at}` : ''}`, options);\n this.name = 'UnexpectedError';\n }\n}\n\nexport class UnimplementedError extends Error {\n constructor(\n public reason = 'Not Implemented',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'UnimplementedError';\n }\n}\n\nexport class NotConnectedError extends Error {\n constructor(\n public reason = 'Not Connected',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'NotConnectedError';\n }\n}\n\nexport class InvalidCredentialsError extends Error {\n constructor(\n public reason = 'Invalid Credentials',\n options?: ErrorOptions\n ) {\n super(reason, options);\n this.name = 'InvalidCredentialsError';\n }\n}\n\nexport class WebSocketConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketConnectionError';\n }\n}\n\nexport class TransportConnectionError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'TransportConnectionError';\n }\n}\n\nexport class WebSocketTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WebSocketTimeoutError';\n }\n}\n\nexport class RequestTimeoutError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestTimeoutError';\n }\n}\n\nexport class RequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'RequestError';\n }\n}\n\nexport class InvalidListenerError extends Error {\n constructor(options?: ErrorOptions) {\n super('listener is not a function', options);\n this.name = 'InvalidListenerError';\n }\n}\n\nexport class RPCTimeoutError extends Error {\n constructor(\n public requestId: string,\n public timeoutMs: number,\n options?: ErrorOptions\n ) {\n super(`RPC request ${requestId} timed out after ${timeoutMs}ms`, options);\n this.name = 'RPCTimeoutError';\n }\n}\n\nexport class AuthStateHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling authorization state update', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'AuthStateHandlerError';\n }\n}\n\nexport class InvalidStateTransitionError extends Error {\n constructor(\n public currentState: string,\n public targetState: string,\n options?: ErrorOptions\n ) {\n super(\n `Invalid transition: cannot transition from \"${currentState}\" to \"${targetState}\"`,\n options\n );\n this.name = 'InvalidStateTransitionError';\n }\n}\n\nexport class InvalidOptionError extends Error {\n constructor(\n public value: string,\n public availableOptions: string[],\n options?: ErrorOptions\n ) {\n super(\n `Invalid option: \"${value}\" must be one of the available options: ${availableOptions.join(', ')}`,\n options\n );\n this.name = 'InvalidOptionError';\n }\n}\n\nexport class StorageNotAvailableError extends Error {\n constructor(\n public storageType: string = 'localStorage',\n options?: ErrorOptions\n ) {\n super(`${storageType} is not available in this environment`, options);\n this.name = 'StorageNotAvailableError';\n }\n}\n\nexport class SerializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to serialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'SerializationError';\n }\n}\n\nexport class DeserializationError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to deserialize value for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'DeserializationError';\n }\n}\n\nexport class StorageWriteError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to write to storage for key \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageWriteError';\n }\n}\n\nexport class StorageReadError extends Error {\n constructor(\n public key: string,\n public originalError: Error\n ) {\n super(`Failed to read from storage \"${key}\": ${originalError.message}`, {\n cause: originalError\n });\n this.name = 'StorageReadError';\n }\n}\n\nexport class InvalidStorageValueError extends Error {\n constructor(\n public key: string,\n public valueType: string,\n options?: ErrorOptions\n ) {\n super(\n `Cannot serialize value of type \"${valueType}\" for key \"${key}\": This type cannot be serialized to JSON`,\n options\n );\n this.name = 'InvalidStorageValueError';\n }\n}\n\nexport class DependencyError extends Error {\n constructor(\n public description: string,\n options?: ErrorOptions\n ) {\n super(`Dependency ${description} is not set or available.`, options);\n this.name = 'DependencyError';\n }\n}\n\nexport class DeviceNotFoundError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'DeviceNotFoundError';\n }\n}\n\n// =============================================================================\n// CALL ERROR TYPES\n// =============================================================================\n\n/**\n * Semantic category of a call-lifecycle error.\n *\n * - `'media'` – RTCPeerConnection / media device failure\n * - `'signaling'` – Verto / JSON-RPC protocol error\n * - `'timeout'` – Call setup timed out waiting for a response\n * - `'rejected'` – Remote side rejected the call\n * - `'network'` – Transport lost during an active call\n * - `'internal'` – Unexpected / unknown error\n */\nexport type CallErrorKind = 'media' | 'signaling' | 'timeout' | 'rejected' | 'network' | 'internal';\n\n/**\n * Structured error emitted on `call.errors$`.\n *\n * Provides actionable metadata so consumers can react without\n * resorting to `instanceof` checks on raw `Error` objects.\n */\nexport interface CallError {\n /** Semantic category of the error. */\n readonly kind: CallErrorKind;\n /**\n * Whether the error terminates the call.\n * When `true`, the call will automatically transition to `'failed'`\n * and be destroyed — no further action is needed from the consumer.\n */\n readonly fatal: boolean;\n /** The underlying error. */\n readonly error: Error;\n /** ID of the call that produced this error. */\n readonly callId: string;\n}\n\nexport class CallCreateError extends Error {\n constructor(\n public message: string,\n public error: unknown = null,\n public direction: 'inbound' | 'outbound' = 'outbound',\n options?: ErrorOptions\n ) {\n super(message, {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'CallCreateError';\n }\n}\n\nexport class JSONRPCError extends Error {\n constructor(\n public code: number | string,\n message: string,\n public data?: unknown,\n options?: ErrorOptions,\n public requestId?: string\n ) {\n super(message, options);\n this.name = 'JSONRPCError';\n }\n}\n\nexport class InvalidParams extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'InvalidParams';\n }\n}\n\nexport class ConversationError extends Error {\n constructor(\n public message: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = 'ConversationError';\n }\n}\n\nexport class VertoInviteHandlerError extends Error {\n constructor(\n public error: unknown = null,\n options?: ErrorOptions\n ) {\n super('Error handling Verto invite', {\n ...options,\n cause: options?.cause ?? (error instanceof Error ? error : undefined)\n });\n this.name = 'VertoInviteHandlerError';\n }\n}\n\nexport class HttpRequestError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'HttpRequestError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'ValidationError';\n }\n}\n\nexport class VertoPongError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to send Verto pong - call may disconnect', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'VertoPongError';\n }\n}\n\nexport class MessageParseError extends Error {\n constructor(public originalError: unknown) {\n super('Failed to parse incoming WebSocket message', {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MessageParseError';\n }\n}\n\nexport class CollectionFetchError extends Error {\n constructor(\n public operation: string,\n public originalError: unknown\n ) {\n super(`Collection fetch failed during ${operation}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'CollectionFetchError';\n }\n}\n\nexport class MediaTrackError extends Error {\n constructor(\n public operation: string,\n public kind: string,\n public originalError: unknown\n ) {\n super(`Media track ${operation} failed for ${kind}`, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'MediaTrackError';\n }\n}\n\n// =============================================================================\n// DPOP / CLIENT BOUND SAT ERROR TYPES\n// =============================================================================\n\nexport class DPoPInitError extends Error {\n constructor(\n public originalError: unknown,\n message = 'Failed to initialize DPoP key pair'\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DPoPInitError';\n }\n}\n\nexport class DeviceTokenError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'DeviceTokenError';\n }\n}\n\nexport class TokenRefreshError extends Error {\n constructor(\n message: string,\n public originalError?: unknown\n ) {\n super(message, {\n cause: originalError instanceof Error ? originalError : undefined\n });\n this.name = 'TokenRefreshError';\n }\n}\n","import log from 'loglevel';\n\ninterface LogFn {\n <T extends object>(obj: T, msg?: string, ...args: unknown[]): void;\n (obj: unknown, msg?: string, ...args: unknown[]): void;\n (msg: string, ...args: unknown[]): void;\n}\nexport interface SDKLogger {\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n debug: LogFn;\n trace: LogFn;\n}\n\nexport interface WsTrafficOptions {\n type: 'send' | 'recv' | 'http';\n payload: unknown;\n}\n\nexport interface LoggerOptions {\n /** @internal */\n devTools?: boolean;\n /** @internal */\n debug?: {\n logWsTraffic?: boolean;\n };\n /** @internal */\n logger?: SDKLogger;\n}\n\nexport interface InternalSDKLogger extends SDKLogger {\n wsTraffic: (options: WsTrafficOptions) => void;\n}\n\nconst datetime = () => new Date().toISOString();\nconst defaultLogger = log.getLogger('signalwire');\n\nconst originalFactory = defaultLogger.methodFactory;\ndefaultLogger.methodFactory = (methodName, logLevel, loggerName) => {\n const rawMethod = originalFactory(methodName, logLevel, loggerName);\n\n return function (...args: unknown[]) {\n args.unshift(datetime(), '-');\n // eslint-disable-next-line prefer-spread\n rawMethod.apply(undefined, args);\n };\n};\n\nconst defaultLoggerLevel = defaultLogger.levels.DEBUG;\ndefaultLogger.setLevel(defaultLoggerLevel);\n\nlet userLogger: SDKLogger | null;\nconst setLogger = (logger: SDKLogger | null): void => {\n userLogger = logger;\n};\n\nlet debugOptions: LoggerOptions['debug'] = {};\nconst setDebugOptions = (options: unknown): void => {\n if (options == null) {\n debugOptions = {};\n return;\n }\n debugOptions = {\n ...debugOptions,\n ...options\n } as LoggerOptions['debug'];\n};\n\nconst getLoggerInstance = (): SDKLogger => {\n return userLogger ?? (defaultLogger as unknown as SDKLogger);\n};\n\nconst shouldStringify = (payload: WsTrafficOptions['payload']) => {\n //@ts-expect-error we don;t cara that payload is unknown\n if ('method' in payload && payload.method === 'signalwire.ping') {\n return false;\n }\n\n return true;\n};\n\nconst wsTraffic: InternalSDKLogger['wsTraffic'] = ({ type, payload }) => {\n const logger = getLoggerInstance();\n const { logWsTraffic } = debugOptions ?? {};\n\n if (!logWsTraffic) {\n return undefined;\n }\n\n const msg = shouldStringify(payload) ? JSON.stringify(payload, null, 2) : payload;\n\n return logger.debug(`${type.toUpperCase()}: \\n`, msg, '\\n');\n};\n\nconst getLogger = (): InternalSDKLogger => {\n const logger = getLoggerInstance();\n\n return new Proxy(logger, {\n get(target, prop: keyof InternalSDKLogger, receiver) {\n if (prop === 'wsTraffic') {\n return wsTraffic;\n }\n\n return Reflect.get(target, prop, receiver);\n }\n }) as InternalSDKLogger;\n};\n\nexport { setLogger, getLogger, setDebugOptions };\n","import { filter } from 'rxjs';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * RxJS operator that filters out `null` and `undefined` values with type narrowing.\n *\n * @example\n * ```ts\n * source$.pipe(filterNull()).subscribe(value => {\n * // value is guaranteed non-null\n * });\n * ```\n */\nexport function filterNull<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((value): value is T => value != null);\n}\n","export const getValueFrom = <T = unknown>(\n obj: unknown,\n path: string,\n defaultValue?: T\n): T | undefined => {\n const keys = path.split('.');\n let result = obj;\n for (const key of keys) {\n if (result && typeof result === 'object' && key in result) {\n result = (result as Record<string, unknown>)[key];\n } else {\n return defaultValue;\n }\n }\n return (result === undefined ? defaultValue : result) as T;\n};\n","import { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\nimport { getValueFrom } from '../utils/getValueFrom';\n\nimport type { OperatorFunction } from 'rxjs';\n\n/**\n * Type helper to extract nested property types using dot notation.\n * Supports up to 4 levels of nesting.\n *\n * @example\n * type Example = { a: { b: { c: string } } }\n * type Result = PathValue<Example, 'a.b.c'> // string\n */\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n// Usage:\n// source$.pipe(\n// isEvent(\n// (event) => event.type === 'call.started',\n// (event) => ({ id: event.id, timestamp: event.timestamp })\n// )\n// );\n\n/**\n * RxJS operator that filters events based on a predicate and maps matching events.\n *\n * This operator combines filter and map operations:\n * 1. Only events that match the predicate are emitted\n * 2. Matching events are transformed using the map function\n *\n * @template TInput - The type of input events\n * @template TOutput - The type of output after mapping\n * @param predicate - Function to test each event. Returns true to include the event.\n * @param mapFn - Function to transform matching events\n * @returns An operator function that filters and maps events\n *\n * @example\n * ```typescript\n * interface CallEvent {\n * type: 'call.started' | 'call.ended';\n * id: string;\n * timestamp: number;\n * }\n *\n * events$.pipe(\n * isEvent(\n * (event: CallEvent) => event.type === 'call.started',\n * (event: CallEvent) => ({ id: event.id, timestamp: event.timestamp })\n * )\n * ).subscribe(startEvent => {\n * console.log('Call started:', startEvent);\n * });\n * ```\n */\nexport function ifIsMap<TInput, TOutput>(\n predicate: (event: unknown) => event is TInput,\n mapFn: (event: TInput) => TOutput\n): OperatorFunction<unknown, TOutput> {\n return pipe(filter(predicate), map(mapFn));\n}\n\n/**\n * Generic RxJS operator that filters events using a type guard and extracts a property.\n *\n * This is the generic version that works with any type, not just JSONRPCRequest.\n * Use this when you need to filter and extract properties from already-narrowed types.\n *\n * **Type inference**: The output type is automatically inferred from the input type and path!\n *\n * @template TInput - The type to narrow to (via type guard)\n * @template TPath - The dot-notation path to extract (inferred from parameter)\n * @param predicate - Type guard function to filter events\n * @param resultPath - Dot-notation path to extract (e.g., 'params', 'params.data')\n * @returns An operator function that filters and extracts\n *\n * @example\n * ```typescript\n * interface EventParams {\n * event_type: string;\n * data: { value: number };\n * }\n *\n * const isAuthEvent = (e: unknown): e is EventParams =>\n * typeof e === 'object' && e !== null && 'event_type' in e;\n *\n * // Type of 'data' is automatically inferred as { value: number }\n * params$.pipe(\n * filterAs(isAuthEvent, 'data')\n * ).subscribe(data => {\n * console.log('Event data:', data.value); // TypeScript knows about .value!\n * });\n *\n * // Deeply nested properties are also inferred\n * params$.pipe(\n * filterAs(isAuthEvent, 'data.value')\n * ).subscribe(value => {\n * console.log(value); // Type is 'number'\n * });\n * ```\n */\nexport function filterAs<TInput, TPath extends string>(\n predicate: (event: unknown) => event is TInput,\n resultPath: TPath\n): OperatorFunction<unknown, PathValue<TInput, TPath>> {\n return pipe(\n ifIsMap(predicate, (event) => {\n const result = getValueFrom<PathValue<TInput, TPath>>(event, resultPath);\n return result;\n }),\n filter((value): value is PathValue<TInput, TPath> => value !== undefined)\n );\n}\n","import { map, type OperatorFunction } from 'rxjs';\n\nimport { JSONRPCError } from '../core/errors';\nimport { getLogger } from '../utils/logger';\n\nimport type { JSONRPCResponse } from '../core/RPCMessages/types/base';\n\nconst logger = getLogger();\n\n/**\n * RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error.\n * Passes successful responses through unchanged.\n */\nexport function throwOnRPCError<T extends JSONRPCResponse>(): OperatorFunction<T, T> {\n return map((response: T) => {\n if (response.error) {\n logger.error('[throwOnRPCError] RPC error response:', {\n code: response.error.code,\n message: response.error.message,\n data: response.error.data\n });\n\n throw new JSONRPCError(response.error.code, response.error.message, response.error.data);\n }\n logger.debug('[throwOnRPCError] RPC successful response:', response);\n return response;\n });\n}\n"],"mappings":";;;;;AAAA,IAAa,kBAAb,cAAqC,MAAM;CACzC,YACE,AAAOA,IACP,SACA;AACA,QAAM,mBAAmB,KAAK,OAAO,OAAO,MAAM,QAAQ;EAHnD;AAIP,OAAK,OAAO;;;AAIhB,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YACE,AAAO,SAAS,mBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAchB,IAAa,0BAAb,cAA6C,MAAM;CACjD,YACE,AAAO,SAAS,uBAChB,SACA;AACA,QAAM,QAAQ,QAAQ;EAHf;AAIP,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,wBAAb,cAA2C,MAAM;CAC/C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAIhB,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;;;AAWhB,IAAa,kBAAb,cAAqC,MAAM;CACzC,YACE,AAAOC,WACP,AAAOC,WACP,SACA;AACA,QAAM,eAAe,UAAU,mBAAmB,UAAU,KAAK,QAAQ;EAJlE;EACA;AAIP,OAAK,OAAO;;;AAIhB,IAAa,wBAAb,cAA2C,MAAM;CAC/C,YACE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