@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.
@@ -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 { safeTelemetryError as p } from "../utils/telemetryError.js";
5
- import { useMutation as m, useQueryClient as h } from "@tanstack/react-query";
6
- import { print as g } from "graphql";
7
- import { graphqlFetch as _ } from "@burdenoff/fe-libs/shared/graphql";
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 v(e, t) {
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 y(e, t, n, r = !1) {
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 b = () => {
20
- let { authToken: t, workspaceId: r } = e(), i = h(), { emit: a } = f();
21
- return m({
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 i = await _({
23
+ let a = await m(p({
24
+ authToken: t,
25
+ currentUser: r
26
+ }), {
24
27
  gateway: "workspace",
25
- authToken: t || void 0,
26
- query: g(n),
28
+ query: v(n),
27
29
  variables: { input: e },
28
- workspaceId: r || void 0,
29
- workspaceToken: !0
30
+ workspaceId: i || void 0
30
31
  });
31
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
32
- return i.data.addWorkspaceMember;
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
- v(i, e.workspaceId), a("workspace-member.added", {
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
- a("workspace-member.add_failed", {
44
- workspaceId: r || void 0,
44
+ o("workspace-member.add_failed", {
45
+ workspaceId: i || void 0,
45
46
  userId: t?.userId,
46
47
  source: "microfe-workspaces",
47
- errorMessage: p(e)
48
+ errorMessage: h(e)
48
49
  });
49
50
  }
50
51
  });
51
- }, x = (t) => {
52
- let { authToken: n, workspaceId: r } = e(), i = h(), { emit: a } = f(), o = t || r;
53
- return m({
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
- authToken: n || void 0,
58
- query: g(l),
61
+ query: v(l),
59
62
  variables: { id: e },
60
- workspaceId: o || void 0,
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
- v(i, o), a("workspace-member.removed", {
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
- a("workspace-member.remove_failed", {
75
+ o("workspace-member.remove_failed", {
74
76
  memberId: t,
75
- workspaceId: o || void 0,
77
+ workspaceId: s || void 0,
76
78
  source: "microfe-workspaces",
77
- errorMessage: p(e)
79
+ errorMessage: h(e)
78
80
  });
79
81
  }
80
82
  });
81
- }, S = (t) => {
82
- let { authToken: n, workspaceId: r } = e(), i = h(), { emit: a } = f(), o = t || r;
83
- return m({
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
- authToken: n || void 0,
88
- query: g(c),
92
+ query: v(c),
89
93
  variables: { userId: e },
90
- workspaceId: o || void 0,
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
- v(i, o), i.invalidateQueries({ queryKey: ["userWorkspaces", t] }), a("workspace-member.removed", {
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
- a("workspace-member.remove_failed", {
106
+ o("workspace-member.remove_failed", {
104
107
  userId: t,
105
- workspaceId: o || void 0,
108
+ workspaceId: s || void 0,
106
109
  source: "microfe-workspaces",
107
- errorMessage: p(e)
110
+ errorMessage: h(e)
108
111
  });
109
112
  }
110
113
  });
111
- }, C = (t) => {
112
- let { authToken: n, workspaceId: r } = e(), i = h(), { emit: o } = f(), s = t || r;
113
- return m({
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
- authToken: n || void 0,
118
- query: g(a),
123
+ query: v(a),
119
124
  variables: { input: e },
120
- workspaceId: e.workspaceId || s || void 0,
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 ?? s;
128
- y(i, e.id, t), o("workspace-invitation.created", {
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
- o("workspace-invitation.create_failed", {
136
- workspaceId: t?.workspaceId || s || void 0,
139
+ s("workspace-invitation.create_failed", {
140
+ workspaceId: t?.workspaceId || c || void 0,
137
141
  source: "microfe-workspaces",
138
- errorMessage: p(e)
142
+ errorMessage: h(e)
139
143
  });
140
144
  }
141
145
  });
142
- }, w = () => {
143
- let { authToken: t, workspaceId: n } = e(), r = h(), { emit: i } = f();
144
- return m({
145
- mutationFn: async ({ id: e, input: r }) => {
146
- let i = await _({
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
- authToken: t || void 0,
149
- query: g(d),
155
+ query: v(d),
150
156
  variables: {
151
157
  id: e,
152
- input: r
158
+ input: i
153
159
  },
154
- workspaceId: n || void 0,
155
- workspaceToken: !0
160
+ workspaceId: r || void 0
156
161
  });
157
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
158
- return i.data.updateInvitation;
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
- y(r, e.id, e.workspaceId), i("workspace-invitation.updated", {
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
- i("workspace-invitation.update_failed", {
173
+ a("workspace-invitation.update_failed", {
169
174
  invitationId: t?.id,
170
- workspaceId: n || void 0,
175
+ workspaceId: r || void 0,
171
176
  source: "microfe-workspaces",
172
- errorMessage: p(e)
177
+ errorMessage: h(e)
173
178
  });
174
179
  }
175
180
  });
176
- }, T = () => {
177
- let { authToken: n, workspaceId: r } = e(), i = h(), { emit: a } = f();
178
- return m({
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 i = await _({
185
+ let a = await m(p({
186
+ authToken: n,
187
+ currentUser: r
188
+ }), {
181
189
  gateway: "workspace",
182
- authToken: n || void 0,
183
- query: g(t),
190
+ query: v(t),
184
191
  variables: { id: e },
185
- workspaceId: r || void 0,
186
- workspaceToken: !0
192
+ workspaceId: i || void 0
187
193
  });
188
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
189
- return i.data.acceptInvitation;
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
- y(i, e.id, e.workspaceId, !0), v(i, e.workspaceId), a("workspace-invitation.accepted", {
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
- a("workspace-invitation.accept_failed", {
205
+ o("workspace-invitation.accept_failed", {
200
206
  invitationId: t,
201
- workspaceId: r || void 0,
207
+ workspaceId: i || void 0,
202
208
  source: "microfe-workspaces",
203
- errorMessage: p(e)
209
+ errorMessage: h(e)
204
210
  });
205
211
  }
206
212
  });
207
- }, E = () => {
208
- let { authToken: t, workspaceId: n } = e(), r = h(), { emit: i } = f();
209
- return m({
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 r = await _({
217
+ let i = await m(p({
218
+ authToken: t,
219
+ currentUser: n
220
+ }), {
212
221
  gateway: "workspace",
213
- authToken: t || void 0,
214
- query: g(s),
222
+ query: v(s),
215
223
  variables: { id: e },
216
- workspaceId: n || void 0,
217
- workspaceToken: !0
224
+ workspaceId: r || void 0
218
225
  });
219
- if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
220
- return r.data.rejectInvitation;
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
- y(r, e.id, e.workspaceId, !0), i("workspace-invitation.rejected", {
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
- i("workspace-invitation.reject_failed", {
237
+ a("workspace-invitation.reject_failed", {
231
238
  invitationId: t,
232
- workspaceId: n || void 0,
239
+ workspaceId: r || void 0,
233
240
  source: "microfe-workspaces",
234
- errorMessage: p(e)
241
+ errorMessage: h(e)
235
242
  });
236
243
  }
237
244
  });
238
- }, D = (t) => {
239
- let { authToken: n, workspaceId: r } = e(), a = h(), { emit: o } = f(), s = t || r;
240
- return m({
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
- authToken: n || void 0,
245
- query: g(i),
254
+ query: v(i),
246
255
  variables: { id: e },
247
- workspaceId: s || void 0,
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
- y(a, e.id, e.workspaceId ?? s, !0), o("workspace-invitation.cancelled", {
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
- o("workspace-invitation.cancel_failed", {
269
+ s("workspace-invitation.cancel_failed", {
262
270
  invitationId: t,
263
- workspaceId: s || void 0,
271
+ workspaceId: c || void 0,
264
272
  source: "microfe-workspaces",
265
- errorMessage: p(e)
273
+ errorMessage: h(e)
266
274
  });
267
275
  }
268
276
  });
269
- }, O = (t) => {
270
- let { authToken: n, workspaceId: r } = e(), i = h(), { emit: a } = f(), o = t || r;
271
- return m({
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
- authToken: n || void 0,
276
- query: g(u),
286
+ query: v(u),
277
287
  variables: { id: e },
278
- workspaceId: o || void 0,
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
- y(i, e.id, e.workspaceId ?? o), a("workspace-invitation.resent", {
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
- a("workspace-invitation.resend_failed", {
301
+ o("workspace-invitation.resend_failed", {
293
302
  invitationId: t,
294
- workspaceId: o || void 0,
303
+ workspaceId: s || void 0,
295
304
  source: "microfe-workspaces",
296
- errorMessage: p(e)
305
+ errorMessage: h(e)
297
306
  });
298
307
  }
299
308
  });
300
- }, k = () => {
301
- let { authToken: t, workspaceId: n } = e(), r = h(), { emit: i } = f();
302
- return m({
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 r = await _({
313
+ let i = await m(p({
314
+ authToken: t,
315
+ currentUser: n
316
+ }), {
305
317
  gateway: "workspace",
306
- authToken: t || void 0,
307
- query: g(o),
318
+ query: v(o),
308
319
  variables: { id: e },
309
- workspaceId: n || void 0,
310
- workspaceToken: !0
320
+ workspaceId: r || void 0
311
321
  });
312
- if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
313
- return r.data.deleteInvitation;
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
- y(r, t, n, !0), i("workspace-invitation.deleted", {
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
- i("workspace-invitation.delete_failed", {
332
+ a("workspace-invitation.delete_failed", {
323
333
  invitationId: t,
324
- workspaceId: n || void 0,
334
+ workspaceId: r || void 0,
325
335
  source: "microfe-workspaces",
326
- errorMessage: p(e)
336
+ errorMessage: h(e)
327
337
  });
328
338
  }
329
339
  });
330
- }, A = () => {
331
- let { authToken: t, workspaceId: n } = e(), i = h();
332
- return m({
340
+ }, j = () => {
341
+ let { authToken: t, currentUser: n, workspaceId: i } = e(), a = _();
342
+ return g({
333
343
  mutationFn: async (e) => {
334
- let i = await _({
344
+ let a = await m(p({
345
+ authToken: t,
346
+ currentUser: n
347
+ }), {
335
348
  gateway: "workspace",
336
- authToken: t || void 0,
337
- query: g(r),
349
+ query: v(r),
338
350
  variables: { inputs: e },
339
- workspaceId: e[0]?.workspaceId || n || void 0,
340
- workspaceToken: !0
351
+ workspaceId: e[0]?.workspaceId || i || void 0
341
352
  });
342
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
343
- return i.data.bulkCreateInvitations;
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
- i.invalidateQueries({ queryKey: ["workspaceInvitations"] }), i.invalidateQueries({ queryKey: ["myPendingInvitations"] });
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) i.invalidateQueries({ queryKey: ["workspaceInvitations", e] });
359
+ for (let e of t) a.invalidateQueries({ queryKey: ["workspaceInvitations", e] });
349
360
  }
350
361
  });
351
362
  };
352
363
  //#endregion
353
- export { T as useAcceptInvitation, b as useAddWorkspaceMember, A as useBulkCreateInvitations, D as useCancelInvitation, C as useCreateInvitation, k as useDeleteInvitation, E as useRejectInvitation, S as useRemoveUserFromWorkspace, x as useRemoveWorkspaceMember, O as useResendInvitation, w as useUpdateInvitation };
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 { safeTelemetryError as n } from "../utils/telemetryError.js";
4
- import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
5
- import { graphqlFetch as a } from "@burdenoff/fe-libs/shared/graphql";
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 o = "\n mutation AddProjectMember($input: AddProjectMemberInput!) {\n addProjectMember(input: $input) {\n id\n projectId\n userId\n createdAt\n updatedAt\n deletedAt\n }\n }\n", s = "\n mutation RemoveProjectMember($input: RemoveProjectMemberInput!) {\n removeProjectMember(input: $input)\n }\n", c = (s) => {
8
- let { authToken: c, workspaceId: l } = e(), u = i(), { emit: d } = t(), f = s || l;
9
- return r({
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 a({
11
+ let t = await r(n({
12
+ authToken: l,
13
+ currentUser: u
14
+ }), {
12
15
  gateway: "workspace",
13
- authToken: c || void 0,
14
- query: o,
16
+ query: s,
15
17
  variables: { input: e },
16
- workspaceId: f || void 0,
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
- u.invalidateQueries({ queryKey: [
25
+ f.invalidateQueries({ queryKey: [
25
26
  "projectMembers",
26
- f,
27
+ m,
27
28
  t.projectId
28
- ] }), u.invalidateQueries({ queryKey: [
29
+ ] }), f.invalidateQueries({ queryKey: [
29
30
  "projectMembersInfinite",
30
- f,
31
+ m,
31
32
  t.projectId
32
- ] }), u.invalidateQueries({ queryKey: [
33
+ ] }), f.invalidateQueries({ queryKey: [
33
34
  "projectMembersCount",
34
- f,
35
+ m,
35
36
  t.projectId
36
- ] }), d("project-member.added", {
37
+ ] }), p("project-member.added", {
37
38
  memberId: e.id,
38
39
  projectId: t.projectId,
39
40
  userId: t.userId,
40
- workspaceId: f || void 0,
41
+ workspaceId: m || void 0,
41
42
  source: "microfe-workspaces"
42
43
  });
43
44
  },
44
45
  onError: (e, t) => {
45
- d("project-member.add_failed", {
46
+ p("project-member.add_failed", {
46
47
  projectId: t?.projectId,
47
48
  userId: t?.userId,
48
- workspaceId: f || void 0,
49
+ workspaceId: m || void 0,
49
50
  source: "microfe-workspaces",
50
- errorMessage: n(e)
51
+ errorMessage: i(e)
51
52
  });
52
53
  }
53
54
  });
54
- }, l = (o) => {
55
- let { authToken: c, workspaceId: l } = e(), u = i(), { emit: d } = t(), f = o || l;
56
- return r({
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 a({
59
+ let t = await r(n({
60
+ authToken: l,
61
+ currentUser: u
62
+ }), {
59
63
  gateway: "workspace",
60
- authToken: c || void 0,
61
- query: s,
64
+ query: c,
62
65
  variables: { input: e },
63
- workspaceId: f || void 0,
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
- u.invalidateQueries({ queryKey: [
73
+ f.invalidateQueries({ queryKey: [
72
74
  "projectMembers",
73
- f,
75
+ m,
74
76
  t.projectId
75
- ] }), u.invalidateQueries({ queryKey: [
77
+ ] }), f.invalidateQueries({ queryKey: [
76
78
  "projectMembersInfinite",
77
- f,
79
+ m,
78
80
  t.projectId
79
- ] }), u.invalidateQueries({ queryKey: [
81
+ ] }), f.invalidateQueries({ queryKey: [
80
82
  "projectMembersCount",
81
- f,
83
+ m,
82
84
  t.projectId
83
- ] }), d("project-member.removed", {
85
+ ] }), p("project-member.removed", {
84
86
  projectId: t.projectId,
85
87
  userId: t.userId,
86
- workspaceId: f || void 0,
88
+ workspaceId: m || void 0,
87
89
  source: "microfe-workspaces"
88
90
  });
89
91
  },
90
92
  onError: (e, t) => {
91
- d("project-member.remove_failed", {
93
+ p("project-member.remove_failed", {
92
94
  projectId: t?.projectId,
93
95
  userId: t?.userId,
94
- workspaceId: f || void 0,
96
+ workspaceId: m || void 0,
95
97
  source: "microfe-workspaces",
96
- errorMessage: n(e)
98
+ errorMessage: i(e)
97
99
  });
98
100
  }
99
101
  });
100
102
  };
101
103
  //#endregion
102
- export { c as useAddProjectMember, l as useRemoveProjectMember };
104
+ export { l as useAddProjectMember, u as useRemoveProjectMember };