@supernova-studio/model 1.0.0 → 1.0.2

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 (237) hide show
  1. package/dist/index.d.mts +26740 -18977
  2. package/dist/index.d.ts +26740 -18977
  3. package/dist/index.js +275 -47
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +2201 -1973
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +3 -4
  8. package/src/asset-delete-schedule/asset-delete-schedule.ts +0 -20
  9. package/src/asset-delete-schedule/index.ts +0 -1
  10. package/src/auth/index.ts +0 -1
  11. package/src/auth/plugin-oauth-request.ts +0 -14
  12. package/src/billing/card.ts +0 -12
  13. package/src/billing/checkoutSession.ts +0 -16
  14. package/src/billing/customer.ts +0 -29
  15. package/src/billing/features.ts +0 -48
  16. package/src/billing/index.ts +0 -9
  17. package/src/billing/invoice.ts +0 -34
  18. package/src/billing/portalSession.ts +0 -19
  19. package/src/billing/price.ts +0 -24
  20. package/src/billing/product.ts +0 -5
  21. package/src/billing/subscription.ts +0 -65
  22. package/src/common/entity.ts +0 -9
  23. package/src/common/index.ts +0 -2
  24. package/src/common/object-meta.ts +0 -8
  25. package/src/custom-domains/custom-domains.ts +0 -24
  26. package/src/custom-domains/index.ts +0 -1
  27. package/src/data-dumps/code-integration-dump.ts +0 -19
  28. package/src/data-dumps/design-system-dump.ts +0 -16
  29. package/src/data-dumps/design-system-version-dump.ts +0 -45
  30. package/src/data-dumps/index.ts +0 -6
  31. package/src/data-dumps/published-docs-dump.ts +0 -10
  32. package/src/data-dumps/user-data-dump.ts +0 -10
  33. package/src/data-dumps/workspace-dump.ts +0 -14
  34. package/src/docs-server/index.ts +0 -1
  35. package/src/docs-server/session.ts +0 -39
  36. package/src/dsm/assets/asset-dynamo-record.ts +0 -10
  37. package/src/dsm/assets/asset-reference.ts +0 -18
  38. package/src/dsm/assets/asset-value.ts +0 -3
  39. package/src/dsm/assets/asset.ts +0 -60
  40. package/src/dsm/assets/index.ts +0 -4
  41. package/src/dsm/brand.ts +0 -13
  42. package/src/dsm/collection.ts +0 -51
  43. package/src/dsm/components/asset-rendering.ts +0 -22
  44. package/src/dsm/components/index.ts +0 -1
  45. package/src/dsm/data-sources/data-source.ts +0 -167
  46. package/src/dsm/data-sources/import-job.ts +0 -30
  47. package/src/dsm/data-sources/import-summary.ts +0 -70
  48. package/src/dsm/data-sources/index.ts +0 -3
  49. package/src/dsm/design-system.ts +0 -47
  50. package/src/dsm/documentation/approvals/approval-state.ts +0 -4
  51. package/src/dsm/documentation/approvals/approval.ts +0 -18
  52. package/src/dsm/documentation/approvals/index.ts +0 -2
  53. package/src/dsm/documentation/block-definitions/aux.ts +0 -10
  54. package/src/dsm/documentation/block-definitions/definition.ts +0 -76
  55. package/src/dsm/documentation/block-definitions/index.ts +0 -4
  56. package/src/dsm/documentation/block-definitions/item.ts +0 -233
  57. package/src/dsm/documentation/block-definitions/variant.ts +0 -49
  58. package/src/dsm/documentation/group.ts +0 -19
  59. package/src/dsm/documentation/index.ts +0 -10
  60. package/src/dsm/documentation/link-preview.ts +0 -10
  61. package/src/dsm/documentation/page-anchor.ts +0 -9
  62. package/src/dsm/documentation/page-content-backup.ts +0 -13
  63. package/src/dsm/documentation/page-content.ts +0 -32
  64. package/src/dsm/documentation/page.ts +0 -18
  65. package/src/dsm/documentation/settings.ts +0 -18
  66. package/src/dsm/documentation/thread.ts +0 -35
  67. package/src/dsm/element-snapshots/base.ts +0 -34
  68. package/src/dsm/element-snapshots/documentation-page-snapshot.ts +0 -29
  69. package/src/dsm/element-snapshots/group-snapshot.ts +0 -27
  70. package/src/dsm/element-snapshots/index.ts +0 -3
  71. package/src/dsm/elements/base.ts +0 -49
  72. package/src/dsm/elements/component-properties.ts +0 -63
  73. package/src/dsm/elements/data/base.ts +0 -18
  74. package/src/dsm/elements/data/blur.ts +0 -16
  75. package/src/dsm/elements/data/border-radius.ts +0 -16
  76. package/src/dsm/elements/data/border-width.ts +0 -16
  77. package/src/dsm/elements/data/border.ts +0 -21
  78. package/src/dsm/elements/data/color.ts +0 -13
  79. package/src/dsm/elements/data/component.ts +0 -30
  80. package/src/dsm/elements/data/dimension.ts +0 -15
  81. package/src/dsm/elements/data/documentation-block-v1.ts +0 -498
  82. package/src/dsm/elements/data/documentation-block-v2.ts +0 -429
  83. package/src/dsm/elements/data/documentation-page-v1.ts +0 -9
  84. package/src/dsm/elements/data/documentation-page-v2.ts +0 -7
  85. package/src/dsm/elements/data/documentation-section-v2.ts +0 -47
  86. package/src/dsm/elements/data/documentation-v1.ts +0 -16
  87. package/src/dsm/elements/data/documentation-v2.ts +0 -18
  88. package/src/dsm/elements/data/duration.ts +0 -16
  89. package/src/dsm/elements/data/figma-file-structure.ts +0 -65
  90. package/src/dsm/elements/data/figma-node-reference.ts +0 -27
  91. package/src/dsm/elements/data/font-family.ts +0 -8
  92. package/src/dsm/elements/data/font-size.ts +0 -16
  93. package/src/dsm/elements/data/font-weight.ts +0 -8
  94. package/src/dsm/elements/data/font.ts +0 -9
  95. package/src/dsm/elements/data/gradient.ts +0 -32
  96. package/src/dsm/elements/data/group.ts +0 -20
  97. package/src/dsm/elements/data/index.ts +0 -43
  98. package/src/dsm/elements/data/item-header-v1.ts +0 -35
  99. package/src/dsm/elements/data/item-header-v2.ts +0 -34
  100. package/src/dsm/elements/data/item-header.ts +0 -14
  101. package/src/dsm/elements/data/letter-spacing.ts +0 -16
  102. package/src/dsm/elements/data/line-height.ts +0 -16
  103. package/src/dsm/elements/data/opacity.ts +0 -13
  104. package/src/dsm/elements/data/paragraph-indent.ts +0 -16
  105. package/src/dsm/elements/data/paragraph-spacing.ts +0 -16
  106. package/src/dsm/elements/data/product-copy.ts +0 -8
  107. package/src/dsm/elements/data/safe-id.ts +0 -13
  108. package/src/dsm/elements/data/shadow.ts +0 -23
  109. package/src/dsm/elements/data/size.ts +0 -16
  110. package/src/dsm/elements/data/space.ts +0 -16
  111. package/src/dsm/elements/data/string.ts +0 -8
  112. package/src/dsm/elements/data/text-case.ts +0 -10
  113. package/src/dsm/elements/data/text-decoration.ts +0 -10
  114. package/src/dsm/elements/data/typography.ts +0 -28
  115. package/src/dsm/elements/data/visibility.ts +0 -10
  116. package/src/dsm/elements/data/z-index.ts +0 -16
  117. package/src/dsm/elements/documentation-page-v1.ts +0 -34
  118. package/src/dsm/elements/documentation-page-v2.ts +0 -21
  119. package/src/dsm/elements/figma-component.ts +0 -67
  120. package/src/dsm/elements/figma-file-structures.ts +0 -40
  121. package/src/dsm/elements/figma-node-reference.ts +0 -25
  122. package/src/dsm/elements/group.ts +0 -40
  123. package/src/dsm/elements/index.ts +0 -15
  124. package/src/dsm/elements/page-block-v2.ts +0 -25
  125. package/src/dsm/elements/primitives/index.ts +0 -2
  126. package/src/dsm/elements/primitives/point.ts +0 -8
  127. package/src/dsm/elements/primitives/size.ts +0 -28
  128. package/src/dsm/elements/raw-element.ts +0 -164
  129. package/src/dsm/elements/theme.ts +0 -76
  130. package/src/dsm/elements/tokens.ts +0 -311
  131. package/src/dsm/elements/utils.ts +0 -114
  132. package/src/dsm/exporter-property-values-collection.ts +0 -31
  133. package/src/dsm/import/asset.ts +0 -6
  134. package/src/dsm/import/base.ts +0 -24
  135. package/src/dsm/import/collection.ts +0 -16
  136. package/src/dsm/import/component.ts +0 -40
  137. package/src/dsm/import/data-source.ts +0 -9
  138. package/src/dsm/import/figma-frames.ts +0 -74
  139. package/src/dsm/import/image.ts +0 -87
  140. package/src/dsm/import/index.ts +0 -12
  141. package/src/dsm/import/origin.ts +0 -5
  142. package/src/dsm/import/support/figma-files.ts +0 -19
  143. package/src/dsm/import/support/import-context.ts +0 -94
  144. package/src/dsm/import/support/import-model-collections.ts +0 -50
  145. package/src/dsm/import/support/index.ts +0 -3
  146. package/src/dsm/import/theme.ts +0 -76
  147. package/src/dsm/import/tokens.ts +0 -50
  148. package/src/dsm/import/warning.ts +0 -38
  149. package/src/dsm/index.ts +0 -19
  150. package/src/dsm/membership/additions.ts +0 -13
  151. package/src/dsm/membership/design-system-membership.ts +0 -92
  152. package/src/dsm/membership/ds-role.ts +0 -28
  153. package/src/dsm/membership/index.ts +0 -4
  154. package/src/dsm/membership/invitations.ts +0 -21
  155. package/src/dsm/properties/index.ts +0 -3
  156. package/src/dsm/properties/property-definition.ts +0 -57
  157. package/src/dsm/properties/property-reference.ts +0 -5
  158. package/src/dsm/properties/property-value.ts +0 -29
  159. package/src/dsm/published-doc-page-visits.ts +0 -15
  160. package/src/dsm/published-doc-page.ts +0 -37
  161. package/src/dsm/published-doc.ts +0 -32
  162. package/src/dsm/reference.ts +0 -9
  163. package/src/dsm/version.ts +0 -41
  164. package/src/dsm/views/column.ts +0 -58
  165. package/src/dsm/views/index.ts +0 -2
  166. package/src/dsm/views/view.ts +0 -19
  167. package/src/emails/design-system-invite.ts +0 -31
  168. package/src/emails/index.ts +0 -2
  169. package/src/emails/workspace-invite.ts +0 -29
  170. package/src/events/base.ts +0 -7
  171. package/src/events/data-source-imported.ts +0 -9
  172. package/src/events/index.ts +0 -3
  173. package/src/events/version-released.ts +0 -10
  174. package/src/export/export-destinations.ts +0 -127
  175. package/src/export/export-jobs.ts +0 -122
  176. package/src/export/export-runner/export-context.ts +0 -34
  177. package/src/export/export-runner/exporter-payload.ts +0 -10
  178. package/src/export/export-runner/index.ts +0 -2
  179. package/src/export/exporter-workspace-membership-role.ts +0 -4
  180. package/src/export/exporter-workspace-membership.ts +0 -14
  181. package/src/export/exporter.ts +0 -55
  182. package/src/export/git-providers.ts +0 -11
  183. package/src/export/index.ts +0 -9
  184. package/src/export/pipeline.ts +0 -34
  185. package/src/export/pulsar.ts +0 -71
  186. package/src/feature-flags/feature-flags.ts +0 -21
  187. package/src/feature-flags/index.ts +0 -1
  188. package/src/helpers/db.ts +0 -82
  189. package/src/helpers/index.ts +0 -2
  190. package/src/helpers/nullish-to-optional.ts +0 -9
  191. package/src/index.ts +0 -20
  192. package/src/integrations/external-oauth-request.ts +0 -12
  193. package/src/integrations/git.ts +0 -49
  194. package/src/integrations/index.ts +0 -6
  195. package/src/integrations/integration.ts +0 -143
  196. package/src/integrations/oauth-providers.ts +0 -13
  197. package/src/integrations/oauth-token.ts +0 -16
  198. package/src/integrations/workspace-oauth-requests.ts +0 -12
  199. package/src/liveblocks/index.ts +0 -1
  200. package/src/liveblocks/rooms/design-system-version-room.ts +0 -62
  201. package/src/liveblocks/rooms/documentation-page-room.ts +0 -65
  202. package/src/liveblocks/rooms/index.ts +0 -4
  203. package/src/liveblocks/rooms/room-type.ts +0 -12
  204. package/src/liveblocks/rooms/workspace-room.ts +0 -16
  205. package/src/npm/index.ts +0 -2
  206. package/src/npm/npm-package.ts +0 -30
  207. package/src/npm/npm-proxy-token-payload.ts +0 -7
  208. package/src/tokens/index.ts +0 -1
  209. package/src/tokens/personal-access-token.ts +0 -25
  210. package/src/users/index.ts +0 -9
  211. package/src/users/linked-integrations.ts +0 -36
  212. package/src/users/user-analytics-cleanup-schedule.ts +0 -15
  213. package/src/users/user-identity.ts +0 -8
  214. package/src/users/user-minified.ts +0 -10
  215. package/src/users/user-notification-settings.ts +0 -18
  216. package/src/users/user-profile.ts +0 -41
  217. package/src/users/user-test.ts +0 -8
  218. package/src/users/user-with-pat.ts +0 -7
  219. package/src/users/user.ts +0 -21
  220. package/src/utils/common.ts +0 -172
  221. package/src/utils/content-loader-instruction.ts +0 -31
  222. package/src/utils/errors.ts +0 -120
  223. package/src/utils/index.ts +0 -6
  224. package/src/utils/naming.ts +0 -73
  225. package/src/utils/slugify.ts +0 -636
  226. package/src/utils/validation.ts +0 -4
  227. package/src/workspace/index.ts +0 -10
  228. package/src/workspace/npm-registry-settings.ts +0 -45
  229. package/src/workspace/sso-provider.ts +0 -13
  230. package/src/workspace/user-invite.ts +0 -18
  231. package/src/workspace/workspace-configuration.ts +0 -14
  232. package/src/workspace/workspace-context.ts +0 -13
  233. package/src/workspace/workspace-create.ts +0 -25
  234. package/src/workspace/workspace-invitations.ts +0 -22
  235. package/src/workspace/workspace-membership.ts +0 -31
  236. package/src/workspace/workspace-role.ts +0 -6
  237. package/src/workspace/workspace.ts +0 -62
@@ -1,50 +0,0 @@
1
- import { z } from "zod";
2
- import { DesignTokenOrigin, DesignTokenOriginPart, DesignTokenType, DesignTokenTypedData } from "../elements";
3
- import { ImportModelBase, ImportModelInputBase } from "./base";
4
-
5
- //
6
- // Base
7
- //
8
-
9
- const DesignTokenImportModelPart = z.object({
10
- collectionId: z.string().optional(),
11
- codeSyntax: z.record(z.coerce.string()).optional(),
12
- scopes: z.array(z.string()).optional(),
13
- });
14
-
15
- export const DesignTokenImportModelBase = ImportModelBase.extend(DesignTokenImportModelPart.shape).extend({
16
- origin: DesignTokenOrigin,
17
- });
18
-
19
- export const DesignTokenImportModelInputBase = ImportModelInputBase.extend(DesignTokenImportModelPart.shape).extend({
20
- originMetadata: DesignTokenOriginPart,
21
- });
22
-
23
- //
24
- // Import models
25
- //
26
-
27
- export const DesignTokenImportModel = DesignTokenTypedData.and(DesignTokenImportModelBase);
28
- export const DesignTokenImportModelInput = DesignTokenTypedData.and(DesignTokenImportModelInputBase);
29
-
30
- export type DesignTokenImportModelInputBase = z.infer<typeof DesignTokenImportModelInputBase>;
31
-
32
- export type DesignTokenImportModel = z.infer<typeof DesignTokenImportModel>;
33
- export type DesignTokenImportModelOfType<T extends DesignTokenType> = Extract<DesignTokenImportModel, { type: T }>;
34
-
35
- export type DesignTokenImportModelInput = z.infer<typeof DesignTokenImportModelInput>;
36
- export type DesignTokenImportModelInputOfType<T extends DesignTokenType> = Extract<DesignTokenImportModel, { type: T }>;
37
-
38
- export function isDesignTokenImportModelOfType<T extends DesignTokenType>(
39
- designToken: DesignTokenImportModel,
40
- type: T
41
- ): designToken is DesignTokenImportModelOfType<T> {
42
- return designToken.type === type;
43
- }
44
-
45
- export function designTokenImportModelTypeFilter<T extends DesignTokenType>(
46
- type: T
47
- ): (designToken: DesignTokenImportModel) => designToken is DesignTokenImportModelOfType<T> {
48
- return (designToken): designToken is DesignTokenImportModelOfType<T> =>
49
- isDesignTokenImportModelOfType(designToken, type);
50
- }
@@ -1,38 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const ImportWarningType = z.enum([
4
- "NoVersionFound",
5
-
6
- "UnsupportedFill",
7
- "UnsupportedStroke",
8
- "UnsupportedEffect",
9
-
10
- "NoPublishedElements",
11
- "NoPublishedStyles",
12
- "NoPublishedComponents",
13
- "NoPublishedAssets",
14
-
15
- "StyleNotApplied",
16
-
17
- "ComponentHasNoThumbnail",
18
-
19
- "DuplicateImportedStyleId",
20
- "DuplicateImportedStylePath",
21
-
22
- "NoUnpublishedStyles",
23
-
24
- "ReferenceResolutionFailed",
25
- ]);
26
-
27
- export const ImportWarning = z.object({
28
- warningType: ImportWarningType,
29
- componentId: z.string().optional(),
30
- componentName: z.string().optional(),
31
- styleId: z.string().optional(),
32
- styleName: z.string().optional(),
33
- unsupportedStyleValueType: z.string().optional(),
34
- referenceId: z.string().optional(),
35
- });
36
-
37
- export type ImportWarningType = z.infer<typeof ImportWarningType>;
38
- export type ImportWarning = z.infer<typeof ImportWarning>;
package/src/dsm/index.ts DELETED
@@ -1,19 +0,0 @@
1
- export * from "./assets";
2
- export * from "./components";
3
- export * from "./data-sources";
4
- export * from "./documentation";
5
- export * from "./element-snapshots";
6
- export * from "./elements";
7
- export * from "./import";
8
- export * from "./membership";
9
- export * from "./properties";
10
- export * from "./views";
11
- export * from "./brand";
12
- export * from "./collection";
13
- export * from "./design-system";
14
- export * from "./exporter-property-values-collection";
15
- export * from "./published-doc-page-visits";
16
- export * from "./published-doc-page";
17
- export * from "./published-doc";
18
- export * from "./reference";
19
- export * from "./version";
@@ -1,13 +0,0 @@
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,92 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
- import { OmitStrict } from "../../utils";
4
- import { WorkspaceRoleSchema } from "../../workspace";
5
- import { DesignSystemRole } from "./ds-role";
6
- import { DesignSystemInvitation } from "./invitations";
7
-
8
- export const DesignSystemMembership = z.object({
9
- id: z.string(),
10
- userId: z.string(),
11
- designSystemId: z.string(),
12
- designSystemRole: DesignSystemRole.optional(),
13
- workspaceMembershipId: z.string(),
14
- workspaceRole: WorkspaceRoleSchema,
15
- });
16
-
17
- export type DesignSystemMembership = z.infer<typeof DesignSystemMembership>;
18
-
19
- export type CreateDesignSystemMembership = DbCreateInputOmit<DesignSystemMembership>;
20
- export type UpdateDesignSystemMembership = OmitStrict<
21
- DbUpdate<DesignSystemMembership>,
22
- "designSystemId" | "userId" | "workspaceMembershipId"
23
- >;
24
-
25
- export const DesignSystemMembers = z.object({
26
- members: DesignSystemMembership.array(),
27
- invitations: DesignSystemInvitation.array(),
28
- });
29
-
30
- export const DesignSystemPendingMemberInvitation = z.object({
31
- inviteId: z.string(),
32
-
33
- /**
34
- * Role that the user will have in the design system, undefined
35
- * if it should be inherited from the workspace
36
- */
37
- designSystemRole: DesignSystemRole.optional(),
38
- });
39
-
40
- export const DesignSystemUserInvitation = z.object({
41
- userId: z.string(),
42
-
43
- /**
44
- * Role that the user will have in the design system, undefined
45
- * if it should be inherited from the workspace
46
- */
47
- designSystemRole: DesignSystemRole.optional(),
48
- });
49
-
50
- export const DesignSystemInvite = z.object({
51
- email: z.string(),
52
- workspaceRole: WorkspaceRoleSchema,
53
-
54
- /**
55
- * Role that the user will have in the design system, undefined
56
- * if it should be inherited from the workspace
57
- */
58
- designSystemRole: DesignSystemRole.optional(),
59
- });
60
-
61
- export const DesignSystemMemberUpdate = z.object({
62
- userId: z.string(),
63
- designSystemRole: DesignSystemRole.nullable(),
64
- });
65
-
66
- export const DesignSystemInviteUpdate = z.object({
67
- /**
68
- * Workspace invitation id
69
- */
70
- inviteId: z.string(),
71
- designSystemRole: DesignSystemRole.nullable(),
72
- });
73
-
74
- export const DesignSystemMembershipUpdates = z.object({
75
- usersToInvite: DesignSystemUserInvitation.array().optional(),
76
- invitesToInvite: DesignSystemPendingMemberInvitation.array().optional(),
77
- emailsToInvite: DesignSystemInvite.array().optional(),
78
-
79
- usersToUpdate: DesignSystemMemberUpdate.array().optional(),
80
- invitesToUpdate: DesignSystemInviteUpdate.array().optional(),
81
-
82
- removeUserIds: z.string().array().optional(),
83
- deleteInvitationIds: z.string().array().optional(),
84
- });
85
-
86
- export type DesignSystemMembers = z.infer<typeof DesignSystemMembers>;
87
- export type DesignSystemInvite = z.infer<typeof DesignSystemInvite>;
88
- export type DesignSystemMemberUpdate = z.infer<typeof DesignSystemMemberUpdate>;
89
- export type DesignSystemInviteUpdate = z.infer<typeof DesignSystemInviteUpdate>;
90
- export type DesignSystemPendingMemberInvite = z.infer<typeof DesignSystemPendingMemberInvitation>;
91
- export type DesignSystemUserInvitation = z.infer<typeof DesignSystemUserInvitation>;
92
- export type DesignSystemMembershipUpdates = z.infer<typeof DesignSystemMembershipUpdates>;
@@ -1,28 +0,0 @@
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,4 +0,0 @@
1
- export * from "./additions";
2
- export * from "./design-system-membership";
3
- export * from "./ds-role";
4
- export * from "./invitations";
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
- import { OmitStrict } from "../../utils";
4
- import { WorkspaceRoleSchema } from "../../workspace";
5
- import { DesignSystemRole } from "./ds-role";
6
-
7
- export const DesignSystemInvitation = z.object({
8
- id: z.string(),
9
- designSystemId: z.string(),
10
- workspaceInvitationId: z.string(),
11
- designSystemRole: DesignSystemRole.optional(),
12
- workspaceRole: WorkspaceRoleSchema,
13
- });
14
-
15
- export type DesignSystemInvitation = z.infer<typeof DesignSystemInvitation>;
16
-
17
- export type CreateDesignSystemInvitation = DbCreateInputOmit<DesignSystemInvitation>;
18
- export type UpdateDesignSystemInvitation = OmitStrict<
19
- DbUpdate<DesignSystemInvitation>,
20
- "designSystemId" | "workspaceInvitationId"
21
- >;
@@ -1,3 +0,0 @@
1
- export * from "./property-definition";
2
- export * from "./property-reference";
3
- export * from "./property-value";
@@ -1,57 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
- import { OmitStrict } from "../../utils";
4
-
5
- export const ElementPropertyTypeSchema = z.enum(["Text", "Number", "Boolean", "Select", "Generic", "Link", "URL"]);
6
- export const ElementPropertyTargetType = z.enum(["Token", "Component", "DocumentationPage"]);
7
- export const ElementPropertyLinkType = z.enum(["FigmaComponent", "DocumentationPage"]);
8
- export const ElementPropertyImmutableType = z.enum(["Collection"]);
9
-
10
- const CODE_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z_$0-9]{1,99}$/;
11
-
12
- export const ColorTokenInlineData = z.object({
13
- value: z.string(),
14
- });
15
-
16
- export const ElementPropertyDefinitionOption = z.object({
17
- id: z.string(),
18
- name: z.string(),
19
- backgroundColor: ColorTokenInlineData.optional(),
20
- });
21
-
22
- export const ElementPropertyDefinition = z.object({
23
- id: z.string(),
24
- designSystemVersionId: z.string(),
25
- persistentId: z.string(),
26
- name: z.string(),
27
- codeName: z.string().regex(CODE_NAME_REGEX),
28
- description: z.string(),
29
- type: ElementPropertyTypeSchema,
30
- targetElementType: ElementPropertyTargetType,
31
- options: z.array(ElementPropertyDefinitionOption).optional(),
32
- linkElementType: ElementPropertyLinkType.optional(),
33
- });
34
-
35
- export type ElementPropertyType = z.infer<typeof ElementPropertyTypeSchema>;
36
- export const ElementPropertyType = ElementPropertyTypeSchema.enum;
37
-
38
- export type ElementPropertyTargetType = z.infer<typeof ElementPropertyTargetType>;
39
- export type ElementPropertyLinkType = z.infer<typeof ElementPropertyLinkType>;
40
- export type ElementPropertyImmutableType = z.infer<typeof ElementPropertyImmutableType>;
41
- export type ColorTokenInlineData = z.infer<typeof ColorTokenInlineData>;
42
- export type ElementPropertyDefinitionOption = z.infer<typeof ElementPropertyDefinitionOption>;
43
- export type ElementPropertyDefinition = z.infer<typeof ElementPropertyDefinition>;
44
-
45
- export type CreateElementPropertyDefinition = DbCreateInputOmit<ElementPropertyDefinition> & {
46
- columnWidth?: number;
47
- };
48
-
49
- export type UpdateElementPropertyDefinition = OmitStrict<
50
- DbUpdate<ElementPropertyDefinition>,
51
- "designSystemVersionId" | "targetElementType" | "type" | "linkElementType"
52
- >;
53
-
54
- export type ElementPropertyDefinitionDiff = {
55
- toCreate: CreateElementPropertyDefinition[];
56
- toUpdate: UpdateElementPropertyDefinition[];
57
- };
@@ -1,5 +0,0 @@
1
- export type ElementPropertyReference = {
2
- id: string;
3
- ownerId: string;
4
- targetId: string;
5
- };
@@ -1,29 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
- import { OmitStrict } from "../../utils";
4
-
5
- export const ElementPropertyValue = z.object({
6
- id: z.string(),
7
- designSystemVersionId: z.string(),
8
- targetElementPersistentId: z.string(),
9
- definitionPersistentId: z.string(),
10
- stringValue: z.string().nullish(),
11
- numberValue: z.number().nullish(),
12
- booleanValue: z.boolean().nullish(),
13
- referenceValue: z.string().nullish(),
14
- referenceValuePreview: z.string().optional(),
15
- });
16
-
17
- export type ElementPropertyValue = z.infer<typeof ElementPropertyValue>;
18
-
19
- export type CreateElementPropertyValue = DbCreateInputOmit<ElementPropertyValue>;
20
- export type UpdateElementPropertyValue = OmitStrict<
21
- DbUpdate<ElementPropertyValue>,
22
- "designSystemVersionId" | "definitionPersistentId" | "targetElementPersistentId"
23
- >;
24
-
25
- export type ElementPropertyValueDiff = {
26
- toCreate: CreateElementPropertyValue[];
27
- toUpdate: UpdateElementPropertyValue[];
28
- toDelete: ElementPropertyValue[];
29
- };
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit } from "../helpers";
3
-
4
- export const PublishedDocPageVisitsEntry = z.object({
5
- id: z.string(),
6
- versionId: z.string(),
7
- pagePersistentId: z.string(),
8
- locale: z.string().optional(),
9
- timestamp: z.coerce.date(),
10
- visits: z.number(),
11
- });
12
-
13
- export type PublishedDocPageVisitsEntry = z.infer<typeof PublishedDocPageVisitsEntry>;
14
-
15
- export type CreatePublishedDocPageVisitsEntry = DbCreateInputOmit<PublishedDocPageVisitsEntry>;
@@ -1,37 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../helpers";
3
- import { OmitStrict } from "../utils";
4
-
5
- export const SHORT_PERSISTENT_ID_LENGTH = 8;
6
-
7
- export function tryParseShortPersistentId(url = "/") {
8
- const lastUrlPart = url.split("/").pop() || "";
9
- const shortPersistentId = lastUrlPart.split("-").pop()?.replaceAll(".html", "") || null;
10
-
11
- return shortPersistentId?.length === SHORT_PERSISTENT_ID_LENGTH ? shortPersistentId : null;
12
- }
13
-
14
- export const PublishedDocPage = z.object({
15
- id: z.string(),
16
- publishedDocId: z.string(),
17
- pageShortPersistentId: z.string(),
18
- pagePersistentId: z.string().optional(),
19
- pathV1: z.string(),
20
- pathV2: z.string(),
21
- storagePath: z.string(),
22
- locale: z.string().optional(),
23
-
24
- isPrivate: z.boolean(),
25
- isHidden: z.boolean(),
26
-
27
- createdAt: z.coerce.date(),
28
- updatedAt: z.coerce.date(),
29
- });
30
-
31
- export type PublishedDocPage = z.infer<typeof PublishedDocPage>;
32
-
33
- export type CreatePublishedDocPage = DbCreateInputOmit<PublishedDocPage> & {
34
- pagePersistentId: string;
35
- };
36
-
37
- export type UpdatePublishedDocPage = DbUpdate<OmitStrict<PublishedDocPage, "pageShortPersistentId" | "publishedDocId">>;
@@ -1,32 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const publishedDocEnvironments = ["Live", "Preview"] as const;
4
- export const PublishedDocEnvironment = z.enum(publishedDocEnvironments);
5
-
6
- export const PublishedDocsChecksums = z.record(z.string());
7
-
8
- export const PublishedDocRoutingVersion = z.enum(["1", "2"]);
9
-
10
- export const PublishedDoc = z.object({
11
- id: z.string(),
12
- designSystemVersionId: z.string(),
13
- createdAt: z.coerce.date(),
14
- updatedAt: z.coerce.date(),
15
- lastPublishedAt: z.coerce.date(),
16
- isDefault: z.boolean(),
17
- isPublic: z.boolean(),
18
- environment: PublishedDocEnvironment,
19
- checksums: PublishedDocsChecksums,
20
- storagePath: z.string(),
21
- wasMigrated: z.boolean(),
22
- routingVersion: PublishedDocRoutingVersion,
23
- usesLocalizations: z.boolean(),
24
- wasPublishedWithLocalizations: z.boolean(),
25
- tokenCount: z.number(),
26
- assetCount: z.number(),
27
- });
28
-
29
- export type PublishedDocEnvironment = z.infer<typeof PublishedDocEnvironment>;
30
- export type PublishedDocsChecksums = z.infer<typeof PublishedDocsChecksums>;
31
- export type PublishedDocRoutingVersion = z.infer<typeof PublishedDocRoutingVersion>;
32
- export type PublishedDoc = z.infer<typeof PublishedDoc>;
@@ -1,9 +0,0 @@
1
- import { DbCreateInputOmit } from "../helpers";
2
-
3
- export type DesignElementReference = {
4
- id: string;
5
- ownerId: string;
6
- referencedElementId: string;
7
- };
8
-
9
- export type CreateDesignElementReference = DbCreateInputOmit<DesignElementReference>;
@@ -1,41 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate, nullishToOptional } from "../helpers";
3
- import { OmitStrict } from "../utils";
4
-
5
- export const DesignSystemVersion = z.object({
6
- id: z.string(),
7
- version: z.string(),
8
- createdAt: z.coerce.date(),
9
- designSystemId: z.string(),
10
- name: z.string(),
11
- comment: z.string(),
12
- isReadonly: z.boolean(),
13
- changeLog: z.string(),
14
- parentId: z.string().optional(),
15
- isDraftsFeatureAdopted: z.boolean(),
16
- });
17
-
18
- export type DesignSystemVersion = z.infer<typeof DesignSystemVersion>;
19
-
20
- export type CreateDesignSystemVersion = DbCreateInputOmit<DesignSystemVersion>;
21
-
22
- export type UpdateDesignSystemVersion = OmitStrict<
23
- DbUpdate<DesignSystemVersion>,
24
- "designSystemId" | "isReadonly" | "version" | "parentId"
25
- >;
26
-
27
- // Jobs
28
- export const VersionCreationJobStatus = z.enum(["Success", "InProgress", "Error"]);
29
-
30
- export type VersionCreationJobStatus = z.infer<typeof VersionCreationJobStatus>;
31
-
32
- export const VersionCreationJob = z.object({
33
- id: z.string(),
34
- version: z.string(),
35
- designSystemId: z.string(),
36
- designSystemVersionId: nullishToOptional(z.string()),
37
- status: VersionCreationJobStatus,
38
- errorMessage: nullishToOptional(z.string()),
39
- });
40
-
41
- export type VersionCreationJob = z.infer<typeof VersionCreationJob>;
@@ -1,58 +0,0 @@
1
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
2
- import { OmitStrict } from "../../utils";
3
- import { z } from "zod";
4
-
5
- export const ElementViewBaseColumnType = z.enum(["Name", "Description", "Value", "UpdatedAt"]);
6
-
7
- export const ElementViewColumnType = z.union([
8
- z.literal("BaseProperty"),
9
- z.literal("PropertyDefinition"),
10
- z.literal("Theme"),
11
- ]);
12
-
13
- export const ElementViewColumnSharedAttributes = z.object({
14
- id: z.string(),
15
- persistentId: z.string(),
16
- elementDataViewId: z.string(),
17
- sortPosition: z.number(),
18
- width: z.number(),
19
- });
20
-
21
- export const ElementViewBasePropertyColumn = ElementViewColumnSharedAttributes.extend({
22
- type: z.literal("BaseProperty"),
23
- basePropertyType: ElementViewBaseColumnType,
24
- });
25
-
26
- export const ElementViewPropertyDefinitionColumn = ElementViewColumnSharedAttributes.extend({
27
- type: z.literal("PropertyDefinition"),
28
- propertyDefinitionId: z.string(),
29
- });
30
-
31
- export const ElementViewThemeColumn = ElementViewColumnSharedAttributes.extend({
32
- type: z.literal("Theme"),
33
- themeId: z.string(),
34
- });
35
-
36
- export const ElementViewColumn = z.discriminatedUnion("type", [
37
- ElementViewBasePropertyColumn,
38
- ElementViewPropertyDefinitionColumn,
39
- ElementViewThemeColumn,
40
- ]);
41
-
42
- export type ElementViewBaseColumnType = z.infer<typeof ElementViewBaseColumnType>;
43
- export type ElementViewBasePropertyColumn = z.infer<typeof ElementViewBasePropertyColumn>;
44
- export type ElementViewPropertyDefinitionColumn = z.infer<typeof ElementViewPropertyDefinitionColumn>;
45
- export type ElementViewThemeColumn = z.infer<typeof ElementViewThemeColumn>;
46
- export type ElementViewColumn = z.infer<typeof ElementViewColumn>;
47
- export type ElementViewColumnSharedAttributes = z.infer<typeof ElementViewColumnSharedAttributes>;
48
- export type ElementViewColumnType = z.infer<typeof ElementViewColumn>["type"];
49
-
50
- export type CreateElementViewColumn =
51
- | DbCreateInputOmit<ElementViewBasePropertyColumn>
52
- | DbCreateInputOmit<ElementViewPropertyDefinitionColumn>
53
- | DbCreateInputOmit<ElementViewThemeColumn>;
54
-
55
- export type UpdateElementViewColumn =
56
- | OmitStrict<DbUpdate<ElementViewBasePropertyColumn>, "elementDataViewId">
57
- | OmitStrict<DbUpdate<ElementViewPropertyDefinitionColumn>, "elementDataViewId">
58
- | OmitStrict<DbUpdate<ElementViewThemeColumn>, "elementDataViewId">;
@@ -1,2 +0,0 @@
1
- export * from "./column";
2
- export * from "./view";
@@ -1,19 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
- import { OmitStrict } from "../../utils";
4
- import { ElementPropertyTargetType } from "../properties";
5
-
6
- export const ElementView = z.object({
7
- id: z.string(),
8
- persistentId: z.string(),
9
- designSystemVersionId: z.string(),
10
- name: z.string(),
11
- description: z.string(),
12
- targetElementType: ElementPropertyTargetType,
13
- isDefault: z.boolean(),
14
- });
15
-
16
- export type ElementView = z.infer<typeof ElementView>;
17
-
18
- export type CreateElementView = DbCreateInputOmit<ElementView>;
19
- export type UpdateElementView = OmitStrict<DbUpdate<ElementView>, "designSystemVersionId" | "targetElementType">;
@@ -1,31 +0,0 @@
1
- import { z } from "zod";
2
- import { DesignSystem } from "../dsm/design-system";
3
- import { User } from "../users/user";
4
- import { Workspace } from "../workspace";
5
- import { WorkspaceRoleSchema } from "../workspace/workspace-role";
6
-
7
- /**
8
- * Object describing who is going to receive the email.
9
- *
10
- * Normally recepient is just an email, however in some cases email can be tailored
11
- * for who receives it. In this case the email has cutomization based on the role of the
12
- * recepient in the workspace (or design design system).
13
- */
14
- export const DesignSystemInviteEmailRecipient = z.object({
15
- email: z.string(),
16
- role: WorkspaceRoleSchema,
17
- });
18
-
19
- /**
20
- * Object describing the necessary data to send an email notifying a user that
21
- * they've been added to a design system.
22
- */
23
- export const DesignSystemInviteEmailData = z.object({
24
- workspace: Workspace,
25
- designSystem: DesignSystem,
26
- invitedBy: User,
27
- documentationDomain: z.string().optional(),
28
- });
29
-
30
- export type DesignSystemInviteEmailRecipient = z.infer<typeof DesignSystemInviteEmailRecipient>;
31
- export type DesignSystemInviteEmailData = z.infer<typeof DesignSystemInviteEmailData>;
@@ -1,2 +0,0 @@
1
- export * from "./design-system-invite";
2
- export * from "./workspace-invite";
@@ -1,29 +0,0 @@
1
- import { z } from "zod";
2
- import { User } from "../users/user";
3
- import { Workspace } from "../workspace/workspace";
4
- import { WorkspaceRoleSchema } from "../workspace/workspace-role";
5
-
6
- /**
7
- * Object describing who is going to receive the email.
8
- *
9
- * Normally recepient is just an email, however in some cases email can be tailored
10
- * for who receives it. In this case the email has cutomization based on the role of the
11
- * recepient in the workspace.
12
- */
13
- export const WorkspaceInviteEmailRecipient = z.object({
14
- email: z.string(),
15
- role: WorkspaceRoleSchema,
16
- });
17
-
18
- /**
19
- * Object describing the necessary data to send an email notifying a user that
20
- * they've been added to a workspace.
21
- */
22
- export const WorkspaceInviteEmailData = z.object({
23
- workspace: Workspace,
24
- invitedBy: User,
25
- documentationDomain: z.string().optional(),
26
- });
27
-
28
- export type WorkspaceInviteEmailRecipient = z.infer<typeof WorkspaceInviteEmailRecipient>;
29
- export type WorkspaceInviteEmailData = z.infer<typeof WorkspaceInviteEmailData>;
@@ -1,7 +0,0 @@
1
- import { z } from "zod";
2
- import { EventDataSourceImported } from "./data-source-imported";
3
- import { EventVersionReleased } from "./version-released";
4
-
5
- export const Event = z.discriminatedUnion("type", [EventVersionReleased, EventDataSourceImported]);
6
-
7
- export type Event = z.infer<typeof Event>;