@firebase/app-check 0.8.12-canary.95b4fc69d → 0.8.12-canary.a512bc655
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/index.esm2017.js +11 -16
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/errors.d.ts +0 -5
- package/dist/esm/src/internal-api.d.ts +1 -1
- package/dist/index.cjs.js +11 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/errors.d.ts +0 -5
- package/dist/src/internal-api.d.ts +1 -1
- package/package.json +6 -6
|
@@ -233,8 +233,7 @@ const ERRORS = {
|
|
|
233
233
|
["storage-get" /* AppCheckError.STORAGE_GET */]: 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
|
|
234
234
|
["storage-set" /* AppCheckError.STORAGE_WRITE */]: 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
|
|
235
235
|
["recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */]: 'ReCAPTCHA error.',
|
|
236
|
-
["
|
|
237
|
-
["throttled" /* AppCheckError.THROTTLED */]: `Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}`
|
|
236
|
+
["throttled" /* AppCheckError.THROTTLED */]: `Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}`
|
|
238
237
|
};
|
|
239
238
|
const ERROR_FACTORY = new ErrorFactory('appCheck', 'AppCheck', ERRORS);
|
|
240
239
|
|
|
@@ -693,7 +692,7 @@ function formatDummyToken(tokenErrorData) {
|
|
|
693
692
|
* The result will contain an error field if there is any error.
|
|
694
693
|
* In case there is an error, the token field in the result will be populated with a dummy value
|
|
695
694
|
*/
|
|
696
|
-
async function getToken$2(appCheck, forceRefresh = false
|
|
695
|
+
async function getToken$2(appCheck, forceRefresh = false) {
|
|
697
696
|
const app = appCheck.app;
|
|
698
697
|
ensureActivated(app);
|
|
699
698
|
const state = getStateReference(app);
|
|
@@ -759,13 +758,12 @@ async function getToken$2(appCheck, forceRefresh = false, shouldLogErrors = fals
|
|
|
759
758
|
return { token: tokenFromDebugExchange.token };
|
|
760
759
|
}
|
|
761
760
|
catch (e) {
|
|
762
|
-
if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}`
|
|
763
|
-
e.code ===
|
|
764
|
-
`appCheck/${"initial-throttle" /* AppCheckError.INITIAL_THROTTLE */}`) {
|
|
761
|
+
if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}`) {
|
|
765
762
|
// Warn if throttled, but do not treat it as an error.
|
|
766
763
|
logger.warn(e.message);
|
|
767
764
|
}
|
|
768
|
-
else
|
|
765
|
+
else {
|
|
766
|
+
// `getToken()` should never throw, but logging error text to console will aid debugging.
|
|
769
767
|
logger.error(e);
|
|
770
768
|
}
|
|
771
769
|
// Return dummy token and error
|
|
@@ -792,12 +790,12 @@ async function getToken$2(appCheck, forceRefresh = false, shouldLogErrors = fals
|
|
|
792
790
|
token = await getStateReference(app).exchangeTokenPromise;
|
|
793
791
|
}
|
|
794
792
|
catch (e) {
|
|
795
|
-
if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}`
|
|
796
|
-
e.code === `appCheck/${"initial-throttle" /* AppCheckError.INITIAL_THROTTLE */}`) {
|
|
793
|
+
if (e.code === `appCheck/${"throttled" /* AppCheckError.THROTTLED */}`) {
|
|
797
794
|
// Warn if throttled, but do not treat it as an error.
|
|
798
795
|
logger.warn(e.message);
|
|
799
796
|
}
|
|
800
|
-
else
|
|
797
|
+
else {
|
|
798
|
+
// `getToken()` should never throw, but logging error text to console will aid debugging.
|
|
801
799
|
logger.error(e);
|
|
802
800
|
}
|
|
803
801
|
// Always save error to be added to dummy token.
|
|
@@ -1054,7 +1052,7 @@ function internalFactory(appCheck) {
|
|
|
1054
1052
|
}
|
|
1055
1053
|
|
|
1056
1054
|
const name = "@firebase/app-check";
|
|
1057
|
-
const version = "0.8.12-canary.
|
|
1055
|
+
const version = "0.8.12-canary.a512bc655";
|
|
1058
1056
|
|
|
1059
1057
|
/**
|
|
1060
1058
|
* @license
|
|
@@ -1250,7 +1248,7 @@ class ReCaptchaV3Provider {
|
|
|
1250
1248
|
catch (e) {
|
|
1251
1249
|
if ((_b = e.code) === null || _b === void 0 ? void 0 : _b.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
|
|
1252
1250
|
this._throttleData = setBackoff(Number((_c = e.customData) === null || _c === void 0 ? void 0 : _c.httpStatus), this._throttleData);
|
|
1253
|
-
throw ERROR_FACTORY.create("
|
|
1251
|
+
throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
|
|
1254
1252
|
time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
|
|
1255
1253
|
httpStatus: this._throttleData.httpStatus
|
|
1256
1254
|
});
|
|
@@ -1328,7 +1326,7 @@ class ReCaptchaEnterpriseProvider {
|
|
|
1328
1326
|
catch (e) {
|
|
1329
1327
|
if ((_b = e.code) === null || _b === void 0 ? void 0 : _b.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
|
|
1330
1328
|
this._throttleData = setBackoff(Number((_c = e.customData) === null || _c === void 0 ? void 0 : _c.httpStatus), this._throttleData);
|
|
1331
|
-
throw ERROR_FACTORY.create("
|
|
1329
|
+
throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
|
|
1332
1330
|
time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
|
|
1333
1331
|
httpStatus: this._throttleData.httpStatus
|
|
1334
1332
|
});
|
|
@@ -1600,9 +1598,6 @@ async function getToken(appCheckInstance, forceRefresh) {
|
|
|
1600
1598
|
if (result.error) {
|
|
1601
1599
|
throw result.error;
|
|
1602
1600
|
}
|
|
1603
|
-
if (result.internalError) {
|
|
1604
|
-
throw result.internalError;
|
|
1605
|
-
}
|
|
1606
1601
|
return { token: result.token };
|
|
1607
1602
|
}
|
|
1608
1603
|
/**
|