@supernova-studio/client 0.57.8 → 0.57.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.57.8",
3
+ "version": "0.57.10",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -1 +1 @@
1
- export * from "./collection";
1
+ export * from "./token-collection";
@@ -1,4 +1,4 @@
1
- import { ObjectMeta } from "@supernova-studio/model";
1
+ import { CollectionOrigin, ColorTokenInlineData, ObjectMeta } from "@supernova-studio/model";
2
2
  import { z } from "zod";
3
3
 
4
4
  export const DTOTokenCollection = z.object({
@@ -7,14 +7,13 @@ export const DTOTokenCollection = z.object({
7
7
  designSystemVersionId: z.string(),
8
8
 
9
9
  meta: ObjectMeta,
10
+ backgroundColor: ColorTokenInlineData.optional(),
11
+ elementPropertyOptionId: z.string(),
10
12
 
11
13
  createdAt: z.coerce.date(),
12
14
  updatedAt: z.coerce.date(),
13
15
 
14
- origin: z.object({
15
- id: z.string(),
16
- sourceId: z.string(),
17
- }),
16
+ origin: CollectionOrigin.optional(),
18
17
  });
19
18
 
20
19
  export const DTOTokenCollectionsListReponse = z.object({
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import {
3
- DTOCreateElementPropertyDefinitionInputV2,
4
- DTODeleteElementPropertyDefinitionInputV2,
5
3
  DTOElementPropertyDefinition,
6
- DTOUpdateElementPropertyDefinitionInputV2,
4
+ DTOElementPropertyDefinitionCreatePayload,
5
+ DTOElementPropertyDefinitionDeletePayload,
6
+ DTOElementPropertyDefinitionUpdatePayload,
7
7
  } from "./property-definitions";
8
8
 
9
9
  // Outputs
@@ -35,17 +35,17 @@ export type DTOPropertyDefinitionDeleteActionOutputV2 = z.infer<typeof DTOProper
35
35
 
36
36
  export const DTOPropertyDefinitionCreateActionInputV2 = z.object({
37
37
  type: z.literal("PropertyDefinitionCreate"),
38
- input: DTOCreateElementPropertyDefinitionInputV2,
38
+ input: DTOElementPropertyDefinitionCreatePayload,
39
39
  });
40
40
 
41
41
  export const DTOPropertyDefinitionUpdateActionInputV2 = z.object({
42
42
  type: z.literal("PropertyDefinitionUpdate"),
43
- input: DTOUpdateElementPropertyDefinitionInputV2,
43
+ input: DTOElementPropertyDefinitionUpdatePayload,
44
44
  });
45
45
 
46
46
  export const DTOPropertyDefinitionDeleteActionInputV2 = z.object({
47
47
  type: z.literal("PropertyDefinitionDelete"),
48
- input: DTODeleteElementPropertyDefinitionInputV2,
48
+ input: DTOElementPropertyDefinitionDeletePayload,
49
49
  });
50
50
 
51
51
  export type DTOPropertyDefinitionCreateActionInputV2 = z.infer<typeof DTOPropertyDefinitionCreateActionInputV2>;
@@ -3,6 +3,7 @@ import {
3
3
  ElementPropertyLinkType,
4
4
  ElementPropertyTargetType,
5
5
  ElementPropertyTypeSchema,
6
+ nullishToOptional,
6
7
  ObjectMeta,
7
8
  } from "@supernova-studio/model";
8
9
  import { z } from "zod";
@@ -18,8 +19,8 @@ export const DTOElementPropertyDefinition = z.object({
18
19
  type: ElementPropertyTypeSchema,
19
20
  targetElementType: ElementPropertyTargetType,
20
21
  codeName: z.string().regex(CODE_NAME_REGEX),
21
- options: z.array(ElementPropertyDefinitionOption).optional(),
22
- linkElementType: ElementPropertyLinkType.optional(),
22
+ options: nullishToOptional(z.array(ElementPropertyDefinitionOption)),
23
+ linkElementType: nullishToOptional(ElementPropertyLinkType),
23
24
  });
24
25
 
25
26
  export type DTOElementPropertyDefinition = z.infer<typeof DTOElementPropertyDefinition>;
@@ -28,24 +29,27 @@ export type DTOElementPropertyDefinition = z.infer<typeof DTOElementPropertyDefi
28
29
  // Read
29
30
  //
30
31
 
31
- export const DTOElementPropertyDefinitionsGetResponse = z.object({
32
+ export const DTOElementPropertyDefinitionListResponse = z.object({
32
33
  definitions: z.array(DTOElementPropertyDefinition),
33
34
  });
34
35
 
35
- export type DTOElementPropertyDefinitionsGetResponse = z.infer<typeof DTOElementPropertyDefinitionsGetResponse>;
36
+ export const DTOElementPropertyDefinitionResponse = z.object({
37
+ definition: DTOElementPropertyDefinition,
38
+ });
39
+
40
+ export type DTOElementPropertyDefinitionListResponse = z.infer<typeof DTOElementPropertyDefinitionListResponse>;
41
+ export type DTOElementPropertyDefinitionResponse = z.infer<typeof DTOElementPropertyDefinitionResponse>;
36
42
 
37
43
  //
38
44
  // Write
39
45
  //
40
46
 
41
- export const DTOCreateElementPropertyDefinitionInputV2 = DTOElementPropertyDefinition.omit({
47
+ export const DTOElementPropertyDefinitionCreatePayload = DTOElementPropertyDefinition.omit({
42
48
  id: true,
43
49
  designSystemVersionId: true,
44
50
  });
45
51
 
46
- export type DTOCreateElementPropertyDefinitionInputV2 = z.infer<typeof DTOCreateElementPropertyDefinitionInputV2>;
47
-
48
- export const DTOUpdateElementPropertyDefinitionInputV2 = z.object({
52
+ export const DTOElementPropertyDefinitionUpdatePayload = z.object({
49
53
  id: z.string(),
50
54
  name: z.string().optional(),
51
55
  description: z.string().optional(),
@@ -53,10 +57,10 @@ export const DTOUpdateElementPropertyDefinitionInputV2 = z.object({
53
57
  options: z.array(ElementPropertyDefinitionOption).optional(),
54
58
  });
55
59
 
56
- export type DTOUpdateElementPropertyDefinitionInputV2 = z.infer<typeof DTOUpdateElementPropertyDefinitionInputV2>;
57
-
58
- export const DTODeleteElementPropertyDefinitionInputV2 = z.object({
60
+ export const DTOElementPropertyDefinitionDeletePayload = z.object({
59
61
  id: z.string(),
60
62
  });
61
63
 
62
- export type DTODeleteElementPropertyDefinitionInputV2 = z.infer<typeof DTODeleteElementPropertyDefinitionInputV2>;
64
+ export type DTOElementPropertyDefinitionCreatePayload = z.infer<typeof DTOElementPropertyDefinitionCreatePayload>;
65
+ export type DTOElementPropertyDefinitionUpdatePayload = z.infer<typeof DTOElementPropertyDefinitionUpdatePayload>;
66
+ export type DTOElementPropertyDefinitionDeletePayload = z.infer<typeof DTOElementPropertyDefinitionDeletePayload>;
@@ -5,7 +5,7 @@ import { RequestExecutor } from "../../transport/request-executor";
5
5
  import { DesignSystemBffEndpoint } from "./bff";
6
6
  import { DesignSystemMembersEndpoint } from "./members";
7
7
  import { DesignSystemSourcesEndpoint } from "./sources";
8
- import { DesignSystemVersionsEndpoint } from "./versions";
8
+ import { DesignSystemVersionsEndpoint } from "./versions/versions";
9
9
 
10
10
  export class DesignSystemsEndpoint {
11
11
  readonly members: DesignSystemMembersEndpoint;
@@ -3,4 +3,3 @@ export * from "./bff";
3
3
  export * from "./design-systems";
4
4
  export * from "./members";
5
5
  export * from "./sources";
6
- export * from "./versions";
@@ -1,6 +1,9 @@
1
1
  export * from "./brands";
2
2
  export * from "./import-jobs";
3
3
  export * from "./overrides";
4
+ export * from "./property-definitions";
4
5
  export * from "./stats";
5
6
  export * from "./themes";
7
+ export * from "./token-collections";
6
8
  export * from "./tokens";
9
+ export * from "./versions";
@@ -0,0 +1,25 @@
1
+ import {
2
+ DTOElementPropertyDefinitionCreatePayload,
3
+ DTOElementPropertyDefinitionListResponse,
4
+ DTOElementPropertyDefinitionResponse,
5
+ } from "../../../dto";
6
+ import { RequestExecutor } from "../../../transport/request-executor";
7
+
8
+ export class ElementPropertyDefinitionsEndpoint {
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/definitions`,
14
+ DTOElementPropertyDefinitionListResponse
15
+ );
16
+ }
17
+
18
+ create(designSystemId: string, versionId: string, body: DTOElementPropertyDefinitionCreatePayload) {
19
+ return this.requestExecutor.json(
20
+ `/design-systems/${designSystemId}/versions/${versionId}/element-properties/definitions`,
21
+ DTOElementPropertyDefinitionResponse,
22
+ { method: "POST", body }
23
+ );
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ import { DTOTokenCollectionsListReponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+
4
+ export class TokenCollectionsEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ list(designSystemId: string, versionId: string) {
8
+ return this.requestExecutor.json(
9
+ `/design-systems/${designSystemId}/versions/${versionId}/token-collections`,
10
+ DTOTokenCollectionsListReponse
11
+ );
12
+ }
13
+ }
@@ -0,0 +1,33 @@
1
+ import { DTODesignSystemVersionsListResponse } from "../../../dto";
2
+ import { RequestExecutor } from "../../../transport/request-executor";
3
+ import { BrandsEndpoint } from "./brands";
4
+ import { ImportJobsEndpoint } from "./import-jobs";
5
+ import { ElementPropertyDefinitionsEndpoint } from "./property-definitions";
6
+ import { VersionStatsEndpoint } from "./stats";
7
+ import { ThemesEndpoint } from "./themes";
8
+ import { TokenCollectionsEndpoint } from "./token-collections";
9
+ import { TokensEndpoint } from "./tokens";
10
+
11
+ export class DesignSystemVersionsEndpoint {
12
+ readonly themes: ThemesEndpoint;
13
+ readonly brands: BrandsEndpoint;
14
+ readonly tokenCollections: TokenCollectionsEndpoint;
15
+ readonly importJobs: ImportJobsEndpoint;
16
+ readonly tokens: TokensEndpoint;
17
+ readonly stats: VersionStatsEndpoint;
18
+ readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
19
+
20
+ constructor(private readonly requestExecutor: RequestExecutor) {
21
+ this.themes = new ThemesEndpoint(requestExecutor);
22
+ this.brands = new BrandsEndpoint(requestExecutor);
23
+ this.tokenCollections = new TokenCollectionsEndpoint(requestExecutor);
24
+ this.importJobs = new ImportJobsEndpoint(requestExecutor);
25
+ this.tokens = new TokensEndpoint(requestExecutor);
26
+ this.stats = new VersionStatsEndpoint(requestExecutor);
27
+ this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
28
+ }
29
+
30
+ list(dsId: string) {
31
+ return this.requestExecutor.json(`/design-systems/${dsId}/versions`, DTODesignSystemVersionsListResponse);
32
+ }
33
+ }
@@ -1,5 +1,4 @@
1
1
  export * from "./codegen";
2
2
  export * from "./design-system";
3
3
  export * from "./workspaces";
4
- export * from "./token-collections";
5
4
  export * from "./users";
@@ -1,27 +0,0 @@
1
- import { DTODesignSystemVersionsListResponse } from "../../dto";
2
- import { RequestExecutor } from "../../transport/request-executor";
3
- import { BrandsEndpoint } from "./versions/brands";
4
- import { ImportJobsEndpoint } from "./versions/import-jobs";
5
- import { VersionStatsEndpoint } from "./versions/stats";
6
- import { ThemesEndpoint } from "./versions/themes";
7
- import { TokensEndpoint } from "./versions/tokens";
8
-
9
- export class DesignSystemVersionsEndpoint {
10
- readonly themes: ThemesEndpoint;
11
- readonly brands: BrandsEndpoint;
12
- readonly importJobs: ImportJobsEndpoint;
13
- readonly tokens: TokensEndpoint;
14
- readonly stats: VersionStatsEndpoint;
15
-
16
- constructor(private readonly requestExecutor: RequestExecutor) {
17
- this.themes = new ThemesEndpoint(requestExecutor);
18
- this.brands = new BrandsEndpoint(requestExecutor);
19
- this.importJobs = new ImportJobsEndpoint(requestExecutor);
20
- this.tokens = new TokensEndpoint(requestExecutor);
21
- this.stats = new VersionStatsEndpoint(requestExecutor);
22
- }
23
-
24
- list(dsId: string) {
25
- return this.requestExecutor.json(`/design-systems/${dsId}/versions`, DTODesignSystemVersionsListResponse);
26
- }
27
- }
@@ -1,13 +0,0 @@
1
- import { DTOTokenCollectionsListReponse } from "../dto";
2
- import { RequestExecutor } from "../transport/request-executor";
3
-
4
- export class TokenCollectionsEndpoint {
5
- constructor(private readonly requestExecutor: RequestExecutor) {}
6
-
7
- list(dsId: string, vId: string) {
8
- return this.requestExecutor.json(
9
- `/design-systems/${dsId}/versions/${vId}/token-collections`,
10
- DTOTokenCollectionsListReponse
11
- );
12
- }
13
- }