moesif-nodejs
moesif-nodejs copied to clipboard
Provide concise TypeScript interfaces describing middleware options
At the moment, the typescript definitions do not help integrating your library. Options to middleware have everything as any
which prevents anybody from discovering the library and integrating with it. It would be great if you can provide more consice typescript interfaces that describe your API.
please upgrade to 3.3.5. it is updated now.
Thank you for looking into the issue. However, the types are still too wide and do not bring any value. Can you please specify more concrete types so that instead of object
there will be types express.Request
, express.Response
etc. At the moment, jsdoc
does not offer same type definitions as typescript would have offered. Perhaps, consider bringing in typescript.
In addition eventModel: object
does not tell what kind of object is there. Please specify exact fields and types. We use this typing internally to resolve issues that I am reporting.
export interface MoesifReporterEvent {
request: {
time: string;
uri: string;
verb: string;
headers: Record<string, string>;
body?: unknown;
};
response?: {
time: string;
status: number;
headers?: Record<string, string>;
body?: unknown;
};
user_id?: string;
company_id?: string;
metadata?: unknown;
}
Understood. Yes. agree that ultimately rebuild this library from ground up in Typescript is probably the best solution. Current type declaration is basically tacked on to this javascript library using auto generated tools. It is on our roadmap to have an typescript version, but migration is a big undertake, it will take time, hope you understand.
@xinghengwang any update?
Sorry, at this stage, still only basic Typescript types. Rebuiding is big undertake at this time.