@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.
- 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 +1 -1
- 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 +1 -1
- 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 +7 -3
- package/dist/umd/telemetry-amazon.js.map +1 -1
- package/dist/umd/telemetry-amazon.min.js +7 -3
- package/dist/umd/telemetry-amazon.min.js.map +1 -1
- package/package.json +1 -1
package/dist/types/auth.d.ts
CHANGED
|
@@ -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,7 +2058,7 @@
|
|
|
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
2064
|
const ESRI_ENDPOINT_URL = (appId, env = 'dev') => `https://${ESRI_ENDPOINT_SUBDOMAINS[env || 'dev']}.arcgis.com/v1/apps/${appId}/events`;
|