@supernova-studio/client 0.58.8 → 0.58.10
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 +2484 -290
- package/dist/index.d.ts +2484 -290
- package/dist/index.js +314 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +745 -536
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-systems/data-source.ts +28 -3
- package/src/api/dto/design-systems/index.ts +0 -1
- package/src/api/dto/elements/components/figma-component-group.ts +19 -0
- package/src/api/dto/elements/components/index.ts +1 -0
- package/src/api/dto/elements/frame-node-structures/frame-node-structure.ts +17 -0
- package/src/api/dto/elements/frame-node-structures/index.ts +1 -0
- package/src/api/dto/elements/index.ts +1 -0
- package/src/api/dto/export/exporter-property.ts +95 -0
- package/src/api/dto/export/exporter.ts +2 -0
- package/src/api/dto/export/index.ts +1 -0
- package/src/api/dto/export/job.ts +3 -0
- package/src/api/dto/export/pipeline.ts +3 -0
- package/src/api/endpoints/codegen/exporters.ts +2 -7
- package/src/api/endpoints/design-system/sources.ts +21 -1
- package/src/api/endpoints/design-system/versions/elements-action.ts +17 -62
- package/src/api/endpoints/design-system/versions/elements.ts +13 -0
- package/src/api/endpoints/design-system/versions/figma-component-groups.ts +13 -0
- package/src/api/endpoints/design-system/versions/figma-components.ts +13 -0
- package/src/api/endpoints/design-system/versions/figma-frame-structures.ts +13 -0
- package/src/api/endpoints/design-system/versions/index.ts +5 -2
- package/src/api/endpoints/design-system/versions/versions.ts +16 -4
- package/src/api/payloads/export/pipeline.ts +3 -0
- package/src/api/transport/request-executor.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/query.ts +18 -0
- package/src/api/dto/design-systems/exporter-property.ts +0 -8
- package/src/api/endpoints/design-system/versions/elements-actions.ts +0 -20
- /package/src/api/endpoints/design-system/versions/{components.ts → ds-components.ts} +0 -0
package/package.json
CHANGED
|
@@ -10,6 +10,12 @@ import {
|
|
|
10
10
|
} from "@supernova-studio/model";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
+
//
|
|
14
|
+
// Read
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
export const DTODataSourceFigmaScope = DataSourceFigmaScope;
|
|
18
|
+
|
|
13
19
|
const DTODataSourceFigmaFileVersion = z.object({
|
|
14
20
|
id: z.string(),
|
|
15
21
|
created_at: z.coerce.date(),
|
|
@@ -36,7 +42,7 @@ export const DTODataSourceFigma = z.object({
|
|
|
36
42
|
id: z.string(),
|
|
37
43
|
type: z.literal(DataSourceRemoteType.Enum.Figma),
|
|
38
44
|
fileName: z.string(),
|
|
39
|
-
scope:
|
|
45
|
+
scope: DTODataSourceFigmaScope,
|
|
40
46
|
brandId: z.string(),
|
|
41
47
|
themeId: z.string().nullish(),
|
|
42
48
|
cloud: DTODataSourceFigmaCloud.nullish(),
|
|
@@ -104,7 +110,7 @@ export const DTODataSourcesListResponse = z.object({
|
|
|
104
110
|
sources: z.array(DTODataSource),
|
|
105
111
|
});
|
|
106
112
|
|
|
107
|
-
export const
|
|
113
|
+
export const DTODataSourceResponse = z.object({
|
|
108
114
|
source: DTODataSource,
|
|
109
115
|
});
|
|
110
116
|
|
|
@@ -112,5 +118,24 @@ export type DTODataSourceFigma = z.infer<typeof DTODataSourceFigma>;
|
|
|
112
118
|
export type DTODataSourceTokenStudio = z.infer<typeof DTODataSourceTokenStudio>;
|
|
113
119
|
export type DTODataSourceFigmaVariablesPlugin = z.infer<typeof DTODataSourceFigmaVariablesPlugin>;
|
|
114
120
|
export type DTODataSource = z.infer<typeof DTODataSource>;
|
|
115
|
-
export type
|
|
121
|
+
export type DTODataSourceResponse = z.infer<typeof DTODataSourceResponse>;
|
|
116
122
|
export type DTODataSourcesListResponse = z.infer<typeof DTODataSourcesListResponse>;
|
|
123
|
+
|
|
124
|
+
//
|
|
125
|
+
// Write
|
|
126
|
+
//
|
|
127
|
+
|
|
128
|
+
export const DTODataSourceFigmaCreatePayload = z.object({
|
|
129
|
+
brandPersistentId: z.string(),
|
|
130
|
+
figmaFileUrl: z.string(),
|
|
131
|
+
scope: DTODataSourceFigmaScope,
|
|
132
|
+
autoImportMode: DataSourceAutoImportMode,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export const DTODataSourceFigmaImportPayload = z.object({
|
|
136
|
+
sourceIds: z.array(z.string()),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export type DTODataSourceFigmaScope = z.infer<typeof DTODataSourceFigmaScope>;
|
|
140
|
+
export type DTODataSourceFigmaCreatePayload = z.infer<typeof DTODataSourceFigmaCreatePayload>;
|
|
141
|
+
export type DTODataSourceFigmaImportPayload = z.infer<typeof DTODataSourceFigmaImportPayload>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { DTOObjectMeta } from "../../aux/meta";
|
|
3
|
+
|
|
4
|
+
export const DTOFigmaComponentGroup = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
designSystemVersionId: z.string(),
|
|
7
|
+
persistentId: z.string(),
|
|
8
|
+
isRoot: z.boolean(),
|
|
9
|
+
brandId: z.string(),
|
|
10
|
+
meta: DTOObjectMeta,
|
|
11
|
+
childrenIds: z.string().array(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const DTOFigmaComponentGroupListResponse = z.object({
|
|
15
|
+
groups: DTOFigmaComponentGroup.array(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type DTOFigmaComponentGroup = z.infer<typeof DTOFigmaComponentGroup>;
|
|
19
|
+
export type DTOFigmaComponentGroupListResponse = z.infer<typeof DTOFigmaComponentGroupListResponse>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FigmaFileStructureOrigin, FigmaFileStructureStatistics } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const DTOFrameNodeStructure = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
persistentId: z.string(),
|
|
7
|
+
designSystemVersionId: z.string(),
|
|
8
|
+
origin: FigmaFileStructureOrigin,
|
|
9
|
+
assetsInFile: FigmaFileStructureStatistics,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const DTOFrameNodeStructureListResponse = z.object({
|
|
13
|
+
structures: DTOFrameNodeStructure.array(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type DTOFrameNodeStructure = z.infer<typeof DTOFrameNodeStructure>;
|
|
17
|
+
export type DTOFrameNodeStructureListResponse = z.infer<typeof DTOFrameNodeStructureListResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./frame-node-structure";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
// Primitives
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
const PrimitiveValue = z.number().or(z.boolean()).or(z.string());
|
|
8
|
+
const ArrayValue = z.array(z.string());
|
|
9
|
+
const ObjectValue = z.record(z.string());
|
|
10
|
+
|
|
11
|
+
export const DTOExporterPropertyDefinitionValue = PrimitiveValue.or(ArrayValue).or(ObjectValue);
|
|
12
|
+
export const DTOExporterPropertyType = z.enum(["Enum", "Boolean", "String", "Number", "Array", "Object"]);
|
|
13
|
+
|
|
14
|
+
export type DTOExporterPropertyDefinitionValue = z.infer<typeof DTOExporterPropertyDefinitionValue>;
|
|
15
|
+
export type DTOExporterPropertyType = z.infer<typeof DTOExporterPropertyType>;
|
|
16
|
+
|
|
17
|
+
//
|
|
18
|
+
// Property
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
const PropertyDefinitionBase = z.object({
|
|
22
|
+
key: z.string(),
|
|
23
|
+
title: z.string(),
|
|
24
|
+
description: z.string(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const DTOExporterPropertyDefinitionEnum = PropertyDefinitionBase.extend({
|
|
28
|
+
type: z.literal(DTOExporterPropertyType.Enum.Enum),
|
|
29
|
+
options: z.string().array(),
|
|
30
|
+
default: z.string(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const DTOExporterPropertyDefinitionBoolean = PropertyDefinitionBase.extend({
|
|
34
|
+
type: z.literal(DTOExporterPropertyType.Enum.Boolean),
|
|
35
|
+
default: z.boolean(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const DTOExporterPropertyDefinitionString = PropertyDefinitionBase.extend({
|
|
39
|
+
type: z.literal(DTOExporterPropertyType.Enum.String),
|
|
40
|
+
default: z.string(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const DTOExporterPropertyDefinitionNumber = PropertyDefinitionBase.extend({
|
|
44
|
+
type: z.literal(DTOExporterPropertyType.Enum.Number),
|
|
45
|
+
default: z.number(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const DTOExporterPropertyDefinitionArray = PropertyDefinitionBase.extend({
|
|
49
|
+
type: z.literal(DTOExporterPropertyType.Enum.Array),
|
|
50
|
+
default: ArrayValue,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const DTOExporterPropertyDefinitionObject = PropertyDefinitionBase.extend({
|
|
54
|
+
type: z.literal(DTOExporterPropertyType.Enum.Object),
|
|
55
|
+
default: ObjectValue,
|
|
56
|
+
allowedKeys: z
|
|
57
|
+
.object({
|
|
58
|
+
options: z.string().array(),
|
|
59
|
+
})
|
|
60
|
+
.optional(),
|
|
61
|
+
allowedValues: z
|
|
62
|
+
.object({
|
|
63
|
+
options: z.string().array(),
|
|
64
|
+
})
|
|
65
|
+
.optional(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const DTOExporterPropertyDefinition = z.discriminatedUnion("type", [
|
|
69
|
+
DTOExporterPropertyDefinitionEnum,
|
|
70
|
+
DTOExporterPropertyDefinitionBoolean,
|
|
71
|
+
DTOExporterPropertyDefinitionString,
|
|
72
|
+
DTOExporterPropertyDefinitionNumber,
|
|
73
|
+
DTOExporterPropertyDefinitionArray,
|
|
74
|
+
DTOExporterPropertyDefinitionObject,
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
export const DTOExporterPropertyDefinitionsResponse = z.object({
|
|
78
|
+
properties: DTOExporterPropertyDefinition.array(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export type DTOExporterPropertyDefinitionEnum = z.infer<typeof DTOExporterPropertyDefinitionEnum>;
|
|
82
|
+
export type DTOExporterPropertyDefinitionBoolean = z.infer<typeof DTOExporterPropertyDefinitionBoolean>;
|
|
83
|
+
export type DTOExporterPropertyDefinitionString = z.infer<typeof DTOExporterPropertyDefinitionString>;
|
|
84
|
+
export type DTOExporterPropertyDefinitionNumber = z.infer<typeof DTOExporterPropertyDefinitionNumber>;
|
|
85
|
+
export type DTOExporterPropertyDefinitionArray = z.infer<typeof DTOExporterPropertyDefinitionArray>;
|
|
86
|
+
export type DTOExporterPropertyDefinitionObject = z.infer<typeof DTOExporterPropertyDefinitionObject>;
|
|
87
|
+
export type DTOExporterPropertyDefinition = z.infer<typeof DTOExporterPropertyDefinition>;
|
|
88
|
+
export type DTOExporterPropertyDefinitionsResponse = z.infer<typeof DTOExporterPropertyDefinitionsResponse>;
|
|
89
|
+
|
|
90
|
+
//
|
|
91
|
+
// Value
|
|
92
|
+
//
|
|
93
|
+
|
|
94
|
+
export const DTOExporterPropertyDefinitionValueMap = z.record(DTOExporterPropertyDefinitionValue);
|
|
95
|
+
export type DTOExporterPropertyDefinitionValueMap = z.infer<typeof DTOExporterPropertyDefinitionValueMap>;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PulsarCustomBlock,
|
|
6
6
|
} from "@supernova-studio/model";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
import { DTOExporterPropertyDefinition } from "./exporter-property";
|
|
8
9
|
|
|
9
10
|
//
|
|
10
11
|
// Read
|
|
@@ -27,6 +28,7 @@ export const DTOExporter = z.object({
|
|
|
27
28
|
|
|
28
29
|
iconURL: z.string().optional(),
|
|
29
30
|
configurationProperties: PulsarContributionConfigurationProperty.array(),
|
|
31
|
+
properties: DTOExporterPropertyDefinition.array().optional(),
|
|
30
32
|
customBlocks: PulsarCustomBlock.array(),
|
|
31
33
|
blockVariants: z.record(z.string(), PulsarContributionVariant.array()),
|
|
32
34
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ObjectMeta,
|
|
12
12
|
} from "@supernova-studio/model";
|
|
13
13
|
import { z } from "zod";
|
|
14
|
+
import { DTOExporterPropertyDefinitionValueMap } from "./exporter-property";
|
|
14
15
|
|
|
15
16
|
export const DTOExportJobCreatedBy = z.object({
|
|
16
17
|
userId: z.string(),
|
|
@@ -69,6 +70,8 @@ export const DTOExportJob = z.object({
|
|
|
69
70
|
brandPersistentId: z.string().optional(),
|
|
70
71
|
themePersistentId: z.string().optional(),
|
|
71
72
|
themePersistentIds: z.string().array().optional(),
|
|
73
|
+
|
|
74
|
+
exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
72
75
|
});
|
|
73
76
|
|
|
74
77
|
export const DTOExportJobResponse = z.object({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExportDestinationsMap, PipelineEventType } from "@supernova-studio/model";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { DTOExporterPropertyDefinitionValueMap } from "./exporter-property";
|
|
3
4
|
import { DTOExportJob } from "./job";
|
|
4
5
|
|
|
5
6
|
export const DTOPipelineListQuery = z.object({
|
|
@@ -21,6 +22,8 @@ export const DTOPipeline = z.object({
|
|
|
21
22
|
themePersistentId: z.string().optional(),
|
|
22
23
|
themePersistentIds: z.string().array().optional(),
|
|
23
24
|
|
|
25
|
+
exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
26
|
+
|
|
24
27
|
...ExportDestinationsMap.shape,
|
|
25
28
|
|
|
26
29
|
latestJobs: DTOExportJob.array(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serializeQuery } from "../../../utils";
|
|
1
2
|
import { DTOExporterListQuery, DTOExporterListResponse } from "../../dto";
|
|
2
3
|
import { RequestExecutor } from "../../transport";
|
|
3
4
|
|
|
@@ -5,14 +6,8 @@ export class ExportersEndpoint {
|
|
|
5
6
|
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
7
|
|
|
7
8
|
list(workspaceId: string, query: DTOExporterListQuery) {
|
|
8
|
-
const queryWithStrings = Object.fromEntries(
|
|
9
|
-
Object.entries(query)
|
|
10
|
-
.filter(e => !!e[1])
|
|
11
|
-
.map(([k, v]) => [k, v.toString()])
|
|
12
|
-
);
|
|
13
|
-
|
|
14
9
|
return this.requestExecutor.json(`/codegen/workspaces/${workspaceId}/exporters`, DTOExporterListResponse, {
|
|
15
|
-
query:
|
|
10
|
+
query: serializeQuery(query),
|
|
16
11
|
});
|
|
17
12
|
}
|
|
18
13
|
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DTODataSourceFigmaCreatePayload,
|
|
4
|
+
DTODataSourceFigmaImportPayload,
|
|
5
|
+
DTODataSourceResponse,
|
|
6
|
+
DTODataSourcesListResponse,
|
|
7
|
+
DTOImportJobResponse,
|
|
8
|
+
} from "../../dto";
|
|
3
9
|
import { RequestExecutor } from "../../transport/request-executor";
|
|
4
10
|
|
|
5
11
|
export class DesignSystemSourcesEndpoint {
|
|
6
12
|
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
7
13
|
|
|
14
|
+
create(dsId: string, payload: DTODataSourceFigmaCreatePayload) {
|
|
15
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/sources`, DTODataSourceResponse, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: payload,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
list(dsId: string) {
|
|
9
22
|
return this.requestExecutor.json(`/design-systems/${dsId}/sources`, DTODataSourcesListResponse);
|
|
10
23
|
}
|
|
@@ -12,4 +25,11 @@ export class DesignSystemSourcesEndpoint {
|
|
|
12
25
|
delete(dsId: string, sourceId: string) {
|
|
13
26
|
return this.requestExecutor.json(`/design-systems/${dsId}/sources/${sourceId}`, z.any(), { method: "DELETE" });
|
|
14
27
|
}
|
|
28
|
+
|
|
29
|
+
figmaImport(dsId: string, payload: DTODataSourceFigmaImportPayload) {
|
|
30
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions/head/cloud-import`, DTOImportJobResponse, {
|
|
31
|
+
method: "POST",
|
|
32
|
+
body: payload,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
15
35
|
}
|
|
@@ -2,97 +2,52 @@ import {
|
|
|
2
2
|
DTOCreateDocumentationGroupInput,
|
|
3
3
|
DTOCreateDocumentationPageInputV2,
|
|
4
4
|
DTOCreateDocumentationTabInput,
|
|
5
|
-
|
|
6
|
-
DTODocumentationStructureItem,
|
|
5
|
+
DTOElementActionInput,
|
|
7
6
|
DTOElementActionOutput,
|
|
7
|
+
DTOFigmaNodeRenderInput,
|
|
8
8
|
DTOMoveDocumentationGroupInput,
|
|
9
9
|
DTOUpdateDocumentationGroupInput,
|
|
10
10
|
DTOUpdateDocumentationPageInputV2,
|
|
11
11
|
} from "../../../dto";
|
|
12
12
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
13
13
|
|
|
14
|
-
export class
|
|
14
|
+
export class ElementsActionEndpoint {
|
|
15
15
|
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
16
16
|
|
|
17
17
|
async createDocPage(dsId: string, vId: string, input: DTOCreateDocumentationPageInputV2) {
|
|
18
|
-
return this.
|
|
19
|
-
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
20
|
-
DTOElementActionOutput,
|
|
21
|
-
{
|
|
22
|
-
body: {
|
|
23
|
-
type: "DocumentationPageCreate",
|
|
24
|
-
input,
|
|
25
|
-
},
|
|
26
|
-
method: "POST",
|
|
27
|
-
}
|
|
28
|
-
);
|
|
18
|
+
return this.action(dsId, vId, { type: "DocumentationPageCreate", input });
|
|
29
19
|
}
|
|
30
20
|
|
|
31
21
|
async createDocGroup(dsId: string, vId: string, input: DTOCreateDocumentationGroupInput) {
|
|
32
|
-
return this.
|
|
33
|
-
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
34
|
-
DTOElementActionOutput,
|
|
35
|
-
{
|
|
36
|
-
body: {
|
|
37
|
-
type: "DocumentationGroupCreate",
|
|
38
|
-
input,
|
|
39
|
-
},
|
|
40
|
-
method: "POST",
|
|
41
|
-
}
|
|
42
|
-
);
|
|
22
|
+
return this.action(dsId, vId, { type: "DocumentationGroupCreate", input });
|
|
43
23
|
}
|
|
44
24
|
|
|
45
25
|
async moveDocGroup(dsId: string, vId: string, input: DTOMoveDocumentationGroupInput) {
|
|
46
|
-
return this.
|
|
47
|
-
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
48
|
-
DTOElementActionOutput,
|
|
49
|
-
{
|
|
50
|
-
body: {
|
|
51
|
-
type: "DocumentationGroupMove",
|
|
52
|
-
input,
|
|
53
|
-
},
|
|
54
|
-
method: "POST",
|
|
55
|
-
}
|
|
56
|
-
);
|
|
26
|
+
return this.action(dsId, vId, { type: "DocumentationGroupMove", input });
|
|
57
27
|
}
|
|
58
28
|
|
|
59
29
|
async updateDocPage(dsId: string, vId: string, input: DTOUpdateDocumentationPageInputV2) {
|
|
60
|
-
return this.
|
|
61
|
-
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
62
|
-
DTOElementActionOutput,
|
|
63
|
-
{
|
|
64
|
-
body: {
|
|
65
|
-
type: "DocumentationPageUpdate",
|
|
66
|
-
input,
|
|
67
|
-
},
|
|
68
|
-
method: "POST",
|
|
69
|
-
}
|
|
70
|
-
);
|
|
30
|
+
return this.action(dsId, vId, { type: "DocumentationPageUpdate", input });
|
|
71
31
|
}
|
|
72
32
|
|
|
73
33
|
async updateDocGroup(dsId: string, vId: string, input: DTOUpdateDocumentationGroupInput) {
|
|
74
|
-
return this.
|
|
75
|
-
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
76
|
-
DTOElementActionOutput,
|
|
77
|
-
{
|
|
78
|
-
body: {
|
|
79
|
-
type: "DocumentationGroupUpdate",
|
|
80
|
-
input,
|
|
81
|
-
},
|
|
82
|
-
method: "POST",
|
|
83
|
-
}
|
|
84
|
-
);
|
|
34
|
+
return this.action(dsId, vId, { type: "DocumentationGroupUpdate", input });
|
|
85
35
|
}
|
|
86
36
|
|
|
87
37
|
async createDocTab(dsId: string, vId: string, input: DTOCreateDocumentationTabInput) {
|
|
38
|
+
return this.action(dsId, vId, { type: "DocumentationTabCreate", input });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async renderNodes(dsId: string, vId: string, input: DTOFigmaNodeRenderInput[]) {
|
|
42
|
+
return this.action(dsId, vId, { type: "FigmaNodeRender", input });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private async action(dsId: string, vId: string, input: DTOElementActionInput) {
|
|
88
46
|
return this.requestExecutor.json(
|
|
89
47
|
`/design-systems/${dsId}/versions/${vId}/elements-action`,
|
|
90
48
|
DTOElementActionOutput,
|
|
91
49
|
{
|
|
92
|
-
body:
|
|
93
|
-
type: "DocumentationTabCreate",
|
|
94
|
-
input,
|
|
95
|
-
},
|
|
50
|
+
body: input,
|
|
96
51
|
method: "POST",
|
|
97
52
|
}
|
|
98
53
|
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { serializeQuery } from "../../../../utils";
|
|
2
|
+
import { DTOElementsGetOutput, DTOElementsGetQueryParsed } from "../../../dto";
|
|
3
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
4
|
+
|
|
5
|
+
export class ElementsEndpoint {
|
|
6
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
7
|
+
|
|
8
|
+
getElements(dsId: string, vId: string, query: DTOElementsGetQueryParsed) {
|
|
9
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/versions/${vId}/elements`, DTOElementsGetOutput, {
|
|
10
|
+
query: serializeQuery(query),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DTOFigmaComponentGroupListResponse } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class FigmaComponentGroupsEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
async list(dsId: string, vId: string) {
|
|
8
|
+
return this.requestExecutor.json(
|
|
9
|
+
`/design-systems/${dsId}/versions/${vId}/component-groups`,
|
|
10
|
+
DTOFigmaComponentGroupListResponse
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DTOFigmaComponentListResponse } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class FigmaComponentsEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
async list(dsId: string, vId: string) {
|
|
8
|
+
return this.requestExecutor.json(
|
|
9
|
+
`/design-systems/${dsId}/versions/${vId}/components`,
|
|
10
|
+
DTOFigmaComponentListResponse
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DTOFrameNodeStructureListResponse } from "../../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class FigmaFrameStructuresEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
list(dsId: string, vId: string) {
|
|
8
|
+
return this.requestExecutor.json(
|
|
9
|
+
`/design-systems/${dsId}/versions/${vId}/figma-frames/node-structures`,
|
|
10
|
+
DTOFrameNodeStructureListResponse
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from "./brands";
|
|
2
|
-
export * from "./components";
|
|
3
2
|
export * from "./documentation";
|
|
3
|
+
export * from "./ds-components";
|
|
4
4
|
export * from "./elements-action";
|
|
5
|
-
export * from "./elements
|
|
5
|
+
export * from "./elements";
|
|
6
|
+
export * from "./figma-component-groups";
|
|
7
|
+
export * from "./figma-components";
|
|
8
|
+
export * from "./figma-frame-structures";
|
|
6
9
|
export * from "./import-jobs";
|
|
7
10
|
export * from "./overrides";
|
|
8
11
|
export * from "./property-definitions";
|
|
@@ -6,9 +6,13 @@ 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
9
|
import { DocumentationEndpoint } from "./documentation";
|
|
11
|
-
import {
|
|
10
|
+
import { DesignSystemComponentEndpoint } from "./ds-components";
|
|
11
|
+
import { ElementsEndpoint } from "./elements";
|
|
12
|
+
import { ElementsActionEndpoint } from "./elements-action";
|
|
13
|
+
import { FigmaComponentGroupsEndpoint } from "./figma-component-groups";
|
|
14
|
+
import { FigmaComponentsEndpoint } from "./figma-components";
|
|
15
|
+
import { FigmaFrameStructuresEndpoint } from "./figma-frame-structures";
|
|
12
16
|
import { ImportJobsEndpoint } from "./import-jobs";
|
|
13
17
|
import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
|
|
14
18
|
import { ElementPropertyValuesEndpoint } from "./property-values";
|
|
@@ -25,10 +29,14 @@ export class DesignSystemVersionsEndpoint {
|
|
|
25
29
|
readonly importJobs: ImportJobsEndpoint;
|
|
26
30
|
readonly tokens: TokensEndpoint;
|
|
27
31
|
readonly tokenGroups: TokenGroupsEndpoint;
|
|
32
|
+
readonly figmaComponents: FigmaComponentsEndpoint;
|
|
33
|
+
readonly figmaComponentGroups: FigmaComponentGroupsEndpoint;
|
|
34
|
+
readonly figmaFrameStructures: FigmaFrameStructuresEndpoint;
|
|
28
35
|
readonly stats: VersionStatsEndpoint;
|
|
29
36
|
readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
|
|
30
37
|
readonly elementPropertyValues: ElementPropertyValuesEndpoint;
|
|
31
|
-
readonly
|
|
38
|
+
readonly elementsAction: ElementsActionEndpoint;
|
|
39
|
+
readonly elements: ElementsEndpoint;
|
|
32
40
|
readonly designSystemComponents: DesignSystemComponentEndpoint;
|
|
33
41
|
readonly documentation: DocumentationEndpoint;
|
|
34
42
|
|
|
@@ -39,10 +47,14 @@ export class DesignSystemVersionsEndpoint {
|
|
|
39
47
|
this.importJobs = new ImportJobsEndpoint(requestExecutor);
|
|
40
48
|
this.tokens = new TokensEndpoint(requestExecutor);
|
|
41
49
|
this.tokenGroups = new TokenGroupsEndpoint(requestExecutor);
|
|
50
|
+
this.figmaComponents = new FigmaComponentsEndpoint(requestExecutor);
|
|
51
|
+
this.figmaComponentGroups = new FigmaComponentGroupsEndpoint(requestExecutor);
|
|
52
|
+
this.figmaFrameStructures = new FigmaFrameStructuresEndpoint(requestExecutor);
|
|
42
53
|
this.stats = new VersionStatsEndpoint(requestExecutor);
|
|
43
54
|
this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
|
|
44
55
|
this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
|
|
45
|
-
this.
|
|
56
|
+
this.elementsAction = new ElementsActionEndpoint(requestExecutor);
|
|
57
|
+
this.elements = new ElementsEndpoint(requestExecutor);
|
|
46
58
|
this.designSystemComponents = new DesignSystemComponentEndpoint(requestExecutor);
|
|
47
59
|
this.documentation = new DocumentationEndpoint(requestExecutor);
|
|
48
60
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
PipelineEventType,
|
|
11
11
|
} from "@supernova-studio/model";
|
|
12
12
|
import { z } from "zod";
|
|
13
|
+
import { DTOExporterPropertyDefinitionValueMap } from "../../dto/export/exporter-property";
|
|
13
14
|
|
|
14
15
|
export const DTOPipelineCreateBody = z.object({
|
|
15
16
|
name: z.string(),
|
|
@@ -21,6 +22,8 @@ export const DTOPipelineCreateBody = z.object({
|
|
|
21
22
|
themePersistentId: z.string().optional(),
|
|
22
23
|
themePersistentIds: z.string().array().optional(),
|
|
23
24
|
|
|
25
|
+
exporterConfiguration: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
26
|
+
|
|
24
27
|
destination: PipelineDestinationType.optional(),
|
|
25
28
|
gitQuery: GitObjectsQuery,
|
|
26
29
|
destinations: z.object({
|
|
@@ -68,6 +68,8 @@ export class RequestExecutor {
|
|
|
68
68
|
|
|
69
69
|
const responseParseResult = schema.safeParse(wrapperParseResult.data.result);
|
|
70
70
|
if (!responseParseResult.success) {
|
|
71
|
+
console.error(`Response was:`);
|
|
72
|
+
console.error(wrapperParseResult.data.result);
|
|
71
73
|
throw RequestExecutorError.responseParsingError(endpoint, responseParseResult.error);
|
|
72
74
|
}
|
|
73
75
|
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type CompatibleValue = number | string | boolean | undefined;
|
|
2
|
+
type QueryObject = Record<string, CompatibleValue | CompatibleValue[]>;
|
|
3
|
+
|
|
4
|
+
export function serializeQuery(query: QueryObject): URLSearchParams {
|
|
5
|
+
const queryWithStrings = Object.fromEntries(
|
|
6
|
+
Object.entries(query)
|
|
7
|
+
.filter(e => !!e[1])
|
|
8
|
+
.map(([k, v]) => {
|
|
9
|
+
if (Array.isArray(v)) {
|
|
10
|
+
return [k, v.join(", ")];
|
|
11
|
+
} else {
|
|
12
|
+
return [k, v!.toString()];
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return new URLSearchParams(queryWithStrings);
|
|
18
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const DTOExporterProperty = z.any({});
|
|
4
|
-
|
|
5
|
-
export const DTOExporterPropertyListResponse = z.object({ items: z.array(DTOExporterProperty) });
|
|
6
|
-
|
|
7
|
-
export type DTOExporterProperty = z.infer<typeof DTOExporterProperty>;
|
|
8
|
-
export type DTOExporterPropertyListResponse = z.infer<typeof DTOExporterPropertyListResponse>;
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
File without changes
|