@dsh-workbench/shared 0.1.5 → 0.1.7
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/LongTaskRow.css +10 -0
- package/dist/host/http.js +15 -7
- package/package.json +1 -1
- package/src/components/LongTaskRow.css +10 -0
- package/src/host/http.ts +17 -7
|
@@ -19,9 +19,19 @@
|
|
|
19
19
|
display: inline-flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
gap: var(--wb-len-2);
|
|
22
|
+
color: var(--dsw-alias-label-secondary);
|
|
22
23
|
text-decoration: none;
|
|
23
24
|
white-space: nowrap;
|
|
24
25
|
}
|
|
26
|
+
.wb-longTaskLink:hover,
|
|
27
|
+
.wb-longTaskLink:focus-visible {
|
|
28
|
+
color: var(--dsw-alias-label-primary);
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
}
|
|
31
|
+
.wb-longTaskLink:focus-visible {
|
|
32
|
+
outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
33
|
+
outline-offset: -2px;
|
|
34
|
+
}
|
|
25
35
|
|
|
26
36
|
.wb-longTaskHeadline {
|
|
27
37
|
margin: 0;
|
package/dist/host/http.js
CHANGED
|
@@ -15,15 +15,23 @@ function sendJson(res, status, body) {
|
|
|
15
15
|
res.setHeader('cache-control', 'no-store');
|
|
16
16
|
res.end(JSON.stringify(body));
|
|
17
17
|
}
|
|
18
|
+
function isDataError(error) {
|
|
19
|
+
if (error instanceof WorkbenchDataError)
|
|
20
|
+
return true;
|
|
21
|
+
return (error instanceof Error &&
|
|
22
|
+
error.name === 'WorkbenchDataError' &&
|
|
23
|
+
typeof error.code === 'string');
|
|
24
|
+
}
|
|
18
25
|
function toErrorPayload(error) {
|
|
19
|
-
if (error
|
|
26
|
+
if (isDataError(error)) {
|
|
27
|
+
const data = error;
|
|
20
28
|
return {
|
|
21
|
-
code:
|
|
22
|
-
message:
|
|
23
|
-
...(
|
|
24
|
-
...(
|
|
25
|
-
...(
|
|
26
|
-
...(
|
|
29
|
+
code: data.code,
|
|
30
|
+
message: data.message,
|
|
31
|
+
...(data.detail === undefined ? {} : { detail: data.detail }),
|
|
32
|
+
...(data.hint === undefined ? {} : { hint: data.hint }),
|
|
33
|
+
...(data.helpUrl === undefined ? {} : { helpUrl: data.helpUrl }),
|
|
34
|
+
...(data.project === undefined ? {} : { project: data.project }),
|
|
27
35
|
};
|
|
28
36
|
}
|
|
29
37
|
return { code: 'internal', message: error instanceof Error ? error.message : String(error) };
|
package/package.json
CHANGED
|
@@ -19,9 +19,19 @@
|
|
|
19
19
|
display: inline-flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
gap: var(--wb-len-2);
|
|
22
|
+
color: var(--dsw-alias-label-secondary);
|
|
22
23
|
text-decoration: none;
|
|
23
24
|
white-space: nowrap;
|
|
24
25
|
}
|
|
26
|
+
.wb-longTaskLink:hover,
|
|
27
|
+
.wb-longTaskLink:focus-visible {
|
|
28
|
+
color: var(--dsw-alias-label-primary);
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
}
|
|
31
|
+
.wb-longTaskLink:focus-visible {
|
|
32
|
+
outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
33
|
+
outline-offset: -2px;
|
|
34
|
+
}
|
|
25
35
|
|
|
26
36
|
.wb-longTaskHeadline {
|
|
27
37
|
margin: 0;
|
package/src/host/http.ts
CHANGED
|
@@ -29,15 +29,25 @@ function sendJson(res: DshResponse, status: number, body: unknown): void {
|
|
|
29
29
|
res.end(JSON.stringify(body));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function isDataError(error: unknown): boolean {
|
|
33
|
+
if (error instanceof WorkbenchDataError) return true;
|
|
34
|
+
return (
|
|
35
|
+
error instanceof Error &&
|
|
36
|
+
error.name === 'WorkbenchDataError' &&
|
|
37
|
+
typeof (error as { code?: unknown }).code === 'string'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
function toErrorPayload(error: unknown): Record<string, unknown> {
|
|
33
|
-
if (error
|
|
42
|
+
if (isDataError(error)) {
|
|
43
|
+
const data = error as WorkbenchDataError;
|
|
34
44
|
return {
|
|
35
|
-
code:
|
|
36
|
-
message:
|
|
37
|
-
...(
|
|
38
|
-
...(
|
|
39
|
-
...(
|
|
40
|
-
...(
|
|
45
|
+
code: data.code,
|
|
46
|
+
message: data.message,
|
|
47
|
+
...(data.detail === undefined ? {} : { detail: data.detail }),
|
|
48
|
+
...(data.hint === undefined ? {} : { hint: data.hint }),
|
|
49
|
+
...(data.helpUrl === undefined ? {} : { helpUrl: data.helpUrl }),
|
|
50
|
+
...(data.project === undefined ? {} : { project: data.project }),
|
|
41
51
|
};
|
|
42
52
|
}
|
|
43
53
|
return { code: 'internal', message: error instanceof Error ? error.message : String(error) };
|