@supernova-studio/model 0.55.25 → 0.55.26
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/dist/index.d.mts +29079 -29050
- package/dist/index.d.ts +29079 -29050
- package/dist/index.js +353 -329
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +823 -799
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/membership/additions.ts +13 -0
- package/src/dsm/membership/design-system-membership.ts +9 -10
- package/src/dsm/membership/ds-role.ts +28 -0
- package/src/dsm/membership/index.ts +2 -0
- package/src/dsm/membership/invitations.ts +9 -1
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkspaceInvitation, WorkspaceMembership } from "../../workspace";
|
|
2
|
+
import { CreateDesignSystemMembership } from "./design-system-membership";
|
|
3
|
+
import { CreateDesignSystemInvitation } from "./invitations";
|
|
4
|
+
|
|
5
|
+
export type DesignSystemMembershipAddition = {
|
|
6
|
+
workspaceMembership: WorkspaceMembership;
|
|
7
|
+
designSystemMembership: CreateDesignSystemMembership;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type DesignSystemInvitationAddition = {
|
|
11
|
+
workspaceInvitation: WorkspaceInvitation;
|
|
12
|
+
designSystemInvitation: CreateDesignSystemInvitation;
|
|
13
|
+
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DbCreateInputOmit } from "../../helpers";
|
|
3
|
-
import {
|
|
2
|
+
import { DbCreateInputOmit, DbUpdate } from "../../helpers";
|
|
3
|
+
import { OmitStrict } from "../../utils";
|
|
4
|
+
import { WorkspaceRoleSchema } from "../../workspace";
|
|
5
|
+
import { DesignSystemRole } from "./ds-role";
|
|
4
6
|
import { DesignSystemInvitation } from "./invitations";
|
|
5
7
|
|
|
6
|
-
export const DesignSystemRole = z.enum([
|
|
7
|
-
WorkspaceRole.Admin,
|
|
8
|
-
WorkspaceRole.Contributor,
|
|
9
|
-
WorkspaceRole.Creator,
|
|
10
|
-
WorkspaceRole.Viewer,
|
|
11
|
-
]);
|
|
12
|
-
|
|
13
8
|
export const DesignSystemMembership = z.object({
|
|
14
9
|
id: z.string(),
|
|
15
10
|
userId: z.string(),
|
|
16
11
|
designSystemId: z.string(),
|
|
12
|
+
designSystemRole: DesignSystemRole.optional(),
|
|
17
13
|
workspaceMembershipId: z.string(),
|
|
18
14
|
});
|
|
19
15
|
|
|
20
16
|
export type DesignSystemMembership = z.infer<typeof DesignSystemMembership>;
|
|
21
17
|
|
|
22
18
|
export type CreateDesignSystemMembership = DbCreateInputOmit<DesignSystemMembership>;
|
|
19
|
+
export type UpdateDesignSystemMembership = OmitStrict<
|
|
20
|
+
DbUpdate<DesignSystemMembership>,
|
|
21
|
+
"designSystemId" | "userId" | "workspaceMembershipId"
|
|
22
|
+
>;
|
|
23
23
|
|
|
24
24
|
export const DesignSystemMembers = z.object({
|
|
25
25
|
members: DesignSystemMembership.array(),
|
|
@@ -82,7 +82,6 @@ export const DesignSystemMembershipUpdates = z.object({
|
|
|
82
82
|
deleteInvitationIds: z.string().array().optional(),
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
export type DesignSystemRole = z.infer<typeof DesignSystemRole>;
|
|
86
85
|
export type DesignSystemMembers = z.infer<typeof DesignSystemMembers>;
|
|
87
86
|
export type DesignSystemInvite = z.infer<typeof DesignSystemInvite>;
|
|
88
87
|
export type DesignSystemMemberUpdate = z.infer<typeof DesignSystemMemberUpdate>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WorkspaceRole } from "../../workspace";
|
|
3
|
+
import { SupernovaException } from "../../utils";
|
|
4
|
+
|
|
5
|
+
export const DesignSystemRole = z.enum([
|
|
6
|
+
WorkspaceRole.Admin,
|
|
7
|
+
WorkspaceRole.Contributor,
|
|
8
|
+
WorkspaceRole.Creator,
|
|
9
|
+
WorkspaceRole.Viewer,
|
|
10
|
+
]);
|
|
11
|
+
export type DesignSystemRole = z.infer<typeof DesignSystemRole>;
|
|
12
|
+
|
|
13
|
+
export function workspaceRoleToDesignSystemRole(role: WorkspaceRole): DesignSystemRole {
|
|
14
|
+
switch (role) {
|
|
15
|
+
case "Owner":
|
|
16
|
+
case "Admin":
|
|
17
|
+
return "Admin";
|
|
18
|
+
case "Creator":
|
|
19
|
+
return "Creator";
|
|
20
|
+
case "Contributor":
|
|
21
|
+
return "Contributor";
|
|
22
|
+
case "Billing":
|
|
23
|
+
case "Viewer":
|
|
24
|
+
return "Viewer";
|
|
25
|
+
case "Guest":
|
|
26
|
+
throw SupernovaException.shouldNotHappen(`Illegal role ${role}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { DbCreateInputOmit } from "../../helpers";
|
|
2
1
|
import { z } from "zod";
|
|
2
|
+
import { DbCreateInputOmit, DbUpdate } from "../../helpers";
|
|
3
|
+
import { OmitStrict } from "../../utils";
|
|
4
|
+
import { DesignSystemRole } from "./ds-role";
|
|
3
5
|
|
|
4
6
|
export const DesignSystemInvitation = z.object({
|
|
5
7
|
id: z.string(),
|
|
6
8
|
designSystemId: z.string(),
|
|
7
9
|
workspaceInvitationId: z.string(),
|
|
10
|
+
designSystemRole: DesignSystemRole.optional(),
|
|
8
11
|
});
|
|
9
12
|
|
|
10
13
|
export type DesignSystemInvitation = z.infer<typeof DesignSystemInvitation>;
|
|
14
|
+
|
|
11
15
|
export type CreateDesignSystemInvitation = DbCreateInputOmit<DesignSystemInvitation>;
|
|
16
|
+
export type UpdateDesignSystemInvitation = OmitStrict<
|
|
17
|
+
DbUpdate<DesignSystemInvitation>,
|
|
18
|
+
"designSystemId" | "workspaceInvitationId"
|
|
19
|
+
>;
|