@esri/telemetry-amazon 6.0.0-beta.11 → 6.0.0-beta.13
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 +4 -3
- 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/plugins/esri.js +4 -4
- package/dist/esm/plugins/esri.js.map +1 -1
- package/dist/esm/plugins/esri.test.js +2 -2
- package/dist/esm/plugins/esri.test.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/plugins/esri.js +4 -4
- package/dist/node/plugins/esri.js.map +1 -1
- package/dist/node/plugins/esri.test.js +2 -2
- package/dist/node/plugins/esri.test.js.map +1 -1
- package/dist/types/auth.d.ts +1 -0
- package/dist/umd/telemetry-amazon.js +10 -6
- package/dist/umd/telemetry-amazon.js.map +1 -1
- package/dist/umd/telemetry-amazon.min.js +10 -6
- package/dist/umd/telemetry-amazon.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -307,10 +307,14 @@
|
|
|
307
307
|
};
|
|
308
308
|
|
|
309
309
|
const COGNITO_KEY = 'TELEMETRY_COGNITO_CREDENTIALS';
|
|
310
|
+
function getCognitoCacheKey(identityPoolId) {
|
|
311
|
+
return `${COGNITO_KEY}:${identityPoolId}`;
|
|
312
|
+
}
|
|
310
313
|
async function getCredentials(IdentityPoolId, options = {}) {
|
|
311
314
|
const fipsSubdomainSuffix = options.fips === true ? '-fips' : '';
|
|
312
315
|
const COGNITO_URL = `https://cognito-identity${fipsSubdomainSuffix}.us-east-1.amazonaws.com/`;
|
|
313
|
-
|
|
316
|
+
const cacheKey = getCognitoCacheKey(IdentityPoolId);
|
|
317
|
+
const cached = storage.get(cacheKey);
|
|
314
318
|
if (cached && Date.now() / 1000 < cached.Expiration)
|
|
315
319
|
return cached;
|
|
316
320
|
const fetchOptions = {
|
|
@@ -339,7 +343,7 @@
|
|
|
339
343
|
throw new Error(getCredentialsResponse.statusText);
|
|
340
344
|
}
|
|
341
345
|
const { Credentials } = await getCredentialsResponse.json();
|
|
342
|
-
storage.set(
|
|
346
|
+
storage.set(cacheKey, Credentials);
|
|
343
347
|
return Credentials;
|
|
344
348
|
}
|
|
345
349
|
|
|
@@ -2054,10 +2058,10 @@
|
|
|
2054
2058
|
const ESRI_SIGNING_REGION = 'us-east-1';
|
|
2055
2059
|
const ESRI_ENDPOINT_SUBDOMAINS = {
|
|
2056
2060
|
production: 'te',
|
|
2057
|
-
qa: '
|
|
2061
|
+
qa: 'tedev',
|
|
2058
2062
|
dev: 'tedev',
|
|
2059
2063
|
};
|
|
2060
|
-
const ESRI_ENDPOINT_URL = (appId, env = '
|
|
2064
|
+
const ESRI_ENDPOINT_URL = (appId, env = 'dev') => `https://${ESRI_ENDPOINT_SUBDOMAINS[env || 'dev']}.arcgis.com/v1/apps/${appId}/events`;
|
|
2061
2065
|
const SESSION_START_EVENT = '_session.start';
|
|
2062
2066
|
const SESSION_STOP_EVENT = '_session.stop';
|
|
2063
2067
|
const DEFAULT_IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
@@ -2170,9 +2174,9 @@
|
|
|
2170
2174
|
},
|
|
2171
2175
|
};
|
|
2172
2176
|
}
|
|
2173
|
-
function createEsriPlugin({ trackerName, appName, appId, appVersion, userPoolID, fips, debounceMs = DEFAULT_DEBOUNCE_MS, env = '
|
|
2177
|
+
function createEsriPlugin({ trackerName, appName, appId, appVersion, userPoolID, fips, debounceMs = DEFAULT_DEBOUNCE_MS, env = 'dev', }) {
|
|
2174
2178
|
const url = ESRI_ENDPOINT_URL(appId, env);
|
|
2175
|
-
console.log(
|
|
2179
|
+
console.log('url set', url);
|
|
2176
2180
|
let isDisabled = false;
|
|
2177
2181
|
let hasWarned = false;
|
|
2178
2182
|
let hasSessionStarted = false;
|