@supernova-studio/client 0.54.25 → 0.54.27

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.54.25",
3
+ "version": "0.54.27",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@ export const DTODesignSystem = DesignSystem.omit({
16
16
  role: WorkspaceRoleSchema.optional(),
17
17
  });
18
18
 
19
- export const DTODesignSystemCreateResponse = z.object({
19
+ export const DTODesignSystemResponse = z.object({
20
20
  designSystem: DTODesignSystem,
21
21
  });
22
22
 
@@ -25,7 +25,7 @@ export const DTODesignSystemsListResponse = z.object({
25
25
  });
26
26
 
27
27
  export type DTODesignSystem = z.infer<typeof DTODesignSystem>;
28
- export type DTODesignSystemCreateResponse = z.infer<typeof DTODesignSystemCreateResponse>;
28
+ export type DTODesignSystemResponse = z.infer<typeof DTODesignSystemResponse>;
29
29
  export type DTODesignSystemsListResponse = z.infer<typeof DTODesignSystemsListResponse>;
30
30
 
31
31
  //
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { DTOWorkspace } from "./workspace";
2
+ import { DTOWorkspace, DTOWorkspaceResponse } from "./workspace";
3
3
 
4
4
  //
5
5
  // Read
@@ -23,9 +23,9 @@ export const DTOWorkspaceCreateInput = z.object({
23
23
  name: z.string(),
24
24
  });
25
25
 
26
- export const DTOWorkspaceCreateResponse = z.object({
26
+ export const DTOWorkspaceResponse = z.object({
27
27
  workspace: DTOWorkspace,
28
28
  });
29
29
 
30
30
  export type DTOWorkspaceCreateInput = z.infer<typeof DTOWorkspaceCreateInput>;
31
- export type DTOWorkspaceCreateResponse = z.infer<typeof DTOWorkspaceCreateResponse>;
31
+ export type DTOWorkspaceResponse = z.infer<typeof DTOWorkspaceResponse>;
@@ -0,0 +1,24 @@
1
+ import {
2
+ DTODesignSystemMemberListResponse,
3
+ DTODesignSystemMembersUpdatePayload,
4
+ DTODesignSystemMembersUpdateResponse,
5
+ DTOUserGetResponse,
6
+ } from "../dto";
7
+ import { RequestExecutor } from "../transport/request-executor";
8
+
9
+ export class DesignSystemMembersEndpoint {
10
+ constructor(private readonly requestExecutor: RequestExecutor) {}
11
+
12
+ list(dsId: string) {
13
+ return this.requestExecutor.json(`/design-systems/${dsId}/members`, DTODesignSystemMemberListResponse, {
14
+ method: "GET",
15
+ });
16
+ }
17
+
18
+ update(dsId: string, body: DTODesignSystemMembersUpdatePayload) {
19
+ return this.requestExecutor.json(`/design-systems/${dsId}/members`, DTODesignSystemMembersUpdateResponse, {
20
+ method: "POST",
21
+ body,
22
+ });
23
+ }
24
+ }
@@ -1,18 +1,17 @@
1
1
  import { z } from "zod";
2
- import {
3
- DTODesignSystemCreateInput,
4
- DTODesignSystemCreateResponse,
5
- DTODesignSystemMembersUpdatePayload,
6
- DTODesignSystemMembersUpdateResponse,
7
- DTODesignSystemsListResponse,
8
- } from "../dto";
2
+ import { DTODesignSystemCreateInput, DTODesignSystemResponse, DTODesignSystemsListResponse } from "../dto";
3
+ import { DTODesignSystemUpdateInput } from "../payloads";
9
4
  import { RequestExecutor } from "../transport/request-executor";
5
+ import { DesignSystemMembersEndpoint } from "./design-system-members";
10
6
 
11
7
  export class DesignSystemsEndpoint {
12
- constructor(private readonly requestExecutor: RequestExecutor) {}
8
+ members: DesignSystemMembersEndpoint;
9
+ constructor(private readonly requestExecutor: RequestExecutor) {
10
+ this.members = new DesignSystemMembersEndpoint(requestExecutor);
11
+ }
13
12
 
14
13
  create(body: DTODesignSystemCreateInput) {
15
- return this.requestExecutor.json("/design-systems", DTODesignSystemCreateResponse, { method: "POST", body });
14
+ return this.requestExecutor.json("/design-systems", DTODesignSystemResponse, { method: "POST", body });
16
15
  }
17
16
 
18
17
  list(wsId: string) {
@@ -27,9 +26,9 @@ export class DesignSystemsEndpoint {
27
26
  return this.requestExecutor.json(`/design-systems/${dsId}`, z.any(), { method: "DELETE" });
28
27
  }
29
28
 
30
- editMembers(dsId: string, body: DTODesignSystemMembersUpdatePayload) {
31
- return this.requestExecutor.json(`/design-systems/${dsId}/members`, DTODesignSystemMembersUpdateResponse, {
32
- method: "POST",
29
+ update(dsId: string, body: DTODesignSystemUpdateInput) {
30
+ return this.requestExecutor.json(`/design-systems/${dsId}`, DTODesignSystemResponse, {
31
+ method: "PUT",
33
32
  body,
34
33
  });
35
34
  }
@@ -1,3 +1,5 @@
1
+ export * from "./design-system-members";
1
2
  export * from "./design-systems";
2
3
  export * from "./users";
4
+ export * from "./workspace-members";
3
5
  export * from "./workspaces";
@@ -0,0 +1,31 @@
1
+ import { UpdateMembershipRolesInput } from "@supernova-studio/model";
2
+ import { z } from "zod";
3
+ import { DTOUserWorkspaceMembershipsResponse, DTOWorkspaceInvitationsListInput, DTOWorkspaceResponse } from "../dto";
4
+ import { RequestExecutor } from "../transport";
5
+
6
+ export class WorkspaceMembersEndpoint {
7
+ constructor(private readonly requestExecutor: RequestExecutor) {}
8
+
9
+ list(workspaceId: string) {
10
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/members`, DTOUserWorkspaceMembershipsResponse, {
11
+ method: "GET",
12
+ });
13
+ }
14
+
15
+ update(workspaceId: string, body: UpdateMembershipRolesInput) {
16
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/members/role`, DTOWorkspaceResponse, {
17
+ method: "PUT",
18
+ body,
19
+ });
20
+ }
21
+
22
+ invite(workspaceId: string, body: DTOWorkspaceInvitationsListInput) {
23
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/members`, z.any(), { method: "POST", body });
24
+ }
25
+
26
+ delete(workspaceId: string, userId: string) {
27
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/members/${userId}`, DTOWorkspaceResponse, {
28
+ method: "DELETE",
29
+ });
30
+ }
31
+ }
@@ -1,12 +1,18 @@
1
1
  import { z } from "zod";
2
- import { DTOWorkspaceCreateInput, DTOWorkspaceCreateResponse, DTOWorkspaceInvitationsListInput } from "../dto";
2
+ import { DTOWorkspaceCreateInput, DTOWorkspaceResponse } from "../dto";
3
3
  import { RequestExecutor } from "../transport/request-executor";
4
+ import { WorkspaceMembersEndpoint } from "./workspace-members";
4
5
 
6
+ // TODO Response types
5
7
  export class WorkspacesEndpoint {
6
- constructor(private readonly requestExecutor: RequestExecutor) {}
8
+ public members: WorkspaceMembersEndpoint;
9
+
10
+ constructor(private readonly requestExecutor: RequestExecutor) {
11
+ this.members = new WorkspaceMembersEndpoint(requestExecutor);
12
+ }
7
13
 
8
14
  create(body: DTOWorkspaceCreateInput) {
9
- return this.requestExecutor.json("/workspaces", DTOWorkspaceCreateResponse, {
15
+ return this.requestExecutor.json("/workspaces", DTOWorkspaceResponse, {
10
16
  method: "POST",
11
17
  body: {
12
18
  ...body,
@@ -20,7 +26,7 @@ export class WorkspacesEndpoint {
20
26
  return this.requestExecutor.json(`/workspaces/${workspaceId}`, z.any(), { method: "DELETE" });
21
27
  }
22
28
 
23
- invite(workspaceId: string, body: DTOWorkspaceInvitationsListInput) {
24
- return this.requestExecutor.json(`/workspaces/${workspaceId}/members`, z.any(), { method: "POST", body });
29
+ subscription(workspaceId: string) {
30
+ return this.requestExecutor.json(`/workspaces/${workspaceId}/subscription`, z.any(), { method: "GET" });
25
31
  }
26
32
  }