@crimson-education/browser-logger 5.0.1-beta.2 → 5.0.1-beta.4
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 +63 -85
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +46 -22
- 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 +22 -16
- 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 +8 -4
- package/lib/logger/datadogTransport.js.map +1 -1
- package/lib/logger/index.js +49 -29
- package/lib/logger/index.js.map +1 -1
- package/lib/logger/index.test.js +18 -16
- package/lib/logger/index.test.js.map +1 -1
- package/lib/logger/utils.js +9 -4
- 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 +133 -230
- package/lib/reporters/amplifyReporter.js.map +1 -1
- package/lib/reporters/amplifyReporter.test.js +12 -9
- package/lib/reporters/amplifyReporter.test.js.map +1 -1
- package/lib/reporters/datadogReporter.d.ts +1 -13
- package/lib/reporters/datadogReporter.d.ts.map +1 -1
- package/lib/reporters/datadogReporter.js +49 -122
- 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 +5 -1
- package/lib/reporters/gtmReporter.js.map +1 -1
- package/lib/reporters/index.js +71 -46
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/logReporter.js +34 -24
- package/lib/reporters/logReporter.js.map +1 -1
- package/lib/reporters/posthogReporter.d.ts +51 -0
- package/lib/reporters/posthogReporter.d.ts.map +1 -0
- package/lib/reporters/posthogReporter.js +254 -0
- package/lib/reporters/posthogReporter.js.map +1 -0
- package/lib/reporters/posthogReporter.test.d.ts +2 -0
- package/lib/reporters/posthogReporter.test.d.ts.map +1 -0
- package/lib/reporters/posthogReporter.test.js +197 -0
- package/lib/reporters/posthogReporter.test.js.map +1 -0
- package/lib/types/index.js +18 -2
- 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 +5 -2
- package/lib/types/logger.js.map +1 -1
- package/lib/types/reporter.d.ts +14 -6
- package/lib/types/reporter.d.ts.map +1 -1
- package/lib/types/reporter.js +2 -1
- package/lib/utils.js +5 -1
- package/lib/utils.js.map +1 -1
- package/lib/utils.test.js +4 -2
- package/lib/utils.test.js.map +1 -1
- package/package.json +17 -15
- package/src/index.ts +6 -0
- package/src/reporters/amplifyReporter.ts +140 -264
- package/src/reporters/datadogReporter.ts +22 -133
- package/src/reporters/posthogReporter.test.ts +244 -0
- package/src/reporters/posthogReporter.ts +374 -0
- package/src/types/reporter.ts +9 -0
|
@@ -1,148 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
// Delay initial page view to ensure Amplify is fully configured
|
|
30
|
-
// Using setTimeout(0) to defer to the next event loop tick
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
this.trackPageView();
|
|
33
|
-
}, 0);
|
|
34
|
-
// Track route changes for SPAs
|
|
35
|
-
let currentUrl = window.location.href;
|
|
36
|
-
const observer = new MutationObserver(() => {
|
|
37
|
-
if (window.location.href !== currentUrl) {
|
|
38
|
-
currentUrl = window.location.href;
|
|
39
|
-
this.trackPageView();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
43
|
-
}
|
|
44
|
-
// User interaction tracking
|
|
45
|
-
if (this.config.autoTrackEvents) {
|
|
46
|
-
this.setupInteractionTracking();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
trackPageView() {
|
|
50
|
-
this.pageViewCount++;
|
|
51
|
-
const pageViewEvent = {
|
|
52
|
-
message: 'Page View',
|
|
53
|
-
metadata: {
|
|
54
|
-
url: window.location.href,
|
|
55
|
-
title: document.title,
|
|
56
|
-
referrer: document.referrer,
|
|
57
|
-
pageViewCount: this.pageViewCount,
|
|
58
|
-
...this.getAutoTrackMetadata('pageView'),
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
record({
|
|
62
|
-
name: pageViewEvent.message,
|
|
63
|
-
attributes: asAttributeMap({
|
|
64
|
-
...this.allMetadata,
|
|
65
|
-
...pageViewEvent.metadata,
|
|
66
|
-
}, false),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
trackSessionState() {
|
|
70
|
-
const sessionDuration = Date.now() - this.sessionStartTime;
|
|
71
|
-
const sessionEvent = {
|
|
72
|
-
message: this.isPageVisible ? 'Session Active' : 'Session Inactive',
|
|
73
|
-
metadata: {
|
|
74
|
-
sessionDuration,
|
|
75
|
-
isVisible: this.isPageVisible,
|
|
76
|
-
...this.getAutoTrackMetadata('session'),
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
record({
|
|
80
|
-
name: sessionEvent.message,
|
|
81
|
-
attributes: asAttributeMap({
|
|
82
|
-
...this.allMetadata,
|
|
83
|
-
...sessionEvent.metadata,
|
|
84
|
-
}, false),
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAttributeMap = exports.asAttributeMap = exports.amplifyReporter = void 0;
|
|
4
|
+
const auth_1 = require("@aws-amplify/auth");
|
|
5
|
+
const analytics_1 = require("@aws-amplify/analytics");
|
|
6
|
+
const protocol_http_1 = require("@aws-sdk/protocol-http");
|
|
7
|
+
const logger_1 = require("../logger");
|
|
8
|
+
function amplifyReporter(info, config) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (config.identityPoolId !== false) {
|
|
11
|
+
auth_1.Auth.configure({
|
|
12
|
+
region: config.region,
|
|
13
|
+
identityPoolId: config.identityPoolId,
|
|
14
|
+
userPoolId: config.userPoolId,
|
|
15
|
+
userPoolWebClientId: config.userPoolWebClientId,
|
|
85
16
|
});
|
|
86
17
|
}
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (!target)
|
|
92
|
-
return;
|
|
93
|
-
// Find the closest element with analytics attributes
|
|
94
|
-
const analyticsElement = target.closest(`[${selectorPrefix}name]`);
|
|
95
|
-
if (!analyticsElement)
|
|
96
|
-
return;
|
|
97
|
-
const analyticsName = analyticsElement.getAttribute(`${selectorPrefix}name`);
|
|
98
|
-
if (!analyticsName)
|
|
99
|
-
return;
|
|
100
|
-
const interactionEvent = {
|
|
101
|
-
message: 'User Interaction',
|
|
102
|
-
metadata: {
|
|
103
|
-
elementName: analyticsName,
|
|
104
|
-
elementType: target.tagName.toLowerCase(),
|
|
105
|
-
elementText: target.textContent?.slice(0, 100),
|
|
106
|
-
interactionType: 'click',
|
|
107
|
-
...this.getAutoTrackMetadata('event'),
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
record({
|
|
111
|
-
name: interactionEvent.message,
|
|
112
|
-
attributes: asAttributeMap({
|
|
113
|
-
...this.allMetadata,
|
|
114
|
-
...interactionEvent.metadata,
|
|
115
|
-
}, false),
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
getAutoTrackMetadata(source) {
|
|
120
|
-
const { beforeAutoTrack } = this.config;
|
|
121
|
-
return typeof beforeAutoTrack === 'function' ? (beforeAutoTrack(source) ?? {}) : {};
|
|
122
|
-
}
|
|
123
|
-
setUser(user) {
|
|
124
|
-
this.currentUser = user;
|
|
125
|
-
}
|
|
126
|
-
updateMetadata(metadata) {
|
|
127
|
-
Object.assign(this.allMetadata, metadata);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export function amplifyReporter(info, config) {
|
|
131
|
-
Amplify.configure({
|
|
132
|
-
Auth: {
|
|
133
|
-
Cognito: {
|
|
134
|
-
identityPoolId: config.identityPoolId,
|
|
135
|
-
allowGuestAccess: true,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
Analytics: {
|
|
139
|
-
Pinpoint: {
|
|
140
|
-
appId: config.analyticsAppId,
|
|
141
|
-
region: config.region,
|
|
142
|
-
...config.buffering,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
});
|
|
18
|
+
const wrapAutoTrackMiddleware = (source) => {
|
|
19
|
+
const { beforeAutoTrack } = config;
|
|
20
|
+
return typeof beforeAutoTrack === 'function' ? () => { var _a; return (_a = beforeAutoTrack(source)) !== null && _a !== void 0 ? _a : {}; } : undefined;
|
|
21
|
+
};
|
|
146
22
|
const allMetadata = asAttributeMap({
|
|
147
23
|
appName: info.service,
|
|
148
24
|
service: info.service,
|
|
@@ -150,21 +26,51 @@ export function amplifyReporter(info, config) {
|
|
|
150
26
|
environment: info.environment,
|
|
151
27
|
version: info.version,
|
|
152
28
|
});
|
|
153
|
-
|
|
154
|
-
|
|
29
|
+
analytics_1.Analytics.configure({
|
|
30
|
+
region: config.region,
|
|
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
|
+
}
|
|
155
60
|
if (config.proxyUrl) {
|
|
156
|
-
|
|
61
|
+
installPinpointProxy(new URL(config.proxyUrl));
|
|
157
62
|
}
|
|
158
63
|
const reporter = {
|
|
159
64
|
trackEvent: function (event) {
|
|
160
|
-
record({
|
|
65
|
+
analytics_1.Analytics.record({
|
|
161
66
|
name: event.message,
|
|
162
67
|
attributes: asAttributeMap({
|
|
163
|
-
...allMetadata,
|
|
164
68
|
...event.metadata,
|
|
165
69
|
...event.tags,
|
|
166
70
|
}, false),
|
|
167
71
|
metrics: event.metrics,
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
168
74
|
});
|
|
169
75
|
},
|
|
170
76
|
addBreadcrumb: function (breadcrumb) {
|
|
@@ -178,32 +84,34 @@ export function amplifyReporter(info, config) {
|
|
|
178
84
|
},
|
|
179
85
|
addMetadata: function (metadata) {
|
|
180
86
|
Object.assign(allMetadata, asAttributeMap(metadata, true));
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
87
|
+
analytics_1.Analytics.updateEndpoint({
|
|
88
|
+
attributes: allMetadata,
|
|
89
|
+
}).catch(() => {
|
|
90
|
+
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
91
|
+
});
|
|
184
92
|
},
|
|
185
93
|
setUser: function (user) {
|
|
94
|
+
var _a, _b;
|
|
186
95
|
const userMetadata = user
|
|
187
96
|
? asAttributeMap({
|
|
188
97
|
userId: user.id,
|
|
189
98
|
})
|
|
190
99
|
: {};
|
|
191
100
|
Object.assign(allMetadata, asAttributeMap(userMetadata, true));
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
userProfile: {
|
|
101
|
+
analytics_1.Analytics.updateEndpoint({
|
|
102
|
+
userId: (_a = user === null || user === void 0 ? void 0 : user.id) !== null && _a !== void 0 ? _a : '',
|
|
103
|
+
attributes: allMetadata,
|
|
104
|
+
userAttributes: user
|
|
105
|
+
? asAttributeMap({
|
|
106
|
+
id: user.id,
|
|
199
107
|
email: user.email,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
108
|
+
name: (_b = user.name) !== null && _b !== void 0 ? _b : user.email,
|
|
109
|
+
username: user.username,
|
|
110
|
+
})
|
|
111
|
+
: {},
|
|
112
|
+
}).catch(() => {
|
|
113
|
+
// Swallow; see: https://crimsonhq.slack.com/archives/G4UN6Q4KF/p1648599302847539
|
|
114
|
+
});
|
|
207
115
|
},
|
|
208
116
|
setRouteName: function (routeName) {
|
|
209
117
|
reporter.addMetadata({ routeName });
|
|
@@ -214,43 +122,41 @@ export function amplifyReporter(info, config) {
|
|
|
214
122
|
};
|
|
215
123
|
return reporter;
|
|
216
124
|
}
|
|
125
|
+
exports.amplifyReporter = amplifyReporter;
|
|
217
126
|
/**
|
|
218
127
|
* Pinpoint has strict attribute name and value length limits
|
|
219
128
|
*/
|
|
220
|
-
|
|
129
|
+
function asAttributeMap(values, groupValues = true) {
|
|
221
130
|
const attributeMap = buildAttributeMap(values, undefined, groupValues);
|
|
222
131
|
const checkedEntries = Object.entries(attributeMap).map(([key, value]) => {
|
|
132
|
+
var _a, _b;
|
|
223
133
|
const truncatedKey = key.length > 50 ? `___${key.slice(-47)}` : key;
|
|
224
134
|
const truncatedValue = Array.isArray(value)
|
|
225
|
-
? (value
|
|
226
|
-
: (value
|
|
135
|
+
? (_a = value === null || value === void 0 ? void 0 : value.map((val) => val.slice(0, 100))) !== null && _a !== void 0 ? _a : null
|
|
136
|
+
: (_b = value === null || value === void 0 ? void 0 : value.slice(0, 100)) !== null && _b !== void 0 ? _b : null;
|
|
227
137
|
return [truncatedKey, truncatedValue];
|
|
228
138
|
});
|
|
229
139
|
// Pinpoint only accepts 40 attributes
|
|
230
140
|
if (checkedEntries.length > 40) {
|
|
231
|
-
logger.error(`Amplify only allows 40 attributes per event, truncating to 40 attributes`, {
|
|
141
|
+
logger_1.logger.error(`Amplify only allows 40 attributes per event, truncating to 40 attributes`, {
|
|
232
142
|
attributes: checkedEntries,
|
|
233
143
|
});
|
|
234
144
|
checkedEntries.length = 40;
|
|
235
145
|
}
|
|
236
146
|
return Object.fromEntries(checkedEntries);
|
|
237
147
|
}
|
|
148
|
+
exports.asAttributeMap = asAttributeMap;
|
|
238
149
|
/**
|
|
239
150
|
* Pinpoint expects `endpoint.attributes` and `endpoint.userAttributes` to have
|
|
240
151
|
* values which are string arrays. This function takes in an object and ensures
|
|
241
152
|
* all of its values are of type `string[]` to appease Pinpoint.
|
|
242
153
|
*/
|
|
243
|
-
|
|
154
|
+
function buildAttributeMap(values, parentKey = undefined, groupValues = true) {
|
|
244
155
|
const valuesWithStringArrays = {};
|
|
245
156
|
Object.entries(values).forEach(([key, value]) => {
|
|
246
157
|
const combinedKey = parentKey ? [parentKey, key].join('.') : key;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
// For event attributes (groupValues === false), Pinpoint rejects null values.
|
|
250
|
-
// In that case we omit the key entirely to avoid "Event attribute value can not be null".
|
|
251
|
-
if (groupValues) {
|
|
252
|
-
valuesWithStringArrays[combinedKey] = null;
|
|
253
|
-
}
|
|
158
|
+
if (!value) {
|
|
159
|
+
valuesWithStringArrays[combinedKey] = null;
|
|
254
160
|
}
|
|
255
161
|
else if (groupValues && Array.isArray(value)) {
|
|
256
162
|
valuesWithStringArrays[combinedKey] = value.map((element) => typeof element === 'string' ? element : JSON.stringify(element));
|
|
@@ -266,57 +172,54 @@ export function buildAttributeMap(values, parentKey = undefined, groupValues = t
|
|
|
266
172
|
});
|
|
267
173
|
return valuesWithStringArrays;
|
|
268
174
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
-
//
|
|
276
|
-
//
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
//
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
//
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
// return result;
|
|
320
|
-
// };
|
|
321
|
-
// }
|
|
175
|
+
exports.buildAttributeMap = buildAttributeMap;
|
|
176
|
+
function installPinpointProxy(proxyUrl) {
|
|
177
|
+
// No public API for overriding where the Pinpoint client sends events to... 🤮
|
|
178
|
+
// In theory you can pass in an `endpoint` to the Pinpoint client's constructor like any other AWS
|
|
179
|
+
// client, but Amplify's analytics doesn't expose anything we can use to get an endpoint threaded
|
|
180
|
+
// down to the Pinpoint client's constructor.
|
|
181
|
+
//
|
|
182
|
+
// The Pinpoint client _also_ isn't available synchronously because it is instantiated when events
|
|
183
|
+
// get sent out, and then reconfigured whenever the API credentials change. We need to hook `_initClients`
|
|
184
|
+
// to ensure that the Pinpoint client being used is always patched with our custom endpoint.
|
|
185
|
+
const provider = analytics_1.Analytics.getPluggable('AWSPinpoint');
|
|
186
|
+
if (!provider || typeof provider._initClients !== 'function') {
|
|
187
|
+
logger_1.logger.error('Installation of the Pinpoint proxy failed. This likely means the internals of the @aws-amplify/analytics package have changed.');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const originalInitClients = provider._initClients;
|
|
191
|
+
const requestMiddleware = (next) => async (args) => {
|
|
192
|
+
const pinpointClient = provider.pinpointClient;
|
|
193
|
+
if (pinpointClient && proxyUrl.pathname !== '/' && protocol_http_1.HttpRequest.isInstance(args.request)) {
|
|
194
|
+
// Add proxyUrl.pathname to final request url if it was provided
|
|
195
|
+
const shouldStripSlash = proxyUrl.pathname.endsWith('/');
|
|
196
|
+
args.request.path = `${proxyUrl.pathname}${args.request.path.slice(shouldStripSlash ? 1 : 0)}`;
|
|
197
|
+
// Wrap request body so the proxy has signing info
|
|
198
|
+
if (typeof args.request.body === 'string') {
|
|
199
|
+
const credentials = await pinpointClient.config.credentials();
|
|
200
|
+
args.request.body = JSON.stringify({
|
|
201
|
+
credentials,
|
|
202
|
+
data: JSON.parse(args.request.body),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return next(args);
|
|
207
|
+
};
|
|
208
|
+
provider._initClients = async (credentials) => {
|
|
209
|
+
const result = await originalInitClients.call(provider, credentials);
|
|
210
|
+
const pinpointClient = provider.pinpointClient;
|
|
211
|
+
if (pinpointClient) {
|
|
212
|
+
pinpointClient.config.endpoint = () => Promise.resolve({
|
|
213
|
+
hostname: proxyUrl.hostname,
|
|
214
|
+
// Passing proxyUrl.pathname here doesn't work; it gets overridden
|
|
215
|
+
path: '/',
|
|
216
|
+
port: undefined,
|
|
217
|
+
protocol: proxyUrl.protocol,
|
|
218
|
+
});
|
|
219
|
+
pinpointClient.middlewareStack.remove(requestMiddleware);
|
|
220
|
+
pinpointClient.middlewareStack.add(requestMiddleware, { step: 'finalizeRequest' });
|
|
221
|
+
}
|
|
222
|
+
return result;
|
|
223
|
+
};
|
|
224
|
+
}
|
|
322
225
|
//# sourceMappingURL=amplifyReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,sDAAmD;AAEnD,0DAAqD;AAYrD,sCAAmC;AAkFnC,SAAgB,eAAe,CAAC,IAAiB,EAAE,MAA6B;;IAC9E,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,EAAE;QACnC,WAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,mBAAmB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AAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACrE,MAAM,cAAc,GAAG,QAAQ,CAAC,cAA4C,CAAC;QAE7E,IAAI,cAAc,EAAE;YAClB,cAAc,CAAC,MAAM,CAAC,QAAQ,GAAG,GAAsB,EAAE,CACvD,OAAO,CAAC,OAAO,CAAC;gBACd,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,kEAAkE;gBAClE,IAAI,EAAE,GAAG;gBACT,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,QAAQ,CAAC,QAAQ;aAC5B,CAAC,CAAC;YAEL,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YACzD,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC;SACpF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const amplifyReporter_1 = require("./amplifyReporter");
|
|
2
4
|
describe('amplifyReporter', () => {
|
|
3
5
|
it('should convert all attribute values to arrays of strings', () => {
|
|
4
6
|
const testMetadata = { a: 'a', d: ['e', 'f'] };
|
|
5
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
7
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
6
8
|
expect(attributeMap.a).toEqual(['a']);
|
|
7
9
|
expect(attributeMap.d).toEqual(['e', 'f']);
|
|
8
10
|
});
|
|
9
11
|
it('should handle undefined / null attributes', () => {
|
|
10
12
|
const testMetadata = { a: null, d: undefined };
|
|
11
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
13
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
12
14
|
expect(attributeMap.a).toBeNull();
|
|
13
15
|
expect(attributeMap.d).toBeNull();
|
|
14
16
|
});
|
|
15
17
|
it('should flatten hierarchies', () => {
|
|
16
18
|
const testMetadata = { foo: { bar: 'baz' } };
|
|
17
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
19
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
18
20
|
expect(attributeMap['foo.bar']).toEqual(['baz']);
|
|
19
21
|
});
|
|
20
22
|
it('should stringify non-string array members', () => {
|
|
23
|
+
var _a;
|
|
21
24
|
const testMetadata = { foo: 5, bar: [{ baz: 'maz' }] };
|
|
22
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
25
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
23
26
|
expect(attributeMap.foo).toEqual(['5']);
|
|
24
|
-
expect(typeof attributeMap.bar
|
|
27
|
+
expect(typeof ((_a = attributeMap.bar) === null || _a === void 0 ? void 0 : _a[0])).toEqual('string');
|
|
25
28
|
});
|
|
26
29
|
it('should truncate attribute names', () => {
|
|
27
30
|
const testMetadata = { thisIsAVeryVeryLongAttributeNameThatNeedsToBeTruncated: 5 };
|
|
28
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
31
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
29
32
|
expect(attributeMap.___VeryVeryLongAttributeNameThatNeedsToBeTruncated).toEqual(['5']);
|
|
30
33
|
});
|
|
31
34
|
it('should truncate attribute values', () => {
|
|
32
35
|
const testMetadata = {
|
|
33
36
|
a: 'ThisIsAVeryLongStringThatNeedsToBeTruncatedTo100CharsOrElseThereWillBeAProblemWithSendingTheBeautifulDataToPinpoint',
|
|
34
37
|
};
|
|
35
|
-
const attributeMap = asAttributeMap(testMetadata);
|
|
38
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata);
|
|
36
39
|
expect(attributeMap.a).toEqual([
|
|
37
40
|
'ThisIsAVeryLongStringThatNeedsToBeTruncatedTo100CharsOrElseThereWillBeAProblemWithSendingTheBeautifu',
|
|
38
41
|
]);
|
|
@@ -41,7 +44,7 @@ describe('amplifyReporter', () => {
|
|
|
41
44
|
const testMetadata = {
|
|
42
45
|
a: '5',
|
|
43
46
|
};
|
|
44
|
-
const attributeMap = asAttributeMap(testMetadata, false);
|
|
47
|
+
const attributeMap = (0, amplifyReporter_1.asAttributeMap)(testMetadata, false);
|
|
45
48
|
expect(attributeMap.a).toEqual('5');
|
|
46
49
|
});
|
|
47
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.test.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.test.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"amplifyReporter.test.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.test.ts"],"names":[],"mappings":";;AAAA,uDAAmD;AAEnD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAA,gCAAc,EAAC,YAAY,CAAC,CAAC;QAElD,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAA,gCAAc,EAAC,YAAY,CAAC,CAA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E,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,qHAAqH;SACzH,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,gCAAc,EAAC,YAAY,CAAC,CAAC;QAElD,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7B,sGAAsG;SACvG,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,GAAG;SACP,CAAC;QAEF,MAAM,YAAY,GAAG,IAAA,gCAAc,EAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -23,14 +23,11 @@ export interface DatadogReporterConfig extends ReporterConfigBase {
|
|
|
23
23
|
* @deprecated Prefer using the dedicated `logSampleRate`, `rumSampleRate`, and `replaySampleRate` options.
|
|
24
24
|
*/
|
|
25
25
|
sampleRate?: number;
|
|
26
|
-
sessionSampleRate?: number;
|
|
27
|
-
sessionReplaySampleRate?: number;
|
|
28
26
|
/**
|
|
29
27
|
* Sampling rate for browser log collection. Defaults to 100, meaning every log message is sent to Datadog.
|
|
30
28
|
*/
|
|
31
29
|
logSampleRate?: number;
|
|
32
30
|
/**
|
|
33
|
-
* @deprecated Prefer using `sessionSampleRate`.
|
|
34
31
|
* Sampling rate for RUM session collection. Defaults to 100, meaning every browser session is tracked.
|
|
35
32
|
*
|
|
36
33
|
* RUM can be used to track things like core web vitals.
|
|
@@ -39,7 +36,6 @@ export interface DatadogReporterConfig extends ReporterConfigBase {
|
|
|
39
36
|
*/
|
|
40
37
|
rumSampleRate?: number;
|
|
41
38
|
/**
|
|
42
|
-
* @deprecated Prefer using `sessionReplaySampleRate`.
|
|
43
39
|
* Applied after the RUM sample rate, and controls the percentage of sessions tracked as Browser RUM & Session Replay.
|
|
44
40
|
* It defaults to 100, so every session is tracked as Browser RUM & Session Replay by default.
|
|
45
41
|
*
|
|
@@ -51,17 +47,10 @@ export interface DatadogReporterConfig extends ReporterConfigBase {
|
|
|
51
47
|
*/
|
|
52
48
|
useSecureSessionCookie?: boolean;
|
|
53
49
|
/**
|
|
54
|
-
* @deprecated Prefer using `usePartitionedCrossSiteSessionCookie`.
|
|
55
50
|
* Use a secure cross-site session cookie.
|
|
56
51
|
* This allows the RUM Browser SDK to run when the site is loaded from another one (iframe). Implies `useSecureSessionCookie`
|
|
57
52
|
*/
|
|
58
53
|
useCrossSiteSessionCookie?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Use a partitioned secure cross-site session cookie. This allows the RUM Browser SDK to run when the site is loaded from another one (iframe). Implies `useSecureSessionCookie`.
|
|
61
|
-
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
usePartitionedCrossSiteSessionCookie?: boolean;
|
|
65
54
|
/**
|
|
66
55
|
* Preserve the session across subdomains for the same site.
|
|
67
56
|
*/
|
|
@@ -111,8 +100,7 @@ export interface DatadogReporterConfig extends ReporterConfigBase {
|
|
|
111
100
|
/**
|
|
112
101
|
* A list of request origins used to inject tracing headers, to be able to connect RUM and backend tracing.
|
|
113
102
|
*/
|
|
114
|
-
|
|
115
|
-
allowedTracingUrls?: (string | RegExp)[];
|
|
103
|
+
allowedTracingOrigins?: (string | RegExp)[];
|
|
116
104
|
/**
|
|
117
105
|
* Enables action tracking for user interactions. This enables the Heatmap tab within Datadog
|
|
118
106
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datadogReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/datadogReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMT,WAAW,EACX,kBAA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