@burdenoff/microfe-workspaces 2026.711.1 → 2026.719.1

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.
@@ -2,30 +2,52 @@ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
2
2
  import { useQuery as t } from "@tanstack/react-query";
3
3
  import { graphqlFetch as n } from "@burdenoff/fe-libs/shared/graphql";
4
4
  //#region src/hooks/useWorkspaceRoles.ts
5
- var r = "\n query GetWorkspaceRoles($scopeId: String!, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n", i = (i) => {
6
- let { authToken: a, workspaceId: o } = e(), s = i || o;
5
+ var r = "\n query GetWorkspaceRoles($scopeId: String!, $filter: RoleFilterInput, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, filter: $filter, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n", i = "\n query GetWorkspaceRoles($scopeId: String!, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n";
6
+ function a(e) {
7
+ return e.some(({ message: e }) => e?.includes("RoleFilterInput") ? (e.includes("product") || e.includes("includePlatformRoles")) && (e.includes("not defined") || e.includes("Unknown field")) : !1);
8
+ }
9
+ var o = (o) => {
10
+ let { authToken: s, workspaceId: c, productId: l } = e(), u = o || c;
7
11
  return t({
8
- queryKey: ["workspaceRoles", s],
12
+ queryKey: [
13
+ "workspaceRoles",
14
+ u,
15
+ l
16
+ ],
9
17
  queryFn: async () => {
10
18
  let e = await n({
11
19
  gateway: "workspace",
12
- authToken: a || void 0,
20
+ authToken: s || void 0,
13
21
  query: r,
14
22
  variables: {
15
- scopeId: s,
23
+ scopeId: u,
24
+ filter: l ? {
25
+ product: l,
26
+ includePlatformRoles: !1
27
+ } : void 0,
16
28
  pagination: { limit: 50 }
17
29
  },
18
- workspaceId: s || void 0,
30
+ workspaceId: u || void 0,
19
31
  workspaceToken: !0
20
32
  });
21
- if (e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load workspace roles");
33
+ if (l && e.errors && a(e.errors) && (e = await n({
34
+ gateway: "workspace",
35
+ authToken: s || void 0,
36
+ query: i,
37
+ variables: {
38
+ scopeId: u,
39
+ pagination: { limit: 50 }
40
+ },
41
+ workspaceId: u || void 0,
42
+ workspaceToken: !0
43
+ })), e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load workspace roles");
22
44
  return e.data?.roles ?? [];
23
45
  },
24
- enabled: !!s,
46
+ enabled: !!u,
25
47
  staleTime: 300 * 1e3
26
48
  });
27
49
  };
28
50
  //#endregion
29
- export { i as useWorkspaceRoles };
51
+ export { o as useWorkspaceRoles };
30
52
 
31
53
  //# sourceMappingURL=useWorkspaceRoles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkspaceRoles.js","names":[],"sources":["../../src/hooks/useWorkspaceRoles.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspacesContext } from '../providers/WorkspacesProvider';\n\nexport interface WorkspaceRoleOption {\n id: string;\n name: string;\n description?: string | null;\n isSystem: boolean;\n}\n\nconst GET_WORKSPACE_ROLES = `\n query GetWorkspaceRoles($scopeId: String!, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n`;\n\nexport const useWorkspaceRoles = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useQuery({\n queryKey: ['workspaceRoles', effectiveWorkspaceId],\n queryFn: async (): Promise<WorkspaceRoleOption[]> => {\n const result = await graphqlFetch<{ roles: WorkspaceRoleOption[] }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: GET_WORKSPACE_ROLES,\n variables: {\n scopeId: effectiveWorkspaceId,\n pagination: { limit: 50 },\n },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'Failed to load workspace roles');\n }\n\n return result.data?.roles ?? [];\n },\n enabled: !!effectiveWorkspaceId,\n staleTime: 5 * 60 * 1000,\n });\n};\n"],"mappings":";;;;AAWA,IAAM,IAAsB,kNAWf,KAAqB,MAAiC;CACjE,IAAM,EAAE,cAAW,mBAAgB,GAAsB,EACnD,IAAuB,KAAuB;AAEpD,QAAO,EAAS;EACd,UAAU,CAAC,kBAAkB,EAAqB;EAClD,SAAS,YAA4C;GACnD,IAAM,IAAS,MAAM,EAA+C;IAClE,SAAS;IACT,WAAW,KAAa,KAAA;IACxB,OAAO;IACP,WAAW;KACT,SAAS;KACT,YAAY,EAAE,OAAO,IAAI;KAC1B;IACD,aAAa,KAAwB,KAAA;IACrC,gBAAgB;IACjB,CAAC;AAEF,OAAI,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,iCAAiC;AAGhF,UAAO,EAAO,MAAM,SAAS,EAAE;;EAEjC,SAAS,CAAC,CAAC;EACX,WAAW,MAAS;EACrB,CAAC"}
1
+ {"version":3,"file":"useWorkspaceRoles.js","names":[],"sources":["../../src/hooks/useWorkspaceRoles.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspacesContext } from '../providers/WorkspacesProvider';\n\nexport interface WorkspaceRoleOption {\n id: string;\n name: string;\n description?: string | null;\n isSystem: boolean;\n}\n\nconst GET_WORKSPACE_ROLES_WITH_PRODUCT_FILTER = `\n query GetWorkspaceRoles($scopeId: String!, $filter: RoleFilterInput, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, filter: $filter, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n`;\n\nconst GET_WORKSPACE_ROLES_LEGACY = `\n query GetWorkspaceRoles($scopeId: String!, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, pagination: $pagination) {\n id\n name\n description\n isSystem\n }\n }\n`;\n\ninterface GraphqlErrorLike {\n message?: string | null;\n}\n\nexport function isUnsupportedProductRoleFilterError(errors: readonly GraphqlErrorLike[]): boolean {\n return errors.some(({ message }) => {\n if (!message?.includes('RoleFilterInput')) return false;\n const mentionsProductField =\n message.includes('product') || message.includes('includePlatformRoles');\n return (\n mentionsProductField && (message.includes('not defined') || message.includes('Unknown field'))\n );\n });\n}\n\nexport const useWorkspaceRoles = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId, productId } = useWorkspacesContext();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useQuery({\n queryKey: ['workspaceRoles', effectiveWorkspaceId, productId],\n queryFn: async (): Promise<WorkspaceRoleOption[]> => {\n let result = await graphqlFetch<{ roles: WorkspaceRoleOption[] }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: GET_WORKSPACE_ROLES_WITH_PRODUCT_FILTER,\n variables: {\n scopeId: effectiveWorkspaceId,\n filter: productId\n ? {\n product: productId,\n includePlatformRoles: false,\n }\n : undefined,\n pagination: { limit: 50 },\n },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true,\n });\n\n // During a rolling backend/gateway rollout the current supergraph may\n // still expose the pre-product RoleFilterInput. Preserve invite loading\n // until the new schema composes, then use server-side filtering normally.\n if (productId && result.errors && isUnsupportedProductRoleFilterError(result.errors)) {\n result = await graphqlFetch<{ roles: WorkspaceRoleOption[] }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: GET_WORKSPACE_ROLES_LEGACY,\n variables: {\n scopeId: effectiveWorkspaceId,\n pagination: { limit: 50 },\n },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true,\n });\n }\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'Failed to load workspace roles');\n }\n\n return result.data?.roles ?? [];\n },\n enabled: !!effectiveWorkspaceId,\n staleTime: 5 * 60 * 1000,\n });\n};\n"],"mappings":";;;;AAWA,IAAM,IAA0C,6PAW1C,IAA6B;AAenC,SAAgB,EAAoC,GAA8C;AAChG,QAAO,EAAO,MAAM,EAAE,iBACf,GAAS,SAAS,kBAAkB,IAEvC,EAAQ,SAAS,UAAU,IAAI,EAAQ,SAAS,uBAAuB,MAE9C,EAAQ,SAAS,cAAc,IAAI,EAAQ,SAAS,gBAAgB,IAJ7C,GAMlD;;AAGJ,IAAa,KAAqB,MAAiC;CACjE,IAAM,EAAE,cAAW,gBAAa,iBAAc,GAAsB,EAC9D,IAAuB,KAAuB;AAEpD,QAAO,EAAS;EACd,UAAU;GAAC;GAAkB;GAAsB;GAAU;EAC7D,SAAS,YAA4C;GACnD,IAAI,IAAS,MAAM,EAA+C;IAChE,SAAS;IACT,WAAW,KAAa,KAAA;IACxB,OAAO;IACP,WAAW;KACT,SAAS;KACT,QAAQ,IACJ;MACE,SAAS;MACT,sBAAsB;MACvB,GACD,KAAA;KACJ,YAAY,EAAE,OAAO,IAAI;KAC1B;IACD,aAAa,KAAwB,KAAA;IACrC,gBAAgB;IACjB,CAAC;AAmBF,OAdI,KAAa,EAAO,UAAU,EAAoC,EAAO,OAAO,KAClF,IAAS,MAAM,EAA+C;IAC5D,SAAS;IACT,WAAW,KAAa,KAAA;IACxB,OAAO;IACP,WAAW;KACT,SAAS;KACT,YAAY,EAAE,OAAO,IAAI;KAC1B;IACD,aAAa,KAAwB,KAAA;IACrC,gBAAgB;IACjB,CAAC,GAGA,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,iCAAiC;AAGhF,UAAO,EAAO,MAAM,SAAS,EAAE;;EAEjC,SAAS,CAAC,CAAC;EACX,WAAW,MAAS;EACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-workspaces",
3
- "version": "2026.711.1",
3
+ "version": "2026.719.1",
4
4
  "description": "Workspaces microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [