@burdenoff/microfe-workspaces 2026.1121.1 → 2026.1123.2

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.
@@ -0,0 +1,143 @@
1
+ import { GetCrossWorkspaceOverviewQuery, GetMspOrgLinksQuery, GetMspOrganizationSummaryQuery, GetWorkspaceSharesQuery } from '../generated/wspace-operations';
2
+ import { MspLinkRole, MspOrgLinkStatus, WorkspaceShareDirection, WorkspaceShareStatus } from '../generated/wspace-types';
3
+ export type CrossWorkspaceOverviewData = GetCrossWorkspaceOverviewQuery['crossWorkspaceOverview'];
4
+ export type CrossWorkspaceOrgSummaryData = CrossWorkspaceOverviewData['organizations'][number];
5
+ export type WorkspaceShareItem = GetWorkspaceSharesQuery['workspaceShares']['items'][number];
6
+ export type MspOrgLinkItem = GetMspOrgLinksQuery['mspOrgLinks']['items'][number];
7
+ export type MspOrganizationSummaryData = GetMspOrganizationSummaryQuery['mspOrganizationSummary'];
8
+ export declare function useCrossWorkspaceOverview(): import('@tanstack/react-query').UseQueryResult<{
9
+ totals: {
10
+ organizationCount: number;
11
+ managedOrganizationCount: number;
12
+ workspaceCount: number;
13
+ activeWorkspaceCount: number;
14
+ totalActiveSeats: number;
15
+ totalProjects: number;
16
+ activeShareCount: number;
17
+ };
18
+ organizations: Array<{
19
+ orgId: string;
20
+ orgName: string;
21
+ tenantId: string;
22
+ managedByMsp: boolean;
23
+ mspLinkId: string | null;
24
+ mspLinkStatus: import('../generated/wspace-operations').MspOrgLinkStatus | null;
25
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
26
+ workspaceCount: number;
27
+ activeWorkspaceCount: number;
28
+ totalMemberCount: number;
29
+ totalProjectCount: number;
30
+ activeShareCount: number;
31
+ billingSummary: {
32
+ totalWorkspaces: number;
33
+ activeWorkspaces: number;
34
+ totalActiveSeats: number;
35
+ totalProjects: number;
36
+ totalResources: number;
37
+ subscribedProductCount: number;
38
+ billingMode: import('../generated/wspace-operations').MspBillingMode | null;
39
+ monthlySeatBudget: number | null;
40
+ seatUtilizationPercent: number | null;
41
+ };
42
+ workspaces: Array<{
43
+ id: string;
44
+ name: string;
45
+ status: import('../generated/wspace-operations').WorkspaceStatus;
46
+ orgId: string;
47
+ tenantId: string;
48
+ memberCount: number;
49
+ projectCount: number;
50
+ resourceCount: number;
51
+ subscribedProductCount: number;
52
+ activeShareCount: number;
53
+ managedViaMsp: boolean;
54
+ mspLinkId: string | null;
55
+ createdAt: string;
56
+ }>;
57
+ }>;
58
+ }, Error>;
59
+ export declare function useWorkspaceShares(workspaceId: string | undefined, direction?: WorkspaceShareDirection, status?: WorkspaceShareStatus): import('@tanstack/react-query').UseQueryResult<{
60
+ totalCount: number;
61
+ items: Array<{
62
+ id: string;
63
+ workspaceId: string;
64
+ sourceWorkspaceName: string | null;
65
+ sourceOrgId: string;
66
+ targetWorkspaceId: string;
67
+ targetWorkspaceName: string | null;
68
+ targetOrgId: string;
69
+ resourceType: import('../generated/wspace-operations').WorkspaceShareResourceType;
70
+ resourceId: string;
71
+ resourceName: string;
72
+ accessLevel: import('../generated/wspace-operations').WorkspaceShareAccessLevel;
73
+ status: import('../generated/wspace-operations').WorkspaceShareStatus;
74
+ consentScope: string;
75
+ consentGrantedBy: string | null;
76
+ consentGrantedAt: string | null;
77
+ expiresAt: string | null;
78
+ revokedAt: string | null;
79
+ revokedBy: string | null;
80
+ revocationReason: string | null;
81
+ createdAt: string;
82
+ updatedAt: string;
83
+ createdBy: string;
84
+ }>;
85
+ }, Error>;
86
+ export declare function useMspOrgLinks(workspaceId: string | undefined, role?: MspLinkRole, status?: MspOrgLinkStatus): import('@tanstack/react-query').UseQueryResult<{
87
+ totalCount: number;
88
+ items: Array<{
89
+ id: string;
90
+ workspaceId: string;
91
+ mspOrgId: string;
92
+ clientOrgId: string;
93
+ clientOrgName: string;
94
+ clientWorkspaceId: string | null;
95
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
96
+ status: import('../generated/wspace-operations').MspOrgLinkStatus;
97
+ billingMode: import('../generated/wspace-operations').MspBillingMode;
98
+ monthlySeatBudget: number | null;
99
+ consentGrantedBy: string | null;
100
+ consentGrantedAt: string | null;
101
+ expiresAt: string | null;
102
+ revokedAt: string | null;
103
+ revokedBy: string | null;
104
+ notes: string | null;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ createdBy: string;
108
+ }>;
109
+ }, Error>;
110
+ export declare function useMspOrganizationSummary(workspaceId: string | undefined, targetOrgId: string | null): import('@tanstack/react-query').UseQueryResult<{
111
+ orgId: string;
112
+ orgName: string;
113
+ managedViaMsp: boolean;
114
+ mspLinkId: string | null;
115
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
116
+ activeSharesCount: number;
117
+ billingSummary: {
118
+ totalWorkspaces: number;
119
+ activeWorkspaces: number;
120
+ totalActiveSeats: number;
121
+ totalProjects: number;
122
+ totalResources: number;
123
+ subscribedProductCount: number;
124
+ billingMode: import('../generated/wspace-operations').MspBillingMode | null;
125
+ monthlySeatBudget: number | null;
126
+ seatUtilizationPercent: number | null;
127
+ };
128
+ workspaces: Array<{
129
+ id: string;
130
+ name: string;
131
+ status: import('../generated/wspace-operations').WorkspaceStatus;
132
+ orgId: string;
133
+ tenantId: string;
134
+ memberCount: number;
135
+ projectCount: number;
136
+ resourceCount: number;
137
+ subscribedProductCount: number;
138
+ activeShareCount: number;
139
+ managedViaMsp: boolean;
140
+ mspLinkId: string | null;
141
+ createdAt: string;
142
+ }>;
143
+ }, Error>;
@@ -0,0 +1,119 @@
1
+ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
2
+ import { GetCrossWorkspaceOverviewDocument as t, GetMspOrgLinksDocument as n, GetMspOrganizationSummaryDocument as r, GetWorkspaceSharesDocument as i } from "../generated/wspace-operations.js";
3
+ import { MspLinkRole as a, WorkspaceShareDirection as o } from "../generated/wspace-types.js";
4
+ import { useQuery as s } from "@tanstack/react-query";
5
+ import { print as c } from "graphql";
6
+ import { graphqlFetch as l } from "@burdenoff/fe-libs/shared/graphql";
7
+ // src/hooks/useCollaboration.ts
8
+ function u() {
9
+ let { authToken: n } = e();
10
+ return s({
11
+ queryKey: ["crossWorkspaceOverview"],
12
+ queryFn: async () => {
13
+ let e = await l({
14
+ gateway: "workspace",
15
+ authToken: n || void 0,
16
+ workspaceToken: !0,
17
+ query: c(t)
18
+ });
19
+ if (e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load cross-workspace overview");
20
+ if (!e.data?.crossWorkspaceOverview) throw Error("Cross-workspace overview returned empty response");
21
+ return e.data.crossWorkspaceOverview;
22
+ },
23
+ staleTime: 6e4,
24
+ retry: 1
25
+ });
26
+ }
27
+ function d(t, n = o.All, r) {
28
+ let { authToken: a } = e();
29
+ return s({
30
+ queryKey: [
31
+ "workspaceShares",
32
+ t,
33
+ n,
34
+ r
35
+ ],
36
+ queryFn: async () => {
37
+ let e = await l({
38
+ gateway: "workspace",
39
+ authToken: a || void 0,
40
+ workspaceToken: !0,
41
+ query: c(i),
42
+ variables: {
43
+ workspaceId: t,
44
+ direction: n,
45
+ status: r
46
+ }
47
+ });
48
+ if (e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load workspace shares");
49
+ return e.data?.workspaceShares ?? {
50
+ items: [],
51
+ totalCount: 0
52
+ };
53
+ },
54
+ enabled: !!t,
55
+ staleTime: 3e4,
56
+ retry: 1
57
+ });
58
+ }
59
+ function f(t, r = a.All, i) {
60
+ let { authToken: o } = e();
61
+ return s({
62
+ queryKey: [
63
+ "mspOrgLinks",
64
+ t,
65
+ r,
66
+ i
67
+ ],
68
+ queryFn: async () => {
69
+ let e = await l({
70
+ gateway: "workspace",
71
+ authToken: o || void 0,
72
+ workspaceToken: !0,
73
+ query: c(n),
74
+ variables: {
75
+ workspaceId: t,
76
+ role: r,
77
+ status: i
78
+ }
79
+ });
80
+ if (e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load MSP organization links");
81
+ return e.data?.mspOrgLinks ?? {
82
+ items: [],
83
+ totalCount: 0
84
+ };
85
+ },
86
+ enabled: !!t,
87
+ staleTime: 3e4,
88
+ retry: 1
89
+ });
90
+ }
91
+ function p(t, n) {
92
+ let { authToken: i } = e();
93
+ return s({
94
+ queryKey: [
95
+ "mspOrganizationSummary",
96
+ t,
97
+ n
98
+ ],
99
+ queryFn: async () => {
100
+ let e = await l({
101
+ gateway: "workspace",
102
+ authToken: i || void 0,
103
+ workspaceToken: !0,
104
+ query: c(r),
105
+ variables: {
106
+ workspaceId: t,
107
+ targetOrgId: n
108
+ }
109
+ });
110
+ if (e.errors?.length) throw Error(e.errors[0]?.message || "Failed to load organization summary");
111
+ if (!e.data?.mspOrganizationSummary) throw Error("Organization summary unavailable");
112
+ return e.data.mspOrganizationSummary;
113
+ },
114
+ enabled: !!(t && n),
115
+ staleTime: 3e4,
116
+ retry: 1
117
+ });
118
+ }
119
+ export { u as useCrossWorkspaceOverview, f as useMspOrgLinks, p as useMspOrganizationSummary, d as useWorkspaceShares };
@@ -0,0 +1,177 @@
1
+ import { CreateMspOrgLinkInput, CreateWorkspaceShareInput, UpdateMspOrgLinkInput } from '../generated/wspace-types';
2
+ /**
3
+ * Actor-bound mutations for Cross-Workspace Shares & MSP Multi-Org Links (BOFF-4425).
4
+ * Every mutation captures the acting account via `captureRequestActor` and dispatches
5
+ * through `pinnedFetch` so an in-flight profile switch can never misattribute a consent grant.
6
+ */
7
+ export declare function useCollaborationMutations(): {
8
+ createShare: import('@tanstack/react-query').UseMutationResult<{
9
+ id: string;
10
+ workspaceId: string;
11
+ sourceWorkspaceName: string | null;
12
+ sourceOrgId: string;
13
+ targetWorkspaceId: string;
14
+ targetWorkspaceName: string | null;
15
+ targetOrgId: string;
16
+ resourceType: import('../generated/wspace-operations').WorkspaceShareResourceType;
17
+ resourceId: string;
18
+ resourceName: string;
19
+ accessLevel: import('../generated/wspace-operations').WorkspaceShareAccessLevel;
20
+ status: import('../generated/wspace-operations').WorkspaceShareStatus;
21
+ consentScope: string;
22
+ consentGrantedBy: string | null;
23
+ consentGrantedAt: string | null;
24
+ expiresAt: string | null;
25
+ revokedAt: string | null;
26
+ revokedBy: string | null;
27
+ revocationReason: string | null;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ createdBy: string;
31
+ }, Error, CreateWorkspaceShareInput, unknown>;
32
+ acceptShare: import('@tanstack/react-query').UseMutationResult<{
33
+ id: string;
34
+ workspaceId: string;
35
+ sourceWorkspaceName: string | null;
36
+ sourceOrgId: string;
37
+ targetWorkspaceId: string;
38
+ targetWorkspaceName: string | null;
39
+ targetOrgId: string;
40
+ resourceType: import('../generated/wspace-operations').WorkspaceShareResourceType;
41
+ resourceId: string;
42
+ resourceName: string;
43
+ accessLevel: import('../generated/wspace-operations').WorkspaceShareAccessLevel;
44
+ status: import('../generated/wspace-operations').WorkspaceShareStatus;
45
+ consentScope: string;
46
+ consentGrantedBy: string | null;
47
+ consentGrantedAt: string | null;
48
+ expiresAt: string | null;
49
+ revokedAt: string | null;
50
+ revokedBy: string | null;
51
+ revocationReason: string | null;
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ createdBy: string;
55
+ }, Error, {
56
+ workspaceId: string;
57
+ shareId: string;
58
+ }, unknown>;
59
+ revokeShare: import('@tanstack/react-query').UseMutationResult<{
60
+ id: string;
61
+ workspaceId: string;
62
+ sourceWorkspaceName: string | null;
63
+ sourceOrgId: string;
64
+ targetWorkspaceId: string;
65
+ targetWorkspaceName: string | null;
66
+ targetOrgId: string;
67
+ resourceType: import('../generated/wspace-operations').WorkspaceShareResourceType;
68
+ resourceId: string;
69
+ resourceName: string;
70
+ accessLevel: import('../generated/wspace-operations').WorkspaceShareAccessLevel;
71
+ status: import('../generated/wspace-operations').WorkspaceShareStatus;
72
+ consentScope: string;
73
+ consentGrantedBy: string | null;
74
+ consentGrantedAt: string | null;
75
+ expiresAt: string | null;
76
+ revokedAt: string | null;
77
+ revokedBy: string | null;
78
+ revocationReason: string | null;
79
+ createdAt: string;
80
+ updatedAt: string;
81
+ createdBy: string;
82
+ }, Error, {
83
+ workspaceId: string;
84
+ shareId: string;
85
+ reason?: string;
86
+ }, unknown>;
87
+ createMspLink: import('@tanstack/react-query').UseMutationResult<{
88
+ id: string;
89
+ workspaceId: string;
90
+ mspOrgId: string;
91
+ clientOrgId: string;
92
+ clientOrgName: string;
93
+ clientWorkspaceId: string | null;
94
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
95
+ status: import('../generated/wspace-operations').MspOrgLinkStatus;
96
+ billingMode: import('../generated/wspace-operations').MspBillingMode;
97
+ monthlySeatBudget: number | null;
98
+ consentGrantedBy: string | null;
99
+ consentGrantedAt: string | null;
100
+ expiresAt: string | null;
101
+ revokedAt: string | null;
102
+ revokedBy: string | null;
103
+ notes: string | null;
104
+ createdAt: string;
105
+ updatedAt: string;
106
+ createdBy: string;
107
+ }, Error, CreateMspOrgLinkInput, unknown>;
108
+ approveMspLink: import('@tanstack/react-query').UseMutationResult<{
109
+ id: string;
110
+ workspaceId: string;
111
+ mspOrgId: string;
112
+ clientOrgId: string;
113
+ clientOrgName: string;
114
+ clientWorkspaceId: string | null;
115
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
116
+ status: import('../generated/wspace-operations').MspOrgLinkStatus;
117
+ billingMode: import('../generated/wspace-operations').MspBillingMode;
118
+ monthlySeatBudget: number | null;
119
+ consentGrantedBy: string | null;
120
+ consentGrantedAt: string | null;
121
+ expiresAt: string | null;
122
+ revokedAt: string | null;
123
+ revokedBy: string | null;
124
+ notes: string | null;
125
+ createdAt: string;
126
+ updatedAt: string;
127
+ createdBy: string;
128
+ }, Error, {
129
+ workspaceId: string;
130
+ linkId: string;
131
+ }, unknown>;
132
+ updateMspLink: import('@tanstack/react-query').UseMutationResult<{
133
+ id: string;
134
+ workspaceId: string;
135
+ mspOrgId: string;
136
+ clientOrgId: string;
137
+ clientOrgName: string;
138
+ clientWorkspaceId: string | null;
139
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
140
+ status: import('../generated/wspace-operations').MspOrgLinkStatus;
141
+ billingMode: import('../generated/wspace-operations').MspBillingMode;
142
+ monthlySeatBudget: number | null;
143
+ consentGrantedBy: string | null;
144
+ consentGrantedAt: string | null;
145
+ expiresAt: string | null;
146
+ revokedAt: string | null;
147
+ revokedBy: string | null;
148
+ notes: string | null;
149
+ createdAt: string;
150
+ updatedAt: string;
151
+ createdBy: string;
152
+ }, Error, UpdateMspOrgLinkInput, unknown>;
153
+ revokeMspLink: import('@tanstack/react-query').UseMutationResult<{
154
+ id: string;
155
+ workspaceId: string;
156
+ mspOrgId: string;
157
+ clientOrgId: string;
158
+ clientOrgName: string;
159
+ clientWorkspaceId: string | null;
160
+ delegatedScopes: Array<import('../generated/wspace-operations').MspDelegatedScope>;
161
+ status: import('../generated/wspace-operations').MspOrgLinkStatus;
162
+ billingMode: import('../generated/wspace-operations').MspBillingMode;
163
+ monthlySeatBudget: number | null;
164
+ consentGrantedBy: string | null;
165
+ consentGrantedAt: string | null;
166
+ expiresAt: string | null;
167
+ revokedAt: string | null;
168
+ revokedBy: string | null;
169
+ notes: string | null;
170
+ createdAt: string;
171
+ updatedAt: string;
172
+ createdBy: string;
173
+ }, Error, {
174
+ workspaceId: string;
175
+ linkId: string;
176
+ }, unknown>;
177
+ };
@@ -0,0 +1,126 @@
1
+ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
2
+ import { captureRequestActor as t, pinnedFetch as n } from "../utils/pinnedRequest.js";
3
+ import { AcceptWorkspaceShareDocument as r, ApproveMspOrgLinkDocument as i, CreateMspOrgLinkDocument as a, CreateWorkspaceShareDocument as o, RevokeMspOrgLinkDocument as s, RevokeWorkspaceShareDocument as c, UpdateMspOrgLinkDocument as l } from "../generated/wspace-operations.js";
4
+ import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
5
+ import { print as f } from "graphql";
6
+ // src/hooks/useCollaborationMutations.ts
7
+ function p() {
8
+ let { authToken: p, currentUser: m } = e(), h = d(), g = () => {
9
+ h.invalidateQueries({ queryKey: ["crossWorkspaceOverview"] }), h.invalidateQueries({ queryKey: ["workspaceShares"] }), h.invalidateQueries({ queryKey: ["mspOrgLinks"] }), h.invalidateQueries({ queryKey: ["mspOrganizationSummary"] });
10
+ };
11
+ return {
12
+ createShare: u({
13
+ mutationFn: async (e) => {
14
+ let r = t({
15
+ authToken: p,
16
+ currentUser: m
17
+ }), i = await n(r, {
18
+ gateway: "workspace",
19
+ workspaceId: e.workspaceId,
20
+ query: f(o),
21
+ variables: { input: e }
22
+ });
23
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to create share");
24
+ return i.data.createWorkspaceShare;
25
+ },
26
+ onSuccess: g
27
+ }),
28
+ acceptShare: u({
29
+ mutationFn: async (e) => {
30
+ let i = t({
31
+ authToken: p,
32
+ currentUser: m
33
+ }), a = await n(i, {
34
+ gateway: "workspace",
35
+ workspaceId: e.workspaceId,
36
+ query: f(r),
37
+ variables: e
38
+ });
39
+ if (a.errors?.length) throw Error(a.errors[0]?.message || "Failed to accept share");
40
+ return a.data.acceptWorkspaceShare;
41
+ },
42
+ onSuccess: g
43
+ }),
44
+ revokeShare: u({
45
+ mutationFn: async (e) => {
46
+ let r = t({
47
+ authToken: p,
48
+ currentUser: m
49
+ }), i = await n(r, {
50
+ gateway: "workspace",
51
+ workspaceId: e.workspaceId,
52
+ query: f(c),
53
+ variables: e
54
+ });
55
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to revoke share");
56
+ return i.data.revokeWorkspaceShare;
57
+ },
58
+ onSuccess: g
59
+ }),
60
+ createMspLink: u({
61
+ mutationFn: async (e) => {
62
+ let r = t({
63
+ authToken: p,
64
+ currentUser: m
65
+ }), i = await n(r, {
66
+ gateway: "workspace",
67
+ workspaceId: e.workspaceId,
68
+ query: f(a),
69
+ variables: { input: e }
70
+ });
71
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to create MSP link");
72
+ return i.data.createMspOrgLink;
73
+ },
74
+ onSuccess: g
75
+ }),
76
+ approveMspLink: u({
77
+ mutationFn: async (e) => {
78
+ let r = t({
79
+ authToken: p,
80
+ currentUser: m
81
+ }), a = await n(r, {
82
+ gateway: "workspace",
83
+ workspaceId: e.workspaceId,
84
+ query: f(i),
85
+ variables: e
86
+ });
87
+ if (a.errors?.length) throw Error(a.errors[0]?.message || "Failed to approve MSP link");
88
+ return a.data.approveMspOrgLink;
89
+ },
90
+ onSuccess: g
91
+ }),
92
+ updateMspLink: u({
93
+ mutationFn: async (e) => {
94
+ let r = t({
95
+ authToken: p,
96
+ currentUser: m
97
+ }), i = await n(r, {
98
+ gateway: "workspace",
99
+ workspaceId: e.workspaceId,
100
+ query: f(l),
101
+ variables: { input: e }
102
+ });
103
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to update MSP link");
104
+ return i.data.updateMspOrgLink;
105
+ },
106
+ onSuccess: g
107
+ }),
108
+ revokeMspLink: u({
109
+ mutationFn: async (e) => {
110
+ let r = t({
111
+ authToken: p,
112
+ currentUser: m
113
+ }), i = await n(r, {
114
+ gateway: "workspace",
115
+ workspaceId: e.workspaceId,
116
+ query: f(s),
117
+ variables: e
118
+ });
119
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to revoke MSP link");
120
+ return i.data.revokeMspOrgLink;
121
+ },
122
+ onSuccess: g
123
+ })
124
+ };
125
+ }
126
+ export { p as useCollaborationMutations };