@supernova-studio/supernova-sdk-beta 1.6.16 → 1.6.18

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.
@@ -1,4 +1,4 @@
1
- import { Brand } from "../../model/base/SDKBrand";
1
+ import { Component } from "../../model/components/SDKComponent";
2
2
  import { ElementProperty } from "../../model/elements/SDKElementProperty";
3
3
  import { TokenGroup } from "../../model/groups/SDKTokenGroup";
4
4
  import { TokenTheme } from "../../model/themes/SDKTokenTheme";
@@ -16,6 +16,15 @@ export type TokenUpdateTransactionData = {
16
16
  propertyValuesToDelete?: Array<string>;
17
17
  themesToUpdate?: Array<TokenTheme>;
18
18
  };
19
+ export type ComponentUpdateTransactionData = {
20
+ component: Component;
21
+ componentMode: "create" | "update";
22
+ propertyValuesToCreateOrUpdate?: Array<{
23
+ property: ElementProperty;
24
+ value: string | boolean | number;
25
+ }>;
26
+ propertyValuesToDelete?: Array<string>;
27
+ };
19
28
  export declare class AreaBulkOperations {
20
29
  /** Internal: Engine */
21
30
  private dataCore;
@@ -27,5 +36,13 @@ export declare class AreaBulkOperations {
27
36
  * @param data - Update information. All keys except token and its parent are optional and any combination of optional properties is allowed.
28
37
  * @returns Nothing
29
38
  */
30
- updateTokenData(to: RemoteVersionIdentifier, data: TokenUpdateTransactionData): Promise<Array<Brand>>;
39
+ updateTokenData(to: RemoteVersionIdentifier, data: TokenUpdateTransactionData): Promise<void>;
40
+ /** Batch updates, creates or deletes component data from Supernova at once. Use this method to perform multiple operations at once instead of chaining single update operations. Batch routine runs everything in a single transaction, so either all operations succeed or all fail.
41
+ *
42
+ * WARNING: This method is not yet complete and only supports limited set of operations. Also, doesn't work as transation just yet.
43
+ * @param to - Remote version to write to
44
+ * @param data - Update information. All keys except component and its parent are optional and any combination of optional properties is allowed.
45
+ * @returns Nothing
46
+ */
47
+ updateComponentData(to: RemoteVersionIdentifier, data: ComponentUpdateTransactionData): Promise<void>;
31
48
  }
@@ -53,7 +53,7 @@ export declare class AreaComponents {
53
53
  * @param parentId - Id of the group to add the component to. This is id of the group, not the versioned id
54
54
  * @returns New remote component ids
55
55
  */
56
- createComponent(to: RemoteVersionIdentifier, component: Component, parentId: string): Promise<{
56
+ createComponent(to: RemoteVersionIdentifier, component: Component): Promise<{
57
57
  id: string;
58
58
  idInVersion: string;
59
59
  }>;
@@ -67,7 +67,7 @@ export declare class AreaComponents {
67
67
  * @param parentId - Id of the group to add the group to. This is id of the group, not the versioned id
68
68
  * @returns New remote component group ids
69
69
  */
70
- createComponentGroup(to: RemoteVersionIdentifier, group: ComponentGroup, parentId: string): Promise<{
70
+ createComponentGroup(to: RemoteVersionIdentifier, group: ComponentGroup): Promise<{
71
71
  id: string;
72
72
  idInVersion: string;
73
73
  }>;
@@ -35,7 +35,7 @@ import { WorkspaceOnboarding, WorkspaceOnboardingUpdateModel } from "../../model
35
35
  import { SubscriptionProductFeatures } from "../../model/workspaces/SDKWorkspaceProductFeatures";
36
36
  import { WorkspaceProfileUpdateModel } from "../../model/workspaces/SDKWorkspaceProfile";
37
37
  import { WorkspaceSSOSettings, WorkspaceSSOSettingsUpdateModel } from "../../model/workspaces/SDKWorkspaceSSOSettings";
38
- import { TokenUpdateTransactionData } from "../areas/SDKAreaBulkOperations";
38
+ import { ComponentUpdateTransactionData, TokenUpdateTransactionData } from "../areas/SDKAreaBulkOperations";
39
39
  import { RenderedAssetRequestSettings } from "./requests/SDKDataCoreRenderRequests";
40
40
  import { DataBridge } from "./SDKDataBridge";
41
41
  export declare class DataCore {
@@ -147,21 +147,21 @@ export declare class DataCore {
147
147
  designComponents(designSystemId: string, versionId: string): Promise<Array<DesignComponent>>;
148
148
  designComponentGroups(designSystemId: string, versionId: string): Promise<Array<DesignComponentGroup>>;
149
149
  /** Write new component to remote */
150
- createComponent(designSystemId: string, versionId: string, component: Component, parentId: string): Promise<{
150
+ createComponent(designSystemId: string, versionId: string, component: Component): Promise<{
151
151
  id: string;
152
152
  idInVersion: string;
153
153
  }>;
154
154
  /** Update existing component in remote */
155
155
  updateComponent(designSystemId: string, versionId: string, component: Component): Promise<void>;
156
156
  /** Write new component group to remote */
157
- createComponentGroup(designSystemId: string, versionId: string, group: ComponentGroup, parentId: string): Promise<{
157
+ createComponentGroup(designSystemId: string, versionId: string, group: ComponentGroup): Promise<{
158
158
  id: string;
159
159
  idInVersion: string;
160
160
  }>;
161
161
  /** Update existing component group in remote */
162
162
  updateComponentGroup(designSystemId: string, versionId: string, group: ComponentGroup): Promise<void>;
163
163
  /** Update component property at remote */
164
- updateComponentPropertyValue(designSystemId: string, versionId: string, newValue: string | boolean, component: Component, property: ElementProperty): Promise<void>;
164
+ updateComponentPropertyValue(designSystemId: string, versionId: string, newValue: string | boolean | number, component: Component, property: ElementProperty): Promise<void>;
165
165
  /** Delete component property in remote */
166
166
  deleteComponentPropertyValue(designSystemId: string, versionId: string, valueId: string): Promise<void>;
167
167
  /** Create a custom property in remote */
@@ -256,6 +256,7 @@ export declare class DataCore {
256
256
  getBrand(designSystemId: string, versionId: string, brandId: string): Promise<Brand>;
257
257
  getOAuthURL(service: "figma" | "bitbucket" | "github" | "gitlab" | "azure"): Promise<string>;
258
258
  bulkUpdateTokenData(designSystemId: string, versionId: string, data: TokenUpdateTransactionData): Promise<any>;
259
+ bulkUpdateComponentData(designSystemId: string, versionId: string, data: ComponentUpdateTransactionData): Promise<any>;
259
260
  getTokenStudioData(designSystemId: string, versionId: string): Promise<object>;
260
261
  writeTokenStudioData(designSystemId: string, versionId: string, data: object): Promise<boolean>;
261
262
  }
@@ -1,6 +1,6 @@
1
1
  import { DocumentationEnvironment } from "../../../model/enums/SDKDocumentationEnvironment";
2
2
  import { ElementDataViewColumnType } from "../../../exports";
3
- import { Component, ComponentRemoteModel } from "../../../model/components/SDKComponent";
3
+ import { Component, ComponentRemoteModel, ComponentUpdateRemoteModel } from "../../../model/components/SDKComponent";
4
4
  import { ElementPropertyRemoteModel } from "../../../model/elements/SDKElementProperty";
5
5
  import { ComponentGroup, ComponentGroupRemoteModel } from "../../../model/groups/SDKComponentGroup";
6
6
  import { TokenGroup, TokenGroupRemoteModel } from "../../../model/groups/SDKTokenGroup";
@@ -74,13 +74,13 @@ export declare class DataCoreWriteRequests {
74
74
  updateReorderTokenColumn(designSystemId: string, versionId: string, viewId: string, columnId: string, newIndex: number): Promise<void>;
75
75
  updateResizeTokenColumn(designSystemId: string, versionId: string, viewId: string, columnType: ElementDataViewColumnType, columnId: string, columnThemeId: string | undefined, columnBasePropertyType: string | undefined, columnPropertyDefinitionId: string | undefined, newWidth: number): Promise<void>;
76
76
  createRemoteComponent(designSystemId: string, versionId: string, component: ComponentRemoteModel): Promise<ComponentRemoteModel>;
77
- updateRemoteComponent(designSystemId: string, versionId: string, component: ComponentRemoteModel): Promise<ComponentRemoteModel>;
77
+ updateRemoteComponent(designSystemId: string, versionId: string, component: ComponentUpdateRemoteModel): Promise<ComponentRemoteModel>;
78
78
  createRemoteComponentGroup(designSystemId: string, versionId: string, group: ComponentGroupRemoteModel): Promise<ComponentGroupRemoteModel>;
79
79
  updateRemoteComponentGroup(designSystemId: string, versionId: string, group: ComponentGroupRemoteModel): Promise<void>;
80
80
  deleteRemoteComponent(designSystemId: string, versionId: string, componentId: string): Promise<void>;
81
81
  ungroupRemoteComponentGroup(designSystemId: string, versionId: string, componentGroupId: string): Promise<void>;
82
82
  writeComponentData(designSystemId: string, versionId: string, components: Array<ComponentRemoteModel>, groups: Array<ComponentGroupRemoteModel>, deleteComponents: Array<Component>, deleteComponentGroups: Array<ComponentGroup>): Promise<void>;
83
- updateComponentPropertyValue(designSystemId: string, versionId: string, newValue: string | boolean, componentId: string, propertyId: string): Promise<void>;
83
+ updateComponentPropertyValue(designSystemId: string, versionId: string, newValue: string | boolean | number, componentId: string, propertyId: string): Promise<void>;
84
84
  deleteComponentPropertyValue(designSystemId: string, versionId: string, valueId: string): Promise<void>;
85
85
  createComponentProperty(designSystemId: string, versionId: string, model: object): Promise<ElementPropertyRemoteModel>;
86
86
  updateComponentProperty(designSystemId: string, versionId: string, propertyIdInVersion: string, model: object): Promise<void>;
@@ -3,7 +3,6 @@ import { ElementPropertyValue } from "../elements/values/SDKElementPropertyValue
3
3
  export type ComponentRemoteModel = {
4
4
  id: string;
5
5
  persistentId: string;
6
- designSystemVersionId: string;
7
6
  brandId: string;
8
7
  meta: {
9
8
  name: string;
@@ -13,6 +12,7 @@ export type ComponentRemoteModel = {
13
12
  updatedAt?: string;
14
13
  groupPersistentId?: string;
15
14
  };
15
+ export type ComponentUpdateRemoteModel = Omit<ComponentRemoteModel, "brandId">;
16
16
  export declare class Component {
17
17
  idInVersion: string;
18
18
  id: string;
@@ -21,9 +21,12 @@ export declare class Component {
21
21
  name: string;
22
22
  description: string;
23
23
  properties: Array<ElementProperty>;
24
- propertyValues: object;
24
+ propertyValues: {
25
+ [key: string]: string | boolean | number;
26
+ };
25
27
  createdAt: Date | null;
26
28
  updatedAt: Date | null;
27
29
  constructor(model: ComponentRemoteModel, properties: Array<ElementProperty>, propertyValues: Array<ElementPropertyValue>);
28
30
  toWriteObject(): ComponentRemoteModel;
31
+ toWriteUpdateObject(): ComponentUpdateRemoteModel;
29
32
  }