@burdenoff/fe-libs 2026.1023.6 → 2026.1023.8

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.
Files changed (40) hide show
  1. package/dist/shared/assistant/gatewayClient.js +23 -19
  2. package/dist/shared/assistant/index.d.ts +1 -0
  3. package/dist/shared/assistant/productContext.d.ts +16 -0
  4. package/dist/shared/assistant/productContext.js +16 -0
  5. package/dist/shared/graphql/client.d.ts +9 -0
  6. package/dist/shared/graphql/client.js +241 -201
  7. package/dist/shared/graphql/fetch.js +135 -123
  8. package/dist/shared/graphql/index.d.ts +1 -0
  9. package/dist/shared/graphql/workspaceOperationGuard.d.ts +70 -0
  10. package/dist/shared/graphql/workspaceOperationGuard.js +62 -0
  11. package/dist/shared/providers/AppShellProvider.d.ts +16 -0
  12. package/dist/shared/providers/AppShellProvider.js +258 -251
  13. package/dist/shared/providers/shell/AuthProvider.d.ts +14 -1
  14. package/dist/shared/providers/shell/AuthProvider.js +105 -94
  15. package/dist/shared/providers/shell/MultiGatewayProvider.d.ts +8 -1
  16. package/dist/shared/providers/shell/MultiGatewayProvider.js +115 -119
  17. package/dist/shared/providers/shell/ProfileStorageManager.js +1 -1
  18. package/dist/shared/providers/shell/WorkspaceWriteRefusedToastListener.d.ts +4 -0
  19. package/dist/shared/providers/shell/WorkspaceWriteRefusedToastListener.js +23 -0
  20. package/dist/shared/providers/shell/authProvider/identityChange.d.ts +26 -0
  21. package/dist/shared/providers/shell/authProvider/identityChange.js +11 -0
  22. package/dist/shared/providers/shell/authProvider/useAuthActions.d.ts +4 -1
  23. package/dist/shared/providers/shell/authProvider/useAuthActions.js +105 -92
  24. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.d.ts +27 -1
  25. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +82 -62
  26. package/dist/shared/providers/shell/authProvider/useRemoteSLO.d.ts +4 -1
  27. package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +16 -14
  28. package/dist/shared/providers/shell/authProvider/useStorageSync.d.ts +4 -1
  29. package/dist/shared/providers/shell/authProvider/useStorageSync.js +19 -14
  30. package/dist/shared/providers/shell/contextSwitchCache.d.ts +4 -0
  31. package/dist/shared/providers/shell/contextSwitchCache.js +17 -0
  32. package/dist/shared/providers/shell/identityQueryReset.d.ts +17 -0
  33. package/dist/shared/providers/shell/identityQueryReset.js +21 -0
  34. package/dist/shared/providers/shell/identityScopedQueryReset.d.ts +16 -0
  35. package/dist/shared/providers/shell/identityScopedQueryReset.js +30 -0
  36. package/dist/shared/providers/shell/index.d.ts +1 -1
  37. package/dist/shared-assistant.js +306 -305
  38. package/dist/shared-graphql.js +11 -10
  39. package/dist/shared.js +129 -128
  40. package/package.json +2 -2
@@ -1,35 +1,40 @@
1
1
  import { PROFILE_STORAGE_CHANGE_EVENT as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as r, resolveActiveProfileId as i } from "../ProfileStorageManager.js";
2
- import { useCallback as a, useEffect as o } from "react";
2
+ import { SIGNED_OUT as a } from "./identityChange.js";
3
+ import { useCallback as o, useEffect as s } from "react";
3
4
  //#region src/shared/providers/shell/authProvider/useStorageSync.ts
4
- function s({ user: s, tokens: c, workspaceToken: l, activeId: u, setUser: d, setTokens: f, setWorkspaceTokenLocal: p, setActiveId: m, clearAccounts: h, refreshAccounts: g }) {
5
- let _ = a(() => {
5
+ function c({ user: c, tokens: l, workspaceToken: u, activeId: d, setUser: f, setTokens: p, setWorkspaceTokenLocal: m, setActiveId: h, clearAccounts: g, refreshAccounts: _, announceIdentityChange: v }) {
6
+ let y = o(() => {
6
7
  let e = i();
7
8
  if (!e) {
8
- (s || c) && (d(null), f(null), p(null), m(null), h());
9
+ (c || l) && (v("storage-sync", a), f(null), p(null), m(null), h(null), g());
9
10
  return;
10
11
  }
11
- let a = t(e), o = r(e), _ = n(e);
12
- e !== u && m(e), a?.accessToken !== c?.accessToken && f(a), o !== l && p(o), _ && _.id !== s?.id && d(_), g();
12
+ let o = t(e), s = r(e), y = n(e);
13
+ v("storage-sync", {
14
+ profileId: e,
15
+ userId: y ? y.id : c?.id ?? null
16
+ }), e !== d && h(e), o?.accessToken !== l?.accessToken && p(o), s !== u && m(s), y && y.id !== c?.id && f(y), _();
13
17
  }, [
14
- c,
15
- s,
16
18
  l,
19
+ c,
17
20
  u,
18
- g,
19
21
  d,
22
+ _,
20
23
  f,
21
24
  p,
22
25
  m,
23
- h
26
+ h,
27
+ g,
28
+ v
24
29
  ]);
25
- o(() => {
26
- let t = () => _();
30
+ s(() => {
31
+ let t = () => y();
27
32
  window.addEventListener(e, t), window.addEventListener("storage", t);
28
33
  let n = setInterval(t, 1e4);
29
34
  return () => {
30
35
  window.removeEventListener(e, t), window.removeEventListener("storage", t), clearInterval(n);
31
36
  };
32
- }, [_]);
37
+ }, [y]);
33
38
  }
34
39
  //#endregion
35
- export { s as useStorageSync };
40
+ export { c as useStorageSync };
@@ -0,0 +1,4 @@
1
+ import { ApolloClient } from '@apollo/client/core';
2
+ import { WorkspaceOperationGuardMode } from '../../graphql/workspaceOperationGuard';
3
+ export declare function evictForContextChange(client: Pick<ApolloClient, 'cache'>, guard: WorkspaceOperationGuardMode): void;
4
+ export declare function refetchForContextChange(client: Pick<ApolloClient, 'refetchQueries'>, guard: WorkspaceOperationGuardMode, activeWorkspaceId: () => string | null): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import { refetchActiveQueries as e } from "../../graphql/workspaceOperationGuard.js";
2
+ //#region src/shared/providers/shell/contextSwitchCache.ts
3
+ function t(e, t) {
4
+ try {
5
+ e.cache.evict(t === "enforce" ? {
6
+ id: "ROOT_QUERY",
7
+ broadcast: !1
8
+ } : { id: "ROOT_QUERY" }), e.cache.gc();
9
+ } catch {}
10
+ }
11
+ async function n(t, n, r) {
12
+ try {
13
+ await e(t, n, r);
14
+ } catch {}
15
+ }
16
+ //#endregion
17
+ export { t as evictForContextChange, n as refetchForContextChange };
@@ -0,0 +1,17 @@
1
+ import { RefObject } from 'react';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ /**
4
+ * Drop every cached result before the account changes. A query no screen
5
+ * observes is removed. A query a mounted screen observes is reset to its
6
+ * initial state instead, which tells that screen its data is gone (a removed
7
+ * query would leave the screen holding the previous account's rows). Nothing is
8
+ * refetched here; in-flight fetches are cancelled silently (no error toast).
9
+ */
10
+ export declare function emptyQueryClientForIdentityChange(queryClient: QueryClient): void;
11
+ export interface IdentityQueryReset {
12
+ /** Pass to `AuthProvider` as `onBeforeIdentityChange`. */
13
+ onBeforeIdentityChange: () => void;
14
+ /** Counts announcements; pass to `IdentityScopedQueryReset`. */
15
+ announcementsRef: RefObject<number>;
16
+ }
17
+ export declare function useIdentityQueryReset(queryClient: QueryClient): IdentityQueryReset;
@@ -0,0 +1,21 @@
1
+ import { useCallback as e, useMemo as t, useRef as n } from "react";
2
+ import { notifyManager as r } from "@tanstack/react-query";
3
+ //#region src/shared/providers/shell/identityQueryReset.ts
4
+ function i(e) {
5
+ e.cancelQueries();
6
+ let t = e.getQueryCache();
7
+ r.batch(() => {
8
+ for (let e of t.getAll()) e.getObserversCount() > 0 ? e.reset() : t.remove(e);
9
+ }), e.getMutationCache().clear();
10
+ }
11
+ function a(r) {
12
+ let a = n(0), o = e(() => {
13
+ a.current += 1, i(r);
14
+ }, [r]);
15
+ return t(() => ({
16
+ onBeforeIdentityChange: o,
17
+ announcementsRef: a
18
+ }), [o]);
19
+ }
20
+ //#endregion
21
+ export { i as emptyQueryClientForIdentityChange, a as useIdentityQueryReset };
@@ -0,0 +1,16 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Mount inside `AuthProvider`, under the same `QueryClientProvider`, before the
4
+ * app's screens. After each commit:
5
+ * - an announcement came since the last commit: the cache was emptied for the
6
+ * account now committed, so the screens still mounted are refetched;
7
+ * - the account changed with no announcement (a missed path): every query is
8
+ * reset, which drops its data, tells mounted screens, and refetches the
9
+ * active ones under the account now signed in.
10
+ * Signed out, nothing is refetched: there is no account to fetch for, and a
11
+ * screen still mounted in that commit would only send a request with no
12
+ * credentials. Emptying the cache is enough.
13
+ */
14
+ export declare function IdentityScopedQueryReset({ announcementsRef, }: {
15
+ announcementsRef: RefObject<number>;
16
+ }): null;
@@ -0,0 +1,30 @@
1
+ import { SIGNED_OUT_IDENTITY_KEY as e, identityKeyOf as t } from "./authProvider/identityChange.js";
2
+ import { useAuth as n } from "./AuthProvider.js";
3
+ import { emptyQueryClientForIdentityChange as r } from "./identityQueryReset.js";
4
+ import { useLayoutEffect as i, useRef as a } from "react";
5
+ import { useQueryClient as o } from "@tanstack/react-query";
6
+ //#region src/shared/providers/shell/identityScopedQueryReset.tsx
7
+ function s({ announcementsRef: s }) {
8
+ let { activeProfileId: c, user: l } = n(), u = o(), d = t(c, l?.id), f = a(null);
9
+ return i(() => {
10
+ let t = f.current, n = s.current;
11
+ if (f.current = {
12
+ identityKey: d,
13
+ announcements: n
14
+ }, !t) return;
15
+ let i = d === e;
16
+ if (t.announcements !== n) {
17
+ i || u.refetchQueries({ type: "active" });
18
+ return;
19
+ }
20
+ if (t.identityKey !== d) {
21
+ if (i) {
22
+ r(u);
23
+ return;
24
+ }
25
+ u.cancelQueries(), u.resetQueries();
26
+ }
27
+ }), null;
28
+ }
29
+ //#endregion
30
+ export { s as IdentityScopedQueryReset };
@@ -5,7 +5,7 @@ export type { Locale, TranslationDictionary, I18nContextValue, I18nProviderProps
5
5
  export { useShellLabel } from './useShellLabel';
6
6
  export type { ShellLabel } from './useShellLabel';
7
7
  export { AuthProvider, useAuth } from './AuthProvider';
8
- export type { User, AuthTokens, Account, AuthContextValue, AuthProviderProps, } from './AuthProvider';
8
+ export type { User, AuthTokens, Account, AuthContextValue, AuthProviderProps, IdentityChangeReason, } from './AuthProvider';
9
9
  export { AuthBridgeClient, initAuthBridge, getAuthBridge, destroyAuthBridge, isAuthBridgeInitialized, } from './AuthBridgeClient';
10
10
  export type { BridgeAuthState, BridgeMessage, AuthBridgeListener, AuthBridgeClientOptions, } from './AuthBridgeClient';
11
11
  export * as ProfileStorage from './ProfileStorageManager';