@supernova-studio/model 1.0.0 → 1.0.1

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,12 +0,0 @@
1
- import { z } from "zod";
2
- import { OAuthProviderSchema } from "./oauth-providers";
3
-
4
- export const ExternalOAuthRequest = z.object({
5
- id: z.string(),
6
- provider: OAuthProviderSchema,
7
- userId: z.string(),
8
- state: z.string(),
9
- createdAt: z.coerce.date(),
10
- });
11
-
12
- export type ExternalOAuthRequest = z.infer<typeof ExternalOAuthRequest>;
@@ -1,49 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const GitObjectsQuery = z.object({
4
- organization: z.string().optional(), // Azure Organization | Bitbucket Workspace slug | Gitlab Group | Github Account (User or Organization)
5
- project: z.string().optional(), // Only for Bitbucket and Azure
6
- repository: z.string().optional(), // For all providers. For Gitlab, it's called "project".
7
- branch: z.string().optional(), // For all providers.
8
- user: z.string().optional(), // Gitlab user
9
- });
10
-
11
- export type GitObjectsQuery = z.infer<typeof GitObjectsQuery>;
12
-
13
- export const GitOrganization = z.object({
14
- id: z.string(),
15
- name: z.string(),
16
- url: z.string(),
17
- slug: z.string(),
18
- });
19
-
20
- export const GitProject = z.object({
21
- id: z.string(),
22
- name: z.string(),
23
- url: z.string(),
24
- slug: z.string(),
25
- });
26
-
27
- export const GitRepository = z.object({
28
- id: z.string(),
29
- name: z.string(),
30
- url: z.string(),
31
- slug: z.string(),
32
-
33
- /**
34
- * Can be undefined when:
35
- * - there are no branches in the repository yet
36
- * - Git provider doesn't expose this information on a repository via their API
37
- */
38
- defaultBranch: z.string().optional(),
39
- });
40
-
41
- export const GitBranch = z.object({
42
- name: z.string(),
43
- lastCommitId: z.string(),
44
- });
45
-
46
- export type GitOrganization = z.infer<typeof GitOrganization>;
47
- export type GitProject = z.infer<typeof GitProject>;
48
- export type GitRepository = z.infer<typeof GitRepository>;
49
- export type GitBranch = z.infer<typeof GitBranch>;
@@ -1,6 +0,0 @@
1
- export * from "./external-oauth-request";
2
- export * from "./git";
3
- export * from "./integration";
4
- export * from "./oauth-providers";
5
- export * from "./oauth-token";
6
- export * from "./workspace-oauth-requests";
@@ -1,143 +0,0 @@
1
- import { z } from "zod";
2
- import { nullishToOptional } from "../helpers";
3
- import { UserMinified } from "../users/user-minified";
4
- import { tryParseUrl } from "../utils";
5
-
6
- export const IntegrationDesignSystem = z.object({
7
- designSystemId: z.string(),
8
- brandId: z.string(),
9
- title: z.string().optional(),
10
- userId: z.string().optional(),
11
- date: z.coerce.date().optional(),
12
- });
13
-
14
- export type IntegrationDesignSystem = z.infer<typeof IntegrationDesignSystem>;
15
-
16
- export const IntegrationCredentialsType = z.enum(["OAuth2", "PAT"]);
17
- export type IntegrationCredentialsType = z.infer<typeof IntegrationCredentialsType>;
18
-
19
- export const IntegrationCredentialsState = z.enum(["Active", "Inactive"]);
20
- export type IntegrationCredentialsState = z.infer<typeof IntegrationCredentialsState>;
21
-
22
- export const IntegrationCredentialsProfile = z.object({
23
- id: nullishToOptional(z.string()),
24
- email: nullishToOptional(z.string()),
25
- handle: nullishToOptional(z.string()),
26
- type: nullishToOptional(z.string()),
27
- avatarUrl: nullishToOptional(z.string()),
28
- organization: nullishToOptional(z.string()),
29
- collection: nullishToOptional(z.string()),
30
- });
31
-
32
- export type IntegrationCredentialsProfile = z.infer<typeof IntegrationCredentialsProfile>;
33
-
34
- export const IntegrationCredentials = z.object({
35
- id: z.string(),
36
- type: IntegrationCredentialsType,
37
- integrationId: z.string(),
38
- accessToken: z.string(),
39
- userId: z.string(),
40
- createdAt: z.coerce.date(),
41
- refreshToken: z.string().optional(),
42
- tokenName: z.string().optional(),
43
- expiresAt: z.coerce.date().optional(),
44
- refreshedAt: z.coerce.date().optional(),
45
- username: z.string().optional(),
46
- appInstallationId: z.string().optional(),
47
- profile: IntegrationCredentialsProfile.optional(),
48
- customUrl: z.string().optional(),
49
- state: IntegrationCredentialsState,
50
-
51
- user: UserMinified.optional(),
52
- });
53
-
54
- export type IntegrationCredentials = z.infer<typeof IntegrationCredentials>;
55
-
56
- export const ExtendedIntegrationType = z.enum([
57
- "Figma",
58
- "Github",
59
- "Gitlab",
60
- "Bitbucket",
61
- "Azure",
62
- "TokenStudio",
63
- "FigmaVariablesPlugin",
64
- ]);
65
- export type ExtendedIntegrationType = z.infer<typeof ExtendedIntegrationType>;
66
-
67
- export const IntegrationType = ExtendedIntegrationType.exclude(["TokenStudio", "FigmaVariablesPlugin"]);
68
- export type IntegrationType = z.infer<typeof IntegrationType>;
69
-
70
- export const GitIntegrationType = IntegrationType.exclude(["Figma"]);
71
- export type GitIntegrationType = z.infer<typeof GitIntegrationType>;
72
-
73
- export const Integration = z.object({
74
- id: z.string(),
75
- workspaceId: z.string(),
76
- type: IntegrationType,
77
- createdAt: z.coerce.date(),
78
- integrationCredentials: z.array(IntegrationCredentials).optional(),
79
- });
80
- export type Integration = z.infer<typeof Integration>;
81
- export type ExtendedIntegration = Omit<Integration, "type"> & {
82
- type: ExtendedIntegrationType;
83
- integrationDesignSystems?: IntegrationDesignSystem[];
84
- };
85
-
86
- export const IntegrationToken = z
87
- .object({
88
- access_token: z.string(),
89
- refresh_token: z.string().optional(),
90
- expires_in: z.union([z.number().optional(), z.string().optional()]),
91
- token_type: z.string().optional(),
92
- token_name: z.string().optional(),
93
- token_azure_organization_name: z.string().optional(), // Azure Cloud PAT only
94
- token_azure_collection_name: z.string().optional(), // Azure Server PAT only
95
- token_bitbucket_username: z.string().optional(), // Bitbucket only
96
- custom_url: z
97
- .string()
98
- .optional()
99
- .transform(value => {
100
- if (!value?.trim()) return undefined;
101
- return formatCustomUrl(value);
102
- }),
103
- })
104
- .refine(data => {
105
- return !data.custom_url || tryParseUrl(data.custom_url);
106
- }, "Custom URL must be a valid URL")
107
- .refine(data => {
108
- if (data.custom_url && data.token_azure_organization_name) {
109
- return false;
110
- }
111
- return true;
112
- }, "Custom URL and Azure organization name cannot be present at the same time")
113
- .transform(data => {
114
- return {
115
- accessToken: data.access_token,
116
- refreshToken: data.refresh_token,
117
- expiresIn: typeof data.expires_in === "string" ? Number(data.expires_in) : data.expires_in,
118
- tokenType: data.token_type,
119
- tokenName: data.token_name,
120
- tokenBitbucketUsername: data.token_bitbucket_username,
121
- tokenAzureOrganizationName: data.token_azure_organization_name,
122
- tokenAzureCollection: data.token_azure_collection_name,
123
- customUrl: data.custom_url,
124
- };
125
- });
126
-
127
- export type IntegrationToken = z.infer<typeof IntegrationToken>;
128
-
129
- // Custom URL validation
130
- const forbiddenCustomUrlDomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
131
-
132
- function formatCustomUrl(url: string): string | undefined {
133
- let formattedUrl = url.trim().toLowerCase();
134
- if (!formattedUrl.startsWith("http://") && !formattedUrl.startsWith("https://")) {
135
- formattedUrl = "https://" + formattedUrl;
136
- }
137
- if (formattedUrl.endsWith("/")) {
138
- formattedUrl = formattedUrl.slice(0, -1);
139
- }
140
-
141
- // do not store default urls that we incorrectly provided as custom urls
142
- return forbiddenCustomUrlDomainList.some(domain => formattedUrl.includes(domain)) ? undefined : formattedUrl;
143
- }
@@ -1,13 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export enum OAuthProviderNames {
4
- Figma = "figma",
5
- Azure = "azure",
6
- Github = "github",
7
- Gitlab = "gitlab",
8
- Bitbucket = "bitbucket",
9
- }
10
-
11
- export const OAuthProviderSchema = z.nativeEnum(OAuthProviderNames);
12
- export type OAuthProvider = z.infer<typeof OAuthProviderSchema>;
13
- export const OAuthProvider = OAuthProviderSchema.enum;
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
- import { OAuthProviderSchema } from "./oauth-providers";
3
-
4
- export const IntegrationTokenSchemaOld = z.object({
5
- id: z.string(),
6
- provider: OAuthProviderSchema,
7
- scope: z.string(),
8
- userId: z.string(),
9
- accessToken: z.string(),
10
- refreshToken: z.string(),
11
- expiresAt: z.coerce.date(),
12
- externalUserId: z.string().nullish(),
13
- });
14
-
15
- // Renamed because will be deleted later after full migration / end of project
16
- export type IntegrationTokenOld = z.infer<typeof IntegrationTokenSchemaOld>;
@@ -1,12 +0,0 @@
1
- import { z } from "zod";
2
- import { OAuthProviderSchema } from "./oauth-providers";
3
-
4
- export const WorkspaceOAuthRequestSchema = z.object({
5
- id: z.string(),
6
- workspaceId: z.string(),
7
- provider: OAuthProviderSchema,
8
- userId: z.string(),
9
- createdAt: z.coerce.date(),
10
- });
11
-
12
- export type WorkspaceOAuthRequest = z.infer<typeof WorkspaceOAuthRequestSchema>;
@@ -1 +0,0 @@
1
- export * from "./rooms";
@@ -1,62 +0,0 @@
1
- import { z } from "zod";
2
- import { Entity } from "../../common/entity";
3
- import { DocumentationPageApproval, DocumentationPageSnapshot, ElementGroupSnapshot } from "../../dsm";
4
- import { DocumentationPageV2 } from "../../dsm/elements/documentation-page-v2";
5
- import { ElementGroup } from "../../dsm/elements/group";
6
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
7
-
8
- //
9
- // Room
10
- //
11
-
12
- export const DesignSystemVersionRoom = Entity.extend({
13
- designSystemVersionId: z.string(),
14
- liveblocksId: z.string(),
15
- });
16
-
17
- export type DesignSystemVersionRoom = z.infer<typeof DesignSystemVersionRoom>;
18
-
19
- export type CreateDesignSystemVersionRoom = DbCreateInputOmit<DesignSystemVersionRoom>;
20
- export type UpdateDesignSystemVersionRoom = DbUpdate<DesignSystemVersionRoom>;
21
-
22
- //
23
- // Room state
24
- //
25
-
26
- export const DesignSystemVersionRoomInternalSettings = z.object({
27
- routingVersion: z.string(),
28
- isDraftFeatureAdopted: z.boolean(),
29
- isApprovalFeatureEnabled: z.boolean(),
30
- approvalRequiredForPublishing: z.boolean(),
31
- });
32
-
33
- export const DesignSystemVersionRoomInitialState = z.object({
34
- pages: z.array(DocumentationPageV2),
35
- groups: z.array(ElementGroup),
36
-
37
- pageSnapshots: z.array(DocumentationPageSnapshot),
38
- groupSnapshots: z.array(ElementGroupSnapshot),
39
-
40
- pageApprovals: z.array(DocumentationPageApproval),
41
- internalSettings: DesignSystemVersionRoomInternalSettings,
42
- });
43
-
44
- export const DesignSystemVersionRoomUpdate = z.object({
45
- pages: z.array(DocumentationPageV2),
46
- groups: z.array(ElementGroup),
47
- pageIdsToDelete: z.array(z.string()),
48
- groupIdsToDelete: z.array(z.string()),
49
-
50
- pageSnapshots: z.array(DocumentationPageSnapshot),
51
- groupSnapshots: z.array(ElementGroupSnapshot),
52
- pageSnapshotIdsToDelete: z.array(z.string()),
53
- groupSnapshotIdsToDelete: z.array(z.string()),
54
- pageHashesToUpdate: z.record(z.string(), z.string()),
55
-
56
- pageApprovals: z.array(DocumentationPageApproval),
57
- pageApprovalIdsToDelete: z.array(z.string()),
58
- });
59
-
60
- export type DesignSystemVersionRoomInternalSettings = z.infer<typeof DesignSystemVersionRoomInternalSettings>;
61
- export type DesignSystemVersionRoomInitialState = z.infer<typeof DesignSystemVersionRoomInitialState>;
62
- export type DesignSystemVersionRoomUpdate = z.infer<typeof DesignSystemVersionRoomUpdate>;
@@ -1,65 +0,0 @@
1
- import { z } from "zod";
2
- import { Entity } from "../../common/entity";
3
- import { DocumentationPageContentData } from "../../dsm";
4
- import { PageBlockDefinition } from "../../dsm/documentation/block-definitions/definition";
5
- import { PageSectionEditorModelV2 } from "../../dsm/elements/data/documentation-section-v2";
6
- import { DocumentationItemConfigurationV2 } from "../../dsm/elements/data/documentation-v2";
7
- import { DocumentationPageV2 } from "../../dsm/elements/documentation-page-v2";
8
- import { ElementGroup } from "../../dsm/elements/group";
9
- import { PageBlockEditorModelV2 } from "../../dsm/elements/page-block-v2";
10
- import { DbCreateInputOmit, DbUpdate } from "../../helpers";
11
- import { OmitStrict } from "../../utils";
12
-
13
- export const DocumentationPageRoom = Entity.extend({
14
- designSystemVersionId: z.string(),
15
- documentationPageId: z.string(),
16
- liveblocksId: z.string(),
17
- isDirty: z.boolean(),
18
- });
19
-
20
- export type DocumentationPageRoom = z.infer<typeof DocumentationPageRoom>;
21
-
22
- export type CreateDocumentationPageRoom = DbCreateInputOmit<DocumentationPageRoom>;
23
- export type UpdateDocumentationPageRoom = OmitStrict<
24
- DbUpdate<DocumentationPageRoom>,
25
- "designSystemVersionId" | "documentationPageId" | "liveblocksId"
26
- >;
27
-
28
- //
29
- // Room content
30
- //
31
-
32
- export const DocumentationPageRoomState = z.object({
33
- pageItems: z.array(PageBlockEditorModelV2.or(PageSectionEditorModelV2)),
34
- itemConfiguration: DocumentationItemConfigurationV2,
35
- });
36
-
37
- export const DocumentationPageRoomRoomUpdate = z.object({
38
- page: DocumentationPageV2,
39
- pageParent: ElementGroup,
40
- });
41
-
42
- export const DocumentationPageRoomInitialStateUpdate = DocumentationPageRoomRoomUpdate.extend({
43
- pageItems: z.array(PageBlockEditorModelV2.or(PageSectionEditorModelV2)),
44
- blockDefinitions: z.array(PageBlockDefinition),
45
- });
46
-
47
- export const RestoredDocumentationPage = z.object({
48
- page: DocumentationPageV2,
49
- pageParent: ElementGroup,
50
- pageContent: DocumentationPageContentData,
51
- contentHash: z.string(),
52
- snapshotId: z.string(),
53
- roomId: z.string().optional(),
54
- });
55
-
56
- export const RestoredDocumentationGroup = z.object({
57
- group: ElementGroup,
58
- parent: ElementGroup,
59
- });
60
-
61
- export type DocumentationPageRoomState = z.infer<typeof DocumentationPageRoomState>;
62
- export type DocumentationPageRoomRoomUpdate = z.infer<typeof DocumentationPageRoomRoomUpdate>;
63
- export type DocumentationPageRoomInitialStateUpdate = z.infer<typeof DocumentationPageRoomInitialStateUpdate>;
64
- export type RestoredDocumentationPage = z.infer<typeof RestoredDocumentationPage>;
65
- export type RestoredDocumentationGroup = z.infer<typeof RestoredDocumentationGroup>;
@@ -1,4 +0,0 @@
1
- export * from "./design-system-version-room";
2
- export * from "./documentation-page-room";
3
- export * from "./room-type";
4
- export * from "./workspace-room";
@@ -1,12 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export enum RoomTypeEnum {
4
- DocumentationPage = "documentation-page",
5
- DesignSystemVersion = "design-system-version",
6
- Workspace = "workspace",
7
- }
8
-
9
- export const RoomTypeSchema = z.nativeEnum(RoomTypeEnum);
10
-
11
- export type RoomType = z.infer<typeof RoomTypeSchema>;
12
- export const RoomType = RoomTypeSchema.enum;
@@ -1,16 +0,0 @@
1
- //
2
- // Room
3
- //
4
-
5
- import { z } from "zod";
6
- import { Entity } from "../../common/entity";
7
- import { DbCreateInputOmit, DbUpdate } from "../../helpers/db";
8
-
9
- export const WorkspaceRoom = Entity.extend({
10
- workspaceId: z.string(),
11
- liveblocksId: z.string(),
12
- });
13
-
14
- export type WorkspaceRoom = z.infer<typeof WorkspaceRoom>;
15
- export type CreateWorkspaceRoom = DbCreateInputOmit<WorkspaceRoom>;
16
- export type UpdateWorkspaceRoom = DbUpdate<WorkspaceRoom>;
package/src/npm/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./npm-package";
2
- export * from "./npm-proxy-token-payload";
@@ -1,30 +0,0 @@
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>;
@@ -1,7 +0,0 @@
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>;
@@ -1 +0,0 @@
1
- export * from "./personal-access-token";
@@ -1,25 +0,0 @@
1
- import { z } from "zod";
2
- import { DbCreateInputOmit } from "../helpers";
3
- import { WorkspaceRoleSchema } from "../workspace";
4
-
5
- export const PersonalAccessToken = z.object({
6
- id: z.string(),
7
- userId: z.string(),
8
-
9
- workspaceId: z.string().optional(),
10
- designSystemId: z.string().optional(),
11
- workspaceRole: WorkspaceRoleSchema.optional(),
12
-
13
- name: z.string(),
14
- hidden: z.boolean(),
15
-
16
- token: z.string(),
17
- scope: z.string().optional(),
18
-
19
- createdAt: z.coerce.date(),
20
- expireAt: z.coerce.date().optional(),
21
- });
22
-
23
- export type PersonalAccessToken = z.infer<typeof PersonalAccessToken>;
24
-
25
- export type CreatePersonalAccessToken = DbCreateInputOmit<PersonalAccessToken>;
@@ -1,9 +0,0 @@
1
- export * from "./linked-integrations";
2
- export * from "./user-analytics-cleanup-schedule";
3
- export * from "./user-identity";
4
- export * from "./user-minified";
5
- export * from "./user-notification-settings";
6
- export * from "./user-profile";
7
- export * from "./user-test";
8
- export * from "./user-with-pat";
9
- export * from "./user";
@@ -1,36 +0,0 @@
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>;
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const UserAnalyticsCleanupSchedule = z.object({
4
- userId: z.string(),
5
- createdAt: z.coerce.date(),
6
- deleteAt: z.coerce.date(),
7
- });
8
-
9
- export type UserAnalyticsCleanupSchedule = z.infer<typeof UserAnalyticsCleanupSchedule>;
10
-
11
- export const UserAnalyticsCleanupScheduleDbInput = UserAnalyticsCleanupSchedule.omit({
12
- createdAt: true,
13
- });
14
-
15
- export type UserAnalyticsCleanupScheduleDbInput = z.infer<typeof UserAnalyticsCleanupScheduleDbInput>;
@@ -1,8 +0,0 @@
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>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const UserMinified = z.object({
4
- id: z.string(),
5
- name: z.string(),
6
- email: z.string(),
7
- avatar: z.string().optional(),
8
- });
9
-
10
- export type UserMinified = z.infer<typeof UserMinified>;
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const LiveblocksNotificationSettings = z.object({
4
- sendCommentNotificationEmails: z.boolean(),
5
- });
6
- export type LiveblocksNotificationSettings = z.infer<typeof LiveblocksNotificationSettings>;
7
-
8
- export const UserNotificationSettings = z.object({
9
- liveblocksNotificationSettings: LiveblocksNotificationSettings,
10
- });
11
-
12
- export type UserNotificationSettings = z.infer<typeof UserNotificationSettings>;
13
-
14
- export const defaultNotificationSettings: UserNotificationSettings = {
15
- liveblocksNotificationSettings: {
16
- sendCommentNotificationEmails: true,
17
- }
18
- } as const;
@@ -1,41 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const UserOnboardingDepartment = z.enum(["Design", "Engineering", "Product", "Brand", "Other"]);
4
- export const UserOnboardingJobLevel = z.enum(["Executive", "Manager", "IndividualContributor", "Other"]);
5
-
6
- export const UserOnboarding = z.object({
7
- companyName: z.string().optional(),
8
- numberOfPeopleInOrg: z.string().optional(),
9
- numberOfPeopleInDesignTeam: z.string().optional(),
10
- department: UserOnboardingDepartment.optional(),
11
- jobTitle: z.string().optional(),
12
- phase: z.string().optional(),
13
- jobLevel: UserOnboardingJobLevel.optional(),
14
- designSystemName: z.string().optional(),
15
- defaultDestination: z.string().optional(),
16
- figmaUrl: z.string().optional(),
17
- isPageDraftOnboardingFinished: z.boolean().optional(),
18
- isApprovalsOnboardingFinished: z.boolean().optional(),
19
- });
20
-
21
- export const UserProfile = z.object({
22
- name: z.string(),
23
- avatar: z.string().optional(),
24
- nickname: z.string().optional(),
25
- onboarding: UserOnboarding.optional(),
26
- });
27
-
28
- export type UserOnboardingDepartment = z.infer<typeof UserOnboardingDepartment>;
29
- export type UserOnboardingJobLevel = z.infer<typeof UserOnboardingJobLevel>;
30
- export type UserOnboarding = z.infer<typeof UserOnboarding>;
31
- export type UserProfile = z.infer<typeof UserProfile>;
32
-
33
- //
34
- // TO DELETE
35
- //
36
-
37
- export const UserProfileUpdate = UserProfile.partial().omit({
38
- avatar: true,
39
- });
40
-
41
- export type UserProfileUpdate = z.infer<typeof UserProfileUpdate>;
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const UserTest = z.object({
4
- id: z.string(),
5
- email: z.string(),
6
- });
7
-
8
- export type UserTest = z.infer<typeof UserTest>;
@@ -1,7 +0,0 @@
1
- import { User } from "./user";
2
- import { PersonalAccessToken } from "../tokens";
3
-
4
- export type PersonalAccessTokenWithUser = {
5
- user: User;
6
- token: PersonalAccessToken;
7
- };