@supernova-studio/client 0.58.10 → 0.58.11
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 +821 -34
- package/dist/index.d.ts +821 -34
- package/dist/index.js +66 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +801 -752
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-systems/brand.ts +23 -1
- package/src/api/dto/design-systems/component.ts +32 -2
- package/src/api/endpoints/design-system/versions/brands.ts +16 -3
- package/src/api/endpoints/design-system/versions/ds-components.ts +20 -7
- package/src/api/payloads/design-systems/index.ts +0 -1
- package/src/api/transport/request-executor-error.ts +1 -1
- package/src/api/payloads/design-systems/brand.ts +0 -12
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { ObjectMeta } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { DTOObjectMeta } from "../aux";
|
|
4
|
+
|
|
5
|
+
//
|
|
6
|
+
// Read
|
|
7
|
+
//
|
|
3
8
|
|
|
4
9
|
export const DTOBrand = z.object({
|
|
5
10
|
id: z.string(),
|
|
@@ -20,3 +25,20 @@ export type DTOBrand = z.infer<typeof DTOBrand>;
|
|
|
20
25
|
export type DTOBrandGetResponse = z.infer<typeof DTOBrandGetResponse>;
|
|
21
26
|
export type DTOBrandCreateResponse = z.infer<typeof DTOBrandCreateResponse>;
|
|
22
27
|
export type DTOBrandsListResponse = z.infer<typeof DTOBrandsListResponse>;
|
|
28
|
+
|
|
29
|
+
//
|
|
30
|
+
// Write
|
|
31
|
+
//
|
|
32
|
+
|
|
33
|
+
export const DTOBrandCreatePayload = z.object({
|
|
34
|
+
persistentId: z.string().uuid(),
|
|
35
|
+
meta: DTOObjectMeta,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const DTOBrandUpdatePayload = z.object({
|
|
39
|
+
meta: DTOObjectMeta.optional(),
|
|
40
|
+
persistentId: z.string(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export type DTOBrandCreatePayload = z.infer<typeof DTOBrandCreatePayload>;
|
|
44
|
+
export type DTOBrandUpdatePayload = z.infer<typeof DTOBrandUpdatePayload>;
|
|
@@ -1,10 +1,40 @@
|
|
|
1
|
-
import { ObjectMeta } from "@supernova-studio/model";
|
|
2
1
|
import { z } from "zod";
|
|
2
|
+
import { DTOObjectMeta } from "../aux";
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Read
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
export const DTODesignSystemComponent = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
persistentId: z.string(),
|
|
11
|
+
designSystemVersionId: z.string(),
|
|
12
|
+
brandId: z.string(),
|
|
13
|
+
meta: DTOObjectMeta,
|
|
14
|
+
createdAt: z.coerce.date(),
|
|
15
|
+
updatedAt: z.coerce.date(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const DTODesignSystemComponentResponse = z.object({
|
|
19
|
+
designSystemComponent: DTODesignSystemComponent,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const DTODesignSystemComponentListResponse = z.object({
|
|
23
|
+
designSystemComponents: DTODesignSystemComponent.array(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type DTODesignSystemComponent = z.infer<typeof DTODesignSystemComponent>;
|
|
27
|
+
export type DTODesignSystemComponentResponse = z.infer<typeof DTODesignSystemComponentResponse>;
|
|
28
|
+
export type DTODesignSystemComponentListResponse = z.infer<typeof DTODesignSystemComponentListResponse>;
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
// Write
|
|
32
|
+
//
|
|
3
33
|
|
|
4
34
|
export const DTODesignSystemComponentCreateInput = z.object({
|
|
5
35
|
brandId: z.string(), // Persistent ID,
|
|
6
36
|
persistentId: z.string(),
|
|
7
|
-
meta:
|
|
37
|
+
meta: DTOObjectMeta,
|
|
8
38
|
});
|
|
9
39
|
|
|
10
40
|
export type DTODesignSystemComponentCreateInput = z.infer<typeof DTODesignSystemComponentCreateInput>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DTOBrandCreatePayload, DTOBrandGetResponse, DTOBrandsListResponse, DTOBrandUpdatePayload } from "../../../dto";
|
|
3
3
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
4
4
|
|
|
5
5
|
export class BrandsEndpoint {
|
|
@@ -19,7 +19,7 @@ export class BrandsEndpoint {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
create(designSystemId: string, versionId: string, body:
|
|
22
|
+
create(designSystemId: string, versionId: string, body: DTOBrandCreatePayload) {
|
|
23
23
|
return this.requestExecutor.json(
|
|
24
24
|
`/design-systems/${designSystemId}/versions/${versionId}/brands`,
|
|
25
25
|
DTOBrandGetResponse,
|
|
@@ -29,4 +29,17 @@ export class BrandsEndpoint {
|
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
update(dsId: string, vId: string, brandId: string, body: DTOBrandUpdatePayload) {
|
|
34
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions/${vId}/brands/${brandId}`, DTOBrandGetResponse, {
|
|
35
|
+
method: "PUT",
|
|
36
|
+
body,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
delete(dsId: string, vId: string, brandId: string) {
|
|
41
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions/${vId}/brands/${brandId}`, z.any(), {
|
|
42
|
+
method: "DELETE",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
32
45
|
}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DTODesignSystemComponentCreateInput,
|
|
3
|
+
DTODesignSystemComponentListResponse,
|
|
4
|
+
DTODesignSystemComponentResponse,
|
|
5
|
+
} from "../../../dto/design-systems/component";
|
|
2
6
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
-
import { DTODesignSystemComponentCreateInput } from "../../../dto/design-systems/component";
|
|
4
|
-
import { z } from "zod";
|
|
5
7
|
|
|
6
8
|
export class DesignSystemComponentEndpoint {
|
|
7
9
|
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
8
10
|
|
|
11
|
+
async list(dsId: string, vId: string) {
|
|
12
|
+
return this.requestExecutor.json(
|
|
13
|
+
`/design-systems/${dsId}/versions/${vId}/design-system-components`,
|
|
14
|
+
DTODesignSystemComponentListResponse
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
async create(dsId: string, vId: string, body: DTODesignSystemComponentCreateInput) {
|
|
10
|
-
return this.requestExecutor.json(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
return this.requestExecutor.json(
|
|
20
|
+
`/design-systems/${dsId}/versions/${vId}/design-system-components`,
|
|
21
|
+
DTODesignSystemComponentResponse,
|
|
22
|
+
{
|
|
23
|
+
body,
|
|
24
|
+
method: "POST",
|
|
25
|
+
}
|
|
26
|
+
);
|
|
14
27
|
}
|
|
15
28
|
}
|
|
@@ -5,7 +5,7 @@ export type RequestEexecutorServerErrorCode = SupernovaExceptionType | undefined
|
|
|
5
5
|
|
|
6
6
|
export class RequestExecutorError extends Error {
|
|
7
7
|
readonly type: RequestExecutorErrorType;
|
|
8
|
-
readonly errorCode: RequestEexecutorServerErrorCode;
|
|
8
|
+
readonly errorCode: RequestEexecutorServerErrorCode | undefined;
|
|
9
9
|
readonly serverErrorType: SupernovaExceptionType | undefined;
|
|
10
10
|
|
|
11
11
|
static tryParseErrorCode(body: string) {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
// TODO make sure these are all accurate.
|
|
4
|
-
export const DTOCreateBrandInput = z.object({
|
|
5
|
-
persistentId: z.string().uuid(),
|
|
6
|
-
meta: z.object({
|
|
7
|
-
name: z.string(),
|
|
8
|
-
description: z.string(),
|
|
9
|
-
}),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export type DTOCreateBrandInput = z.infer<typeof DTOCreateBrandInput>;
|