@supernova-studio/client 0.58.7 → 0.58.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.58.7",
3
+ "version": "0.58.9",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -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: DataSourceFigmaScope,
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 DTODataSourceCreationResponse = z.object({
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 DTODataSourceCreationResponse = z.infer<typeof DTODataSourceCreationResponse>;
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>;
@@ -1,10 +1,23 @@
1
1
  import { z } from "zod";
2
- import { DTODataSourcesListResponse } from "../../dto";
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
  }
@@ -0,0 +1,23 @@
1
+ import { DTODocumentationStructure, DTODocumentationStructureItem, DTOImportJobResponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+
4
+ export class DocumentationEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ getStructure(designSystemId: string, versionId: string) {
8
+ return this.requestExecutor.json(
9
+ `/design-systems/${designSystemId}/versions/${versionId}/documentation/structure`,
10
+ DTODocumentationStructure
11
+ );
12
+ }
13
+
14
+ async getDocStructure(dsId: string, vId: string) {
15
+ return await this.requestExecutor.json(
16
+ `/design-systems/${dsId}/versions/${vId}/documentation/structure`,
17
+ DTODocumentationStructure,
18
+ {
19
+ method: "GET",
20
+ }
21
+ );
22
+ }
23
+ }
@@ -0,0 +1,98 @@
1
+ import {
2
+ DTOCreateDocumentationGroupInput,
3
+ DTOCreateDocumentationPageInputV2,
4
+ DTOCreateDocumentationTabInput,
5
+ DTOElementActionOutput,
6
+ DTOMoveDocumentationGroupInput,
7
+ DTOUpdateDocumentationGroupInput,
8
+ DTOUpdateDocumentationPageInputV2,
9
+ } from "../../../dto";
10
+ import { RequestExecutor } from "../../../transport/request-executor";
11
+
12
+ export class ElementsActionEndpoint {
13
+ constructor(private readonly requestExecutor: RequestExecutor) {}
14
+
15
+ async createDocPage(dsId: string, vId: string, input: DTOCreateDocumentationPageInputV2) {
16
+ return this.requestExecutor.json(
17
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
18
+ DTOElementActionOutput,
19
+ {
20
+ body: {
21
+ type: "DocumentationPageCreate",
22
+ input,
23
+ },
24
+ method: "POST",
25
+ }
26
+ );
27
+ }
28
+
29
+ async createDocGroup(dsId: string, vId: string, input: DTOCreateDocumentationGroupInput) {
30
+ return this.requestExecutor.json(
31
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
32
+ DTOElementActionOutput,
33
+ {
34
+ body: {
35
+ type: "DocumentationGroupCreate",
36
+ input,
37
+ },
38
+ method: "POST",
39
+ }
40
+ );
41
+ }
42
+
43
+ async moveDocGroup(dsId: string, vId: string, input: DTOMoveDocumentationGroupInput) {
44
+ return this.requestExecutor.json(
45
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
46
+ DTOElementActionOutput,
47
+ {
48
+ body: {
49
+ type: "DocumentationGroupMove",
50
+ input,
51
+ },
52
+ method: "POST",
53
+ }
54
+ );
55
+ }
56
+
57
+ async updateDocPage(dsId: string, vId: string, input: DTOUpdateDocumentationPageInputV2) {
58
+ return this.requestExecutor.json(
59
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
60
+ DTOElementActionOutput,
61
+ {
62
+ body: {
63
+ type: "DocumentationPageUpdate",
64
+ input,
65
+ },
66
+ method: "POST",
67
+ }
68
+ );
69
+ }
70
+
71
+ async updateDocGroup(dsId: string, vId: string, input: DTOUpdateDocumentationGroupInput) {
72
+ return this.requestExecutor.json(
73
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
74
+ DTOElementActionOutput,
75
+ {
76
+ body: {
77
+ type: "DocumentationGroupUpdate",
78
+ input,
79
+ },
80
+ method: "POST",
81
+ }
82
+ );
83
+ }
84
+
85
+ async createDocTab(dsId: string, vId: string, input: DTOCreateDocumentationTabInput) {
86
+ return this.requestExecutor.json(
87
+ `/design-systems/${dsId}/versions/${vId}/elements-action`,
88
+ DTOElementActionOutput,
89
+ {
90
+ body: {
91
+ type: "DocumentationTabCreate",
92
+ input,
93
+ },
94
+ method: "POST",
95
+ }
96
+ );
97
+ }
98
+ }
@@ -1,6 +1,7 @@
1
1
  export * from "./brands";
2
2
  export * from "./components";
3
- export * from "./elements-actions";
3
+ export * from "./documentation";
4
+ export * from "./elements-action";
4
5
  export * from "./import-jobs";
5
6
  export * from "./overrides";
6
7
  export * from "./property-definitions";
@@ -7,7 +7,8 @@ import { DTOCreateVersionInput } from "../../../payloads";
7
7
  import { RequestExecutor } from "../../../transport/request-executor";
8
8
  import { BrandsEndpoint } from "./brands";
9
9
  import { DesignSystemComponentEndpoint } from "./components";
10
- import { ElementsActionsEndpoint } from "./elements-actions";
10
+ import { DocumentationEndpoint } from "./documentation";
11
+ import { ElementsActionEndpoint } from "./elements-action";
11
12
  import { ImportJobsEndpoint } from "./import-jobs";
12
13
  import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
13
14
  import { ElementPropertyValuesEndpoint } from "./property-values";
@@ -27,8 +28,9 @@ export class DesignSystemVersionsEndpoint {
27
28
  readonly stats: VersionStatsEndpoint;
28
29
  readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
29
30
  readonly elementPropertyValues: ElementPropertyValuesEndpoint;
30
- readonly elementsActions: ElementsActionsEndpoint;
31
+ readonly elementsAction: ElementsActionEndpoint;
31
32
  readonly designSystemComponents: DesignSystemComponentEndpoint;
33
+ readonly documentation: DocumentationEndpoint;
32
34
 
33
35
  constructor(private readonly requestExecutor: RequestExecutor) {
34
36
  this.themes = new ThemesEndpoint(requestExecutor);
@@ -40,8 +42,9 @@ export class DesignSystemVersionsEndpoint {
40
42
  this.stats = new VersionStatsEndpoint(requestExecutor);
41
43
  this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
42
44
  this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
43
- this.elementsActions = new ElementsActionsEndpoint(requestExecutor);
45
+ this.elementsAction = new ElementsActionEndpoint(requestExecutor);
44
46
  this.designSystemComponents = new DesignSystemComponentEndpoint(requestExecutor);
47
+ this.documentation = new DocumentationEndpoint(requestExecutor);
45
48
  }
46
49
 
47
50
  list(dsId: string) {
@@ -3,6 +3,7 @@ import { DTOWorkspaceCreateInput, DTOWorkspaceResponse } from "../../dto";
3
3
  import { RequestExecutor } from "../../transport/request-executor";
4
4
  import { WorkspaceInvitationsEndpoint } from "./workspace-invites";
5
5
  import { WorkspaceMembersEndpoint } from "./workspace-members";
6
+ import { DTOTransferOwnershipPayload } from "../../payloads";
6
7
 
7
8
  // TODO Response types
8
9
  export class WorkspacesEndpoint {
@@ -36,4 +37,11 @@ export class WorkspacesEndpoint {
36
37
  subscription(workspaceId: string) {
37
38
  return this.requestExecutor.json(`/workspaces/${workspaceId}/subscription`, z.any(), { method: "GET" });
38
39
  }
40
+
41
+ transferOwnership(workspaceId: string, body: DTOTransferOwnershipPayload) {
42
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/ownership`, DTOWorkspaceResponse, {
43
+ method: "PUT",
44
+ body,
45
+ });
46
+ }
39
47
  }
@@ -1,2 +1,3 @@
1
+ export * from "./transfer-ownership";
1
2
  export * from "./workspace-configuration";
2
3
  export * from "./workspace-integrations";
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+
3
+ export const DTOTransferOwnershipPayload = z.object({
4
+ newOwnerId: z.string(),
5
+ });
6
+
7
+ export type DTOTransferOwnershipPayload = z.infer<typeof DTOTransferOwnershipPayload>;
@@ -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
- }