@friggframework/core 2.0.0-next.96 → 2.0.0-next.97

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.
@@ -315,13 +315,13 @@ class OAuth2Requester extends Requester {
315
315
  console.log('[Frigg] Token refresh succeeded');
316
316
  return true;
317
317
  } catch (error) {
318
- console.error('[Frigg] Token refresh failed', {
318
+ const moduleName = this.delegate?.name ?? 'unknown module';
319
+ console.error(`[Frigg] Token refresh failed for ${moduleName}`, {
319
320
  error_message: error?.message,
320
321
  error_name: error?.name,
321
322
  response_status: error?.response?.status,
322
323
  response_data: error?.response?.data,
323
324
  });
324
- await this.notify(this.DLGT_INVALID_AUTH);
325
325
  return false;
326
326
  }
327
327
  }
@@ -119,9 +119,7 @@ class Requester extends Delegate {
119
119
  if (e?.code === 'ECONNRESET' && i < this.backOff.length) {
120
120
  clearRequestTimer();
121
121
  const delay = this.backOff[i] * 1000;
122
- await new Promise((resolve) =>
123
- setTimeout(resolve, delay)
124
- );
122
+ await new Promise((resolve) => setTimeout(resolve, delay));
125
123
  return this._request(url, options, i + 1);
126
124
  }
127
125
  const fetchError = await FetchError.create({
@@ -150,16 +148,24 @@ class Requester extends Delegate {
150
148
  const delay = this.backOff[i] * 1000;
151
149
  await new Promise((resolve) => setTimeout(resolve, delay));
152
150
  return this._request(url, options, i + 1);
153
- } else if (status === 401) {
151
+ }
152
+
153
+ if (status === 401) {
154
154
  if (!this.isRefreshable) {
155
155
  await this.notify(this.DLGT_INVALID_AUTH);
156
- } else if (this.refreshCount === 0) {
156
+ return;
157
+ }
158
+
159
+ if (this.refreshCount === 0) {
157
160
  this.refreshCount++;
158
161
  const refreshSucceeded = await this.refreshAuth();
159
162
  if (refreshSucceeded) {
160
163
  clearRequestTimer();
161
164
  return this._request(url, options, i + 1);
162
165
  }
166
+
167
+ await this.notify(this.DLGT_INVALID_AUTH);
168
+ return;
163
169
  }
164
170
  }
165
171
 
@@ -201,8 +207,7 @@ class Requester extends Delegate {
201
207
  _maybeFlagTimeoutDuringBodyRead(err, timeoutMs) {
202
208
  if (!err || typeof err !== 'object') return err;
203
209
  if (err.isTimeout) return err;
204
- const isAbort =
205
- err.name === 'AbortError' || err.type === 'aborted';
210
+ const isAbort = err.name === 'AbortError' || err.type === 'aborted';
206
211
  if (!isAbort) return err;
207
212
  err.isTimeout = true;
208
213
  err.timeoutMs = timeoutMs;
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-next.96",
4
+ "version": "2.0.0-next.97",
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-next.96",
42
- "@friggframework/prettier-config": "2.0.0-next.96",
43
- "@friggframework/test": "2.0.0-next.96",
41
+ "@friggframework/eslint-config": "2.0.0-next.97",
42
+ "@friggframework/prettier-config": "2.0.0-next.97",
43
+ "@friggframework/test": "2.0.0-next.97",
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": "f69e2249ecdd7a00cfac6ed479b5afab6657bf16"
83
+ "gitHead": "5595f797e6f65bb5a66dc96bfa1154f0d4c39504"
84
84
  }