@oxyhq/core 10.1.2 → 10.1.4

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.
@@ -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 graph-load failure is non-fatal: device rows still render. Surface the
249
- // message but keep going with whatever graph we already had.
250
- this.error = errorMessage(error);
251
- loggerUtils_1.logger.warn('[AccountDialogController] listAccounts failed', { component: 'AccountDialogController' }, error);
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
- // `getUsersByIds` already swallows per-chunk failures and returns `[]`;
292
- // this guards the unexpected total failure. Non-fatal keep prior map.
293
- loggerUtils_1.logger.warn('[AccountDialogController] getUsersByIds failed', { component: 'AccountDialogController' }, error);
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)
@@ -46,28 +46,6 @@
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
47
  exports.normalizeInlineText = normalizeInlineText;
48
48
  exports.normalizeMultilineText = normalizeMultilineText;
49
- /**
50
- * Characters that make a value ineligible for the zero-work fast path, and the
51
- * whitespace shapes that a normalized INLINE value can never contain.
52
- *
53
- * A value that matches nothing here is, by construction, already normalized:
54
- * it holds only printable ASCII (which is NFC-stable, so `normalize('NFC')`
55
- * would be a no-op), its only whitespace is the plain space, it has no leading
56
- * or trailing space, and no run of two spaces. Returning it untouched skips
57
- * three string allocations — worth it because the common case in the feed
58
- * hydration hot path is text that is already clean.
59
- *
60
- * Non-global (safe for repeated `.test()`; a global regex is stateful).
61
- */
62
- const INLINE_NEEDS_NORMALIZATION = /[^\x20-\x7E]|^ | $| {2}/;
63
- /**
64
- * Same idea as {@link INLINE_NEEDS_NORMALIZATION}, for MULTILINE values: `\n`
65
- * joins the printable-ASCII fast-path alphabet, and the additional shapes a
66
- * normalized body can never contain are a space adjacent to a line break — on
67
- * either side, since every line is trimmed — and a run of three line breaks
68
- * (more than one blank line).
69
- */
70
- const MULTILINE_NEEDS_NORMALIZATION = /[^\x20-\x7E\n]|^[ \n]|[ \n]$| {2}| \n|\n |\n{3}/;
71
49
  /** Any run of whitespace, including tabs, line breaks and Unicode spaces. */
72
50
  const ANY_WHITESPACE_RUN = /\s+/g;
73
51
  /**
@@ -129,9 +107,6 @@ const EXCESS_BLANK_LINES = /\n{3,}/g;
129
107
  * Idempotent: `f(f(x)) === f(x)`.
130
108
  */
131
109
  function normalizeInlineText(value) {
132
- if (!INLINE_NEEDS_NORMALIZATION.test(value)) {
133
- return value;
134
- }
135
110
  return value.normalize('NFC').replace(ANY_WHITESPACE_RUN, ' ').trim();
136
111
  }
137
112
  /**
@@ -167,9 +142,6 @@ function normalizeInlineText(value) {
167
142
  * Idempotent: `f(f(x)) === f(x)`.
168
143
  */
169
144
  function normalizeMultilineText(value) {
170
- if (!MULTILINE_NEEDS_NORMALIZATION.test(value)) {
171
- return value;
172
- }
173
145
  return value
174
146
  .normalize('NFC')
175
147
  .replace(LINE_BREAK_FORMS, '\n')