@supernova-studio/model 0.0.4

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.
Files changed (165) hide show
  1. package/index.ts +1 -0
  2. package/package.json +23 -0
  3. package/src/auth/index.ts +1 -0
  4. package/src/auth/plugin-oauth-request.ts +14 -0
  5. package/src/billing/card.ts +12 -0
  6. package/src/billing/checkoutSession.ts +16 -0
  7. package/src/billing/customer.ts +28 -0
  8. package/src/billing/features.ts +43 -0
  9. package/src/billing/index.ts +9 -0
  10. package/src/billing/invoice.ts +34 -0
  11. package/src/billing/portalSession.ts +19 -0
  12. package/src/billing/price.ts +24 -0
  13. package/src/billing/product.ts +5 -0
  14. package/src/billing/subscription.ts +65 -0
  15. package/src/codegen/export-jobs.ts +26 -0
  16. package/src/codegen/exporter-workspace-membership-role.ts +4 -0
  17. package/src/codegen/exporter-workspace-membership.ts +14 -0
  18. package/src/codegen/exporter.ts +52 -0
  19. package/src/codegen/git-providers.ts +11 -0
  20. package/src/codegen/index.ts +6 -0
  21. package/src/codegen/pulsar.ts +59 -0
  22. package/src/common/entity.ts +9 -0
  23. package/src/common/index.ts +2 -0
  24. package/src/common/object-meta.ts +8 -0
  25. package/src/custom-domains/custom-domains.ts +24 -0
  26. package/src/custom-domains/index.ts +1 -0
  27. package/src/docs-server/index.ts +1 -0
  28. package/src/docs-server/session.ts +39 -0
  29. package/src/dsm/assets/asset-reference.ts +18 -0
  30. package/src/dsm/assets/asset-value.ts +3 -0
  31. package/src/dsm/assets/asset.ts +48 -0
  32. package/src/dsm/assets/index.ts +3 -0
  33. package/src/dsm/brand.ts +7 -0
  34. package/src/dsm/data-sources/data-source.ts +158 -0
  35. package/src/dsm/data-sources/import-job.ts +28 -0
  36. package/src/dsm/data-sources/import-summary.ts +70 -0
  37. package/src/dsm/data-sources/index.ts +3 -0
  38. package/src/dsm/design-system.ts +33 -0
  39. package/src/dsm/desing-system-create.ts +22 -0
  40. package/src/dsm/desing-system-update.ts +25 -0
  41. package/src/dsm/documentation/block-definitions/aux.ts +8 -0
  42. package/src/dsm/documentation/block-definitions/definition.ts +104 -0
  43. package/src/dsm/documentation/block-definitions/index.ts +4 -0
  44. package/src/dsm/documentation/block-definitions/item.ts +113 -0
  45. package/src/dsm/documentation/block-definitions/variant.ts +78 -0
  46. package/src/dsm/documentation/group.ts +19 -0
  47. package/src/dsm/documentation/index.ts +3 -0
  48. package/src/dsm/documentation/page.ts +18 -0
  49. package/src/dsm/elements/base.ts +49 -0
  50. package/src/dsm/elements/component.ts +48 -0
  51. package/src/dsm/elements/data/base.ts +18 -0
  52. package/src/dsm/elements/data/blur.ts +16 -0
  53. package/src/dsm/elements/data/border-radius.ts +15 -0
  54. package/src/dsm/elements/data/border-width.ts +15 -0
  55. package/src/dsm/elements/data/border.ts +21 -0
  56. package/src/dsm/elements/data/color.ts +13 -0
  57. package/src/dsm/elements/data/component.ts +23 -0
  58. package/src/dsm/elements/data/dimension.ts +15 -0
  59. package/src/dsm/elements/data/documentation-block-v1.ts +325 -0
  60. package/src/dsm/elements/data/documentation-block-v2.ts +57 -0
  61. package/src/dsm/elements/data/documentation-page-v1.ts +13 -0
  62. package/src/dsm/elements/data/documentation-page-v2.ts +11 -0
  63. package/src/dsm/elements/data/documentation.ts +8 -0
  64. package/src/dsm/elements/data/duration.ts +15 -0
  65. package/src/dsm/elements/data/figma-file-structure.ts +65 -0
  66. package/src/dsm/elements/data/figma-node-reference.ts +20 -0
  67. package/src/dsm/elements/data/font-family.ts +8 -0
  68. package/src/dsm/elements/data/font-size.ts +15 -0
  69. package/src/dsm/elements/data/font-weight.ts +8 -0
  70. package/src/dsm/elements/data/gradient.ts +32 -0
  71. package/src/dsm/elements/data/group.ts +17 -0
  72. package/src/dsm/elements/data/index.ts +36 -0
  73. package/src/dsm/elements/data/letter-spacing.ts +15 -0
  74. package/src/dsm/elements/data/line-height.ts +15 -0
  75. package/src/dsm/elements/data/opacity.ts +12 -0
  76. package/src/dsm/elements/data/paragraph-indent.ts +15 -0
  77. package/src/dsm/elements/data/paragraph-spacing.ts +15 -0
  78. package/src/dsm/elements/data/product-copy.ts +8 -0
  79. package/src/dsm/elements/data/shadow.ts +23 -0
  80. package/src/dsm/elements/data/size.ts +15 -0
  81. package/src/dsm/elements/data/space.ts +15 -0
  82. package/src/dsm/elements/data/string.ts +8 -0
  83. package/src/dsm/elements/data/text-case.ts +10 -0
  84. package/src/dsm/elements/data/text-decoration.ts +10 -0
  85. package/src/dsm/elements/data/typography.ts +28 -0
  86. package/src/dsm/elements/data/visibility.ts +10 -0
  87. package/src/dsm/elements/data/z-index.ts +15 -0
  88. package/src/dsm/elements/documentation-page-v1.ts +30 -0
  89. package/src/dsm/elements/documentation-page-v2.ts +16 -0
  90. package/src/dsm/elements/figma-file-structures.ts +39 -0
  91. package/src/dsm/elements/figma-node-reference.ts +17 -0
  92. package/src/dsm/elements/group.ts +59 -0
  93. package/src/dsm/elements/index.ts +13 -0
  94. package/src/dsm/elements/page-block-v2.ts +24 -0
  95. package/src/dsm/elements/primitives/index.ts +2 -0
  96. package/src/dsm/elements/primitives/point.ts +8 -0
  97. package/src/dsm/elements/primitives/size.ts +28 -0
  98. package/src/dsm/elements/raw-element.ts +126 -0
  99. package/src/dsm/elements/theme.ts +74 -0
  100. package/src/dsm/elements/tokens.ts +288 -0
  101. package/src/dsm/import/asset.ts +6 -0
  102. package/src/dsm/import/base.ts +24 -0
  103. package/src/dsm/import/component.ts +36 -0
  104. package/src/dsm/import/data-source.ts +9 -0
  105. package/src/dsm/import/figma-frames.ts +74 -0
  106. package/src/dsm/import/image.ts +72 -0
  107. package/src/dsm/import/index.ts +11 -0
  108. package/src/dsm/import/origin.ts +5 -0
  109. package/src/dsm/import/support/figma-files.ts +16 -0
  110. package/src/dsm/import/support/import-context.ts +75 -0
  111. package/src/dsm/import/support/import-model-collections.ts +46 -0
  112. package/src/dsm/import/support/index.ts +3 -0
  113. package/src/dsm/import/theme.ts +76 -0
  114. package/src/dsm/import/tokens.ts +49 -0
  115. package/src/dsm/import/warning.ts +28 -0
  116. package/src/dsm/index.ts +15 -0
  117. package/src/dsm/properties/index.ts +3 -0
  118. package/src/dsm/properties/property-definition.ts +44 -0
  119. package/src/dsm/properties/property-reference.ts +5 -0
  120. package/src/dsm/properties/property-value.ts +27 -0
  121. package/src/dsm/published-doc-page.ts +25 -0
  122. package/src/dsm/published-doc.ts +30 -0
  123. package/src/dsm/reference.ts +9 -0
  124. package/src/dsm/version.ts +14 -0
  125. package/src/dsm/views/column.ts +43 -0
  126. package/src/dsm/views/index.ts +2 -0
  127. package/src/dsm/views/view.ts +11 -0
  128. package/src/feature-flags/feature-flags.ts +14 -0
  129. package/src/feature-flags/index.ts +1 -0
  130. package/src/helpers/common.ts +1 -0
  131. package/src/helpers/db.ts +37 -0
  132. package/src/helpers/index.ts +4 -0
  133. package/src/helpers/nullish-to-optional.ts +9 -0
  134. package/src/helpers/slug-helper.ts +641 -0
  135. package/src/index.ts +16 -0
  136. package/src/integrations/external-oauth-request.ts +12 -0
  137. package/src/integrations/index.ts +3 -0
  138. package/src/integrations/oauth-providers.ts +13 -0
  139. package/src/integrations/oauth-token.ts +15 -0
  140. package/src/multiplayer/design-system-version-room.ts +13 -0
  141. package/src/multiplayer/documentation-page-room.ts +14 -0
  142. package/src/multiplayer/index.ts +2 -0
  143. package/src/npm/index.ts +2 -0
  144. package/src/npm/npm-package.ts +30 -0
  145. package/src/npm/npm-proxy-token-payload.ts +7 -0
  146. package/src/tokens/index.ts +1 -0
  147. package/src/tokens/personal-access-token.ts +17 -0
  148. package/src/users/index.ts +5 -0
  149. package/src/users/linked-integrations.ts +36 -0
  150. package/src/users/user-identity.ts +8 -0
  151. package/src/users/user-profile.ts +26 -0
  152. package/src/users/user-with-pat.ts +7 -0
  153. package/src/users/user.ts +17 -0
  154. package/src/utils/content-loader-instruction.ts +31 -0
  155. package/src/utils/index.ts +1 -0
  156. package/src/workspace/index.ts +9 -0
  157. package/src/workspace/npm-registry-settings.ts +45 -0
  158. package/src/workspace/sso-provider.ts +13 -0
  159. package/src/workspace/user-invite.ts +18 -0
  160. package/src/workspace/workspace-context.ts +10 -0
  161. package/src/workspace/workspace-create.ts +27 -0
  162. package/src/workspace/workspace-invitations.ts +14 -0
  163. package/src/workspace/workspace-membership.ts +11 -0
  164. package/src/workspace/workspace-role.ts +6 -0
  165. package/src/workspace/workspace.ts +48 -0
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { Entity } from "../common/entity";
3
+ import { DbCreateInputOmit, DbUpdate } from "../helpers";
4
+
5
+ export const DocumentationPageRoom = Entity.extend({
6
+ designSystemVersionId: z.string(),
7
+ documentationPageId: z.string(),
8
+ liveblocksId: z.string(),
9
+ });
10
+
11
+ export type DocumentationPageRoom = z.infer<typeof DocumentationPageRoom>;
12
+
13
+ export type CreateDocumentationPageRoom = DbCreateInputOmit<DocumentationPageRoom>;
14
+ export type UpdateDocumentationPageRoom = DbUpdate<DocumentationPageRoom>;
@@ -0,0 +1,2 @@
1
+ export * from "./design-system-version-room";
2
+ export * from "./documentation-page-room";
@@ -0,0 +1,2 @@
1
+ export * from "./npm-package";
2
+ export * from "./npm-proxy-token-payload";
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+
3
+ const AnyRecord = z.record(z.any());
4
+
5
+ const NpmPackageVersionDist = AnyRecord.and(
6
+ z.object({
7
+ tarball: z.string(),
8
+ })
9
+ );
10
+
11
+ const NpmPackageVersion = AnyRecord.and(
12
+ z.object({
13
+ dist: NpmPackageVersionDist,
14
+ })
15
+ );
16
+
17
+ export const NpmPackage = AnyRecord.and(
18
+ z.object({
19
+ _id: z.string(),
20
+ name: z.string(),
21
+
22
+ // e.g. "latest": "1.2.3"
23
+ "dist-tags": z.record(z.string(), z.string()),
24
+
25
+ // "1.2.3": {...}
26
+ versions: z.record(NpmPackageVersion),
27
+ })
28
+ );
29
+
30
+ export type NpmPackage = z.infer<typeof NpmPackage>;
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+
3
+ export const NpmProxyTokenPayload = z.object({
4
+ npmProxyRegistryConfigId: z.string(),
5
+ });
6
+
7
+ export type NpmProxyTokenPayload = z.infer<typeof NpmProxyTokenPayload>;
@@ -0,0 +1 @@
1
+ export * from "./personal-access-token";
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ import { WorkspaceRoleSchema } from "../workspace";
3
+
4
+ export const PersonalAccessToken = z.object({
5
+ id: z.string(),
6
+ userId: z.string(),
7
+ name: z.string(),
8
+ token: z.string(),
9
+ createdAt: z.date(),
10
+ hidden: z.boolean(),
11
+ workspaceId: z.string().optional(),
12
+ workspaceRole: WorkspaceRoleSchema.optional(),
13
+ expireAt: z.date().optional(),
14
+ scope: z.string().optional(),
15
+ });
16
+
17
+ export type PersonalAccessToken = z.infer<typeof PersonalAccessToken>;
@@ -0,0 +1,5 @@
1
+ export * from "./linked-integrations";
2
+ export * from "./user-identity";
3
+ export * from "./user-profile";
4
+ export * from "./user-with-pat";
5
+ export * from "./user";
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+
3
+ export const IntegrationAuthType = z.union([z.literal("OAuth2"), z.literal("PAT")]);
4
+
5
+ export type IntegrationAuthType = z.infer<typeof IntegrationAuthType>;
6
+
7
+ export const ExternalServiceType = z.union([
8
+ z.literal("figma"),
9
+ z.literal("github"),
10
+ z.literal("azure"),
11
+ z.literal("gitlab"),
12
+ z.literal("bitbucket"),
13
+ ]);
14
+
15
+ export type ExternalServiceType = z.infer<typeof ExternalServiceType>;
16
+
17
+ export const IntegrationUserInfo = z.object({
18
+ id: z.string(),
19
+ handle: z.string().optional(),
20
+ avatarUrl: z.string().optional(),
21
+ email: z.string().optional(),
22
+ authType: IntegrationAuthType.optional(),
23
+ customUrl: z.string().optional(),
24
+ });
25
+
26
+ export type IntegrationUserInfo = z.infer<typeof IntegrationUserInfo>;
27
+
28
+ export const UserLinkedIntegrations = z.object({
29
+ figma: IntegrationUserInfo.optional(),
30
+ github: IntegrationUserInfo.array().optional(),
31
+ azure: IntegrationUserInfo.array().optional(),
32
+ gitlab: IntegrationUserInfo.array().optional(),
33
+ bitbucket: IntegrationUserInfo.array().optional(),
34
+ });
35
+
36
+ export type UserLinkedIntegrations = z.infer<typeof UserLinkedIntegrations>;
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+
3
+ export const UserIdentity = z.object({
4
+ id: z.string(),
5
+ userId: z.string(),
6
+ });
7
+
8
+ export type UserIdentity = z.infer<typeof UserIdentity>;
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+
3
+ export const UserOnboardingDepartment = z.enum(["Design", "Engineering", "Brand", "Other"]);
4
+
5
+ export const UserOnboardingJobLevel = z.enum(["Executive", "Manager", "IndividualContributor", "Other"]);
6
+
7
+ export const UserOnboarding = z.object({
8
+ companyName: z.string().optional(),
9
+ numberOfPeopleInOrg: z.string().optional(),
10
+ numberOfPeopleInDesignTeam: z.string().optional(),
11
+ department: UserOnboardingDepartment.optional(),
12
+ jobTitle: z.string().optional(),
13
+ phase: z.string().optional(),
14
+ jobLevel: UserOnboardingJobLevel.optional(),
15
+ });
16
+
17
+ export type UserOnboarding = z.infer<typeof UserOnboarding>;
18
+
19
+ export const UserProfile = z.object({
20
+ name: z.string(),
21
+ avatar: z.string().optional(),
22
+ nickname: z.string().optional(),
23
+ onboarding: UserOnboarding.optional(),
24
+ });
25
+
26
+ export type UserProfile = z.infer<typeof UserProfile>;
@@ -0,0 +1,7 @@
1
+ import { User } from "./user";
2
+ import { PersonalAccessToken } from "../tokens";
3
+
4
+ export type PersonalAccessTokenWithUser = {
5
+ user: User;
6
+ token: PersonalAccessToken;
7
+ };
@@ -0,0 +1,17 @@
1
+ import { UserLinkedIntegrations } from "./linked-integrations";
2
+ import { UserProfile } from "./user-profile";
3
+ import { z } from "zod";
4
+
5
+ export const User = z.object({
6
+ id: z.string(),
7
+ email: z.string(),
8
+ emailVerified: z.boolean(),
9
+ createdAt: z.date(),
10
+ trialExpiresAt: z.date().optional(),
11
+ profile: UserProfile,
12
+ linkedIntegrations: UserLinkedIntegrations.optional(),
13
+ loggedOutAt: z.date().optional(),
14
+ isProtected: z.boolean(),
15
+ });
16
+
17
+ export type User = z.infer<typeof User>;
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+
3
+ export const ContentLoadInstruction = z.object({
4
+ from: z.string(),
5
+ to: z.string(),
6
+ authorizationHeaderKvsId: z.string().optional(),
7
+ timeout: z.number().optional(),
8
+ });
9
+
10
+ export type ContentLoadInstruction = z.infer<typeof ContentLoadInstruction>;
11
+
12
+ export const ContentLoaderPayload = z
13
+ .object({
14
+ type: z.literal("Single"),
15
+ instruction: ContentLoadInstruction,
16
+ })
17
+ .or(
18
+ z.object({
19
+ type: z.literal("Multiple"),
20
+ loadingChunkSize: z.number().optional(),
21
+ instructions: z.array(ContentLoadInstruction),
22
+ })
23
+ )
24
+ .or(
25
+ z.object({
26
+ type: z.literal("S3"),
27
+ location: z.string(),
28
+ })
29
+ );
30
+
31
+ export type ContentLoaderPayload = z.infer<typeof ContentLoaderPayload>;
@@ -0,0 +1 @@
1
+ export * from "./content-loader-instruction";
@@ -0,0 +1,9 @@
1
+ export * from "./npm-registry-settings";
2
+ export * from "./sso-provider";
3
+ export * from "./user-invite";
4
+ export * from "./workspace-context";
5
+ export * from "./workspace-create";
6
+ export * from "./workspace-invitations";
7
+ export * from "./workspace-membership";
8
+ export * from "./workspace-role";
9
+ export * from "./workspace";
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+
3
+ export const NpmRegistryAuthType = z.enum(["Basic", "Bearer", "None", "Custom"]);
4
+ export const NpmRegistryType = z.enum(["NPMJS", "GitHub", "AzureDevOps", "Artifactory", "Custom"]);
5
+
6
+ export const NpmRegistryBasicAuthConfig = z.object({
7
+ authType: z.literal(NpmRegistryAuthType.Enum.Basic),
8
+ username: z.string(),
9
+ password: z.string(),
10
+ });
11
+
12
+ export const NpmRegistryBearerAuthConfig = z.object({
13
+ authType: z.literal(NpmRegistryAuthType.Enum.Bearer),
14
+ accessToken: z.string(),
15
+ });
16
+
17
+ export const NpmRegistryNoAuthConfig = z.object({
18
+ authType: z.literal(NpmRegistryAuthType.Enum.None),
19
+ });
20
+
21
+ export const NpmRegistrCustomAuthConfig = z.object({
22
+ authType: z.literal(NpmRegistryAuthType.Enum.Custom),
23
+ authHeaderName: z.string(),
24
+ authHeaderValue: z.string(),
25
+ });
26
+
27
+ export const NpmRegistryAuthConfig = z.discriminatedUnion("authType", [
28
+ NpmRegistryBasicAuthConfig,
29
+ NpmRegistryBearerAuthConfig,
30
+ NpmRegistryNoAuthConfig,
31
+ NpmRegistrCustomAuthConfig,
32
+ ]);
33
+
34
+ const NpmRegistryConfigBase = z.object({
35
+ registryType: NpmRegistryType,
36
+ enabledScopes: z.array(z.string()),
37
+ customRegistryUrl: z.string().optional(),
38
+ bypassProxy: z.boolean().default(false),
39
+ npmProxyRegistryConfigId: z.string().optional(),
40
+ npmProxyVersion: z.number().optional(),
41
+ });
42
+
43
+ export const NpmRegistryConfig = NpmRegistryConfigBase.and(NpmRegistryAuthConfig);
44
+
45
+ export type NpmRegistryConfig = z.infer<typeof NpmRegistryConfig>;
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export const SsoProvider = z.object({
3
+ providerId: z.string(),
4
+ defaultAutoInviteValue: z.boolean(),
5
+ autoInviteDomains: z.record(z.string(), z.boolean()),
6
+ skipDocsSupernovaLogin: z.boolean(),
7
+ areInvitesDisabled: z.boolean(),
8
+ isTestMode: z.boolean(),
9
+ emailDomains: z.array(z.string()),
10
+ metadataXml: z.string().nullish(),
11
+ });
12
+
13
+ export type SsoProvider = z.infer<typeof SsoProvider>;
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { WorkspaceRoleSchema } from "./workspace-role";
3
+
4
+ export const MAX_MEMBERS_COUNT = 100;
5
+
6
+ export const UserInvite = z.object({
7
+ email: z
8
+ .string()
9
+ .email()
10
+ .trim()
11
+ .transform(value => value.toLowerCase()),
12
+ role: WorkspaceRoleSchema,
13
+ });
14
+
15
+ export const UserInvites = z.array(UserInvite).max(MAX_MEMBERS_COUNT);
16
+
17
+ export type UserInvite = z.infer<typeof UserInvite>;
18
+ export type UserInvites = z.infer<typeof UserInvites>;
@@ -0,0 +1,10 @@
1
+ import { ProductCodeSchema } from "../billing";
2
+ import { z } from "zod";
3
+
4
+ export const WorkspaceContext = z.object({
5
+ workspaceId: z.string(),
6
+ product: ProductCodeSchema,
7
+ publicDesignSystem: z.boolean().optional(),
8
+ });
9
+
10
+ export type WorkspaceContext = z.infer<typeof WorkspaceContext>;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { UserInvites } from "./user-invite";
3
+ import { SLUG_REGEX } from "../helpers";
4
+ import { ProductCodeSchema } from "../billing";
5
+
6
+ const WORKSPACE_NAME_MIN_LENGTH: number = 2;
7
+ const WORKSPACE_NAME_MAX_LENGTH: number = 64;
8
+ export const HANDLE_MIN_LENGTH = 2;
9
+ export const HANDLE_MAX_LENGTH = 64;
10
+
11
+ export const CreateWorkspaceInput = z.object({
12
+ name: z.string().min(WORKSPACE_NAME_MIN_LENGTH).max(WORKSPACE_NAME_MAX_LENGTH).trim(),
13
+ product: ProductCodeSchema,
14
+ priceId: z.string(),
15
+ billingEmail: z.string().email().optional(),
16
+ handle: z
17
+ .string()
18
+ .regex(SLUG_REGEX)
19
+ .min(HANDLE_MIN_LENGTH)
20
+ .max(HANDLE_MAX_LENGTH)
21
+ .refine(value => value?.length > 0)
22
+ .optional(),
23
+ invites: UserInvites.optional(),
24
+ promoCode: z.string().optional(),
25
+ });
26
+
27
+ export type CreateWorkspaceInput = z.infer<typeof CreateWorkspaceInput>;
@@ -0,0 +1,14 @@
1
+ import { WorkspaceRole } from "./workspace-role";
2
+ import { z } from "zod";
3
+
4
+ export const WorkspaceInvitation = z.object({
5
+ id: z.string(),
6
+ email: z.string().email(),
7
+ createdAt: z.date(),
8
+ resentAt: z.date().nullish(),
9
+ role: z.nativeEnum(WorkspaceRole),
10
+ workspaceId: z.string(),
11
+ invitedBy: z.string(),
12
+ });
13
+
14
+ export type WorkspaceInvitation = z.infer<typeof WorkspaceInvitation>;
@@ -0,0 +1,11 @@
1
+ import { WorkspaceRole } from "./workspace-role";
2
+ import { z } from "zod";
3
+
4
+ export const WorkspaceMembership = z.object({
5
+ id: z.string(),
6
+ userId: z.string(),
7
+ workspaceId: z.string(),
8
+ workspaceRole: z.nativeEnum(WorkspaceRole),
9
+ });
10
+
11
+ export type WorkspaceMembership = z.infer<typeof WorkspaceMembership>;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+
3
+ export const WorkspaceRoleSchema = z.enum(["Owner", "Admin", "Creator", "Viewer", "Billing", "Guest"]);
4
+
5
+ export type WorkspaceRole = z.infer<typeof WorkspaceRoleSchema>;
6
+ export const WorkspaceRole = WorkspaceRoleSchema.enum;
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import { Subscription } from "../billing";
3
+ import { SsoProvider } from "./sso-provider";
4
+ import { DesignSystem } from "../dsm";
5
+ import { BillingDetails } from "../billing";
6
+
7
+ export const WorkspaceIpWhitelistEntry = z.object({
8
+ isEnabled: z.boolean(),
9
+ name: z.string(),
10
+ range: z.string(),
11
+ });
12
+
13
+ export const WorkspaceIpSettings = z
14
+ .object({
15
+ isEnabledForCloud: z.boolean(),
16
+ isEnabledForDocs: z.boolean(),
17
+ entries: z.array(WorkspaceIpWhitelistEntry),
18
+ })
19
+ .nullish();
20
+
21
+ export const WorkspaceProfile = z.object({
22
+ name: z.string(),
23
+ handle: z.string(),
24
+ color: z.string(),
25
+ avatar: z.string().optional(),
26
+ billingDetails: BillingDetails.optional(),
27
+ });
28
+
29
+ export const Workspace = z.object({
30
+ id: z.string(),
31
+ profile: WorkspaceProfile,
32
+ subscription: Subscription,
33
+ ipWhitelist: WorkspaceIpSettings,
34
+ sso: SsoProvider.nullish(),
35
+ npmRegistrySettings: z.unknown().optional(),
36
+ designSystems: z.array(DesignSystem).nullish(),
37
+ });
38
+
39
+ export const WorkspaceWithDesignSystems = z.object({
40
+ workspace: Workspace,
41
+ designSystems: z.array(DesignSystem),
42
+ });
43
+
44
+ export type WorkspaceIpWhitelistEntry = z.infer<typeof WorkspaceIpWhitelistEntry>;
45
+ export type WorkspaceIpSettings = z.infer<typeof WorkspaceIpSettings>;
46
+ export type WorkspaceProfile = z.infer<typeof WorkspaceProfile>;
47
+ export type Workspace = z.infer<typeof Workspace>;
48
+ export type WorkspaceWithDesignSystems = z.infer<typeof WorkspaceWithDesignSystems>;