@esri/telemetry-amazon 6.0.0-beta.12 → 6.0.0-beta.14
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/esm/auth.js +6 -2
- package/dist/esm/auth.js.map +1 -1
- package/dist/esm/auth.test.js +35 -0
- package/dist/esm/auth.test.js.map +1 -1
- package/dist/esm/create-event-log.js +6 -2
- package/dist/esm/create-event-log.js.map +1 -1
- package/dist/esm/create-event-log.test.js +8 -1
- package/dist/esm/create-event-log.test.js.map +1 -1
- package/dist/esm/format-telemetry-attributes.js +1 -1
- package/dist/esm/format-telemetry-attributes.js.map +1 -1
- package/dist/esm/format-telemetry-attributes.test.js +52 -0
- package/dist/esm/format-telemetry-attributes.test.js.map +1 -0
- package/dist/esm/plugins/esri.js +1 -1
- package/dist/esm/plugins/esri.js.map +1 -1
- package/dist/esm/plugins/esri.test.js +35 -2
- package/dist/esm/plugins/esri.test.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/node/auth.js +8 -3
- package/dist/node/auth.js.map +1 -1
- package/dist/node/auth.test.js +35 -0
- package/dist/node/auth.test.js.map +1 -1
- package/dist/node/create-event-log.js +6 -2
- package/dist/node/create-event-log.js.map +1 -1
- package/dist/node/create-event-log.test.js +8 -1
- package/dist/node/create-event-log.test.js.map +1 -1
- package/dist/node/format-telemetry-attributes.js +1 -1
- package/dist/node/format-telemetry-attributes.js.map +1 -1
- package/dist/node/format-telemetry-attributes.test.js +54 -0
- package/dist/node/format-telemetry-attributes.test.js.map +1 -0
- package/dist/node/plugins/esri.js +1 -1
- package/dist/node/plugins/esri.js.map +1 -1
- package/dist/node/plugins/esri.test.js +35 -2
- package/dist/node/plugins/esri.test.js.map +1 -1
- package/dist/node/types.js.map +1 -1
- package/dist/types/auth.d.ts +1 -0
- package/dist/types/format-telemetry-attributes.d.ts +2 -2
- package/dist/types/format-telemetry-attributes.test.d.ts +1 -0
- package/dist/types/types.d.ts +3 -3
- package/dist/umd/telemetry-amazon.js +14 -6
- package/dist/umd/telemetry-amazon.js.map +1 -1
- package/dist/umd/telemetry-amazon.min.js +14 -6
- package/dist/umd/telemetry-amazon.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
function formatTelemetryAttributes({ telemetryData, dimensionLookup = {}, }) {
|
|
82
82
|
return Object.keys(telemetryData)
|
|
83
83
|
.filter((key) => {
|
|
84
|
-
return isAmazonEventAttributeKey(key);
|
|
84
|
+
return (isAmazonEventAttributeKey(key) || dimensionLookup[key] !== undefined);
|
|
85
85
|
})
|
|
86
86
|
.map((key) => {
|
|
87
87
|
if (dimensionLookup[key]) {
|
|
@@ -140,7 +140,9 @@
|
|
|
140
140
|
function createEventLog({ event = {}, dimensionLookup = {}, metricLookup = {}, }) {
|
|
141
141
|
var _a, _b, _c;
|
|
142
142
|
const acceptedAttributeKeys = new Set(AMAZON_EVENT_ATTRIBUTE_KEYS);
|
|
143
|
+
acceptedAttributeKeys.delete('pathname');
|
|
143
144
|
const { pathname: eventPathname, eventType = 'other' } = event;
|
|
145
|
+
const eventName = String(eventType);
|
|
144
146
|
const metrics = formatTelemetryMetrics(event, metricLookup);
|
|
145
147
|
const formattedEventAttributes = formatTelemetryAttributes({
|
|
146
148
|
telemetryData: Object.assign({}, event),
|
|
@@ -149,7 +151,7 @@
|
|
|
149
151
|
const eventAttributes = Object.fromEntries(Object.entries(formattedEventAttributes).filter(([key]) => {
|
|
150
152
|
return acceptedAttributeKeys.has(key);
|
|
151
153
|
}));
|
|
152
|
-
const telemetryPayload = Object.assign(Object.assign(Object.assign({}, eventAttributes), metrics), { name:
|
|
154
|
+
const telemetryPayload = Object.assign(Object.assign(Object.assign({}, eventAttributes), metrics), { name: eventName });
|
|
153
155
|
// Set browser properties if available
|
|
154
156
|
if (typeof document !== 'undefined' &&
|
|
155
157
|
document.referrer &&
|
|
@@ -161,7 +163,9 @@
|
|
|
161
163
|
}
|
|
162
164
|
(_b = telemetryPayload.path) !== null && _b !== void 0 ? _b : (telemetryPayload.path = typeof window !== 'undefined' && window.location.pathname
|
|
163
165
|
? (_c = window.location) === null || _c === void 0 ? void 0 : _c.pathname
|
|
164
|
-
: eventPathname
|
|
166
|
+
: eventPathname === undefined
|
|
167
|
+
? undefined
|
|
168
|
+
: String(eventPathname));
|
|
165
169
|
return telemetryPayload;
|
|
166
170
|
}
|
|
167
171
|
|
|
@@ -307,10 +311,14 @@
|
|
|
307
311
|
};
|
|
308
312
|
|
|
309
313
|
const COGNITO_KEY = 'TELEMETRY_COGNITO_CREDENTIALS';
|
|
314
|
+
function getCognitoCacheKey(identityPoolId) {
|
|
315
|
+
return `${COGNITO_KEY}:${identityPoolId}`;
|
|
316
|
+
}
|
|
310
317
|
async function getCredentials(IdentityPoolId, options = {}) {
|
|
311
318
|
const fipsSubdomainSuffix = options.fips === true ? '-fips' : '';
|
|
312
319
|
const COGNITO_URL = `https://cognito-identity${fipsSubdomainSuffix}.us-east-1.amazonaws.com/`;
|
|
313
|
-
|
|
320
|
+
const cacheKey = getCognitoCacheKey(IdentityPoolId);
|
|
321
|
+
const cached = storage.get(cacheKey);
|
|
314
322
|
if (cached && Date.now() / 1000 < cached.Expiration)
|
|
315
323
|
return cached;
|
|
316
324
|
const fetchOptions = {
|
|
@@ -339,7 +347,7 @@
|
|
|
339
347
|
throw new Error(getCredentialsResponse.statusText);
|
|
340
348
|
}
|
|
341
349
|
const { Credentials } = await getCredentialsResponse.json();
|
|
342
|
-
storage.set(
|
|
350
|
+
storage.set(cacheKey, Credentials);
|
|
343
351
|
return Credentials;
|
|
344
352
|
}
|
|
345
353
|
|
|
@@ -2054,7 +2062,7 @@
|
|
|
2054
2062
|
const ESRI_SIGNING_REGION = 'us-east-1';
|
|
2055
2063
|
const ESRI_ENDPOINT_SUBDOMAINS = {
|
|
2056
2064
|
production: 'te',
|
|
2057
|
-
qa: '
|
|
2065
|
+
qa: 'tedev',
|
|
2058
2066
|
dev: 'tedev',
|
|
2059
2067
|
};
|
|
2060
2068
|
const ESRI_ENDPOINT_URL = (appId, env = 'dev') => `https://${ESRI_ENDPOINT_SUBDOMAINS[env || 'dev']}.arcgis.com/v1/apps/${appId}/events`;
|