@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,9 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const EventDataSourceImported = z.object({
4
- type: z.literal("DataSourceImported"),
5
- workspaceId: z.string(),
6
- designSystemId: z.string(),
7
- });
8
-
9
- export type EventDataSourceImported = z.infer<typeof EventDataSourceImported>;
@@ -1,3 +0,0 @@
1
- export * from "./base";
2
- export * from "./data-source-imported";
3
- export * from "./version-released";
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const EventVersionReleased = z.object({
4
- type: z.literal("DesignSystemVersionReleased"),
5
- workspaceId: z.string(),
6
- designSystemId: z.string(),
7
- versionId: z.string(),
8
- });
9
-
10
- export type EventVersionReleased = z.infer<typeof EventVersionReleased>;
@@ -1,127 +0,0 @@
1
- import { z } from "zod";
2
- import { PublishedDocEnvironment } from "../dsm";
3
- import { nullishToOptional } from "../helpers";
4
-
5
- const BITBUCKET_SLUG = /^[-a-zA-Z0-9~]*$/;
6
- const BITBUCKET_MAX_LENGTH = 64;
7
-
8
- export const ExportJobDocumentationChanges = z.object({
9
- pagePersistentIds: z.string().array(),
10
- groupPersistentIds: z.string().array(),
11
- });
12
-
13
- export const ExporterDestinationDocs = z.object({
14
- environment: PublishedDocEnvironment,
15
- changes: nullishToOptional(ExportJobDocumentationChanges),
16
- });
17
-
18
- export const ExporterDestinationS3 = z.object({});
19
-
20
- export const ExporterDestinationGithub = z.object({
21
- credentialId: z.string().optional(),
22
-
23
- // Repository
24
- url: z.string(),
25
-
26
- // Location
27
- branch: z.string(),
28
- relativePath: nullishToOptional(z.string()),
29
- purgeDirectory: nullishToOptional(z.boolean()),
30
-
31
- // Commit metadata
32
- commitAuthorName: nullishToOptional(z.string()),
33
- commitAuthorEmail: nullishToOptional(z.string()),
34
-
35
- // Legacy deprecated fields. Use `credentialId` instead
36
- connectionId: nullishToOptional(z.string()),
37
- userId: nullishToOptional(z.number()),
38
- });
39
-
40
- export const ExporterDestinationAzure = z.object({
41
- credentialId: z.string().optional(),
42
-
43
- // Repository
44
- organizationId: z.string(),
45
- projectId: z.string(),
46
- repositoryId: z.string(),
47
-
48
- // Commit metadata
49
- commitAuthorName: nullishToOptional(z.string()),
50
- commitAuthorEmail: nullishToOptional(z.string()),
51
-
52
- // Location
53
- branch: z.string(),
54
- relativePath: nullishToOptional(z.string()),
55
- purgeDirectory: nullishToOptional(z.boolean()),
56
-
57
- // Maybe not needed
58
- url: nullishToOptional(z.string()),
59
-
60
- // Legacy deprecated fields. Use `credentialId` instead
61
- connectionId: nullishToOptional(z.string()),
62
- userId: nullishToOptional(z.number()),
63
- });
64
-
65
- export const ExporterDestinationGitlab = z.object({
66
- credentialId: z.string().optional(),
67
-
68
- // Repository
69
- projectId: z.string(),
70
-
71
- // Commit metadata
72
- commitAuthorName: nullishToOptional(z.string()),
73
- commitAuthorEmail: nullishToOptional(z.string()),
74
-
75
- // Location
76
- branch: z.string(),
77
- relativePath: nullishToOptional(z.string()),
78
- purgeDirectory: nullishToOptional(z.boolean()),
79
-
80
- // Maybe not needed
81
- url: nullishToOptional(z.string()),
82
-
83
- // Legacy deprecated fields. Use `credentialId` instead
84
- connectionId: nullishToOptional(z.string()),
85
- userId: nullishToOptional(z.number()),
86
- });
87
-
88
- export const ExporterDestinationBitbucket = z.object({
89
- credentialId: z.string().optional(),
90
-
91
- // Repository
92
- workspaceSlug: z.string().max(BITBUCKET_MAX_LENGTH).regex(BITBUCKET_SLUG),
93
- projectKey: z.string().max(BITBUCKET_MAX_LENGTH).regex(BITBUCKET_SLUG),
94
- repoSlug: z.string().max(BITBUCKET_MAX_LENGTH).regex(BITBUCKET_SLUG),
95
-
96
- // Commit metadata
97
- commitAuthorName: nullishToOptional(z.string()),
98
- commitAuthorEmail: nullishToOptional(z.string()),
99
-
100
- // Location
101
- branch: z.string(),
102
- relativePath: nullishToOptional(z.string()),
103
- purgeDirectory: nullishToOptional(z.boolean()),
104
-
105
- // Legacy deprecated fields. Use `credentialId` instead
106
- connectionId: nullishToOptional(z.string()),
107
- userId: nullishToOptional(z.number()),
108
- });
109
-
110
- export const ExportDestinationsMap = z.object({
111
- webhookUrl: z.string().optional(),
112
- destinationSnDocs: ExporterDestinationDocs.optional(),
113
- destinationS3: ExporterDestinationS3.optional(),
114
- destinationGithub: ExporterDestinationGithub.optional(),
115
- destinationAzure: ExporterDestinationAzure.optional(),
116
- destinationGitlab: ExporterDestinationGitlab.optional(),
117
- destinationBitbucket: ExporterDestinationBitbucket.optional(),
118
- });
119
-
120
- export type ExportJobDocumentationChanges = z.infer<typeof ExportJobDocumentationChanges>;
121
- export type ExporterDestinationDocs = z.infer<typeof ExporterDestinationDocs>;
122
- export type ExporterDestinationS3 = z.infer<typeof ExporterDestinationS3>;
123
- export type ExporterDestinationGithub = z.infer<typeof ExporterDestinationGithub>;
124
- export type ExporterDestinationAzure = z.infer<typeof ExporterDestinationAzure>;
125
- export type ExporterDestinationGitlab = z.infer<typeof ExporterDestinationGitlab>;
126
- export type ExporterDestinationBitbucket = z.infer<typeof ExporterDestinationBitbucket>;
127
- export type ExportDestinationsMap = z.infer<typeof ExportDestinationsMap>;
@@ -1,122 +0,0 @@
1
- import { z } from "zod";
2
- import { PublishedDocEnvironment } from "../dsm";
3
- import { DbCreateInputOmit, DbUpdate, nullishToOptional } from "../helpers";
4
- import { ExportDestinationsMap } from "./export-destinations";
5
-
6
- //
7
- // Enums
8
- //
9
-
10
- export const ExportJobDestinationType = z.enum([
11
- "s3",
12
- "webhookUrl",
13
- "github",
14
- "documentation",
15
- "azure",
16
- "gitlab",
17
- "bitbucket",
18
- ]);
19
- export const ExportJobStatus = z.enum(["InProgress", "Success", "Failed", "Timeout"]);
20
- export const ExportJobLogEntryType = z.enum(["success", "info", "warning", "error", "user"]);
21
-
22
- export type ExportJobDestinationType = z.infer<typeof ExportJobDestinationType>;
23
- export type ExportJobStatus = z.infer<typeof ExportJobStatus>;
24
- export type ExportJobLogEntryType = z.infer<typeof ExportJobLogEntryType>;
25
-
26
- //
27
- // Results
28
- //
29
-
30
- export const ExportJobLogEntry = z.object({
31
- id: z.string().optional(),
32
- time: z.coerce.date(),
33
- type: ExportJobLogEntryType,
34
- message: z.string(),
35
- });
36
-
37
- export const ExportJobPullRequestDestinationResult = z.object({
38
- pullRequestUrl: z.string(),
39
- });
40
-
41
- export const ExportJobS3DestinationResult = z.object({
42
- bucket: z.string(),
43
- urlPrefix: z.string().optional(),
44
- path: z.string(),
45
- files: z.array(z.string()),
46
-
47
- url: nullishToOptional(z.string()),
48
- urls: nullishToOptional(z.string().array()),
49
- });
50
-
51
- export const ExportJobDocsDestinationResult = z.object({
52
- url: z.string(),
53
- });
54
-
55
- export const ExportJobResult = z.object({
56
- error: z.string().optional(),
57
- s3: nullishToOptional(ExportJobS3DestinationResult),
58
- github: nullishToOptional(ExportJobPullRequestDestinationResult),
59
- azure: nullishToOptional(ExportJobPullRequestDestinationResult),
60
- gitlab: nullishToOptional(ExportJobPullRequestDestinationResult),
61
- bitbucket: nullishToOptional(ExportJobPullRequestDestinationResult),
62
- sndocs: nullishToOptional(ExportJobDocsDestinationResult),
63
- logs: nullishToOptional(ExportJobLogEntry.array()),
64
- });
65
-
66
- export type ExportJobLogEntry = z.infer<typeof ExportJobLogEntry>;
67
- export type ExportJobPullRequestDestinationResult = z.infer<typeof ExportJobPullRequestDestinationResult>;
68
- export type ExportJobS3DestinationResult = z.infer<typeof ExportJobS3DestinationResult>;
69
- export type ExportJobDocsDestinationResult = z.infer<typeof ExportJobDocsDestinationResult>;
70
- export type ExportJobResult = z.infer<typeof ExportJobResult>;
71
-
72
- //
73
- // Job
74
- //
75
-
76
- export const ExportJob = z.object({
77
- id: z.string(),
78
- createdAt: z.coerce.date(),
79
- finishedAt: z.coerce.date().optional(),
80
- designSystemId: z.string(),
81
- designSystemVersionId: z.string(),
82
- workspaceId: z.string(),
83
- scheduleId: z.string().nullish(),
84
- exporterId: z.string(),
85
- brandId: z.string().optional(),
86
- themeId: z.string().optional(),
87
- themePersistentIds: z.string().array().optional(),
88
- estimatedExecutionTime: z.number().optional(),
89
- status: ExportJobStatus,
90
- result: ExportJobResult.optional(),
91
- createdByUserId: z.string().optional(),
92
-
93
- // Destinations
94
- ...ExportDestinationsMap.shape,
95
- });
96
-
97
- export type ExportJob = z.infer<typeof ExportJob>;
98
-
99
- export type CreateExportJob = DbCreateInputOmit<ExportJob>;
100
- export type UpdateExportJob = Pick<DbUpdate<ExportJob>, "id" | "status" | "result" | "finishedAt">;
101
-
102
- //
103
- // Support
104
- //
105
-
106
- export const ExportJobFindByFilter = ExportJob.pick({
107
- exporterId: true,
108
- designSystemVersionId: true,
109
- createdByUserId: true,
110
- status: true,
111
- scheduleId: true,
112
- designSystemId: true,
113
- themeId: true,
114
- brandId: true,
115
- })
116
- .extend({
117
- destinations: z.array(ExportJobDestinationType),
118
- docsEnvironment: PublishedDocEnvironment,
119
- })
120
- .partial();
121
-
122
- export type ExportJobFindByFilter = z.infer<typeof ExportJobFindByFilter>;
@@ -1,34 +0,0 @@
1
- import { z } from "zod";
2
- import { ExporterPropertyValue, PublishedDocEnvironment } from "../../dsm";
3
-
4
- export const ExportJobDocumentationContext = z.object({
5
- isSingleVersionDocs: z.boolean(),
6
- versionSlug: z.string(),
7
- environment: PublishedDocEnvironment,
8
- });
9
-
10
- export const ExportJobContext = z.object({
11
- apiUrl: z.string(),
12
- accessToken: z.string(),
13
-
14
- designSystemId: z.string(),
15
- designSystemName: z.string(),
16
- exporterId: z.string(),
17
- versionId: z.string(),
18
- brandId: z.string().optional(),
19
- themeId: z.string().optional(),
20
- themePersistentIds: z.string().array().optional(),
21
-
22
- exporterName: z.string(),
23
-
24
- documentation: ExportJobDocumentationContext.optional(),
25
- });
26
-
27
- export const ExportJobExporterConfiguration = z.object({
28
- exporterPackageUrl: z.string(),
29
- exporterPropertyValues: ExporterPropertyValue.array(),
30
- });
31
-
32
- export type ExportJobDocumentationContext = z.infer<typeof ExportJobDocumentationContext>;
33
- export type ExportJobExporterConfiguration = z.infer<typeof ExportJobExporterConfiguration>;
34
- export type ExportJobContext = z.infer<typeof ExportJobContext>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const ExporterFunctionPayload = z.object({
4
- exportJobId: z.string(),
5
- exportContextId: z.string(),
6
- designSystemId: z.string(),
7
- workspaceId: z.string(),
8
- });
9
-
10
- export type ExporterFunctionPayload = z.infer<typeof ExporterFunctionPayload>;
@@ -1,2 +0,0 @@
1
- export * from "./export-context";
2
- export * from "./exporter-payload";
@@ -1,4 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const ExporterWorkspaceMembershipRole = z.enum(["Owner", "OwnerArchived", "User"]);
4
- export type ExporterWorkspaceMembershipRole = z.infer<typeof ExporterWorkspaceMembershipRole>;
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- import { ExporterWorkspaceMembershipRole } from "./exporter-workspace-membership-role";
3
- import { DbCreateInputOmit } from "../helpers";
4
-
5
- export const ExporterWorkspaceMembership = z.object({
6
- id: z.string(),
7
- workspaceId: z.string(),
8
- exporterId: z.string(),
9
- role: ExporterWorkspaceMembershipRole,
10
- });
11
-
12
- export type ExporterWorkspaceMembership = z.infer<typeof ExporterWorkspaceMembership>;
13
-
14
- export type CreateExporterMembership = DbCreateInputOmit<ExporterWorkspaceMembership>;
@@ -1,55 +0,0 @@
1
- import { z } from "zod";
2
- import { nullishToOptional } from "../helpers";
3
- import { GitProvider } from "./git-providers";
4
- import { PulsarContributionConfigurationProperty, PulsarContributionVariant, PulsarCustomBlock } from "./pulsar";
5
-
6
- export const ExporterType = z.enum(["code", "documentation"]);
7
- export const ExporterSource = z.enum(["git", "upload"]);
8
- export const ExporterTag = z.string();
9
-
10
- export const ExporterPulsarDetails = z.object({
11
- description: z.string(),
12
- version: z.string(),
13
- routingVersion: nullishToOptional(z.string()),
14
- author: nullishToOptional(z.string()),
15
- organization: nullishToOptional(z.string()),
16
- homepage: nullishToOptional(z.string()),
17
- readme: nullishToOptional(z.string()),
18
- tags: nullishToOptional(z.array(ExporterTag)).default([]),
19
- packageId: nullishToOptional(z.string().max(255)),
20
-
21
- iconURL: nullishToOptional(z.string()),
22
- configurationProperties: nullishToOptional(z.array(PulsarContributionConfigurationProperty)).default([]),
23
- customBlocks: nullishToOptional(z.array(PulsarCustomBlock)).default([]),
24
- blockVariants: nullishToOptional(z.record(z.string(), z.array(PulsarContributionVariant))).default({}),
25
-
26
- usesBrands: nullishToOptional(z.boolean()).default(false),
27
- usesThemes: nullishToOptional(z.boolean()).default(false),
28
- usesLocale: nullishToOptional(z.boolean()).default(false),
29
- });
30
-
31
- export const ExporterDetails = ExporterPulsarDetails.extend({
32
- source: ExporterSource,
33
-
34
- gitProvider: nullishToOptional(GitProvider),
35
- gitUrl: nullishToOptional(z.string()),
36
- gitBranch: nullishToOptional(z.string()),
37
- gitDirectory: nullishToOptional(z.string()),
38
- });
39
-
40
- export const Exporter = z.object({
41
- id: z.string(),
42
- createdAt: z.coerce.date(),
43
- name: z.string(),
44
- isPrivate: z.boolean(),
45
- details: ExporterDetails,
46
- exporterType: nullishToOptional(ExporterType).default("code"),
47
- storagePath: nullishToOptional(z.string()).default(""),
48
- });
49
-
50
- export type ExporterType = z.infer<typeof ExporterType>;
51
- export type ExporterSource = z.infer<typeof ExporterSource>;
52
- export type ExporterTag = z.infer<typeof ExporterTag>;
53
- export type ExporterPulsarDetails = z.infer<typeof ExporterPulsarDetails>;
54
- export type ExporterDetails = z.infer<typeof ExporterDetails>;
55
- export type Exporter = z.infer<typeof Exporter>;
@@ -1,11 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export enum GitProviderNames {
4
- Azure = "azure",
5
- Github = "github",
6
- Gitlab = "gitlab",
7
- Bitbucket = "bitbucket",
8
- }
9
-
10
- export const GitProvider = z.nativeEnum(GitProviderNames);
11
- export type GitProvider = z.infer<typeof GitProvider>;
@@ -1,9 +0,0 @@
1
- export * from "./export-runner";
2
- export * from "./export-destinations";
3
- export * from "./export-jobs";
4
- export * from "./exporter-workspace-membership-role";
5
- export * from "./exporter-workspace-membership";
6
- export * from "./exporter";
7
- export * from "./git-providers";
8
- export * from "./pipeline";
9
- export * from "./pulsar";
@@ -1,34 +0,0 @@
1
- import { z } from "zod";
2
- import { ExportDestinationsMap } from "./export-destinations";
3
-
4
- export const PipelineEventType = z.enum(["OnVersionReleased", "OnHeadChanged", "OnSourceUpdated", "None"]);
5
-
6
- export const PipelineDestinationGitType = z.enum(["Github", "Gitlab", "Bitbucket", "Azure"]);
7
- export const PipelineDestinationExtraType = z.enum(["WebhookUrl", "S3", "Documentation"]);
8
- export const PipelineDestinationType = z.union([PipelineDestinationGitType, PipelineDestinationExtraType]);
9
-
10
- export const Pipeline = z.object({
11
- id: z.string(),
12
-
13
- name: z.string(),
14
- eventType: PipelineEventType,
15
- isEnabled: z.boolean(),
16
-
17
- workspaceId: z.string(),
18
- designSystemId: z.string(),
19
- exporterId: z.string(),
20
-
21
- brandPersistentId: z.string().optional(),
22
- themePersistentId: z.string().optional(),
23
- themePersistentIds: z.string().array().optional(),
24
-
25
- // Destinations
26
- ...ExportDestinationsMap.shape,
27
- });
28
-
29
- export type PipelineEventType = z.infer<typeof PipelineEventType>;
30
- export type PipelineDestinationGitType = z.infer<typeof PipelineDestinationGitType>;
31
- export type PipelineDestinationExtraType = z.infer<typeof PipelineDestinationExtraType>;
32
- export type PipelineDestinationType = z.infer<typeof PipelineDestinationType>;
33
-
34
- export type Pipeline = z.infer<typeof Pipeline>;
@@ -1,71 +0,0 @@
1
- import { z } from "zod";
2
- import { nullishToOptional } from "../helpers";
3
-
4
- //
5
- // Base
6
- //
7
-
8
- export const PulsarPropertyType = z.enum([
9
- "string",
10
- "number",
11
- "boolean",
12
- "image",
13
- "enum",
14
- "color",
15
- "typography",
16
- "component",
17
- "componentProperties",
18
- "tokenProperties",
19
- "tokenType",
20
- ]);
21
-
22
- export const PulsarBaseProperty = z.object({
23
- label: z.string(),
24
- key: z.string(),
25
- description: z.string().nullish(),
26
- type: PulsarPropertyType,
27
- values: z.array(z.string()).nullish(),
28
- default: z.union([z.string(), z.boolean(), z.number()]).nullish(), // PulsarPropertyValueType //is optional?
29
- inputType: z.enum(["code", "plain"]).optional(), //is optional?
30
- isMultiline: z.boolean().nullish(),
31
- });
32
-
33
- //
34
- // Exporter custom properties
35
- //
36
-
37
- export const PulsarContributionConfigurationProperty = PulsarBaseProperty.extend({
38
- category: z.string(),
39
- });
40
-
41
- //
42
- // Exporter custom blocks
43
- //
44
-
45
- export const PulsarContributionVariant = z.object({
46
- key: z.string(),
47
- name: z.string(),
48
- isDefault: nullishToOptional(z.boolean()),
49
- description: nullishToOptional(z.string()),
50
- thumbnailURL: nullishToOptional(z.string()),
51
- });
52
-
53
- export const PulsarCustomBlock = z.object({
54
- title: nullishToOptional(z.string()),
55
- key: z.string(),
56
- category: nullishToOptional(z.string()),
57
- description: nullishToOptional(z.string()),
58
- iconURL: nullishToOptional(z.string()),
59
- mode: nullishToOptional(z.enum(["array", "block"])),
60
- properties: nullishToOptional(z.array(PulsarBaseProperty)).transform(v => v ?? []),
61
- });
62
-
63
- //
64
- // Types
65
- //
66
-
67
- export type PulsarContributionVariant = z.infer<typeof PulsarContributionVariant>;
68
- export type PulsarPropertyType = z.infer<typeof PulsarPropertyType>;
69
- export type PulsarBaseProperty = z.infer<typeof PulsarBaseProperty>;
70
- export type PulsarCustomBlock = z.infer<typeof PulsarCustomBlock>;
71
- export type PulsarContributionConfigurationProperty = z.infer<typeof PulsarContributionConfigurationProperty>;
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const FlaggedFeature = z.enum([
4
- "FigmaImporterV2",
5
- "ShadowOpacityOptional",
6
- "DisableImporter",
7
- "VariablesOrder",
8
- "TypographyPropsKeepAliases",
9
- ]);
10
- export const FeatureFlagMap = z.record(FlaggedFeature, z.boolean());
11
- export const FeatureFlag = z.object({
12
- id: z.string(),
13
- feature: FlaggedFeature,
14
- createdAt: z.coerce.date(),
15
- enabled: z.boolean(),
16
- designSystemId: z.string().optional(),
17
- });
18
-
19
- export type FlaggedFeature = z.infer<typeof FlaggedFeature>;
20
- export type FeatureFlagMap = z.infer<typeof FeatureFlagMap>;
21
- export type FeatureFlag = z.infer<typeof FeatureFlag>;
@@ -1 +0,0 @@
1
- export * from "./feature-flags";
package/src/helpers/db.ts DELETED
@@ -1,82 +0,0 @@
1
- export type DbCreateInputOmit<T> = Omit<T, "id" | "createdAt" | "updatedAt">;
2
-
3
- export type DbUpdateInputOmit<T> = Omit<T, "createdAt" | "updatedAt" | "persistentId">;
4
-
5
- export type DbUpdate<T extends { id: string }> = Partial<OptionalToNullable<DbUpdateInputOmit<Omit<T, "id">>>> &
6
- Pick<T, "id">;
7
-
8
- type PickOptional<T> = {
9
- [P in keyof T as undefined extends T[P] ? P : never]: T[P];
10
- };
11
-
12
- type PickNotOptional<T> = {
13
- [P in keyof T as undefined extends T[P] ? never : P]: T[P];
14
- };
15
-
16
- export type OptionalToNullable<T> = {
17
- [K in keyof PickOptional<T>]-?: Exclude<T[K], undefined> | null;
18
- } & {
19
- [K in keyof PickNotOptional<T>]: T[K];
20
- };
21
-
22
- export function zodCreateInputOmit() {
23
- return {
24
- id: true,
25
- createdAt: true,
26
- updatedAt: true,
27
- } as const;
28
- }
29
-
30
- export function zodUpdateInputOmit() {
31
- return {
32
- id: true,
33
- createdAt: true,
34
- updatedAt: true,
35
- persistentId: true,
36
- } as const;
37
- }
38
-
39
- // function zodCreate<
40
- // T extends ZodRawShape,
41
- // UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
42
- // Catchall extends ZodTypeAny = ZodTypeAny,
43
- // O = objectOutputType<T, Catchall, UnknownKeys>,
44
- // I = objectInputType<T, Catchall, UnknownKeys>
45
- // >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
46
- // return schema.omit(zodCreateInputOmit());
47
- // }
48
-
49
- // /**
50
- // * Don't use it yet, produces too complex type
51
- // */
52
- // function zodUpdate<
53
- // T extends ZodRawShape,
54
- // UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
55
- // Catchall extends ZodTypeAny = ZodTypeAny,
56
- // O = objectOutputType<T, Catchall, UnknownKeys>,
57
- // I = objectInputType<T, Catchall, UnknownKeys>
58
- // >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
59
- // const hue = schema.omit(zodUpdateInputOmit());
60
- // return makeOptionalPropsNullable(hue).partial();
61
- // }
62
-
63
- // function makeOptionalPropsNullable<Schema extends z.AnyZodObject>(schema: Schema) {
64
- // type SchemaType = typeof schema;
65
-
66
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
67
- // const entries = Object.entries(schema.shape) as [keyof SchemaType["shape"], z.ZodTypeAny][];
68
- // const newProps = entries.reduce(
69
- // (acc, [key, value]) => {
70
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
71
- // acc[key] = value instanceof z.ZodOptional ? value.unwrap().nullable() : value;
72
- // return acc;
73
- // },
74
- // {} as {
75
- // [key in keyof SchemaType["shape"]]: SchemaType["shape"][key] extends z.ZodOptional<infer T>
76
- // ? z.ZodNullable<T>
77
- // : SchemaType["shape"][key];
78
- // }
79
- // );
80
-
81
- // return z.object(newProps);
82
- // }
@@ -1,2 +0,0 @@
1
- export * from "./db";
2
- export * from "./nullish-to-optional";
@@ -1,9 +0,0 @@
1
- import { ZodType, ZodTypeDef } from "zod";
2
-
3
- /**
4
- * Allows both null and undefined as input values in addition to the actual value,
5
- * but coerces them both to undefined.
6
- */
7
- export function nullishToOptional<I, O>(type: ZodType<I, ZodTypeDef, O>) {
8
- return type.nullish().transform(t => t ?? undefined);
9
- }
package/src/index.ts DELETED
@@ -1,20 +0,0 @@
1
- export * from "./asset-delete-schedule";
2
- export * from "./auth";
3
- export * from "./billing";
4
- export * from "./common";
5
- export * from "./custom-domains";
6
- export * from "./data-dumps";
7
- export * from "./docs-server";
8
- export * from "./dsm";
9
- export * from "./emails";
10
- export * from "./events";
11
- export * from "./export";
12
- export * from "./feature-flags";
13
- export * from "./helpers";
14
- export * from "./integrations";
15
- export * from "./liveblocks";
16
- export * from "./npm";
17
- export * from "./tokens";
18
- export * from "./users";
19
- export * from "./utils";
20
- export * from "./workspace";