perimeterx-js-core 0.15.2 → 0.16.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/activities/HttpActivityClient.js +4 -4
- package/lib/cjs/activities/HttpBatchedActivityClient.js +7 -7
- package/lib/cjs/additional_activity_handler/AdditionalActivityHandlerUtils.js +2 -2
- package/lib/cjs/config/ConfigurationBase.js +4 -1
- package/lib/cjs/config/remote_config/DefaultRemoteConfigUpdater.js +25 -30
- package/lib/cjs/config/remote_config/RemoteConfigUtils.js +14 -0
- package/lib/cjs/config/remote_config/index.js +1 -0
- package/lib/cjs/context/DefaultContext.js +18 -7
- package/lib/cjs/custom_parameters/CustomParametersUtils.js +1 -1
- package/lib/cjs/enforcer/EnforcerBase.js +40 -31
- package/lib/cjs/graphql/DefaultGraphQLParser.js +20 -22
- package/lib/cjs/impl/url/DefaultUrlUtils.js +7 -1
- package/lib/cjs/logger/DefaultLogger.js +2 -2
- package/lib/cjs/logger/HttpLogServiceClient.js +32 -27
- package/lib/cjs/logger/LoggerBase.js +5 -1
- package/lib/cjs/monitored_request/MonitoredRequestUtils.js +8 -8
- package/lib/cjs/phase/impl/CreateBlockResponsePhase.js +2 -2
- package/lib/cjs/phase/impl/DecideActionPhase.js +3 -4
- package/lib/cjs/phase/impl/EnrichContextFromRequestPhase.js +3 -2
- package/lib/cjs/phase/impl/EnrichContextFromResponsePhase.js +1 -1
- package/lib/cjs/phase/impl/FirstPartyPhase.js +4 -4
- package/lib/cjs/phase/impl/RiskApiPhase.js +1 -1
- package/lib/cjs/phase/impl/SendLogsPhase.js +2 -2
- package/lib/cjs/phase/impl/UpdateRemoteConfigPhase.js +0 -1
- package/lib/cjs/products/account_defender/AccountDefender.js +9 -8
- package/lib/cjs/products/bot_defender/filter/DefaultBotDefenderFilter.js +10 -10
- package/lib/cjs/products/bot_defender/first_party/DefaultBotDefenderFirstParty.js +17 -17
- package/lib/cjs/products/credential_intelligence/endpoint/CredentialEndpoint.js +8 -9
- package/lib/cjs/products/credential_intelligence/endpoint/CredentialEndpointManager.js +13 -15
- package/lib/cjs/pxde/DefaultDataEnrichment.js +11 -11
- package/lib/cjs/risk_api/client/PostRiskApiClientBase.js +5 -5
- package/lib/cjs/risk_token/parser/TokenParserBase.js +12 -13
- package/lib/cjs/risk_token/token/v2/DefaultTokenV2.js +5 -5
- package/lib/cjs/risk_token/token/v3/DefaultTokenV3.js +11 -11
- package/lib/cjs/sensitive_request/SensitiveRequestUtils.js +4 -4
- package/lib/cjs/telemetry/DefaultTelemetry.js +7 -7
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/cjs/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.js +7 -7
- package/lib/esm/activities/HttpActivityClient.js +4 -4
- package/lib/esm/activities/HttpBatchedActivityClient.js +7 -7
- package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +2 -2
- package/lib/esm/config/ConfigurationBase.js +4 -1
- package/lib/esm/config/remote_config/DefaultRemoteConfigUpdater.js +21 -23
- package/lib/esm/config/remote_config/RemoteConfigUtils.js +9 -0
- package/lib/esm/config/remote_config/index.js +1 -0
- package/lib/esm/context/DefaultContext.js +18 -8
- package/lib/esm/custom_parameters/CustomParametersUtils.js +1 -1
- package/lib/esm/enforcer/EnforcerBase.js +18 -7
- package/lib/esm/graphql/DefaultGraphQLParser.js +9 -10
- package/lib/esm/impl/url/DefaultUrlUtils.js +7 -1
- package/lib/esm/logger/DefaultLogger.js +2 -2
- package/lib/esm/logger/HttpLogServiceClient.js +25 -27
- package/lib/esm/logger/LoggerBase.js +6 -1
- package/lib/esm/monitored_request/MonitoredRequestUtils.js +8 -8
- package/lib/esm/phase/impl/CreateBlockResponsePhase.js +2 -2
- package/lib/esm/phase/impl/DecideActionPhase.js +2 -6
- package/lib/esm/phase/impl/EnrichContextFromRequestPhase.js +4 -2
- package/lib/esm/phase/impl/EnrichContextFromResponsePhase.js +1 -1
- package/lib/esm/phase/impl/FirstPartyPhase.js +4 -4
- package/lib/esm/phase/impl/RiskApiPhase.js +1 -1
- package/lib/esm/phase/impl/SendLogsPhase.js +2 -2
- package/lib/esm/phase/impl/UpdateRemoteConfigPhase.js +0 -1
- package/lib/esm/products/account_defender/AccountDefender.js +9 -8
- package/lib/esm/products/bot_defender/filter/DefaultBotDefenderFilter.js +8 -8
- package/lib/esm/products/bot_defender/first_party/DefaultBotDefenderFirstParty.js +16 -15
- package/lib/esm/products/credential_intelligence/endpoint/CredentialEndpoint.js +8 -10
- package/lib/esm/products/credential_intelligence/endpoint/CredentialEndpointManager.js +5 -5
- package/lib/esm/pxde/DefaultDataEnrichment.js +11 -11
- package/lib/esm/risk_api/client/PostRiskApiClientBase.js +5 -5
- package/lib/esm/risk_token/parser/TokenParserBase.js +12 -11
- package/lib/esm/risk_token/token/v2/DefaultTokenV2.js +5 -5
- package/lib/esm/risk_token/token/v3/DefaultTokenV3.js +11 -11
- package/lib/esm/sensitive_request/SensitiveRequestUtils.js +4 -4
- package/lib/esm/telemetry/DefaultTelemetry.js +7 -7
- package/lib/esm/utils/constants.js +1 -1
- package/lib/esm/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.js +7 -7
- package/lib/types/activities/HttpActivityClient.d.ts +4 -3
- package/lib/types/activities/HttpBatchedActivityClient.d.ts +8 -7
- package/lib/types/activities/utils.d.ts +270 -0
- package/lib/types/blocker/utils.d.ts +27 -0
- package/lib/types/config/ConfigurationBase.d.ts +6 -5
- package/lib/types/config/remote_config/DefaultRemoteConfigUpdater.d.ts +5 -5
- package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +4 -0
- package/lib/types/config/remote_config/index.d.ts +1 -0
- package/lib/types/context/DefaultContext.d.ts +7 -2
- package/lib/types/context/interfaces/IContext.d.ts +11 -2
- package/lib/types/enforcer/EnforcerBase.d.ts +2 -1
- package/lib/types/graphql/DefaultGraphQLParser.d.ts +1 -2
- package/lib/types/logger/DefaultLogger.d.ts +1 -1
- package/lib/types/logger/HttpLogServiceClient.d.ts +5 -10
- package/lib/types/logger/ILogServiceClient.d.ts +1 -2
- package/lib/types/logger/LoggerBase.d.ts +2 -1
- package/lib/types/logger/model/LogMetadata.d.ts +1 -0
- package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +1353 -2
- package/lib/types/phase/impl/DecideActionPhase.d.ts +0 -3
- package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +1 -0
- package/lib/types/phase/impl/FirstPartyPhase.d.ts +1 -1
- package/lib/types/products/account_defender/AccountDefender.d.ts +4 -5
- package/lib/types/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +2 -3
- package/lib/types/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +3 -4
- package/lib/types/products/credential_intelligence/endpoint/CredentialEndpoint.d.ts +3 -5
- package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointManager.d.ts +2 -2
- package/lib/types/products/credential_intelligence/endpoint/ICredentialEndpoint.d.ts +3 -4
- package/lib/types/pxhd/PXHDUtils.d.ts +54 -0
- package/lib/types/risk_api/client/PostRiskApiClientBase.d.ts +1 -1
- package/lib/types/risk_token/parser/TokenParserBase.d.ts +4 -5
- package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +1 -1
- package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +705 -17
- package/lib/types/telemetry/DefaultTelemetry.d.ts +1 -1
- package/lib/types/utils/constants.d.ts +1 -1
- package/lib/types/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.d.ts +3 -2
- package/lib/types/utils/timestamp_hmac_header_validator/ITimestampHmacHeaderValidator.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,14 @@ import { IBase64Utils } from '../utils';
|
|
|
4
4
|
import { BlockData } from './model';
|
|
5
5
|
export declare const renderHtml: (htmlTemplate: string, blockData?: BlockData) => string;
|
|
6
6
|
export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res, import("../config").ConfigurationParams<Req, Res>>, context: {
|
|
7
|
+
readonly logger: {
|
|
8
|
+
readonly getLoggerSeverity: () => import("..").LoggerSeverity;
|
|
9
|
+
readonly setLoggerSeverity: (loggerSeverity: import("..").LoggerSeverity) => void;
|
|
10
|
+
readonly debug: (message: string, metadata?: Record<string, any>) => void;
|
|
11
|
+
readonly error: (message: string, metadata?: Record<string, any>) => void;
|
|
12
|
+
readonly getLogs: () => import("..").LogRecord[];
|
|
13
|
+
readonly clearLogs: () => void;
|
|
14
|
+
};
|
|
7
15
|
readonly requestId: string;
|
|
8
16
|
readonly isMobile: boolean;
|
|
9
17
|
readonly requestData: {
|
|
@@ -68,6 +76,14 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
68
76
|
readonly score: number;
|
|
69
77
|
readonly cpa: boolean;
|
|
70
78
|
readonly verify: (context: {
|
|
79
|
+
readonly logger: {
|
|
80
|
+
readonly getLoggerSeverity: () => import("..").LoggerSeverity;
|
|
81
|
+
readonly setLoggerSeverity: (loggerSeverity: import("..").LoggerSeverity) => void;
|
|
82
|
+
readonly debug: (message: string, metadata?: Record<string, any>) => void;
|
|
83
|
+
readonly error: (message: string, metadata?: Record<string, any>) => void;
|
|
84
|
+
readonly getLogs: () => import("..").LogRecord[];
|
|
85
|
+
readonly clearLogs: () => void;
|
|
86
|
+
};
|
|
71
87
|
readonly requestId: string;
|
|
72
88
|
readonly isMobile: boolean;
|
|
73
89
|
readonly requestData: {
|
|
@@ -265,6 +281,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
265
281
|
readonly getUnderlyingResponse: () => Res;
|
|
266
282
|
};
|
|
267
283
|
readonly shouldSendLogs: boolean;
|
|
284
|
+
readonly isRemoteConfigUpdateRequest: boolean;
|
|
268
285
|
readonly enforcerStartTime?: number;
|
|
269
286
|
}) => import("ts-essentials").AsyncOrSync<import("..").TokenParseResult>;
|
|
270
287
|
readonly isExpired: () => boolean;
|
|
@@ -284,6 +301,14 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
284
301
|
readonly score: number;
|
|
285
302
|
readonly cpa: boolean;
|
|
286
303
|
readonly verify: (context: {
|
|
304
|
+
readonly logger: {
|
|
305
|
+
readonly getLoggerSeverity: () => import("..").LoggerSeverity;
|
|
306
|
+
readonly setLoggerSeverity: (loggerSeverity: import("..").LoggerSeverity) => void;
|
|
307
|
+
readonly debug: (message: string, metadata?: Record<string, any>) => void;
|
|
308
|
+
readonly error: (message: string, metadata?: Record<string, any>) => void;
|
|
309
|
+
readonly getLogs: () => import("..").LogRecord[];
|
|
310
|
+
readonly clearLogs: () => void;
|
|
311
|
+
};
|
|
287
312
|
readonly requestId: string;
|
|
288
313
|
readonly isMobile: boolean;
|
|
289
314
|
readonly requestData: {
|
|
@@ -481,6 +506,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
481
506
|
readonly getUnderlyingResponse: () => Res;
|
|
482
507
|
};
|
|
483
508
|
readonly shouldSendLogs: boolean;
|
|
509
|
+
readonly isRemoteConfigUpdateRequest: boolean;
|
|
484
510
|
readonly enforcerStartTime?: number;
|
|
485
511
|
}) => import("ts-essentials").AsyncOrSync<import("..").TokenParseResult>;
|
|
486
512
|
readonly isExpired: () => boolean;
|
|
@@ -637,5 +663,6 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
|
|
|
637
663
|
readonly getUnderlyingResponse: () => Res;
|
|
638
664
|
};
|
|
639
665
|
readonly shouldSendLogs: boolean;
|
|
666
|
+
readonly isRemoteConfigUpdateRequest: boolean;
|
|
640
667
|
readonly enforcerStartTime?: number;
|
|
641
668
|
}, base64Utils: IBase64Utils) => BlockData;
|
|
@@ -12,11 +12,12 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
|
|
|
12
12
|
protected internalLogger: ILogger;
|
|
13
13
|
protected abstract getModuleVersion(): string;
|
|
14
14
|
protected constructor(params: ParamsType, defaultParams?: Partial<ParamsType>);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
protected initialize(params: ParamsType, defaultParams: ParamsType): ParamsType;
|
|
16
|
+
protected throwIfMissingRequiredField(params: ParamsType): void;
|
|
17
|
+
protected getValidConfigValue<K extends keyof ParamsType, V extends ParamsType[K]>(params: ParamsType, defaultParams: ParamsType, key: K): V;
|
|
18
|
+
protected isValidConfigValue(params: ParamsType, defaultParams: ParamsType, key: keyof ParamsType): boolean;
|
|
19
|
+
protected getDefaultConfigurationValue<K extends keyof ParamsType, V extends ParamsType[K]>(params: ParamsType, defaultParams: ParamsType, key: K): V;
|
|
20
|
+
protected createInternalLogger(loggerSeverity: LoggerSeverity): ILogger;
|
|
20
21
|
toParams(): ParamsType;
|
|
21
22
|
get moduleVersion(): string;
|
|
22
23
|
get logger(): ILogger;
|
|
@@ -25,11 +25,11 @@ export declare class DefaultRemoteConfigUpdater<Req, Res, ParamsType extends Con
|
|
|
25
25
|
protected readonly storageClient: IRemoteConfigStorageClient<Req, Res>;
|
|
26
26
|
protected readonly timestampHmacHeaderValidator: ITimestampHmacHeaderValidator;
|
|
27
27
|
constructor(config: IConfiguration<Req, Res, ParamsType>, options: DefaultRemoteConfigUpdaterOptions<Req, Res>);
|
|
28
|
-
isUpdateRemoteConfigRequest(
|
|
29
|
-
updateRemoteConfig(
|
|
30
|
-
protected isUpdateRequestValid(request: IIncomingRequest<Req>): Promise<boolean>;
|
|
31
|
-
protected getUpdateRequestData(request: IIncomingRequest<Req>): Promise<RemoteConfigUpdateRequestData>;
|
|
32
|
-
protected fetchRemoteConfig(updateRequestData: RemoteConfigUpdateRequestData): Promise<RemoteConfigData<Req, Res> | null>;
|
|
28
|
+
isUpdateRemoteConfigRequest(context: ReadonlyContext<Req, Res>): boolean;
|
|
29
|
+
updateRemoteConfig(context: ReadonlyContext<Req, Res>): Promise<boolean>;
|
|
30
|
+
protected isUpdateRequestValid(request: IIncomingRequest<Req>, context: ReadonlyContext<Req, Res>): Promise<boolean>;
|
|
31
|
+
protected getUpdateRequestData(request: IIncomingRequest<Req>, context: ReadonlyContext<Req, Res>): Promise<RemoteConfigUpdateRequestData>;
|
|
32
|
+
protected fetchRemoteConfig(updateRequestData: RemoteConfigUpdateRequestData, context: ReadonlyContext<Req, Res>): Promise<RemoteConfigData<Req, Res> | null>;
|
|
33
33
|
protected isDesiredRemoteConfigVersion({ version }: RemoteConfigUpdateRequestData, remoteConfigData: RemoteConfigData<Req, Res>): boolean;
|
|
34
34
|
protected sleepBetweenFetchAttempts(ms: number): Promise<void>;
|
|
35
35
|
}
|
|
@@ -8,6 +8,7 @@ import { IIncomingRequest, IOutgoingResponse, ReadonlyHeaders } from '../http';
|
|
|
8
8
|
import { ICookieParser, IRequestIdGenerator, IUrl, IUrlUtils, VidSource } from '../utils';
|
|
9
9
|
import { ProductData, ProductName } from '../products';
|
|
10
10
|
import { Action } from '../action';
|
|
11
|
+
import { ILogger } from '../logger';
|
|
11
12
|
import { IContext, RequestData, RiskApiData, ServerData, TlsData, TokenData } from './interfaces';
|
|
12
13
|
export type DefaultContextOptions = {
|
|
13
14
|
cookieParser?: ICookieParser;
|
|
@@ -17,6 +18,8 @@ export type DefaultContextOptions = {
|
|
|
17
18
|
export declare class DefaultContext<Req, Res> implements IContext<Req, Res> {
|
|
18
19
|
readonly requestId: string;
|
|
19
20
|
readonly tokenOrigin: TokenOrigin;
|
|
21
|
+
readonly isRemoteConfigUpdateRequest: boolean;
|
|
22
|
+
readonly shouldSendLogs: boolean;
|
|
20
23
|
readonly requestData: RequestData<Req>;
|
|
21
24
|
readonly tokenData: TokenData<Req, Res>;
|
|
22
25
|
readonly riskApiData: RiskApiData;
|
|
@@ -30,7 +33,6 @@ export declare class DefaultContext<Req, Res> implements IContext<Req, Res> {
|
|
|
30
33
|
reasons?: Partial<Record<ProductName, string>>;
|
|
31
34
|
score?: number;
|
|
32
35
|
blockAction?: BlockAction;
|
|
33
|
-
shouldSendLogs: boolean;
|
|
34
36
|
pxhd?: PXHD;
|
|
35
37
|
pxde?: PXDE;
|
|
36
38
|
pxdeVerified?: boolean;
|
|
@@ -39,8 +41,11 @@ export declare class DefaultContext<Req, Res> implements IContext<Req, Res> {
|
|
|
39
41
|
enforcerStartTime?: number;
|
|
40
42
|
protected readonly config: IConfiguration<Req, Res>;
|
|
41
43
|
protected readonly urlUtils: IUrlUtils;
|
|
44
|
+
protected readonly contextLogger: ILogger;
|
|
42
45
|
constructor(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>, options: DefaultContextOptions);
|
|
46
|
+
get logger(): ILogger;
|
|
43
47
|
get isMobile(): boolean;
|
|
48
|
+
protected createContextLogger(config: IConfiguration<Req, Res>, shouldSaveLogs: boolean): ILogger;
|
|
44
49
|
protected createRequestData(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>, cookieParser?: ICookieParser): RequestData<Req>;
|
|
45
50
|
protected static getCookies(cookieParser: ICookieParser, ...cookieHeaderValues: string[]): Record<string, string>;
|
|
46
51
|
protected normalizeUrl(rawUrl: string): IUrl;
|
|
@@ -48,5 +53,5 @@ export declare class DefaultContext<Req, Res> implements IContext<Req, Res> {
|
|
|
48
53
|
protected extractIpFromHeader(config: IConfiguration<Req, Res>, headers: ReadonlyHeaders): string;
|
|
49
54
|
protected getTokenOrigin(request: IIncomingRequest<Req>): TokenOrigin;
|
|
50
55
|
protected setCookiesOnContext(): void;
|
|
51
|
-
protected
|
|
56
|
+
protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>): boolean;
|
|
52
57
|
}
|
|
@@ -13,7 +13,12 @@ import { Action } from '../../action';
|
|
|
13
13
|
import { IOutgoingResponse } from '../../http';
|
|
14
14
|
import { GraphQLData } from '../../graphql';
|
|
15
15
|
import { PXHD } from '../../pxhd';
|
|
16
|
+
import { ILogger } from '../../logger';
|
|
16
17
|
export interface IContext<Req, Res> {
|
|
18
|
+
/**
|
|
19
|
+
* Logger for recording messages related to the request flow.
|
|
20
|
+
*/
|
|
21
|
+
readonly logger: ILogger;
|
|
17
22
|
/**
|
|
18
23
|
* A UUID generated in the enforcer unique to each HTTP request.
|
|
19
24
|
*/
|
|
@@ -111,9 +116,13 @@ export interface IContext<Req, Res> {
|
|
|
111
116
|
/**
|
|
112
117
|
* Whether to send the logs for the current request to the logger service.
|
|
113
118
|
*/
|
|
114
|
-
shouldSendLogs: boolean;
|
|
119
|
+
readonly shouldSendLogs: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the incoming request was sent to trigger a remote configuration update.
|
|
122
|
+
*/
|
|
123
|
+
readonly isRemoteConfigUpdateRequest: boolean;
|
|
115
124
|
/**
|
|
116
125
|
* The time the Enforcer process started
|
|
117
126
|
*/
|
|
118
|
-
enforcerStartTime?: number;
|
|
127
|
+
readonly enforcerStartTime?: number;
|
|
119
128
|
}
|
|
@@ -71,11 +71,12 @@ export declare abstract class EnforcerBase<TokenV extends TokenVersion, Req, Res
|
|
|
71
71
|
enforce(...args: EnforceArgs): Promise<Res | null>;
|
|
72
72
|
/**
|
|
73
73
|
* Performs all enforcer functionality on the incoming request context.
|
|
74
|
+
* @param context
|
|
74
75
|
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
75
76
|
* @returns Promise<Res|null> - A Promise resolving to a Res or null depending on the action that should be taken.
|
|
76
77
|
* @protected
|
|
77
78
|
*/
|
|
78
|
-
protected doEnforce(...args: EnforceArgs): Promise<Res | null>;
|
|
79
|
+
protected doEnforce(context: IContext<Req, Res>, ...args: EnforceArgs): Promise<Res | null>;
|
|
79
80
|
/**
|
|
80
81
|
* Performs all required functionality after an origin response has been received.
|
|
81
82
|
* @param args - The PostEnforce args required to enforce the incoming request.
|
|
@@ -3,13 +3,12 @@ import { IConfiguration } from '../config';
|
|
|
3
3
|
import { IGraphQLParser } from './IGraphQLParser';
|
|
4
4
|
import { GraphQLData } from './model';
|
|
5
5
|
export declare class DefaultGraphQLParser<Req, Res> implements IGraphQLParser<Req, Res> {
|
|
6
|
-
private readonly config;
|
|
7
6
|
private readonly graphqlRoutes;
|
|
8
7
|
private readonly sensitiveOperationTypes;
|
|
9
8
|
private readonly sensitiveOperationNames;
|
|
10
9
|
constructor(config: IConfiguration<Req, Res>);
|
|
11
10
|
isGraphQLRequest({ requestData }: ReadonlyContext<Req, Res>): boolean;
|
|
12
|
-
parseGraphQLRequest(
|
|
11
|
+
parseGraphQLRequest(context: ReadonlyContext<Req, Res>): Promise<GraphQLData[]>;
|
|
13
12
|
private getGraphQLOperationsFromBody;
|
|
14
13
|
private parseGraphQLOperations;
|
|
15
14
|
private parseGraphQlOperation;
|
|
@@ -2,6 +2,6 @@ import { LoggerSeverity } from './LoggerSeverity';
|
|
|
2
2
|
import { LoggerBase } from './LoggerBase';
|
|
3
3
|
import { ILogger } from './ILogger';
|
|
4
4
|
export declare class DefaultLogger extends LoggerBase implements ILogger {
|
|
5
|
-
constructor(loggerSeverity: LoggerSeverity);
|
|
5
|
+
constructor(loggerSeverity: LoggerSeverity, shouldSaveLogs: boolean);
|
|
6
6
|
protected log(message: string): void;
|
|
7
7
|
}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { EnrichedLogRecord, LogRecord } from './model';
|
|
1
|
+
import { EnrichedLogRecord, LogMetadata, LogRecord } from './model';
|
|
2
2
|
import { ReadonlyContext } from '../context';
|
|
3
3
|
import { IConfiguration } from '../config';
|
|
4
4
|
import { IHttpClient } from '../http';
|
|
5
|
-
import { ILogger } from '../logger';
|
|
6
5
|
import { ILogServiceClient } from './ILogServiceClient';
|
|
7
6
|
export declare class HttpLogServiceClient<Req, Res> implements ILogServiceClient<Req, Res> {
|
|
8
|
-
protected readonly
|
|
9
|
-
protected readonly backendUrl: string;
|
|
10
|
-
protected readonly loggerAuthToken: string;
|
|
11
|
-
protected readonly remoteConfigId: string;
|
|
12
|
-
protected readonly remoteConfigVersion: number;
|
|
13
|
-
protected readonly logger: ILogger;
|
|
7
|
+
protected readonly config: IConfiguration<Req, Res>;
|
|
14
8
|
protected readonly httpClient: IHttpClient;
|
|
15
9
|
constructor(config: IConfiguration<Req, Res>, httpClient: IHttpClient);
|
|
16
|
-
sendLogs(context: ReadonlyContext<Req, Res
|
|
17
|
-
protected
|
|
10
|
+
sendLogs(context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
11
|
+
protected getLogMetadata(context: ReadonlyContext<Req, Res>): LogMetadata;
|
|
12
|
+
protected enrichLogRecord(log: LogRecord, logMetadata: LogMetadata): EnrichedLogRecord;
|
|
18
13
|
protected postLogs(logRecords: EnrichedLogRecord[]): Promise<boolean>;
|
|
19
14
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReadonlyContext } from '../context';
|
|
2
|
-
import { LogRecord } from './model';
|
|
3
2
|
import { AsyncOrSync } from 'ts-essentials';
|
|
4
3
|
export interface ILogServiceClient<Req, Res> {
|
|
5
|
-
sendLogs(context: ReadonlyContext<Req, Res
|
|
4
|
+
sendLogs(context: ReadonlyContext<Req, Res>): AsyncOrSync<void>;
|
|
6
5
|
}
|
|
@@ -3,8 +3,9 @@ import { LoggerSeverity } from './LoggerSeverity';
|
|
|
3
3
|
import { LogRecord } from './model';
|
|
4
4
|
export declare abstract class LoggerBase implements ILogger {
|
|
5
5
|
protected loggerSeverity: LoggerSeverity;
|
|
6
|
+
protected readonly shouldSaveLogs: boolean;
|
|
6
7
|
protected logs: LogRecord[];
|
|
7
|
-
protected constructor(loggerSeverity
|
|
8
|
+
protected constructor(loggerSeverity: LoggerSeverity, shouldSaveLogs: boolean, logs?: LogRecord[]);
|
|
8
9
|
protected abstract log(message: string): void;
|
|
9
10
|
debug(message: string, metadata?: Record<string, any>): void;
|
|
10
11
|
error(message: string, metadata?: Record<string, any>): void;
|