@burdenoff/microfe-workspaces 2026.1031.1 → 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/hooks/useDashboardPreferences.js +14 -15
- package/dist/utils/pinnedRequest.d.ts +35 -0
- package/dist/utils/pinnedRequest.js +53 -0
- package/package.json +3 -2
|
@@ -1,97 +1,100 @@
|
|
|
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/useProjectMutations.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var s = "\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id\n name\n key\n workspaceId\n creatorId\n status\n tags\n createdAt\n }\n }\n", c = "\n mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {\n updateProject(id: $id, input: $input) {\n id\n name\n key\n status\n config\n tags\n archived\n updatedAt\n }\n }\n", l = "\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n", u = "\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", d = "\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", f = "\n mutation AssignProjectTag($input: AssignTagInput!) {\n assignTag(input: $input) {\n id\n tagId\n entityType\n entityId\n source\n assignedById\n createdAt\n validFrom\n validTo\n metadata\n }\n }\n", p = "\n query GetProjectTagAssignments($entityType: String!, $entityId: ID!) {\n getEntityTags(entityType: $entityType, entityId: $entityId) {\n id\n tagId\n }\n }\n", m = "\n mutation RemoveTagAssignment($id: ID!) {\n removeTagAssignment(id: $id)\n }\n";
|
|
8
|
+
function h(e) {
|
|
9
9
|
e.invalidateQueries({ queryKey: ["projects"] }), e.invalidateQueries({ queryKey: ["project"] }), e.invalidateQueries({ queryKey: ["myProjects"] }), e.invalidateQueries({ queryKey: ["dashboard", "projects"] });
|
|
10
10
|
}
|
|
11
|
-
var
|
|
12
|
-
let { authToken:
|
|
13
|
-
return
|
|
11
|
+
var g = (c) => {
|
|
12
|
+
let { authToken: l, currentUser: u, onProjectCreate: d, workspaceId: f } = e(), p = o(), { emit: m } = t(), g = c || f;
|
|
13
|
+
return a({
|
|
14
14
|
mutationFn: async (e) => {
|
|
15
|
-
let t = await
|
|
15
|
+
let t = await r(n({
|
|
16
|
+
authToken: l,
|
|
17
|
+
currentUser: u
|
|
18
|
+
}), {
|
|
16
19
|
gateway: "workspace",
|
|
17
|
-
|
|
18
|
-
query: o,
|
|
20
|
+
query: s,
|
|
19
21
|
variables: { input: e },
|
|
20
|
-
workspaceId:
|
|
21
|
-
workspaceToken: !0
|
|
22
|
+
workspaceId: g || void 0
|
|
22
23
|
});
|
|
23
24
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
24
25
|
return t.data.createProject;
|
|
25
26
|
},
|
|
26
27
|
onSuccess: (e) => {
|
|
27
|
-
|
|
28
|
+
h(p), m("project.created", {
|
|
28
29
|
projectId: e.id,
|
|
29
30
|
workspaceId: e.workspaceId,
|
|
30
31
|
source: "microfe-workspaces"
|
|
31
|
-
}),
|
|
32
|
+
}), d && d(e);
|
|
32
33
|
},
|
|
33
34
|
onError: (e) => {
|
|
34
|
-
|
|
35
|
-
workspaceId:
|
|
35
|
+
m("project.create_failed", {
|
|
36
|
+
workspaceId: g || void 0,
|
|
36
37
|
source: "microfe-workspaces",
|
|
37
|
-
errorMessage:
|
|
38
|
+
errorMessage: i(e)
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
|
-
},
|
|
42
|
-
let { authToken:
|
|
43
|
-
return
|
|
42
|
+
}, _ = (s) => {
|
|
43
|
+
let { authToken: l, currentUser: u, workspaceId: d } = e(), f = o(), { emit: p } = t(), m = s || d;
|
|
44
|
+
return a({
|
|
44
45
|
mutationFn: async ({ id: e, input: t }) => {
|
|
45
|
-
let
|
|
46
|
+
let i = await r(n({
|
|
47
|
+
authToken: l,
|
|
48
|
+
currentUser: u
|
|
49
|
+
}), {
|
|
46
50
|
gateway: "workspace",
|
|
47
|
-
|
|
48
|
-
query: s,
|
|
51
|
+
query: c,
|
|
49
52
|
variables: {
|
|
50
53
|
id: e,
|
|
51
54
|
input: t
|
|
52
55
|
},
|
|
53
|
-
workspaceId:
|
|
54
|
-
workspaceToken: !0
|
|
56
|
+
workspaceId: m || void 0
|
|
55
57
|
});
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
58
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
|
|
59
|
+
return i.data.updateProject;
|
|
58
60
|
},
|
|
59
61
|
onSuccess: (e) => {
|
|
60
|
-
|
|
62
|
+
h(f), p("project.updated", {
|
|
61
63
|
projectId: e.id,
|
|
62
64
|
workspaceId: e.workspaceId,
|
|
63
65
|
source: "microfe-workspaces"
|
|
64
66
|
});
|
|
65
67
|
},
|
|
66
68
|
onError: (e, t) => {
|
|
67
|
-
|
|
69
|
+
p("project.update_failed", {
|
|
68
70
|
projectId: t?.id,
|
|
69
|
-
workspaceId:
|
|
71
|
+
workspaceId: m || void 0,
|
|
70
72
|
source: "microfe-workspaces",
|
|
71
|
-
errorMessage:
|
|
73
|
+
errorMessage: i(e)
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
});
|
|
75
|
-
},
|
|
76
|
-
let { authToken:
|
|
77
|
-
return
|
|
77
|
+
}, v = (s) => {
|
|
78
|
+
let { authToken: c, currentUser: l, workspaceId: u } = e(), d = o(), { emit: p } = t(), m = s || u;
|
|
79
|
+
return a({
|
|
78
80
|
mutationFn: async (e) => {
|
|
79
|
-
let t = await
|
|
81
|
+
let t = await r(n({
|
|
82
|
+
authToken: c,
|
|
83
|
+
currentUser: l
|
|
84
|
+
}), {
|
|
80
85
|
gateway: "workspace",
|
|
81
|
-
|
|
82
|
-
query: d,
|
|
86
|
+
query: f,
|
|
83
87
|
variables: { input: {
|
|
84
88
|
tagId: e.tagId,
|
|
85
89
|
entityType: "WORKSPACE_PROJECT",
|
|
86
90
|
entityId: e.entityId,
|
|
87
91
|
source: "MANUAL",
|
|
88
92
|
context: {
|
|
89
|
-
workspaceId:
|
|
93
|
+
workspaceId: m,
|
|
90
94
|
projectId: e.entityId
|
|
91
95
|
}
|
|
92
96
|
} },
|
|
93
|
-
workspaceId:
|
|
94
|
-
workspaceToken: !0
|
|
97
|
+
workspaceId: m || void 0
|
|
95
98
|
});
|
|
96
99
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
97
100
|
if (!t.data?.assignTag) throw Error("GraphQL error");
|
|
@@ -110,161 +113,163 @@ var h = (s) => {
|
|
|
110
113
|
};
|
|
111
114
|
},
|
|
112
115
|
onSuccess: (e, t) => {
|
|
113
|
-
|
|
116
|
+
h(d), p("project.updated", {
|
|
114
117
|
projectId: t.entityId,
|
|
115
|
-
workspaceId:
|
|
118
|
+
workspaceId: m || void 0,
|
|
116
119
|
source: "microfe-workspaces"
|
|
117
120
|
});
|
|
118
121
|
},
|
|
119
122
|
onError: (e, t) => {
|
|
120
|
-
|
|
123
|
+
p("project.update_failed", {
|
|
121
124
|
projectId: t.entityId,
|
|
122
|
-
workspaceId:
|
|
125
|
+
workspaceId: m || void 0,
|
|
123
126
|
source: "microfe-workspaces",
|
|
124
|
-
errorMessage:
|
|
127
|
+
errorMessage: i(e)
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
130
|
});
|
|
128
|
-
},
|
|
129
|
-
let { authToken:
|
|
130
|
-
return
|
|
131
|
+
}, y = (s) => {
|
|
132
|
+
let { authToken: c, currentUser: l, workspaceId: u } = e(), d = o(), { emit: f } = t(), g = s || u;
|
|
133
|
+
return a({
|
|
131
134
|
mutationFn: async (e) => {
|
|
132
|
-
let t =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
let t = n({
|
|
136
|
+
authToken: c,
|
|
137
|
+
currentUser: l
|
|
138
|
+
}), i = e.assignmentId;
|
|
139
|
+
if (!i) {
|
|
140
|
+
let n = await r(t, {
|
|
135
141
|
gateway: "workspace",
|
|
136
|
-
|
|
137
|
-
query: f,
|
|
142
|
+
query: p,
|
|
138
143
|
variables: {
|
|
139
144
|
entityType: "WORKSPACE_PROJECT",
|
|
140
145
|
entityId: e.entityId
|
|
141
146
|
},
|
|
142
|
-
workspaceId:
|
|
143
|
-
workspaceToken: !0
|
|
147
|
+
workspaceId: g || void 0
|
|
144
148
|
});
|
|
145
149
|
if (n.errors?.length) throw Error(n.errors[0]?.message || "GraphQL error");
|
|
146
|
-
|
|
150
|
+
i = n.data?.getEntityTags.find((t) => t.tagId === e.tagId)?.id;
|
|
147
151
|
}
|
|
148
|
-
if (!
|
|
149
|
-
let
|
|
152
|
+
if (!i) return !1;
|
|
153
|
+
let a = await r(t, {
|
|
150
154
|
gateway: "workspace",
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
workspaceId: d || void 0,
|
|
155
|
-
workspaceToken: !0
|
|
155
|
+
query: m,
|
|
156
|
+
variables: { id: i },
|
|
157
|
+
workspaceId: g || void 0
|
|
156
158
|
});
|
|
157
|
-
if (
|
|
158
|
-
return
|
|
159
|
+
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
160
|
+
return a.data?.removeTagAssignment ?? !1;
|
|
159
161
|
},
|
|
160
162
|
onSuccess: (e, t) => {
|
|
161
|
-
|
|
163
|
+
h(d), f("project.updated", {
|
|
162
164
|
projectId: t.entityId,
|
|
163
|
-
workspaceId:
|
|
165
|
+
workspaceId: g || void 0,
|
|
164
166
|
source: "microfe-workspaces"
|
|
165
167
|
});
|
|
166
168
|
},
|
|
167
169
|
onError: (e, t) => {
|
|
168
|
-
|
|
170
|
+
f("project.update_failed", {
|
|
169
171
|
projectId: t.entityId,
|
|
170
|
-
workspaceId:
|
|
172
|
+
workspaceId: g || void 0,
|
|
171
173
|
source: "microfe-workspaces",
|
|
172
|
-
errorMessage:
|
|
174
|
+
errorMessage: i(e)
|
|
173
175
|
});
|
|
174
176
|
}
|
|
175
177
|
});
|
|
176
|
-
},
|
|
177
|
-
let { authToken:
|
|
178
|
-
return
|
|
178
|
+
}, b = (s) => {
|
|
179
|
+
let { authToken: c, currentUser: u, workspaceId: d } = e(), f = o(), { emit: p } = t(), m = s || d;
|
|
180
|
+
return a({
|
|
179
181
|
mutationFn: async (e) => {
|
|
180
|
-
let t = await
|
|
182
|
+
let t = await r(n({
|
|
183
|
+
authToken: c,
|
|
184
|
+
currentUser: u
|
|
185
|
+
}), {
|
|
181
186
|
gateway: "workspace",
|
|
182
|
-
|
|
183
|
-
query: c,
|
|
187
|
+
query: l,
|
|
184
188
|
variables: { id: e },
|
|
185
|
-
workspaceId:
|
|
186
|
-
workspaceToken: !0
|
|
189
|
+
workspaceId: m || void 0
|
|
187
190
|
});
|
|
188
191
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
189
192
|
return t.data.deleteProject;
|
|
190
193
|
},
|
|
191
194
|
onSuccess: (e, t) => {
|
|
192
|
-
|
|
195
|
+
h(f), p("project.deleted", {
|
|
193
196
|
projectId: t,
|
|
194
197
|
source: "microfe-workspaces"
|
|
195
198
|
});
|
|
196
199
|
},
|
|
197
200
|
onError: (e, t) => {
|
|
198
|
-
|
|
201
|
+
p("project.delete_failed", {
|
|
199
202
|
projectId: t,
|
|
200
|
-
workspaceId:
|
|
203
|
+
workspaceId: m || void 0,
|
|
201
204
|
source: "microfe-workspaces",
|
|
202
|
-
errorMessage:
|
|
205
|
+
errorMessage: i(e)
|
|
203
206
|
});
|
|
204
207
|
}
|
|
205
208
|
});
|
|
206
|
-
},
|
|
207
|
-
let { authToken:
|
|
208
|
-
return
|
|
209
|
+
}, x = (s) => {
|
|
210
|
+
let { authToken: c, currentUser: l, workspaceId: d } = e(), f = o(), { emit: p } = t(), m = s || d;
|
|
211
|
+
return a({
|
|
209
212
|
mutationFn: async (e) => {
|
|
210
|
-
let t = await
|
|
213
|
+
let t = await r(n({
|
|
214
|
+
authToken: c,
|
|
215
|
+
currentUser: l
|
|
216
|
+
}), {
|
|
211
217
|
gateway: "workspace",
|
|
212
|
-
|
|
213
|
-
query: l,
|
|
218
|
+
query: u,
|
|
214
219
|
variables: { id: e },
|
|
215
|
-
workspaceId:
|
|
216
|
-
workspaceToken: !0
|
|
220
|
+
workspaceId: m || void 0
|
|
217
221
|
});
|
|
218
222
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
219
223
|
return t.data.archiveProject;
|
|
220
224
|
},
|
|
221
225
|
onSuccess: (e) => {
|
|
222
|
-
|
|
226
|
+
h(f), p("project.archived", {
|
|
223
227
|
projectId: e.id,
|
|
224
228
|
workspaceId: e.workspaceId,
|
|
225
229
|
source: "microfe-workspaces"
|
|
226
230
|
});
|
|
227
231
|
},
|
|
228
232
|
onError: (e, t) => {
|
|
229
|
-
|
|
233
|
+
p("project.archive_failed", {
|
|
230
234
|
projectId: t,
|
|
231
|
-
workspaceId:
|
|
235
|
+
workspaceId: m || void 0,
|
|
232
236
|
source: "microfe-workspaces",
|
|
233
|
-
errorMessage:
|
|
237
|
+
errorMessage: i(e)
|
|
234
238
|
});
|
|
235
239
|
}
|
|
236
240
|
});
|
|
237
|
-
},
|
|
238
|
-
let { authToken:
|
|
239
|
-
return
|
|
241
|
+
}, S = (s) => {
|
|
242
|
+
let { authToken: c, currentUser: l, workspaceId: u } = e(), f = o(), { emit: p } = t(), m = s || u;
|
|
243
|
+
return a({
|
|
240
244
|
mutationFn: async (e) => {
|
|
241
|
-
let t = await
|
|
245
|
+
let t = await r(n({
|
|
246
|
+
authToken: c,
|
|
247
|
+
currentUser: l
|
|
248
|
+
}), {
|
|
242
249
|
gateway: "workspace",
|
|
243
|
-
|
|
244
|
-
query: u,
|
|
250
|
+
query: d,
|
|
245
251
|
variables: { id: e },
|
|
246
|
-
workspaceId:
|
|
247
|
-
workspaceToken: !0
|
|
252
|
+
workspaceId: m || void 0
|
|
248
253
|
});
|
|
249
254
|
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
250
255
|
return t.data.unarchiveProject;
|
|
251
256
|
},
|
|
252
257
|
onSuccess: (e) => {
|
|
253
|
-
|
|
258
|
+
h(f), p("project.unarchived", {
|
|
254
259
|
projectId: e.id,
|
|
255
260
|
workspaceId: e.workspaceId,
|
|
256
261
|
source: "microfe-workspaces"
|
|
257
262
|
});
|
|
258
263
|
},
|
|
259
264
|
onError: (e, t) => {
|
|
260
|
-
|
|
265
|
+
p("project.unarchive_failed", {
|
|
261
266
|
projectId: t,
|
|
262
|
-
workspaceId:
|
|
267
|
+
workspaceId: m || void 0,
|
|
263
268
|
source: "microfe-workspaces",
|
|
264
|
-
errorMessage:
|
|
269
|
+
errorMessage: i(e)
|
|
265
270
|
});
|
|
266
271
|
}
|
|
267
272
|
});
|
|
268
273
|
};
|
|
269
274
|
//#endregion
|
|
270
|
-
export {
|
|
275
|
+
export { x as useArchiveProject, g as useCreateProject, b as useDeleteProject, v as useTagProject, S as useUnarchiveProject, y as useUntagProject, _ as useUpdateProject };
|
|
@@ -2,182 +2,189 @@ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
|
|
|
2
2
|
import { DeleteWorkspaceDocument as t, UpdateWorkspaceDocument as n } from "../generated/wspace-operations.js";
|
|
3
3
|
import { ActivateGlobalWorkspaceDocument as r, ArchiveGlobalWorkspaceDocument as i, UpdateGlobalWorkspaceDocument as a } from "../generated/global-operations.js";
|
|
4
4
|
import { useWorkspacesEventEmitter as o } from "./useWorkspacesEventEmitter.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { captureRequestActor as s, pinnedFetch as c } from "../utils/pinnedRequest.js";
|
|
6
|
+
import { safeTelemetryError as l } from "../utils/telemetryError.js";
|
|
7
|
+
import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
|
|
8
|
+
import { print as f } from "graphql";
|
|
9
9
|
//#region src/hooks/useWorkspaceMutations.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var p = "\n mutation CreateGlobalWorkspace($input: CreateWorkspaceInput!) {\n createWorkspace(input: $input) {\n id\n name\n slug\n type\n status\n tenantId\n organizationId\n createdAt\n }\n }\n";
|
|
11
|
+
function m(e, t) {
|
|
12
12
|
e.invalidateQueries({ queryKey: ["workspaces"] }), t && (e.invalidateQueries({ queryKey: ["workspace", t] }), e.invalidateQueries({ queryKey: [
|
|
13
13
|
"dashboard",
|
|
14
14
|
"workspace",
|
|
15
15
|
t
|
|
16
16
|
] })), e.invalidateQueries({ queryKey: ["myWorkspaces"] }), e.invalidateQueries({ queryKey: ["myTenants"] }), e.invalidateQueries({ queryKey: ["myOrganizations"] }), e.invalidateQueries({ queryKey: ["dashboard", "global"] });
|
|
17
17
|
}
|
|
18
|
-
var
|
|
19
|
-
let { authToken: t,
|
|
20
|
-
return
|
|
18
|
+
var h = () => {
|
|
19
|
+
let { authToken: t, currentUser: n, onWorkspaceCreate: r } = e(), i = d(), { emit: a } = o();
|
|
20
|
+
return u({
|
|
21
21
|
mutationFn: async (e) => {
|
|
22
|
-
let
|
|
22
|
+
let r = await c(s({
|
|
23
|
+
authToken: t,
|
|
24
|
+
currentUser: n
|
|
25
|
+
}), {
|
|
23
26
|
gateway: "global",
|
|
24
|
-
|
|
25
|
-
query: f,
|
|
27
|
+
query: p,
|
|
26
28
|
variables: { input: e }
|
|
27
29
|
});
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
30
|
+
if (r.errors?.length) throw Error(r.errors[0]?.message || "Failed to create workspace");
|
|
31
|
+
return r.data.createWorkspace;
|
|
30
32
|
},
|
|
31
33
|
onSuccess: (e) => {
|
|
32
|
-
|
|
34
|
+
m(i, e.id), a("workspace.created", {
|
|
33
35
|
workspaceId: e.id,
|
|
34
36
|
source: "microfe-workspaces"
|
|
35
|
-
}),
|
|
37
|
+
}), r && r(e);
|
|
36
38
|
},
|
|
37
39
|
onError: (e) => {
|
|
38
|
-
|
|
40
|
+
a("workspace.create_failed", {
|
|
39
41
|
source: "microfe-workspaces",
|
|
40
|
-
errorMessage:
|
|
42
|
+
errorMessage: l(e)
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
|
-
},
|
|
45
|
-
let { authToken: t } = e(),
|
|
46
|
-
return
|
|
47
|
-
mutationFn: async ({ id: e, input:
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
}, g = () => {
|
|
47
|
+
let { authToken: t, currentUser: r } = e(), i = d(), { emit: p } = o();
|
|
48
|
+
return u({
|
|
49
|
+
mutationFn: async ({ id: e, input: i }) => {
|
|
50
|
+
let o = s({
|
|
51
|
+
authToken: t,
|
|
52
|
+
currentUser: r
|
|
53
|
+
}), { name: l, ...u } = i, d;
|
|
54
|
+
if (l !== void 0) {
|
|
55
|
+
let t = await c(o, {
|
|
51
56
|
gateway: "global",
|
|
52
|
-
|
|
53
|
-
query: u(a),
|
|
57
|
+
query: f(a),
|
|
54
58
|
variables: {
|
|
55
59
|
id: e,
|
|
56
|
-
input: { name:
|
|
60
|
+
input: { name: l }
|
|
57
61
|
}
|
|
58
62
|
});
|
|
59
|
-
if (
|
|
60
|
-
|
|
63
|
+
if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
|
|
64
|
+
d = t.data.updateWorkspace;
|
|
61
65
|
}
|
|
62
|
-
if (!Object.values(
|
|
63
|
-
if (!
|
|
64
|
-
return
|
|
66
|
+
if (!Object.values(u).some((e) => e !== void 0)) {
|
|
67
|
+
if (!d) throw Error("No workspace changes were provided");
|
|
68
|
+
return d;
|
|
65
69
|
}
|
|
66
|
-
let
|
|
70
|
+
let p = await c(o, {
|
|
67
71
|
gateway: "workspace",
|
|
68
|
-
|
|
69
|
-
query: u(n),
|
|
72
|
+
query: f(n),
|
|
70
73
|
variables: {
|
|
71
74
|
id: e,
|
|
72
|
-
input:
|
|
73
|
-
}
|
|
74
|
-
workspaceToken: !0
|
|
75
|
+
input: u
|
|
76
|
+
}
|
|
75
77
|
});
|
|
76
|
-
if (
|
|
78
|
+
if (p.errors?.length) throw Error(p.errors[0]?.message || "GraphQL error");
|
|
77
79
|
return {
|
|
78
|
-
...
|
|
79
|
-
...
|
|
80
|
+
...p.data.updateWorkspace,
|
|
81
|
+
...d ? { name: d.name } : {}
|
|
80
82
|
};
|
|
81
83
|
},
|
|
82
84
|
onSuccess: (e) => {
|
|
83
|
-
|
|
85
|
+
i.setQueryData(["workspace", e.id], (t) => ({
|
|
84
86
|
...t,
|
|
85
87
|
...e
|
|
86
|
-
})),
|
|
88
|
+
})), m(i, e.id), p("workspace.updated", {
|
|
87
89
|
workspaceId: e.id,
|
|
88
90
|
source: "microfe-workspaces"
|
|
89
91
|
});
|
|
90
92
|
},
|
|
91
93
|
onError: (e, t) => {
|
|
92
|
-
|
|
94
|
+
p("workspace.update_failed", {
|
|
93
95
|
workspaceId: t?.id,
|
|
94
96
|
source: "microfe-workspaces",
|
|
95
|
-
errorMessage:
|
|
97
|
+
errorMessage: l(e)
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
|
-
},
|
|
100
|
-
let { authToken: n } = e(),
|
|
101
|
-
return
|
|
101
|
+
}, _ = () => {
|
|
102
|
+
let { authToken: n, currentUser: r } = e(), i = d(), { emit: a } = o();
|
|
103
|
+
return u({
|
|
102
104
|
mutationFn: async (e) => {
|
|
103
|
-
let
|
|
105
|
+
let i = await c(s({
|
|
106
|
+
authToken: n,
|
|
107
|
+
currentUser: r
|
|
108
|
+
}), {
|
|
104
109
|
gateway: "workspace",
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
variables: { id: e },
|
|
108
|
-
workspaceToken: !0
|
|
110
|
+
query: f(t),
|
|
111
|
+
variables: { id: e }
|
|
109
112
|
});
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
113
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
|
|
114
|
+
return i.data.deleteWorkspace;
|
|
112
115
|
},
|
|
113
116
|
onSuccess: (e, t) => {
|
|
114
|
-
|
|
117
|
+
m(i, t), a("workspace.deleted", {
|
|
115
118
|
workspaceId: t,
|
|
116
119
|
source: "microfe-workspaces"
|
|
117
120
|
});
|
|
118
121
|
},
|
|
119
122
|
onError: (e, t) => {
|
|
120
|
-
|
|
123
|
+
a("workspace.delete_failed", {
|
|
121
124
|
workspaceId: t,
|
|
122
125
|
source: "microfe-workspaces",
|
|
123
|
-
errorMessage:
|
|
126
|
+
errorMessage: l(e)
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
});
|
|
127
|
-
},
|
|
128
|
-
let { authToken: t } = e(),
|
|
129
|
-
return
|
|
130
|
+
}, v = () => {
|
|
131
|
+
let { authToken: t, currentUser: n } = e(), r = d(), { emit: a } = o();
|
|
132
|
+
return u({
|
|
130
133
|
mutationFn: async (e) => {
|
|
131
|
-
let
|
|
134
|
+
let r = await c(s({
|
|
135
|
+
authToken: t,
|
|
136
|
+
currentUser: n
|
|
137
|
+
}), {
|
|
132
138
|
gateway: "global",
|
|
133
|
-
|
|
134
|
-
query: u(i),
|
|
139
|
+
query: f(i),
|
|
135
140
|
variables: { id: e }
|
|
136
141
|
});
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
142
|
+
if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
|
|
143
|
+
return r.data.archiveWorkspace;
|
|
139
144
|
},
|
|
140
145
|
onSuccess: (e) => {
|
|
141
|
-
|
|
146
|
+
m(r, e.id), a("workspace.archived", {
|
|
142
147
|
workspaceId: e.id,
|
|
143
148
|
source: "microfe-workspaces"
|
|
144
149
|
});
|
|
145
150
|
},
|
|
146
151
|
onError: (e, t) => {
|
|
147
|
-
|
|
152
|
+
a("workspace.archive_failed", {
|
|
148
153
|
workspaceId: t,
|
|
149
154
|
source: "microfe-workspaces",
|
|
150
|
-
errorMessage:
|
|
155
|
+
errorMessage: l(e)
|
|
151
156
|
});
|
|
152
157
|
}
|
|
153
158
|
});
|
|
154
|
-
},
|
|
155
|
-
let { authToken: t } = e(),
|
|
156
|
-
return
|
|
159
|
+
}, y = () => {
|
|
160
|
+
let { authToken: t, currentUser: n } = e(), i = d(), { emit: a } = o();
|
|
161
|
+
return u({
|
|
157
162
|
mutationFn: async (e) => {
|
|
158
|
-
let
|
|
163
|
+
let i = await c(s({
|
|
164
|
+
authToken: t,
|
|
165
|
+
currentUser: n
|
|
166
|
+
}), {
|
|
159
167
|
gateway: "global",
|
|
160
|
-
|
|
161
|
-
query: u(r),
|
|
168
|
+
query: f(r),
|
|
162
169
|
variables: { id: e }
|
|
163
170
|
});
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
171
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
|
|
172
|
+
return i.data.activateWorkspace;
|
|
166
173
|
},
|
|
167
174
|
onSuccess: (e) => {
|
|
168
|
-
|
|
175
|
+
m(i, e.id), a("workspace.reactivated", {
|
|
169
176
|
workspaceId: e.id,
|
|
170
177
|
source: "microfe-workspaces"
|
|
171
178
|
});
|
|
172
179
|
},
|
|
173
180
|
onError: (e, t) => {
|
|
174
|
-
|
|
181
|
+
a("workspace.reactivate_failed", {
|
|
175
182
|
workspaceId: t,
|
|
176
183
|
source: "microfe-workspaces",
|
|
177
|
-
errorMessage:
|
|
184
|
+
errorMessage: l(e)
|
|
178
185
|
});
|
|
179
186
|
}
|
|
180
187
|
});
|
|
181
188
|
};
|
|
182
189
|
//#endregion
|
|
183
|
-
export {
|
|
190
|
+
export { v as useArchiveWorkspace, h as useCreateWorkspace, _ as useDeleteWorkspace, y as useReactivateWorkspace, g as useUpdateWorkspace };
|