@crimson-education/browser-logger 4.1.4 → 5.0.0-beta.10
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/README.md +81 -29
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -41
- package/lib/index.js.map +1 -1
- package/lib/logger/consoleTransport.d.ts +1 -1
- package/lib/logger/consoleTransport.d.ts.map +1 -1
- package/lib/logger/consoleTransport.js +16 -22
- package/lib/logger/consoleTransport.js.map +1 -1
- package/lib/logger/datadogTransport.d.ts +1 -1
- package/lib/logger/datadogTransport.d.ts.map +1 -1
- package/lib/logger/datadogTransport.js +4 -8
- package/lib/logger/datadogTransport.js.map +1 -1
- package/lib/logger/index.js +29 -49
- package/lib/logger/index.js.map +1 -1
- package/lib/logger/index.test.js +16 -18
- package/lib/logger/index.test.js.map +1 -1
- package/lib/logger/utils.js +4 -9
- package/lib/logger/utils.js.map +1 -1
- package/lib/reporters/amplifyReporter.d.ts +4 -4
- package/lib/reporters/amplifyReporter.d.ts.map +1 -1
- package/lib/reporters/amplifyReporter.js +210 -133
- package/lib/reporters/amplifyReporter.js.map +1 -1
- package/lib/reporters/amplifyReporter.test.js +9 -12
- package/lib/reporters/amplifyReporter.test.js.map +1 -1
- package/lib/reporters/datadogReporter.d.ts +1 -1
- package/lib/reporters/datadogReporter.d.ts.map +1 -1
- package/lib/reporters/datadogReporter.js +118 -48
- package/lib/reporters/datadogReporter.js.map +1 -1
- package/lib/reporters/gtmReporter.d.ts +1 -1
- package/lib/reporters/gtmReporter.d.ts.map +1 -1
- package/lib/reporters/gtmReporter.js +1 -5
- package/lib/reporters/gtmReporter.js.map +1 -1
- package/lib/reporters/index.js +46 -71
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/logReporter.js +24 -34
- package/lib/reporters/logReporter.js.map +1 -1
- package/lib/types/index.js +2 -18
- package/lib/types/index.js.map +1 -1
- package/lib/types/logger.d.ts +3 -3
- package/lib/types/logger.d.ts.map +1 -1
- package/lib/types/logger.js +2 -5
- package/lib/types/logger.js.map +1 -1
- package/lib/types/reporter.d.ts +6 -6
- package/lib/types/reporter.d.ts.map +1 -1
- package/lib/types/reporter.js +1 -2
- package/lib/utils.js +1 -5
- package/lib/utils.js.map +1 -1
- package/lib/utils.test.js +2 -4
- package/lib/utils.test.js.map +1 -1
- package/package.json +14 -16
- package/src/reporters/amplifyReporter.ts +233 -138
- package/src/reporters/datadogReporter.ts +107 -19
package/lib/logger/index.test.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const reporters_1 = require("../reporters");
|
|
6
|
-
const types_1 = require("../types");
|
|
1
|
+
import { createLogger, setLogLevel as setGlobalLogLevel, logTransports, consoleTransport } from '.';
|
|
2
|
+
import { init } from '..';
|
|
3
|
+
import { addMetadata, setUser } from '../reporters';
|
|
4
|
+
import { LogLevel } from '../types';
|
|
7
5
|
// This isn't actually asserting anything.
|
|
8
6
|
// But it ensures that the logs look correct, and no errors get thrown.
|
|
9
7
|
describe('logger', () => {
|
|
10
|
-
const logger =
|
|
8
|
+
const logger = createLogger({
|
|
11
9
|
metadata: {
|
|
12
10
|
service: 'test',
|
|
13
11
|
},
|
|
14
12
|
});
|
|
15
13
|
// Manually set the log transports.
|
|
16
|
-
|
|
17
|
-
const transport =
|
|
14
|
+
logTransports.length = 0;
|
|
15
|
+
const transport = consoleTransport({
|
|
18
16
|
// So we can see everything.
|
|
19
17
|
ignoreMetadataPatterns: [],
|
|
20
18
|
});
|
|
21
|
-
|
|
19
|
+
logTransports.push(transport);
|
|
22
20
|
it('should log', async () => {
|
|
23
21
|
logger.log({
|
|
24
22
|
level: 'info',
|
|
25
23
|
message: 'data',
|
|
26
24
|
});
|
|
27
25
|
logger.log({ data: 'obj' });
|
|
28
|
-
logger.log(
|
|
29
|
-
logger.log(
|
|
30
|
-
|
|
26
|
+
logger.log(LogLevel.Debug, 'level, message', { data: 'obj' });
|
|
27
|
+
logger.log(LogLevel.Debug, 'level, message, metadata', { data: 'obj' });
|
|
28
|
+
init({
|
|
31
29
|
service: 'test-service',
|
|
32
30
|
environment: 'test',
|
|
33
31
|
version: 'no-version',
|
|
@@ -41,17 +39,17 @@ describe('logger', () => {
|
|
|
41
39
|
const timer = logger.startTimer();
|
|
42
40
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
43
41
|
timer.done({ message: 'timer done', metadata: { id: 1 } });
|
|
44
|
-
(
|
|
45
|
-
|
|
42
|
+
setGlobalLogLevel(LogLevel.Info);
|
|
43
|
+
addMetadata({ global: 'metadata' });
|
|
46
44
|
logger.debug('You should not see this');
|
|
47
45
|
logger.info('You should see this with { global: "metadata" }');
|
|
48
|
-
(
|
|
49
|
-
|
|
46
|
+
setGlobalLogLevel(null);
|
|
47
|
+
setUser({
|
|
50
48
|
id: '123',
|
|
51
49
|
email: 'test@example.com',
|
|
52
50
|
});
|
|
53
51
|
logger.debug('debug call, user metadata');
|
|
54
|
-
transport.logLevel =
|
|
52
|
+
transport.logLevel = LogLevel.Info;
|
|
55
53
|
logger.debug('You should not see this');
|
|
56
54
|
logger.info('You should see this');
|
|
57
55
|
transport.logLevel = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/logger/index.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/logger/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,IAAI,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AACpG,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEp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AAC,UAAU,EAAE,CAAC;QAClC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAE3D,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QAEpC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QAE/D,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,CAAC;YACN,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,kBAAkB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAE1C,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/lib/logger/utils.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLogMessage = exports.isAboveLevel = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
1
|
+
import { LogLevel } from '../types';
|
|
5
2
|
/**
|
|
6
3
|
* Checks if a log level is above the global log level.
|
|
7
4
|
* @param level The log level to check
|
|
8
5
|
* @param checkLevel THe log level to check against
|
|
9
6
|
* @returns Is above the checkLevel?
|
|
10
7
|
*/
|
|
11
|
-
function isAboveLevel(level, checkLevel) {
|
|
12
|
-
const levels = [
|
|
8
|
+
export function isAboveLevel(level, checkLevel) {
|
|
9
|
+
const levels = [LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error];
|
|
13
10
|
return levels.indexOf(level) >= levels.indexOf(checkLevel);
|
|
14
11
|
}
|
|
15
|
-
exports.isAboveLevel = isAboveLevel;
|
|
16
12
|
/**
|
|
17
13
|
* Ensures a message output is a string.
|
|
18
14
|
* @param message The message to assert is/convert to a string
|
|
19
15
|
* @returns The message as a string
|
|
20
16
|
*/
|
|
21
|
-
function getLogMessage(message) {
|
|
17
|
+
export function getLogMessage(message) {
|
|
22
18
|
if (typeof message === 'string') {
|
|
23
19
|
return message;
|
|
24
20
|
}
|
|
@@ -28,5 +24,4 @@ function getLogMessage(message) {
|
|
|
28
24
|
}
|
|
29
25
|
return String(message);
|
|
30
26
|
}
|
|
31
|
-
exports.getLogMessage = getLogMessage;
|
|
32
27
|
//# sourceMappingURL=utils.js.map
|
package/lib/logger/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/logger/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/logger/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAe,EAAE,UAAoB;IAChE,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9E,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAY;IACxC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,OAAO,CAAC;KAChB;IACD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QACnD,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC7B;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IReporter, Metadata, ReporterConfigBase, ServiceInfo } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type AttributeMap = Record<string, string[] | string | null>;
|
|
3
|
+
type AmplifyAutoTrackSource = 'pageView' | 'event' | 'session';
|
|
4
4
|
export interface AmplifyReporterConfig extends ReporterConfigBase {
|
|
5
5
|
/**
|
|
6
6
|
* AWS Region for Amplify.
|
|
@@ -10,7 +10,7 @@ export interface AmplifyReporterConfig extends ReporterConfigBase {
|
|
|
10
10
|
* The Identity Pool Id to use for reporting, if set to false, Auth.configure is not called.
|
|
11
11
|
* This must be called manually for the reporter to work.
|
|
12
12
|
*/
|
|
13
|
-
identityPoolId: string
|
|
13
|
+
identityPoolId: string;
|
|
14
14
|
/**
|
|
15
15
|
* The Pinpoint App Id to report to.
|
|
16
16
|
*/
|
|
@@ -61,7 +61,7 @@ export interface AmplifyReporterConfig extends ReporterConfigBase {
|
|
|
61
61
|
*
|
|
62
62
|
* @see https://docs.amplify.aws/lib/analytics/getting-started/q/platform/js/#set-up-existing-analytics-backend
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
type AmplifyReporterBufferingConfig = {
|
|
65
65
|
/** Number of items to buffer for sending. */
|
|
66
66
|
bufferSize?: number;
|
|
67
67
|
/** Number of events sent each time Pinpoint flushes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amplifyReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,SAAS,EACT,QAAQ,EAER,kBAAkB,EAGlB,WAAW,EACZ,MAAM,UAAU,CAAC;AAMlB,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;AAE7D,KAAK,sBAAsB,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAkI/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,eAAe,CAAC,CAAC,MAAM,EAAE,sBAAsB,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEvE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;GAIG;AACH,KAAK,8BAA8B,GAAG;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAuF3F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,UAAO,GAAG,YAAY,CAqBhG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,SAAS,GAAE,MAAM,GAAG,SAAqB,EACzC,WAAW,UAAO,GACjB,YAAY,CA2Bd"}
|
|
@@ -1,24 +1,135 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { identifyUser, record } from '@aws-amplify/analytics';
|
|
2
|
+
import { logger } from '../logger';
|
|
3
|
+
// Note: fetchAuthSession was previously imported but unused; removing to satisfy linter
|
|
4
|
+
import { Amplify } from 'aws-amplify';
|
|
5
|
+
// Auto-tracking implementation for Gen2
|
|
6
|
+
class AmplifyAutoTracker {
|
|
7
|
+
config;
|
|
8
|
+
allMetadata;
|
|
9
|
+
currentUser = null;
|
|
10
|
+
sessionStartTime = Date.now();
|
|
11
|
+
pageViewCount = 0;
|
|
12
|
+
lastPageUrl = window.location.href;
|
|
13
|
+
isPageVisible = !document.hidden;
|
|
14
|
+
constructor(config, allMetadata) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.allMetadata = allMetadata;
|
|
17
|
+
this.setupEventListeners();
|
|
18
|
+
}
|
|
19
|
+
setupEventListeners() {
|
|
20
|
+
// Page visibility tracking
|
|
21
|
+
document.addEventListener('visibilitychange', () => {
|
|
22
|
+
this.isPageVisible = !document.hidden;
|
|
23
|
+
if (this.config.autoTrackSessions) {
|
|
24
|
+
this.trackSessionState();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// Page view tracking
|
|
28
|
+
if (this.config.autoTrackPageViews) {
|
|
29
|
+
this.trackPageView();
|
|
30
|
+
// Track route changes for SPAs
|
|
31
|
+
let currentUrl = window.location.href;
|
|
32
|
+
const observer = new MutationObserver(() => {
|
|
33
|
+
if (window.location.href !== currentUrl) {
|
|
34
|
+
currentUrl = window.location.href;
|
|
35
|
+
this.trackPageView();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
39
|
+
}
|
|
40
|
+
// User interaction tracking
|
|
41
|
+
if (this.config.autoTrackEvents) {
|
|
42
|
+
this.setupInteractionTracking();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
trackPageView() {
|
|
46
|
+
this.pageViewCount++;
|
|
47
|
+
const pageViewEvent = {
|
|
48
|
+
message: 'Page View',
|
|
49
|
+
metadata: {
|
|
50
|
+
url: window.location.href,
|
|
51
|
+
title: document.title,
|
|
52
|
+
referrer: document.referrer,
|
|
53
|
+
pageViewCount: this.pageViewCount,
|
|
54
|
+
...this.getAutoTrackMetadata('pageView'),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
record({
|
|
58
|
+
name: pageViewEvent.message,
|
|
59
|
+
attributes: asAttributeMap(pageViewEvent.metadata, false),
|
|
16
60
|
});
|
|
17
61
|
}
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
62
|
+
trackSessionState() {
|
|
63
|
+
const sessionDuration = Date.now() - this.sessionStartTime;
|
|
64
|
+
const sessionEvent = {
|
|
65
|
+
message: this.isPageVisible ? 'Session Active' : 'Session Inactive',
|
|
66
|
+
metadata: {
|
|
67
|
+
sessionDuration,
|
|
68
|
+
isVisible: this.isPageVisible,
|
|
69
|
+
...this.getAutoTrackMetadata('session'),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
record({
|
|
73
|
+
name: sessionEvent.message,
|
|
74
|
+
attributes: asAttributeMap(sessionEvent.metadata, false),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
setupInteractionTracking() {
|
|
78
|
+
const selectorPrefix = this.config.selectorPrefix ?? 'data-analytics-';
|
|
79
|
+
document.addEventListener('click', (event) => {
|
|
80
|
+
const target = event.target;
|
|
81
|
+
if (!target)
|
|
82
|
+
return;
|
|
83
|
+
// Find the closest element with analytics attributes
|
|
84
|
+
const analyticsElement = target.closest(`[${selectorPrefix}name]`);
|
|
85
|
+
if (!analyticsElement)
|
|
86
|
+
return;
|
|
87
|
+
const analyticsName = analyticsElement.getAttribute(`${selectorPrefix}name`);
|
|
88
|
+
if (!analyticsName)
|
|
89
|
+
return;
|
|
90
|
+
const interactionEvent = {
|
|
91
|
+
message: 'User Interaction',
|
|
92
|
+
metadata: {
|
|
93
|
+
elementName: analyticsName,
|
|
94
|
+
elementType: target.tagName.toLowerCase(),
|
|
95
|
+
elementText: target.textContent?.slice(0, 100),
|
|
96
|
+
interactionType: 'click',
|
|
97
|
+
...this.getAutoTrackMetadata('event'),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
record({
|
|
101
|
+
name: interactionEvent.message,
|
|
102
|
+
attributes: asAttributeMap(interactionEvent.metadata, false),
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
getAutoTrackMetadata(source) {
|
|
107
|
+
const { beforeAutoTrack } = this.config;
|
|
108
|
+
return typeof beforeAutoTrack === 'function' ? (beforeAutoTrack(source) ?? {}) : {};
|
|
109
|
+
}
|
|
110
|
+
setUser(user) {
|
|
111
|
+
this.currentUser = user;
|
|
112
|
+
}
|
|
113
|
+
updateMetadata(metadata) {
|
|
114
|
+
Object.assign(this.allMetadata, metadata);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export function amplifyReporter(info, config) {
|
|
118
|
+
Amplify.configure({
|
|
119
|
+
Auth: {
|
|
120
|
+
Cognito: {
|
|
121
|
+
identityPoolId: config.identityPoolId,
|
|
122
|
+
allowGuestAccess: true,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
Analytics: {
|
|
126
|
+
Pinpoint: {
|
|
127
|
+
appId: config.analyticsAppId,
|
|
128
|
+
region: config.region,
|
|
129
|
+
...config.buffering,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
});
|
|
22
133
|
const allMetadata = asAttributeMap({
|
|
23
134
|
appName: info.service,
|
|
24
135
|
service: info.service,
|
|
@@ -26,51 +137,20 @@ function amplifyReporter(info, config) {
|
|
|
26
137
|
environment: info.environment,
|
|
27
138
|
version: info.version,
|
|
28
139
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
appId: config.analyticsAppId,
|
|
32
|
-
endpoint: {
|
|
33
|
-
attributes: allMetadata,
|
|
34
|
-
},
|
|
35
|
-
...config.buffering,
|
|
36
|
-
});
|
|
37
|
-
// Session autotracking is enabled by default for backwards compatibility reasons, so we _must_
|
|
38
|
-
// call this unconditionally to ensure we opt out of session tracking when `autoTrackSessions` isn't set
|
|
39
|
-
// See: https://docs.amplify.aws/lib/analytics/autotrack/q/platform/js/#session-tracking
|
|
40
|
-
analytics_1.Analytics.autoTrack('session', {
|
|
41
|
-
enable: config.autoTrackSessions === true,
|
|
42
|
-
attributes: wrapAutoTrackMiddleware('session'),
|
|
43
|
-
});
|
|
44
|
-
if (config.autoTrackPageViews) {
|
|
45
|
-
analytics_1.Analytics.autoTrack('pageView', {
|
|
46
|
-
enable: true,
|
|
47
|
-
eventName: 'pageView',
|
|
48
|
-
type: 'SPA',
|
|
49
|
-
provider: 'AWSPinpoint',
|
|
50
|
-
attributes: wrapAutoTrackMiddleware('pageView'),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
if (config.autoTrackEvents) {
|
|
54
|
-
analytics_1.Analytics.autoTrack('event', {
|
|
55
|
-
enable: true,
|
|
56
|
-
selectorPrefix: (_a = config.selectorPrefix) !== null && _a !== void 0 ? _a : 'data-analytics-',
|
|
57
|
-
attributes: wrapAutoTrackMiddleware('event'),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
140
|
+
// Initialize auto-tracker for Gen2
|
|
141
|
+
const autoTracker = new AmplifyAutoTracker(config, allMetadata);
|
|
60
142
|
if (config.proxyUrl) {
|
|
61
|
-
installPinpointProxy(new URL(config.proxyUrl));
|
|
143
|
+
// installPinpointProxy(new URL(config.proxyUrl));
|
|
62
144
|
}
|
|
63
145
|
const reporter = {
|
|
64
146
|
trackEvent: function (event) {
|
|
65
|
-
|
|
147
|
+
record({
|
|
66
148
|
name: event.message,
|
|
67
149
|
attributes: asAttributeMap({
|
|
68
150
|
...event.metadata,
|
|
69
151
|
...event.tags,
|
|
70
152
|
}, false),
|
|
71
153
|
metrics: event.metrics,
|
|
72
|
-
}).catch(() => {
|
|
73
|
-
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
74
154
|
});
|
|
75
155
|
},
|
|
76
156
|
addBreadcrumb: function (breadcrumb) {
|
|
@@ -84,33 +164,25 @@ function amplifyReporter(info, config) {
|
|
|
84
164
|
},
|
|
85
165
|
addMetadata: function (metadata) {
|
|
86
166
|
Object.assign(allMetadata, asAttributeMap(metadata, true));
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
91
|
-
});
|
|
167
|
+
autoTracker.updateMetadata(asAttributeMap(metadata, true));
|
|
168
|
+
// Note: updateEndpoint is not available in Amplify v7
|
|
169
|
+
// Metadata updates would need to be handled differently
|
|
92
170
|
},
|
|
93
171
|
setUser: function (user) {
|
|
94
|
-
var _a, _b;
|
|
95
172
|
const userMetadata = user
|
|
96
173
|
? asAttributeMap({
|
|
97
174
|
userId: user.id,
|
|
98
175
|
})
|
|
99
176
|
: {};
|
|
100
177
|
Object.assign(allMetadata, asAttributeMap(userMetadata, true));
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
username: user.username,
|
|
110
|
-
})
|
|
111
|
-
: {},
|
|
112
|
-
}).catch(() => {
|
|
113
|
-
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
178
|
+
autoTracker.setUser(user);
|
|
179
|
+
// Note: updateEndpoint is not available in Amplify v7
|
|
180
|
+
// User updates would need to be handled differently
|
|
181
|
+
identifyUser({
|
|
182
|
+
userId: user?.id ?? '',
|
|
183
|
+
userProfile: {
|
|
184
|
+
email: user?.email,
|
|
185
|
+
},
|
|
114
186
|
});
|
|
115
187
|
},
|
|
116
188
|
setRouteName: function (routeName) {
|
|
@@ -122,41 +194,43 @@ function amplifyReporter(info, config) {
|
|
|
122
194
|
};
|
|
123
195
|
return reporter;
|
|
124
196
|
}
|
|
125
|
-
exports.amplifyReporter = amplifyReporter;
|
|
126
197
|
/**
|
|
127
198
|
* Pinpoint has strict attribute name and value length limits
|
|
128
199
|
*/
|
|
129
|
-
function asAttributeMap(values, groupValues = true) {
|
|
200
|
+
export function asAttributeMap(values, groupValues = true) {
|
|
130
201
|
const attributeMap = buildAttributeMap(values, undefined, groupValues);
|
|
131
202
|
const checkedEntries = Object.entries(attributeMap).map(([key, value]) => {
|
|
132
|
-
var _a, _b;
|
|
133
203
|
const truncatedKey = key.length > 50 ? `___${key.slice(-47)}` : key;
|
|
134
204
|
const truncatedValue = Array.isArray(value)
|
|
135
|
-
? (
|
|
136
|
-
: (
|
|
205
|
+
? (value?.map((val) => val.slice(0, 100)) ?? null)
|
|
206
|
+
: (value?.slice(0, 100) ?? null);
|
|
137
207
|
return [truncatedKey, truncatedValue];
|
|
138
208
|
});
|
|
139
209
|
// Pinpoint only accepts 40 attributes
|
|
140
210
|
if (checkedEntries.length > 40) {
|
|
141
|
-
|
|
211
|
+
logger.error(`Amplify only allows 40 attributes per event, truncating to 40 attributes`, {
|
|
142
212
|
attributes: checkedEntries,
|
|
143
213
|
});
|
|
144
214
|
checkedEntries.length = 40;
|
|
145
215
|
}
|
|
146
216
|
return Object.fromEntries(checkedEntries);
|
|
147
217
|
}
|
|
148
|
-
exports.asAttributeMap = asAttributeMap;
|
|
149
218
|
/**
|
|
150
219
|
* Pinpoint expects `endpoint.attributes` and `endpoint.userAttributes` to have
|
|
151
220
|
* values which are string arrays. This function takes in an object and ensures
|
|
152
221
|
* all of its values are of type `string[]` to appease Pinpoint.
|
|
153
222
|
*/
|
|
154
|
-
function buildAttributeMap(values, parentKey = undefined, groupValues = true) {
|
|
223
|
+
export function buildAttributeMap(values, parentKey = undefined, groupValues = true) {
|
|
155
224
|
const valuesWithStringArrays = {};
|
|
156
225
|
Object.entries(values).forEach(([key, value]) => {
|
|
157
226
|
const combinedKey = parentKey ? [parentKey, key].join('.') : key;
|
|
158
|
-
|
|
159
|
-
|
|
227
|
+
// Only treat undefined or null as empty; avoid converting falsy values like ''/0/false to null
|
|
228
|
+
if (value === undefined || value === null) {
|
|
229
|
+
// For event attributes (groupValues === false), Pinpoint rejects null values.
|
|
230
|
+
// In that case we omit the key entirely to avoid "Event attribute value can not be null".
|
|
231
|
+
if (groupValues) {
|
|
232
|
+
valuesWithStringArrays[combinedKey] = null;
|
|
233
|
+
}
|
|
160
234
|
}
|
|
161
235
|
else if (groupValues && Array.isArray(value)) {
|
|
162
236
|
valuesWithStringArrays[combinedKey] = value.map((element) => typeof element === 'string' ? element : JSON.stringify(element));
|
|
@@ -172,54 +246,57 @@ function buildAttributeMap(values, parentKey = undefined, groupValues = true) {
|
|
|
172
246
|
});
|
|
173
247
|
return valuesWithStringArrays;
|
|
174
248
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
249
|
+
// function installPinpointProxy(proxyUrl: URL) {
|
|
250
|
+
// // No public API for overriding where the Pinpoint client sends events to... 🤮
|
|
251
|
+
// // In theory you can pass in an `endpoint` to the Pinpoint client's constructor like any other AWS
|
|
252
|
+
// // client, but Amplify's analytics doesn't expose anything we can use to get an endpoint threaded
|
|
253
|
+
// // down to the Pinpoint client's constructor.
|
|
254
|
+
// //
|
|
255
|
+
// // The Pinpoint client _also_ isn't available synchronously because it is instantiated when events
|
|
256
|
+
// // get sent out, and then reconfigured whenever the API credentials change. We need to hook `_initClients`
|
|
257
|
+
// // to ensure that the Pinpoint client being used is always patched with our custom endpoint.
|
|
258
|
+
// const provider = (globalThis as any).Analytics?.getPluggable?.('AWSPinpoint') as any;
|
|
259
|
+
// if (!provider || typeof provider._initClients !== 'function') {
|
|
260
|
+
// logger.error(
|
|
261
|
+
// 'Installation of the Pinpoint proxy failed. This likely means the internals of the @aws-amplify/analytics package have changed.',
|
|
262
|
+
// );
|
|
263
|
+
// return;
|
|
264
|
+
// }
|
|
265
|
+
// const originalInitClients = provider._initClients;
|
|
266
|
+
// const requestMiddleware: FinalizeRequestMiddleware<ServiceInputTypes, ServiceOutputTypes> =
|
|
267
|
+
// (next) => async (args) => {
|
|
268
|
+
// const pinpointClient = provider.pinpointClient as PinpointClient | undefined;
|
|
269
|
+
// if (pinpointClient && proxyUrl.pathname !== '/' && HttpRequest.isInstance(args.request)) {
|
|
270
|
+
// // Add proxyUrl.pathname to final request url if it was provided
|
|
271
|
+
// const shouldStripSlash = proxyUrl.pathname.endsWith('/');
|
|
272
|
+
// args.request.path = `${proxyUrl.pathname}${args.request.path.slice(shouldStripSlash ? 1 : 0)}`;
|
|
273
|
+
// // Wrap request body so the proxy has signing info
|
|
274
|
+
// if (typeof args.request.body === 'string') {
|
|
275
|
+
// const credentials = await pinpointClient.config.credentials();
|
|
276
|
+
// args.request.body = JSON.stringify({
|
|
277
|
+
// credentials,
|
|
278
|
+
// data: JSON.parse(args.request.body),
|
|
279
|
+
// });
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
|
+
// return next(args);
|
|
283
|
+
// };
|
|
284
|
+
// provider._initClients = async (credentials: unknown) => {
|
|
285
|
+
// const result = await originalInitClients.call(provider, credentials);
|
|
286
|
+
// const pinpointClient = provider.pinpointClient as PinpointClient | undefined;
|
|
287
|
+
// if (pinpointClient) {
|
|
288
|
+
// pinpointClient.config.endpoint = (): Promise<Endpoint> =>
|
|
289
|
+
// Promise.resolve({
|
|
290
|
+
// hostname: proxyUrl.hostname,
|
|
291
|
+
// // Passing proxyUrl.pathname here doesn't work; it gets overridden
|
|
292
|
+
// path: '/',
|
|
293
|
+
// port: undefined,
|
|
294
|
+
// protocol: proxyUrl.protocol,
|
|
295
|
+
// });
|
|
296
|
+
// pinpointClient.middlewareStack.remove(requestMiddleware);
|
|
297
|
+
// pinpointClient.middlewareStack.add(requestMiddleware, { step: 'finalizeRequest' });
|
|
298
|
+
// }
|
|
299
|
+
// return result;
|
|
300
|
+
// };
|
|
301
|
+
// }
|
|
225
302
|
//# sourceMappingURL=amplifyReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAc9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,wFAAwF;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtC,wCAAwC;AACxC,MAAM,kBAAkB;IACd,MAAM,CAAwB;IAC9B,WAAW,CAAe;IAC1B,WAAW,GAAsB,IAAI,CAAC;IACtC,gBAAgB,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,aAAa,GAAW,CAAC,CAAC;IAC1B,WAAW,GAAW,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3C,aAAa,GAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;IAElD,YAAY,MAA6B,EAAE,WAAyB;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAEO,mBAAmB;QACzB,2BAA2B;QAC3B,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;YACjD,IAAI,CAAC,aAAa,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;gBACjC,IAAI,CAAC,iBAAiB,EAAE,CAAC;aAC1B;QACH,CAAC,CAAC,CAAC;QAEH,qBAAqB;QACrB,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAClC,IAAI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