@esri/telemetry-amazon 6.0.0-beta.12 → 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.
@@ -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
- let cached = storage.get(COGNITO_KEY);
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(COGNITO_KEY, Credentials);
346
+ storage.set(cacheKey, Credentials);
343
347
  return Credentials;
344
348
  }
345
349
 
@@ -2054,7 +2058,7 @@
2054
2058
  const ESRI_SIGNING_REGION = 'us-east-1';
2055
2059
  const ESRI_ENDPOINT_SUBDOMAINS = {
2056
2060
  production: 'te',
2057
- qa: 'teqa',
2061
+ qa: 'tedev',
2058
2062
  dev: 'tedev',
2059
2063
  };
2060
2064
  const ESRI_ENDPOINT_URL = (appId, env = 'dev') => `https://${ESRI_ENDPOINT_SUBDOMAINS[env || 'dev']}.arcgis.com/v1/apps/${appId}/events`;