new10com / axios-logger

Library that should be used as axios request/response interceptor for logging request/response details
MIT License
14 stars 2 forks source link

types not exported as documentation suggests #1

Closed xenoterracide closed 4 years ago

xenoterracide commented 4 years ago

this is what's exported, you'll notice statics like AxiosLogger.using are not exported (not really sure why they aren't emitted). also the docs have you package name wrong.

import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";
import { LogFn } from "pino";
interface Headers {
    [key: string]: string | object;
}
interface HeaderRecord {
    key: string;
    value: string | object;
}
export declare const indent = "  ";
declare type ErrorSource = 'Request' | 'Response';
export declare class AxiosLogger {
    protected ignoreHeaderKeys: string[];
    protected logInfo: LogFn;
    protected logError: LogFn;
    constructor(infoFn?: LogFn, errorFn?: LogFn);
    logRequest(request: AxiosRequestConfig): void;
    logResponse(resp: AxiosResponse): void;
    logErrorDetails(err: any): void;
    protected parseError(error: AxiosError, errorSource: ErrorSource): string;
    protected parseRequest(request: AxiosRequestConfig): string;
    protected parseResponse(resp: AxiosResponse): string;
    protected startingLine(name: any): string;
    protected endingLine(): string;
    protected title(detailName: string): string;
    protected newLine(): string;
    protected prettyFormatBody(body: string | object): string;
    protected parseHeaders(headers: Headers): string;
    protected transformHeadersToStringArr(headers: Headers): string[];
    protected prettyHeaderEntry(headerEntry: HeaderRecord, isFirstElement: boolean, isLastElement: boolean): string;
}
export {};
azakordonets commented 4 years ago

Hmmm, interesting. Sorry about that - i'm starting with Typescript recently. Will try to fix that soon.

xenoterracide commented 4 years ago

yeah, I'll be honest, I don't get why these aren't available on the class either, seems like they should be...

azakordonets commented 4 years ago

I had a problem with publishing new versions of the library to npm from Github. Now it should be fixed in v0.1.3 - can you please give it a try ? @xenoterracide

xenoterracide commented 4 years ago

using is now exported, I notice a lot of the same protected stuff isn't but maybe that's not supposed to be a part of your published api. What was the issue? out of curiousity.

azakordonets commented 4 years ago

@xenoterracide i have 2fa on this account and i need to setup properly tokens in Github in order to public from CI. Will do that later. For now publishing from my local machine. And the problem you had was because the first version that was published on npm was using an old code. When i refactored the library, publishing was taking too long on Github and i forgot to check it's state :) It appeared to be broken and therefore my changes were not properly published to npm.