@@ -9,6 +9,8 @@ import { Event, ReadEvent, ReadableStream, WritableStream, TransformStream, Corr
99import * as es from "event-stream" ;
1010import zlib from "zlib" ;
1111import { Options as BackoffOptions } from "backoff" ;
12+ import { ParserName } from "./stream/helper/parser-util" ;
13+ import { ReadHooksParams } from "./stream/helper/leo-stream-helper" ;
1214
1315/**
1416 * A standard callback function. If the operation failed, return the first argument only,
@@ -224,26 +226,25 @@ export interface OnStartData {
224226
225227export interface ReadOptionHooks < SR extends StreamRecord > {
226228
227- onStart ?: ( data : OnStartData ) => void ,
228- onEnd ?: ( ) => void ,
229+ onStart ?: ( data : OnStartData ) => void ;
230+ onEnd ?: ( ) => void ;
229231
230- onBatchStart ?: ( streamRecords : SR [ ] ) => void | SR [ ] ,
231- onBatchEnd ?: ( streamRecords : SR [ ] ) => Promise < void > ,
232+ onBatchStart ?: ( streamRecords : SR [ ] ) => void | SR [ ] ;
233+ onBatchEnd ?: ( streamRecords : SR [ ] ) => Promise < void > ;
232234
233- onRecordStart ?: ( streamRecord : SR , index : number ) => void ,
234- onRecordEnd ?: ( streamRecord : SR , index : number ) => void ,
235+ onRecordStart ?: ( streamRecord : SR , index : number ) => void ;
236+ onRecordEnd ?: ( streamRecord : SR , index : number ) => void ;
235237
236- getS3Stream ?: ( streamRecord : SR , index : number ) => ReadableStream < string > & { idOffset : number } ,
238+ getS3Stream ?: ( streamRecord : SR , index : number ) => ReadableStream < string > & { idOffset : number } ;
237239 createS3Stream ?: ( streamRecord : SR , index : number , start : string ) => {
238- get : ( ) => ReadableStream < string > & { idOffset : number }
239- on : ( event : string , handler : ( ...args : any [ ] ) => void ) => void
240- destroy : ( error ?: any ) => void
241- } ,
240+ get : ( ) => ReadableStream < string > & { idOffset : number } ;
241+ on : ( event : string , handler : ( ...args : any [ ] ) => void ) => void ;
242+ destroy : ( error ?: any ) => void ;
243+ } ;
242244 freeS3Stream ?: ( index : number ) => void ;
243- createSplitParseStream ?: ( JSONparse : ( string ) => any , streamRecord : SR ) => TransformStream < string , any > | null ,
245+ createSplitParseStream ?: ( JSONparse : ( string ) => any , streamRecord : SR ) => TransformStream < string , any > | null ;
244246
245- onGetEvents ?: ( streamRecords : SR [ ] ) => void | SR [ ] ,
246- getExtraMetaData ?: ( ) => any ;
247+ onGetEvents ?: ( streamRecords : SR [ ] ) => void | SR [ ] ;
247248}
248249
249250
@@ -387,8 +388,10 @@ export interface ReadOptions<T = any> {
387388 *
388389 * @default : JSON.parse
389390 */
390- parser ?: ( stringEvent : string ) => ReadEvent < T > ,
391- hooks ?: ReadOptionHooks < StreamRecord >
391+ parser ?: ( ( stringEvent : string ) => ReadEvent < T > ) | ParserName | string ,
392+ parserOpts ?: any ;
393+ hooks ?: ReadOptionHooks < StreamRecord > ,
394+ autoConfigure ?: boolean | Partial < ReadHooksParams >
392395}
393396
394397/**
@@ -734,7 +737,7 @@ export declare namespace StreamUtil {
734737 /**
735738 * Default is process.env.RSTREAMS_TMP_DIR || "/tmp/rstreams"
736739 */
737- const tmpDir : string ;
740+ let tmpDir : string ;
738741
739742 /**
740743 * Helper function to turn a timestamp into an RStreams event ID.
0 commit comments