import { i as JSONRPCResponse } from "../base-CQPEW1lJ.mjs"; import { OperatorFunction } from "rxjs"; //#region src/operators/filterNull.d.ts /** * RxJS operator that filters out `null` and `undefined` values with type narrowing. * * @example * ```ts * source$.pipe(filterNull()).subscribe(value => { * // value is guaranteed non-null * }); * ``` */ declare function filterNull(): OperatorFunction; //#endregion //#region src/operators/filterEventAs.d.ts /** * Type helper to extract nested property types using dot notation. * Supports up to 4 levels of nesting. * * @example * type Example = { a: { b: { c: string } } } * type Result = PathValue // string */ type PathValue = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? PathValue : never : P extends keyof T ? T[P] : never; /** * RxJS operator that filters events based on a predicate and maps matching events. * * This operator combines filter and map operations: * 1. Only events that match the predicate are emitted * 2. Matching events are transformed using the map function * * @template TInput - The type of input events * @template TOutput - The type of output after mapping * @param predicate - Function to test each event. Returns true to include the event. * @param mapFn - Function to transform matching events * @returns An operator function that filters and maps events * * @example * ```typescript * interface CallEvent { * type: 'call.started' | 'call.ended'; * id: string; * timestamp: number; * } * * events$.pipe( * isEvent( * (event: CallEvent) => event.type === 'call.started', * (event: CallEvent) => ({ id: event.id, timestamp: event.timestamp }) * ) * ).subscribe(startEvent => { * console.log('Call started:', startEvent); * }); * ``` */ declare function ifIsMap(predicate: (event: unknown) => event is TInput, mapFn: (event: TInput) => TOutput): OperatorFunction; /** * Generic RxJS operator that filters events using a type guard and extracts a property. * * This is the generic version that works with any type, not just JSONRPCRequest. * Use this when you need to filter and extract properties from already-narrowed types. * * **Type inference**: The output type is automatically inferred from the input type and path! * * @template TInput - The type to narrow to (via type guard) * @template TPath - The dot-notation path to extract (inferred from parameter) * @param predicate - Type guard function to filter events * @param resultPath - Dot-notation path to extract (e.g., 'params', 'params.data') * @returns An operator function that filters and extracts * * @example * ```typescript * interface EventParams { * event_type: string; * data: { value: number }; * } * * const isAuthEvent = (e: unknown): e is EventParams => * typeof e === 'object' && e !== null && 'event_type' in e; * * // Type of 'data' is automatically inferred as { value: number } * params$.pipe( * filterAs(isAuthEvent, 'data') * ).subscribe(data => { * console.log('Event data:', data.value); // TypeScript knows about .value! * }); * * // Deeply nested properties are also inferred * params$.pipe( * filterAs(isAuthEvent, 'data.value') * ).subscribe(value => { * console.log(value); // Type is 'number' * }); * ``` */ declare function filterAs(predicate: (event: unknown) => event is TInput, resultPath: TPath): OperatorFunction>; //#endregion //#region src/operators/throwOnRPCError.d.ts /** * RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error. * Passes successful responses through unchanged. */ declare function throwOnRPCError(): OperatorFunction; //#endregion export { filterAs, filterNull, ifIsMap, throwOnRPCError }; //# sourceMappingURL=index.d.mts.map