Skip to content

Commit b11151d

Browse files
@jotadevelopersergiohgz
authored andcommitted
feat: proxy npm audit endpoint
1 parent a1f533f commit b11151d

File tree

11 files changed

+1120
-151
lines changed

11 files changed

+1120
-151
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// flow-typed signature: bac0ee66e0653772d037dc47b51a5e1f
2+
// flow-typed version: da30fe6876/body-parser_v1.x.x/flow_>=v0.25.x
3+
4+
import type { Middleware, $Request, $Response } from 'express';
5+
6+
declare type bodyParser$Options = {
7+
inflate?: boolean,
8+
limit?: number | string,
9+
type?: string | string[] | ((req: $Request) => any),
10+
verify?: (req: $Request, res: $Response, buf: Buffer, encoding: string) => void
11+
};
12+
13+
declare type bodyParser$OptionsText = bodyParser$Options & {
14+
reviver?: (key: string, value: any) => any,
15+
strict?: boolean
16+
};
17+
18+
declare type bodyParser$OptionsJson = bodyParser$Options & {
19+
reviver?: (key: string, value: any) => any,
20+
strict?: boolean
21+
};
22+
23+
declare type bodyParser$OptionsUrlencoded = bodyParser$Options & {
24+
extended?: boolean,
25+
parameterLimit?: number
26+
};
27+
28+
declare module 'body-parser' {
29+
declare type Options = bodyParser$Options;
30+
declare type OptionsText = bodyParser$OptionsText;
31+
declare type OptionsJson = bodyParser$OptionsJson;
32+
declare type OptionsUrlencoded = bodyParser$OptionsUrlencoded;
33+
34+
declare function json(options?: OptionsJson): Middleware;
35+
36+
declare function raw(options?: Options): Middleware;
37+
38+
declare function text(options?: OptionsText): Middleware;
39+
40+
declare function urlencoded(options?: OptionsUrlencoded): Middleware;
41+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// flow-typed signature: 80c21b4a25778a0faefd532204b78050
2+
// flow-typed version: <<STUB>>/compression_v1.7.2/flow_v0.67.1
3+
4+
/**
5+
* This is an autogenerated libdef stub for:
6+
*
7+
* 'compression'
8+
*
9+
* Fill this stub out by replacing all the `any` types.
10+
*
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
13+
* https://github.com/flowtype/flow-typed
14+
*/
15+
16+
declare module 'compression' {
17+
declare module.exports: any;
18+
}
19+
20+
/**
21+
* We include stubs for each file inside this npm package in case you need to
22+
* require those files directly. Feel free to delete any files that aren't
23+
* needed.
24+
*/
25+
26+
// Filename aliases
27+
declare module 'compression/index' {
28+
declare module.exports: $Exports<'compression'>;
29+
}
30+
declare module 'compression/index.js' {
31+
declare module.exports: $Exports<'compression'>;
32+
}
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
// flow-typed signature: 41a220e96fcef89a09244ac3797039e8
2+
// flow-typed version: 9f7cf2ab0c/express_v4.16.x/flow_>=v0.32.x
3+
4+
import type { Server } from 'http';
5+
import type { Socket } from 'net';
6+
7+
declare type express$RouterOptions = {
8+
caseSensitive?: boolean,
9+
mergeParams?: boolean,
10+
strict?: boolean
11+
};
12+
13+
declare class express$RequestResponseBase {
14+
app: express$Application;
15+
get(field: string): string | void;
16+
}
17+
18+
declare type express$RequestParams = {
19+
[param: string]: string
20+
};
21+
22+
declare class express$Request extends http$IncomingMessage mixins express$RequestResponseBase {
23+
baseUrl: string;
24+
body: mixed;
25+
cookies: { [cookie: string]: string };
26+
connection: Socket;
27+
fresh: boolean;
28+
hostname: string;
29+
ip: string;
30+
ips: Array<string>;
31+
method: string;
32+
originalUrl: string;
33+
params: express$RequestParams;
34+
path: string;
35+
protocol: 'https' | 'http';
36+
query: { [name: string]: string | Array<string> };
37+
route: string;
38+
secure: boolean;
39+
signedCookies: { [signedCookie: string]: string };
40+
stale: boolean;
41+
subdomains: Array<string>;
42+
xhr: boolean;
43+
accepts(types: string): string | false;
44+
accepts(types: Array<string>): string | false;
45+
acceptsCharsets(...charsets: Array<string>): string | false;
46+
acceptsEncodings(...encoding: Array<string>): string | false;
47+
acceptsLanguages(...lang: Array<string>): string | false;
48+
header(field: string): string | void;
49+
is(type: string): boolean;
50+
param(name: string, defaultValue?: string): string | void;
51+
}
52+
53+
declare type express$CookieOptions = {
54+
domain?: string,
55+
encode?: (value: string) => string,
56+
expires?: Date,
57+
httpOnly?: boolean,
58+
maxAge?: number,
59+
path?: string,
60+
secure?: boolean,
61+
signed?: boolean
62+
};
63+
64+
declare type express$Path = string | RegExp;
65+
66+
declare type express$RenderCallback = (err: Error | null, html?: string) => mixed;
67+
68+
declare type express$SendFileOptions = {
69+
maxAge?: number,
70+
root?: string,
71+
lastModified?: boolean,
72+
headers?: { [name: string]: string },
73+
dotfiles?: 'allow' | 'deny' | 'ignore'
74+
};
75+
76+
declare class express$Response extends http$ServerResponse mixins express$RequestResponseBase {
77+
headersSent: boolean;
78+
locals: { [name: string]: mixed };
79+
append(field: string, value?: string): this;
80+
attachment(filename?: string): this;
81+
cookie(name: string, value: string, options?: express$CookieOptions): this;
82+
clearCookie(name: string, options?: express$CookieOptions): this;
83+
download(path: string, filename?: string, callback?: (err?: ?Error) => void): this;
84+
format(typesObject: { [type: string]: Function }): this;
85+
json(body?: mixed): this;
86+
jsonp(body?: mixed): this;
87+
links(links: { [name: string]: string }): this;
88+
location(path: string): this;
89+
redirect(url: string, ...args: Array<void>): this;
90+
redirect(status: number, url: string, ...args: Array<void>): this;
91+
render(view: string, locals?: { [name: string]: mixed }, callback?: express$RenderCallback): this;
92+
send(body?: mixed): this;
93+
sendFile(path: string, options?: express$SendFileOptions, callback?: (err?: ?Error) => mixed): this;
94+
sendStatus(statusCode: number): this;
95+
header(field: string, value?: string): this;
96+
header(headers: { [name: string]: string }): this;
97+
set(field: string, value?: string | string[]): this;
98+
set(headers: { [name: string]: string }): this;
99+
status(statusCode: number): this;
100+
type(type: string): this;
101+
vary(field: string): this;
102+
req: express$Request;
103+
}
104+
105+
declare type express$NextFunction = (err?: ?Error | 'route') => mixed;
106+
declare type express$Middleware = ((req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed) | ((error: Error, req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed);
107+
declare interface express$RouteMethodType<T> {
108+
(middleware: express$Middleware): T;
109+
(...middleware: Array<express$Middleware>): T;
110+
(path: express$Path | express$Path[], ...middleware: Array<express$Middleware>): T;
111+
}
112+
declare class express$Route {
113+
all: express$RouteMethodType<this>;
114+
get: express$RouteMethodType<this>;
115+
post: express$RouteMethodType<this>;
116+
put: express$RouteMethodType<this>;
117+
head: express$RouteMethodType<this>;
118+
delete: express$RouteMethodType<this>;
119+
options: express$RouteMethodType<this>;
120+
trace: express$RouteMethodType<this>;
121+
copy: express$RouteMethodType<this>;
122+
lock: express$RouteMethodType<this>;
123+
mkcol: express$RouteMethodType<this>;
124+
move: express$RouteMethodType<this>;
125+
purge: express$RouteMethodType<this>;
126+
propfind: express$RouteMethodType<this>;
127+
proppatch: express$RouteMethodType<this>;
128+
unlock: express$RouteMethodType<this>;
129+
report: express$RouteMethodType<this>;
130+
mkactivity: express$RouteMethodType<this>;
131+
checkout: express$RouteMethodType<this>;
132+
merge: express$RouteMethodType<this>;
133+
134+
// @TODO Missing 'm-search' but get flow illegal name error.
135+
136+
notify: express$RouteMethodType<this>;
137+
subscribe: express$RouteMethodType<this>;
138+
unsubscribe: express$RouteMethodType<this>;
139+
patch: express$RouteMethodType<this>;
140+
search: express$RouteMethodType<this>;
141+
connect: express$RouteMethodType<this>;
142+
}
143+
144+
declare class express$Router extends express$Route {
145+
constructor(options?: express$RouterOptions): void;
146+
route(path: string): express$Route;
147+
static (options?: express$RouterOptions): express$Router;
148+
use(middleware: express$Middleware): this;
149+
use(...middleware: Array<express$Middleware>): this;
150+
use(path: express$Path | express$Path[], ...middleware: Array<express$Middleware>): this;
151+
use(path: string, router: express$Router): this;
152+
handle(req: http$IncomingMessage, res: http$ServerResponse, next: express$NextFunction): void;
153+
param(param: string, callback: (req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction, id: string) => mixed): void;
154+
155+
// Can't use regular callable signature syntax due to https://github.com/facebook/flow/issues/3084
156+
$call: (req: http$IncomingMessage, res: http$ServerResponse, next?: ?express$NextFunction) => void;
157+
}
158+
159+
/*
160+
With flow-bin ^0.59, express app.listen() is deemed to return any and fails flow type coverage.
161+
Which is ironic because https://github.com/facebook/flow/blob/master/Changelog.md#misc-2 (release notes for 0.59)
162+
says "Improves typings for Node.js HTTP server listen() function." See that? IMPROVES!
163+
To work around this issue, we changed Server to ?Server here, so that our invocations of express.listen() will
164+
not be deemed to lack type coverage.
165+
*/
166+
167+
declare class express$Application extends express$Router mixins events$EventEmitter {
168+
constructor(): void;
169+
locals: { [name: string]: mixed };
170+
mountpath: string;
171+
listen(port: number, hostname?: string, backlog?: number, callback?: (err?: ?Error) => mixed): ?Server;
172+
listen(port: number, hostname?: string, callback?: (err?: ?Error) => mixed): ?Server;
173+
listen(port: number, callback?: (err?: ?Error) => mixed): ?Server;
174+
listen(path: string, callback?: (err?: ?Error) => mixed): ?Server;
175+
listen(handle: Object, callback?: (err?: ?Error) => mixed): ?Server;
176+
disable(name: string): void;
177+
disabled(name: string): boolean;
178+
enable(name: string): express$Application;
179+
enabled(name: string): boolean;
180+
engine(name: string, callback: Function): void;
181+
/**
182+
* Mixed will not be taken as a value option. Issue around using the GET http method name and the get for settings.
183+
*/
184+
// get(name: string): mixed;
185+
set(name: string, value: mixed): mixed;
186+
render(name: string, optionsOrFunction: { [name: string]: mixed }, callback: express$RenderCallback): void;
187+
handle(req: http$IncomingMessage, res: http$ServerResponse, next?: ?express$NextFunction): void;
188+
}
189+
190+
declare type JsonOptions = {
191+
inflate?: boolean,
192+
limit?: string | number,
193+
reviver?: (key: string, value: mixed) => mixed,
194+
strict?: boolean,
195+
type?: string | Array<string> | ((req: express$Request) => boolean),
196+
verify?: (req: express$Request, res: express$Response, buf: Buffer, encoding: string) => mixed
197+
};
198+
199+
declare module 'express' {
200+
declare export type RouterOptions = express$RouterOptions;
201+
declare export type CookieOptions = express$CookieOptions;
202+
declare export type Middleware = express$Middleware;
203+
declare export type NextFunction = express$NextFunction;
204+
declare export type RequestParams = express$RequestParams;
205+
declare export type $Response = express$Response;
206+
declare export type $Request = express$Request;
207+
declare export type $Application = express$Application;
208+
209+
declare module.exports: {
210+
(): express$Application, // If you try to call like a function, it will use this signature
211+
json: (opts: ?JsonOptions) => express$Middleware,
212+
static: (root: string, options?: Object) => express$Middleware, // `static` property on the function
213+
Router: typeof express$Router // `Router` property on the function
214+
};
215+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// flow-typed signature: 04b2a4d673f44e6b3f792935ecc0dffc
2+
// flow-typed version: <<STUB>>/http-proxy_v1.x.x/flow_v0.70.0
3+
4+
/**
5+
* This is an autogenerated libdef stub for:
6+
*
7+
* 'http-proxy'
8+
*
9+
* Fill this stub out by replacing all the `any` types.
10+
*
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
13+
* https://github.com/flowtype/flow-typed
14+
*/
15+
16+
declare module 'http-proxy' {
17+
declare module.exports: any;
18+
}
19+
20+
/**
21+
* We include stubs for each file inside this npm package in case you need to
22+
* require those files directly. Feel free to delete any files that aren't
23+
* needed.
24+
*/
25+
declare module 'http-proxy/coverage/lcov-report/block-navigation' {
26+
declare module.exports: any;
27+
}
28+
29+
declare module 'http-proxy/coverage/lcov-report/prettify' {
30+
declare module.exports: any;
31+
}
32+
33+
declare module 'http-proxy/coverage/lcov-report/sorter' {
34+
declare module.exports: any;
35+
}
36+
37+
declare module 'http-proxy/lib/http-proxy' {
38+
declare module.exports: any;
39+
}
40+
41+
declare module 'http-proxy/lib/http-proxy/common' {
42+
declare module.exports: any;
43+
}
44+
45+
declare module 'http-proxy/lib/http-proxy/index' {
46+
declare module.exports: any;
47+
}
48+
49+
declare module 'http-proxy/lib/http-proxy/passes/web-incoming' {
50+
declare module.exports: any;
51+
}
52+
53+
declare module 'http-proxy/lib/http-proxy/passes/web-outgoing' {
54+
declare module.exports: any;
55+
}
56+
57+
declare module 'http-proxy/lib/http-proxy/passes/ws-incoming' {
58+
declare module.exports: any;
59+
}
60+
61+
// Filename aliases
62+
declare module 'http-proxy/coverage/lcov-report/block-navigation.js' {
63+
declare module.exports: $Exports<'http-proxy/coverage/lcov-report/block-navigation'>;
64+
}
65+
declare module 'http-proxy/coverage/lcov-report/prettify.js' {
66+
declare module.exports: $Exports<'http-proxy/coverage/lcov-report/prettify'>;
67+
}
68+
declare module 'http-proxy/coverage/lcov-report/sorter.js' {
69+
declare module.exports: $Exports<'http-proxy/coverage/lcov-report/sorter'>;
70+
}
71+
declare module 'http-proxy/index' {
72+
declare module.exports: $Exports<'http-proxy'>;
73+
}
74+
declare module 'http-proxy/index.js' {
75+
declare module.exports: $Exports<'http-proxy'>;
76+
}
77+
declare module 'http-proxy/lib/http-proxy.js' {
78+
declare module.exports: $Exports<'http-proxy/lib/http-proxy'>;
79+
}
80+
declare module 'http-proxy/lib/http-proxy/common.js' {
81+
declare module.exports: $Exports<'http-proxy/lib/http-proxy/common'>;
82+
}
83+
declare module 'http-proxy/lib/http-proxy/index.js' {
84+
declare module.exports: $Exports<'http-proxy/lib/http-proxy/index'>;
85+
}
86+
declare module 'http-proxy/lib/http-proxy/passes/web-incoming.js' {
87+
declare module.exports: $Exports<'http-proxy/lib/http-proxy/passes/web-incoming'>;
88+
}
89+
declare module 'http-proxy/lib/http-proxy/passes/web-outgoing.js' {
90+
declare module.exports: $Exports<'http-proxy/lib/http-proxy/passes/web-outgoing'>;
91+
}
92+
declare module 'http-proxy/lib/http-proxy/passes/ws-incoming.js' {
93+
declare module.exports: $Exports<'http-proxy/lib/http-proxy/passes/ws-incoming'>;
94+
}

0 commit comments

Comments
 (0)