@supernova-studio/client 0.58.4 → 0.58.6
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 +525 -40
- package/dist/index.d.ts +525 -40
- package/dist/index.js +98 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +982 -886
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-systems/component.ts +10 -0
- package/src/api/dto/design-systems/index.ts +1 -0
- package/src/api/dto/elements/documentation/index.ts +1 -0
- package/src/api/dto/elements/documentation/structure.ts +37 -0
- package/src/api/endpoints/design-system/versions/brands.ts +12 -0
- package/src/api/endpoints/design-system/versions/components.ts +15 -0
- package/src/api/endpoints/design-system/versions/elements-actions.ts +20 -0
- package/src/api/endpoints/design-system/versions/index.ts +2 -0
- package/src/api/endpoints/design-system/versions/versions.ts +6 -0
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ObjectMeta } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const DTODesignSystemComponentCreateInput = z.object({
|
|
5
|
+
brandId: z.string(), // Persistent ID,
|
|
6
|
+
persistentId: z.string(),
|
|
7
|
+
meta: ObjectMeta,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type DTODesignSystemComponentCreateInput = z.infer<typeof DTODesignSystemComponentCreateInput>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const DTODocumentationStructureItemType = z.enum(["Group", "Page"]);
|
|
4
|
+
|
|
5
|
+
const DTODocumentationStructureItemBase = z.object({
|
|
6
|
+
type: DTODocumentationStructureItemType,
|
|
7
|
+
id: z.string(),
|
|
8
|
+
designSystemVersionId: z.string(),
|
|
9
|
+
shortPersistentId: z.string(),
|
|
10
|
+
persistentId: z.string(),
|
|
11
|
+
title: z.string(),
|
|
12
|
+
createdAt: z.coerce.date(),
|
|
13
|
+
updatedAt: z.coerce.date(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const DTODocumentationStructureGroupItem = DTODocumentationStructureItemBase.extend({
|
|
17
|
+
type: z.literal(DTODocumentationStructureItemType.enum.Group),
|
|
18
|
+
groupBehavior: z.string(),
|
|
19
|
+
childrenIds: z.string().array(),
|
|
20
|
+
isRoot: z.boolean(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const DTODocumentationStructurePageItem = DTODocumentationStructureItemBase.extend({
|
|
24
|
+
type: z.literal(DTODocumentationStructureItemType.enum.Page),
|
|
25
|
+
path: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const DTODocumentationStructureItem = z.discriminatedUnion("type", [
|
|
29
|
+
DTODocumentationStructureGroupItem,
|
|
30
|
+
DTODocumentationStructurePageItem,
|
|
31
|
+
]);
|
|
32
|
+
export const DTODocumentationStructure = z.object({
|
|
33
|
+
items: z.array(DTODocumentationStructureItem),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type DTODocumentationStructureItem = z.infer<typeof DTODocumentationStructureItem>;
|
|
37
|
+
export type DTODocumentationStructure = z.infer<typeof DTODocumentationStructure>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DTOBrandGetResponse, DTOBrandsListResponse } from "../../../dto";
|
|
2
|
+
import { DTOCreateBrandInput } from "../../../payloads";
|
|
2
3
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
4
|
|
|
4
5
|
export class BrandsEndpoint {
|
|
@@ -17,4 +18,15 @@ export class BrandsEndpoint {
|
|
|
17
18
|
DTOBrandsListResponse
|
|
18
19
|
);
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
create(designSystemId: string, versionId: string, body: DTOCreateBrandInput) {
|
|
23
|
+
return this.requestExecutor.json(
|
|
24
|
+
`/design-systems/${designSystemId}/versions/${versionId}/brands`,
|
|
25
|
+
DTOBrandGetResponse,
|
|
26
|
+
{
|
|
27
|
+
method: "POST",
|
|
28
|
+
body,
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
20
32
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DTOElementActionOutput } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
import { DTODesignSystemComponentCreateInput } from "../../../dto/design-systems/component";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
export class DesignSystemComponentEndpoint {
|
|
7
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
8
|
+
|
|
9
|
+
async create(dsId: string, vId: string, body: DTODesignSystemComponentCreateInput) {
|
|
10
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions/${vId}/design-system-components`, z.any(), {
|
|
11
|
+
body,
|
|
12
|
+
method: "POST",
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DTOCreateDocumentationPageInputV2, DTOElementActionOutput } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class ElementsActionsEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
async createDocPage(dsId: string, vId: string, input: DTOCreateDocumentationPageInputV2) {
|
|
8
|
+
return this.requestExecutor.json(
|
|
9
|
+
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
10
|
+
DTOElementActionOutput,
|
|
11
|
+
{
|
|
12
|
+
body: {
|
|
13
|
+
type: "DocumentationPageCreate",
|
|
14
|
+
input,
|
|
15
|
+
},
|
|
16
|
+
method: "POST",
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
import { DTOCreateVersionInput } from "../../../payloads";
|
|
7
7
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
8
8
|
import { BrandsEndpoint } from "./brands";
|
|
9
|
+
import { DesignSystemComponentEndpoint } from "./components";
|
|
10
|
+
import { ElementsActionsEndpoint } from "./elements-actions";
|
|
9
11
|
import { ImportJobsEndpoint } from "./import-jobs";
|
|
10
12
|
import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
|
|
11
13
|
import { ElementPropertyValuesEndpoint } from "./property-values";
|
|
@@ -25,6 +27,8 @@ export class DesignSystemVersionsEndpoint {
|
|
|
25
27
|
readonly stats: VersionStatsEndpoint;
|
|
26
28
|
readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
|
|
27
29
|
readonly elementPropertyValues: ElementPropertyValuesEndpoint;
|
|
30
|
+
readonly elementsActions: ElementsActionsEndpoint;
|
|
31
|
+
readonly designSystemComponents: DesignSystemComponentEndpoint;
|
|
28
32
|
|
|
29
33
|
constructor(private readonly requestExecutor: RequestExecutor) {
|
|
30
34
|
this.themes = new ThemesEndpoint(requestExecutor);
|
|
@@ -36,6 +40,8 @@ export class DesignSystemVersionsEndpoint {
|
|
|
36
40
|
this.stats = new VersionStatsEndpoint(requestExecutor);
|
|
37
41
|
this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
|
|
38
42
|
this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
|
|
43
|
+
this.elementsActions = new ElementsActionsEndpoint(requestExecutor);
|
|
44
|
+
this.designSystemComponents = new DesignSystemComponentEndpoint(requestExecutor);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
list(dsId: string) {
|