perimeterx-js-core 0.30.1 → 0.32.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/config/ConfigurationBase.js +8 -0
- package/lib/cjs/config/defaults/DefaultConfigurationParams.js +1 -0
- package/lib/cjs/config/params/CreateHumanSecurityConfigurationParams.js +2 -0
- package/lib/cjs/config/params/index.js +1 -0
- package/lib/cjs/flow/EnforceFlow.js +2 -1
- package/lib/cjs/phase/impl/BlockByHeaderPhase.js +76 -0
- package/lib/cjs/phase/impl/index.js +1 -0
- package/lib/cjs/products/bot_defender/BotDefender.js +9 -1
- package/lib/cjs/products/utils/ProductName.js +1 -0
- package/lib/cjs/products/utils/ProductPriorityOrder.js +1 -0
- package/lib/cjs/utils/constants.js +5 -2
- package/lib/esm/config/ConfigurationBase.js +4 -0
- package/lib/esm/config/defaults/DefaultConfigurationParams.js +1 -0
- package/lib/esm/config/params/CreateHumanSecurityConfigurationParams.js +1 -0
- package/lib/esm/config/params/index.js +1 -0
- package/lib/esm/flow/EnforceFlow.js +3 -2
- package/lib/esm/phase/impl/BlockByHeaderPhase.js +72 -0
- package/lib/esm/phase/impl/index.js +1 -0
- package/lib/esm/products/bot_defender/BotDefender.js +9 -2
- package/lib/esm/products/utils/ProductName.js +1 -0
- package/lib/esm/products/utils/ProductPriorityOrder.js +1 -0
- package/lib/esm/utils/constants.js +4 -1
- package/lib/types/activities/HttpActivityClient.d.ts +3 -3
- package/lib/types/activities/HttpBatchedActivityClient.d.ts +2 -2
- package/lib/types/activities/utils.d.ts +5 -5
- package/lib/types/additional_activity_handler/AdditionalActivityHandler.d.ts +1 -1
- package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +1 -1
- package/lib/types/blocker/MobileBlocker.d.ts +3 -3
- package/lib/types/blocker/utils.d.ts +1 -1
- package/lib/types/config/ConfigurationBase.d.ts +23 -22
- package/lib/types/config/IConfiguration.d.ts +13 -9
- package/lib/types/config/defaults/DefaultConfigurationParams.d.ts +1 -1
- package/lib/types/config/params/ActiveConfigurationParams.d.ts +8 -2
- package/lib/types/config/params/AllConfigurationParams.d.ts +6 -3
- package/lib/types/config/params/CoreConfigurationParams.d.ts +25 -7
- package/lib/types/config/params/CreateHumanSecurityConfigurationParams.d.ts +2 -0
- package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -2
- package/lib/types/config/params/StaticConfigurationParams.d.ts +5 -3
- package/lib/types/config/params/index.d.ts +1 -0
- package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +1 -1
- package/lib/types/config/remote_config/manager/DefaultRemoteConfigManager.d.ts +10 -10
- package/lib/types/config/remote_config/model/RemoteConfigData.d.ts +2 -2
- package/lib/types/config/remote_config/service_client/HttpRemoteConfigServiceClient.d.ts +5 -5
- package/lib/types/config/remote_config/service_client/IRemoteConfigServiceClient.d.ts +2 -2
- package/lib/types/config/remote_config/storage_client/IRemoteConfigStorageClient.d.ts +3 -3
- package/lib/types/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.d.ts +3 -3
- package/lib/types/context/DefaultContext.d.ts +8 -8
- package/lib/types/context/SerializedContext.d.ts +4 -4
- package/lib/types/cors/DefaultCors.d.ts +2 -2
- package/lib/types/custom_parameters/CustomParametersFunction.d.ts +2 -2
- package/lib/types/custom_parameters/CustomParametersUtils.d.ts +2 -2
- package/lib/types/enforcer/EnforcerBase.d.ts +8 -8
- package/lib/types/enforcer/EnforcerOptions.d.ts +3 -3
- package/lib/types/enforcer/utils.d.ts +6 -6
- package/lib/types/flow/EndEnforcerFlow.d.ts +2 -2
- package/lib/types/flow/EnforceFlow.d.ts +3 -3
- package/lib/types/flow/FilterFlow.d.ts +2 -2
- package/lib/types/flow/PostEnforceFlow.d.ts +2 -2
- package/lib/types/graphql/DefaultGraphQLParser.d.ts +3 -3
- package/lib/types/logger/HttpLogServiceClient.d.ts +3 -3
- package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +3 -3
- package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -3
- package/lib/types/phase/impl/BlockByHeaderPhase.d.ts +40 -0
- package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +3 -3
- package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/FirstPartyPhase.d.ts +3 -3
- package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/PreflightPhase.d.ts +2 -2
- package/lib/types/phase/impl/SendAsyncActivitiesPhase.d.ts +3 -3
- package/lib/types/phase/impl/SendLogsPhase.d.ts +2 -2
- package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -3
- package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -3
- package/lib/types/phase/impl/index.d.ts +1 -0
- package/lib/types/products/account_defender/AccountDefender.d.ts +3 -3
- package/lib/types/products/bot_defender/BotDefender.d.ts +4 -4
- package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +3 -3
- package/lib/types/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +12 -12
- package/lib/types/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +5 -5
- package/lib/types/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +5 -5
- package/lib/types/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +4 -4
- package/lib/types/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +2 -2
- package/lib/types/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +3 -3
- package/lib/types/products/bot_defender/first_party/utils.d.ts +7 -7
- package/lib/types/products/credential_intelligence/CredentialIntelligence.d.ts +4 -4
- package/lib/types/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +1 -1
- package/lib/types/products/hype_sale_challenge/HypeSaleChallenge.d.ts +3 -3
- package/lib/types/products/hype_sale_challenge/block/JsonHypeSaleChallengeBlocker.d.ts +3 -3
- package/lib/types/products/hype_sale_challenge/block/MobileHypeSaleChallengeBlocker.d.ts +2 -2
- package/lib/types/products/utils/ProductName.d.ts +1 -0
- package/lib/types/pxde/DefaultDataEnrichment.d.ts +2 -2
- package/lib/types/pxhd/PXHDUtils.d.ts +2 -2
- package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +2 -2
- package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +3 -3
- package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +3 -3
- package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +2 -1
- package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +3 -3
- package/lib/types/risk_api/utils.d.ts +2 -2
- package/lib/types/risk_token/parser/DefaultTokenV2Parser.d.ts +4 -4
- package/lib/types/risk_token/parser/DefaultTokenV3Parser.d.ts +4 -4
- package/lib/types/risk_token/parser/TokenParserBase.d.ts +5 -5
- package/lib/types/risk_token/token/TokenBase.d.ts +3 -3
- package/lib/types/risk_token/token/serialize/SerializedToken.d.ts +2 -2
- package/lib/types/risk_token/token/v2/DefaultTokenV2.d.ts +2 -2
- package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +2 -2
- package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +2 -2
- package/lib/types/snippet_injection/CustomSnippetFunction.d.ts +1 -1
- package/lib/types/snippet_injection/snippet_retriever/DefaultSnippetRetriever.d.ts +3 -3
- package/lib/types/telemetry/DefaultTelemetry.d.ts +5 -5
- package/lib/types/telemetry/model/TelemetryActivity.d.ts +9 -9
- package/lib/types/utils/constants.d.ts +4 -1
- package/lib/types/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.d.ts +3 -3
- package/package.json +5 -5
|
@@ -10,7 +10,7 @@ import { ExtractGraphQLKeywordsFunction } from '../graphql';
|
|
|
10
10
|
import { TokenVersion } from '../risk_token';
|
|
11
11
|
import { CustomSnippetFunction } from '../snippet_injection';
|
|
12
12
|
import { RemoteConfigData } from './remote_config';
|
|
13
|
-
export interface IConfiguration<Req, Res,
|
|
13
|
+
export interface IConfiguration<Req, Res, Supported extends string, Added> {
|
|
14
14
|
/**
|
|
15
15
|
* The application ID.
|
|
16
16
|
*/
|
|
@@ -246,15 +246,15 @@ export interface IConfiguration<Req, Res, Added, Removed> {
|
|
|
246
246
|
/**
|
|
247
247
|
* A function returning CustomParameters that will be added to the enforcer activities.
|
|
248
248
|
*/
|
|
249
|
-
readonly enrichCustomParameters: CustomParametersFunction<Req, Res,
|
|
249
|
+
readonly enrichCustomParameters: CustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
250
250
|
/**
|
|
251
251
|
* A function returning ResponseCustomParameters that will be added to the enforcer activities.
|
|
252
252
|
*/
|
|
253
|
-
readonly enrichResponseCustomParameters: ResponseCustomParametersFunction<Req, Res,
|
|
253
|
+
readonly enrichResponseCustomParameters: ResponseCustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
254
254
|
/**
|
|
255
255
|
* A function that will be called after the asynchronous activities are sent to the backend.
|
|
256
256
|
*/
|
|
257
|
-
readonly additionalActivityHandler: AdditionalActivityHandler<Req, Res,
|
|
257
|
+
readonly additionalActivityHandler: AdditionalActivityHandler<Req, Res, Supported, Added> | null;
|
|
258
258
|
/**
|
|
259
259
|
* Whether cors support feature should be enabled.
|
|
260
260
|
*/
|
|
@@ -387,7 +387,7 @@ export interface IConfiguration<Req, Res, Added, Removed> {
|
|
|
387
387
|
/**
|
|
388
388
|
* A custom function that returns a string representing the snippet to be injected.
|
|
389
389
|
*/
|
|
390
|
-
readonly createCustomSnippet: CustomSnippetFunction<Req, Res,
|
|
390
|
+
readonly createCustomSnippet: CustomSnippetFunction<Req, Res, Supported, Added> | null;
|
|
391
391
|
/**
|
|
392
392
|
* Whether to include the request url in captcha block page
|
|
393
393
|
*/
|
|
@@ -404,20 +404,24 @@ export interface IConfiguration<Req, Res, Added, Removed> {
|
|
|
404
404
|
* The version of the token the enforcer is able to parse.
|
|
405
405
|
*/
|
|
406
406
|
readonly tokenVersion: `${TokenVersion}`;
|
|
407
|
+
/**
|
|
408
|
+
* The header name to use when adding the data enrichment value as an incoming request header.
|
|
409
|
+
*/
|
|
410
|
+
readonly dataEnrichmentHeaderName: string;
|
|
407
411
|
/**
|
|
408
412
|
* Returns an object representation of the current configuration.
|
|
409
413
|
*/
|
|
410
|
-
getActiveConfig(): ActiveConfigurationParams<Req, Res,
|
|
414
|
+
getActiveConfig(): ActiveConfigurationParams<Req, Res, Supported, Added>;
|
|
411
415
|
/**
|
|
412
416
|
* Returns an object representation of the static configuration.
|
|
413
417
|
*/
|
|
414
|
-
getStaticConfig(): StaticConfigurationParams<Req, Res,
|
|
418
|
+
getStaticConfig(): StaticConfigurationParams<Req, Res, Supported, Added>;
|
|
415
419
|
/**
|
|
416
420
|
* Returns an object representation of the remote configuration.
|
|
417
421
|
*/
|
|
418
|
-
getRemoteConfig(): RemoteConfigurationParams<Req, Res,
|
|
422
|
+
getRemoteConfig(): RemoteConfigurationParams<Req, Res, Supported, Added>;
|
|
419
423
|
/**
|
|
420
424
|
* Sets the remote configuration data.
|
|
421
425
|
*/
|
|
422
|
-
setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res,
|
|
426
|
+
setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res, Supported, Added>): void;
|
|
423
427
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CoreConfigurationParams } from '../params';
|
|
2
|
-
export declare const defaultConfigurationParams: <Req, Res,
|
|
2
|
+
export declare const defaultConfigurationParams: <Req, Res, Supported extends string, Added>() => Required<CoreConfigurationParams<Req, Res, Supported, Added>>;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CoreConfigurationParams, CoreConfigurationParamsKeys } from './CoreConfigurationParams';
|
|
2
|
+
/**
|
|
3
|
+
* Active configuration parameters representing the runtime-filtered configuration.
|
|
4
|
+
* Only includes the supported subset of core configurations plus added configurations.
|
|
5
|
+
*/
|
|
6
|
+
export type ActiveConfigurationParams<Req, Res, Supported extends string, Added> = [Supported] extends [
|
|
7
|
+
CoreConfigurationParamsKeys
|
|
8
|
+
] ? Required<Added> & Required<Pick<CoreConfigurationParams<Req, Res, string, Added>, Supported>> : never;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CoreConfigurationParams } from './CoreConfigurationParams';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Combined configuration parameters (Added + Core) with optional fields.
|
|
4
|
+
* Used for input parameters where not all fields are required.
|
|
5
|
+
*/
|
|
6
|
+
export type AllConfigurationParams<Req, Res, Supported extends string, Added> = Added & CoreConfigurationParams<Req, Res, Supported, Added>;
|
|
7
|
+
export type RequiredAllConfigurationParams<Req, Res, Supported extends string, Added> = Required<Added> & Required<CoreConfigurationParams<Req, Res, Supported, Added>>;
|
|
@@ -50,14 +50,14 @@ export type TokenV3ConfigurationParamsOnly = {
|
|
|
50
50
|
/**
|
|
51
51
|
* The configuration parameters relevant to the snippet injection feature.
|
|
52
52
|
*/
|
|
53
|
-
export type SnippetInjectionParamsOnly<Req, Res,
|
|
53
|
+
export type SnippetInjectionParamsOnly<Req, Res, Supported extends string, Added> = {
|
|
54
54
|
px_snippet_injection_enabled?: boolean;
|
|
55
|
-
px_create_custom_snippet?: CustomSnippetFunction<Req, Res,
|
|
55
|
+
px_create_custom_snippet?: CustomSnippetFunction<Req, Res, Supported, Added> | null;
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* The configuration parameters that can be set via either the static or remote configuration.
|
|
59
59
|
*/
|
|
60
|
-
export type CommonConfigurationParams<Req, Res,
|
|
60
|
+
export type CommonConfigurationParams<Req, Res, Supported extends string, Added> = TokenV3ConfigurationParamsOnly & BatchedActivitiesConfigParamsOnly & SnippetInjectionParamsOnly<Req, Res, Supported, Added> & {
|
|
61
61
|
px_s2s_timeout?: number;
|
|
62
62
|
px_async_timeout?: number;
|
|
63
63
|
px_backend_url?: string;
|
|
@@ -120,9 +120,10 @@ export type CommonConfigurationParams<Req, Res, Added, Removed> = TokenV3Configu
|
|
|
120
120
|
px_remote_config_retry_interval_ms?: number;
|
|
121
121
|
px_url_decode_reserved_characters?: boolean;
|
|
122
122
|
px_secured_pxhd_enabled?: boolean;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
px_data_enrichment_header_name?: string;
|
|
124
|
+
px_additional_activity_handler?: AdditionalActivityHandler<Req, Res, Supported, Added> | null;
|
|
125
|
+
px_enrich_custom_parameters?: CustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
126
|
+
px_enrich_response_custom_parameters?: ResponseCustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
126
127
|
px_login_successful_custom_callback?: CustomLoginSuccessfulCallback<Res> | null;
|
|
127
128
|
px_cors_custom_preflight_handler?: CustomPreflightHandler<Req> | null;
|
|
128
129
|
px_cors_create_custom_block_response_headers?: CustomBlockResponseHeadersHandler<Req> | null;
|
|
@@ -135,4 +136,21 @@ export type CommonConfigurationParams<Req, Res, Added, Removed> = TokenV3Configu
|
|
|
135
136
|
/**
|
|
136
137
|
* All configuration parameters supported by JS Core.
|
|
137
138
|
*/
|
|
138
|
-
export type CoreConfigurationParams<Req, Res,
|
|
139
|
+
export type CoreConfigurationParams<Req, Res, Supported extends string, Added> = StaticConfigurationParamsOnly & RemoteConfigurationParamsOnly & CommonConfigurationParams<Req, Res, Supported, Added>;
|
|
140
|
+
export type CoreConfigurationParamsKeys = keyof CoreConfigurationParams<any, any, any, any>;
|
|
141
|
+
/**
|
|
142
|
+
* Utility type to validate that enforcer-supported configurations are valid core configuration keys.
|
|
143
|
+
* This provides compile-time type safety to ensure wrapper libraries only reference existing core configs.
|
|
144
|
+
*
|
|
145
|
+
* @template T - Union of core configuration parameter keys to validate
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* // In wrapper library:
|
|
149
|
+
* export type SupportedCoreConfigs = ValidateSupportedConfigurations<
|
|
150
|
+
* | 'px_app_id'
|
|
151
|
+
* | 'px_auth_token'
|
|
152
|
+
* | 'px_blocking_score'
|
|
153
|
+
* >;
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export type ValidateSupportedConfigurations<T extends CoreConfigurationParamsKeys> = T;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CoreConfigurationParamsKeys, CoreConfigurationParams } from './CoreConfigurationParams';
|
|
2
|
+
export type CreateHumanSecurityConfigurationParams<Req, Res, Supported extends CoreConfigurationParamsKeys, Added> = Added & Pick<CoreConfigurationParams<Req, Res, Supported, Added>, Supported>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CoreConfigurationParams, StaticConfigurationParamsOnly } from './CoreConfigurationParams';
|
|
2
2
|
/**
|
|
3
|
-
* All configurations that can be set via the remote configurations
|
|
3
|
+
* All core configurations that can be set via the remote configurations.
|
|
4
|
+
* Note: Only core configs can be set remotely, not wrapper-specific Added configs.
|
|
4
5
|
*/
|
|
5
|
-
export type RemoteConfigurationParams<Req, Res,
|
|
6
|
+
export type RemoteConfigurationParams<Req, Res, Supported extends string, Added> = Omit<CoreConfigurationParams<Req, Res, Supported, Added>, keyof StaticConfigurationParamsOnly>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { RemoteConfigurationParamsOnly } from './CoreConfigurationParams';
|
|
2
|
-
import { CreateHumanSecurityConfigurationParams } from './
|
|
1
|
+
import { CoreConfigurationParamsKeys, RemoteConfigurationParamsOnly } from './CoreConfigurationParams';
|
|
2
|
+
import { CreateHumanSecurityConfigurationParams } from './CreateHumanSecurityConfigurationParams';
|
|
3
3
|
/**
|
|
4
4
|
* All configurations that can be set via the static configurations, taking into account any added or removed configurations.
|
|
5
5
|
*/
|
|
6
|
-
export type StaticConfigurationParams<Req, Res,
|
|
6
|
+
export type StaticConfigurationParams<Req, Res, Supported extends string, Added> = [Supported] extends [
|
|
7
|
+
CoreConfigurationParamsKeys
|
|
8
|
+
] ? Omit<CreateHumanSecurityConfigurationParams<Req, Res, Supported, Added>, keyof RemoteConfigurationParamsOnly> : never;
|
|
@@ -4,6 +4,6 @@ import { RemoteConfigurationParams } from '../params';
|
|
|
4
4
|
import { RemoteConfigData } from './model';
|
|
5
5
|
export declare namespace RemoteConfigUtils {
|
|
6
6
|
const isRemoteConfigUpdateRequest: <Req>(request: IIncomingRequest<Req>) => boolean;
|
|
7
|
-
const prepareRemoteConfigParams: <Req, Res,
|
|
7
|
+
const prepareRemoteConfigParams: <Req, Res, Supported extends string, Added>({ version, configValue }: RemoteConfigData<Req, Res, Supported, Added>, logger: ILogger) => RemoteConfigurationParams<Req, Res, Supported, Added>;
|
|
8
8
|
const mergeStringRegexConfigurationValues: (stringFields: Array<string | RegExp> | undefined, regexFields: string[] | undefined, logger: ILogger) => Array<string | RegExp>;
|
|
9
9
|
}
|
|
@@ -4,20 +4,20 @@ import { RemoteConfigData } from '../model';
|
|
|
4
4
|
import { IRemoteConfigServiceClient } from '../service_client';
|
|
5
5
|
import { IRemoteConfigStorageClient } from '../storage_client';
|
|
6
6
|
import { IRemoteConfigManager } from './IRemoteConfigManager';
|
|
7
|
-
export type DefaultRemoteConfigManagerOptions<Req, Res,
|
|
8
|
-
serviceClient: IRemoteConfigServiceClient<Req, Res,
|
|
9
|
-
storageClient: IRemoteConfigStorageClient<Req, Res,
|
|
7
|
+
export type DefaultRemoteConfigManagerOptions<Req, Res, Supported extends string, Added> = {
|
|
8
|
+
serviceClient: IRemoteConfigServiceClient<Req, Res, Supported, Added>;
|
|
9
|
+
storageClient: IRemoteConfigStorageClient<Req, Res, Supported, Added>;
|
|
10
10
|
};
|
|
11
|
-
export declare class DefaultRemoteConfigManager<Req, Res,
|
|
12
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
13
|
-
protected serviceClient: IRemoteConfigServiceClient<Req, Res,
|
|
14
|
-
protected storageClient: IRemoteConfigStorageClient<Req, Res,
|
|
15
|
-
constructor(config: IConfiguration<Req, Res,
|
|
11
|
+
export declare class DefaultRemoteConfigManager<Req, Res, Supported extends string, Added> implements IRemoteConfigManager<Req, Res> {
|
|
12
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
13
|
+
protected serviceClient: IRemoteConfigServiceClient<Req, Res, Supported, Added>;
|
|
14
|
+
protected storageClient: IRemoteConfigStorageClient<Req, Res, Supported, Added>;
|
|
15
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: DefaultRemoteConfigManagerOptions<Req, Res, Supported, Added>);
|
|
16
16
|
loadRemoteConfig(): Promise<void>;
|
|
17
|
-
protected loadRemoteConfigData(): Promise<RemoteConfigData<Req, Res,
|
|
17
|
+
protected loadRemoteConfigData(): Promise<RemoteConfigData<Req, Res, Supported, Added> | null>;
|
|
18
18
|
protected isValidRemoteConfigId(remoteConfigId: string): boolean;
|
|
19
19
|
shouldUpdateRemoteConfig(context: IContext<Req, Res>): boolean;
|
|
20
20
|
updateRemoteConfig(context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
21
|
-
protected fetchRemoteConfigData(desiredVersion: number, context: ReadonlyContext<Req, Res>): Promise<RemoteConfigData<Req, Res,
|
|
21
|
+
protected fetchRemoteConfigData(desiredVersion: number, context: ReadonlyContext<Req, Res>): Promise<RemoteConfigData<Req, Res, Supported, Added> | null>;
|
|
22
22
|
protected sleepBetweenFetchAttempts(ms: number): Promise<void>;
|
|
23
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RemoteConfigurationParams } from '../../params';
|
|
2
|
-
export type RemoteConfigData<Req, Res,
|
|
2
|
+
export type RemoteConfigData<Req, Res, Supported extends string, Added> = {
|
|
3
3
|
id: string;
|
|
4
|
-
configValue: RemoteConfigurationParams<Req, Res,
|
|
4
|
+
configValue: RemoteConfigurationParams<Req, Res, Supported, Added>;
|
|
5
5
|
lastUpdated: number;
|
|
6
6
|
version: number;
|
|
7
7
|
};
|
|
@@ -2,11 +2,11 @@ import { IHttpClient, IIncomingResponse, IOutgoingRequest } from '../../../http'
|
|
|
2
2
|
import { IConfiguration } from '../../IConfiguration';
|
|
3
3
|
import { RemoteConfigData, RemoteConfigNotifyRequestPayload } from '../model';
|
|
4
4
|
import { IRemoteConfigServiceClient } from './IRemoteConfigServiceClient';
|
|
5
|
-
export declare class HttpRemoteConfigServiceClient<Req, Res,
|
|
6
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
5
|
+
export declare class HttpRemoteConfigServiceClient<Req, Res, Supported extends string, Added> implements IRemoteConfigServiceClient<Req, Res, Supported, Added> {
|
|
6
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
7
7
|
protected readonly httpClient: IHttpClient;
|
|
8
|
-
constructor(config: IConfiguration<Req, Res,
|
|
9
|
-
fetch(_updateRequestData: RemoteConfigNotifyRequestPayload): Promise<RemoteConfigData<Req, Res,
|
|
8
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient);
|
|
9
|
+
fetch(_updateRequestData: RemoteConfigNotifyRequestPayload): Promise<RemoteConfigData<Req, Res, Supported, Added>>;
|
|
10
10
|
protected createFetchRemoteConfigRequest(): IOutgoingRequest;
|
|
11
|
-
protected extractConfigFromResponse(response: IIncomingResponse): Promise<RemoteConfigData<Req, Res,
|
|
11
|
+
protected extractConfigFromResponse(response: IIncomingResponse): Promise<RemoteConfigData<Req, Res, Supported, Added>>;
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncOrSync } from 'ts-essentials';
|
|
2
2
|
import { RemoteConfigData, RemoteConfigNotifyRequestPayload } from '../model';
|
|
3
|
-
export interface IRemoteConfigServiceClient<Req, Res,
|
|
4
|
-
fetch(updateRequestData: RemoteConfigNotifyRequestPayload): AsyncOrSync<RemoteConfigData<Req, Res,
|
|
3
|
+
export interface IRemoteConfigServiceClient<Req, Res, Supported extends string, Added> {
|
|
4
|
+
fetch(updateRequestData: RemoteConfigNotifyRequestPayload): AsyncOrSync<RemoteConfigData<Req, Res, Supported, Added>>;
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncOrSync } from 'ts-essentials';
|
|
2
2
|
import { RemoteConfigData } from '../model';
|
|
3
|
-
export interface IRemoteConfigStorageClient<Req, Res,
|
|
4
|
-
load(): AsyncOrSync<RemoteConfigData<Req, Res,
|
|
5
|
-
save(remoteConfigData: RemoteConfigData<Req, Res,
|
|
3
|
+
export interface IRemoteConfigStorageClient<Req, Res, Supported extends string, Added> {
|
|
4
|
+
load(): AsyncOrSync<RemoteConfigData<Req, Res, Supported, Added> | null>;
|
|
5
|
+
save(remoteConfigData: RemoteConfigData<Req, Res, Supported, Added>): AsyncOrSync<void>;
|
|
6
6
|
}
|
package/lib/types/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export type DefaultNotifyRemoteConfigUpdateParserOptions = {
|
|
|
11
11
|
hmacUtils?: never;
|
|
12
12
|
timestampHmacHeaderValidator: ITimestampHmacHeaderValidator;
|
|
13
13
|
};
|
|
14
|
-
export declare class DefaultNotifyRemoteConfigUpdateParser<Req, Res,
|
|
15
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
14
|
+
export declare class DefaultNotifyRemoteConfigUpdateParser<Req, Res, Supported extends string, Added> implements IRemoteConfigUpdateParser<Req, Res> {
|
|
15
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
16
16
|
protected readonly timestampHmacHeaderValidator: ITimestampHmacHeaderValidator;
|
|
17
|
-
constructor(config: IConfiguration<Req, Res,
|
|
17
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: DefaultNotifyRemoteConfigUpdateParserOptions);
|
|
18
18
|
isUpdateRequest({ requestData: { request } }: ReadonlyContext<Req, Res>): Promise<boolean>;
|
|
19
19
|
parseUpdate(context: ReadonlyContext<Req, Res>): Promise<RemoteConfigUpdateData>;
|
|
20
20
|
protected isNotifyRequestValid(context: ReadonlyContext<Req, Res>): Promise<boolean>;
|
|
@@ -21,7 +21,7 @@ export type DefaultContextOptions = {
|
|
|
21
21
|
* The default implementation of the request context which uses the incoming HTTP request and enforcer configuration
|
|
22
22
|
* to populate the context with relevant data.
|
|
23
23
|
*/
|
|
24
|
-
export declare class DefaultContext<Req, Res,
|
|
24
|
+
export declare class DefaultContext<Req, Res, Supported extends string, Added> implements IContext<Req, Res> {
|
|
25
25
|
readonly requestId: string;
|
|
26
26
|
readonly tokenOrigin: TokenOrigin;
|
|
27
27
|
readonly remoteConfigUpdateData: RemoteConfigUpdateData;
|
|
@@ -49,19 +49,19 @@ export declare class DefaultContext<Req, Res, Added, Removed> implements IContex
|
|
|
49
49
|
usedCookieSecret?: string;
|
|
50
50
|
shouldSendTelemetry: boolean;
|
|
51
51
|
protected _shouldSendLogs: boolean;
|
|
52
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
52
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
53
53
|
protected readonly urlUtils: IUrlUtils;
|
|
54
|
-
constructor(config: IConfiguration<Req, Res,
|
|
54
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>, options: DefaultContextOptions);
|
|
55
55
|
get shouldSendLogs(): boolean;
|
|
56
56
|
set shouldSendLogs(shouldSendLogs: boolean);
|
|
57
57
|
get isMobile(): boolean;
|
|
58
|
-
protected createContextLogger(config: IConfiguration<Req, Res,
|
|
59
|
-
protected createRequestData(config: IConfiguration<Req, Res,
|
|
58
|
+
protected createContextLogger(config: IConfiguration<Req, Res, Supported, Added>, shouldSaveLogs: boolean): ILogger;
|
|
59
|
+
protected createRequestData(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>, cookieParser?: ICookieParser): RequestData<Req>;
|
|
60
60
|
protected normalizeUrl(rawUrl: string): IUrl;
|
|
61
|
-
protected extractUserAgentFromHeader(config: IConfiguration<Req, Res,
|
|
62
|
-
protected extractIpFromHeader(config: IConfiguration<Req, Res,
|
|
61
|
+
protected extractUserAgentFromHeader(config: IConfiguration<Req, Res, Supported, Added>, headers: ReadonlyHeaders): string;
|
|
62
|
+
protected extractIpFromHeader(config: IConfiguration<Req, Res, Supported, Added>, headers: ReadonlyHeaders): string | null;
|
|
63
63
|
protected getTokenOrigin(request: IIncomingRequest<Req>): TokenOrigin;
|
|
64
64
|
protected setCookiesOnContext(): void;
|
|
65
|
-
protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res,
|
|
65
|
+
protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>): boolean;
|
|
66
66
|
toJSON(): ContextJson<Req, Res>;
|
|
67
67
|
}
|
|
@@ -17,7 +17,7 @@ import { ContextJson } from './ContextJson';
|
|
|
17
17
|
* incoming request, but rather uses already-extracted data from the `ContextJson` (likely returned from the `DefaultContext.toJSON()`
|
|
18
18
|
* function) and fills in the gaps using the other parameters.
|
|
19
19
|
*/
|
|
20
|
-
export declare class SerializedContext<Req, Res,
|
|
20
|
+
export declare class SerializedContext<Req, Res, Supported extends string, Added> implements IContext<Req, Res> {
|
|
21
21
|
readonly isMobile: boolean;
|
|
22
22
|
readonly remoteConfigUpdateData: RemoteConfigUpdateData;
|
|
23
23
|
readonly logger: ILogger;
|
|
@@ -44,9 +44,9 @@ export declare class SerializedContext<Req, Res, Added, Removed> implements ICon
|
|
|
44
44
|
tokenOrigin: TokenOrigin;
|
|
45
45
|
uuid?: string;
|
|
46
46
|
shouldSendTelemetry: boolean;
|
|
47
|
-
constructor(config: IConfiguration<Req, Res,
|
|
47
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, contextJson: ContextJson<Req, Res>, request: IIncomingRequest<Req>, urlUtils: IUrlUtils);
|
|
48
48
|
protected createRequestData({ requestData }: ContextJson<Req, Res>, request: IIncomingRequest<Req>, urlUtils: IUrlUtils): RequestData<Req>;
|
|
49
|
-
protected createTokenData({ tokenData }: ContextJson<Req, Res>, config: IConfiguration<Req, Res,
|
|
49
|
+
protected createTokenData({ tokenData }: ContextJson<Req, Res>, config: IConfiguration<Req, Res, Supported, Added>): TokenData<Req, Res>;
|
|
50
50
|
protected createRiskApiData({ riskApiData }: ContextJson<Req, Res>): RiskApiData;
|
|
51
|
-
protected createLogger(config: IConfiguration<Req, Res,
|
|
51
|
+
protected createLogger(config: IConfiguration<Req, Res, Supported, Added>, shouldSendLogs: boolean, logs?: LogRecord[]): ILogger;
|
|
52
52
|
}
|
|
@@ -2,11 +2,11 @@ import { ICors } from './ICors';
|
|
|
2
2
|
import { IConfiguration } from '../config';
|
|
3
3
|
import { ReadonlyContext } from '../context';
|
|
4
4
|
import { ReadonlyHeaders, IMinimalResponse } from '../http';
|
|
5
|
-
export declare class DefaultCors<Req, Res,
|
|
5
|
+
export declare class DefaultCors<Req, Res, Supported extends string, Added> implements ICors<Req, Res> {
|
|
6
6
|
private readonly customBlockResponseHeaders;
|
|
7
7
|
private readonly customPreflightHandler;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
constructor(config: IConfiguration<Req, Res,
|
|
9
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
10
10
|
isPreflightRequest(context: ReadonlyContext<Req, Res>): boolean;
|
|
11
11
|
runPreflightCustomHandler(context: ReadonlyContext<Req, Res>): Promise<IMinimalResponse | null>;
|
|
12
12
|
isCorsRequest(context: ReadonlyContext<Req, Res>): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CustomParameters, ResponseCustomParameters } from './CustomParameters';
|
|
2
2
|
import { ActiveConfigurationParams } from '../config';
|
|
3
|
-
export type CustomParametersFunction<Req, Res,
|
|
4
|
-
export type ResponseCustomParametersFunction<Req, Res,
|
|
3
|
+
export type CustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, request: Req) => CustomParameters | Promise<CustomParameters>;
|
|
4
|
+
export type ResponseCustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, response: Res) => ResponseCustomParameters | Promise<ResponseCustomParameters>;
|
|
@@ -2,8 +2,8 @@ import { IConfiguration } from '../config';
|
|
|
2
2
|
import { ReadonlyContext } from '../context';
|
|
3
3
|
import { CustomParameters, ResponseCustomParameters } from './CustomParameters';
|
|
4
4
|
export declare namespace CustomParametersUtils {
|
|
5
|
-
const createCustomParameters: <Req, Res,
|
|
6
|
-
const createResponseCustomParameters: <Req, Res,
|
|
5
|
+
const createCustomParameters: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<CustomParameters | null>;
|
|
6
|
+
const createResponseCustomParameters: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<ResponseCustomParameters | null>;
|
|
7
7
|
const normalizeCustomParams: (customParameters: Record<string, any>) => CustomParameters | null;
|
|
8
8
|
const normalizeResponseCustomParams: (customParameters: Record<string, any>) => ResponseCustomParameters | null;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncOrSync } from 'ts-essentials';
|
|
2
|
-
import { IConfiguration, IRemoteConfigManager } from '../config';
|
|
2
|
+
import { IConfiguration, IRemoteConfigManager, CoreConfigurationParamsKeys } from '../config';
|
|
3
3
|
import { IContext } from '../context';
|
|
4
4
|
import { IMinimalResponse, IOutgoingResponse } from '../http';
|
|
5
5
|
import { IFlow } from '../flow';
|
|
@@ -10,8 +10,8 @@ import { IPostEnforcer } from './IPostEnforcer';
|
|
|
10
10
|
/**
|
|
11
11
|
* The base class for fundamental enforcer logic.
|
|
12
12
|
*/
|
|
13
|
-
export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[], PostEnforceArgs extends any[],
|
|
14
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
13
|
+
export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[], PostEnforceArgs extends any[], Supported extends CoreConfigurationParamsKeys, Added> implements IEnforcer<EnforceArgs, Promise<Res | null>>, IPostEnforcer<PostEnforceArgs, Promise<void>> {
|
|
14
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
15
15
|
protected readonly filterFlow: IFlow<Req, Res>;
|
|
16
16
|
protected readonly enforceFlow: IFlow<Req, Res>;
|
|
17
17
|
protected readonly postEnforceFlow: IFlow<Req, Res> | null;
|
|
@@ -61,7 +61,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
61
61
|
* @param options - An EnforcerOptions object that allows for overriding any functional building blocks in the enforcer.
|
|
62
62
|
* @protected
|
|
63
63
|
*/
|
|
64
|
-
protected constructor(config: IConfiguration<Req, Res,
|
|
64
|
+
protected constructor(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>);
|
|
65
65
|
/**
|
|
66
66
|
* Creates the filter flow for the enforcer. The filter flow is responsible for filtering out requests that should not undergo the usual enforcement flow.
|
|
67
67
|
* For example, first party, filtered, CORS preflight, and telemetry requests are filtered out.
|
|
@@ -70,7 +70,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
70
70
|
* @protected
|
|
71
71
|
* @returns - The filter flow for the enforcer.
|
|
72
72
|
*/
|
|
73
|
-
protected createFilterFlow(config: IConfiguration<Req, Res,
|
|
73
|
+
protected createFilterFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
74
74
|
/**
|
|
75
75
|
* Creates the post enforce flow for the enforcer. The post enforce flow is responsible for any logic that requires the origin response in the case of passed requests.
|
|
76
76
|
* For example, enriching the context with response data (status, login successful information) and modifying the origin response (snippet injection, PXHD) are part of the post enforce flow.
|
|
@@ -79,7 +79,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
79
79
|
* @protected
|
|
80
80
|
* @returns - The post enforce flow for the enforcer or null if post enforce is not enabled.
|
|
81
81
|
*/
|
|
82
|
-
protected createPostEnforceFlow(config: IConfiguration<Req, Res,
|
|
82
|
+
protected createPostEnforceFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res> | null;
|
|
83
83
|
/**
|
|
84
84
|
* Creates the enforce flow for the enforcer. The enforce flow is responsible for the core functionality of HUMAN enforcement.
|
|
85
85
|
* For example, parsing HUMAN cookies, performing Risk API, invoking the additional activity handler, and returning a block response are part of the enforce flow.
|
|
@@ -88,7 +88,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
88
88
|
* @protected
|
|
89
89
|
* @returns - The enforce flow for the enforcer.
|
|
90
90
|
*/
|
|
91
|
-
protected createEnforceFlow(config: IConfiguration<Req, Res,
|
|
91
|
+
protected createEnforceFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
92
92
|
/**
|
|
93
93
|
* Creates the end enforce flow for the enforcer. The end enforce flow is responsible for all actions that must be done after every incoming request.
|
|
94
94
|
* For example, sending the async activities, sending the telemetry activity, or updating the remote config, sending and clearing the enforcer logs, are parts of the end enforce flow.
|
|
@@ -97,7 +97,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
97
97
|
* @protected
|
|
98
98
|
* @returns - The end enforce flow for the enforcer.
|
|
99
99
|
*/
|
|
100
|
-
protected createEndEnforcerFlow(config: IConfiguration<Req, Res,
|
|
100
|
+
protected createEndEnforcerFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
101
101
|
/**
|
|
102
102
|
* The central function that triggers enforcement on the incoming request.
|
|
103
103
|
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
@@ -11,7 +11,7 @@ import { IGraphQLParser } from '../graphql';
|
|
|
11
11
|
import { ILogServiceClient } from '../logger';
|
|
12
12
|
import { IRemoteConfigStorageClient, IRemoteConfigServiceClient, IRemoteConfigManager, IRemoteConfigUpdateParser } from '../config';
|
|
13
13
|
import { ISnippetInjector, ISnippetRetriever } from '../snippet_injection';
|
|
14
|
-
export type EnforcerOptions<Req, Res,
|
|
14
|
+
export type EnforcerOptions<Req, Res, Supported extends string, Added> = {
|
|
15
15
|
httpClient: IHttpClient;
|
|
16
16
|
base64Utils: IBase64Utils;
|
|
17
17
|
hmacUtils: IHmacUtils;
|
|
@@ -30,8 +30,8 @@ export type EnforcerOptions<Req, Res, Added, Removed> = {
|
|
|
30
30
|
logServiceClient?: ILogServiceClient<Req, Res> | null;
|
|
31
31
|
remoteConfigManager?: IRemoteConfigManager<Req, Res> | null;
|
|
32
32
|
remoteConfigUpdateParser?: IRemoteConfigUpdateParser<Req, Res> | null;
|
|
33
|
-
remoteConfigStorageClient?: IRemoteConfigStorageClient<Req, Res,
|
|
34
|
-
remoteConfigServiceClient?: IRemoteConfigServiceClient<Req, Res,
|
|
33
|
+
remoteConfigStorageClient?: IRemoteConfigStorageClient<Req, Res, Supported, Added> | null;
|
|
34
|
+
remoteConfigServiceClient?: IRemoteConfigServiceClient<Req, Res, Supported, Added> | null;
|
|
35
35
|
snippetRetriever?: ISnippetRetriever<Req, Res> | null;
|
|
36
36
|
snippetInjector?: ISnippetInjector<Res> | null;
|
|
37
37
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IConfiguration, IRemoteConfigManager, IRemoteConfigServiceClient, IRemoteConfigStorageClient, IRemoteConfigUpdateParser } from '../config';
|
|
1
|
+
import { IConfiguration, IRemoteConfigManager, IRemoteConfigServiceClient, IRemoteConfigStorageClient, IRemoteConfigUpdateParser, CoreConfigurationParamsKeys } from '../config';
|
|
2
2
|
import { EnforcerOptions } from './EnforcerOptions';
|
|
3
3
|
import { Products } from '../products';
|
|
4
4
|
import { IBase64Utils, IHashUtils, IIpRangeChecker, IUrlUtils } from '../utils';
|
|
5
|
-
export declare const createEnforcerInitializationBlock: <Req, Res,
|
|
6
|
-
export declare const createEnforcerProducts: <Req, Res,
|
|
7
|
-
export declare const createRemoteConfigClients: <Req, Res,
|
|
8
|
-
remoteConfigServiceClient: IRemoteConfigServiceClient<Req, Res,
|
|
5
|
+
export declare const createEnforcerInitializationBlock: <Req, Res, Supported extends CoreConfigurationParamsKeys, Added>(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>) => Required<EnforcerOptions<Req, Res, Supported, Added>>;
|
|
6
|
+
export declare const createEnforcerProducts: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, products: Products<Req, Res> | undefined, base64Utils: IBase64Utils, hashUtils: IHashUtils, urlUtils: IUrlUtils, ipRangeChecker: IIpRangeChecker) => Products<Req, Res>;
|
|
7
|
+
export declare const createRemoteConfigClients: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>) => {
|
|
8
|
+
remoteConfigServiceClient: IRemoteConfigServiceClient<Req, Res, Supported, Added> | null;
|
|
9
9
|
remoteConfigManager: IRemoteConfigManager<Req, Res> | null;
|
|
10
10
|
remoteConfigUpdateParser: IRemoteConfigUpdateParser<Req, Res> | null;
|
|
11
|
-
remoteConfigStorageClient: IRemoteConfigStorageClient<Req, Res,
|
|
11
|
+
remoteConfigStorageClient: IRemoteConfigStorageClient<Req, Res, Supported, Added> | null;
|
|
12
12
|
};
|
|
@@ -2,7 +2,7 @@ import { IConfiguration } from '../config';
|
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
4
|
type RequiredEndEnforcerFlowOptions = 'activityClient' | 'logServiceClient' | 'telemetry' | 'remoteConfigManager';
|
|
5
|
-
export declare class EndEnforcerFlow<Req, Res,
|
|
6
|
-
constructor(config: IConfiguration<Req, Res,
|
|
5
|
+
export declare class EndEnforcerFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { logServiceClient, telemetry, remoteConfigManager, activityClient, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, RequiredEndEnforcerFlowOptions>);
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IConfiguration } from '../config';
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
|
-
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'cors' | 'products' | 'graphQLParser';
|
|
5
|
-
export declare class EnforceFlow<Req, Res,
|
|
6
|
-
constructor(config: IConfiguration<Req, Res,
|
|
4
|
+
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'cors' | 'products' | 'graphQLParser' | 'base64Utils';
|
|
5
|
+
export declare class EnforceFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser, base64Utils, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, RequiredEnforceFlowOptions>);
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -4,8 +4,8 @@ import { Products } from '../products';
|
|
|
4
4
|
import { IFirstParty } from '../first_party';
|
|
5
5
|
import { IFilter } from '../filter';
|
|
6
6
|
import { Flow } from './Flow';
|
|
7
|
-
export declare class FilterFlow<Req, Res,
|
|
8
|
-
constructor(config: IConfiguration<Req, Res,
|
|
7
|
+
export declare class FilterFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
8
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { httpClient, products, cors, telemetry, remoteConfigUpdateParser, }: Required<EnforcerOptions<Req, Res, Supported, Added>>);
|
|
9
9
|
protected static getFirstPartyProducts<Req, Res>(products: Products<Req, Res>): IFirstParty<Req, Res>[];
|
|
10
10
|
protected static getFilterProducts<Req, Res>(products: Products<Req, Res>): IFilter<Req, Res>[];
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IConfiguration } from '../config';
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
|
-
export declare class PostEnforceFlow<Req, Res,
|
|
5
|
-
constructor(config: IConfiguration<Req, Res,
|
|
4
|
+
export declare class PostEnforceFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
5
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { products, snippetRetriever, snippetInjector, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, 'products' | 'snippetRetriever' | 'snippetInjector'>);
|
|
6
6
|
}
|
|
@@ -4,11 +4,11 @@ import { IIncomingRequest } from '../http';
|
|
|
4
4
|
import { IGraphQLParser } from './IGraphQLParser';
|
|
5
5
|
import { GraphQLData, GraphQLOperation, GraphQLOperationType } from './model';
|
|
6
6
|
import { ExtractGraphQLKeywordsFunction } from './ExtractGraphQLKeywordsFunction';
|
|
7
|
-
export declare class DefaultGraphQLParser<Req, Res,
|
|
8
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
7
|
+
export declare class DefaultGraphQLParser<Req, Res, Supported extends string, Added> implements IGraphQLParser<Req, Res> {
|
|
8
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
9
9
|
protected readonly maxCharactersInGraphqlKeyword: number;
|
|
10
10
|
protected readonly maxGraphqlKeywordCount: number;
|
|
11
|
-
constructor(config: IConfiguration<Req, Res,
|
|
11
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
12
12
|
isGraphQLRequest({ requestData }: ReadonlyContext<Req, Res>): boolean;
|
|
13
13
|
parseGraphQLRequest(context: ReadonlyContext<Req, Res>): Promise<GraphQLData[] | null>;
|
|
14
14
|
protected getGraphQLOperationsFromBody(request: IIncomingRequest<Req>, context: ReadonlyContext<Req, Res>): Promise<Array<GraphQLOperation> | null>;
|
|
@@ -3,10 +3,10 @@ import { ReadonlyContext } from '../context';
|
|
|
3
3
|
import { IConfiguration } from '../config';
|
|
4
4
|
import { IHttpClient } from '../http';
|
|
5
5
|
import { ILogServiceClient } from './ILogServiceClient';
|
|
6
|
-
export declare class HttpLogServiceClient<Req, Res,
|
|
7
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
6
|
+
export declare class HttpLogServiceClient<Req, Res, Supported extends string, Added> implements ILogServiceClient<Req, Res> {
|
|
7
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
8
8
|
protected readonly httpClient: IHttpClient;
|
|
9
|
-
constructor(config: IConfiguration<Req, Res,
|
|
9
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient);
|
|
10
10
|
sendLogs(context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
11
11
|
protected getLogMetadata(context: ReadonlyContext<Req, Res>): LogMetadata;
|
|
12
12
|
protected enrichLogRecord(log: LogRecord, logMetadata: LogMetadata): EnrichedLogRecord;
|