@supernova-studio/model 0.55.24 → 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 +33889 -33860
- package/dist/index.d.ts +33889 -33860
- package/dist/index.js +484 -460
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +835 -811
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/elements/data/border-radius.ts +2 -1
- package/src/dsm/elements/data/border-width.ts +2 -1
- package/src/dsm/elements/data/duration.ts +2 -1
- package/src/dsm/elements/data/font-size.ts +2 -1
- package/src/dsm/elements/data/letter-spacing.ts +2 -1
- package/src/dsm/elements/data/line-height.ts +2 -1
- package/src/dsm/elements/data/opacity.ts +2 -1
- package/src/dsm/elements/data/paragraph-indent.ts +2 -1
- package/src/dsm/elements/data/paragraph-spacing.ts +2 -1
- package/src/dsm/elements/data/size.ts +2 -1
- package/src/dsm/elements/data/space.ts +2 -1
- package/src/dsm/elements/data/z-index.ts +2 -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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const BorderRadiusUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const BorderRadiusValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const BorderWidthUnit = z.enum(["Pixels"]);
|
|
5
6
|
|
|
6
7
|
export const BorderWidthValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const DurationUnit = z.enum(["Ms"]);
|
|
5
6
|
|
|
6
7
|
export const DurationValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const FontSizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const FontSizeValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const LetterSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const LetterSpacingValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const LineHeightUnit = z.enum(["Pixels", "Rem", "Percent", "Raw"]);
|
|
5
6
|
|
|
6
7
|
export const LineHeightValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const ParagraphIndentUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const ParagraphIndentValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const ParagraphSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const ParagraphSpacingValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const SizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const SizeValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const SpaceUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
6
|
|
|
6
7
|
export const SpaceValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
import { DimensionUnit } from "./dimension";
|
|
3
4
|
|
|
4
5
|
export const ZIndexUnit = z.enum(["Raw"]);
|
|
5
6
|
|
|
6
7
|
export const ZIndexValue = z.object({
|
|
7
|
-
unit:
|
|
8
|
+
unit: DimensionUnit,
|
|
8
9
|
measure: z.number(),
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -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
|
+
>;
|