@burdenoff/microfe-workspaces 2026.1029.2 → 2026.1108.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.
- package/dist/hooks/useMemberMutations.js +163 -152
- package/dist/hooks/useProjectMemberMutations.js +44 -42
- package/dist/hooks/useProjectMutations.js +113 -108
- package/dist/hooks/useWorkspaceMutations.js +89 -82
- package/dist/pages/dashboard/DashboardPage.js +2 -0
- package/dist/pages/dashboard/hooks/useDashboardPreferences.js +14 -15
- package/dist/pages/dashboard/widgets/GroupsWidget.js +5 -1
- package/dist/pages/dashboard/widgets/MembersWidget.js +5 -1
- package/dist/pages/dashboard/widgets/TagCloudWidget.js +5 -1
- package/dist/utils/pinnedRequest.d.ts +35 -0
- package/dist/utils/pinnedRequest.js +53 -0
- package/package.json +3 -2
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
|
|
2
2
|
import { AcceptInvitationDocument as t, AddWorkspaceMemberDocument as n, BulkCreateInvitationsDocument as r, CancelInvitationDocument as i, CreateInvitationDocument as a, DeleteInvitationDocument as o, RejectInvitationDocument as s, RemoveUserFromWorkspaceDocument as c, RemoveWorkspaceMemberDocument as l, ResendInvitationDocument as u, UpdateInvitationDocument as d } from "../generated/wspace-operations.js";
|
|
3
3
|
import { useWorkspacesEventEmitter as f } from "./useWorkspacesEventEmitter.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { captureRequestActor as p, pinnedFetch as m } from "../utils/pinnedRequest.js";
|
|
5
|
+
import { safeTelemetryError as h } from "../utils/telemetryError.js";
|
|
6
|
+
import { useMutation as g, useQueryClient as _ } from "@tanstack/react-query";
|
|
7
|
+
import { print as v } from "graphql";
|
|
8
8
|
//#region src/hooks/useMemberMutations.ts
|
|
9
|
-
function
|
|
9
|
+
function y(e, t) {
|
|
10
10
|
e.invalidateQueries({ queryKey: ["workspaceMembers"] }), e.invalidateQueries({ queryKey: ["workspaceMembersInfinite"] }), e.invalidateQueries({ queryKey: ["userWorkspaces"] }), e.invalidateQueries({ queryKey: ["myWorkspaces"] }), e.invalidateQueries({ queryKey: ["dashboard", "global"] }), t && (e.invalidateQueries({ queryKey: ["workspaceMembers", t] }), e.invalidateQueries({ queryKey: ["workspaceMembersInfinite", t] }), e.invalidateQueries({ queryKey: [
|
|
11
11
|
"dashboard",
|
|
12
12
|
"workspace",
|
|
13
13
|
t
|
|
14
14
|
] }));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function b(e, t, n, r = !1) {
|
|
17
17
|
t && r && e.setQueriesData({ queryKey: ["myPendingInvitations"] }, (e) => Array.isArray(e) ? e.filter((e) => e.id !== t) : e), e.invalidateQueries({ queryKey: ["workspaceInvitations"] }), e.invalidateQueries({ queryKey: ["myPendingInvitations"] }), t && e.invalidateQueries({ queryKey: ["invitation", t] }), n && e.invalidateQueries({ queryKey: ["workspaceInvitations", n] });
|
|
18
18
|
}
|
|
19
|
-
var
|
|
20
|
-
let { authToken: t,
|
|
21
|
-
return
|
|
19
|
+
var x = () => {
|
|
20
|
+
let { authToken: t, currentUser: r, workspaceId: i } = e(), a = _(), { emit: o } = f();
|
|
21
|
+
return g({
|
|
22
22
|
mutationFn: async (e) => {
|
|
23
|
-
let
|
|
23
|
+
let a = await m(p({
|
|
24
|
+
authToken: t,
|
|
25
|
+
currentUser: r
|
|
26
|
+
}), {
|
|
24
27
|
gateway: "workspace",
|
|
25
|
-
|
|
26
|
-
query: g(n),
|
|
28
|
+
query: v(n),
|
|
27
29
|
variables: { input: e },
|
|
28
|
-
workspaceId:
|
|
29
|
-
workspaceToken: !0
|
|
30
|
+
workspaceId: i || void 0
|
|
30
31
|
});
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
32
|
+
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
33
|
+
return a.data.addWorkspaceMember;
|
|
33
34
|
},
|
|
34
35
|
onSuccess: (e) => {
|
|
35
|
-
|
|
36
|
+
y(a, e.workspaceId), o("workspace-member.added", {
|
|
36
37
|
memberId: e.id,
|
|
37
38
|
workspaceId: e.workspaceId,
|
|
38
39
|
userId: e.userId,
|
|
@@ -40,314 +41,324 @@ var b = () => {
|
|
|
40
41
|
});
|
|
41
42
|
},
|
|
42
43
|
onError: (e, t) => {
|
|
43
|
-
|
|
44
|
-
workspaceId:
|
|
44
|
+
o("workspace-member.add_failed", {
|
|
45
|
+
workspaceId: i || void 0,
|
|
45
46
|
userId: t?.userId,
|
|
46
47
|
source: "microfe-workspaces",
|
|
47
|
-
errorMessage:
|
|
48
|
+
errorMessage: h(e)
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
|
-
},
|
|
52
|
-
let { authToken: n,
|
|
53
|
-
return
|
|
52
|
+
}, S = (t) => {
|
|
53
|
+
let { authToken: n, currentUser: r, workspaceId: i } = e(), a = _(), { emit: o } = f(), s = t || i;
|
|
54
|
+
return g({
|
|
54
55
|
mutationFn: async (e) => {
|
|
55
|
-
let t = await
|
|
56
|
+
let t = await m(p({
|
|
57
|
+
authToken: n,
|
|
58
|
+
currentUser: r
|
|
59
|
+
}), {
|
|
56
60
|
gateway: "workspace",
|
|
57
|
-
|
|
58
|
-
query: g(l),
|
|
61
|
+
query: v(l),
|
|
59
62
|
variables: { id: e },
|
|
60
|
-
workspaceId:
|
|
61
|
-
workspaceToken: !0
|
|
63
|
+
workspaceId: s || void 0
|
|
62
64
|
});
|
|
63
65
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
64
66
|
return t.data.removeWorkspaceMember;
|
|
65
67
|
},
|
|
66
68
|
onSuccess: (e, t) => {
|
|
67
|
-
|
|
69
|
+
y(a, s), o("workspace-member.removed", {
|
|
68
70
|
memberId: t,
|
|
69
71
|
source: "microfe-workspaces"
|
|
70
72
|
});
|
|
71
73
|
},
|
|
72
74
|
onError: (e, t) => {
|
|
73
|
-
|
|
75
|
+
o("workspace-member.remove_failed", {
|
|
74
76
|
memberId: t,
|
|
75
|
-
workspaceId:
|
|
77
|
+
workspaceId: s || void 0,
|
|
76
78
|
source: "microfe-workspaces",
|
|
77
|
-
errorMessage:
|
|
79
|
+
errorMessage: h(e)
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
|
-
},
|
|
82
|
-
let { authToken: n,
|
|
83
|
-
return
|
|
83
|
+
}, C = (t) => {
|
|
84
|
+
let { authToken: n, currentUser: r, workspaceId: i } = e(), a = _(), { emit: o } = f(), s = t || i;
|
|
85
|
+
return g({
|
|
84
86
|
mutationFn: async (e) => {
|
|
85
|
-
let t = await
|
|
87
|
+
let t = await m(p({
|
|
88
|
+
authToken: n,
|
|
89
|
+
currentUser: r
|
|
90
|
+
}), {
|
|
86
91
|
gateway: "workspace",
|
|
87
|
-
|
|
88
|
-
query: g(c),
|
|
92
|
+
query: v(c),
|
|
89
93
|
variables: { userId: e },
|
|
90
|
-
workspaceId:
|
|
91
|
-
workspaceToken: !0
|
|
94
|
+
workspaceId: s || void 0
|
|
92
95
|
});
|
|
93
96
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
94
97
|
return t.data.removeUserFromWorkspace;
|
|
95
98
|
},
|
|
96
99
|
onSuccess: (e, t) => {
|
|
97
|
-
|
|
100
|
+
y(a, s), a.invalidateQueries({ queryKey: ["userWorkspaces", t] }), o("workspace-member.removed", {
|
|
98
101
|
userId: t,
|
|
99
102
|
source: "microfe-workspaces"
|
|
100
103
|
});
|
|
101
104
|
},
|
|
102
105
|
onError: (e, t) => {
|
|
103
|
-
|
|
106
|
+
o("workspace-member.remove_failed", {
|
|
104
107
|
userId: t,
|
|
105
|
-
workspaceId:
|
|
108
|
+
workspaceId: s || void 0,
|
|
106
109
|
source: "microfe-workspaces",
|
|
107
|
-
errorMessage:
|
|
110
|
+
errorMessage: h(e)
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
});
|
|
111
|
-
},
|
|
112
|
-
let { authToken: n,
|
|
113
|
-
return
|
|
114
|
+
}, w = (t) => {
|
|
115
|
+
let { authToken: n, currentUser: r, workspaceId: i } = e(), o = _(), { emit: s } = f(), c = t || i;
|
|
116
|
+
return g({
|
|
114
117
|
mutationFn: async (e) => {
|
|
115
|
-
let t = await
|
|
118
|
+
let t = await m(p({
|
|
119
|
+
authToken: n,
|
|
120
|
+
currentUser: r
|
|
121
|
+
}), {
|
|
116
122
|
gateway: "workspace",
|
|
117
|
-
|
|
118
|
-
query: g(a),
|
|
123
|
+
query: v(a),
|
|
119
124
|
variables: { input: e },
|
|
120
|
-
workspaceId: e.workspaceId ||
|
|
121
|
-
workspaceToken: !0
|
|
125
|
+
workspaceId: e.workspaceId || c || void 0
|
|
122
126
|
});
|
|
123
127
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
124
128
|
return t.data.createInvitation;
|
|
125
129
|
},
|
|
126
130
|
onSuccess: (e) => {
|
|
127
|
-
let t = e.workspaceId ??
|
|
128
|
-
|
|
131
|
+
let t = e.workspaceId ?? c;
|
|
132
|
+
b(o, e.id, t), s("workspace-invitation.created", {
|
|
129
133
|
invitationId: e.id,
|
|
130
134
|
workspaceId: e.workspaceId,
|
|
131
135
|
source: "microfe-workspaces"
|
|
132
136
|
});
|
|
133
137
|
},
|
|
134
138
|
onError: (e, t) => {
|
|
135
|
-
|
|
136
|
-
workspaceId: t?.workspaceId ||
|
|
139
|
+
s("workspace-invitation.create_failed", {
|
|
140
|
+
workspaceId: t?.workspaceId || c || void 0,
|
|
137
141
|
source: "microfe-workspaces",
|
|
138
|
-
errorMessage:
|
|
142
|
+
errorMessage: h(e)
|
|
139
143
|
});
|
|
140
144
|
}
|
|
141
145
|
});
|
|
142
|
-
},
|
|
143
|
-
let { authToken: t,
|
|
144
|
-
return
|
|
145
|
-
mutationFn: async ({ id: e, input:
|
|
146
|
-
let
|
|
146
|
+
}, T = () => {
|
|
147
|
+
let { authToken: t, currentUser: n, workspaceId: r } = e(), i = _(), { emit: a } = f();
|
|
148
|
+
return g({
|
|
149
|
+
mutationFn: async ({ id: e, input: i }) => {
|
|
150
|
+
let a = await m(p({
|
|
151
|
+
authToken: t,
|
|
152
|
+
currentUser: n
|
|
153
|
+
}), {
|
|
147
154
|
gateway: "workspace",
|
|
148
|
-
|
|
149
|
-
query: g(d),
|
|
155
|
+
query: v(d),
|
|
150
156
|
variables: {
|
|
151
157
|
id: e,
|
|
152
|
-
input:
|
|
158
|
+
input: i
|
|
153
159
|
},
|
|
154
|
-
workspaceId:
|
|
155
|
-
workspaceToken: !0
|
|
160
|
+
workspaceId: r || void 0
|
|
156
161
|
});
|
|
157
|
-
if (
|
|
158
|
-
return
|
|
162
|
+
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
163
|
+
return a.data.updateInvitation;
|
|
159
164
|
},
|
|
160
165
|
onSuccess: (e) => {
|
|
161
|
-
|
|
166
|
+
b(i, e.id, e.workspaceId), a("workspace-invitation.updated", {
|
|
162
167
|
invitationId: e.id,
|
|
163
168
|
workspaceId: e.workspaceId,
|
|
164
169
|
source: "microfe-workspaces"
|
|
165
170
|
});
|
|
166
171
|
},
|
|
167
172
|
onError: (e, t) => {
|
|
168
|
-
|
|
173
|
+
a("workspace-invitation.update_failed", {
|
|
169
174
|
invitationId: t?.id,
|
|
170
|
-
workspaceId:
|
|
175
|
+
workspaceId: r || void 0,
|
|
171
176
|
source: "microfe-workspaces",
|
|
172
|
-
errorMessage:
|
|
177
|
+
errorMessage: h(e)
|
|
173
178
|
});
|
|
174
179
|
}
|
|
175
180
|
});
|
|
176
|
-
},
|
|
177
|
-
let { authToken: n,
|
|
178
|
-
return
|
|
181
|
+
}, E = () => {
|
|
182
|
+
let { authToken: n, currentUser: r, workspaceId: i } = e(), a = _(), { emit: o } = f();
|
|
183
|
+
return g({
|
|
179
184
|
mutationFn: async (e) => {
|
|
180
|
-
let
|
|
185
|
+
let a = await m(p({
|
|
186
|
+
authToken: n,
|
|
187
|
+
currentUser: r
|
|
188
|
+
}), {
|
|
181
189
|
gateway: "workspace",
|
|
182
|
-
|
|
183
|
-
query: g(t),
|
|
190
|
+
query: v(t),
|
|
184
191
|
variables: { id: e },
|
|
185
|
-
workspaceId:
|
|
186
|
-
workspaceToken: !0
|
|
192
|
+
workspaceId: i || void 0
|
|
187
193
|
});
|
|
188
|
-
if (
|
|
189
|
-
return
|
|
194
|
+
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
195
|
+
return a.data.acceptInvitation;
|
|
190
196
|
},
|
|
191
197
|
onSuccess: (e) => {
|
|
192
|
-
|
|
198
|
+
b(a, e.id, e.workspaceId, !0), y(a, e.workspaceId), o("workspace-invitation.accepted", {
|
|
193
199
|
invitationId: e.id,
|
|
194
200
|
workspaceId: e.workspaceId,
|
|
195
201
|
source: "microfe-workspaces"
|
|
196
202
|
});
|
|
197
203
|
},
|
|
198
204
|
onError: (e, t) => {
|
|
199
|
-
|
|
205
|
+
o("workspace-invitation.accept_failed", {
|
|
200
206
|
invitationId: t,
|
|
201
|
-
workspaceId:
|
|
207
|
+
workspaceId: i || void 0,
|
|
202
208
|
source: "microfe-workspaces",
|
|
203
|
-
errorMessage:
|
|
209
|
+
errorMessage: h(e)
|
|
204
210
|
});
|
|
205
211
|
}
|
|
206
212
|
});
|
|
207
|
-
},
|
|
208
|
-
let { authToken: t,
|
|
209
|
-
return
|
|
213
|
+
}, D = () => {
|
|
214
|
+
let { authToken: t, currentUser: n, workspaceId: r } = e(), i = _(), { emit: a } = f();
|
|
215
|
+
return g({
|
|
210
216
|
mutationFn: async (e) => {
|
|
211
|
-
let
|
|
217
|
+
let i = await m(p({
|
|
218
|
+
authToken: t,
|
|
219
|
+
currentUser: n
|
|
220
|
+
}), {
|
|
212
221
|
gateway: "workspace",
|
|
213
|
-
|
|
214
|
-
query: g(s),
|
|
222
|
+
query: v(s),
|
|
215
223
|
variables: { id: e },
|
|
216
|
-
workspaceId:
|
|
217
|
-
workspaceToken: !0
|
|
224
|
+
workspaceId: r || void 0
|
|
218
225
|
});
|
|
219
|
-
if (
|
|
220
|
-
return
|
|
226
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
|
|
227
|
+
return i.data.rejectInvitation;
|
|
221
228
|
},
|
|
222
229
|
onSuccess: (e) => {
|
|
223
|
-
|
|
230
|
+
b(i, e.id, e.workspaceId, !0), a("workspace-invitation.rejected", {
|
|
224
231
|
invitationId: e.id,
|
|
225
232
|
workspaceId: e.workspaceId,
|
|
226
233
|
source: "microfe-workspaces"
|
|
227
234
|
});
|
|
228
235
|
},
|
|
229
236
|
onError: (e, t) => {
|
|
230
|
-
|
|
237
|
+
a("workspace-invitation.reject_failed", {
|
|
231
238
|
invitationId: t,
|
|
232
|
-
workspaceId:
|
|
239
|
+
workspaceId: r || void 0,
|
|
233
240
|
source: "microfe-workspaces",
|
|
234
|
-
errorMessage:
|
|
241
|
+
errorMessage: h(e)
|
|
235
242
|
});
|
|
236
243
|
}
|
|
237
244
|
});
|
|
238
|
-
},
|
|
239
|
-
let { authToken: n,
|
|
240
|
-
return
|
|
245
|
+
}, O = (t) => {
|
|
246
|
+
let { authToken: n, currentUser: r, workspaceId: a } = e(), o = _(), { emit: s } = f(), c = t || a;
|
|
247
|
+
return g({
|
|
241
248
|
mutationFn: async (e) => {
|
|
242
|
-
let t = await
|
|
249
|
+
let t = await m(p({
|
|
250
|
+
authToken: n,
|
|
251
|
+
currentUser: r
|
|
252
|
+
}), {
|
|
243
253
|
gateway: "workspace",
|
|
244
|
-
|
|
245
|
-
query: g(i),
|
|
254
|
+
query: v(i),
|
|
246
255
|
variables: { id: e },
|
|
247
|
-
workspaceId:
|
|
248
|
-
workspaceToken: !0
|
|
256
|
+
workspaceId: c || void 0
|
|
249
257
|
});
|
|
250
258
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
251
259
|
return t.data.cancelInvitation;
|
|
252
260
|
},
|
|
253
261
|
onSuccess: (e) => {
|
|
254
|
-
|
|
262
|
+
b(o, e.id, e.workspaceId ?? c, !0), s("workspace-invitation.cancelled", {
|
|
255
263
|
invitationId: e.id,
|
|
256
264
|
workspaceId: e.workspaceId,
|
|
257
265
|
source: "microfe-workspaces"
|
|
258
266
|
});
|
|
259
267
|
},
|
|
260
268
|
onError: (e, t) => {
|
|
261
|
-
|
|
269
|
+
s("workspace-invitation.cancel_failed", {
|
|
262
270
|
invitationId: t,
|
|
263
|
-
workspaceId:
|
|
271
|
+
workspaceId: c || void 0,
|
|
264
272
|
source: "microfe-workspaces",
|
|
265
|
-
errorMessage:
|
|
273
|
+
errorMessage: h(e)
|
|
266
274
|
});
|
|
267
275
|
}
|
|
268
276
|
});
|
|
269
|
-
},
|
|
270
|
-
let { authToken: n,
|
|
271
|
-
return
|
|
277
|
+
}, k = (t) => {
|
|
278
|
+
let { authToken: n, currentUser: r, workspaceId: i } = e(), a = _(), { emit: o } = f(), s = t || i;
|
|
279
|
+
return g({
|
|
272
280
|
mutationFn: async (e) => {
|
|
273
|
-
let t = await
|
|
281
|
+
let t = await m(p({
|
|
282
|
+
authToken: n,
|
|
283
|
+
currentUser: r
|
|
284
|
+
}), {
|
|
274
285
|
gateway: "workspace",
|
|
275
|
-
|
|
276
|
-
query: g(u),
|
|
286
|
+
query: v(u),
|
|
277
287
|
variables: { id: e },
|
|
278
|
-
workspaceId:
|
|
279
|
-
workspaceToken: !0
|
|
288
|
+
workspaceId: s || void 0
|
|
280
289
|
});
|
|
281
290
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
282
291
|
return t.data.resendInvitation;
|
|
283
292
|
},
|
|
284
293
|
onSuccess: (e) => {
|
|
285
|
-
|
|
294
|
+
b(a, e.id, e.workspaceId ?? s), o("workspace-invitation.resent", {
|
|
286
295
|
invitationId: e.id,
|
|
287
296
|
workspaceId: e.workspaceId,
|
|
288
297
|
source: "microfe-workspaces"
|
|
289
298
|
});
|
|
290
299
|
},
|
|
291
300
|
onError: (e, t) => {
|
|
292
|
-
|
|
301
|
+
o("workspace-invitation.resend_failed", {
|
|
293
302
|
invitationId: t,
|
|
294
|
-
workspaceId:
|
|
303
|
+
workspaceId: s || void 0,
|
|
295
304
|
source: "microfe-workspaces",
|
|
296
|
-
errorMessage:
|
|
305
|
+
errorMessage: h(e)
|
|
297
306
|
});
|
|
298
307
|
}
|
|
299
308
|
});
|
|
300
|
-
},
|
|
301
|
-
let { authToken: t,
|
|
302
|
-
return
|
|
309
|
+
}, A = () => {
|
|
310
|
+
let { authToken: t, currentUser: n, workspaceId: r } = e(), i = _(), { emit: a } = f();
|
|
311
|
+
return g({
|
|
303
312
|
mutationFn: async (e) => {
|
|
304
|
-
let
|
|
313
|
+
let i = await m(p({
|
|
314
|
+
authToken: t,
|
|
315
|
+
currentUser: n
|
|
316
|
+
}), {
|
|
305
317
|
gateway: "workspace",
|
|
306
|
-
|
|
307
|
-
query: g(o),
|
|
318
|
+
query: v(o),
|
|
308
319
|
variables: { id: e },
|
|
309
|
-
workspaceId:
|
|
310
|
-
workspaceToken: !0
|
|
320
|
+
workspaceId: r || void 0
|
|
311
321
|
});
|
|
312
|
-
if (
|
|
313
|
-
return
|
|
322
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
|
|
323
|
+
return i.data.deleteInvitation;
|
|
314
324
|
},
|
|
315
325
|
onSuccess: (e, t) => {
|
|
316
|
-
|
|
326
|
+
b(i, t, r, !0), a("workspace-invitation.deleted", {
|
|
317
327
|
invitationId: t,
|
|
318
328
|
source: "microfe-workspaces"
|
|
319
329
|
});
|
|
320
330
|
},
|
|
321
331
|
onError: (e, t) => {
|
|
322
|
-
|
|
332
|
+
a("workspace-invitation.delete_failed", {
|
|
323
333
|
invitationId: t,
|
|
324
|
-
workspaceId:
|
|
334
|
+
workspaceId: r || void 0,
|
|
325
335
|
source: "microfe-workspaces",
|
|
326
|
-
errorMessage:
|
|
336
|
+
errorMessage: h(e)
|
|
327
337
|
});
|
|
328
338
|
}
|
|
329
339
|
});
|
|
330
|
-
},
|
|
331
|
-
let { authToken: t,
|
|
332
|
-
return
|
|
340
|
+
}, j = () => {
|
|
341
|
+
let { authToken: t, currentUser: n, workspaceId: i } = e(), a = _();
|
|
342
|
+
return g({
|
|
333
343
|
mutationFn: async (e) => {
|
|
334
|
-
let
|
|
344
|
+
let a = await m(p({
|
|
345
|
+
authToken: t,
|
|
346
|
+
currentUser: n
|
|
347
|
+
}), {
|
|
335
348
|
gateway: "workspace",
|
|
336
|
-
|
|
337
|
-
query: g(r),
|
|
349
|
+
query: v(r),
|
|
338
350
|
variables: { inputs: e },
|
|
339
|
-
workspaceId: e[0]?.workspaceId ||
|
|
340
|
-
workspaceToken: !0
|
|
351
|
+
workspaceId: e[0]?.workspaceId || i || void 0
|
|
341
352
|
});
|
|
342
|
-
if (
|
|
343
|
-
return
|
|
353
|
+
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
354
|
+
return a.data.bulkCreateInvitations;
|
|
344
355
|
},
|
|
345
356
|
onSuccess: (e) => {
|
|
346
|
-
|
|
357
|
+
a.invalidateQueries({ queryKey: ["workspaceInvitations"] }), a.invalidateQueries({ queryKey: ["myPendingInvitations"] });
|
|
347
358
|
let t = new Set(e.map((e) => e.workspaceId).filter(Boolean));
|
|
348
|
-
for (let e of t)
|
|
359
|
+
for (let e of t) a.invalidateQueries({ queryKey: ["workspaceInvitations", e] });
|
|
349
360
|
}
|
|
350
361
|
});
|
|
351
362
|
};
|
|
352
363
|
//#endregion
|
|
353
|
-
export {
|
|
364
|
+
export { E as useAcceptInvitation, x as useAddWorkspaceMember, j as useBulkCreateInvitations, O as useCancelInvitation, w as useCreateInvitation, A as useDeleteInvitation, D as useRejectInvitation, C as useRemoveUserFromWorkspace, S as useRemoveWorkspaceMember, k as useResendInvitation, T as useUpdateInvitation };
|
|
@@ -1,102 +1,104 @@
|
|
|
1
1
|
import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
|
|
2
2
|
import { useWorkspacesEventEmitter as t } from "./useWorkspacesEventEmitter.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { captureRequestActor as n, pinnedFetch as r } from "../utils/pinnedRequest.js";
|
|
4
|
+
import { safeTelemetryError as i } from "../utils/telemetryError.js";
|
|
5
|
+
import { useMutation as a, useQueryClient as o } from "@tanstack/react-query";
|
|
6
6
|
//#region src/hooks/useProjectMemberMutations.ts
|
|
7
|
-
var
|
|
8
|
-
let { authToken:
|
|
9
|
-
return
|
|
7
|
+
var s = "\n mutation AddProjectMember($input: AddProjectMemberInput!) {\n addProjectMember(input: $input) {\n id\n projectId\n userId\n createdAt\n updatedAt\n deletedAt\n }\n }\n", c = "\n mutation RemoveProjectMember($input: RemoveProjectMemberInput!) {\n removeProjectMember(input: $input)\n }\n", l = (c) => {
|
|
8
|
+
let { authToken: l, currentUser: u, workspaceId: d } = e(), f = o(), { emit: p } = t(), m = c || d;
|
|
9
|
+
return a({
|
|
10
10
|
mutationFn: async (e) => {
|
|
11
|
-
let t = await
|
|
11
|
+
let t = await r(n({
|
|
12
|
+
authToken: l,
|
|
13
|
+
currentUser: u
|
|
14
|
+
}), {
|
|
12
15
|
gateway: "workspace",
|
|
13
|
-
|
|
14
|
-
query: o,
|
|
16
|
+
query: s,
|
|
15
17
|
variables: { input: e },
|
|
16
|
-
workspaceId:
|
|
17
|
-
workspaceToken: !0
|
|
18
|
+
workspaceId: m || void 0
|
|
18
19
|
});
|
|
19
20
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
20
21
|
if (!t.data?.addProjectMember) throw Error("No data returned from addProjectMember mutation");
|
|
21
22
|
return t.data.addProjectMember;
|
|
22
23
|
},
|
|
23
24
|
onSuccess: (e, t) => {
|
|
24
|
-
|
|
25
|
+
f.invalidateQueries({ queryKey: [
|
|
25
26
|
"projectMembers",
|
|
26
|
-
|
|
27
|
+
m,
|
|
27
28
|
t.projectId
|
|
28
|
-
] }),
|
|
29
|
+
] }), f.invalidateQueries({ queryKey: [
|
|
29
30
|
"projectMembersInfinite",
|
|
30
|
-
|
|
31
|
+
m,
|
|
31
32
|
t.projectId
|
|
32
|
-
] }),
|
|
33
|
+
] }), f.invalidateQueries({ queryKey: [
|
|
33
34
|
"projectMembersCount",
|
|
34
|
-
|
|
35
|
+
m,
|
|
35
36
|
t.projectId
|
|
36
|
-
] }),
|
|
37
|
+
] }), p("project-member.added", {
|
|
37
38
|
memberId: e.id,
|
|
38
39
|
projectId: t.projectId,
|
|
39
40
|
userId: t.userId,
|
|
40
|
-
workspaceId:
|
|
41
|
+
workspaceId: m || void 0,
|
|
41
42
|
source: "microfe-workspaces"
|
|
42
43
|
});
|
|
43
44
|
},
|
|
44
45
|
onError: (e, t) => {
|
|
45
|
-
|
|
46
|
+
p("project-member.add_failed", {
|
|
46
47
|
projectId: t?.projectId,
|
|
47
48
|
userId: t?.userId,
|
|
48
|
-
workspaceId:
|
|
49
|
+
workspaceId: m || void 0,
|
|
49
50
|
source: "microfe-workspaces",
|
|
50
|
-
errorMessage:
|
|
51
|
+
errorMessage: i(e)
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
},
|
|
55
|
-
let { authToken:
|
|
56
|
-
return
|
|
55
|
+
}, u = (s) => {
|
|
56
|
+
let { authToken: l, currentUser: u, workspaceId: d } = e(), f = o(), { emit: p } = t(), m = s || d;
|
|
57
|
+
return a({
|
|
57
58
|
mutationFn: async (e) => {
|
|
58
|
-
let t = await
|
|
59
|
+
let t = await r(n({
|
|
60
|
+
authToken: l,
|
|
61
|
+
currentUser: u
|
|
62
|
+
}), {
|
|
59
63
|
gateway: "workspace",
|
|
60
|
-
|
|
61
|
-
query: s,
|
|
64
|
+
query: c,
|
|
62
65
|
variables: { input: e },
|
|
63
|
-
workspaceId:
|
|
64
|
-
workspaceToken: !0
|
|
66
|
+
workspaceId: m || void 0
|
|
65
67
|
});
|
|
66
68
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
67
69
|
if (typeof t.data?.removeProjectMember != "boolean") throw Error("No data returned from removeProjectMember mutation");
|
|
68
70
|
return t.data.removeProjectMember;
|
|
69
71
|
},
|
|
70
72
|
onSuccess: (e, t) => {
|
|
71
|
-
|
|
73
|
+
f.invalidateQueries({ queryKey: [
|
|
72
74
|
"projectMembers",
|
|
73
|
-
|
|
75
|
+
m,
|
|
74
76
|
t.projectId
|
|
75
|
-
] }),
|
|
77
|
+
] }), f.invalidateQueries({ queryKey: [
|
|
76
78
|
"projectMembersInfinite",
|
|
77
|
-
|
|
79
|
+
m,
|
|
78
80
|
t.projectId
|
|
79
|
-
] }),
|
|
81
|
+
] }), f.invalidateQueries({ queryKey: [
|
|
80
82
|
"projectMembersCount",
|
|
81
|
-
|
|
83
|
+
m,
|
|
82
84
|
t.projectId
|
|
83
|
-
] }),
|
|
85
|
+
] }), p("project-member.removed", {
|
|
84
86
|
projectId: t.projectId,
|
|
85
87
|
userId: t.userId,
|
|
86
|
-
workspaceId:
|
|
88
|
+
workspaceId: m || void 0,
|
|
87
89
|
source: "microfe-workspaces"
|
|
88
90
|
});
|
|
89
91
|
},
|
|
90
92
|
onError: (e, t) => {
|
|
91
|
-
|
|
93
|
+
p("project-member.remove_failed", {
|
|
92
94
|
projectId: t?.projectId,
|
|
93
95
|
userId: t?.userId,
|
|
94
|
-
workspaceId:
|
|
96
|
+
workspaceId: m || void 0,
|
|
95
97
|
source: "microfe-workspaces",
|
|
96
|
-
errorMessage:
|
|
98
|
+
errorMessage: i(e)
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
102
|
};
|
|
101
103
|
//#endregion
|
|
102
|
-
export {
|
|
104
|
+
export { l as useAddProjectMember, u as useRemoveProjectMember };
|