@xapp/arachne
Advanced tools
Comparing version 0.4.7 to 0.5.0
@@ -9,5 +9,5 @@ /*! Copyright (c) 2020, XAPP AI */ | ||
export declare const DEFAULT_MAX_RETRIES = 3; | ||
export declare type ArachneResponse = HTTPResponse; | ||
export declare type ArachnePage = Page; | ||
export declare type ArachnePageHandler = (page: ArachnePage, request: ArachneRequest, response: ArachneResponse) => Promise<void>; | ||
export type ArachneResponse = HTTPResponse; | ||
export type ArachnePage = Page; | ||
export type ArachnePageHandler = (page: ArachnePage, request: ArachneRequest, response: ArachneResponse) => Promise<void>; | ||
export interface ArachneProps { | ||
@@ -14,0 +14,0 @@ /** |
@@ -25,2 +25,3 @@ "use strict"; | ||
super(message); | ||
this.name = "PagedError"; | ||
this.page = page; | ||
@@ -148,6 +149,15 @@ } | ||
try { | ||
yield (0, util_1.promiseWithTimeout)(this.pageHandlerTimeout, this.pageHandler.bind(this, page, currentRequest, response), new PagedError(`ArachnePageHandler function exceeded timeout of ${this.pageHandlerTimeout} ms`, page)); | ||
yield (0, util_1.promiseWithTimeout)(this.pageHandlerTimeout, this.pageHandler.bind(this, page, currentRequest, response), `ArachnePageHandler function exceeded timeout of ${this.pageHandlerTimeout} ms`); | ||
} | ||
catch (e) { | ||
// Throw it again with the page so it gets caught! | ||
console.error(e); | ||
if (e.name === "TimeoutError") { | ||
// eslint-disable-next-line no-console | ||
console.debug(e.message); | ||
} | ||
else { | ||
console.error(`Caught error in pageHandler`); | ||
console.error(e); | ||
} | ||
throw new PagedError(e, page); | ||
@@ -154,0 +164,0 @@ } |
/*! Copyright (c) 2020, XAPP AI */ | ||
export declare class TimeoutError extends Error { | ||
readonly name = "TimeoutError"; | ||
} | ||
/** | ||
@@ -3,0 +6,0 @@ * Wraps the function that returns a promise with a timeout |
"use strict"; | ||
/*! Copyright (c) 2020, XAPP AI */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.promiseWithTimeout = void 0; | ||
exports.promiseWithTimeout = exports.TimeoutError = void 0; | ||
class TimeoutError extends Error { | ||
constructor() { | ||
super(...arguments); | ||
this.name = "TimeoutError"; | ||
} | ||
} | ||
exports.TimeoutError = TimeoutError; | ||
/** | ||
@@ -16,6 +23,6 @@ * Wraps the function that returns a promise with a timeout | ||
if (!failureMessage) { | ||
error = new Error(); | ||
error = new TimeoutError(); | ||
} | ||
else if (typeof failureMessage === "string") { | ||
error = new Error(failureMessage); | ||
error = new TimeoutError(failureMessage); | ||
} | ||
@@ -22,0 +29,0 @@ else { |
{ | ||
"name": "@xapp/arachne", | ||
"version": "0.4.7", | ||
"version": "0.5.0", | ||
"types": "lib/index", | ||
@@ -15,10 +15,10 @@ "main": "lib/index", | ||
"engines": { | ||
"node": "^10 || ^12 || ^14 || ^16" | ||
"node": "^14 || ^16 || ^18" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "7.33.6", | ||
"@microsoft/api-extractor": "7.34.4", | ||
"@types/chai": "4.3.4", | ||
"@types/generic-pool": "3.1.11", | ||
"@types/mocha": "10.0.0", | ||
"@types/node": "17.0.32", | ||
"@types/mocha": "10.0.1", | ||
"@types/node": "18.11.18", | ||
"@types/sinon": "10.0.13", | ||
@@ -28,15 +28,15 @@ "@types/sinon-chai": "3.2.9", | ||
"chai": "4.3.7", | ||
"mocha": "10.1.0", | ||
"mocha": "10.2.0", | ||
"puppeteer": "18.2.1", | ||
"sinon": "14.0.1", | ||
"sinon": "15.0.1", | ||
"sinon-chai": "3.7.0", | ||
"ts-node": "10.9.1", | ||
"tslib": "2.4.1", | ||
"typescript": "4.8.4" | ||
"tslib": "2.5.0", | ||
"typescript": "4.9.5" | ||
}, | ||
"dependencies": { | ||
"@xapp/arachne-utils": "0.4.6", | ||
"@xapp/arachne-utils": "0.5.0", | ||
"generic-pool": "3.9.0", | ||
"puppeteer-extra": "3.3.4", | ||
"puppeteer-extra-plugin-stealth": "2.11.1" | ||
"puppeteer-extra": "3.3.6", | ||
"puppeteer-extra-plugin-stealth": "2.11.2" | ||
}, | ||
@@ -52,3 +52,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "20868c6a7532079a290b47fd3d9e44f1040bfc70" | ||
"gitHead": "3f8407d44b028384726efab7359aafe796469209" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62608
896
+ Added@xapp/arachne-utils@0.5.0(transitive)
+ Addedpuppeteer-extra@3.3.6(transitive)
+ Addedpuppeteer-extra-plugin-stealth@2.11.2(transitive)
- Removed@xapp/arachne-utils@0.4.6(transitive)
- Removedpuppeteer-extra@3.3.4(transitive)
- Removedpuppeteer-extra-plugin-stealth@2.11.1(transitive)
Updated@xapp/arachne-utils@0.5.0
Updatedpuppeteer-extra@3.3.6