@supernova-studio/client 0.57.16 → 0.57.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.57.16",
3
+ "version": "0.57.18",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ import { DTOUser } from "../users";
3
+
4
+ export const DTODesignSystemContactsResponse = z.object({
5
+ contacts: z.object({
6
+ workspace: z.array(DTOUser),
7
+ designSystem: z.array(DTOUser),
8
+ }),
9
+ });
10
+
11
+ export type DTODesignSystemContactsResponse = z.infer<typeof DTODesignSystemContactsResponse>;
@@ -1,4 +1,5 @@
1
1
  export * from "./brand";
2
+ export * from "./contact";
2
3
  export * from "./data-source";
3
4
  export * from "./design-system";
4
5
  export * from "./elements-diff";
@@ -1,4 +1,4 @@
1
- import { DesignTokenOrigin, DesignTokenTypedData, ObjectMeta } from "@supernova-studio/model";
1
+ import { DesignTokenOrigin, DesignTokenType, DesignTokenTypedData, ObjectMeta } from "@supernova-studio/model";
2
2
  import { z } from "zod";
3
3
 
4
4
  //
@@ -26,10 +26,32 @@ export const DTODesignTokenResponse = z.object({
26
26
  token: DTODesignToken,
27
27
  });
28
28
 
29
+ export const DTODesignTokenGroup = z.object({
30
+ id: z.string(),
31
+ tokenType: DesignTokenType,
32
+ persistentId: z.string(),
33
+ isRoot: z.boolean(),
34
+ brandId: z.string(),
35
+ meta: ObjectMeta,
36
+ childrenIds: z.string().array(),
37
+ });
38
+
39
+ export const DTODesignTokenGroupListResponse = z.object({
40
+ groups: DTODesignTokenGroup.array(),
41
+ });
42
+
43
+ export const DTODesignTokenGroupResponse = z.object({
44
+ group: DTODesignTokenGroup,
45
+ });
46
+
29
47
  export type DTODesignToken = z.infer<typeof DTODesignToken>;
30
48
  export type DTODesignTokenResponse = z.infer<typeof DTODesignTokenResponse>;
31
49
  export type DTODesignTokenListResponse = z.infer<typeof DTODesignTokenListResponse>;
32
50
 
51
+ export type DTODesignTokenGroup = z.infer<typeof DTODesignTokenGroup>;
52
+ export type DTODesignTokenGroupListResponse = z.infer<typeof DTODesignTokenGroupListResponse>;
53
+ export type DTODesignTokenGroupResponse = z.infer<typeof DTODesignTokenGroupResponse>;
54
+
33
55
  //
34
56
  // Write
35
57
  //
@@ -43,4 +65,14 @@ export const DTODesignTokenCreatePayload = DesignTokenTypedData.and(
43
65
  })
44
66
  );
45
67
 
68
+ export const DTODesignTokenGroupCreatePayload = z.object({
69
+ persistentId: z.string(),
70
+ meta: ObjectMeta,
71
+ brandId: z.string(),
72
+ parentId: z.string().optional(),
73
+ tokenType: DesignTokenType,
74
+ childrenIds: z.string().array(),
75
+ });
76
+
46
77
  export type DTODesignTokenCreatePayload = z.infer<typeof DTODesignTokenCreatePayload>;
78
+ export type DTODesignTokenGroupCreatePayload = z.infer<typeof DTODesignTokenGroupCreatePayload>;
@@ -0,0 +1,12 @@
1
+ import { DTODesignSystemContactsResponse } from "../../dto";
2
+ import { RequestExecutor } from "../../transport/request-executor";
3
+
4
+ export class DesignSystemContactsEndpoint {
5
+ constructor(private readonly requestExecutor: RequestExecutor) {}
6
+
7
+ list(dsId: string) {
8
+ return this.requestExecutor.json(`/design-systems/${dsId}/contacts`, DTODesignSystemContactsResponse, {
9
+ method: "GET",
10
+ });
11
+ }
12
+ }
@@ -6,18 +6,21 @@ import { DesignSystemBffEndpoint } from "./bff";
6
6
  import { DesignSystemMembersEndpoint } from "./members";
7
7
  import { DesignSystemSourcesEndpoint } from "./sources";
8
8
  import { DesignSystemVersionsEndpoint } from "./versions/versions";
9
+ import { DesignSystemContactsEndpoint } from "./contact";
9
10
 
10
11
  export class DesignSystemsEndpoint {
11
12
  readonly members: DesignSystemMembersEndpoint;
12
13
  readonly versions: DesignSystemVersionsEndpoint;
13
14
  readonly bff: DesignSystemBffEndpoint;
14
15
  readonly sources: DesignSystemSourcesEndpoint;
16
+ readonly contacts: DesignSystemContactsEndpoint;
15
17
 
16
18
  constructor(private readonly requestExecutor: RequestExecutor) {
17
19
  this.members = new DesignSystemMembersEndpoint(requestExecutor);
18
20
  this.versions = new DesignSystemVersionsEndpoint(requestExecutor);
19
21
  this.bff = new DesignSystemBffEndpoint(requestExecutor);
20
22
  this.sources = new DesignSystemSourcesEndpoint(requestExecutor);
23
+ this.contacts = new DesignSystemContactsEndpoint(requestExecutor);
21
24
  }
22
25
 
23
26
  create(body: DTODesignSystemCreateInput) {
@@ -1,5 +1,6 @@
1
1
  export * from "./versions";
2
2
  export * from "./bff";
3
+ export * from "./contact";
3
4
  export * from "./design-systems";
4
5
  export * from "./members";
5
6
  export * from "./sources";
@@ -6,5 +6,6 @@ export * from "./property-values";
6
6
  export * from "./stats";
7
7
  export * from "./themes";
8
8
  export * from "./token-collections";
9
+ export * from "./token-groups";
9
10
  export * from "./tokens";
10
11
  export * from "./versions";
@@ -0,0 +1,28 @@
1
+ import {
2
+ DTODesignTokenGroupCreatePayload,
3
+ DTODesignTokenGroupListResponse,
4
+ DTODesignTokenGroupResponse,
5
+ } from "../../../dto";
6
+ import { RequestExecutor } from "../../../transport/request-executor";
7
+
8
+ export class TokenGroupsEndpoint {
9
+ constructor(private readonly requestExecutor: RequestExecutor) {}
10
+
11
+ create(dsId: string, versionId: string, body: DTODesignTokenGroupCreatePayload) {
12
+ return this.requestExecutor.json(
13
+ `/design-systems/${dsId}/versions/${versionId}/token-groups`,
14
+ DTODesignTokenGroupResponse,
15
+ {
16
+ method: "POST",
17
+ body,
18
+ }
19
+ );
20
+ }
21
+
22
+ list(dsId: string, versionId: string): Promise<DTODesignTokenGroupListResponse> {
23
+ return this.requestExecutor.json(
24
+ `/design-systems/${dsId}/versions/${versionId}/token-groups`,
25
+ DTODesignTokenGroupListResponse
26
+ );
27
+ }
28
+ }
@@ -7,6 +7,7 @@ import { ElementPropertyValuesEndpoint } from "./property-values";
7
7
  import { VersionStatsEndpoint } from "./stats";
8
8
  import { ThemesEndpoint } from "./themes";
9
9
  import { TokenCollectionsEndpoint } from "./token-collections";
10
+ import { TokenGroupsEndpoint } from "./token-groups";
10
11
  import { TokensEndpoint } from "./tokens";
11
12
 
12
13
  export class DesignSystemVersionsEndpoint {
@@ -15,6 +16,7 @@ export class DesignSystemVersionsEndpoint {
15
16
  readonly tokenCollections: TokenCollectionsEndpoint;
16
17
  readonly importJobs: ImportJobsEndpoint;
17
18
  readonly tokens: TokensEndpoint;
19
+ readonly tokenGroups: TokenGroupsEndpoint;
18
20
  readonly stats: VersionStatsEndpoint;
19
21
  readonly elementPropertyDefinitions: ElementPropertyDefinitionsEndpoint;
20
22
  readonly elementPropertyValues: ElementPropertyValuesEndpoint;
@@ -25,6 +27,7 @@ export class DesignSystemVersionsEndpoint {
25
27
  this.tokenCollections = new TokenCollectionsEndpoint(requestExecutor);
26
28
  this.importJobs = new ImportJobsEndpoint(requestExecutor);
27
29
  this.tokens = new TokensEndpoint(requestExecutor);
30
+ this.tokenGroups = new TokenGroupsEndpoint(requestExecutor);
28
31
  this.stats = new VersionStatsEndpoint(requestExecutor);
29
32
  this.elementPropertyDefinitions = new ElementPropertyDefinitionsEndpoint(requestExecutor);
30
33
  this.elementPropertyValues = new ElementPropertyValuesEndpoint(requestExecutor);