@oxyhq/core 10.1.2 → 10.1.3
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/session/accountDialogController.js +25 -7
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/session/accountDialogController.js +25 -7
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/models/interfaces.d.ts +0 -1
- package/package.json +1 -1
- package/src/models/interfaces.ts +0 -1
- package/src/session/__tests__/accountDialogController.test.ts +36 -0
- package/src/session/accountDialogController.ts +23 -7
|
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
exports.AccountDialogController = void 0;
|
|
31
31
|
exports.createAccountDialogController = createAccountDialogController;
|
|
32
32
|
const loggerUtils_1 = require("../utils/loggerUtils");
|
|
33
|
+
const errorUtils_1 = require("../utils/errorUtils");
|
|
33
34
|
const authWebUrl_1 = require("../utils/authWebUrl");
|
|
34
35
|
const oauthPkce_1 = require("../utils/oauthPkce");
|
|
35
36
|
const accountProjection_1 = require("./accountProjection");
|
|
@@ -245,10 +246,20 @@ class AccountDialogController {
|
|
|
245
246
|
graph = await this.oxyServices.listAccounts();
|
|
246
247
|
}
|
|
247
248
|
catch (error) {
|
|
248
|
-
// A
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
// A 401 here is the EXPECTED signed-out edge, not a failure: the bearer was
|
|
250
|
+
// stale/revoked, so `HttpService` already cleared it and emitted
|
|
251
|
+
// `onTokensChanged(null)`, which drops the graph via `reconcileAuth`. Log at
|
|
252
|
+
// debug and leave the dialog error-free — a signed-out device with zero
|
|
253
|
+
// accounts is a normal state, not a warning. Any other error (network, 5xx,
|
|
254
|
+
// malformed) IS unexpected: surface it and warn while keeping the prior graph
|
|
255
|
+
// so device rows still render.
|
|
256
|
+
if ((0, errorUtils_1.extractErrorStatus)(error) === 401) {
|
|
257
|
+
loggerUtils_1.logger.debug('[AccountDialogController] listAccounts unauthorized (signed out)', { component: 'AccountDialogController' }, error);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.error = errorMessage(error);
|
|
261
|
+
loggerUtils_1.logger.warn('[AccountDialogController] listAccounts failed', { component: 'AccountDialogController' }, error);
|
|
262
|
+
}
|
|
252
263
|
}
|
|
253
264
|
if (seq !== this.refreshSeq)
|
|
254
265
|
return; // superseded by a newer refresh
|
|
@@ -288,9 +299,16 @@ class AccountDialogController {
|
|
|
288
299
|
profiles = await this.oxyServices.getUsersByIds(ids);
|
|
289
300
|
}
|
|
290
301
|
catch (error) {
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
|
|
302
|
+
// A 401 is the EXPECTED signed-out edge (stale/cleared bearer) — log at debug.
|
|
303
|
+
// `getUsersByIds` already swallows per-chunk failures and returns `[]`, so any
|
|
304
|
+
// OTHER error here is an unexpected total failure worth a warn. Either way keep
|
|
305
|
+
// the prior profile map.
|
|
306
|
+
if ((0, errorUtils_1.extractErrorStatus)(error) === 401) {
|
|
307
|
+
loggerUtils_1.logger.debug('[AccountDialogController] getUsersByIds unauthorized (signed out)', { component: 'AccountDialogController' }, error);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
loggerUtils_1.logger.warn('[AccountDialogController] getUsersByIds failed', { component: 'AccountDialogController' }, error);
|
|
311
|
+
}
|
|
294
312
|
return;
|
|
295
313
|
}
|
|
296
314
|
if (seq !== this.refreshSeq)
|