@aws-amplify/core 4.4.2-api-logging.5 → 4.4.2-unstable.3
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/dist/aws-amplify-core.js +225 -1052
- package/dist/aws-amplify-core.js.map +1 -1
- package/dist/aws-amplify-core.min.js +7 -7
- package/dist/aws-amplify-core.min.js.map +1 -1
- package/lib/Logger/ConsoleLogger.d.ts +1 -12
- package/lib/Logger/ConsoleLogger.js +6 -69
- package/lib/Logger/ConsoleLogger.js.map +1 -1
- package/lib/Providers/AWSCloudWatchProvider.js +1 -8
- package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib/Providers/index.d.ts +0 -1
- package/lib/Providers/index.js +0 -2
- package/lib/Providers/index.js.map +1 -1
- package/lib/Util/Constants.d.ts +1 -3
- package/lib/Util/Constants.js +0 -4
- package/lib/Util/Constants.js.map +1 -1
- package/lib/Util/Reachability.js +5 -7
- package/lib/Util/Reachability.js.map +1 -1
- package/lib/Util/Retry.d.ts +5 -0
- package/lib/Util/Retry.js +8 -2
- package/lib/Util/Retry.js.map +1 -1
- package/lib/Util/StringUtils.d.ts +0 -1
- package/lib/Util/StringUtils.js +6 -11
- package/lib/Util/StringUtils.js.map +1 -1
- package/lib/types/index.js +0 -4
- package/lib/types/index.js.map +1 -1
- package/lib/types/types.d.ts +1 -38
- package/lib/types/types.js +0 -4
- package/lib/types/types.js.map +1 -1
- package/lib-esm/Logger/ConsoleLogger.d.ts +1 -12
- package/lib-esm/Logger/ConsoleLogger.js +4 -67
- package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.js +1 -8
- package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib-esm/Providers/index.d.ts +0 -1
- package/lib-esm/Providers/index.js +0 -1
- package/lib-esm/Providers/index.js.map +1 -1
- package/lib-esm/Util/Constants.d.ts +1 -3
- package/lib-esm/Util/Constants.js +1 -3
- package/lib-esm/Util/Constants.js.map +1 -1
- package/lib-esm/Util/Reachability.js +3 -5
- package/lib-esm/Util/Reachability.js.map +1 -1
- package/lib-esm/Util/Retry.d.ts +5 -0
- package/lib-esm/Util/Retry.js +8 -3
- package/lib-esm/Util/Retry.js.map +1 -1
- package/lib-esm/Util/StringUtils.d.ts +0 -1
- package/lib-esm/Util/StringUtils.js +6 -11
- package/lib-esm/Util/StringUtils.js.map +1 -1
- package/lib-esm/types/index.js +0 -1
- package/lib-esm/types/index.js.map +1 -1
- package/lib-esm/types/types.d.ts +1 -38
- package/lib-esm/types/types.js +0 -3
- package/lib-esm/types/types.js.map +1 -1
- package/package.json +2 -2
- package/src/Logger/ConsoleLogger.ts +2 -54
- package/src/Providers/AWSCloudWatchProvider.ts +1 -9
- package/src/Providers/index.ts +0 -1
- package/src/Util/Constants.ts +0 -4
- package/src/Util/Reachability.ts +7 -9
- package/src/Util/Retry.ts +9 -3
- package/src/Util/StringUtils.ts +6 -15
- package/src/types/types.ts +62 -106
- package/lib/Providers/APIProvider/APILoggingProvider.d.ts +0 -28
- package/lib/Providers/APIProvider/APILoggingProvider.js +0 -320
- package/lib/Providers/APIProvider/APILoggingProvider.js.map +0 -1
- package/lib/Providers/APIProvider/CloudWatchEventFormatter.d.ts +0 -5
- package/lib/Providers/APIProvider/CloudWatchEventFormatter.js +0 -78
- package/lib/Providers/APIProvider/CloudWatchEventFormatter.js.map +0 -1
- package/lib/Providers/APIProvider/Fetch.d.ts +0 -10
- package/lib/Providers/APIProvider/Fetch.js +0 -13
- package/lib/Providers/APIProvider/Fetch.js.map +0 -1
- package/lib/Providers/APIProvider/LoggerReachability/index.d.ts +0 -3
- package/lib/Providers/APIProvider/LoggerReachability/index.js +0 -5
- package/lib/Providers/APIProvider/LoggerReachability/index.js.map +0 -1
- package/lib/Providers/APIProvider/LoggerReachability/index.native.d.ts +0 -3
- package/lib/Providers/APIProvider/LoggerReachability/index.native.js +0 -9
- package/lib/Providers/APIProvider/LoggerReachability/index.native.js.map +0 -1
- package/lib/Providers/APIProvider/index.d.ts +0 -1
- package/lib/Providers/APIProvider/index.js +0 -5
- package/lib/Providers/APIProvider/index.js.map +0 -1
- package/lib/Providers/APIProvider/loggerConnectivity.d.ts +0 -14
- package/lib/Providers/APIProvider/loggerConnectivity.js +0 -55
- package/lib/Providers/APIProvider/loggerConnectivity.js.map +0 -1
- package/lib-esm/Providers/APIProvider/APILoggingProvider.d.ts +0 -28
- package/lib-esm/Providers/APIProvider/APILoggingProvider.js +0 -315
- package/lib-esm/Providers/APIProvider/APILoggingProvider.js.map +0 -1
- package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.d.ts +0 -5
- package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js +0 -76
- package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js.map +0 -1
- package/lib-esm/Providers/APIProvider/Fetch.d.ts +0 -10
- package/lib-esm/Providers/APIProvider/Fetch.js +0 -11
- package/lib-esm/Providers/APIProvider/Fetch.js.map +0 -1
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.d.ts +0 -3
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.js +0 -3
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.js.map +0 -1
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.d.ts +0 -3
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.js +0 -4
- package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.js.map +0 -1
- package/lib-esm/Providers/APIProvider/index.d.ts +0 -1
- package/lib-esm/Providers/APIProvider/index.js +0 -2
- package/lib-esm/Providers/APIProvider/index.js.map +0 -1
- package/lib-esm/Providers/APIProvider/loggerConnectivity.d.ts +0 -14
- package/lib-esm/Providers/APIProvider/loggerConnectivity.js +0 -50
- package/lib-esm/Providers/APIProvider/loggerConnectivity.js.map +0 -1
- package/src/Providers/APIProvider/APILoggingProvider.ts +0 -286
- package/src/Providers/APIProvider/CloudWatchEventFormatter.ts +0 -100
- package/src/Providers/APIProvider/Fetch.ts +0 -10
- package/src/Providers/APIProvider/LoggerReachability/index.native.ts +0 -4
- package/src/Providers/APIProvider/LoggerReachability/index.ts +0 -2
- package/src/Providers/APIProvider/index.ts +0 -1
- package/src/Providers/APIProvider/loggerConnectivity.ts +0 -49
package/src/Util/Reachability.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { browserOrNode, isWebWorker } from '
|
|
1
|
+
import { browserOrNode, isWebWorker } from '@aws-amplify/core';
|
|
2
2
|
import Observable, { ZenObservable } from 'zen-observable-ts';
|
|
3
3
|
|
|
4
4
|
type NetworkStatus = {
|
|
@@ -32,10 +32,9 @@ export default class ReachabilityNavigator implements Reachability {
|
|
|
32
32
|
globalObj.removeEventListener('online', notifyOnline);
|
|
33
33
|
globalObj.removeEventListener('offline', notifyOffline);
|
|
34
34
|
|
|
35
|
-
ReachabilityNavigator._observers =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
35
|
+
ReachabilityNavigator._observers = ReachabilityNavigator._observers.filter(
|
|
36
|
+
_observer => _observer !== observer
|
|
37
|
+
);
|
|
39
38
|
};
|
|
40
39
|
});
|
|
41
40
|
}
|
|
@@ -44,10 +43,9 @@ export default class ReachabilityNavigator implements Reachability {
|
|
|
44
43
|
private static _observerOverride(status: NetworkStatus): void {
|
|
45
44
|
for (const observer of ReachabilityNavigator._observers) {
|
|
46
45
|
if (observer.closed) {
|
|
47
|
-
ReachabilityNavigator._observers =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
46
|
+
ReachabilityNavigator._observers = ReachabilityNavigator._observers.filter(
|
|
47
|
+
_observer => _observer !== observer
|
|
48
|
+
);
|
|
51
49
|
continue;
|
|
52
50
|
}
|
|
53
51
|
observer.next(status);
|
package/src/Util/Retry.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DelayFunction } from '../types';
|
|
2
2
|
import { ConsoleLogger as Logger } from '../Logger/ConsoleLogger';
|
|
3
|
-
const logger = new Logger('
|
|
3
|
+
const logger = new Logger('Util');
|
|
4
4
|
|
|
5
5
|
export class NonRetryableError extends Error {
|
|
6
6
|
public readonly nonRetryable = true;
|
|
@@ -30,7 +30,7 @@ export async function retry(
|
|
|
30
30
|
logger.debug(
|
|
31
31
|
`${
|
|
32
32
|
functionToRetry.name
|
|
33
|
-
} attempt #${attempt} with
|
|
33
|
+
} attempt #${attempt} with this vars: ${JSON.stringify(args)}`
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
try {
|
|
@@ -57,7 +57,13 @@ export async function retry(
|
|
|
57
57
|
|
|
58
58
|
const MAX_DELAY_MS = 5 * 60 * 1000;
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* @private
|
|
62
|
+
* Internal use of Amplify only
|
|
63
|
+
*/
|
|
64
|
+
export function jitteredBackoff(
|
|
65
|
+
maxDelayMs: number = MAX_DELAY_MS
|
|
66
|
+
): DelayFunction {
|
|
61
67
|
const BASE_TIME_MS = 100;
|
|
62
68
|
const JITTER_FACTOR = 100;
|
|
63
69
|
|
package/src/Util/StringUtils.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { browserOrNode } from '../../';
|
|
2
1
|
export function urlSafeEncode(str: string) {
|
|
3
2
|
return str
|
|
4
3
|
.split('')
|
|
5
|
-
.map(char =>
|
|
4
|
+
.map(char =>
|
|
5
|
+
char
|
|
6
|
+
.charCodeAt(0)
|
|
7
|
+
.toString(16)
|
|
8
|
+
.padStart(2, '0')
|
|
9
|
+
)
|
|
6
10
|
.join('');
|
|
7
11
|
}
|
|
8
12
|
|
|
@@ -12,16 +16,3 @@ export function urlSafeDecode(hex: string) {
|
|
|
12
16
|
.map(char => String.fromCharCode(parseInt(char, 16)))
|
|
13
17
|
.join('');
|
|
14
18
|
}
|
|
15
|
-
export const getStringByteSize = (str: string): number => {
|
|
16
|
-
if (browserOrNode().isBrowser || Blob !== undefined) {
|
|
17
|
-
return new Blob([str]).size;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (Buffer !== undefined) {
|
|
21
|
-
return Buffer.byteLength(str, 'utf8');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
throw new Error(
|
|
25
|
-
'Cannot compute string length. Blob and Buffer are undefined'
|
|
26
|
-
);
|
|
27
|
-
};
|
package/src/types/types.ts
CHANGED
|
@@ -1,106 +1,62 @@
|
|
|
1
|
-
import { InputLogEvent, LogGroup } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
-
import { Credentials } from '@aws-sdk/types';
|
|
3
|
-
|
|
4
|
-
export interface AmplifyConfig {
|
|
5
|
-
Analytics?: object;
|
|
6
|
-
Auth?: object;
|
|
7
|
-
API?: object;
|
|
8
|
-
Logging?: object;
|
|
9
|
-
Storage?: object;
|
|
10
|
-
Cache?: object;
|
|
11
|
-
Geo?: object;
|
|
12
|
-
ssr?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ICredentials {
|
|
16
|
-
accessKeyId: string;
|
|
17
|
-
sessionToken: string;
|
|
18
|
-
secretAccessKey: string;
|
|
19
|
-
identityId: string;
|
|
20
|
-
authenticated: boolean;
|
|
21
|
-
// Long term creds do not provide an expiration date
|
|
22
|
-
expiration?: Date;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
* Internal use of Amplify only
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export type DelayFunction = (
|
|
31
|
-
attempt: number,
|
|
32
|
-
args?: any[],
|
|
33
|
-
error?: Error
|
|
34
|
-
) => number | false;
|
|
35
|
-
|
|
36
|
-
export interface LoggingProvider {
|
|
37
|
-
// return the name of you provider
|
|
38
|
-
getProviderName(): string;
|
|
39
|
-
|
|
40
|
-
// return the name of you category
|
|
41
|
-
getCategoryName(): string;
|
|
42
|
-
|
|
43
|
-
// configure the plugin
|
|
44
|
-
configure(config?: object): object;
|
|
45
|
-
|
|
46
|
-
// take logs and push to provider
|
|
47
|
-
pushLogs
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface AWSCloudWatchProviderOptions {
|
|
51
|
-
logGroupName?: string;
|
|
52
|
-
logStreamName?: string;
|
|
53
|
-
region?: string;
|
|
54
|
-
credentials?: Credentials;
|
|
55
|
-
endpoint?: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface CloudWatchDataTracker {
|
|
59
|
-
eventUploadInProgress: boolean;
|
|
60
|
-
logEvents: InputLogEvent[];
|
|
61
|
-
verifiedLogGroup?: LogGroup;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface APILoggingProviderOptions {
|
|
65
|
-
endpoint: string;
|
|
66
|
-
apiKey?: string;
|
|
67
|
-
enabled?: boolean;
|
|
68
|
-
level?: LOG_TYPE;
|
|
69
|
-
excludeClassList?: string[];
|
|
70
|
-
metadata?: { [key: string]: any };
|
|
71
|
-
bufferInterval?: number;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface LoggerEvent extends InputLogEvent {
|
|
75
|
-
loggerInfo?: {
|
|
76
|
-
level: string;
|
|
77
|
-
name: string;
|
|
78
|
-
data?: object;
|
|
79
|
-
error?: {
|
|
80
|
-
message: string;
|
|
81
|
-
name: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function isLoggerEvent(
|
|
87
|
-
inputLogEvent: any
|
|
88
|
-
): inputLogEvent is LoggerEvent {
|
|
89
|
-
return (
|
|
90
|
-
inputLogEvent && !!Object.keys(inputLogEvent).find(k => k === 'loggerInfo')
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface GenericLogEvent {
|
|
95
|
-
level: string;
|
|
96
|
-
message?: string;
|
|
97
|
-
context: {
|
|
98
|
-
category: string;
|
|
99
|
-
logTime: number;
|
|
100
|
-
data?: object;
|
|
101
|
-
};
|
|
102
|
-
error?: {
|
|
103
|
-
errorMessage: string;
|
|
104
|
-
errorName: string;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
1
|
+
import { InputLogEvent, LogGroup } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
+
import { Credentials } from '@aws-sdk/types';
|
|
3
|
+
|
|
4
|
+
export interface AmplifyConfig {
|
|
5
|
+
Analytics?: object;
|
|
6
|
+
Auth?: object;
|
|
7
|
+
API?: object;
|
|
8
|
+
Logging?: object;
|
|
9
|
+
Storage?: object;
|
|
10
|
+
Cache?: object;
|
|
11
|
+
Geo?: object;
|
|
12
|
+
ssr?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ICredentials {
|
|
16
|
+
accessKeyId: string;
|
|
17
|
+
sessionToken: string;
|
|
18
|
+
secretAccessKey: string;
|
|
19
|
+
identityId: string;
|
|
20
|
+
authenticated: boolean;
|
|
21
|
+
// Long term creds do not provide an expiration date
|
|
22
|
+
expiration?: Date;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* Internal use of Amplify only
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export type DelayFunction = (
|
|
31
|
+
attempt: number,
|
|
32
|
+
args?: any[],
|
|
33
|
+
error?: Error
|
|
34
|
+
) => number | false;
|
|
35
|
+
|
|
36
|
+
export interface LoggingProvider {
|
|
37
|
+
// return the name of you provider
|
|
38
|
+
getProviderName(): string;
|
|
39
|
+
|
|
40
|
+
// return the name of you category
|
|
41
|
+
getCategoryName(): string;
|
|
42
|
+
|
|
43
|
+
// configure the plugin
|
|
44
|
+
configure(config?: object): object;
|
|
45
|
+
|
|
46
|
+
// take logs and push to provider
|
|
47
|
+
pushLogs(logs: InputLogEvent[]): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AWSCloudWatchProviderOptions {
|
|
51
|
+
logGroupName?: string;
|
|
52
|
+
logStreamName?: string;
|
|
53
|
+
region?: string;
|
|
54
|
+
credentials?: Credentials;
|
|
55
|
+
endpoint?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface CloudWatchDataTracker {
|
|
59
|
+
eventUploadInProgress: boolean;
|
|
60
|
+
logEvents: InputLogEvent[];
|
|
61
|
+
verifiedLogGroup?: LogGroup;
|
|
62
|
+
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { LoggingProvider, APILoggingProviderOptions } from '../../types/types';
|
|
2
|
-
import { InputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
|
|
3
|
-
declare class APILoggingProvider implements LoggingProvider {
|
|
4
|
-
static readonly PROVIDER_NAME = "API";
|
|
5
|
-
static readonly CATEGORY = "Logging";
|
|
6
|
-
private config;
|
|
7
|
-
private connectivity;
|
|
8
|
-
private online;
|
|
9
|
-
private bufferInterval;
|
|
10
|
-
private eventBuffer;
|
|
11
|
-
constructor(config?: APILoggingProviderOptions);
|
|
12
|
-
getProviderName(): string;
|
|
13
|
-
getCategoryName(): string;
|
|
14
|
-
configure(config: APILoggingProviderOptions): object | APILoggingProviderOptions;
|
|
15
|
-
pushLogs(events: InputLogEvent[]): void;
|
|
16
|
-
private validateConfig;
|
|
17
|
-
private normalizeConfig;
|
|
18
|
-
private initialize;
|
|
19
|
-
private disable;
|
|
20
|
-
private subscribeConnectivity;
|
|
21
|
-
private unsubscribeConnectivity;
|
|
22
|
-
private startInterval;
|
|
23
|
-
private clearInterval;
|
|
24
|
-
private verifyEvent;
|
|
25
|
-
private uploadEvents;
|
|
26
|
-
private genericLogEventBatch;
|
|
27
|
-
}
|
|
28
|
-
export { APILoggingProvider };
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __spread = (this && this.__spread) || function () {
|
|
66
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
67
|
-
return ar;
|
|
68
|
-
};
|
|
69
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
70
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
71
|
-
};
|
|
72
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
-
var Logger_1 = require("../../Logger");
|
|
74
|
-
var loggerConnectivity_1 = __importDefault(require("./loggerConnectivity"));
|
|
75
|
-
var types_1 = require("../../types/types");
|
|
76
|
-
var __1 = require("../../../");
|
|
77
|
-
var Fetch_1 = require("./Fetch");
|
|
78
|
-
var Constants_1 = require("../../Util/Constants");
|
|
79
|
-
var StringUtils_1 = require("../../Util/StringUtils");
|
|
80
|
-
var logger = new Logger_1.ConsoleLogger('APILoggingProvider');
|
|
81
|
-
var HTTPS = 'https';
|
|
82
|
-
var LOCALHOST = 'http://localhost';
|
|
83
|
-
var DEFAULT_INTERVAL = 3000;
|
|
84
|
-
// Exclude these to avoid infinite loop
|
|
85
|
-
var DEFAULT_CLASS_EXCLUDE_LIST = [
|
|
86
|
-
'APILoggingProvider',
|
|
87
|
-
'AWSCloudWatch',
|
|
88
|
-
'Retry',
|
|
89
|
-
];
|
|
90
|
-
var LAMBDA_PAYLOAD_LIMIT = 6 * 1024 * 1024; // 6MB
|
|
91
|
-
/*
|
|
92
|
-
Todo:
|
|
93
|
-
* Refactor this into a FSM - managing state will become complex when remote config functionality gets added in P1
|
|
94
|
-
*/
|
|
95
|
-
var APILoggingProvider = /** @class */ (function () {
|
|
96
|
-
function APILoggingProvider(config) {
|
|
97
|
-
this.online = false;
|
|
98
|
-
this.eventBuffer = [];
|
|
99
|
-
this.configure(config);
|
|
100
|
-
}
|
|
101
|
-
APILoggingProvider.prototype.getProviderName = function () {
|
|
102
|
-
return APILoggingProvider.PROVIDER_NAME;
|
|
103
|
-
};
|
|
104
|
-
APILoggingProvider.prototype.getCategoryName = function () {
|
|
105
|
-
return APILoggingProvider.CATEGORY;
|
|
106
|
-
};
|
|
107
|
-
APILoggingProvider.prototype.configure = function (config) {
|
|
108
|
-
try {
|
|
109
|
-
this.validateConfig(config);
|
|
110
|
-
this.config = this.normalizeConfig(config);
|
|
111
|
-
if (this.config.enabled === true) {
|
|
112
|
-
this.initialize();
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
this.disable();
|
|
116
|
-
}
|
|
117
|
-
return this.config;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
logger.error('Unable to start: ', error);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
APILoggingProvider.prototype.pushLogs = function (events) {
|
|
124
|
-
var _this = this;
|
|
125
|
-
var _a;
|
|
126
|
-
if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.enabled) === false) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
events.forEach(function (event) {
|
|
130
|
-
if (!types_1.isLoggerEvent(event)) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
var message = event.message, timestamp = event.timestamp, _a = event.loggerInfo, level = _a.level, data = _a.data, name = _a.name, _b = _a.error, _c = _b === void 0 ? {} : _b, errorMessage = _c.message, errorName = _c.name;
|
|
134
|
-
var error = errorName &&
|
|
135
|
-
errorMessage && {
|
|
136
|
-
errorMessage: errorMessage,
|
|
137
|
-
errorName: errorName,
|
|
138
|
-
};
|
|
139
|
-
var combinedEvent = {
|
|
140
|
-
level: level,
|
|
141
|
-
error: error,
|
|
142
|
-
message: message,
|
|
143
|
-
context: {
|
|
144
|
-
category: name,
|
|
145
|
-
data: __assign(__assign({}, data), _this.config.metadata),
|
|
146
|
-
logTime: timestamp,
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
if (_this.verifyEvent(combinedEvent)) {
|
|
150
|
-
_this.eventBuffer.push(combinedEvent);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
APILoggingProvider.prototype.validateConfig = function (config) {
|
|
155
|
-
if (typeof (config === null || config === void 0 ? void 0 : config.endpoint) !== 'string') {
|
|
156
|
-
throw new Error("Invalid configuration. `config.endpoint` must be a string. Received: " + typeof (config === null || config === void 0 ? void 0 : config.endpoint));
|
|
157
|
-
}
|
|
158
|
-
var protocolStr = config.endpoint.substring(0, 5).toLowerCase();
|
|
159
|
-
var isUsingLocalhost = config.endpoint.substring(0, LOCALHOST.length).toLowerCase() ===
|
|
160
|
-
LOCALHOST;
|
|
161
|
-
if (protocolStr !== HTTPS && !isUsingLocalhost) {
|
|
162
|
-
throw new Error("Invalid configuration. Only HTTPS endpoints are supported. Received: " + protocolStr);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
APILoggingProvider.prototype.normalizeConfig = function (config) {
|
|
166
|
-
var _a, _b, _c;
|
|
167
|
-
var normalizedConfig = {
|
|
168
|
-
endpoint: config.endpoint,
|
|
169
|
-
apiKey: config.apiKey,
|
|
170
|
-
metadata: config.metadata,
|
|
171
|
-
enabled: (_a = config.enabled) !== null && _a !== void 0 ? _a : true,
|
|
172
|
-
level: (_b = config.level) !== null && _b !== void 0 ? _b : Logger_1.LOG_TYPE.WARN,
|
|
173
|
-
bufferInterval: (_c = config.bufferInterval) !== null && _c !== void 0 ? _c : DEFAULT_INTERVAL,
|
|
174
|
-
excludeClassList: config.excludeClassList instanceof Array
|
|
175
|
-
? __spread(DEFAULT_CLASS_EXCLUDE_LIST, config.excludeClassList) : DEFAULT_CLASS_EXCLUDE_LIST,
|
|
176
|
-
};
|
|
177
|
-
return normalizedConfig;
|
|
178
|
-
};
|
|
179
|
-
APILoggingProvider.prototype.initialize = function () {
|
|
180
|
-
this.subscribeConnectivity();
|
|
181
|
-
};
|
|
182
|
-
APILoggingProvider.prototype.disable = function () {
|
|
183
|
-
this.clearInterval();
|
|
184
|
-
this.unsubscribeConnectivity();
|
|
185
|
-
this.eventBuffer = [];
|
|
186
|
-
};
|
|
187
|
-
APILoggingProvider.prototype.subscribeConnectivity = function () {
|
|
188
|
-
var _this = this;
|
|
189
|
-
if (this.connectivity) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
this.connectivity = new loggerConnectivity_1.default();
|
|
193
|
-
this.connectivity.status().subscribe(function (_a) {
|
|
194
|
-
var online = _a.online;
|
|
195
|
-
if (online && !_this.online) {
|
|
196
|
-
_this.startInterval();
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
_this.clearInterval();
|
|
200
|
-
}
|
|
201
|
-
_this.online = online;
|
|
202
|
-
logger.debug('Connectivity status: ', online);
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
APILoggingProvider.prototype.unsubscribeConnectivity = function () {
|
|
206
|
-
if (this.connectivity) {
|
|
207
|
-
this.connectivity.unsubscribe();
|
|
208
|
-
this.connectivity = undefined;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
APILoggingProvider.prototype.startInterval = function () {
|
|
212
|
-
var _this = this;
|
|
213
|
-
if (this.bufferInterval) {
|
|
214
|
-
this.clearInterval();
|
|
215
|
-
}
|
|
216
|
-
this.bufferInterval = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
-
var error_1;
|
|
218
|
-
return __generator(this, function (_a) {
|
|
219
|
-
switch (_a.label) {
|
|
220
|
-
case 0:
|
|
221
|
-
_a.trys.push([0, 2, , 3]);
|
|
222
|
-
return [4 /*yield*/, this.uploadEvents()];
|
|
223
|
-
case 1:
|
|
224
|
-
_a.sent();
|
|
225
|
-
return [3 /*break*/, 3];
|
|
226
|
-
case 2:
|
|
227
|
-
error_1 = _a.sent();
|
|
228
|
-
logger.error("Could not upload log events", error_1);
|
|
229
|
-
return [3 /*break*/, 3];
|
|
230
|
-
case 3: return [2 /*return*/];
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}); }, this.config.bufferInterval);
|
|
234
|
-
};
|
|
235
|
-
APILoggingProvider.prototype.clearInterval = function () {
|
|
236
|
-
clearInterval(this.bufferInterval);
|
|
237
|
-
this.bufferInterval = undefined;
|
|
238
|
-
};
|
|
239
|
-
/*
|
|
240
|
-
Filter out events that don't adhere to config settings
|
|
241
|
-
*/
|
|
242
|
-
APILoggingProvider.prototype.verifyEvent = function (event) {
|
|
243
|
-
var level = event.level, context = event.context;
|
|
244
|
-
var configLevelValue = Logger_1.LOG_LEVELS[this.config.level];
|
|
245
|
-
var eventLevelValue = Logger_1.LOG_LEVELS[level];
|
|
246
|
-
if (eventLevelValue < configLevelValue) {
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
if (this.config.excludeClassList.includes(context.category)) {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
return true;
|
|
253
|
-
};
|
|
254
|
-
APILoggingProvider.prototype.uploadEvents = function () {
|
|
255
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
-
var eventBatch, body, options;
|
|
257
|
-
var _this = this;
|
|
258
|
-
return __generator(this, function (_a) {
|
|
259
|
-
switch (_a.label) {
|
|
260
|
-
case 0:
|
|
261
|
-
eventBatch = this.genericLogEventBatch(this.eventBuffer);
|
|
262
|
-
if (eventBatch.length < 1) {
|
|
263
|
-
return [2 /*return*/];
|
|
264
|
-
}
|
|
265
|
-
body = {
|
|
266
|
-
logs: eventBatch,
|
|
267
|
-
};
|
|
268
|
-
options = Fetch_1.postOptions(body);
|
|
269
|
-
return [4 /*yield*/, __1.jitteredExponentialRetry(function (endpoint, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
270
|
-
var error_2;
|
|
271
|
-
return __generator(this, function (_a) {
|
|
272
|
-
switch (_a.label) {
|
|
273
|
-
case 0:
|
|
274
|
-
_a.trys.push([0, 2, , 3]);
|
|
275
|
-
return [4 /*yield*/, fetch(endpoint, options)];
|
|
276
|
-
case 1:
|
|
277
|
-
_a.sent(); // fetch doesnt return info for no-cors request
|
|
278
|
-
return [3 /*break*/, 3];
|
|
279
|
-
case 2:
|
|
280
|
-
error_2 = _a.sent();
|
|
281
|
-
// fetch will only fail in the event of a network error. Don't retry
|
|
282
|
-
if (error_2.message === 'Failed to fetch') {
|
|
283
|
-
throw new __1.NonRetryableError(error_2.message);
|
|
284
|
-
}
|
|
285
|
-
// all other errors are logged and retried
|
|
286
|
-
logger.warn(error_2);
|
|
287
|
-
throw error_2;
|
|
288
|
-
case 3: return [2 /*return*/];
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}); }, [this.config.endpoint, options])];
|
|
292
|
-
case 1:
|
|
293
|
-
_a.sent();
|
|
294
|
-
// remove events from buffer after the request succeeds
|
|
295
|
-
this.eventBuffer.splice(0, eventBatch.length);
|
|
296
|
-
return [2 /*return*/];
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
APILoggingProvider.prototype.genericLogEventBatch = function (buffer) {
|
|
302
|
-
var totalByteSize = 0;
|
|
303
|
-
var currentEventIdx = 0;
|
|
304
|
-
while (currentEventIdx < buffer.length) {
|
|
305
|
-
var currentEvent = buffer[currentEventIdx];
|
|
306
|
-
var eventSize = StringUtils_1.getStringByteSize(JSON.stringify(currentEvent));
|
|
307
|
-
if (totalByteSize + eventSize > LAMBDA_PAYLOAD_LIMIT) {
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
totalByteSize += eventSize;
|
|
311
|
-
currentEventIdx += 1;
|
|
312
|
-
}
|
|
313
|
-
return buffer.slice(0, currentEventIdx);
|
|
314
|
-
};
|
|
315
|
-
APILoggingProvider.PROVIDER_NAME = Constants_1.API_LOGGING_PROVIDER_NAME;
|
|
316
|
-
APILoggingProvider.CATEGORY = Constants_1.API_LOGGING_PROVIDER_CATEGORY;
|
|
317
|
-
return APILoggingProvider;
|
|
318
|
-
}());
|
|
319
|
-
exports.APILoggingProvider = APILoggingProvider;
|
|
320
|
-
//# sourceMappingURL=APILoggingProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APILoggingProvider.js","sourceRoot":"","sources":["../../../src/Providers/APIProvider/APILoggingProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA6E;AAC7E,4EAAsD;AACtD,2CAK2B;AAC3B,+BAAwE;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CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;YAElE,IAAI,aAAa,GAAG,SAAS,GAAG,oBAAoB,EAAE;gBACrD,MAAM;aACN;YAED,aAAa,IAAI,SAAS,CAAC;YAC3B,eAAe,IAAI,CAAC,CAAC;SACrB;QAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;IACzC,CAAC;IAvPe,gCAAa,GAAG,qCAAyB,CAAC;IAC1C,2BAAQ,GAAG,yCAA6B,CAAC;IAuP1D,yBAAC;CAAA,AAzPD,IAyPC;AAEQ,gDAAkB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
-
import { GenericLogEvent } from '../../types/types';
|
|
3
|
-
export declare const cloudWatchEventFromGeneric: (event: GenericLogEvent) => InputLogEvent;
|
|
4
|
-
export declare const truncateOversizedEvent: (event: InputLogEvent) => InputLogEvent;
|
|
5
|
-
export declare const cloudWatchLogEventBatch: (buffer: InputLogEvent[]) => InputLogEvent[];
|