@friggframework/core 2.0.0--canary.623.0155fc6.0 → 2.0.0--canary.623.9b7cdf7.0
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.
|
@@ -4,6 +4,7 @@ const { FetchError } = require('../../errors');
|
|
|
4
4
|
const { get } = require('../../assertions');
|
|
5
5
|
|
|
6
6
|
const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
|
|
7
|
+
const MAX_AUTH_RETRIES = 3;
|
|
7
8
|
|
|
8
9
|
class Requester extends Delegate {
|
|
9
10
|
constructor(params) {
|
|
@@ -163,12 +164,13 @@ class Requester extends Delegate {
|
|
|
163
164
|
|
|
164
165
|
if (status === 401) {
|
|
165
166
|
if (!this.isRefreshable) {
|
|
166
|
-
//
|
|
167
|
-
// isn't proof the credential is bad.
|
|
168
|
-
if (this.authGraceRetryCount
|
|
167
|
+
// Up to MAX_AUTH_RETRIES grace retries before invalidating
|
|
168
|
+
// — a 401 alone isn't proof the credential is bad.
|
|
169
|
+
if (this.authGraceRetryCount < MAX_AUTH_RETRIES) {
|
|
170
|
+
const delay =
|
|
171
|
+
this.backOff[this.authGraceRetryCount] * 1000;
|
|
169
172
|
this.authGraceRetryCount++;
|
|
170
173
|
clearRequestTimer();
|
|
171
|
-
const delay = this.backOff[0] * 1000;
|
|
172
174
|
await new Promise((resolve) =>
|
|
173
175
|
setTimeout(resolve, delay)
|
|
174
176
|
);
|
|
@@ -182,7 +184,7 @@ class Requester extends Delegate {
|
|
|
182
184
|
);
|
|
183
185
|
}
|
|
184
186
|
|
|
185
|
-
if (this.refreshCount
|
|
187
|
+
if (this.refreshCount < MAX_AUTH_RETRIES) {
|
|
186
188
|
this.refreshCount++;
|
|
187
189
|
const refreshSucceeded = await this.refreshAuth();
|
|
188
190
|
if (refreshSucceeded) {
|
|
@@ -196,6 +198,8 @@ class Requester extends Delegate {
|
|
|
196
198
|
response
|
|
197
199
|
);
|
|
198
200
|
}
|
|
201
|
+
|
|
202
|
+
throw await this._invalidateAuth(encodedUrl, options, response);
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
// If the error wasn't retried, throw. FetchError.create reads
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.623.
|
|
4
|
+
"version": "2.0.0--canary.623.9b7cdf7.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@friggframework/eslint-config": "2.0.0--canary.623.
|
|
42
|
-
"@friggframework/prettier-config": "2.0.0--canary.623.
|
|
43
|
-
"@friggframework/test": "2.0.0--canary.623.
|
|
41
|
+
"@friggframework/eslint-config": "2.0.0--canary.623.9b7cdf7.0",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0--canary.623.9b7cdf7.0",
|
|
43
|
+
"@friggframework/test": "2.0.0--canary.623.9b7cdf7.0",
|
|
44
44
|
"@prisma/client": "^6.19.3",
|
|
45
45
|
"@types/lodash": "4.17.15",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "9b7cdf7b3bcdcd7746a50c30519d2eebe16db23d"
|
|
84
84
|
}
|