@supernova-studio/client 0.57.10 → 0.57.12

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.57.10",
3
+ "version": "0.57.12",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,9 @@
1
1
  import { z } from "zod";
2
2
 
3
+ //
4
+ // Read
5
+ //
6
+
3
7
  export const DTOElementPropertyValue = z.object({
4
8
  id: z.string(),
5
9
  designSystemVersionId: z.string(),
@@ -9,9 +13,26 @@ export const DTOElementPropertyValue = z.object({
9
13
  valuePreview: z.string().optional(),
10
14
  });
11
15
 
12
- export const DTOElementPropertyValuesGetResponse = z.object({
16
+ export const DTOElementPropertyValueListResponse = z.object({
13
17
  values: z.array(DTOElementPropertyValue),
14
18
  });
15
19
 
20
+ export const DTOElementPropertyValueResponse = z.object({
21
+ value: DTOElementPropertyValue,
22
+ });
23
+
16
24
  export type DTOElementPropertyValue = z.infer<typeof DTOElementPropertyValue>;
17
- export type DTOElementPropertyValuesGetResponse = z.infer<typeof DTOElementPropertyValuesGetResponse>;
25
+ export type DTOElementPropertyValueListResponse = z.infer<typeof DTOElementPropertyValueListResponse>;
26
+ export type DTOElementPropertyValueResponse = z.infer<typeof DTOElementPropertyValueResponse>;
27
+
28
+ //
29
+ // Create
30
+ //
31
+
32
+ export const DTOElementPropertyValueUpsertPaylod = z.object({
33
+ definitionId: z.string(),
34
+ targetElementId: z.string(),
35
+ value: z.string().or(z.number()).or(z.boolean()),
36
+ });
37
+
38
+ export type DTOElementPropertyValueUpsertPaylod = z.infer<typeof DTOElementPropertyValueUpsertPaylod>;
@@ -2,6 +2,7 @@ export * from "./brands";
2
2
  export * from "./import-jobs";
3
3
  export * from "./overrides";
4
4
  export * from "./property-definitions";
5
+ export * from "./property-values";
5
6
  export * from "./stats";
6
7
  export * from "./themes";
7
8
  export * from "./token-collections";
@@ -0,0 +1,25 @@
1
+ import {
2
+ DTOElementPropertyValueListResponse,
3
+ DTOElementPropertyValueResponse,
4
+ DTOElementPropertyValueUpsertPaylod,
5
+ } from "../../../dto";
6
+ import { RequestExecutor } from "../../../transport/request-executor";
7
+
8
+ export class ElementPropertyValuesEndpoint {
9
+ constructor(private readonly requestExecutor: RequestExecutor) {}
10
+
11
+ list(designSystemId: string, versionId: string) {
12
+ return this.requestExecutor.json(
13
+ `/design-systems/${designSystemId}/versions/${versionId}/element-properties/values`,
14
+ DTOElementPropertyValueListResponse
15
+ );
16
+ }
17
+
18
+ upsert(designSystemId: string, versionId: string, body: DTOElementPropertyValueUpsertPaylod) {
19
+ return this.requestExecutor.json(
20
+ `/design-systems/${designSystemId}/versions/${versionId}/element-properties/values`,
21
+ DTOElementPropertyValueResponse,
22
+ { method: "POST", body }
23
+ );
24
+ }
25
+ }
@@ -3,6 +3,7 @@ import { RequestExecutor } from "../../../transport/request-executor";
3
3
  import { BrandsEndpoint } from "./brands";
4
4
  import { ImportJobsEndpoint } from "./import-jobs";
5
5
  import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
6
+ import { ElementPropertyValuesEndpoint } from "./property-values";
6
7
  import { VersionStatsEndpoint } from "./stats";
7
8
  import { ThemesEndpoint } from "./themes";
8
9
  import { TokenCollectionsEndpoint } from "./token-collections";
@@ -16,6 +17,7 @@ export class DesignSystemVersionsEndpoint {
16
17
  readonly tokens: TokensEndpoint;
17
18
  readonly stats: VersionStatsEndpoint;
18
19
  readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
20
+ readonly elementPropertyValues: ElementPropertyValuesEndpoint;
19
21
 
20
22
  constructor(private readonly requestExecutor: RequestExecutor) {
21
23
  this.themes = new ThemesEndpoint(requestExecutor);
@@ -25,6 +27,7 @@ export class DesignSystemVersionsEndpoint {
25
27
  this.tokens = new TokensEndpoint(requestExecutor);
26
28
  this.stats = new VersionStatsEndpoint(requestExecutor);
27
29
  this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
30
+ this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);
28
31
  }
29
32
 
30
33
  list(dsId: string) {