Skip to content

Commit

Permalink
Expose perimiterx interceptor types. (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeadglaz authored Aug 12, 2021
1 parent 753f257 commit ca12767
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.4

## Improvements
Exposing package `types` entry.

# 1.0.3

## Improvements
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perimeterx-axios-interceptor",
"version": "1.0.3",
"version": "1.0.4",
"description": "🧱 Intercept requests which are blocked by PerimeterX - pop up the challenge and retry the request",
"keywords": [
"perimeterx",
Expand Down Expand Up @@ -28,6 +28,7 @@
"tester": "node ./tools/tester/index.js"
},
"main": "index.js",
"types": "types.d.ts",
"devDependencies": {
"@fiverr/eslint-config-fiverr": "^3.2.2",
"@lets/wait": "^2.0.2",
Expand Down
25 changes: 25 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AxiosInstance, AxiosError } from 'axios';

interface FilterOptions {
path: string;
appId?: string;
}

export interface PerimeterXInterceptorConfig {
filter: (options: FilterOptions) => boolean;
onintercept: (request: Request) => void;
onignore: (request: Request) => void;
onsuccess: (request: Request) => void;
onfailure: (request: Request, error: AxiosError) => void;
onerror: (error: AxiosError) => void;
modalConfig: {
timeout: number;
}
}

export declare const attach: (
axiosInstance: AxiosInstance,
config: PerimeterXInterceptorConfig
) => void;

export declare const detach: (axiosInstance: AxiosInstance) => void;

0 comments on commit ca12767

Please sign in to comment.