-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.ts
54 lines (46 loc) · 1.87 KB
/
classes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import type Puppeteer from 'puppeteer'
import type EventEmitter from 'events'
import type { IConfigurableMixin, ILoggableMixin, INetworkMixin } from './mixins'
import type { RequestStage, IRequestOptions, IResponseOptions, IAbortReason, IResponseOverrides } from './network'
// TODO: add PuppeteerExtraPlugin/AutomationExtraPlugin?
export interface IInterceptionProxyPlugin extends
IConfigurableMixin, ILoggableMixin {
}
export interface IInterceptionProxyBrowser extends
IConfigurableMixin, ILoggableMixin {
proceedNewPage(page: Puppeteer.Page): Promise<IInterceptionProxyPage>
}
export interface IInterceptionProxyPage extends
IConfigurableMixin, ILoggableMixin {
readonly page: Puppeteer.Page;
}
export interface INewRequestInitialArgs {
page: Puppeteer.Page;
__parent: IInterceptionProxyPage;
originalRequest: Puppeteer.HTTPRequest;
}
export interface IInterceptionProxyNetworkEntity extends
IConfigurableMixin, ILoggableMixin, EventEmitter, INetworkMixin {
readonly page: Puppeteer.Page;
readonly originalRequest: Puppeteer.HTTPRequest;
stage: RequestStage;
getRequest(): IInterceptionProxyRequest;
setResponse(response: IResponseOptions): Promise<IInterceptionProxyResponse>;
getResponse(): Promise<IInterceptionProxyResponse>;
abort(abortReason?: IAbortReason): Promise<IInterceptionProxyResponse>;
/**
* Will send gathered response back to the puppeteer immediately
*
* If response not collected yet will call getResponse first.
*/
continue(): Promise<void>;
}
export interface IInterceptionProxyRequest extends
IInterceptionProxyNetworkEntity, IRequestOptions {
}
export interface IInterceptionProxyResponse extends
IInterceptionProxyNetworkEntity, Partial<IResponseOverrides> {
originalResponse?: Puppeteer.HTTPResponse,
responseOptions: IResponseOptions;
abortReason?: IAbortReason;
}