@burdenoff/fe-libs 2026.1023.6 → 2026.1023.7

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.
@@ -1,45 +1,49 @@
1
1
  import { graphqlFetch as e } from "../graphql/fetch.js";
2
2
  import "../../shared-graphql.js";
3
3
  import "./quota.js";
4
+ import { assistantProductHeaders as t } from "./productContext.js";
4
5
  //#region src/shared/assistant/gatewayClient.ts
5
- function t() {
6
+ function n() {
6
7
  try {
7
8
  return `bf-assistant-${crypto.randomUUID()}`;
8
9
  } catch {
9
10
  return `bf-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;
10
11
  }
11
12
  }
12
- function n(e, t) {
13
+ function r(e, t) {
13
14
  return {
14
15
  workspaceId: e,
15
16
  ...t?.organizationId ? { custom: { organizationId: t.organizationId } } : {}
16
17
  };
17
18
  }
18
- async function r(n) {
19
- let r = await e({
19
+ async function i(r) {
20
+ let i = await e({
20
21
  gateway: "workspace",
21
- query: n.query,
22
- operationName: n.operationName,
23
- variables: n.variables,
24
- ...n.signal ? { signal: n.signal } : {},
25
- authToken: n.authContext?.accessToken ?? void 0,
22
+ query: r.query,
23
+ operationName: r.operationName,
24
+ variables: r.variables,
25
+ ...r.signal ? { signal: r.signal } : {},
26
+ authToken: r.authContext?.accessToken ?? void 0,
26
27
  workspaceToken: !0,
27
- workspaceId: n.workspaceId,
28
- organizationId: n.authContext?.organizationId ?? !0,
28
+ workspaceId: r.workspaceId,
29
+ organizationId: r.authContext?.organizationId ?? !0,
29
30
  suppressGlobalErrorEvent: !0,
30
- extraHeaders: { "x-request-id": t() }
31
+ extraHeaders: {
32
+ "x-request-id": n(),
33
+ ...t()
34
+ }
31
35
  });
32
- if (r.errors?.length) {
33
- let e = r.errors[0], t = Error(e.message);
36
+ if (i.errors?.length) {
37
+ let e = i.errors[0], t = Error(e.message);
34
38
  throw t.extensions = e.extensions, t;
35
39
  }
36
- if (r.data == null) throw Error("Sandbox GraphQL returned no data");
37
- return r.data;
40
+ if (i.data == null) throw Error("Sandbox GraphQL returned no data");
41
+ return i.data;
38
42
  }
39
- async function i(e) {
43
+ async function a(e) {
40
44
  let t;
41
45
  for (let n = 0; n < 3; n++) try {
42
- return await r(e);
46
+ return await i(e);
43
47
  } catch (e) {
44
48
  t = e;
45
49
  let r = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
@@ -49,4 +53,4 @@ async function i(e) {
49
53
  throw t;
50
54
  }
51
55
  //#endregion
52
- export { n as buildSandboxContextInput, r as executeAssistantGraphQLOnce, i as executeSandboxGraphQL };
56
+ export { r as buildSandboxContextInput, i as executeAssistantGraphQLOnce, a as executeSandboxGraphQL };
@@ -33,6 +33,7 @@ export * from './useSandboxAssistantTransport';
33
33
  export * from './createSandboxAssistantTransport';
34
34
  export * from './runtime';
35
35
  export * from './gatewayClient';
36
+ export * from './productContext';
36
37
  export * from './progress';
37
38
  export * from './streamBudget';
38
39
  export * from './api';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The product the assistant runs in, sent as `x-product-id` on every
3
+ * assistant gateway call.
4
+ *
5
+ * The session relay re-sends the assistant's reads to the gateway with this
6
+ * product, and product-scoped services (wspace-workflow-svc) answer a read only
7
+ * when it names one: without it every FluidGrids read came back
8
+ * BAD_USER_INPUT. The shell registers its product while it is mounted
9
+ * (AppShellProvider), so the assistant code itself never names a product.
10
+ */
11
+ /** Register the shell's product; returns a disposer that clears it if it is still the one set. */
12
+ export declare function setAssistantProductId(productId: string | null | undefined): () => void;
13
+ /** The registered product, or null outside a shell (an MFE in isolation, a test). */
14
+ export declare function getAssistantProductId(): string | null;
15
+ /** The headers that carry the product, when one is registered. */
16
+ export declare function assistantProductHeaders(): Record<string, string>;
@@ -0,0 +1,16 @@
1
+ //#region src/shared/assistant/productContext.ts
2
+ var e = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/, t = null;
3
+ function n(n) {
4
+ let r = typeof n == "string" && e.test(n) ? n : null;
5
+ return t = r, () => {
6
+ t === r && (t = null);
7
+ };
8
+ }
9
+ function r() {
10
+ return t;
11
+ }
12
+ function i() {
13
+ return t ? { "x-product-id": t } : {};
14
+ }
15
+ //#endregion
16
+ export { i as assistantProductHeaders, r as getAssistantProductId, n as setAssistantProductId };