perimeterx-js-core 0.25.0 → 0.26.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/lib/cjs/action/Action.js +15 -0
- package/lib/cjs/action/ActionPriorityOrder.js +4 -0
- package/lib/cjs/action/utils.js +20 -0
- package/lib/cjs/activities/HttpActivityClient.js +61 -1
- package/lib/cjs/activities/HttpBatchedActivityClient.js +7 -0
- package/lib/cjs/activities/utils.js +128 -62
- package/lib/cjs/additional_activity_handler/AdditionalActivityHandlerUtils.js +6 -0
- package/lib/cjs/blocker/BlockerBase.js +14 -0
- package/lib/cjs/blocker/JsonBlockerBase.js +5 -0
- package/lib/cjs/blocker/utils.js +13 -0
- package/lib/cjs/config/ConfigurationBase.js +17 -0
- package/lib/cjs/context/DefaultContext.js +4 -0
- package/lib/cjs/context/SerializedContext.js +5 -0
- package/lib/cjs/enforcer/EnforcerBase.js +61 -22
- package/lib/cjs/enforcer/index.js +1 -0
- package/lib/cjs/{phase/flow → flow}/EndEnforcerFlow.js +11 -7
- package/lib/cjs/{phase/flow → flow}/EnforceFlow.js +10 -15
- package/lib/cjs/{phase/flow → flow}/FilterFlow.js +10 -9
- package/lib/cjs/flow/Flow.js +60 -0
- package/lib/cjs/flow/IFlow.js +2 -0
- package/lib/cjs/{phase/flow → flow}/PostEnforceFlow.js +6 -6
- package/lib/cjs/{phase/flow → flow}/index.js +2 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
- package/lib/cjs/phase/impl/ClearLogsPhase.js +3 -0
- package/lib/cjs/phase/impl/CompositePhase.js +9 -0
- package/lib/cjs/phase/impl/CreateBlockResponsePhase.js +16 -0
- package/lib/cjs/phase/impl/DecideActionPhase.js +11 -0
- package/lib/cjs/phase/impl/EnrichContextFromRequestPhase.js +13 -9
- package/lib/cjs/phase/impl/EnrichContextFromResponsePhase.js +4 -0
- package/lib/cjs/phase/impl/FilterPhase.js +4 -0
- package/lib/cjs/phase/impl/FirstPartyPhase.js +5 -0
- package/lib/cjs/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +5 -0
- package/lib/cjs/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
- package/lib/cjs/phase/impl/ModifyIncomingRequestPhase.js +5 -0
- package/lib/cjs/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
- package/lib/cjs/phase/impl/ParseTokenPhase.js +14 -7
- package/lib/cjs/phase/impl/PreflightPhase.js +4 -0
- package/lib/cjs/phase/impl/RiskApiPhase.js +18 -7
- package/lib/cjs/phase/impl/{SendAsyncActivitiesOnResponsePhase.js → SendAsyncActivitiesPhase.js} +15 -8
- package/lib/cjs/phase/impl/SendLogsPhase.js +3 -0
- package/lib/cjs/phase/impl/SendTelemetryActivityPhase.js +3 -0
- package/lib/cjs/phase/impl/UpdateRemoteConfigPhase.js +3 -0
- package/lib/cjs/phase/impl/index.js +1 -2
- package/lib/cjs/phase/index.js +0 -1
- package/lib/cjs/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
- package/lib/cjs/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
- package/lib/cjs/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +3 -1
- package/lib/cjs/risk_api/client/GetRiskApiClientV2.js +80 -0
- package/lib/cjs/risk_api/client/PostRiskApiClientV2.js +3 -3
- package/lib/cjs/risk_api/client/PostRiskApiClientV3.js +3 -3
- package/lib/cjs/risk_api/client/abstract/IRiskApiClient.js +2 -0
- package/lib/cjs/risk_api/client/abstract/PostRiskApiClientBase.js +43 -0
- package/lib/cjs/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +22 -69
- package/lib/cjs/risk_api/client/abstract/index.js +19 -0
- package/lib/cjs/risk_api/client/index.js +2 -2
- package/lib/cjs/risk_api/index.js +1 -0
- package/lib/cjs/risk_api/model/GetRiskRequestHeaders.js +185 -0
- package/lib/cjs/risk_api/model/GetRiskResponseHeaders.js +16 -0
- package/lib/cjs/risk_api/model/index.js +2 -0
- package/lib/cjs/{phase/impl/SendAsyncActivitiesOnRequestPhase.js → risk_api/risk_response/PostRiskResponseBase.js} +26 -30
- package/lib/cjs/risk_api/risk_response/RiskResponseBase.js +11 -8
- package/lib/cjs/risk_api/risk_response/index.js +1 -0
- package/lib/cjs/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
- package/lib/cjs/risk_api/risk_response/v2/GetRiskResponseV2.js +80 -0
- package/lib/cjs/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +10 -10
- package/lib/cjs/risk_api/risk_response/v2/index.js +2 -1
- package/lib/cjs/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +10 -10
- package/lib/cjs/risk_api/risk_response/v3/index.js +1 -1
- package/lib/cjs/risk_api/utils.js +36 -0
- package/lib/cjs/telemetry/DefaultTelemetry.js +12 -9
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/cjs/utils/utils.js +1 -19
- package/lib/esm/action/Action.js +15 -0
- package/lib/esm/action/ActionPriorityOrder.js +4 -0
- package/lib/esm/action/utils.js +20 -0
- package/lib/esm/activities/HttpActivityClient.js +61 -1
- package/lib/esm/activities/HttpBatchedActivityClient.js +7 -0
- package/lib/esm/activities/utils.js +128 -63
- package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +6 -0
- package/lib/esm/blocker/BlockerBase.js +14 -0
- package/lib/esm/blocker/JsonBlockerBase.js +5 -0
- package/lib/esm/blocker/utils.js +13 -0
- package/lib/esm/config/ConfigurationBase.js +13 -0
- package/lib/esm/context/DefaultContext.js +4 -0
- package/lib/esm/context/SerializedContext.js +5 -0
- package/lib/esm/enforcer/EnforcerBase.js +43 -6
- package/lib/esm/enforcer/index.js +1 -0
- package/lib/esm/flow/EndEnforcerFlow.js +18 -0
- package/lib/esm/flow/EnforceFlow.js +14 -0
- package/lib/esm/{phase/flow → flow}/FilterFlow.js +5 -4
- package/lib/esm/flow/Flow.js +56 -0
- package/lib/esm/flow/IFlow.js +1 -0
- package/lib/esm/flow/PostEnforceFlow.js +10 -0
- package/lib/esm/{phase/flow → flow}/index.js +2 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
- package/lib/esm/phase/impl/ClearLogsPhase.js +3 -0
- package/lib/esm/phase/impl/CompositePhase.js +9 -0
- package/lib/esm/phase/impl/CreateBlockResponsePhase.js +16 -1
- package/lib/esm/phase/impl/DecideActionPhase.js +11 -0
- package/lib/esm/phase/impl/EnrichContextFromRequestPhase.js +9 -0
- package/lib/esm/phase/impl/EnrichContextFromResponsePhase.js +4 -0
- package/lib/esm/phase/impl/FilterPhase.js +4 -0
- package/lib/esm/phase/impl/FirstPartyPhase.js +5 -0
- package/lib/esm/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +5 -0
- package/lib/esm/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
- package/lib/esm/phase/impl/ModifyIncomingRequestPhase.js +5 -0
- package/lib/esm/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
- package/lib/esm/phase/impl/ParseTokenPhase.js +15 -8
- package/lib/esm/phase/impl/PreflightPhase.js +4 -0
- package/lib/esm/phase/impl/RiskApiPhase.js +19 -8
- package/lib/esm/phase/impl/SendAsyncActivitiesPhase.js +16 -0
- package/lib/esm/phase/impl/SendLogsPhase.js +3 -0
- package/lib/esm/phase/impl/SendTelemetryActivityPhase.js +3 -0
- package/lib/esm/phase/impl/UpdateRemoteConfigPhase.js +3 -0
- package/lib/esm/phase/impl/index.js +1 -2
- package/lib/esm/phase/index.js +0 -1
- package/lib/esm/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
- package/lib/esm/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
- package/lib/esm/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +2 -1
- package/lib/esm/risk_api/client/GetRiskApiClientV2.js +57 -0
- package/lib/esm/risk_api/client/PostRiskApiClientV2.js +3 -3
- package/lib/esm/risk_api/client/PostRiskApiClientV3.js +3 -3
- package/lib/esm/risk_api/client/abstract/IRiskApiClient.js +1 -0
- package/lib/esm/risk_api/client/abstract/PostRiskApiClientBase.js +18 -0
- package/lib/esm/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +10 -49
- package/lib/esm/risk_api/client/abstract/index.js +3 -0
- package/lib/esm/risk_api/client/index.js +2 -2
- package/lib/esm/risk_api/index.js +1 -0
- package/lib/esm/risk_api/model/GetRiskRequestHeaders.js +182 -0
- package/lib/esm/risk_api/model/GetRiskResponseHeaders.js +13 -0
- package/lib/esm/risk_api/model/index.js +2 -0
- package/lib/esm/risk_api/risk_response/PostRiskResponseBase.js +6 -0
- package/lib/esm/risk_api/risk_response/RiskResponseBase.js +5 -1
- package/lib/esm/risk_api/risk_response/index.js +1 -0
- package/lib/esm/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
- package/lib/esm/risk_api/risk_response/v2/GetRiskResponseV2.js +52 -0
- package/lib/esm/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +2 -2
- package/lib/esm/risk_api/risk_response/v2/index.js +2 -1
- package/lib/esm/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +2 -2
- package/lib/esm/risk_api/risk_response/v3/index.js +1 -1
- package/lib/esm/risk_api/utils.js +23 -0
- package/lib/esm/telemetry/DefaultTelemetry.js +13 -10
- package/lib/esm/utils/constants.js +1 -1
- package/lib/esm/utils/utils.js +0 -16
- package/lib/types/action/Action.d.ts +15 -0
- package/lib/types/action/ActionData.d.ts +3 -0
- package/lib/types/action/ActionPriorityOrder.d.ts +4 -0
- package/lib/types/action/Decision.d.ts +9 -0
- package/lib/types/action/ProductAction.d.ts +3 -0
- package/lib/types/action/utils.d.ts +20 -0
- package/lib/types/activities/HttpActivityClient.d.ts +57 -1
- package/lib/types/activities/HttpBatchedActivityClient.d.ts +7 -0
- package/lib/types/activities/IActivityClient.d.ts +4 -1
- package/lib/types/activities/model/AsyncActivity.d.ts +3 -0
- package/lib/types/activities/model/AsyncActivityDetails.d.ts +12 -0
- package/lib/types/activities/model/CommonActivityDetails.d.ts +3 -0
- package/lib/types/activities/utils.d.ts +14 -0
- package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +6 -0
- package/lib/types/blocker/BlockerBase.d.ts +21 -0
- package/lib/types/blocker/IBlocker.d.ts +8 -0
- package/lib/types/blocker/IConditionalBlocker.d.ts +4 -0
- package/lib/types/blocker/JsonBlockerBase.d.ts +12 -0
- package/lib/types/blocker/model/BlockData.d.ts +3 -0
- package/lib/types/blocker/utils.d.ts +13 -0
- package/lib/types/config/ConfigurationBase.d.ts +22 -0
- package/lib/types/config/IConfiguration.d.ts +4 -0
- package/lib/types/config/params/CoreConfigurationParams.d.ts +21 -0
- package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -0
- package/lib/types/config/params/StaticConfigurationParams.d.ts +3 -0
- package/lib/types/context/ContextJson.d.ts +4 -0
- package/lib/types/context/DefaultContext.d.ts +4 -0
- package/lib/types/context/SerializedContext.d.ts +5 -0
- package/lib/types/custom_parameters/CustomParameters.d.ts +3 -0
- package/lib/types/enforcer/EnforcerBase.d.ts +48 -12
- package/lib/types/enforcer/IEnforcer.d.ts +1 -2
- package/lib/types/enforcer/IPostEnforcer.d.ts +3 -0
- package/lib/types/enforcer/index.d.ts +1 -0
- package/lib/types/first_party/IFirstParty.d.ts +1 -1
- package/lib/types/flow/EndEnforcerFlow.d.ts +8 -0
- package/lib/types/flow/EnforceFlow.d.ts +8 -0
- package/lib/types/{phase/flow → flow}/FilterFlow.d.ts +7 -7
- package/lib/types/flow/Flow.d.ts +13 -0
- package/lib/types/flow/IFlow.d.ts +57 -0
- package/lib/types/flow/PostEnforceFlow.d.ts +6 -0
- package/lib/types/{phase/flow → flow}/index.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/phase/IPhase.d.ts +9 -0
- package/lib/types/phase/PhaseResult.d.ts +11 -0
- package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -0
- package/lib/types/phase/impl/ClearLogsPhase.d.ts +3 -0
- package/lib/types/phase/impl/CompositePhase.d.ts +9 -0
- package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +11 -1
- package/lib/types/phase/impl/DecideActionPhase.d.ts +11 -0
- package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +9 -0
- package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +4 -0
- package/lib/types/phase/impl/FilterPhase.d.ts +4 -0
- package/lib/types/phase/impl/FirstPartyPhase.d.ts +5 -0
- package/lib/types/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.d.ts +5 -0
- package/lib/types/phase/impl/IdentifyTelemetryRequestPhase.d.ts +5 -0
- package/lib/types/phase/impl/ModifyIncomingRequestPhase.d.ts +5 -0
- package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +5 -0
- package/lib/types/phase/impl/ParseTokenPhase.d.ts +3 -0
- package/lib/types/phase/impl/PreflightPhase.d.ts +4 -0
- package/lib/types/phase/impl/RiskApiPhase.d.ts +5 -0
- package/lib/types/phase/impl/{SendAsyncActivitiesOnResponsePhase.d.ts → SendAsyncActivitiesPhase.d.ts} +5 -2
- package/lib/types/phase/impl/SendLogsPhase.d.ts +3 -0
- package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -0
- package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -0
- package/lib/types/phase/impl/index.d.ts +1 -2
- package/lib/types/phase/index.d.ts +0 -1
- package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +1 -1
- package/lib/types/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +1 -1
- package/lib/types/products/interfaces/IProduct.d.ts +28 -0
- package/lib/types/products/interfaces/ProductDataType.d.ts +1 -1
- package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +15 -0
- package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +1 -1
- package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +2 -2
- package/lib/types/risk_api/client/{IRiskApiClient.d.ts → abstract/IRiskApiClient.d.ts} +1 -1
- package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +8 -0
- package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +26 -0
- package/lib/types/risk_api/client/abstract/index.d.ts +3 -0
- package/lib/types/risk_api/client/index.d.ts +2 -2
- package/lib/types/risk_api/index.d.ts +1 -0
- package/lib/types/risk_api/model/GetRiskRequestHeaders.d.ts +17 -0
- package/lib/types/risk_api/model/GetRiskResponseHeaders.d.ts +3 -0
- package/lib/types/risk_api/model/index.d.ts +2 -0
- package/lib/types/risk_api/risk_response/IRiskResponse.d.ts +2 -0
- package/lib/types/risk_api/risk_response/PostRiskResponseBase.d.ts +7 -0
- package/lib/types/risk_api/risk_response/RiskResponseBase.d.ts +3 -1
- package/lib/types/risk_api/risk_response/index.d.ts +1 -0
- package/lib/types/risk_api/risk_response/serialize/SerializedRiskResponse.d.ts +1 -0
- package/lib/types/risk_api/risk_response/v2/GetRiskResponseV2.d.ts +11 -0
- package/lib/types/risk_api/risk_response/{v3/DefaultRiskResponseV3.d.ts → v2/PostRiskResponseV2.d.ts} +2 -2
- package/lib/types/risk_api/risk_response/v2/index.d.ts +2 -1
- package/lib/types/risk_api/risk_response/{v2/DefaultRiskResponseV2.d.ts → v3/PostRiskResponseV3.d.ts} +2 -2
- package/lib/types/risk_api/risk_response/v3/index.d.ts +1 -1
- package/lib/types/risk_api/utils.d.ts +69 -0
- package/lib/types/telemetry/model/TelemetryActivity.d.ts +1 -1
- package/lib/types/utils/constants.d.ts +1 -1
- package/lib/types/utils/utils.d.ts +0 -5
- package/package.json +1 -1
- package/lib/esm/phase/flow/EndEnforcerFlow.js +0 -14
- package/lib/esm/phase/flow/EnforceFlow.js +0 -18
- package/lib/esm/phase/flow/PostEnforceFlow.js +0 -10
- package/lib/esm/phase/impl/SendAsyncActivitiesOnRequestPhase.js +0 -16
- package/lib/esm/phase/impl/SendAsyncActivitiesOnResponsePhase.js +0 -10
- package/lib/types/phase/flow/EndEnforcerFlow.d.ts +0 -8
- package/lib/types/phase/flow/EnforceFlow.d.ts +0 -8
- package/lib/types/phase/flow/PostEnforceFlow.d.ts +0 -6
- package/lib/types/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +0 -10
- package/lib/types/risk_api/client/PostRiskApiClientBase.d.ts +0 -40
- /package/lib/cjs/{risk_api/client/IRiskApiClient.js → enforcer/IPostEnforcer.js} +0 -0
- /package/lib/esm/{risk_api/client/IRiskApiClient.js → enforcer/IPostEnforcer.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RiskActivity } from './RiskActivity';
|
|
2
|
+
export type RiskRequestHeaderConversionObject<T> = T extends string ? {
|
|
3
|
+
header: string;
|
|
4
|
+
convertToString?: (value: T) => string;
|
|
5
|
+
} : {
|
|
6
|
+
header: string;
|
|
7
|
+
convertToString: (value: T) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare const RISK_ACTIVITY_FIELDS_TO_HEADER_NAMES: {
|
|
10
|
+
[K in keyof Omit<RiskActivity, 'additional' | 'request'>]: RiskRequestHeaderConversionObject<Omit<RiskActivity, 'additional' | 'request'>[K]>;
|
|
11
|
+
};
|
|
12
|
+
export declare const RISK_ACTIVITY_REQUEST_FIELDS_TO_HEADER_NAMES: {
|
|
13
|
+
[K in keyof Omit<RiskActivity['request'], 'headers'>]: RiskRequestHeaderConversionObject<Omit<RiskActivity['request'], 'headers'>[K]>;
|
|
14
|
+
};
|
|
15
|
+
export declare const RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES: {
|
|
16
|
+
[K in keyof Required<RiskActivity['additional']>]: RiskRequestHeaderConversionObject<Required<RiskActivity['additional']>[K]>;
|
|
17
|
+
};
|
|
@@ -2,6 +2,7 @@ import { AsyncOrSync } from 'ts-essentials';
|
|
|
2
2
|
import { BlockAction } from '../../blocker';
|
|
3
3
|
import { PXDE } from '../../pxde';
|
|
4
4
|
import { RiskStatus } from '../model';
|
|
5
|
+
import { RiskResponseJson } from './serialize';
|
|
5
6
|
export interface IRiskResponse {
|
|
6
7
|
readonly status?: RiskStatus;
|
|
7
8
|
readonly score?: number;
|
|
@@ -15,4 +16,5 @@ export interface IRiskResponse {
|
|
|
15
16
|
readonly additionalRiskInfo?: string;
|
|
16
17
|
readonly telemetryRequested?: boolean;
|
|
17
18
|
validate(): AsyncOrSync<boolean>;
|
|
19
|
+
toJSON(): RiskResponseJson;
|
|
18
20
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RiskResponseBase } from './RiskResponseBase';
|
|
2
|
+
import { TokenVersion } from '../../risk_token';
|
|
3
|
+
import { IIncomingResponse } from '../../http';
|
|
4
|
+
import { RiskResponsePayloadType } from './RiskResponsePayloadType';
|
|
5
|
+
export declare abstract class PostRiskResponseBase<TokenV extends TokenVersion> extends RiskResponseBase<TokenV> {
|
|
6
|
+
protected parseRiskResponse(response: IIncomingResponse): Promise<RiskResponsePayloadType<TokenV>>;
|
|
7
|
+
}
|
|
@@ -6,10 +6,12 @@ import { RiskStatus } from '../model';
|
|
|
6
6
|
import { IRiskResponse } from './IRiskResponse';
|
|
7
7
|
import { RiskResponsePayloadType } from './RiskResponsePayloadType';
|
|
8
8
|
import { RiskResponseJson } from './serialize';
|
|
9
|
+
import { AsyncOrSync } from 'ts-essentials';
|
|
9
10
|
export declare abstract class RiskResponseBase<TokenV extends TokenVersion> implements IRiskResponse {
|
|
10
|
-
|
|
11
|
+
protected readonly response: IIncomingResponse;
|
|
11
12
|
protected riskResponse?: RiskResponsePayloadType<TokenV>;
|
|
12
13
|
abstract score: number | undefined;
|
|
14
|
+
protected abstract parseRiskResponse(response: IIncomingResponse): AsyncOrSync<RiskResponsePayloadType<TokenV> | null>;
|
|
13
15
|
protected abstract validateRiskResponseScore(): boolean;
|
|
14
16
|
protected constructor(response: IIncomingResponse);
|
|
15
17
|
validate(): Promise<boolean>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IIncomingResponse } from '../../../http';
|
|
2
|
+
import { RiskResponseBase } from '../RiskResponseBase';
|
|
3
|
+
import { TokenVersion } from '../../../risk_token';
|
|
4
|
+
import { RiskResponseV2Payload } from './RiskResponseV2Payload';
|
|
5
|
+
export declare class GetRiskResponseV2 extends RiskResponseBase<TokenVersion.V2> {
|
|
6
|
+
constructor(response: IIncomingResponse);
|
|
7
|
+
protected parseRiskResponse(response: IIncomingResponse): RiskResponseV2Payload | null;
|
|
8
|
+
protected getHeader(response: IIncomingResponse, header: string): string | undefined;
|
|
9
|
+
get score(): number | undefined;
|
|
10
|
+
protected validateRiskResponseScore(): boolean;
|
|
11
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IIncomingResponse } from '../../../http';
|
|
2
2
|
import { TokenVersion } from '../../../risk_token';
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
3
|
+
import { PostRiskResponseBase } from '../PostRiskResponseBase';
|
|
4
|
+
export declare class PostRiskResponseV2 extends PostRiskResponseBase<TokenVersion.V2> {
|
|
5
5
|
constructor(response: IIncomingResponse);
|
|
6
6
|
get score(): number | undefined;
|
|
7
7
|
protected validateRiskResponseScore(): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IIncomingResponse } from '../../../http';
|
|
2
2
|
import { TokenVersion } from '../../../risk_token';
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
3
|
+
import { PostRiskResponseBase } from '../PostRiskResponseBase';
|
|
4
|
+
export declare class PostRiskResponseV3 extends PostRiskResponseBase<TokenVersion.V3> {
|
|
5
5
|
constructor(response: IIncomingResponse);
|
|
6
6
|
get score(): number | undefined;
|
|
7
7
|
protected validateRiskResponseScore(): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './PostRiskResponseV3';
|
|
2
2
|
export * from './RiskResponseV3Payload';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { HeaderEntry } from '../activities';
|
|
2
|
+
import { ReadonlyContext } from '../context';
|
|
3
|
+
import { IConfiguration } from '../config';
|
|
4
|
+
import { ReadonlyHeaders } from '../http';
|
|
5
|
+
export type SnakeToPascalCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Capitalize<T>}${SnakeToPascalCase<U>}` : Capitalize<S>;
|
|
6
|
+
export declare const createRiskApiActivity: <Req, Res, Added, Removed>(config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>) => {
|
|
7
|
+
vid: string | undefined;
|
|
8
|
+
client_uuid: string | undefined;
|
|
9
|
+
pxhd: string | undefined;
|
|
10
|
+
request: {
|
|
11
|
+
socket_ip: string;
|
|
12
|
+
headers: HeaderEntry[];
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
additional: {
|
|
16
|
+
s2s_call_reason: string;
|
|
17
|
+
risk_start_time: number;
|
|
18
|
+
request_id: string;
|
|
19
|
+
module_version: string;
|
|
20
|
+
risk_mode: import("../utils").ModuleMode;
|
|
21
|
+
http_method: import("../http").HttpMethod;
|
|
22
|
+
http_version?: string;
|
|
23
|
+
px_orig_cookie?: string;
|
|
24
|
+
px_cookie?: string;
|
|
25
|
+
px_cookie_hmac?: string;
|
|
26
|
+
tls_protocol?: string;
|
|
27
|
+
tls_server?: string;
|
|
28
|
+
tls_cipher?: string;
|
|
29
|
+
tls_ciphers_sha?: string;
|
|
30
|
+
tls_extension_sha?: string;
|
|
31
|
+
tls_preferred_ciphers?: string;
|
|
32
|
+
tls_ja3_fingerprint?: string;
|
|
33
|
+
enforcer_vid_source?: import("../utils").VidSource;
|
|
34
|
+
original_uuid?: string;
|
|
35
|
+
original_token_error?: string;
|
|
36
|
+
original_token?: string;
|
|
37
|
+
px_decoded_original_token?: string;
|
|
38
|
+
cookie_origin?: import("..").TokenOrigin;
|
|
39
|
+
request_cookie_names?: string[];
|
|
40
|
+
server_info_region?: string;
|
|
41
|
+
server_info_datacenter?: string;
|
|
42
|
+
cpa?: boolean;
|
|
43
|
+
cross_tab_session?: string;
|
|
44
|
+
app_user_id?: string;
|
|
45
|
+
jwt_additional_fields?: Record<string, any>;
|
|
46
|
+
graphql_operations?: import("..").GraphQLData[];
|
|
47
|
+
user?: string;
|
|
48
|
+
pass?: string;
|
|
49
|
+
ci_version?: import("..").CredentialIntelligenceVersion;
|
|
50
|
+
sso_step?: import("..").SsoStep;
|
|
51
|
+
remote_config_version?: number;
|
|
52
|
+
remote_config_id?: string;
|
|
53
|
+
enforcer_start_time: number;
|
|
54
|
+
raw_url?: string;
|
|
55
|
+
used_cookie_secret?: string;
|
|
56
|
+
custom_param1?: any;
|
|
57
|
+
custom_param2?: any;
|
|
58
|
+
custom_param3?: any;
|
|
59
|
+
custom_param4?: any;
|
|
60
|
+
custom_param5?: any;
|
|
61
|
+
custom_param6?: any;
|
|
62
|
+
custom_param7?: any;
|
|
63
|
+
custom_param8?: any;
|
|
64
|
+
custom_param9?: any;
|
|
65
|
+
custom_param10?: any;
|
|
66
|
+
is_hype_sale?: boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const formatRiskHeadersField: <Req, Res, Added, Removed>(headers: ReadonlyHeaders, config: IConfiguration<Req, Res, Added, Removed>) => HeaderEntry[];
|
|
@@ -7,7 +7,7 @@ export type TelemetryActivityDetails<Req, Res, Added, Removed> = {
|
|
|
7
7
|
node_name?: string;
|
|
8
8
|
os_name?: string;
|
|
9
9
|
remote_config_id?: string;
|
|
10
|
-
remote_config_version?:
|
|
10
|
+
remote_config_version?: number;
|
|
11
11
|
};
|
|
12
12
|
export type TelemetryActivity<Req, Res, Added, Removed> = {
|
|
13
13
|
type: ActivityType.ENFORCER_TELEMETRY;
|
|
@@ -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.
|
|
14
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.26.0";
|
|
@@ -13,11 +13,6 @@ export declare const redactSensitiveFields: <T extends Record<string, any>>(obje
|
|
|
13
13
|
export declare const removeSensitiveHeaders: (headers: ReadonlyHeaders, sensitiveHeaderNames: string[]) => Record<string, string[]>;
|
|
14
14
|
export declare const isStringInPatterns: (str: string, patterns: Array<string | RegExp>) => boolean;
|
|
15
15
|
export declare const isStringMatch: (str: string, pattern: string | RegExp) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated this method is not typesafe. Copy the fields manually instead,
|
|
18
|
-
* unsafe - ignores compilerOptions.strictNullChecks
|
|
19
|
-
*/
|
|
20
|
-
export declare const transferExistingProperties: <FromObj extends Record<string, any>, ToObj extends Record<string, any>>(fromObj: FromObj | undefined, toObj: ToObj | undefined, propertyMappings: Partial<Record<keyof FromObj, keyof ToObj>>) => void;
|
|
21
16
|
export declare const rejectOnTimeout: <T>(promise: Promise<T>, ms: number) => Promise<T>;
|
|
22
17
|
export declare const getPropertyFromObject: <T>(object: any, ...keys: Array<string | number>) => T;
|
|
23
18
|
export declare const sleep: (ms: number) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ClearLogsPhase, CompositePhase, SendLogsPhase, SendTelemetryActivityPhase, UpdateRemoteConfigPhase, } from '../impl/index.js';
|
|
2
|
-
export class EndEnforcerFlow extends CompositePhase {
|
|
3
|
-
constructor(config, { logServiceClient, telemetry, remoteConfigManager, }) {
|
|
4
|
-
const phases = [new SendTelemetryActivityPhase(telemetry)];
|
|
5
|
-
if (remoteConfigManager) {
|
|
6
|
-
phases.push(new UpdateRemoteConfigPhase(config, remoteConfigManager));
|
|
7
|
-
}
|
|
8
|
-
if (logServiceClient) {
|
|
9
|
-
phases.push(new SendLogsPhase(config, logServiceClient));
|
|
10
|
-
}
|
|
11
|
-
phases.push(new ClearLogsPhase());
|
|
12
|
-
super(phases);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ProductName } from '../../products/index.js';
|
|
2
|
-
import { CompositePhase, AdditionalActivityHandlerPhase, CreateBlockResponsePhase, EnrichContextFromRequestPhase, ModifyIncomingRequestPhase, ParseTokenPhase, RiskApiPhase, SendAsyncActivitiesOnRequestPhase, } from '../impl/index.js';
|
|
3
|
-
export class EnforceFlow extends CompositePhase {
|
|
4
|
-
constructor(config, { dataEnrichment, tokenParser, riskApiClient, activityClient, cors, products, graphQLParser, }) {
|
|
5
|
-
super([
|
|
6
|
-
new ParseTokenPhase(tokenParser),
|
|
7
|
-
new EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser),
|
|
8
|
-
new RiskApiPhase(products, riskApiClient),
|
|
9
|
-
new AdditionalActivityHandlerPhase(config),
|
|
10
|
-
new SendAsyncActivitiesOnRequestPhase(activityClient),
|
|
11
|
-
new CreateBlockResponsePhase(config, {
|
|
12
|
-
[ProductName.BOT_DEFENDER]: products[ProductName.BOT_DEFENDER],
|
|
13
|
-
[ProductName.HYPE_SALE_CHALLENGE]: products[ProductName.HYPE_SALE_CHALLENGE],
|
|
14
|
-
}, cors),
|
|
15
|
-
new ModifyIncomingRequestPhase(Object.values(products)),
|
|
16
|
-
]);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CompositePhase, EnrichContextFromResponsePhase, ModifyOutgoingResponsePhase, SendAsyncActivitiesOnResponsePhase, } from '../impl/index.js';
|
|
2
|
-
export class PostEnforceFlow extends CompositePhase {
|
|
3
|
-
constructor(config, { products, activityClient, snippetRetriever, snippetInjector, }) {
|
|
4
|
-
super([
|
|
5
|
-
new EnrichContextFromResponsePhase(config, products),
|
|
6
|
-
new ModifyOutgoingResponsePhase(config, Object.values(products), snippetRetriever, snippetInjector),
|
|
7
|
-
new SendAsyncActivitiesOnResponsePhase(activityClient),
|
|
8
|
-
]);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Action } from '../../action/index.js';
|
|
2
|
-
export class SendAsyncActivitiesOnRequestPhase {
|
|
3
|
-
activityClient;
|
|
4
|
-
constructor(activityClient) {
|
|
5
|
-
this.activityClient = activityClient;
|
|
6
|
-
}
|
|
7
|
-
async execute(context) {
|
|
8
|
-
if (context.action === Action.BLOCK) {
|
|
9
|
-
await this.sendAsyncActivity(context);
|
|
10
|
-
}
|
|
11
|
-
return { done: false };
|
|
12
|
-
}
|
|
13
|
-
async sendAsyncActivity(context) {
|
|
14
|
-
await this.activityClient.sendActivities(context);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { CompositePhase } from '../impl';
|
|
3
|
-
import { EnforcerOptions } from '../../enforcer';
|
|
4
|
-
type RequiredEndEnforcerFlowOptions = 'logServiceClient' | 'telemetry' | 'remoteConfigManager';
|
|
5
|
-
export declare class EndEnforcerFlow<Req, Res, Added, Removed> extends CompositePhase<Req, Res> {
|
|
6
|
-
constructor(config: IConfiguration<Req, Res, Added, Removed>, { logServiceClient, telemetry, remoteConfigManager, }: Pick<Required<EnforcerOptions<Req, Res, Added, Removed>>, RequiredEndEnforcerFlowOptions>);
|
|
7
|
-
}
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { EnforcerOptions } from '../../enforcer';
|
|
3
|
-
import { CompositePhase } from '../impl';
|
|
4
|
-
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'activityClient' | 'cors' | 'products' | 'graphQLParser';
|
|
5
|
-
export declare class EnforceFlow<Req, Res, Added, Removed> extends CompositePhase<Req, Res> {
|
|
6
|
-
constructor(config: IConfiguration<Req, Res, Added, Removed>, { dataEnrichment, tokenParser, riskApiClient, activityClient, cors, products, graphQLParser, }: Pick<Required<EnforcerOptions<Req, Res, Added, Removed>>, RequiredEnforceFlowOptions>);
|
|
7
|
-
}
|
|
8
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { EnforcerOptions } from '../../enforcer';
|
|
3
|
-
import { CompositePhase } from '../impl';
|
|
4
|
-
export declare class PostEnforceFlow<Req, Res, Added, Removed> extends CompositePhase<Req, Res> {
|
|
5
|
-
constructor(config: IConfiguration<Req, Res, Added, Removed>, { products, activityClient, snippetRetriever, snippetInjector, }: Pick<Required<EnforcerOptions<Req, Res, Added, Removed>>, 'products' | 'activityClient' | 'snippetRetriever' | 'snippetInjector'>);
|
|
6
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IContext, ReadonlyContext } from '../../context';
|
|
2
|
-
import { IActivityClient } from '../../activities';
|
|
3
|
-
import { PhaseResult } from '../PhaseResult';
|
|
4
|
-
import { IPhase } from '../IPhase';
|
|
5
|
-
export declare class SendAsyncActivitiesOnRequestPhase<Req, Res> implements IPhase<Req, Res> {
|
|
6
|
-
protected readonly activityClient: IActivityClient<Req, Res>;
|
|
7
|
-
constructor(activityClient: IActivityClient<Req, Res>);
|
|
8
|
-
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
9
|
-
protected sendAsyncActivity(context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ReadonlyContext, RiskApiData } from '../../context';
|
|
2
|
-
import { IConfiguration } from '../../config';
|
|
3
|
-
import { IHttpClient, IIncomingResponse, ReadonlyHeaders } from '../../http';
|
|
4
|
-
import { HeaderEntry } from '../../activities';
|
|
5
|
-
import { RiskActivity } from '../model';
|
|
6
|
-
import { IRiskResponse } from '../risk_response';
|
|
7
|
-
import { IRiskApiClient } from './IRiskApiClient';
|
|
8
|
-
export declare abstract class PostRiskApiClientBase<Req, Res, Added, Removed> implements IRiskApiClient<Req, Res> {
|
|
9
|
-
private readonly config;
|
|
10
|
-
private readonly httpClient;
|
|
11
|
-
protected constructor(config: IConfiguration<Req, Res, Added, Removed>, httpClient: IHttpClient);
|
|
12
|
-
protected abstract createRiskResponse(response: IIncomingResponse): IRiskResponse;
|
|
13
|
-
/**
|
|
14
|
-
* Builds the Risk API activity, sends the request, and returns RiskApiData with the response.
|
|
15
|
-
* @param context
|
|
16
|
-
* @returns Promise<RiskApiData>
|
|
17
|
-
*/
|
|
18
|
-
executeRiskApi(context: ReadonlyContext<Req, Res>): Promise<RiskApiData>;
|
|
19
|
-
/**
|
|
20
|
-
* Creates the RiskActivity payload
|
|
21
|
-
* @param context
|
|
22
|
-
* @returns RiskActivity
|
|
23
|
-
* @protected
|
|
24
|
-
*/
|
|
25
|
-
protected createRiskActivity(context: ReadonlyContext<Req, Res>): RiskActivity;
|
|
26
|
-
/**
|
|
27
|
-
* Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
|
|
28
|
-
* @param riskActivity
|
|
29
|
-
* @returns RiskActivity
|
|
30
|
-
* @protected
|
|
31
|
-
*/
|
|
32
|
-
protected finalizeRiskActivity(riskActivity: RiskActivity): RiskActivity;
|
|
33
|
-
protected formatRiskHeadersField(headers: ReadonlyHeaders): HeaderEntry[];
|
|
34
|
-
protected sendRiskActivity(riskActivity: RiskActivity, riskApiData: RiskApiData, context: ReadonlyContext<Req, Res>): Promise<IIncomingResponse>;
|
|
35
|
-
protected getRiskUrl(): string;
|
|
36
|
-
protected getRiskHeaders(): ReadonlyHeaders;
|
|
37
|
-
protected handleS2STimeout(riskApiData: RiskApiData): RiskApiData;
|
|
38
|
-
protected handleS2SError(riskApiData: RiskApiData, context: ReadonlyContext<Req, Res>, response?: IIncomingResponse, error?: unknown): Promise<RiskApiData>;
|
|
39
|
-
}
|
|
40
|
-
export declare const isEnforcerTimeoutError: (err: unknown) => boolean;
|
|
File without changes
|
|
File without changes
|