perimeterx-js-core 0.1.0
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/README.md +158 -0
- package/lib/activities/ActivityType.d.ts +6 -0
- package/lib/activities/ActivityType.js +10 -0
- package/lib/activities/HttpActivityClient.d.ts +12 -0
- package/lib/activities/HttpActivityClient.js +107 -0
- package/lib/activities/IActivityClient.d.ts +8 -0
- package/lib/activities/IActivityClient.js +2 -0
- package/lib/activities/constants.d.ts +1 -0
- package/lib/activities/constants.js +4 -0
- package/lib/activities/index.d.ts +5 -0
- package/lib/activities/index.js +7 -0
- package/lib/activities/model/Activity.d.ts +13 -0
- package/lib/activities/model/Activity.js +2 -0
- package/lib/activities/model/ActivityDetails.d.ts +41 -0
- package/lib/activities/model/ActivityDetails.js +2 -0
- package/lib/activities/utils.d.ts +10 -0
- package/lib/activities/utils.js +88 -0
- package/lib/additional_activity_handler/AdditionalActivityHandler.d.ts +3 -0
- package/lib/additional_activity_handler/AdditionalActivityHandler.js +2 -0
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +5 -0
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.js +64 -0
- package/lib/additional_activity_handler/index.d.ts +2 -0
- package/lib/additional_activity_handler/index.js +5 -0
- package/lib/block_handler/BlockAction.d.ts +6 -0
- package/lib/block_handler/BlockAction.js +21 -0
- package/lib/block_handler/BlockReason.d.ts +4 -0
- package/lib/block_handler/BlockReason.js +8 -0
- package/lib/block_handler/DefaultBlockResponseGenerator.d.ts +14 -0
- package/lib/block_handler/DefaultBlockResponseGenerator.js +44 -0
- package/lib/block_handler/IBlockResponseGenerator.d.ts +14 -0
- package/lib/block_handler/IBlockResponseGenerator.js +2 -0
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.d.ts +14 -0
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.js +30 -0
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.d.ts +10 -0
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.js +25 -0
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.d.ts +10 -0
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.js +44 -0
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.d.ts +12 -0
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.js +36 -0
- package/lib/block_handler/index.d.ts +13 -0
- package/lib/block_handler/index.js +21 -0
- package/lib/block_handler/model/BlockData.d.ts +16 -0
- package/lib/block_handler/model/BlockData.js +2 -0
- package/lib/block_handler/model/JsonBlockPayload.d.ts +11 -0
- package/lib/block_handler/model/JsonBlockPayload.js +2 -0
- package/lib/block_handler/model/MobileBlockPayload.d.ts +8 -0
- package/lib/block_handler/model/MobileBlockPayload.js +2 -0
- package/lib/block_handler/templates/captcha_template.d.ts +1 -0
- package/lib/block_handler/templates/captcha_template.js +4 -0
- package/lib/block_handler/templates/rate_limit_template.d.ts +1 -0
- package/lib/block_handler/templates/rate_limit_template.js +4 -0
- package/lib/block_handler/utils.d.ts +5 -0
- package/lib/block_handler/utils.js +48 -0
- package/lib/config/ConfigurationParams.d.ts +65 -0
- package/lib/config/ConfigurationParams.js +2 -0
- package/lib/config/DefaultConfigurations.d.ts +2 -0
- package/lib/config/DefaultConfigurations.js +107 -0
- package/lib/config/IConfiguration.d.ts +172 -0
- package/lib/config/IConfiguration.js +2 -0
- package/lib/config/StaticConfigurationBase.d.ts +57 -0
- package/lib/config/StaticConfigurationBase.js +355 -0
- package/lib/config/index.d.ts +4 -0
- package/lib/config/index.js +7 -0
- package/lib/context/ContextBase.d.ts +55 -0
- package/lib/context/ContextBase.js +206 -0
- package/lib/context/DefaultTokenV2Context.d.ts +13 -0
- package/lib/context/DefaultTokenV2Context.js +35 -0
- package/lib/context/DefaultTokenV3Context.d.ts +13 -0
- package/lib/context/DefaultTokenV3Context.js +35 -0
- package/lib/context/IContext.d.ts +256 -0
- package/lib/context/IContext.js +2 -0
- package/lib/context/index.d.ts +4 -0
- package/lib/context/index.js +9 -0
- package/lib/custom_parameters/CustomParameters.d.ts +12 -0
- package/lib/custom_parameters/CustomParameters.js +2 -0
- package/lib/custom_parameters/CustomParametersFunction.d.ts +4 -0
- package/lib/custom_parameters/CustomParametersFunction.js +2 -0
- package/lib/custom_parameters/CustomParametersUtils.d.ts +4 -0
- package/lib/custom_parameters/CustomParametersUtils.js +19 -0
- package/lib/custom_parameters/index.d.ts +3 -0
- package/lib/custom_parameters/index.js +5 -0
- package/lib/enforcer/EnforcerBase.d.ts +139 -0
- package/lib/enforcer/EnforcerBase.js +376 -0
- package/lib/enforcer/IEnforcer.d.ts +4 -0
- package/lib/enforcer/IEnforcer.js +2 -0
- package/lib/enforcer/index.d.ts +2 -0
- package/lib/enforcer/index.js +5 -0
- package/lib/filter/DefaultFilter.d.ts +16 -0
- package/lib/filter/DefaultFilter.js +59 -0
- package/lib/filter/FilterReason.d.ts +8 -0
- package/lib/filter/FilterReason.js +12 -0
- package/lib/filter/IFilter.d.ts +8 -0
- package/lib/filter/IFilter.js +2 -0
- package/lib/filter/index.d.ts +3 -0
- package/lib/filter/index.js +7 -0
- package/lib/first_party/DefaultFirstParty.d.ts +22 -0
- package/lib/first_party/DefaultFirstParty.js +215 -0
- package/lib/first_party/IFirstParty.d.ts +9 -0
- package/lib/first_party/IFirstParty.js +2 -0
- package/lib/first_party/constants.d.ts +32 -0
- package/lib/first_party/constants.js +39 -0
- package/lib/first_party/index.d.ts +4 -0
- package/lib/first_party/index.js +21 -0
- package/lib/first_party/utils.d.ts +8 -0
- package/lib/first_party/utils.js +27 -0
- package/lib/http/IHttpClient.d.ts +10 -0
- package/lib/http/IHttpClient.js +2 -0
- package/lib/http/body_reader/IBodyReader.d.ts +5 -0
- package/lib/http/body_reader/IBodyReader.js +2 -0
- package/lib/http/body_reader/StringBodyReader.d.ts +8 -0
- package/lib/http/body_reader/StringBodyReader.js +70 -0
- package/lib/http/index.d.ts +10 -0
- package/lib/http/index.js +28 -0
- package/lib/http/request/DefaultHttpRequest.d.ts +5 -0
- package/lib/http/request/DefaultHttpRequest.js +42 -0
- package/lib/http/request/HttpRequestBase.d.ts +24 -0
- package/lib/http/request/HttpRequestBase.js +77 -0
- package/lib/http/request/IHttpRequest.d.ts +31 -0
- package/lib/http/request/IHttpRequest.js +2 -0
- package/lib/http/response/DefaultHttpResponse.d.ts +5 -0
- package/lib/http/response/DefaultHttpResponse.js +32 -0
- package/lib/http/response/HttpResponseBase.d.ts +17 -0
- package/lib/http/response/HttpResponseBase.js +75 -0
- package/lib/http/response/IHttpResponse.d.ts +26 -0
- package/lib/http/response/IHttpResponse.js +2 -0
- package/lib/http/utils/ContentType.d.ts +9 -0
- package/lib/http/utils/ContentType.js +13 -0
- package/lib/http/utils/HttpBody.d.ts +4 -0
- package/lib/http/utils/HttpBody.js +2 -0
- package/lib/http/utils/HttpHeaders.d.ts +51 -0
- package/lib/http/utils/HttpHeaders.js +106 -0
- package/lib/http/utils/HttpMethod.d.ts +11 -0
- package/lib/http/utils/HttpMethod.js +15 -0
- package/lib/http/utils/constants.d.ts +9 -0
- package/lib/http/utils/constants.js +12 -0
- package/lib/http/utils/index.d.ts +5 -0
- package/lib/http/utils/index.js +24 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +33 -0
- package/lib/logger/DefaultLogger.d.ts +7 -0
- package/lib/logger/DefaultLogger.js +31 -0
- package/lib/logger/ILogger.d.ts +24 -0
- package/lib/logger/ILogger.js +2 -0
- package/lib/logger/LoggerBase.d.ts +11 -0
- package/lib/logger/LoggerBase.js +28 -0
- package/lib/logger/LoggerSeverity.d.ts +5 -0
- package/lib/logger/LoggerSeverity.js +9 -0
- package/lib/logger/index.d.ts +4 -0
- package/lib/logger/index.js +9 -0
- package/lib/pxde/DefaultDataEnrichment.d.ts +14 -0
- package/lib/pxde/DefaultDataEnrichment.js +133 -0
- package/lib/pxde/IDataEnrichment.d.ts +9 -0
- package/lib/pxde/IDataEnrichment.js +2 -0
- package/lib/pxde/constants.d.ts +4 -0
- package/lib/pxde/constants.js +7 -0
- package/lib/pxde/index.d.ts +4 -0
- package/lib/pxde/index.js +20 -0
- package/lib/pxde/model/PXDE.d.ts +9 -0
- package/lib/pxde/model/PXDE.js +2 -0
- package/lib/pxhd/PXHDUtils.d.ts +8 -0
- package/lib/pxhd/PXHDUtils.js +20 -0
- package/lib/pxhd/index.d.ts +1 -0
- package/lib/pxhd/index.js +5 -0
- package/lib/risk_api/PostRiskApiClient.d.ts +27 -0
- package/lib/risk_api/PostRiskApiClient.js +232 -0
- package/lib/risk_api/S2SCallReason.d.ts +12 -0
- package/lib/risk_api/S2SCallReason.js +16 -0
- package/lib/risk_api/S2SErrorHandler.d.ts +9 -0
- package/lib/risk_api/S2SErrorHandler.js +121 -0
- package/lib/risk_api/S2SErrorReason.d.ts +8 -0
- package/lib/risk_api/S2SErrorReason.js +12 -0
- package/lib/risk_api/constants.d.ts +1 -0
- package/lib/risk_api/constants.js +4 -0
- package/lib/risk_api/index.d.ts +13 -0
- package/lib/risk_api/index.js +34 -0
- package/lib/risk_api/model/RiskActivity.d.ts +50 -0
- package/lib/risk_api/model/RiskActivity.js +2 -0
- package/lib/risk_api/model/RiskResponseV2.d.ts +10 -0
- package/lib/risk_api/model/RiskResponseV2.js +2 -0
- package/lib/risk_api/model/RiskResponseV3.d.ts +12 -0
- package/lib/risk_api/model/RiskResponseV3.js +2 -0
- package/lib/risk_api/model/RiskStatus.d.ts +4 -0
- package/lib/risk_api/model/RiskStatus.js +8 -0
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.d.ts +5 -0
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.js +2 -0
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.d.ts +16 -0
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.js +73 -0
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.d.ts +10 -0
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.js +46 -0
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.d.ts +10 -0
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.js +47 -0
- package/lib/risk_token/MobileError.d.ts +6 -0
- package/lib/risk_token/MobileError.js +10 -0
- package/lib/risk_token/MobileErrorHandler.d.ts +9 -0
- package/lib/risk_token/MobileErrorHandler.js +100 -0
- package/lib/risk_token/RiskTokenScoreRetriever.d.ts +14 -0
- package/lib/risk_token/RiskTokenScoreRetriever.js +148 -0
- package/lib/risk_token/TokenOrigin.d.ts +4 -0
- package/lib/risk_token/TokenOrigin.js +8 -0
- package/lib/risk_token/TokenVerificationResult.d.ts +6 -0
- package/lib/risk_token/TokenVerificationResult.js +10 -0
- package/lib/risk_token/TokenVersion.d.ts +4 -0
- package/lib/risk_token/TokenVersion.js +8 -0
- package/lib/risk_token/constants.d.ts +9 -0
- package/lib/risk_token/constants.js +12 -0
- package/lib/risk_token/index.d.ts +9 -0
- package/lib/risk_token/index.js +32 -0
- package/lib/risk_token/token/BotDefenderTokenBase.d.ts +27 -0
- package/lib/risk_token/token/BotDefenderTokenBase.js +94 -0
- package/lib/risk_token/token/IBotDefenderToken.d.ts +54 -0
- package/lib/risk_token/token/IBotDefenderToken.js +2 -0
- package/lib/risk_token/token/index.d.ts +7 -0
- package/lib/risk_token/token/index.js +11 -0
- package/lib/risk_token/token/v2/BotDefenderTokenV2Payload.d.ts +6 -0
- package/lib/risk_token/token/v2/BotDefenderTokenV2Payload.js +2 -0
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.d.ts +28 -0
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.js +199 -0
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.d.ts +9 -0
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.js +2 -0
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.d.ts +31 -0
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.js +231 -0
- package/lib/risk_token/token/v3/TokenSignField.d.ts +4 -0
- package/lib/risk_token/token/v3/TokenSignField.js +8 -0
- package/lib/risk_token/utils.d.ts +2 -0
- package/lib/risk_token/utils.js +16 -0
- package/lib/telemetry/DefaultTelemetry.d.ts +19 -0
- package/lib/telemetry/DefaultTelemetry.js +176 -0
- package/lib/telemetry/ITelemetry.d.ts +13 -0
- package/lib/telemetry/ITelemetry.js +2 -0
- package/lib/telemetry/constants.d.ts +7 -0
- package/lib/telemetry/constants.js +10 -0
- package/lib/telemetry/index.d.ts +4 -0
- package/lib/telemetry/index.js +20 -0
- package/lib/telemetry/model/TelemetryActivity.d.ts +15 -0
- package/lib/telemetry/model/TelemetryActivity.js +2 -0
- package/lib/utils/Algorithm.d.ts +4 -0
- package/lib/utils/Algorithm.js +8 -0
- package/lib/utils/EnforcerException.d.ts +3 -0
- package/lib/utils/EnforcerException.js +26 -0
- package/lib/utils/IScoreRetriever.d.ts +14 -0
- package/lib/utils/IScoreRetriever.js +2 -0
- package/lib/utils/ModuleMode.d.ts +4 -0
- package/lib/utils/ModuleMode.js +8 -0
- package/lib/utils/PassReason.d.ts +6 -0
- package/lib/utils/PassReason.js +10 -0
- package/lib/utils/VidSource.d.ts +4 -0
- package/lib/utils/VidSource.js +8 -0
- package/lib/utils/base64/DefaultBase64Utils.d.ts +5 -0
- package/lib/utils/base64/DefaultBase64Utils.js +16 -0
- package/lib/utils/base64/IBase64Utils.d.ts +4 -0
- package/lib/utils/base64/IBase64Utils.js +2 -0
- package/lib/utils/base64/index.d.ts +2 -0
- package/lib/utils/base64/index.js +5 -0
- package/lib/utils/cipher/ICipherUtils.d.ts +7 -0
- package/lib/utils/cipher/ICipherUtils.js +2 -0
- package/lib/utils/cipher/index.d.ts +1 -0
- package/lib/utils/cipher/index.js +2 -0
- package/lib/utils/constants.d.ts +10 -0
- package/lib/utils/constants.js +13 -0
- package/lib/utils/cookie_parser/DefaultCookieParser.d.ts +4 -0
- package/lib/utils/cookie_parser/DefaultCookieParser.js +13 -0
- package/lib/utils/cookie_parser/ICookieParser.d.ts +3 -0
- package/lib/utils/cookie_parser/ICookieParser.js +2 -0
- package/lib/utils/cookie_parser/index.d.ts +2 -0
- package/lib/utils/cookie_parser/index.js +5 -0
- package/lib/utils/hash/DefaultHashUtils.d.ts +5 -0
- package/lib/utils/hash/DefaultHashUtils.js +19 -0
- package/lib/utils/hash/IHashUtils.d.ts +4 -0
- package/lib/utils/hash/IHashUtils.js +2 -0
- package/lib/utils/hash/index.d.ts +2 -0
- package/lib/utils/hash/index.js +5 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/index.js +35 -0
- package/lib/utils/ip_range_checker/DefaultIpRangeChecker.d.ts +4 -0
- package/lib/utils/ip_range_checker/DefaultIpRangeChecker.js +13 -0
- package/lib/utils/ip_range_checker/IIpRangeChecker.d.ts +3 -0
- package/lib/utils/ip_range_checker/IIpRangeChecker.js +2 -0
- package/lib/utils/ip_range_checker/index.d.ts +2 -0
- package/lib/utils/ip_range_checker/index.js +5 -0
- package/lib/utils/utils.d.ts +13 -0
- package/lib/utils/utils.js +91 -0
- package/lib/utils/uuid_generator/DefaultUuidGenerator.d.ts +4 -0
- package/lib/utils/uuid_generator/DefaultUuidGenerator.js +13 -0
- package/lib/utils/uuid_generator/IUuidGenerator.d.ts +3 -0
- package/lib/utils/uuid_generator/IUuidGenerator.js +2 -0
- package/lib/utils/uuid_generator/index.d.ts +2 -0
- package/lib/utils/uuid_generator/index.js +5 -0
- package/package.json +52 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.HttpRequestBase = void 0;
|
|
40
|
+
var utils_1 = require("../utils");
|
|
41
|
+
var HttpRequestBase = /** @class */ (function () {
|
|
42
|
+
function HttpRequestBase(url, options) {
|
|
43
|
+
this.url = url;
|
|
44
|
+
this.method = (options === null || options === void 0 ? void 0 : options.method) || utils_1.HttpMethod.GET;
|
|
45
|
+
this.headers = (options === null || options === void 0 ? void 0 : options.headers) instanceof utils_1.HttpHeaders ? options === null || options === void 0 ? void 0 : options.headers : new utils_1.HttpHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
|
46
|
+
this.bodyReader = options === null || options === void 0 ? void 0 : options.bodyReader;
|
|
47
|
+
}
|
|
48
|
+
Object.defineProperty(HttpRequestBase.prototype, "body", {
|
|
49
|
+
get: function () {
|
|
50
|
+
var _a;
|
|
51
|
+
return (_a = this.bodyReader) === null || _a === void 0 ? void 0 : _a.body;
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
HttpRequestBase.prototype.readBody = function () {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
+
var _c;
|
|
60
|
+
return __generator(this, function (_d) {
|
|
61
|
+
switch (_d.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
if (typeof this.httpBody !== 'undefined') {
|
|
64
|
+
return [2 /*return*/, this.httpBody];
|
|
65
|
+
}
|
|
66
|
+
_c = this;
|
|
67
|
+
return [4 /*yield*/, ((_a = this.bodyReader) === null || _a === void 0 ? void 0 : _a.readBody((_b = this.headers.get(utils_1.CONTENT_TYPE_HEADER_NAME)) === null || _b === void 0 ? void 0 : _b[0]))];
|
|
68
|
+
case 1:
|
|
69
|
+
_c.httpBody = _d.sent();
|
|
70
|
+
return [2 /*return*/, this.httpBody];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return HttpRequestBase;
|
|
76
|
+
}());
|
|
77
|
+
exports.HttpRequestBase = HttpRequestBase;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HttpMethod, HttpHeaders, HttpBody } from '../utils';
|
|
2
|
+
export interface IHttpRequest<UnreadBodyType = unknown, Req = unknown> {
|
|
3
|
+
/**
|
|
4
|
+
* The full URL of the request, including scheme, path, and query parameters
|
|
5
|
+
* e.g., https://www.example.com/some/path?param1=value1¶m2=value2
|
|
6
|
+
*/
|
|
7
|
+
url: string;
|
|
8
|
+
/**
|
|
9
|
+
* The request method in all caps
|
|
10
|
+
* e.g., GET, POST
|
|
11
|
+
*/
|
|
12
|
+
method: HttpMethod;
|
|
13
|
+
/**
|
|
14
|
+
* An object representing the HTTP headers. For more information, see the documentation for the HttpHeaders class.
|
|
15
|
+
*/
|
|
16
|
+
headers: HttpHeaders;
|
|
17
|
+
/**
|
|
18
|
+
* A representation of the request body. If the request does not have a body, it should be undefined.
|
|
19
|
+
* This is called when the request body needs to be accessed or used to reconstruct a new request, but not read.
|
|
20
|
+
*/
|
|
21
|
+
readonly body: UnreadBodyType | string;
|
|
22
|
+
/**
|
|
23
|
+
* The request body if it needs to be used in the enforcer. If read, the call to HttpRequest.body
|
|
24
|
+
* should return the saved value so as not to consume streams twice.
|
|
25
|
+
*/
|
|
26
|
+
readBody(): Promise<HttpBody>;
|
|
27
|
+
/**
|
|
28
|
+
* The underlying, platform-specific implementation of the request object.
|
|
29
|
+
*/
|
|
30
|
+
getUnderlyingRequest(): Req;
|
|
31
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpResponseBase, HttpResponseOptions } from './HttpResponseBase';
|
|
2
|
+
export declare class DefaultHttpResponse extends HttpResponseBase<string, DefaultHttpResponse> {
|
|
3
|
+
constructor(body?: string, options?: HttpResponseOptions);
|
|
4
|
+
getUnderlyingResponse(): DefaultHttpResponse;
|
|
5
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DefaultHttpResponse = void 0;
|
|
19
|
+
var HttpResponseBase_1 = require("./HttpResponseBase");
|
|
20
|
+
var StringBodyReader_1 = require("../body_reader/StringBodyReader");
|
|
21
|
+
var DefaultHttpResponse = /** @class */ (function (_super) {
|
|
22
|
+
__extends(DefaultHttpResponse, _super);
|
|
23
|
+
function DefaultHttpResponse(body, options) {
|
|
24
|
+
if (body === void 0) { body = ''; }
|
|
25
|
+
return _super.call(this, new StringBodyReader_1.StringBodyReader(body), options) || this;
|
|
26
|
+
}
|
|
27
|
+
DefaultHttpResponse.prototype.getUnderlyingResponse = function () {
|
|
28
|
+
return this;
|
|
29
|
+
};
|
|
30
|
+
return DefaultHttpResponse;
|
|
31
|
+
}(HttpResponseBase_1.HttpResponseBase));
|
|
32
|
+
exports.DefaultHttpResponse = DefaultHttpResponse;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HttpHeaders, HttpHeadersInit, HttpBody } from '../utils';
|
|
2
|
+
import { IBodyReader } from '../body_reader/IBodyReader';
|
|
3
|
+
import { IHttpResponse } from './IHttpResponse';
|
|
4
|
+
export declare type HttpResponseOptions = {
|
|
5
|
+
status?: number;
|
|
6
|
+
headers?: HttpHeaders | HttpHeadersInit;
|
|
7
|
+
};
|
|
8
|
+
export declare abstract class HttpResponseBase<UnreadBodyType, Res> implements IHttpResponse<UnreadBodyType, Res> {
|
|
9
|
+
headers: HttpHeaders;
|
|
10
|
+
status: number;
|
|
11
|
+
protected httpBody: HttpBody;
|
|
12
|
+
protected readonly bodyReader: IBodyReader<UnreadBodyType>;
|
|
13
|
+
abstract getUnderlyingResponse(): Res;
|
|
14
|
+
protected constructor(bodyReader: IBodyReader<UnreadBodyType>, options?: HttpResponseOptions);
|
|
15
|
+
get body(): UnreadBodyType | string;
|
|
16
|
+
readBody(): Promise<HttpBody>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.HttpResponseBase = void 0;
|
|
40
|
+
var utils_1 = require("../utils");
|
|
41
|
+
var HttpResponseBase = /** @class */ (function () {
|
|
42
|
+
function HttpResponseBase(bodyReader, options) {
|
|
43
|
+
this.bodyReader = bodyReader;
|
|
44
|
+
this.status = (options === null || options === void 0 ? void 0 : options.status) || 200;
|
|
45
|
+
this.headers = (options === null || options === void 0 ? void 0 : options.headers) instanceof utils_1.HttpHeaders ? options === null || options === void 0 ? void 0 : options.headers : new utils_1.HttpHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(HttpResponseBase.prototype, "body", {
|
|
48
|
+
get: function () {
|
|
49
|
+
return this.bodyReader.body;
|
|
50
|
+
},
|
|
51
|
+
enumerable: false,
|
|
52
|
+
configurable: true
|
|
53
|
+
});
|
|
54
|
+
HttpResponseBase.prototype.readBody = function () {
|
|
55
|
+
var _a;
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var _b;
|
|
58
|
+
return __generator(this, function (_c) {
|
|
59
|
+
switch (_c.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
if (typeof this.httpBody !== 'undefined') {
|
|
62
|
+
return [2 /*return*/, this.httpBody];
|
|
63
|
+
}
|
|
64
|
+
_b = this;
|
|
65
|
+
return [4 /*yield*/, this.bodyReader.readBody((_a = this.headers.get(utils_1.CONTENT_TYPE_HEADER_NAME)) === null || _a === void 0 ? void 0 : _a[0])];
|
|
66
|
+
case 1:
|
|
67
|
+
_b.httpBody = _c.sent();
|
|
68
|
+
return [2 /*return*/, this.httpBody];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
return HttpResponseBase;
|
|
74
|
+
}());
|
|
75
|
+
exports.HttpResponseBase = HttpResponseBase;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HttpHeaders, HttpBody } from '../utils';
|
|
2
|
+
export interface IHttpResponse<UnreadBodyType = unknown, Res = unknown> {
|
|
3
|
+
/**
|
|
4
|
+
* The numerical status code of the response
|
|
5
|
+
* e.g., 200, 404, etc.
|
|
6
|
+
*/
|
|
7
|
+
status: number;
|
|
8
|
+
/**
|
|
9
|
+
* An object representing the HTTP headers. For more information, see the documentation for the HttpHeaders class.
|
|
10
|
+
*/
|
|
11
|
+
headers: HttpHeaders;
|
|
12
|
+
/**
|
|
13
|
+
* A representation of the response body. If the response does not have a body, it should be undefined.
|
|
14
|
+
* This is called when the response body needs to be accessed or used to reconstruct a new response, but not read.
|
|
15
|
+
*/
|
|
16
|
+
readonly body: UnreadBodyType | string;
|
|
17
|
+
/**
|
|
18
|
+
* A string or object representation of the response body if it needs to be used in the enforcer. If read, the call to
|
|
19
|
+
* HttpResponse.body should return the saved string value so as not to consume the same ReadableStream twice.
|
|
20
|
+
*/
|
|
21
|
+
readBody(): Promise<HttpBody>;
|
|
22
|
+
/**
|
|
23
|
+
* The underlying, platform-specific implementation of the response object.
|
|
24
|
+
*/
|
|
25
|
+
getUnderlyingResponse(): Res;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum ContentType {
|
|
2
|
+
APPLICATION_X_WWW_FORM_URL_ENCODED = "application/x-www-form-urlencoded",
|
|
3
|
+
APPLICATION_JSON = "application/json",
|
|
4
|
+
APPLICATION_JAVASCRIPT = "application/javascript",
|
|
5
|
+
TEXT_PLAIN = "text/plain",
|
|
6
|
+
TEXT_HTML = "text/html",
|
|
7
|
+
MULTIPART_FORM_DATA = "multipart/form-data",
|
|
8
|
+
IMAGE_GIF = "image/gif"
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentType = void 0;
|
|
4
|
+
var ContentType;
|
|
5
|
+
(function (ContentType) {
|
|
6
|
+
ContentType["APPLICATION_X_WWW_FORM_URL_ENCODED"] = "application/x-www-form-urlencoded";
|
|
7
|
+
ContentType["APPLICATION_JSON"] = "application/json";
|
|
8
|
+
ContentType["APPLICATION_JAVASCRIPT"] = "application/javascript";
|
|
9
|
+
ContentType["TEXT_PLAIN"] = "text/plain";
|
|
10
|
+
ContentType["TEXT_HTML"] = "text/html";
|
|
11
|
+
ContentType["MULTIPART_FORM_DATA"] = "multipart/form-data";
|
|
12
|
+
ContentType["IMAGE_GIF"] = "image/gif";
|
|
13
|
+
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare type HttpHeadersInit = Record<string, string[]>;
|
|
2
|
+
export declare class HttpHeaders {
|
|
3
|
+
private readonly headers;
|
|
4
|
+
/**
|
|
5
|
+
* Constructs a new instance of the HttpHeaders class.
|
|
6
|
+
* @param init - Optional header names and values with which to initialize the HttpHeaders instance.
|
|
7
|
+
*/
|
|
8
|
+
constructor(init?: HttpHeadersInit);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the values associated with the provided header name. If no header exists, it returns undefined.
|
|
11
|
+
* @param name - The case-insensitive header name.
|
|
12
|
+
* @returns values - An array of strings representing the header values associated with the provided header name.
|
|
13
|
+
*/
|
|
14
|
+
get(name: string): readonly string[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Sets a header with the provided name and value(s). If no header by that name exists, one will be added.
|
|
17
|
+
* If the header name already exists, the provided values will override all pre-existing values.
|
|
18
|
+
* @param name - The case-insensitive header name.
|
|
19
|
+
* @param values - The header values to be associated with the provided header name.
|
|
20
|
+
*/
|
|
21
|
+
set(name: string, ...values: readonly string[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Adds the value(s) to the header with the given name. If no header by that name exists, one will be added.
|
|
24
|
+
* If the header name already exists, the provided values will be added to the end of the list of existing values.
|
|
25
|
+
* @param name - The case-insensitive header name.
|
|
26
|
+
* @param values - The header values to be associated with the provided header name.
|
|
27
|
+
*/
|
|
28
|
+
append(name: string, ...values: readonly string[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Deletes a header and all its associated values. If no header by that name exists, no action is taken.
|
|
31
|
+
* @param name - The case-insensitive header name.
|
|
32
|
+
*/
|
|
33
|
+
delete(name: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a deep copy of the current HttpHeaders instance.
|
|
36
|
+
* @returns HttpHeaders - A new instance of the HttpHeaders class with the same header names and values as the original.
|
|
37
|
+
*/
|
|
38
|
+
copy(): HttpHeaders;
|
|
39
|
+
/**
|
|
40
|
+
* Returns an object representation of the HttpHeaders instance.
|
|
41
|
+
* @returns object - An object representing the current state of the HttpHeaders instance. The keys are the header
|
|
42
|
+
* names (all lowercase), and the values are arrays of all the associated header values.
|
|
43
|
+
*/
|
|
44
|
+
toObject(): Record<string, string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Iterates through all headers and applies a callback function to each one.
|
|
47
|
+
* @param callbackFn - The callback function to be applied on every header.
|
|
48
|
+
*/
|
|
49
|
+
forEach(callbackFn: (values: readonly string[], name: string) => void): void;
|
|
50
|
+
private toKey;
|
|
51
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HttpHeaders = void 0;
|
|
13
|
+
var HttpHeaders = /** @class */ (function () {
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new instance of the HttpHeaders class.
|
|
16
|
+
* @param init - Optional header names and values with which to initialize the HttpHeaders instance.
|
|
17
|
+
*/
|
|
18
|
+
function HttpHeaders(init) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
this.headers = init ? new Map(Object.keys(init).map(function (name) { return [_this.toKey(name), init[name]]; })) : new Map();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the values associated with the provided header name. If no header exists, it returns undefined.
|
|
24
|
+
* @param name - The case-insensitive header name.
|
|
25
|
+
* @returns values - An array of strings representing the header values associated with the provided header name.
|
|
26
|
+
*/
|
|
27
|
+
HttpHeaders.prototype.get = function (name) {
|
|
28
|
+
return this.headers.get(this.toKey(name));
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Sets a header with the provided name and value(s). If no header by that name exists, one will be added.
|
|
32
|
+
* If the header name already exists, the provided values will override all pre-existing values.
|
|
33
|
+
* @param name - The case-insensitive header name.
|
|
34
|
+
* @param values - The header values to be associated with the provided header name.
|
|
35
|
+
*/
|
|
36
|
+
HttpHeaders.prototype.set = function (name) {
|
|
37
|
+
var values = [];
|
|
38
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
39
|
+
values[_i - 1] = arguments[_i];
|
|
40
|
+
}
|
|
41
|
+
if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
|
|
42
|
+
this.headers.set(this.toKey(name), values);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Adds the value(s) to the header with the given name. If no header by that name exists, one will be added.
|
|
47
|
+
* If the header name already exists, the provided values will be added to the end of the list of existing values.
|
|
48
|
+
* @param name - The case-insensitive header name.
|
|
49
|
+
* @param values - The header values to be associated with the provided header name.
|
|
50
|
+
*/
|
|
51
|
+
HttpHeaders.prototype.append = function (name) {
|
|
52
|
+
var values = [];
|
|
53
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
54
|
+
values[_i - 1] = arguments[_i];
|
|
55
|
+
}
|
|
56
|
+
var existingValues = this.get(name);
|
|
57
|
+
if (existingValues) {
|
|
58
|
+
this.set.apply(this, __spreadArray([name], existingValues.concat(values), false));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.set.apply(this, __spreadArray([name], values, false));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Deletes a header and all its associated values. If no header by that name exists, no action is taken.
|
|
66
|
+
* @param name - The case-insensitive header name.
|
|
67
|
+
*/
|
|
68
|
+
HttpHeaders.prototype.delete = function (name) {
|
|
69
|
+
this.headers.delete(this.toKey(name));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Returns a deep copy of the current HttpHeaders instance.
|
|
73
|
+
* @returns HttpHeaders - A new instance of the HttpHeaders class with the same header names and values as the original.
|
|
74
|
+
*/
|
|
75
|
+
HttpHeaders.prototype.copy = function () {
|
|
76
|
+
var copy = new HttpHeaders();
|
|
77
|
+
this.forEach(function (values, name) {
|
|
78
|
+
copy.set.apply(copy, __spreadArray([name], values, false));
|
|
79
|
+
});
|
|
80
|
+
return copy;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Returns an object representation of the HttpHeaders instance.
|
|
84
|
+
* @returns object - An object representing the current state of the HttpHeaders instance. The keys are the header
|
|
85
|
+
* names (all lowercase), and the values are arrays of all the associated header values.
|
|
86
|
+
*/
|
|
87
|
+
HttpHeaders.prototype.toObject = function () {
|
|
88
|
+
var obj = {};
|
|
89
|
+
this.forEach(function (values, name) {
|
|
90
|
+
obj[name] = __spreadArray([], values, true);
|
|
91
|
+
});
|
|
92
|
+
return obj;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Iterates through all headers and applies a callback function to each one.
|
|
96
|
+
* @param callbackFn - The callback function to be applied on every header.
|
|
97
|
+
*/
|
|
98
|
+
HttpHeaders.prototype.forEach = function (callbackFn) {
|
|
99
|
+
this.headers.forEach(function (values, name) { return callbackFn(values, name); });
|
|
100
|
+
};
|
|
101
|
+
HttpHeaders.prototype.toKey = function (name) {
|
|
102
|
+
return name.toLowerCase();
|
|
103
|
+
};
|
|
104
|
+
return HttpHeaders;
|
|
105
|
+
}());
|
|
106
|
+
exports.HttpHeaders = HttpHeaders;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpMethod = void 0;
|
|
4
|
+
var HttpMethod;
|
|
5
|
+
(function (HttpMethod) {
|
|
6
|
+
HttpMethod["GET"] = "GET";
|
|
7
|
+
HttpMethod["POST"] = "POST";
|
|
8
|
+
HttpMethod["PUT"] = "PUT";
|
|
9
|
+
HttpMethod["HEAD"] = "HEAD";
|
|
10
|
+
HttpMethod["DELETE"] = "DELETE";
|
|
11
|
+
HttpMethod["OPTIONS"] = "OPTIONS";
|
|
12
|
+
HttpMethod["CONNECT"] = "CONNECT";
|
|
13
|
+
HttpMethod["TRACE"] = "TRACE";
|
|
14
|
+
HttpMethod["PATCH"] = "PATCH";
|
|
15
|
+
})(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const X_FORWARDED_FOR_HEADER_NAME = "x-forwarded-for";
|
|
2
|
+
export declare const USER_AGENT_HEADER_NAME = "user-agent";
|
|
3
|
+
export declare const CONTENT_TYPE_HEADER_NAME = "content-type";
|
|
4
|
+
export declare const CONTENT_LENGTH_HEADER_NAME = "content-length";
|
|
5
|
+
export declare const COOKIE_HEADER_NAME = "cookie";
|
|
6
|
+
export declare const AUTHORIZATION_HEADER_NAME = "authorization";
|
|
7
|
+
export declare const ACCEPT_HEADER_NAME = "accept";
|
|
8
|
+
export declare const SET_COOKIE_HEADER_NAME = "set-cookie";
|
|
9
|
+
export declare const HOST_HEADER_NAME = "host";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HOST_HEADER_NAME = exports.SET_COOKIE_HEADER_NAME = exports.ACCEPT_HEADER_NAME = exports.AUTHORIZATION_HEADER_NAME = exports.COOKIE_HEADER_NAME = exports.CONTENT_LENGTH_HEADER_NAME = exports.CONTENT_TYPE_HEADER_NAME = exports.USER_AGENT_HEADER_NAME = exports.X_FORWARDED_FOR_HEADER_NAME = void 0;
|
|
4
|
+
exports.X_FORWARDED_FOR_HEADER_NAME = 'x-forwarded-for';
|
|
5
|
+
exports.USER_AGENT_HEADER_NAME = 'user-agent';
|
|
6
|
+
exports.CONTENT_TYPE_HEADER_NAME = 'content-type';
|
|
7
|
+
exports.CONTENT_LENGTH_HEADER_NAME = 'content-length';
|
|
8
|
+
exports.COOKIE_HEADER_NAME = 'cookie';
|
|
9
|
+
exports.AUTHORIZATION_HEADER_NAME = 'authorization';
|
|
10
|
+
exports.ACCEPT_HEADER_NAME = 'accept';
|
|
11
|
+
exports.SET_COOKIE_HEADER_NAME = 'set-cookie';
|
|
12
|
+
exports.HOST_HEADER_NAME = 'host';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HttpHeaders = exports.ContentType = exports.HttpMethod = void 0;
|
|
18
|
+
var HttpMethod_1 = require("./HttpMethod");
|
|
19
|
+
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return HttpMethod_1.HttpMethod; } });
|
|
20
|
+
var ContentType_1 = require("./ContentType");
|
|
21
|
+
Object.defineProperty(exports, "ContentType", { enumerable: true, get: function () { return ContentType_1.ContentType; } });
|
|
22
|
+
var HttpHeaders_1 = require("./HttpHeaders");
|
|
23
|
+
Object.defineProperty(exports, "HttpHeaders", { enumerable: true, get: function () { return HttpHeaders_1.HttpHeaders; } });
|
|
24
|
+
__exportStar(require("./constants"), exports);
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './additional_activity_handler';
|
|
2
|
+
export * from './activities';
|
|
3
|
+
export * from './block_handler';
|
|
4
|
+
export * from './config';
|
|
5
|
+
export * from './context';
|
|
6
|
+
export * from './custom_parameters';
|
|
7
|
+
export * from './enforcer';
|
|
8
|
+
export * from './filter';
|
|
9
|
+
export * from './first_party';
|
|
10
|
+
export * from './http';
|
|
11
|
+
export * from './logger';
|
|
12
|
+
export * from './pxde';
|
|
13
|
+
export * from './pxhd';
|
|
14
|
+
export * from './risk_api';
|
|
15
|
+
export * from './risk_token';
|
|
16
|
+
export * from './telemetry';
|
|
17
|
+
export * from './utils';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./additional_activity_handler"), exports);
|
|
18
|
+
__exportStar(require("./activities"), exports);
|
|
19
|
+
__exportStar(require("./block_handler"), exports);
|
|
20
|
+
__exportStar(require("./config"), exports);
|
|
21
|
+
__exportStar(require("./context"), exports);
|
|
22
|
+
__exportStar(require("./custom_parameters"), exports);
|
|
23
|
+
__exportStar(require("./enforcer"), exports);
|
|
24
|
+
__exportStar(require("./filter"), exports);
|
|
25
|
+
__exportStar(require("./first_party"), exports);
|
|
26
|
+
__exportStar(require("./http"), exports);
|
|
27
|
+
__exportStar(require("./logger"), exports);
|
|
28
|
+
__exportStar(require("./pxde"), exports);
|
|
29
|
+
__exportStar(require("./pxhd"), exports);
|
|
30
|
+
__exportStar(require("./risk_api"), exports);
|
|
31
|
+
__exportStar(require("./risk_token"), exports);
|
|
32
|
+
__exportStar(require("./telemetry"), exports);
|
|
33
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LoggerSeverity } from './LoggerSeverity';
|
|
2
|
+
import { LoggerBase } from './LoggerBase';
|
|
3
|
+
import { ILogger } from './ILogger';
|
|
4
|
+
export declare class DefaultLogger extends LoggerBase implements ILogger {
|
|
5
|
+
constructor(loggerSeverity: LoggerSeverity);
|
|
6
|
+
protected log(message: string): void;
|
|
7
|
+
}
|