@supernova-studio/client 0.54.35 → 0.55.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/index.d.mts +78 -5
- package/dist/index.d.ts +78 -5
- package/dist/index.js +52 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +926 -895
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-systems/design-system.ts +7 -1
- package/src/api/dto/design-systems/members.ts +1 -1
- package/src/api/transport/request-executor-error.ts +18 -1
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DesignSystem, DesignSystemAccessMode, ObjectMeta, WorkspaceRoleSchema } from "@supernova-studio/model";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { DTODesignSystemMembersUpdatePayload } from "./members";
|
|
3
4
|
|
|
4
5
|
//
|
|
5
6
|
// Read
|
|
@@ -38,7 +39,12 @@ export const DTODesignSystemCreateInput = z.object({
|
|
|
38
39
|
name: z.string().min(2).max(64).optional(),
|
|
39
40
|
description: z.string().max(1024).optional(),
|
|
40
41
|
accessMode: DesignSystemAccessMode.optional(),
|
|
41
|
-
|
|
42
|
+
|
|
43
|
+
invites: DTODesignSystemMembersUpdatePayload.pick({
|
|
44
|
+
usersToInvite: true,
|
|
45
|
+
invitesToInvite: true,
|
|
46
|
+
emailsToInvite: true,
|
|
47
|
+
}).optional(),
|
|
42
48
|
});
|
|
43
49
|
|
|
44
50
|
export type DTODesignSystemCreateInput = z.infer<typeof DTODesignSystemCreateInput>;
|
|
@@ -6,6 +6,7 @@ export type RequestEexecutorServerErrorCode = SupernovaExceptionType | undefined
|
|
|
6
6
|
export class RequestExecutorError extends Error {
|
|
7
7
|
readonly type: RequestExecutorErrorType;
|
|
8
8
|
readonly errorCode: RequestEexecutorServerErrorCode;
|
|
9
|
+
readonly serverErrorType: SupernovaExceptionType | undefined;
|
|
9
10
|
|
|
10
11
|
static tryParseErrorCode(body: string) {
|
|
11
12
|
try {
|
|
@@ -19,11 +20,24 @@ export class RequestExecutorError extends Error {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
static tryParseServerErrorType(body: string) {
|
|
24
|
+
try {
|
|
25
|
+
const errorObj = JSON.parse(body);
|
|
26
|
+
if (errorObj && typeof errorObj.errorCode === "string") {
|
|
27
|
+
return errorObj.type;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
static serverError(endpoint: string, status: number, bodyText: string) {
|
|
23
36
|
return new RequestExecutorError(
|
|
24
37
|
"ServerError",
|
|
25
38
|
`Endpoint ${endpoint} returned ${status}\n${bodyText}`,
|
|
26
|
-
this.tryParseErrorCode(bodyText)
|
|
39
|
+
this.tryParseErrorCode(bodyText),
|
|
40
|
+
this.tryParseServerErrorType(bodyText)
|
|
27
41
|
);
|
|
28
42
|
}
|
|
29
43
|
|
|
@@ -32,6 +46,7 @@ export class RequestExecutorError extends Error {
|
|
|
32
46
|
"ResponseParsingError",
|
|
33
47
|
`Endpoint ${endpoint} returned incompatible JSON`,
|
|
34
48
|
undefined,
|
|
49
|
+
undefined,
|
|
35
50
|
cause
|
|
36
51
|
);
|
|
37
52
|
}
|
|
@@ -40,10 +55,12 @@ export class RequestExecutorError extends Error {
|
|
|
40
55
|
type: RequestExecutorErrorType,
|
|
41
56
|
message: string,
|
|
42
57
|
errorCode: RequestEexecutorServerErrorCode | undefined,
|
|
58
|
+
serverErrorType?: SupernovaExceptionType | undefined,
|
|
43
59
|
cause?: unknown
|
|
44
60
|
) {
|
|
45
61
|
super(`${type}: ${message}`, { cause });
|
|
46
62
|
this.type = type;
|
|
47
63
|
this.errorCode = errorCode;
|
|
64
|
+
this.serverErrorType = serverErrorType;
|
|
48
65
|
}
|
|
49
66
|
}
|