perimeterx-js-core 0.21.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/products/bot_defender/BotDefender.js +1 -1
- package/lib/cjs/products/bot_defender/block/DefaultBotDefenderBlocker.js +11 -2
- package/lib/cjs/products/bot_defender/block/captcha/CaptchaBlocker.js +8 -5
- package/lib/cjs/products/bot_defender/block/captcha/HtmlCaptchaBlocker.js +5 -4
- package/lib/cjs/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +3 -3
- package/lib/cjs/products/bot_defender/block/captcha/MobileCaptchaBlocker.js +2 -2
- package/lib/cjs/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +4 -2
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/cjs/utils/utils.js +1 -1
- package/lib/esm/products/bot_defender/BotDefender.js +1 -1
- package/lib/esm/products/bot_defender/block/DefaultBotDefenderBlocker.js +12 -3
- package/lib/esm/products/bot_defender/block/captcha/CaptchaBlocker.js +8 -5
- package/lib/esm/products/bot_defender/block/captcha/HtmlCaptchaBlocker.js +6 -4
- package/lib/esm/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +3 -3
- package/lib/esm/products/bot_defender/block/captcha/MobileCaptchaBlocker.js +2 -2
- package/lib/esm/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -2
- package/lib/esm/utils/constants.js +1 -1
- package/lib/esm/utils/utils.js +1 -1
- package/lib/types/activities/utils.d.ts +30 -0
- package/lib/types/blocker/utils.d.ts +3 -0
- package/lib/types/http/interfaces/IBody.d.ts +1 -1
- package/lib/types/http/interfaces/IOutgoingResponse.d.ts +7 -2
- package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +9 -0
- package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +6 -1
- package/lib/types/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +21 -9
- package/lib/types/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +7 -1
- package/lib/types/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +5 -1
- package/lib/types/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +6 -1
- package/lib/types/pxhd/PXHDUtils.d.ts +6 -0
- package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +6 -0
- package/lib/types/utils/constants.d.ts +1 -1
- package/package.json +3 -3
|
@@ -67,7 +67,7 @@ var BotDefender = /** @class */ (function () {
|
|
|
67
67
|
this.firstParty =
|
|
68
68
|
(_a = options.firstParty) !== null && _a !== void 0 ? _a : new first_party_1.DefaultBotDefenderFirstParty(config, { urlUtils: options.urlUtils });
|
|
69
69
|
this.filter = (_b = options.filter) !== null && _b !== void 0 ? _b : new filter_1.DefaultBotDefenderFilter(config, options.ipRangeChecker);
|
|
70
|
-
this.blocker = (_c = options.blocker) !== null && _c !== void 0 ? _c : new block_1.DefaultBotDefenderBlocker(config, options.base64Utils);
|
|
70
|
+
this.blocker = (_c = options.blocker) !== null && _c !== void 0 ? _c : new block_1.DefaultBotDefenderBlocker(config, { base64Utils: options.base64Utils });
|
|
71
71
|
}
|
|
72
72
|
BotDefender.prototype.handleFirstPartyRequest = function (context) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8,9 +8,18 @@ var utils_1 = require("../../utils");
|
|
|
8
8
|
var captcha_1 = require("./captcha");
|
|
9
9
|
var templates_1 = require("./templates");
|
|
10
10
|
var DefaultBotDefenderBlocker = /** @class */ (function () {
|
|
11
|
-
function DefaultBotDefenderBlocker(config,
|
|
11
|
+
function DefaultBotDefenderBlocker(config, options) {
|
|
12
12
|
this.config = config;
|
|
13
|
-
|
|
13
|
+
if ('captchaBlocker' in options) {
|
|
14
|
+
this.captchaBlocker = options.captchaBlocker;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this.captchaBlocker = new captcha_1.CaptchaBlocker({
|
|
18
|
+
config: config,
|
|
19
|
+
base64Utils: options.base64Utils,
|
|
20
|
+
captchaTemplate: templates_1.CAPTCHA_TEMPLATE,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
DefaultBotDefenderBlocker.prototype.shouldBlock = function (_a) {
|
|
16
25
|
var action = _a.action, reasons = _a.reasons, productData = _a.productData;
|
|
@@ -5,11 +5,14 @@ var JsonCaptchaBlocker_1 = require("./JsonCaptchaBlocker");
|
|
|
5
5
|
var MobileCaptchaBlocker_1 = require("./MobileCaptchaBlocker");
|
|
6
6
|
var HtmlCaptchaBlocker_1 = require("./HtmlCaptchaBlocker");
|
|
7
7
|
var CaptchaBlocker = /** @class */ (function () {
|
|
8
|
-
function CaptchaBlocker(
|
|
9
|
-
this.config = config;
|
|
10
|
-
this.jsonCaptchaBlocker =
|
|
11
|
-
|
|
12
|
-
this.
|
|
8
|
+
function CaptchaBlocker(options) {
|
|
9
|
+
this.config = options.config;
|
|
10
|
+
this.jsonCaptchaBlocker =
|
|
11
|
+
'jsonCaptchaBlocker' in options ? options.jsonCaptchaBlocker : new JsonCaptchaBlocker_1.JsonCaptchaBlocker(options);
|
|
12
|
+
this.mobileCaptchaBlocker =
|
|
13
|
+
'mobileCaptchaBlocker' in options ? options.mobileCaptchaBlocker : new MobileCaptchaBlocker_1.MobileCaptchaBlocker(options);
|
|
14
|
+
this.htmlCaptchaBlocker =
|
|
15
|
+
'htmlCaptchaBlocker' in options ? options.htmlCaptchaBlocker : new HtmlCaptchaBlocker_1.HtmlCaptchaBlocker(options);
|
|
13
16
|
}
|
|
14
17
|
CaptchaBlocker.prototype.createBlockResponse = function (context) {
|
|
15
18
|
if (this.mobileCaptchaBlocker.shouldBlock(context)) {
|
|
@@ -21,14 +21,15 @@ var blocker_1 = require("../../../../blocker");
|
|
|
21
21
|
var templates_1 = require("../templates");
|
|
22
22
|
var HtmlCaptchaBlocker = /** @class */ (function (_super) {
|
|
23
23
|
__extends(HtmlCaptchaBlocker, _super);
|
|
24
|
-
function HtmlCaptchaBlocker(
|
|
24
|
+
function HtmlCaptchaBlocker(options) {
|
|
25
25
|
var _this = _super.call(this, http_1.ContentType.TEXT_HTML) || this;
|
|
26
|
-
_this.config = config;
|
|
27
|
-
_this.base64Utils = base64Utils;
|
|
26
|
+
_this.config = options.config;
|
|
27
|
+
_this.base64Utils = options.base64Utils;
|
|
28
|
+
_this.captchaTemplate = options.captchaTemplate || templates_1.CAPTCHA_TEMPLATE;
|
|
28
29
|
return _this;
|
|
29
30
|
}
|
|
30
31
|
HtmlCaptchaBlocker.prototype.createBlockBody = function (context) {
|
|
31
|
-
return (0, blocker_1.renderHtml)(
|
|
32
|
+
return (0, blocker_1.renderHtml)(this.captchaTemplate, (0, blocker_1.createBlockData)(this.config, context, this.base64Utils));
|
|
32
33
|
};
|
|
33
34
|
return HtmlCaptchaBlocker;
|
|
34
35
|
}(blocker_1.BlockerBase));
|
|
@@ -19,10 +19,10 @@ exports.JsonCaptchaBlocker = void 0;
|
|
|
19
19
|
var blocker_1 = require("../../../../blocker");
|
|
20
20
|
var JsonCaptchaBlocker = /** @class */ (function (_super) {
|
|
21
21
|
__extends(JsonCaptchaBlocker, _super);
|
|
22
|
-
function JsonCaptchaBlocker(
|
|
22
|
+
function JsonCaptchaBlocker(options) {
|
|
23
23
|
var _this = _super.call(this) || this;
|
|
24
|
-
_this.config = config;
|
|
25
|
-
_this.base64Utils = base64Utils;
|
|
24
|
+
_this.config = options.config;
|
|
25
|
+
_this.base64Utils = options.base64Utils;
|
|
26
26
|
return _this;
|
|
27
27
|
}
|
|
28
28
|
JsonCaptchaBlocker.prototype.shouldBlock = function (context) {
|
|
@@ -20,8 +20,8 @@ var blocker_1 = require("../../../../blocker");
|
|
|
20
20
|
var templates_1 = require("../templates");
|
|
21
21
|
var MobileCaptchaBlocker = /** @class */ (function (_super) {
|
|
22
22
|
__extends(MobileCaptchaBlocker, _super);
|
|
23
|
-
function MobileCaptchaBlocker(
|
|
24
|
-
return _super.call(this, config, base64Utils, templates_1.CAPTCHA_TEMPLATE) || this;
|
|
23
|
+
function MobileCaptchaBlocker(options) {
|
|
24
|
+
return _super.call(this, options.config, options.base64Utils, options.captchaTemplate || templates_1.CAPTCHA_TEMPLATE) || this;
|
|
25
25
|
}
|
|
26
26
|
return MobileCaptchaBlocker;
|
|
27
27
|
}(blocker_1.MobileBlocker));
|
|
@@ -45,8 +45,10 @@ var BodyLoginSuccessfulParser = /** @class */ (function () {
|
|
|
45
45
|
var _a, _b;
|
|
46
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
47
|
return __generator(this, function (_c) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
switch (_c.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, response.text()];
|
|
50
|
+
case 1: return [2 /*return*/, !!((_b = (_a = (_c.sent())) === null || _a === void 0 ? void 0 : _a.match) === null || _b === void 0 ? void 0 : _b.call(_a, this.bodyRegex))];
|
|
51
|
+
}
|
|
50
52
|
});
|
|
51
53
|
});
|
|
52
54
|
};
|
|
@@ -14,4 +14,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
14
14
|
exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
15
15
|
exports.URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
16
16
|
exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
17
|
-
exports.CORE_MODULE_VERSION = 'JS Core 0.21.
|
|
17
|
+
exports.CORE_MODULE_VERSION = 'JS Core 0.21.2';
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -228,7 +228,7 @@ var toHash = function (string) {
|
|
|
228
228
|
};
|
|
229
229
|
var telemetryConfigReplacer = function (key, value) {
|
|
230
230
|
if (value instanceof RegExp) {
|
|
231
|
-
return '_REGEXP ' + value.toString();
|
|
231
|
+
return '_REGEXP ' + value.toString().replace(/\\\//g, '/');
|
|
232
232
|
}
|
|
233
233
|
if (value instanceof Function) {
|
|
234
234
|
return '_FUNCTION_HASH' + toHash(value.toString()); // NOTE: Do not log functions
|
|
@@ -20,7 +20,7 @@ export class BotDefender {
|
|
|
20
20
|
this.firstParty =
|
|
21
21
|
options.firstParty ?? new DefaultBotDefenderFirstParty(config, { urlUtils: options.urlUtils });
|
|
22
22
|
this.filter = options.filter ?? new DefaultBotDefenderFilter(config, options.ipRangeChecker);
|
|
23
|
-
this.blocker = options.blocker ?? new DefaultBotDefenderBlocker(config, options.base64Utils);
|
|
23
|
+
this.blocker = options.blocker ?? new DefaultBotDefenderBlocker(config, { base64Utils: options.base64Utils });
|
|
24
24
|
}
|
|
25
25
|
async handleFirstPartyRequest(context) {
|
|
26
26
|
return this.firstParty.handleFirstPartyRequest(context);
|
|
@@ -3,13 +3,22 @@ import { BlockAction } from '../../../blocker';
|
|
|
3
3
|
import { ContentType, CONTENT_TYPE_HEADER_NAME, MinimalResponseImpl } from '../../../http';
|
|
4
4
|
import { ProductName } from '../../utils';
|
|
5
5
|
import { CaptchaBlocker } from './captcha';
|
|
6
|
-
import { RATE_LIMIT_TEMPLATE } from './templates';
|
|
6
|
+
import { CAPTCHA_TEMPLATE, RATE_LIMIT_TEMPLATE } from './templates';
|
|
7
7
|
export class DefaultBotDefenderBlocker {
|
|
8
8
|
config;
|
|
9
9
|
captchaBlocker;
|
|
10
|
-
constructor(config,
|
|
10
|
+
constructor(config, options) {
|
|
11
11
|
this.config = config;
|
|
12
|
-
|
|
12
|
+
if ('captchaBlocker' in options) {
|
|
13
|
+
this.captchaBlocker = options.captchaBlocker;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.captchaBlocker = new CaptchaBlocker({
|
|
17
|
+
config,
|
|
18
|
+
base64Utils: options.base64Utils,
|
|
19
|
+
captchaTemplate: CAPTCHA_TEMPLATE,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
shouldBlock({ action, reasons, productData }) {
|
|
15
24
|
return action === Action.BLOCK && !!reasons?.[ProductName.BOT_DEFENDER];
|
|
@@ -6,11 +6,14 @@ export class CaptchaBlocker {
|
|
|
6
6
|
jsonCaptchaBlocker;
|
|
7
7
|
mobileCaptchaBlocker;
|
|
8
8
|
htmlCaptchaBlocker;
|
|
9
|
-
constructor(
|
|
10
|
-
this.config = config;
|
|
11
|
-
this.jsonCaptchaBlocker =
|
|
12
|
-
|
|
13
|
-
this.
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.config = options.config;
|
|
11
|
+
this.jsonCaptchaBlocker =
|
|
12
|
+
'jsonCaptchaBlocker' in options ? options.jsonCaptchaBlocker : new JsonCaptchaBlocker(options);
|
|
13
|
+
this.mobileCaptchaBlocker =
|
|
14
|
+
'mobileCaptchaBlocker' in options ? options.mobileCaptchaBlocker : new MobileCaptchaBlocker(options);
|
|
15
|
+
this.htmlCaptchaBlocker =
|
|
16
|
+
'htmlCaptchaBlocker' in options ? options.htmlCaptchaBlocker : new HtmlCaptchaBlocker(options);
|
|
14
17
|
}
|
|
15
18
|
createBlockResponse(context) {
|
|
16
19
|
if (this.mobileCaptchaBlocker.shouldBlock(context)) {
|
|
@@ -4,12 +4,14 @@ import { CAPTCHA_TEMPLATE } from '../templates';
|
|
|
4
4
|
export class HtmlCaptchaBlocker extends BlockerBase {
|
|
5
5
|
config;
|
|
6
6
|
base64Utils;
|
|
7
|
-
|
|
7
|
+
captchaTemplate;
|
|
8
|
+
constructor(options) {
|
|
8
9
|
super(ContentType.TEXT_HTML);
|
|
9
|
-
this.config = config;
|
|
10
|
-
this.base64Utils = base64Utils;
|
|
10
|
+
this.config = options.config;
|
|
11
|
+
this.base64Utils = options.base64Utils;
|
|
12
|
+
this.captchaTemplate = options.captchaTemplate || CAPTCHA_TEMPLATE;
|
|
11
13
|
}
|
|
12
14
|
createBlockBody(context) {
|
|
13
|
-
return renderHtml(
|
|
15
|
+
return renderHtml(this.captchaTemplate, createBlockData(this.config, context, this.base64Utils));
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -2,10 +2,10 @@ import { BlockAction, createBlockData, JsonBlockerBase } from '../../../../block
|
|
|
2
2
|
export class JsonCaptchaBlocker extends JsonBlockerBase {
|
|
3
3
|
config;
|
|
4
4
|
base64Utils;
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(options) {
|
|
6
6
|
super();
|
|
7
|
-
this.config = config;
|
|
8
|
-
this.base64Utils = base64Utils;
|
|
7
|
+
this.config = options.config;
|
|
8
|
+
this.base64Utils = options.base64Utils;
|
|
9
9
|
}
|
|
10
10
|
shouldBlock(context) {
|
|
11
11
|
if (!this.config.advancedBlockingResponseEnabled) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MobileBlocker } from '../../../../blocker';
|
|
2
2
|
import { CAPTCHA_TEMPLATE } from '../templates';
|
|
3
3
|
export class MobileCaptchaBlocker extends MobileBlocker {
|
|
4
|
-
constructor(
|
|
5
|
-
super(config, base64Utils, CAPTCHA_TEMPLATE);
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super(options.config, options.base64Utils, options.captchaTemplate || CAPTCHA_TEMPLATE);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -4,7 +4,6 @@ export class BodyLoginSuccessfulParser {
|
|
|
4
4
|
this.bodyRegex = new RegExp(regex);
|
|
5
5
|
}
|
|
6
6
|
async isLoginSuccessful(response) {
|
|
7
|
-
|
|
8
|
-
return !!response.body?.match?.(this.bodyRegex);
|
|
7
|
+
return !!(await response.text())?.match?.(this.bodyRegex);
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -11,4 +11,4 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
11
11
|
export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
12
12
|
export const URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
13
13
|
export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
14
|
-
export const CORE_MODULE_VERSION = 'JS Core 0.21.
|
|
14
|
+
export const CORE_MODULE_VERSION = 'JS Core 0.21.2';
|
package/lib/esm/utils/utils.js
CHANGED
|
@@ -158,7 +158,7 @@ const toHash = (string) => {
|
|
|
158
158
|
};
|
|
159
159
|
export const telemetryConfigReplacer = (key, value) => {
|
|
160
160
|
if (value instanceof RegExp) {
|
|
161
|
-
return '_REGEXP ' + value.toString();
|
|
161
|
+
return '_REGEXP ' + value.toString().replace(/\\\//g, '/');
|
|
162
162
|
}
|
|
163
163
|
if (value instanceof Function) {
|
|
164
164
|
return '_FUNCTION_HASH' + toHash(value.toString()); // NOTE: Do not log functions
|
|
@@ -285,6 +285,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
|
|
|
285
285
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
286
286
|
};
|
|
287
287
|
readonly body: any;
|
|
288
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
288
289
|
readonly getUnderlyingResponse: () => Res;
|
|
289
290
|
};
|
|
290
291
|
readonly shouldSendLogs: boolean;
|
|
@@ -512,6 +513,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
|
|
|
512
513
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
513
514
|
};
|
|
514
515
|
readonly body: any;
|
|
516
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
515
517
|
readonly getUnderlyingResponse: () => Res;
|
|
516
518
|
};
|
|
517
519
|
readonly shouldSendLogs: boolean;
|
|
@@ -670,6 +672,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
|
|
|
670
672
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
671
673
|
};
|
|
672
674
|
readonly body: any;
|
|
675
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
673
676
|
readonly getUnderlyingResponse: () => Res;
|
|
674
677
|
};
|
|
675
678
|
readonly shouldSendLogs: boolean;
|
|
@@ -954,6 +957,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
|
|
|
954
957
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
955
958
|
};
|
|
956
959
|
readonly body: any;
|
|
960
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
957
961
|
readonly getUnderlyingResponse: () => Res;
|
|
958
962
|
};
|
|
959
963
|
readonly shouldSendLogs: boolean;
|
|
@@ -1181,6 +1185,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
|
|
|
1181
1185
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1182
1186
|
};
|
|
1183
1187
|
readonly body: any;
|
|
1188
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1184
1189
|
readonly getUnderlyingResponse: () => Res;
|
|
1185
1190
|
};
|
|
1186
1191
|
readonly shouldSendLogs: boolean;
|
|
@@ -1339,6 +1344,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
|
|
|
1339
1344
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1340
1345
|
};
|
|
1341
1346
|
readonly body: any;
|
|
1347
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1342
1348
|
readonly getUnderlyingResponse: () => Res;
|
|
1343
1349
|
};
|
|
1344
1350
|
readonly shouldSendLogs: boolean;
|
|
@@ -1623,6 +1629,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
|
|
|
1623
1629
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1624
1630
|
};
|
|
1625
1631
|
readonly body: any;
|
|
1632
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1626
1633
|
readonly getUnderlyingResponse: () => Res;
|
|
1627
1634
|
};
|
|
1628
1635
|
readonly shouldSendLogs: boolean;
|
|
@@ -1850,6 +1857,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
|
|
|
1850
1857
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1851
1858
|
};
|
|
1852
1859
|
readonly body: any;
|
|
1860
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1853
1861
|
readonly getUnderlyingResponse: () => Res;
|
|
1854
1862
|
};
|
|
1855
1863
|
readonly shouldSendLogs: boolean;
|
|
@@ -2008,6 +2016,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
|
|
|
2008
2016
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
2009
2017
|
};
|
|
2010
2018
|
readonly body: any;
|
|
2019
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2011
2020
|
readonly getUnderlyingResponse: () => Res;
|
|
2012
2021
|
};
|
|
2013
2022
|
readonly shouldSendLogs: boolean;
|
|
@@ -2292,6 +2301,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
|
|
|
2292
2301
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
2293
2302
|
};
|
|
2294
2303
|
readonly body: any;
|
|
2304
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2295
2305
|
readonly getUnderlyingResponse: () => Res;
|
|
2296
2306
|
};
|
|
2297
2307
|
readonly shouldSendLogs: boolean;
|
|
@@ -2519,6 +2529,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
|
|
|
2519
2529
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
2520
2530
|
};
|
|
2521
2531
|
readonly body: any;
|
|
2532
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2522
2533
|
readonly getUnderlyingResponse: () => Res;
|
|
2523
2534
|
};
|
|
2524
2535
|
readonly shouldSendLogs: boolean;
|
|
@@ -2677,6 +2688,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
|
|
|
2677
2688
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
2678
2689
|
};
|
|
2679
2690
|
readonly body: any;
|
|
2691
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2680
2692
|
readonly getUnderlyingResponse: () => Res;
|
|
2681
2693
|
};
|
|
2682
2694
|
readonly shouldSendLogs: boolean;
|
|
@@ -2961,6 +2973,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
|
|
|
2961
2973
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
2962
2974
|
};
|
|
2963
2975
|
readonly body: any;
|
|
2976
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2964
2977
|
readonly getUnderlyingResponse: () => Res;
|
|
2965
2978
|
};
|
|
2966
2979
|
readonly shouldSendLogs: boolean;
|
|
@@ -3188,6 +3201,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
|
|
|
3188
3201
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
3189
3202
|
};
|
|
3190
3203
|
readonly body: any;
|
|
3204
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
3191
3205
|
readonly getUnderlyingResponse: () => Res;
|
|
3192
3206
|
};
|
|
3193
3207
|
readonly shouldSendLogs: boolean;
|
|
@@ -3346,6 +3360,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
|
|
|
3346
3360
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
3347
3361
|
};
|
|
3348
3362
|
readonly body: any;
|
|
3363
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
3349
3364
|
readonly getUnderlyingResponse: () => Res;
|
|
3350
3365
|
};
|
|
3351
3366
|
readonly shouldSendLogs: boolean;
|
|
@@ -3688,6 +3703,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
|
|
|
3688
3703
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
3689
3704
|
};
|
|
3690
3705
|
readonly body: any;
|
|
3706
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
3691
3707
|
readonly getUnderlyingResponse: () => Res;
|
|
3692
3708
|
};
|
|
3693
3709
|
readonly shouldSendLogs: boolean;
|
|
@@ -3915,6 +3931,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
|
|
|
3915
3931
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
3916
3932
|
};
|
|
3917
3933
|
readonly body: any;
|
|
3934
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
3918
3935
|
readonly getUnderlyingResponse: () => Res;
|
|
3919
3936
|
};
|
|
3920
3937
|
readonly shouldSendLogs: boolean;
|
|
@@ -4073,6 +4090,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
|
|
|
4073
4090
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
4074
4091
|
};
|
|
4075
4092
|
readonly body: any;
|
|
4093
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
4076
4094
|
readonly getUnderlyingResponse: () => Res;
|
|
4077
4095
|
};
|
|
4078
4096
|
readonly shouldSendLogs: boolean;
|
|
@@ -4357,6 +4375,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
|
|
|
4357
4375
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
4358
4376
|
};
|
|
4359
4377
|
readonly body: any;
|
|
4378
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
4360
4379
|
readonly getUnderlyingResponse: () => Res;
|
|
4361
4380
|
};
|
|
4362
4381
|
readonly shouldSendLogs: boolean;
|
|
@@ -4584,6 +4603,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
|
|
|
4584
4603
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
4585
4604
|
};
|
|
4586
4605
|
readonly body: any;
|
|
4606
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
4587
4607
|
readonly getUnderlyingResponse: () => Res;
|
|
4588
4608
|
};
|
|
4589
4609
|
readonly shouldSendLogs: boolean;
|
|
@@ -4742,6 +4762,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
|
|
|
4742
4762
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
4743
4763
|
};
|
|
4744
4764
|
readonly body: any;
|
|
4765
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
4745
4766
|
readonly getUnderlyingResponse: () => Res;
|
|
4746
4767
|
};
|
|
4747
4768
|
readonly shouldSendLogs: boolean;
|
|
@@ -5026,6 +5047,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
|
|
|
5026
5047
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
5027
5048
|
};
|
|
5028
5049
|
readonly body: any;
|
|
5050
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
5029
5051
|
readonly getUnderlyingResponse: () => Res;
|
|
5030
5052
|
};
|
|
5031
5053
|
readonly shouldSendLogs: boolean;
|
|
@@ -5253,6 +5275,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
|
|
|
5253
5275
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
5254
5276
|
};
|
|
5255
5277
|
readonly body: any;
|
|
5278
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
5256
5279
|
readonly getUnderlyingResponse: () => Res;
|
|
5257
5280
|
};
|
|
5258
5281
|
readonly shouldSendLogs: boolean;
|
|
@@ -5411,6 +5434,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
|
|
|
5411
5434
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
5412
5435
|
};
|
|
5413
5436
|
readonly body: any;
|
|
5437
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
5414
5438
|
readonly getUnderlyingResponse: () => Res;
|
|
5415
5439
|
};
|
|
5416
5440
|
readonly shouldSendLogs: boolean;
|
|
@@ -5695,6 +5719,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
|
|
|
5695
5719
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
5696
5720
|
};
|
|
5697
5721
|
readonly body: any;
|
|
5722
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
5698
5723
|
readonly getUnderlyingResponse: () => Res;
|
|
5699
5724
|
};
|
|
5700
5725
|
readonly shouldSendLogs: boolean;
|
|
@@ -5922,6 +5947,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
|
|
|
5922
5947
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
5923
5948
|
};
|
|
5924
5949
|
readonly body: any;
|
|
5950
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
5925
5951
|
readonly getUnderlyingResponse: () => Res;
|
|
5926
5952
|
};
|
|
5927
5953
|
readonly shouldSendLogs: boolean;
|
|
@@ -6080,6 +6106,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
|
|
|
6080
6106
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
6081
6107
|
};
|
|
6082
6108
|
readonly body: any;
|
|
6109
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
6083
6110
|
readonly getUnderlyingResponse: () => Res;
|
|
6084
6111
|
};
|
|
6085
6112
|
readonly shouldSendLogs: boolean;
|
|
@@ -6364,6 +6391,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
|
|
|
6364
6391
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
6365
6392
|
};
|
|
6366
6393
|
readonly body: any;
|
|
6394
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
6367
6395
|
readonly getUnderlyingResponse: () => Res;
|
|
6368
6396
|
};
|
|
6369
6397
|
readonly shouldSendLogs: boolean;
|
|
@@ -6591,6 +6619,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
|
|
|
6591
6619
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
6592
6620
|
};
|
|
6593
6621
|
readonly body: any;
|
|
6622
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
6594
6623
|
readonly getUnderlyingResponse: () => Res;
|
|
6595
6624
|
};
|
|
6596
6625
|
readonly shouldSendLogs: boolean;
|
|
@@ -6749,6 +6778,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
|
|
|
6749
6778
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
6750
6779
|
};
|
|
6751
6780
|
readonly body: any;
|
|
6781
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
6752
6782
|
readonly getUnderlyingResponse: () => Res;
|
|
6753
6783
|
};
|
|
6754
6784
|
readonly shouldSendLogs: boolean;
|
|
@@ -281,6 +281,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
281
281
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
282
282
|
};
|
|
283
283
|
readonly body: any;
|
|
284
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
284
285
|
readonly getUnderlyingResponse: () => Res;
|
|
285
286
|
};
|
|
286
287
|
readonly shouldSendLogs: boolean;
|
|
@@ -508,6 +509,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
508
509
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
509
510
|
};
|
|
510
511
|
readonly body: any;
|
|
512
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
511
513
|
readonly getUnderlyingResponse: () => Res;
|
|
512
514
|
};
|
|
513
515
|
readonly shouldSendLogs: boolean;
|
|
@@ -666,6 +668,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
666
668
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
667
669
|
};
|
|
668
670
|
readonly body: any;
|
|
671
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
669
672
|
readonly getUnderlyingResponse: () => Res;
|
|
670
673
|
};
|
|
671
674
|
readonly shouldSendLogs: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AsyncOrSync } from 'ts-essentials';
|
|
1
2
|
import { IHeaders } from './IHeaders';
|
|
2
3
|
/**
|
|
3
4
|
* Describes a response that is going to be returned to the end user.
|
|
@@ -8,13 +9,17 @@ export interface IOutgoingResponse<Res> {
|
|
|
8
9
|
*/
|
|
9
10
|
readonly status: number | null;
|
|
10
11
|
/**
|
|
11
|
-
* the response headers (for read
|
|
12
|
+
* the response headers (for read and write)
|
|
12
13
|
*/
|
|
13
14
|
readonly headers: IHeaders | null;
|
|
14
15
|
/**
|
|
15
|
-
* the response body
|
|
16
|
+
* the response body
|
|
16
17
|
*/
|
|
17
18
|
readonly body: any;
|
|
19
|
+
/**
|
|
20
|
+
* Converts the body to text (plain/text, text/html, etc.)
|
|
21
|
+
*/
|
|
22
|
+
text(): AsyncOrSync<string>;
|
|
18
23
|
/**
|
|
19
24
|
* Returns the platform-specific implementation of the response.
|
|
20
25
|
*/
|
|
@@ -281,6 +281,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
281
281
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
282
282
|
};
|
|
283
283
|
readonly body: any;
|
|
284
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
284
285
|
readonly getUnderlyingResponse: () => Res;
|
|
285
286
|
};
|
|
286
287
|
readonly shouldSendLogs: boolean;
|
|
@@ -508,6 +509,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
508
509
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
509
510
|
};
|
|
510
511
|
readonly body: any;
|
|
512
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
511
513
|
readonly getUnderlyingResponse: () => Res;
|
|
512
514
|
};
|
|
513
515
|
readonly shouldSendLogs: boolean;
|
|
@@ -666,6 +668,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
666
668
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
667
669
|
};
|
|
668
670
|
readonly body: any;
|
|
671
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
669
672
|
readonly getUnderlyingResponse: () => Res;
|
|
670
673
|
};
|
|
671
674
|
readonly shouldSendLogs: boolean;
|
|
@@ -952,6 +955,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
952
955
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
953
956
|
};
|
|
954
957
|
readonly body: any;
|
|
958
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
955
959
|
readonly getUnderlyingResponse: () => Res;
|
|
956
960
|
};
|
|
957
961
|
readonly shouldSendLogs: boolean;
|
|
@@ -1179,6 +1183,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
1179
1183
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1180
1184
|
};
|
|
1181
1185
|
readonly body: any;
|
|
1186
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1182
1187
|
readonly getUnderlyingResponse: () => Res;
|
|
1183
1188
|
};
|
|
1184
1189
|
readonly shouldSendLogs: boolean;
|
|
@@ -1337,6 +1342,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
1337
1342
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1338
1343
|
};
|
|
1339
1344
|
readonly body: any;
|
|
1345
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1340
1346
|
readonly getUnderlyingResponse: () => Res;
|
|
1341
1347
|
};
|
|
1342
1348
|
readonly shouldSendLogs: boolean;
|
|
@@ -1621,6 +1627,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
1621
1627
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1622
1628
|
};
|
|
1623
1629
|
readonly body: any;
|
|
1630
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1624
1631
|
readonly getUnderlyingResponse: () => Res;
|
|
1625
1632
|
};
|
|
1626
1633
|
readonly shouldSendLogs: boolean;
|
|
@@ -1848,6 +1855,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
1848
1855
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1849
1856
|
};
|
|
1850
1857
|
readonly body: any;
|
|
1858
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1851
1859
|
readonly getUnderlyingResponse: () => Res;
|
|
1852
1860
|
};
|
|
1853
1861
|
readonly shouldSendLogs: boolean;
|
|
@@ -2006,6 +2014,7 @@ export declare namespace MonitoredRequestUtils {
|
|
|
2006
2014
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
2007
2015
|
};
|
|
2008
2016
|
readonly body: any;
|
|
2017
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
2009
2018
|
readonly getUnderlyingResponse: () => Res;
|
|
2010
2019
|
};
|
|
2011
2020
|
readonly shouldSendLogs: boolean;
|
|
@@ -3,10 +3,15 @@ import { IConfiguration } from '../../../config';
|
|
|
3
3
|
import { IBase64Utils } from '../../../utils';
|
|
4
4
|
import { IBlocker, IConditionalBlocker } from '../../../blocker';
|
|
5
5
|
import { IMinimalResponse } from '../../../http';
|
|
6
|
+
export type DefaultBotDefenderBlockerConstructorOptions<Req, Res> = {
|
|
7
|
+
base64Utils: IBase64Utils;
|
|
8
|
+
} | {
|
|
9
|
+
captchaBlocker: IBlocker<Req, Res>;
|
|
10
|
+
};
|
|
6
11
|
export declare class DefaultBotDefenderBlocker<Req, Res> implements IConditionalBlocker<Req, Res> {
|
|
7
12
|
protected readonly config: IConfiguration<Req, Res>;
|
|
8
13
|
protected readonly captchaBlocker: IBlocker<Req, Res>;
|
|
9
|
-
constructor(config: IConfiguration<Req, Res>,
|
|
14
|
+
constructor(config: IConfiguration<Req, Res>, options: DefaultBotDefenderBlockerConstructorOptions<Req, Res>);
|
|
10
15
|
shouldBlock({ action, reasons, productData }: ReadonlyContext<Req, Res>): boolean;
|
|
11
16
|
createBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
12
17
|
protected createRateLimitResponse(): IMinimalResponse;
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { IConfiguration } from '../../../../config';
|
|
2
2
|
import { ReadonlyContext } from '../../../../context';
|
|
3
|
-
import {
|
|
4
|
-
import { IBlocker } from '../../../../blocker';
|
|
3
|
+
import { IBlocker, IConditionalBlocker } from '../../../../blocker';
|
|
5
4
|
import { IMinimalResponse } from '../../../../http';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { JsonCaptchaBlockerConstructorOptions } from './JsonCaptchaBlocker';
|
|
6
|
+
import { MobileCaptchaBlockerConstructorOptions } from './MobileCaptchaBlocker';
|
|
7
|
+
import { HtmlCaptchaBlockerConstructorOptions } from './HtmlCaptchaBlocker';
|
|
8
|
+
type JsonBlockerOptions<Req, Res> = {
|
|
9
|
+
jsonCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
10
|
+
} | JsonCaptchaBlockerConstructorOptions<Req, Res>;
|
|
11
|
+
type MobileCaptchaBlockerOptions<Req, Res> = {
|
|
12
|
+
mobileCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
13
|
+
} | MobileCaptchaBlockerConstructorOptions<Req, Res>;
|
|
14
|
+
type HtmlCaptchaBlockerOptions<Req, Res> = {
|
|
15
|
+
htmlCaptchaBlocker: IBlocker<Req, Res>;
|
|
16
|
+
} | HtmlCaptchaBlockerConstructorOptions<Req, Res>;
|
|
17
|
+
export type CaptchaBlockerConstructorOptions<Req, Res> = {
|
|
18
|
+
config: IConfiguration<Req, Res>;
|
|
19
|
+
} & JsonBlockerOptions<Req, Res> & MobileCaptchaBlockerOptions<Req, Res> & HtmlCaptchaBlockerOptions<Req, Res>;
|
|
9
20
|
export declare class CaptchaBlocker<Req, Res> implements IBlocker<Req, Res> {
|
|
10
21
|
protected readonly config: IConfiguration<Req, Res>;
|
|
11
|
-
protected readonly jsonCaptchaBlocker:
|
|
12
|
-
protected readonly mobileCaptchaBlocker:
|
|
13
|
-
protected readonly htmlCaptchaBlocker:
|
|
14
|
-
constructor(
|
|
22
|
+
protected readonly jsonCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
23
|
+
protected readonly mobileCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
24
|
+
protected readonly htmlCaptchaBlocker: IBlocker<Req, Res>;
|
|
25
|
+
constructor(options: CaptchaBlockerConstructorOptions<Req, Res>);
|
|
15
26
|
createBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
16
27
|
}
|
|
28
|
+
export {};
|
|
@@ -2,9 +2,15 @@ import { IConfiguration } from '../../../../config';
|
|
|
2
2
|
import { ReadonlyContext } from '../../../../context';
|
|
3
3
|
import { IBase64Utils } from '../../../../utils';
|
|
4
4
|
import { BlockerBase } from '../../../../blocker';
|
|
5
|
+
export type HtmlCaptchaBlockerConstructorOptions<Req, Res> = {
|
|
6
|
+
config: IConfiguration<Req, Res>;
|
|
7
|
+
base64Utils: IBase64Utils;
|
|
8
|
+
captchaTemplate?: string;
|
|
9
|
+
};
|
|
5
10
|
export declare class HtmlCaptchaBlocker<Req, Res> extends BlockerBase<Req, Res> {
|
|
6
11
|
protected readonly config: IConfiguration<Req, Res>;
|
|
7
12
|
protected readonly base64Utils: IBase64Utils;
|
|
8
|
-
|
|
13
|
+
protected readonly captchaTemplate: string;
|
|
14
|
+
constructor(options: HtmlCaptchaBlockerConstructorOptions<Req, Res>);
|
|
9
15
|
protected createBlockBody(context: ReadonlyContext<Req, Res>): string;
|
|
10
16
|
}
|
|
@@ -3,10 +3,14 @@ import { ReadonlyContext } from '../../../../context';
|
|
|
3
3
|
import { IConditionalBlocker, JsonBlockerBase } from '../../../../blocker';
|
|
4
4
|
import { JsonCaptchaBlockPayload } from '../model';
|
|
5
5
|
import { IBase64Utils } from '../../../../utils';
|
|
6
|
+
export type JsonCaptchaBlockerConstructorOptions<Req, Res> = {
|
|
7
|
+
config: IConfiguration<Req, Res>;
|
|
8
|
+
base64Utils: IBase64Utils;
|
|
9
|
+
};
|
|
6
10
|
export declare class JsonCaptchaBlocker<Req, Res> extends JsonBlockerBase<Req, Res, JsonCaptchaBlockPayload> implements IConditionalBlocker<Req, Res> {
|
|
7
11
|
protected readonly config: IConfiguration<Req, Res>;
|
|
8
12
|
protected readonly base64Utils: IBase64Utils;
|
|
9
|
-
constructor(
|
|
13
|
+
constructor(options: JsonCaptchaBlockerConstructorOptions<Req, Res>);
|
|
10
14
|
shouldBlock(context: ReadonlyContext<Req, Res>): boolean;
|
|
11
15
|
protected createJsonPayload(context: ReadonlyContext<Req, Res>): JsonCaptchaBlockPayload;
|
|
12
16
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { IConfiguration } from '../../../../config';
|
|
2
2
|
import { IBase64Utils } from '../../../../utils';
|
|
3
3
|
import { MobileBlocker } from '../../../../blocker';
|
|
4
|
+
export type MobileCaptchaBlockerConstructorOptions<Req, Res> = {
|
|
5
|
+
config: IConfiguration<Req, Res>;
|
|
6
|
+
base64Utils: IBase64Utils;
|
|
7
|
+
captchaTemplate?: string;
|
|
8
|
+
};
|
|
4
9
|
export declare class MobileCaptchaBlocker<Req, Res> extends MobileBlocker<Req, Res> {
|
|
5
|
-
constructor(
|
|
10
|
+
constructor(options: MobileCaptchaBlockerConstructorOptions<Req, Res>);
|
|
6
11
|
}
|
|
@@ -283,6 +283,7 @@ export declare namespace PXHDUtils {
|
|
|
283
283
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
284
284
|
};
|
|
285
285
|
readonly body: any;
|
|
286
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
286
287
|
readonly getUnderlyingResponse: () => Res;
|
|
287
288
|
};
|
|
288
289
|
readonly shouldSendLogs: boolean;
|
|
@@ -510,6 +511,7 @@ export declare namespace PXHDUtils {
|
|
|
510
511
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
511
512
|
};
|
|
512
513
|
readonly body: any;
|
|
514
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
513
515
|
readonly getUnderlyingResponse: () => Res;
|
|
514
516
|
};
|
|
515
517
|
readonly shouldSendLogs: boolean;
|
|
@@ -668,6 +670,7 @@ export declare namespace PXHDUtils {
|
|
|
668
670
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
669
671
|
};
|
|
670
672
|
readonly body: any;
|
|
673
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
671
674
|
readonly getUnderlyingResponse: () => Res;
|
|
672
675
|
};
|
|
673
676
|
readonly shouldSendLogs: boolean;
|
|
@@ -952,6 +955,7 @@ export declare namespace PXHDUtils {
|
|
|
952
955
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
953
956
|
};
|
|
954
957
|
readonly body: any;
|
|
958
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
955
959
|
readonly getUnderlyingResponse: () => Res;
|
|
956
960
|
};
|
|
957
961
|
readonly shouldSendLogs: boolean;
|
|
@@ -1179,6 +1183,7 @@ export declare namespace PXHDUtils {
|
|
|
1179
1183
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1180
1184
|
};
|
|
1181
1185
|
readonly body: any;
|
|
1186
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1182
1187
|
readonly getUnderlyingResponse: () => Res;
|
|
1183
1188
|
};
|
|
1184
1189
|
readonly shouldSendLogs: boolean;
|
|
@@ -1337,6 +1342,7 @@ export declare namespace PXHDUtils {
|
|
|
1337
1342
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("../http").IHeaders) => void, thisArg?: any) => void;
|
|
1338
1343
|
};
|
|
1339
1344
|
readonly body: any;
|
|
1345
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1340
1346
|
readonly getUnderlyingResponse: () => Res;
|
|
1341
1347
|
};
|
|
1342
1348
|
readonly shouldSendLogs: boolean;
|
|
@@ -282,6 +282,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
282
282
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
283
283
|
};
|
|
284
284
|
readonly body: any;
|
|
285
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
285
286
|
readonly getUnderlyingResponse: () => Res;
|
|
286
287
|
};
|
|
287
288
|
readonly shouldSendLogs: boolean;
|
|
@@ -509,6 +510,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
509
510
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
510
511
|
};
|
|
511
512
|
readonly body: any;
|
|
513
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
512
514
|
readonly getUnderlyingResponse: () => Res;
|
|
513
515
|
};
|
|
514
516
|
readonly shouldSendLogs: boolean;
|
|
@@ -667,6 +669,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
667
669
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
668
670
|
};
|
|
669
671
|
readonly body: any;
|
|
672
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
670
673
|
readonly getUnderlyingResponse: () => Res;
|
|
671
674
|
};
|
|
672
675
|
readonly shouldSendLogs: boolean;
|
|
@@ -953,6 +956,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
953
956
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
954
957
|
};
|
|
955
958
|
readonly body: any;
|
|
959
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
956
960
|
readonly getUnderlyingResponse: () => Res;
|
|
957
961
|
};
|
|
958
962
|
readonly shouldSendLogs: boolean;
|
|
@@ -1180,6 +1184,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
1180
1184
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1181
1185
|
};
|
|
1182
1186
|
readonly body: any;
|
|
1187
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1183
1188
|
readonly getUnderlyingResponse: () => Res;
|
|
1184
1189
|
};
|
|
1185
1190
|
readonly shouldSendLogs: boolean;
|
|
@@ -1338,6 +1343,7 @@ export declare namespace SensitiveRequestUtils {
|
|
|
1338
1343
|
readonly forEach: (callbackfn: (value: string, key: string, parent: import("..").IHeaders) => void, thisArg?: any) => void;
|
|
1339
1344
|
};
|
|
1340
1345
|
readonly body: any;
|
|
1346
|
+
readonly text: () => import("ts-essentials").AsyncOrSync<string>;
|
|
1341
1347
|
readonly getUnderlyingResponse: () => Res;
|
|
1342
1348
|
};
|
|
1343
1349
|
readonly shouldSendLogs: boolean;
|
|
@@ -11,4 +11,4 @@ export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
|
|
|
11
11
|
export declare const EMAIL_ADDRESS_REGEX: RegExp;
|
|
12
12
|
export declare const URL_REGEX: RegExp;
|
|
13
13
|
export declare const REGEX_STRUCTURE: RegExp;
|
|
14
|
-
export declare const CORE_MODULE_VERSION = "JS Core 0.21.
|
|
14
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.21.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "perimeterx-js-core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"typesVersions": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"js-base64": "^3.7.2",
|
|
49
49
|
"phin": "^3.7.0",
|
|
50
50
|
"ts-essentials": "^10.0.0",
|
|
51
|
-
"uuid": "^
|
|
51
|
+
"uuid": "^10.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/chai": "^4.3.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/crypto-js": "^4.1.1",
|
|
57
57
|
"@types/mocha": "^10.0.0",
|
|
58
58
|
"@types/sinon": "^17.0.1",
|
|
59
|
-
"@types/uuid": "^
|
|
59
|
+
"@types/uuid": "^10.0.0",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "^5.40.0",
|
|
61
61
|
"@typescript-eslint/parser": "^5.40.0",
|
|
62
62
|
"chai": "^4.3.6",
|