diff --git a/src/main/ts/index.ts b/src/main/ts/index.ts index e953e92..d8a5525 100644 --- a/src/main/ts/index.ts +++ b/src/main/ts/index.ts @@ -1,6 +1,7 @@ import { IClientEventDto, LogLevel } from '@qiwi/substrate' import { nanoid } from 'nanoid' +import { IPipeOutput } from './interfaces' import { createFlpPipeline, eventifyPipe } from './pipes/flp' import { createTransmittable, createTransmitter } from './transmitter' import { getCookie, setCookie } from './utils/cookie' @@ -66,7 +67,7 @@ const createFrontLogProxyTransmitter = ({ }) } return acc - }, {} as Record Promise>) + }, {} as Record Promise>) } export { @@ -78,3 +79,7 @@ export { eventifyPipe, createFrontLogProxyTransmitter, } + +export type { + IClientEventDtoFlp +} diff --git a/src/main/ts/pipes/httpFallback.ts b/src/main/ts/pipes/httpFallback.ts index 163a02f..569ff4e 100644 --- a/src/main/ts/pipes/httpFallback.ts +++ b/src/main/ts/pipes/httpFallback.ts @@ -15,7 +15,7 @@ export const createHttpPipeFallback = (opts: IHttpPipeOpts[]): IPipe => { return { type, execute(transmittable: ITransmittable): IPromise { - return executeFailproof(transmittable, httpPipes) + return executeFailproof(transmittable, [...httpPipes]) }, } } diff --git a/src/test/ts/createFrontLogProxyTransmitter.ts b/src/test/ts/createFrontLogProxyTransmitter.ts index 4a12a38..d3d7699 100644 --- a/src/test/ts/createFrontLogProxyTransmitter.ts +++ b/src/test/ts/createFrontLogProxyTransmitter.ts @@ -97,4 +97,21 @@ test('createFrontLogProxyTransmitter correctly call fetch with Error', async () } }) +test('createFrontLogProxyTransmitter does not throw an error on several calls', async () => { + const transmitter = createFrontLogProxyTransmitter({ + appName: 'testApp', + url: 'https://reqres.in/api/users/2', + }) + + const callAndCheck = async (message: string) => { + const [err, res] = await transmitter.info({ message }) + assert.equal(res.message, message) + assert.equal(err, null) + } + + await callAndCheck('foo') + await callAndCheck('bar') + await callAndCheck('baz') +}) + test.run()