@burdenoff/microfe-workspaces 2026.1129.1 → 2026.1130.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.
- package/dist/components/CreateProjectDialog.js +80 -67
- package/dist/hooks/useProjectMutations.js +55 -54
- package/dist/translations/en.d.ts +9 -0
- package/dist/translations/en.js +9 -0
- package/dist/utils/createProjectError.d.ts +25 -0
- package/dist/utils/createProjectError.js +31 -0
- package/package.json +8 -2
|
@@ -3,112 +3,125 @@ import { useCreateProject as t } from "../hooks/useProjectMutations.js";
|
|
|
3
3
|
import { useTr as n } from "../hooks/useTr.js";
|
|
4
4
|
import { useIsFluidGridsVariant as r } from "../providers/WorkspacesProvider.js";
|
|
5
5
|
import { buildCreateProjectInput as i, generateProjectKey as a } from "../utils/createForms.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { describeCreateProjectError as o } from "../utils/createProjectError.js";
|
|
7
|
+
import { useMemo as s } from "react";
|
|
8
|
+
import { Button as c, OptionalFields as l, ResponsiveDialog as u, ResponsiveDialogContent as d, ResponsiveDialogDescription as f, ResponsiveDialogHeader as p, ResponsiveDialogTitle as m } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
|
+
import { FormControl as v, FormDescription as y, FormField as b, FormItem as x, FormLabel as S, FormMessage as C, FormProvider as w, Input as T, Textarea as E, useForm as D, z as O } from "@burdenoff/fe-libs/form";
|
|
10
11
|
// src/components/CreateProjectDialog.tsx
|
|
11
|
-
function
|
|
12
|
-
return
|
|
13
|
-
name:
|
|
14
|
-
key:
|
|
15
|
-
description:
|
|
12
|
+
function k(e) {
|
|
13
|
+
return O.object({
|
|
14
|
+
name: O.string().min(2, e("createProjectDialog.validation.nameMin", "Name must be at least 2 characters")).max(100, e("createProjectDialog.validation.nameMax", "Name must be less than 100 characters")),
|
|
15
|
+
key: O.string().min(2, e("createProjectDialog.validation.keyMin", "Key must be at least 2 characters")).max(10, e("createProjectDialog.validation.keyMax", "Key must be less than 10 characters")).regex(/^[A-Z0-9_-]+$/, e("createProjectDialog.validation.keyFormat", "Key must be uppercase letters, numbers, underscores, or hyphens")),
|
|
16
|
+
description: O.string().optional()
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
schema:
|
|
19
|
+
function A({ workspaceId: O }) {
|
|
20
|
+
let A = n(), j = r(), { isCreateProjectDialogOpen: M, closeCreateProjectDialog: N } = e(), { mutate: P, isPending: F } = t(O), I = s(() => k(A), [A]), L = D({
|
|
21
|
+
schema: I,
|
|
21
22
|
defaultValues: {
|
|
22
23
|
name: "",
|
|
23
24
|
key: "",
|
|
24
25
|
description: ""
|
|
25
26
|
}
|
|
26
|
-
}),
|
|
27
|
+
}), R = (e) => {
|
|
27
28
|
let t = i(e);
|
|
28
|
-
|
|
29
|
+
P(t, {
|
|
29
30
|
onSuccess: () => {
|
|
30
|
-
|
|
31
|
+
N(), L.reset();
|
|
31
32
|
},
|
|
32
|
-
onError: (
|
|
33
|
-
|
|
33
|
+
onError: (t) => {
|
|
34
|
+
let n = o(t, e.key, A);
|
|
35
|
+
n.field ? L.setError(n.field, {
|
|
36
|
+
type: "server",
|
|
37
|
+
message: n.message
|
|
38
|
+
}, { shouldFocus: !0 }) : L.setError("root.server", {
|
|
39
|
+
type: "server",
|
|
40
|
+
message: n.message
|
|
41
|
+
});
|
|
34
42
|
}
|
|
35
43
|
});
|
|
36
|
-
},
|
|
37
|
-
e || (
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
control:
|
|
44
|
+
}, z = (e) => {
|
|
45
|
+
e || (N(), L.reset());
|
|
46
|
+
}, B = !!L.formState.dirtyFields.key, V = (e) => {
|
|
47
|
+
B || L.setValue("key", a(e), { shouldValidate: L.formState.isSubmitted });
|
|
48
|
+
}, H = /* @__PURE__ */ g(b, {
|
|
49
|
+
control: L.control,
|
|
42
50
|
name: "key",
|
|
43
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
51
|
+
render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
|
|
52
|
+
/* @__PURE__ */ g(S, { children: A("createProjectDialog.keyLabel", "Project Key") }),
|
|
53
|
+
/* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(T, {
|
|
46
54
|
...e,
|
|
47
|
-
placeholder:
|
|
55
|
+
placeholder: A("createProjectDialog.keyPlaceholder", "MYPROJ")
|
|
48
56
|
}) }),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ g(y, { children: A("createProjectDialog.keyHint", "Short identifier (uppercase letters, numbers, underscores)") }),
|
|
58
|
+
/* @__PURE__ */ g(C, {})
|
|
51
59
|
] })
|
|
52
|
-
}),
|
|
53
|
-
control:
|
|
60
|
+
}), U = /* @__PURE__ */ g(b, {
|
|
61
|
+
control: L.control,
|
|
54
62
|
name: "description",
|
|
55
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
63
|
+
render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
|
|
64
|
+
/* @__PURE__ */ g(S, { children: A("createProjectDialog.descriptionLabel", "Description (Optional)") }),
|
|
65
|
+
/* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(E, {
|
|
58
66
|
...e,
|
|
59
|
-
placeholder:
|
|
67
|
+
placeholder: A("createProjectDialog.descriptionPlaceholder", "Brief description of the project"),
|
|
60
68
|
rows: 3
|
|
61
69
|
}) }),
|
|
62
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ g(C, {})
|
|
63
71
|
] })
|
|
64
72
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
open:
|
|
67
|
-
onOpenChange:
|
|
68
|
-
children: /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ g(u, {
|
|
74
|
+
open: M,
|
|
75
|
+
onOpenChange: z,
|
|
76
|
+
children: /* @__PURE__ */ _(d, {
|
|
69
77
|
className: "sm:max-w-[500px]",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
...
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
-
onSubmit:
|
|
78
|
+
children: [/* @__PURE__ */ _(p, { children: [/* @__PURE__ */ g(m, { children: A("createProjectDialog.title", "Create Project") }), /* @__PURE__ */ g(f, { children: A("createProjectDialog.description", "Create a new project in your workspace. Projects help organize your work.") })] }), /* @__PURE__ */ g(w, {
|
|
79
|
+
...L,
|
|
80
|
+
children: /* @__PURE__ */ _("form", {
|
|
81
|
+
onSubmit: L.handleSubmit(R),
|
|
74
82
|
className: "space-y-4",
|
|
75
83
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
control:
|
|
84
|
+
/* @__PURE__ */ g(b, {
|
|
85
|
+
control: L.control,
|
|
78
86
|
name: "name",
|
|
79
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
87
|
+
render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
|
|
88
|
+
/* @__PURE__ */ g(S, { children: A("createProjectDialog.nameLabel", "Project Name") }),
|
|
89
|
+
/* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(T, {
|
|
82
90
|
...e,
|
|
83
|
-
placeholder:
|
|
91
|
+
placeholder: A("createProjectDialog.namePlaceholder", "My Project"),
|
|
84
92
|
onChange: (t) => {
|
|
85
|
-
e.onChange(t),
|
|
93
|
+
e.onChange(t), V(t.target.value);
|
|
86
94
|
}
|
|
87
95
|
}) }),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ g(y, { children: A("createProjectDialog.nameHint", "A descriptive name for your project") }),
|
|
97
|
+
/* @__PURE__ */ g(C, {})
|
|
90
98
|
] })
|
|
91
99
|
}),
|
|
92
|
-
|
|
100
|
+
j ? /* @__PURE__ */ _(h, { children: [L.formState.errors.key?.message ? /* @__PURE__ */ g("p", {
|
|
93
101
|
role: "alert",
|
|
94
102
|
className: "text-sm text-status-error-text",
|
|
95
|
-
children:
|
|
96
|
-
}) : null, /* @__PURE__ */
|
|
103
|
+
children: L.formState.errors.key.message
|
|
104
|
+
}) : null, /* @__PURE__ */ _(l, {
|
|
97
105
|
storageKey: "workspaces.createProject",
|
|
98
|
-
children: [
|
|
99
|
-
})] }) : /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */ g("
|
|
106
|
+
children: [H, U]
|
|
107
|
+
})] }) : /* @__PURE__ */ _(h, { children: [H, U] }),
|
|
108
|
+
L.formState.errors.root?.server?.message ? /* @__PURE__ */ g("p", {
|
|
109
|
+
role: "alert",
|
|
110
|
+
className: "text-sm text-status-error-text",
|
|
111
|
+
children: L.formState.errors.root.server.message
|
|
112
|
+
}) : null,
|
|
113
|
+
/* @__PURE__ */ _("div", {
|
|
101
114
|
className: "flex justify-end gap-3 pt-4",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
115
|
+
children: [/* @__PURE__ */ g(c, {
|
|
103
116
|
type: "button",
|
|
104
117
|
variant: "outline",
|
|
105
|
-
onClick: () =>
|
|
106
|
-
disabled:
|
|
107
|
-
children:
|
|
108
|
-
}), /* @__PURE__ */
|
|
118
|
+
onClick: () => z(!1),
|
|
119
|
+
disabled: F,
|
|
120
|
+
children: A("common.cancel", "Cancel")
|
|
121
|
+
}), /* @__PURE__ */ g(c, {
|
|
109
122
|
type: "submit",
|
|
110
|
-
disabled:
|
|
111
|
-
children:
|
|
123
|
+
disabled: F,
|
|
124
|
+
children: F ? A("createProjectDialog.creating", "Creating...") : A("createProjectDialog.submit", "Create Project")
|
|
112
125
|
})]
|
|
113
126
|
})
|
|
114
127
|
]
|
|
@@ -117,4 +130,4 @@ function k({ workspaceId: D }) {
|
|
|
117
130
|
})
|
|
118
131
|
});
|
|
119
132
|
}
|
|
120
|
-
export {
|
|
133
|
+
export { A as CreateProjectDialog };
|
|
@@ -2,53 +2,54 @@ import { captureRequestActor as e, pinnedFetch as t } from "../utils/pinnedReque
|
|
|
2
2
|
import { useWorkspacesContext as n } from "../providers/WorkspacesProvider.js";
|
|
3
3
|
import { useWorkspacesEventEmitter as r } from "./useWorkspacesEventEmitter.js";
|
|
4
4
|
import { safeTelemetryError as i } from "../utils/telemetryError.js";
|
|
5
|
-
import {
|
|
5
|
+
import { GraphQLOperationError as a } from "../utils/createProjectError.js";
|
|
6
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
6
7
|
// src/hooks/useProjectMutations.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var c = "\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", l = "\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", u = "\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n", d = "\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", f = "\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", p = "\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", m = "\n query GetProjectTagAssignments($entityType: String!, $entityId: ID!) {\n getEntityTags(entityType: $entityType, entityId: $entityId) {\n id\n tagId\n }\n }\n", h = "\n mutation RemoveTagAssignment($id: ID!) {\n removeTagAssignment(id: $id)\n }\n";
|
|
9
|
+
function g(e) {
|
|
9
10
|
e.invalidateQueries({ queryKey: ["projects"] }), e.invalidateQueries({ queryKey: ["project"] }), e.invalidateQueries({ queryKey: ["myProjects"] }), e.invalidateQueries({ queryKey: ["dashboard", "projects"] });
|
|
10
11
|
}
|
|
11
|
-
var
|
|
12
|
-
let { authToken:
|
|
13
|
-
return
|
|
12
|
+
var _ = (l) => {
|
|
13
|
+
let { authToken: u, currentUser: d, onProjectCreate: f, workspaceId: p } = n(), m = s(), { emit: h } = r(), _ = l || p;
|
|
14
|
+
return o({
|
|
14
15
|
mutationFn: async (n) => {
|
|
15
16
|
let r = e({
|
|
16
|
-
authToken:
|
|
17
|
-
currentUser:
|
|
17
|
+
authToken: u,
|
|
18
|
+
currentUser: d
|
|
18
19
|
}), i = await t(r, {
|
|
19
20
|
gateway: "workspace",
|
|
20
|
-
query:
|
|
21
|
+
query: c,
|
|
21
22
|
variables: { input: n },
|
|
22
|
-
workspaceId:
|
|
23
|
+
workspaceId: _ || void 0
|
|
23
24
|
});
|
|
24
|
-
if (i.errors?.length) throw
|
|
25
|
+
if (i.errors?.length) throw new a(i.errors[0]);
|
|
25
26
|
return i.data.createProject;
|
|
26
27
|
},
|
|
27
28
|
onSuccess: (e) => {
|
|
28
|
-
|
|
29
|
+
g(m), h("project.created", {
|
|
29
30
|
projectId: e.id,
|
|
30
31
|
workspaceId: e.workspaceId,
|
|
31
32
|
source: "microfe-workspaces"
|
|
32
|
-
}),
|
|
33
|
+
}), f && f(e);
|
|
33
34
|
},
|
|
34
35
|
onError: (e) => {
|
|
35
|
-
|
|
36
|
-
workspaceId:
|
|
36
|
+
h("project.create_failed", {
|
|
37
|
+
workspaceId: _ || void 0,
|
|
37
38
|
source: "microfe-workspaces",
|
|
38
39
|
errorMessage: i(e)
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
|
-
},
|
|
43
|
-
let { authToken:
|
|
44
|
-
return
|
|
43
|
+
}, v = (a) => {
|
|
44
|
+
let { authToken: c, currentUser: u, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
|
|
45
|
+
return o({
|
|
45
46
|
mutationFn: async ({ id: n, input: r }) => {
|
|
46
47
|
let i = e({
|
|
47
|
-
authToken:
|
|
48
|
+
authToken: c,
|
|
48
49
|
currentUser: u
|
|
49
50
|
}), a = await t(i, {
|
|
50
51
|
gateway: "workspace",
|
|
51
|
-
query:
|
|
52
|
+
query: l,
|
|
52
53
|
variables: {
|
|
53
54
|
id: n,
|
|
54
55
|
input: r
|
|
@@ -59,7 +60,7 @@ var g = (c) => {
|
|
|
59
60
|
return a.data.updateProject;
|
|
60
61
|
},
|
|
61
62
|
onSuccess: (e) => {
|
|
62
|
-
|
|
63
|
+
g(f), p("project.updated", {
|
|
63
64
|
projectId: e.id,
|
|
64
65
|
workspaceId: e.workspaceId,
|
|
65
66
|
source: "microfe-workspaces"
|
|
@@ -74,16 +75,16 @@ var g = (c) => {
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
|
-
},
|
|
78
|
-
let { authToken: c, currentUser: l, workspaceId: u } = n(), d =
|
|
79
|
-
return
|
|
78
|
+
}, y = (a) => {
|
|
79
|
+
let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), m = a || u;
|
|
80
|
+
return o({
|
|
80
81
|
mutationFn: async (n) => {
|
|
81
82
|
let r = e({
|
|
82
83
|
authToken: c,
|
|
83
84
|
currentUser: l
|
|
84
85
|
}), i = await t(r, {
|
|
85
86
|
gateway: "workspace",
|
|
86
|
-
query:
|
|
87
|
+
query: p,
|
|
87
88
|
variables: { input: {
|
|
88
89
|
tagId: n.tagId,
|
|
89
90
|
entityType: "WORKSPACE_PROJECT",
|
|
@@ -113,14 +114,14 @@ var g = (c) => {
|
|
|
113
114
|
};
|
|
114
115
|
},
|
|
115
116
|
onSuccess: (e, t) => {
|
|
116
|
-
|
|
117
|
+
g(d), f("project.updated", {
|
|
117
118
|
projectId: t.entityId,
|
|
118
119
|
workspaceId: m || void 0,
|
|
119
120
|
source: "microfe-workspaces"
|
|
120
121
|
});
|
|
121
122
|
},
|
|
122
123
|
onError: (e, t) => {
|
|
123
|
-
|
|
124
|
+
f("project.update_failed", {
|
|
124
125
|
projectId: t.entityId,
|
|
125
126
|
workspaceId: m || void 0,
|
|
126
127
|
source: "microfe-workspaces",
|
|
@@ -128,9 +129,9 @@ var g = (c) => {
|
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
|
-
},
|
|
132
|
-
let { authToken: c, currentUser: l, workspaceId: u } = n(), d =
|
|
133
|
-
return
|
|
132
|
+
}, b = (a) => {
|
|
133
|
+
let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), p = a || u;
|
|
134
|
+
return o({
|
|
134
135
|
mutationFn: async (n) => {
|
|
135
136
|
let r = e({
|
|
136
137
|
authToken: c,
|
|
@@ -139,12 +140,12 @@ var g = (c) => {
|
|
|
139
140
|
if (!i) {
|
|
140
141
|
let e = await t(r, {
|
|
141
142
|
gateway: "workspace",
|
|
142
|
-
query:
|
|
143
|
+
query: m,
|
|
143
144
|
variables: {
|
|
144
145
|
entityType: "WORKSPACE_PROJECT",
|
|
145
146
|
entityId: n.entityId
|
|
146
147
|
},
|
|
147
|
-
workspaceId:
|
|
148
|
+
workspaceId: p || void 0
|
|
148
149
|
});
|
|
149
150
|
if (e.errors?.length) throw Error(e.errors[0]?.message || "GraphQL error");
|
|
150
151
|
i = e.data?.getEntityTags.find((e) => e.tagId === n.tagId)?.id;
|
|
@@ -152,39 +153,39 @@ var g = (c) => {
|
|
|
152
153
|
if (!i) return !1;
|
|
153
154
|
let a = await t(r, {
|
|
154
155
|
gateway: "workspace",
|
|
155
|
-
query:
|
|
156
|
+
query: h,
|
|
156
157
|
variables: { id: i },
|
|
157
|
-
workspaceId:
|
|
158
|
+
workspaceId: p || void 0
|
|
158
159
|
});
|
|
159
160
|
if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
|
|
160
161
|
return a.data?.removeTagAssignment ?? !1;
|
|
161
162
|
},
|
|
162
163
|
onSuccess: (e, t) => {
|
|
163
|
-
|
|
164
|
+
g(d), f("project.updated", {
|
|
164
165
|
projectId: t.entityId,
|
|
165
|
-
workspaceId:
|
|
166
|
+
workspaceId: p || void 0,
|
|
166
167
|
source: "microfe-workspaces"
|
|
167
168
|
});
|
|
168
169
|
},
|
|
169
170
|
onError: (e, t) => {
|
|
170
171
|
f("project.update_failed", {
|
|
171
172
|
projectId: t.entityId,
|
|
172
|
-
workspaceId:
|
|
173
|
+
workspaceId: p || void 0,
|
|
173
174
|
source: "microfe-workspaces",
|
|
174
175
|
errorMessage: i(e)
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
|
-
},
|
|
179
|
-
let { authToken: c, currentUser:
|
|
180
|
-
return
|
|
179
|
+
}, x = (a) => {
|
|
180
|
+
let { authToken: c, currentUser: l, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
|
|
181
|
+
return o({
|
|
181
182
|
mutationFn: async (n) => {
|
|
182
183
|
let r = e({
|
|
183
184
|
authToken: c,
|
|
184
|
-
currentUser:
|
|
185
|
+
currentUser: l
|
|
185
186
|
}), i = await t(r, {
|
|
186
187
|
gateway: "workspace",
|
|
187
|
-
query:
|
|
188
|
+
query: u,
|
|
188
189
|
variables: { id: n },
|
|
189
190
|
workspaceId: m || void 0
|
|
190
191
|
});
|
|
@@ -192,7 +193,7 @@ var g = (c) => {
|
|
|
192
193
|
return i.data.deleteProject;
|
|
193
194
|
},
|
|
194
195
|
onSuccess: (e, t) => {
|
|
195
|
-
|
|
196
|
+
g(f), p("project.deleted", {
|
|
196
197
|
projectId: t,
|
|
197
198
|
source: "microfe-workspaces"
|
|
198
199
|
});
|
|
@@ -206,16 +207,16 @@ var g = (c) => {
|
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
|
-
},
|
|
210
|
-
let { authToken: c, currentUser: l, workspaceId:
|
|
211
|
-
return
|
|
210
|
+
}, S = (a) => {
|
|
211
|
+
let { authToken: c, currentUser: l, workspaceId: u } = n(), f = s(), { emit: p } = r(), m = a || u;
|
|
212
|
+
return o({
|
|
212
213
|
mutationFn: async (n) => {
|
|
213
214
|
let r = e({
|
|
214
215
|
authToken: c,
|
|
215
216
|
currentUser: l
|
|
216
217
|
}), i = await t(r, {
|
|
217
218
|
gateway: "workspace",
|
|
218
|
-
query:
|
|
219
|
+
query: d,
|
|
219
220
|
variables: { id: n },
|
|
220
221
|
workspaceId: m || void 0
|
|
221
222
|
});
|
|
@@ -223,7 +224,7 @@ var g = (c) => {
|
|
|
223
224
|
return i.data.archiveProject;
|
|
224
225
|
},
|
|
225
226
|
onSuccess: (e) => {
|
|
226
|
-
|
|
227
|
+
g(f), p("project.archived", {
|
|
227
228
|
projectId: e.id,
|
|
228
229
|
workspaceId: e.workspaceId,
|
|
229
230
|
source: "microfe-workspaces"
|
|
@@ -238,16 +239,16 @@ var g = (c) => {
|
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
241
|
});
|
|
241
|
-
},
|
|
242
|
-
let { authToken: c, currentUser: l, workspaceId: u } = n(),
|
|
243
|
-
return
|
|
242
|
+
}, C = (a) => {
|
|
243
|
+
let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: p } = r(), m = a || u;
|
|
244
|
+
return o({
|
|
244
245
|
mutationFn: async (n) => {
|
|
245
246
|
let r = e({
|
|
246
247
|
authToken: c,
|
|
247
248
|
currentUser: l
|
|
248
249
|
}), i = await t(r, {
|
|
249
250
|
gateway: "workspace",
|
|
250
|
-
query:
|
|
251
|
+
query: f,
|
|
251
252
|
variables: { id: n },
|
|
252
253
|
workspaceId: m || void 0
|
|
253
254
|
});
|
|
@@ -255,7 +256,7 @@ var g = (c) => {
|
|
|
255
256
|
return i.data.unarchiveProject;
|
|
256
257
|
},
|
|
257
258
|
onSuccess: (e) => {
|
|
258
|
-
|
|
259
|
+
g(d), p("project.unarchived", {
|
|
259
260
|
projectId: e.id,
|
|
260
261
|
workspaceId: e.workspaceId,
|
|
261
262
|
source: "microfe-workspaces"
|
|
@@ -271,4 +272,4 @@ var g = (c) => {
|
|
|
271
272
|
}
|
|
272
273
|
});
|
|
273
274
|
};
|
|
274
|
-
export {
|
|
275
|
+
export { S as useArchiveProject, _ as useCreateProject, x as useDeleteProject, y as useTagProject, C as useUnarchiveProject, b as useUntagProject, v as useUpdateProject };
|
|
@@ -86,6 +86,15 @@ export declare const enTranslations: {
|
|
|
86
86
|
description: string;
|
|
87
87
|
descriptionLabel: string;
|
|
88
88
|
descriptionPlaceholder: string;
|
|
89
|
+
errors: {
|
|
90
|
+
actorChanged: string;
|
|
91
|
+
forbidden: string;
|
|
92
|
+
generic: string;
|
|
93
|
+
invalid: string;
|
|
94
|
+
keyTaken: string;
|
|
95
|
+
network: string;
|
|
96
|
+
signIn: string;
|
|
97
|
+
};
|
|
89
98
|
keyHint: string;
|
|
90
99
|
keyLabel: string;
|
|
91
100
|
keyPlaceholder: string;
|
package/dist/translations/en.js
CHANGED
|
@@ -77,6 +77,15 @@ var e = {
|
|
|
77
77
|
description: "Create a new project in your workspace. Projects help organize your work.",
|
|
78
78
|
descriptionLabel: "Description (Optional)",
|
|
79
79
|
descriptionPlaceholder: "Brief description of the project",
|
|
80
|
+
errors: {
|
|
81
|
+
actorChanged: "The active account changed before the project was created. Review it and try again.",
|
|
82
|
+
forbidden: "You do not have permission to create projects in this workspace.",
|
|
83
|
+
generic: "The project could not be created. Try again in a moment.",
|
|
84
|
+
invalid: "The project details were not accepted. Check them and try again.",
|
|
85
|
+
keyTaken: "A project with the key \"{{key}}\" already exists in this workspace. Choose another key.",
|
|
86
|
+
network: "Could not reach the server. Check your connection and try again.",
|
|
87
|
+
signIn: "Your session has ended. Sign in again, then create the project."
|
|
88
|
+
},
|
|
80
89
|
keyHint: "Short identifier (uppercase letters, numbers, underscores)",
|
|
81
90
|
keyLabel: "Project Key",
|
|
82
91
|
keyPlaceholder: "MYPROJ",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TrFunction } from '../hooks/useTr';
|
|
2
|
+
/** The server's i18n key for a key another live project already uses (wspace-workspace-svc, BOFF-17404). */
|
|
3
|
+
export declare const PROJECT_KEY_TAKEN_I18N_KEY = "project.errors.keyTaken";
|
|
4
|
+
interface GraphQLErrorEntry {
|
|
5
|
+
message: string;
|
|
6
|
+
extensions?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
/** A GraphQL error response, with the first error's code and i18n key kept. */
|
|
9
|
+
export declare class GraphQLOperationError extends Error {
|
|
10
|
+
readonly code: string | undefined;
|
|
11
|
+
readonly i18nKey: string | undefined;
|
|
12
|
+
readonly field: string | undefined;
|
|
13
|
+
constructor(error: GraphQLErrorEntry | undefined);
|
|
14
|
+
}
|
|
15
|
+
export interface CreateProjectErrorDisplay {
|
|
16
|
+
/** The form field the message belongs to; absent for a form-level message. */
|
|
17
|
+
field?: 'key';
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Map a failed create to what the dialog shows. `key` is the key the user
|
|
22
|
+
* submitted; the key-taken message names it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function describeCreateProjectError(error: unknown, key: string, tr: TrFunction): CreateProjectErrorDisplay;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "./pinnedRequest.js";
|
|
2
|
+
// src/utils/createProjectError.ts
|
|
3
|
+
var e = "project.errors.keyTaken", t = class extends Error {
|
|
4
|
+
code;
|
|
5
|
+
i18nKey;
|
|
6
|
+
field;
|
|
7
|
+
constructor(e) {
|
|
8
|
+
super(e?.message || "GraphQL error"), this.name = "GraphQLOperationError";
|
|
9
|
+
let t = e?.extensions ?? {};
|
|
10
|
+
this.code = typeof t.code == "string" ? t.code : void 0, this.i18nKey = typeof t.i18nKey == "string" ? t.i18nKey : void 0, this.field = typeof t.field == "string" ? t.field : void 0;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function n(e, n, a) {
|
|
14
|
+
if (e instanceof t) return e.i18nKey === "project.errors.keyTaken" || e.code === "CONFLICT" ? {
|
|
15
|
+
field: "key",
|
|
16
|
+
message: a("createProjectDialog.errors.keyTaken", "A project with the key \"{{key}}\" already exists in this workspace. Choose another key.", { key: n })
|
|
17
|
+
} : e.code === "FORBIDDEN" ? { message: a("createProjectDialog.errors.forbidden", "You do not have permission to create projects in this workspace.") } : e.code === "UNAUTHENTICATED" ? { message: r(a) } : e.code === "BAD_USER_INPUT" || e.code === "VALIDATION_ERROR" ? { message: a("createProjectDialog.errors.invalid", "The project details were not accepted. Check them and try again.") } : { message: i(a) };
|
|
18
|
+
if (e instanceof Error) {
|
|
19
|
+
if (e.message === "Your session has ended. Sign in again, then retry this action.") return { message: r(a) };
|
|
20
|
+
if (e.message === "The active account changed before this action was sent. Review it and try again.") return { message: a("createProjectDialog.errors.actorChanged", "The active account changed before the project was created. Review it and try again.") };
|
|
21
|
+
if (e instanceof TypeError) return { message: a("createProjectDialog.errors.network", "Could not reach the server. Check your connection and try again.") };
|
|
22
|
+
}
|
|
23
|
+
return { message: i(a) };
|
|
24
|
+
}
|
|
25
|
+
function r(e) {
|
|
26
|
+
return e("createProjectDialog.errors.signIn", "Your session has ended. Sign in again, then create the project.");
|
|
27
|
+
}
|
|
28
|
+
function i(e) {
|
|
29
|
+
return e("createProjectDialog.errors.generic", "The project could not be created. Try again in a moment.");
|
|
30
|
+
}
|
|
31
|
+
export { t as GraphQLOperationError, e as PROJECT_KEY_TAKEN_I18N_KEY, n as describeCreateProjectError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-workspaces",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1130.2",
|
|
4
4
|
"description": "Workspaces microfrontend for Burdenoff products",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"format": "bun fmt src",
|
|
38
38
|
"format:check": "bun fmt --check src",
|
|
39
39
|
"type:check": "boff gate -- bun check --no-pretty -b",
|
|
40
|
-
"test": "bun test",
|
|
40
|
+
"test": "bun test --isolate",
|
|
41
41
|
"test:watch": "bun test --watch",
|
|
42
42
|
"test:coverage": "bun test --coverage",
|
|
43
43
|
"sanity": "boff sanity",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@burdenoff/toolchain": "2026.1107.14",
|
|
76
76
|
"@graphql-codegen/core": "6.2.2",
|
|
77
|
+
"@graphql-codegen/plugin-helpers": "7.4.2",
|
|
77
78
|
"@graphql-codegen/schema-ast": "6.1.1",
|
|
78
79
|
"@graphql-codegen/typed-document-node": "7.1.1",
|
|
79
80
|
"@graphql-codegen/typescript": "6.1.2",
|
|
@@ -150,6 +151,11 @@
|
|
|
150
151
|
"test:codegen",
|
|
151
152
|
"check:verify-package-contents"
|
|
152
153
|
]
|
|
154
|
+
},
|
|
155
|
+
"scripts": {
|
|
156
|
+
"unmanaged": [
|
|
157
|
+
"test"
|
|
158
|
+
]
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
}
|