@aws-amplify/analytics 7.0.1-api-v6-models.9351bcf.0 → 7.0.1-api-v6-models.891fe0d.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/apis/disable.js +1 -1
- package/lib/apis/enable.js +1 -1
- package/lib/errors/AnalyticsError.js +7 -11
- package/lib/errors/assertValidationError.js +6 -6
- package/lib/errors/validation.js +10 -11
- package/lib/providers/kinesis/apis/flushEvents.js +20 -23
- package/lib/providers/kinesis/apis/record.js +24 -26
- package/lib/providers/kinesis/utils/getEventBuffer.js +39 -70
- package/lib/providers/kinesis/utils/resolveConfig.js +14 -13
- package/lib/providers/kinesis-firehose/apis/flushEvents.js +19 -22
- package/lib/providers/kinesis-firehose/apis/record.js +22 -24
- package/lib/providers/kinesis-firehose/utils/getEventBuffer.js +39 -68
- package/lib/providers/kinesis-firehose/utils/resolveConfig.js +14 -13
- package/lib/providers/personalize/apis/flushEvents.js +18 -21
- package/lib/providers/personalize/apis/record.js +55 -71
- package/lib/providers/personalize/utils/autoTrackMedia.js +96 -98
- package/lib/providers/personalize/utils/cachedSession.js +30 -42
- package/lib/providers/personalize/utils/getEventBuffer.js +35 -62
- package/lib/providers/personalize/utils/resolveConfig.js +14 -13
- package/lib/providers/pinpoint/apis/configureAutoTrack.js +6 -6
- package/lib/providers/pinpoint/apis/flushEvents.js +10 -13
- package/lib/providers/pinpoint/apis/identifyUser.js +18 -30
- package/lib/providers/pinpoint/apis/record.js +15 -16
- package/lib/providers/pinpoint/utils/resolveConfig.js +5 -6
- package/lib/providers/pinpoint/utils/resolveCredentials.js +7 -15
- package/lib/setupTests.js +1 -1
- package/lib/trackers/EventTracker.js +39 -45
- package/lib/trackers/PageViewTracker.js +41 -45
- package/lib/trackers/SessionTracker.js +25 -31
- package/lib/trackers/SessionTracker.native.js +25 -31
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/eventBuffer/EventBuffer.js +34 -62
- package/lib/utils/groupBy.js +4 -7
- package/lib/utils/resolveCredentials.js +7 -15
- package/lib/utils/statusHelpers.js +4 -4
- package/lib/utils/trackerConfigHelpers.js +2 -2
- package/lib/utils/trackerConfigHelpers.native.js +2 -2
- package/lib/utils/trackerHelpers.js +5 -5
- package/lib/utils/userAgent.js +3 -3
- package/lib-esm/apis/disable.js +1 -1
- package/lib-esm/apis/enable.js +1 -1
- package/lib-esm/errors/AnalyticsError.js +6 -11
- package/lib-esm/errors/assertValidationError.js +4 -4
- package/lib-esm/errors/validation.js +10 -11
- package/lib-esm/providers/kinesis/apis/flushEvents.js +15 -18
- package/lib-esm/providers/kinesis/apis/record.js +18 -20
- package/lib-esm/providers/kinesis/utils/constants.js +1 -1
- package/lib-esm/providers/kinesis/utils/getEventBuffer.js +37 -68
- package/lib-esm/providers/kinesis/utils/resolveConfig.js +11 -10
- package/lib-esm/providers/kinesis-firehose/apis/flushEvents.js +15 -18
- package/lib-esm/providers/kinesis-firehose/apis/record.js +17 -19
- package/lib-esm/providers/kinesis-firehose/utils/constants.js +1 -1
- package/lib-esm/providers/kinesis-firehose/utils/getEventBuffer.js +37 -66
- package/lib-esm/providers/kinesis-firehose/utils/resolveConfig.js +11 -10
- package/lib-esm/providers/personalize/apis/flushEvents.js +14 -17
- package/lib-esm/providers/personalize/apis/record.js +50 -66
- package/lib-esm/providers/personalize/utils/autoTrackMedia.js +94 -96
- package/lib-esm/providers/personalize/utils/cachedSession.js +28 -40
- package/lib-esm/providers/personalize/utils/constants.js +4 -4
- package/lib-esm/providers/personalize/utils/getEventBuffer.js +33 -60
- package/lib-esm/providers/personalize/utils/resolveConfig.js +11 -10
- package/lib-esm/providers/pinpoint/apis/configureAutoTrack.js +4 -4
- package/lib-esm/providers/pinpoint/apis/flushEvents.js +5 -8
- package/lib-esm/providers/pinpoint/apis/identifyUser.js +14 -26
- package/lib-esm/providers/pinpoint/apis/record.js +9 -10
- package/lib-esm/providers/pinpoint/utils/resolveConfig.js +3 -4
- package/lib-esm/providers/pinpoint/utils/resolveCredentials.js +5 -13
- package/lib-esm/setupTests.js +1 -1
- package/lib-esm/trackers/EventTracker.js +37 -44
- package/lib-esm/trackers/PageViewTracker.js +39 -44
- package/lib-esm/trackers/SessionTracker.js +22 -29
- package/lib-esm/trackers/SessionTracker.native.js +22 -29
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/utils/eventBuffer/EventBuffer.js +33 -62
- package/lib-esm/utils/groupBy.js +4 -7
- package/lib-esm/utils/resolveCredentials.js +5 -13
- package/lib-esm/utils/statusHelpers.js +4 -4
- package/lib-esm/utils/trackerConfigHelpers.js +1 -1
- package/lib-esm/utils/trackerConfigHelpers.native.js +1 -1
- package/lib-esm/utils/trackerHelpers.js +4 -4
- package/lib-esm/utils/userAgent.js +2 -2
- package/package.json +6 -9
- package/src/providers/kinesis/utils/getEventBuffer.ts +6 -7
- package/src/providers/kinesis-firehose/utils/getEventBuffer.ts +6 -7
- package/src/providers/personalize/utils/getEventBuffer.ts +6 -7
- package/src/trackers/SessionTracker.native.ts +2 -3
- package/src/trackers/SessionTracker.ts +2 -3
|
@@ -1,88 +1,59 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __read, __spreadArray, __values } from "tslib";
|
|
4
3
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const logger = new ConsoleLogger('EventBuffer');
|
|
5
|
+
export class EventBuffer {
|
|
6
|
+
constructor(config, getAnalyticsClient) {
|
|
8
7
|
this.list = [];
|
|
9
8
|
this.config = config;
|
|
10
9
|
this.getAnalyticsClient = getAnalyticsClient;
|
|
11
10
|
this.startEventLoop();
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
21
|
-
var event_1 = events_1_1.value;
|
|
22
|
-
if (this.list.length + 1 > this.config.bufferSize) {
|
|
23
|
-
logger.debug("Exceed ".concat(typeof event_1, " event buffer limits, event dropped"));
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
this.list.push(event_1);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
30
|
-
finally {
|
|
31
|
-
try {
|
|
32
|
-
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
12
|
+
append(...events) {
|
|
13
|
+
for (const event of events) {
|
|
14
|
+
if (this.list.length + 1 > this.config.bufferSize) {
|
|
15
|
+
logger.debug(`Exceed ${typeof event} event buffer limits, event dropped`);
|
|
16
|
+
continue;
|
|
33
17
|
}
|
|
34
|
-
|
|
18
|
+
this.list.push(event);
|
|
35
19
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
20
|
+
}
|
|
21
|
+
flushAll() {
|
|
38
22
|
return this.submitEvents(this.list.length);
|
|
39
|
-
}
|
|
40
|
-
|
|
23
|
+
}
|
|
24
|
+
release() {
|
|
41
25
|
this.list = [];
|
|
42
26
|
if (this.timer) {
|
|
43
27
|
clearInterval(this.timer);
|
|
44
28
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
enumerable: false,
|
|
51
|
-
configurable: true
|
|
52
|
-
});
|
|
53
|
-
EventBuffer.prototype.head = function (count) {
|
|
29
|
+
}
|
|
30
|
+
get length() {
|
|
31
|
+
return this.list.length;
|
|
32
|
+
}
|
|
33
|
+
head(count) {
|
|
54
34
|
return this.list.splice(0, count);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
data[_i] = arguments[_i];
|
|
61
|
-
}
|
|
62
|
-
(_a = this.list).unshift.apply(_a, __spreadArray([], __read(data), false));
|
|
63
|
-
};
|
|
64
|
-
EventBuffer.prototype.startEventLoop = function () {
|
|
65
|
-
var _this = this;
|
|
35
|
+
}
|
|
36
|
+
insertAtBeginning(...data) {
|
|
37
|
+
this.list.unshift(...data);
|
|
38
|
+
}
|
|
39
|
+
startEventLoop() {
|
|
66
40
|
if (this.timer) {
|
|
67
41
|
clearInterval(this.timer);
|
|
68
42
|
}
|
|
69
|
-
|
|
70
|
-
setInterval(
|
|
71
|
-
|
|
43
|
+
const { flushSize, flushInterval } = this.config;
|
|
44
|
+
setInterval(() => {
|
|
45
|
+
this.submitEvents(flushSize);
|
|
72
46
|
}, flushInterval);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var events = this.head(count);
|
|
47
|
+
}
|
|
48
|
+
submitEvents(count) {
|
|
49
|
+
const events = this.head(count);
|
|
77
50
|
if (events.length === 0) {
|
|
78
51
|
return Promise.resolve();
|
|
79
52
|
}
|
|
80
|
-
return this.getAnalyticsClient()(events).then(
|
|
53
|
+
return this.getAnalyticsClient()(events).then(result => {
|
|
81
54
|
if (result.length > 0) {
|
|
82
|
-
|
|
55
|
+
this.insertAtBeginning(...result);
|
|
83
56
|
}
|
|
84
57
|
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}());
|
|
88
|
-
export { EventBuffer };
|
|
58
|
+
}
|
|
59
|
+
}
|
package/lib-esm/utils/groupBy.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _b;
|
|
8
|
-
var groupId = getGroupId(current);
|
|
9
|
-
return __assign(__assign({}, result), (_a = {}, _a[groupId] = __spreadArray(__spreadArray([], __read(((_b = result[groupId]) !== null && _b !== void 0 ? _b : [])), false), [current], false), _a));
|
|
3
|
+
export const groupBy = (getGroupId, list) => {
|
|
4
|
+
return list.reduce((result, current) => {
|
|
5
|
+
const groupId = getGroupId(current);
|
|
6
|
+
return { ...result, [groupId]: [...(result[groupId] ?? []), current] };
|
|
10
7
|
}, {});
|
|
11
8
|
};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __awaiter, __generator } from "tslib";
|
|
4
3
|
import { AnalyticsValidationErrorCode, assertValidationError } from '../errors';
|
|
5
4
|
import { fetchAuthSession } from '@aws-amplify/core';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
case 1:
|
|
12
|
-
_a = _b.sent(), credentials = _a.credentials, identityId = _a.identityId;
|
|
13
|
-
assertValidationError(!!credentials, AnalyticsValidationErrorCode.NoCredentials);
|
|
14
|
-
return [2 /*return*/, { credentials: credentials, identityId: identityId }];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}); };
|
|
5
|
+
export const resolveCredentials = async () => {
|
|
6
|
+
const { credentials, identityId } = await fetchAuthSession();
|
|
7
|
+
assertValidationError(!!credentials, AnalyticsValidationErrorCode.NoCredentials);
|
|
8
|
+
return { credentials, identityId };
|
|
9
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
let analyticsEnabled = true;
|
|
4
|
+
export const enableAnalytics = () => {
|
|
5
5
|
analyticsEnabled = true;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export const disableAnalytics = () => {
|
|
8
8
|
analyticsEnabled = false;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Returns the current status of the Analytics category.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export const isAnalyticsEnabled = () => analyticsEnabled;
|
|
@@ -4,7 +4,7 @@ import { AnalyticsValidationErrorCode, assertValidationError } from '../errors';
|
|
|
4
4
|
/**
|
|
5
5
|
* Validates tracker configuration.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export const validateTrackerConfiguration = (input) => {
|
|
8
8
|
assertValidationError(input.type === 'event' ||
|
|
9
9
|
input.type === 'pageView' ||
|
|
10
10
|
input.type === 'session', AnalyticsValidationErrorCode.InvalidTracker);
|
|
@@ -4,7 +4,7 @@ import { AnalyticsValidationErrorCode, assertValidationError } from '../errors';
|
|
|
4
4
|
/**
|
|
5
5
|
* Validates tracker configuration.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export const validateTrackerConfiguration = (input) => {
|
|
8
8
|
// React Native only supports session tracking
|
|
9
9
|
assertValidationError(input.type === 'session', AnalyticsValidationErrorCode.UnsupportedPlatform);
|
|
10
10
|
};
|
|
@@ -7,10 +7,10 @@ import { EventTracker, PageViewTracker, SessionTracker } from '../trackers';
|
|
|
7
7
|
* @remark
|
|
8
8
|
* This utility will mutate the provider's configured trackers via `providerTrackers`.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export const updateProviderTrackers = (input, providerEventRecorder, providerTrackers) => {
|
|
11
|
+
let trackerInstance;
|
|
12
|
+
const trackerType = input.type;
|
|
13
|
+
const currentTracker = providerTrackers[trackerType];
|
|
14
14
|
// Check if the tracker was disabled & should be cleaned up
|
|
15
15
|
if (!input.enable) {
|
|
16
16
|
if (currentTracker) {
|
|
@@ -4,12 +4,12 @@ import { Category, getAmplifyUserAgentObject, getAmplifyUserAgent, } from '@aws-
|
|
|
4
4
|
export function getAnalyticsUserAgent(action) {
|
|
5
5
|
return getAmplifyUserAgentObject({
|
|
6
6
|
category: Category.Analytics,
|
|
7
|
-
action
|
|
7
|
+
action,
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export function getAnalyticsUserAgentString(action) {
|
|
11
11
|
return getAmplifyUserAgent({
|
|
12
12
|
category: Category.Analytics,
|
|
13
|
-
action
|
|
13
|
+
action,
|
|
14
14
|
});
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/analytics",
|
|
3
|
-
"version": "7.0.1-api-v6-models.
|
|
3
|
+
"version": "7.0.1-api-v6-models.891fe0d.0+891fe0d",
|
|
4
4
|
"description": "Analytics category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -26,10 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"react-native": "./lib-esm/index.js",
|
|
28
28
|
"typesVersions": {
|
|
29
|
-
">=4.
|
|
30
|
-
"*": [
|
|
31
|
-
"./lib-esm/index.d.ts"
|
|
32
|
-
],
|
|
29
|
+
">=4.2": {
|
|
33
30
|
"pinpoint": [
|
|
34
31
|
"./lib-esm/providers/pinpoint/index.d.ts"
|
|
35
32
|
],
|
|
@@ -99,11 +96,11 @@
|
|
|
99
96
|
"tslib": "^2.5.0"
|
|
100
97
|
},
|
|
101
98
|
"peerDependencies": {
|
|
102
|
-
"@aws-amplify/core": "6.0.1-api-v6-models.
|
|
99
|
+
"@aws-amplify/core": "6.0.1-api-v6-models.891fe0d.0+891fe0d"
|
|
103
100
|
},
|
|
104
101
|
"devDependencies": {
|
|
105
|
-
"@aws-amplify/core": "6.0.1-api-v6-models.
|
|
106
|
-
"@aws-amplify/react-native": "1.0.1-api-v6-models.
|
|
102
|
+
"@aws-amplify/core": "6.0.1-api-v6-models.891fe0d.0+891fe0d",
|
|
103
|
+
"@aws-amplify/react-native": "1.0.1-api-v6-models.891fe0d.0+891fe0d",
|
|
107
104
|
"@aws-sdk/types": "3.398.0",
|
|
108
105
|
"typescript": "5.0.2"
|
|
109
106
|
},
|
|
@@ -151,5 +148,5 @@
|
|
|
151
148
|
"<rootDir>/src/setupTests.ts"
|
|
152
149
|
]
|
|
153
150
|
},
|
|
154
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "891fe0dc64e168de42b3b8d42def3eb9aed89efa"
|
|
155
152
|
}
|
|
@@ -66,10 +66,7 @@ export const getEventBuffer = ({
|
|
|
66
66
|
resendLimit,
|
|
67
67
|
userAgentValue,
|
|
68
68
|
}: KinesisEventBufferConfig): EventBuffer<KinesisBufferEvent> => {
|
|
69
|
-
const
|
|
70
|
-
const sessionIdentityKey = [region, sessionToken, identityId]
|
|
71
|
-
.filter(x => !!x)
|
|
72
|
-
.join('-');
|
|
69
|
+
const sessionIdentityKey = [region, identityId].filter(x => !!x).join('-');
|
|
73
70
|
|
|
74
71
|
if (!eventBufferMap[sessionIdentityKey]) {
|
|
75
72
|
const getKinesisClient = (): IAnalyticsClient<KinesisBufferEvent> => {
|
|
@@ -100,9 +97,11 @@ export const getEventBuffer = ({
|
|
|
100
97
|
x => x !== sessionIdentityKey
|
|
101
98
|
);
|
|
102
99
|
for (const releaseSessionKey of releaseSessionKeys) {
|
|
103
|
-
eventBufferMap[releaseSessionKey].
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
eventBufferMap[releaseSessionKey].flushAll().finally(() => {
|
|
101
|
+
eventBufferMap[releaseSessionKey].release();
|
|
102
|
+
delete eventBufferMap[releaseSessionKey];
|
|
103
|
+
delete cachedClients[releaseSessionKey];
|
|
104
|
+
});
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
|
|
@@ -75,10 +75,7 @@ export const getEventBuffer = ({
|
|
|
75
75
|
resendLimit,
|
|
76
76
|
userAgentValue,
|
|
77
77
|
}: KinesisFirehoseEventBufferConfig): EventBuffer<KinesisFirehoseBufferEvent> => {
|
|
78
|
-
const
|
|
79
|
-
const sessionIdentityKey = [region, sessionToken, identityId]
|
|
80
|
-
.filter(id => !!id)
|
|
81
|
-
.join('-');
|
|
78
|
+
const sessionIdentityKey = [region, identityId].filter(id => !!id).join('-');
|
|
82
79
|
|
|
83
80
|
if (!eventBufferMap[sessionIdentityKey]) {
|
|
84
81
|
const getClient = (): IAnalyticsClient<KinesisFirehoseBufferEvent> => {
|
|
@@ -108,9 +105,11 @@ export const getEventBuffer = ({
|
|
|
108
105
|
key => key !== sessionIdentityKey
|
|
109
106
|
);
|
|
110
107
|
for (const releaseSessionKey of releaseSessionKeys) {
|
|
111
|
-
eventBufferMap[releaseSessionKey].
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
eventBufferMap[releaseSessionKey].flushAll().finally(() => {
|
|
109
|
+
eventBufferMap[releaseSessionKey].release();
|
|
110
|
+
delete eventBufferMap[releaseSessionKey];
|
|
111
|
+
delete cachedClients[releaseSessionKey];
|
|
112
|
+
});
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
|
|
@@ -70,10 +70,7 @@ export const getEventBuffer = ({
|
|
|
70
70
|
identityId,
|
|
71
71
|
userAgentValue,
|
|
72
72
|
}: PersonalizeBufferConfig): EventBuffer<PersonalizeBufferEvent> => {
|
|
73
|
-
const
|
|
74
|
-
const sessionIdentityKey = [region, sessionToken, identityId]
|
|
75
|
-
.filter(x => !!x)
|
|
76
|
-
.join('-');
|
|
73
|
+
const sessionIdentityKey = [region, identityId].filter(x => !!x).join('-');
|
|
77
74
|
|
|
78
75
|
if (!eventBufferMap[sessionIdentityKey]) {
|
|
79
76
|
const getClient = (): IAnalyticsClient<PersonalizeBufferEvent> => {
|
|
@@ -101,9 +98,11 @@ export const getEventBuffer = ({
|
|
|
101
98
|
key => key !== sessionIdentityKey
|
|
102
99
|
);
|
|
103
100
|
for (const releaseSessionKey of releaseSessionKeys) {
|
|
104
|
-
eventBufferMap[releaseSessionKey].
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
eventBufferMap[releaseSessionKey].flushAll().finally(() => {
|
|
102
|
+
eventBufferMap[releaseSessionKey].release();
|
|
103
|
+
delete eventBufferMap[releaseSessionKey];
|
|
104
|
+
delete cachedClients[releaseSessionKey];
|
|
105
|
+
});
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import {
|
|
5
5
|
sessionListener,
|
|
6
6
|
SessionState,
|
|
7
|
+
SESSION_START_EVENT,
|
|
8
|
+
SESSION_STOP_EVENT,
|
|
7
9
|
} from '@aws-amplify/core/internals/utils';
|
|
8
10
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
9
11
|
import {
|
|
@@ -12,9 +14,6 @@ import {
|
|
|
12
14
|
TrackerInterface,
|
|
13
15
|
} from '../types/trackers';
|
|
14
16
|
|
|
15
|
-
const SESSION_START_EVENT = '_session.start';
|
|
16
|
-
const SESSION_STOP_EVENT = '_session.stop';
|
|
17
|
-
|
|
18
17
|
const logger = new ConsoleLogger('SessionTracker');
|
|
19
18
|
|
|
20
19
|
export class SessionTracker implements TrackerInterface {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import {
|
|
5
5
|
sessionListener,
|
|
6
6
|
SessionState,
|
|
7
|
+
SESSION_START_EVENT,
|
|
8
|
+
SESSION_STOP_EVENT,
|
|
7
9
|
} from '@aws-amplify/core/internals/utils';
|
|
8
10
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
9
11
|
import {
|
|
@@ -12,9 +14,6 @@ import {
|
|
|
12
14
|
TrackerInterface,
|
|
13
15
|
} from '../types/trackers';
|
|
14
16
|
|
|
15
|
-
const SESSION_START_EVENT = '_session.start';
|
|
16
|
-
const SESSION_STOP_EVENT = '_session.stop';
|
|
17
|
-
|
|
18
17
|
const logger = new ConsoleLogger('SessionTracker');
|
|
19
18
|
|
|
20
19
|
export class SessionTracker implements TrackerInterface {
|