@supernova-studio/client 1.96.5 → 1.96.7

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 (349) hide show
  1. package/dist/index.d.mts +101428 -143199
  2. package/dist/index.d.ts +101428 -143199
  3. package/dist/index.js +489 -99
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +5607 -5217
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +20 -9
  8. package/src/api/client.ts +62 -0
  9. package/src/api/conversion/analytics/index.ts +3 -0
  10. package/src/api/conversion/analytics/page-visits-to-comparison-dto.ts +65 -0
  11. package/src/api/conversion/analytics/page-visits-to-dto.ts +68 -0
  12. package/src/api/conversion/analytics/page-visits-to-heatmap-dto.ts +49 -0
  13. package/src/api/conversion/documentation/documentation-group-v1-to-dto.ts +114 -0
  14. package/src/api/conversion/documentation/documentation-group-v2-to-dto.ts +91 -0
  15. package/src/api/conversion/documentation/documentation-item-configuration-v1-to-dto.ts +52 -0
  16. package/src/api/conversion/documentation/documentation-item-configuration-v2-to-dto.ts +34 -0
  17. package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +134 -0
  18. package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +69 -0
  19. package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +84 -0
  20. package/src/api/conversion/documentation/documentation-settings-to-dto.ts +14 -0
  21. package/src/api/conversion/documentation/index.ts +8 -0
  22. package/src/api/conversion/export/index.ts +1 -0
  23. package/src/api/conversion/export/pipeline.ts +27 -0
  24. package/src/api/conversion/index.ts +4 -0
  25. package/src/api/conversion/integrations/git.ts +37 -0
  26. package/src/api/conversion/integrations/index.ts +2 -0
  27. package/src/api/conversion/integrations/integration.ts +37 -0
  28. package/src/api/dto/access-tokens/access-token.ts +45 -0
  29. package/src/api/dto/access-tokens/index.ts +1 -0
  30. package/src/api/dto/aux/color.ts +7 -0
  31. package/src/api/dto/aux/index.ts +4 -0
  32. package/src/api/dto/aux/meta.ts +8 -0
  33. package/src/api/dto/aux/object-metadata.ts +29 -0
  34. package/src/api/dto/aux/pagination.ts +8 -0
  35. package/src/api/dto/bff/app-bootstrap-data.ts +20 -0
  36. package/src/api/dto/bff/index.ts +1 -0
  37. package/src/api/dto/collections/index.ts +1 -0
  38. package/src/api/dto/collections/token-collection.ts +32 -0
  39. package/src/api/dto/design-systems/brand.ts +44 -0
  40. package/src/api/dto/design-systems/code-component-usage.ts +52 -0
  41. package/src/api/dto/design-systems/code-component.ts +101 -0
  42. package/src/api/dto/design-systems/code-history.ts +43 -0
  43. package/src/api/dto/design-systems/code-scan.ts +29 -0
  44. package/src/api/dto/design-systems/code-snapshots.ts +46 -0
  45. package/src/api/dto/design-systems/component.ts +40 -0
  46. package/src/api/dto/design-systems/contact.ts +11 -0
  47. package/src/api/dto/design-systems/data-source.ts +216 -0
  48. package/src/api/dto/design-systems/design-system.ts +75 -0
  49. package/src/api/dto/design-systems/documentation-search.ts +31 -0
  50. package/src/api/dto/design-systems/elements-diff.ts +14 -0
  51. package/src/api/dto/design-systems/figma-variables.ts +122 -0
  52. package/src/api/dto/design-systems/file.ts +71 -0
  53. package/src/api/dto/design-systems/import-job.ts +62 -0
  54. package/src/api/dto/design-systems/index.ts +24 -0
  55. package/src/api/dto/design-systems/members.ts +52 -0
  56. package/src/api/dto/design-systems/redirects.ts +33 -0
  57. package/src/api/dto/design-systems/role.ts +11 -0
  58. package/src/api/dto/design-systems/stats.ts +20 -0
  59. package/src/api/dto/design-systems/storybook.ts +45 -0
  60. package/src/api/dto/design-systems/user-design-systems.ts +10 -0
  61. package/src/api/dto/design-systems/version-room.ts +12 -0
  62. package/src/api/dto/design-systems/version.ts +56 -0
  63. package/src/api/dto/design-systems/view.ts +45 -0
  64. package/src/api/dto/design-tokens/design-token.ts +78 -0
  65. package/src/api/dto/design-tokens/index.ts +1 -0
  66. package/src/api/dto/documentation/analytics-v2.ts +80 -0
  67. package/src/api/dto/documentation/analytics.ts +32 -0
  68. package/src/api/dto/documentation/anchor.ts +15 -0
  69. package/src/api/dto/documentation/approvals.ts +21 -0
  70. package/src/api/dto/documentation/block-definition.ts +28 -0
  71. package/src/api/dto/documentation/block.ts +6 -0
  72. package/src/api/dto/documentation/documentation-page-snapshot.ts +18 -0
  73. package/src/api/dto/documentation/documentation.ts +34 -0
  74. package/src/api/dto/documentation/index.ts +11 -0
  75. package/src/api/dto/documentation/link-preview.ts +23 -0
  76. package/src/api/dto/documentation/publish.ts +23 -0
  77. package/src/api/dto/documentation/room.ts +12 -0
  78. package/src/api/dto/elements/components/figma-component-group.ts +19 -0
  79. package/src/api/dto/elements/components/figma-component.ts +56 -0
  80. package/src/api/dto/elements/components/index.ts +2 -0
  81. package/src/api/dto/elements/documentation/configuration.ts +20 -0
  82. package/src/api/dto/elements/documentation/draft-state.ts +37 -0
  83. package/src/api/dto/elements/documentation/group-action.ts +108 -0
  84. package/src/api/dto/elements/documentation/group-v1.ts +35 -0
  85. package/src/api/dto/elements/documentation/group-v2.ts +117 -0
  86. package/src/api/dto/elements/documentation/hierarchy.ts +25 -0
  87. package/src/api/dto/elements/documentation/index.ts +16 -0
  88. package/src/api/dto/elements/documentation/item-configuration-v1.ts +24 -0
  89. package/src/api/dto/elements/documentation/item-configuration-v2.ts +14 -0
  90. package/src/api/dto/elements/documentation/metadata.ts +8 -0
  91. package/src/api/dto/elements/documentation/page-actions-v2.ts +138 -0
  92. package/src/api/dto/elements/documentation/page-content.ts +15 -0
  93. package/src/api/dto/elements/documentation/page-dependencies.ts +30 -0
  94. package/src/api/dto/elements/documentation/page-v1.ts +21 -0
  95. package/src/api/dto/elements/documentation/page-v2.ts +132 -0
  96. package/src/api/dto/elements/documentation/settings.ts +9 -0
  97. package/src/api/dto/elements/documentation/structure.ts +37 -0
  98. package/src/api/dto/elements/elements-action-v2.ts +125 -0
  99. package/src/api/dto/elements/figma-nodes/figma-node-structure.ts +27 -0
  100. package/src/api/dto/elements/figma-nodes/figma-node-v1.ts +32 -0
  101. package/src/api/dto/elements/figma-nodes/figma-node-v2.ts +32 -0
  102. package/src/api/dto/elements/figma-nodes/figma-node.ts +103 -0
  103. package/src/api/dto/elements/figma-nodes/index.ts +5 -0
  104. package/src/api/dto/elements/figma-nodes/node-actions-v2.ts +25 -0
  105. package/src/api/dto/elements/frame-node-structures/frame-node-structure.ts +17 -0
  106. package/src/api/dto/elements/frame-node-structures/index.ts +1 -0
  107. package/src/api/dto/elements/get-elements-v2.ts +27 -0
  108. package/src/api/dto/elements/index.ts +7 -0
  109. package/src/api/dto/elements/properties/index.ts +2 -0
  110. package/src/api/dto/elements/properties/property-definitions.ts +75 -0
  111. package/src/api/dto/elements/properties/property-values.ts +50 -0
  112. package/src/api/dto/events/forge-project.ts +51 -0
  113. package/src/api/dto/events/index.ts +2 -0
  114. package/src/api/dto/events/workspace.ts +81 -0
  115. package/src/api/dto/export/exporter-property.ts +114 -0
  116. package/src/api/dto/export/exporter.ts +115 -0
  117. package/src/api/dto/export/filter.ts +20 -0
  118. package/src/api/dto/export/index.ts +5 -0
  119. package/src/api/dto/export/job.ts +114 -0
  120. package/src/api/dto/export/pipeline.ts +60 -0
  121. package/src/api/dto/figma-components/assets/download.ts +30 -0
  122. package/src/api/dto/figma-components/assets/index.ts +1 -0
  123. package/src/api/dto/figma-components/index.ts +1 -0
  124. package/src/api/dto/figma-exporter/figma-node.ts +11 -0
  125. package/src/api/dto/figma-exporter/index.ts +1 -0
  126. package/src/api/dto/files/files.ts +94 -0
  127. package/src/api/dto/files/index.ts +1 -0
  128. package/src/api/dto/forge/agent.ts +38 -0
  129. package/src/api/dto/forge/artifact.ts +94 -0
  130. package/src/api/dto/forge/feature-messages.ts +551 -0
  131. package/src/api/dto/forge/feature-room.ts +12 -0
  132. package/src/api/dto/forge/figma-node.ts +117 -0
  133. package/src/api/dto/forge/index.ts +28 -0
  134. package/src/api/dto/forge/iteration-message-old.ts +43 -0
  135. package/src/api/dto/forge/knowledge-item.ts +67 -0
  136. package/src/api/dto/forge/memory.ts +67 -0
  137. package/src/api/dto/forge/participant.ts +44 -0
  138. package/src/api/dto/forge/project-action.ts +123 -0
  139. package/src/api/dto/forge/project-artifact-room.ts +12 -0
  140. package/src/api/dto/forge/project-artifact.ts +85 -0
  141. package/src/api/dto/forge/project-context-feedback.ts +141 -0
  142. package/src/api/dto/forge/project-context-override.ts +41 -0
  143. package/src/api/dto/forge/project-context-scope.ts +23 -0
  144. package/src/api/dto/forge/project-context-v2.ts +228 -0
  145. package/src/api/dto/forge/project-context.ts +72 -0
  146. package/src/api/dto/forge/project-feature.ts +86 -0
  147. package/src/api/dto/forge/project-figma-node.ts +9 -0
  148. package/src/api/dto/forge/project-file.ts +48 -0
  149. package/src/api/dto/forge/project-invitation.ts +46 -0
  150. package/src/api/dto/forge/project-iteration-old.ts +54 -0
  151. package/src/api/dto/forge/project-member.ts +67 -0
  152. package/src/api/dto/forge/project-room.ts +12 -0
  153. package/src/api/dto/forge/project-section.ts +37 -0
  154. package/src/api/dto/forge/project.ts +105 -0
  155. package/src/api/dto/forge/relation.ts +34 -0
  156. package/src/api/dto/forge/threads.ts +153 -0
  157. package/src/api/dto/index.ts +25 -0
  158. package/src/api/dto/liveblocks/auth-response.ts +7 -0
  159. package/src/api/dto/liveblocks/index.ts +1 -0
  160. package/src/api/dto/mcp/index.ts +1 -0
  161. package/src/api/dto/mcp/stream.ts +17 -0
  162. package/src/api/dto/notifications/index.ts +2 -0
  163. package/src/api/dto/notifications/notifications.ts +65 -0
  164. package/src/api/dto/notifications/settings.ts +10 -0
  165. package/src/api/dto/portal/index.ts +1 -0
  166. package/src/api/dto/portal/portal-settings.ts +45 -0
  167. package/src/api/dto/sandboxes/index.ts +1 -0
  168. package/src/api/dto/sandboxes/template.ts +143 -0
  169. package/src/api/dto/storybook-sites/index.ts +1 -0
  170. package/src/api/dto/storybook-sites/storybook-sites.ts +60 -0
  171. package/src/api/dto/themes/index.ts +2 -0
  172. package/src/api/dto/themes/override.ts +27 -0
  173. package/src/api/dto/themes/theme.ts +53 -0
  174. package/src/api/dto/threads/index.ts +1 -0
  175. package/src/api/dto/threads/threads.ts +280 -0
  176. package/src/api/dto/trail-events/index.ts +1 -0
  177. package/src/api/dto/trail-events/trail-events.ts +172 -0
  178. package/src/api/dto/users/authenticated-user.ts +92 -0
  179. package/src/api/dto/users/index.ts +2 -0
  180. package/src/api/dto/users/user.ts +27 -0
  181. package/src/api/dto/workspaces/billing.ts +156 -0
  182. package/src/api/dto/workspaces/enums.ts +13 -0
  183. package/src/api/dto/workspaces/git.ts +32 -0
  184. package/src/api/dto/workspaces/index.ts +15 -0
  185. package/src/api/dto/workspaces/integrations.ts +34 -0
  186. package/src/api/dto/workspaces/invitations.ts +47 -0
  187. package/src/api/dto/workspaces/ip-whitelist.ts +33 -0
  188. package/src/api/dto/workspaces/knowledge-items-search.ts +37 -0
  189. package/src/api/dto/workspaces/login-screen.ts +42 -0
  190. package/src/api/dto/workspaces/membership.ts +55 -0
  191. package/src/api/dto/workspaces/npm-registry.ts +62 -0
  192. package/src/api/dto/workspaces/products.ts +45 -0
  193. package/src/api/dto/workspaces/subscription.ts +170 -0
  194. package/src/api/dto/workspaces/transfer-ownership.ts +7 -0
  195. package/src/api/dto/workspaces/untyped-data.ts +35 -0
  196. package/src/api/dto/workspaces/workspace.ts +49 -0
  197. package/src/api/endpoints/auth-tokens.ts +28 -0
  198. package/src/api/endpoints/codegen/codegen.ts +16 -0
  199. package/src/api/endpoints/codegen/ds-pipelines.ts +37 -0
  200. package/src/api/endpoints/codegen/exporters.ts +54 -0
  201. package/src/api/endpoints/codegen/index.ts +5 -0
  202. package/src/api/endpoints/codegen/jobs.ts +15 -0
  203. package/src/api/endpoints/codegen/pipelines.ts +55 -0
  204. package/src/api/endpoints/design-system/analytics.ts +14 -0
  205. package/src/api/endpoints/design-system/bff.ts +13 -0
  206. package/src/api/endpoints/design-system/code-snapshots.ts +47 -0
  207. package/src/api/endpoints/design-system/contact.ts +12 -0
  208. package/src/api/endpoints/design-system/design-systems.ts +90 -0
  209. package/src/api/endpoints/design-system/figma-node-structures.ts +20 -0
  210. package/src/api/endpoints/design-system/index.ts +11 -0
  211. package/src/api/endpoints/design-system/members.ts +24 -0
  212. package/src/api/endpoints/design-system/redirects.ts +46 -0
  213. package/src/api/endpoints/design-system/sources.ts +80 -0
  214. package/src/api/endpoints/design-system/storybook.ts +28 -0
  215. package/src/api/endpoints/design-system/versions/brands.ts +45 -0
  216. package/src/api/endpoints/design-system/versions/documentation.ts +107 -0
  217. package/src/api/endpoints/design-system/versions/ds-components.ts +30 -0
  218. package/src/api/endpoints/design-system/versions/elements-action.ts +65 -0
  219. package/src/api/endpoints/design-system/versions/elements.ts +27 -0
  220. package/src/api/endpoints/design-system/versions/figma-component-groups.ts +13 -0
  221. package/src/api/endpoints/design-system/versions/figma-components.ts +15 -0
  222. package/src/api/endpoints/design-system/versions/figma-frame-structures.ts +13 -0
  223. package/src/api/endpoints/design-system/versions/files.ts +43 -0
  224. package/src/api/endpoints/design-system/versions/import-jobs.ts +13 -0
  225. package/src/api/endpoints/design-system/versions/index.ts +19 -0
  226. package/src/api/endpoints/design-system/versions/overrides.ts +17 -0
  227. package/src/api/endpoints/design-system/versions/property-definitions.ts +43 -0
  228. package/src/api/endpoints/design-system/versions/property-values.ts +25 -0
  229. package/src/api/endpoints/design-system/versions/stats.ts +12 -0
  230. package/src/api/endpoints/design-system/versions/themes.ts +35 -0
  231. package/src/api/endpoints/design-system/versions/token-collections.ts +13 -0
  232. package/src/api/endpoints/design-system/versions/token-groups.ts +30 -0
  233. package/src/api/endpoints/design-system/versions/tokens.ts +29 -0
  234. package/src/api/endpoints/design-system/versions/versions.ts +90 -0
  235. package/src/api/endpoints/feedback.ts +60 -0
  236. package/src/api/endpoints/files.ts +25 -0
  237. package/src/api/endpoints/forge/agents.ts +54 -0
  238. package/src/api/endpoints/forge/artifacts.ts +54 -0
  239. package/src/api/endpoints/forge/documents.ts +18 -0
  240. package/src/api/endpoints/forge/feature-artifacts.ts +39 -0
  241. package/src/api/endpoints/forge/feature-iterations.ts +49 -0
  242. package/src/api/endpoints/forge/feature-messages.ts +68 -0
  243. package/src/api/endpoints/forge/features.ts +63 -0
  244. package/src/api/endpoints/forge/forge.ts +38 -0
  245. package/src/api/endpoints/forge/index.ts +16 -0
  246. package/src/api/endpoints/forge/iteration-tags.ts +13 -0
  247. package/src/api/endpoints/forge/memory.ts +41 -0
  248. package/src/api/endpoints/forge/project-contexts.ts +49 -0
  249. package/src/api/endpoints/forge/project-files.ts +41 -0
  250. package/src/api/endpoints/forge/project-invitations.ts +39 -0
  251. package/src/api/endpoints/forge/project-iterations.ts +65 -0
  252. package/src/api/endpoints/forge/project-members.ts +55 -0
  253. package/src/api/endpoints/forge/projects.ts +56 -0
  254. package/src/api/endpoints/index.ts +13 -0
  255. package/src/api/endpoints/liveblocks.ts +14 -0
  256. package/src/api/endpoints/mcp/index.ts +1 -0
  257. package/src/api/endpoints/mcp/streams.ts +21 -0
  258. package/src/api/endpoints/sandboxes/builds.ts +30 -0
  259. package/src/api/endpoints/sandboxes/index.ts +3 -0
  260. package/src/api/endpoints/sandboxes/sandboxes.ts +13 -0
  261. package/src/api/endpoints/sandboxes/templates.ts +16 -0
  262. package/src/api/endpoints/storybook-sites.ts +42 -0
  263. package/src/api/endpoints/threads.ts +38 -0
  264. package/src/api/endpoints/users.ts +26 -0
  265. package/src/api/endpoints/workspaces/billing.ts +24 -0
  266. package/src/api/endpoints/workspaces/chat-threads.ts +95 -0
  267. package/src/api/endpoints/workspaces/index.ts +9 -0
  268. package/src/api/endpoints/workspaces/integrations.ts +15 -0
  269. package/src/api/endpoints/workspaces/invites.ts +34 -0
  270. package/src/api/endpoints/workspaces/knowledge-items.ts +59 -0
  271. package/src/api/endpoints/workspaces/members.ts +31 -0
  272. package/src/api/endpoints/workspaces/npm-register.ts +20 -0
  273. package/src/api/endpoints/workspaces/subscription.ts +31 -0
  274. package/src/api/endpoints/workspaces/workspaces.ts +84 -0
  275. package/src/api/index.ts +6 -0
  276. package/src/api/payloads/design-systems/code-snapshots.ts +27 -0
  277. package/src/api/payloads/design-systems/index.ts +3 -0
  278. package/src/api/payloads/design-systems/update-design-system.ts +42 -0
  279. package/src/api/payloads/design-systems/version.ts +29 -0
  280. package/src/api/payloads/documentation/analytics.ts +36 -0
  281. package/src/api/payloads/documentation/block-definitions.ts +18 -0
  282. package/src/api/payloads/documentation/design-data-doc-diff.ts +7 -0
  283. package/src/api/payloads/documentation/index.ts +3 -0
  284. package/src/api/payloads/export/index.ts +1 -0
  285. package/src/api/payloads/export/pipeline.ts +111 -0
  286. package/src/api/payloads/index.ts +6 -0
  287. package/src/api/payloads/liveblocks/auth.ts +7 -0
  288. package/src/api/payloads/liveblocks/index.ts +1 -0
  289. package/src/api/payloads/users/index.ts +1 -0
  290. package/src/api/payloads/users/notifications/index.ts +1 -0
  291. package/src/api/payloads/users/notifications/notification-settings.ts +17 -0
  292. package/src/api/payloads/workspaces/index.ts +2 -0
  293. package/src/api/payloads/workspaces/workspace-configuration.ts +62 -0
  294. package/src/api/payloads/workspaces/workspace-integrations.ts +35 -0
  295. package/src/api/transport/index.ts +2 -0
  296. package/src/api/transport/request-executor-error.ts +60 -0
  297. package/src/api/transport/request-executor.ts +94 -0
  298. package/src/events/design-system.ts +21 -0
  299. package/src/events/event.ts +6 -0
  300. package/src/events/index.ts +2 -0
  301. package/src/index.ts +5 -0
  302. package/src/sync/docs-local-action-executor.ts +412 -0
  303. package/src/sync/docs-structure-repo.ts +283 -0
  304. package/src/sync/index.ts +5 -0
  305. package/src/sync/project-content-repo.ts +215 -0
  306. package/src/sync/project-local-action-executor.ts +415 -0
  307. package/src/sync/types.ts +37 -0
  308. package/src/utils/figma.ts +72 -0
  309. package/src/utils/hash.ts +62 -0
  310. package/src/utils/index.ts +4 -0
  311. package/src/utils/query.ts +41 -0
  312. package/src/utils/redirect-validation.ts +76 -0
  313. package/src/yjs/design-system-content/documentation-hierarchy.ts +35 -0
  314. package/src/yjs/design-system-content/index.ts +2 -0
  315. package/src/yjs/design-system-content/item-configuration.ts +62 -0
  316. package/src/yjs/docs-editor/blocks-to-prosemirror.ts +764 -0
  317. package/src/yjs/docs-editor/index.ts +7 -0
  318. package/src/yjs/docs-editor/list-tree-builder.ts +127 -0
  319. package/src/yjs/docs-editor/mock.ts +2271 -0
  320. package/src/yjs/docs-editor/model/block.ts +8 -0
  321. package/src/yjs/docs-editor/model/index.ts +2 -0
  322. package/src/yjs/docs-editor/model/page.ts +8 -0
  323. package/src/yjs/docs-editor/prosemirror/index.ts +3 -0
  324. package/src/yjs/docs-editor/prosemirror/inner-editor-schema.ts +145 -0
  325. package/src/yjs/docs-editor/prosemirror/main-editor-schema.ts +577 -0
  326. package/src/yjs/docs-editor/prosemirror/types.ts +19 -0
  327. package/src/yjs/docs-editor/prosemirror-to-blocks.ts +986 -0
  328. package/src/yjs/docs-editor/utils.ts +115 -0
  329. package/src/yjs/feature-room/backend.ts +36 -0
  330. package/src/yjs/feature-room/base.ts +109 -0
  331. package/src/yjs/feature-room/frontend.ts +53 -0
  332. package/src/yjs/feature-room/index.ts +3 -0
  333. package/src/yjs/forge-project-room/backend.ts +59 -0
  334. package/src/yjs/forge-project-room/base.ts +190 -0
  335. package/src/yjs/forge-project-room/index.ts +2 -0
  336. package/src/yjs/index.ts +7 -0
  337. package/src/yjs/thread-room/backend.ts +32 -0
  338. package/src/yjs/thread-room/base.ts +71 -0
  339. package/src/yjs/thread-room/frontend.ts +39 -0
  340. package/src/yjs/thread-room/index.ts +3 -0
  341. package/src/yjs/utils/index.ts +1 -0
  342. package/src/yjs/utils/key-value-storage.ts +57 -0
  343. package/src/yjs/version-room/backend.ts +101 -0
  344. package/src/yjs/version-room/base.ts +323 -0
  345. package/src/yjs/version-room/compute-dto.ts +387 -0
  346. package/src/yjs/version-room/frontend.ts +76 -0
  347. package/src/yjs/version-room/index.ts +6 -0
  348. package/src/yjs/version-room/types.ts +31 -0
  349. package/src/yjs/version-room/utils.ts +109 -0
@@ -0,0 +1,134 @@
1
+ import {
2
+ DocumentationGroupV1,
3
+ DocumentationItemConfigurationV1,
4
+ DocumentationItemConfigurationV2,
5
+ DocumentationPageV1,
6
+ mapByUnique,
7
+ } from "@supernova-studio/model";
8
+ import { LocalDocsPage, LocalDocsPageGroup } from "../../../sync/types";
9
+ import { VersionRoomDocsPage, VersionRoomDocsPageGroup } from "../../../yjs/version-room/types";
10
+
11
+ type GroupLike = {
12
+ persistentId: string;
13
+ parentPersistentId?: string;
14
+ };
15
+
16
+ type DocsPage = LocalDocsPage | VersionRoomDocsPage;
17
+ type DocsPageGroup = LocalDocsPageGroup | VersionRoomDocsPageGroup;
18
+
19
+ // The fact that DTO conversion is located here instead of main backend code is due to the fact
20
+ // that we store page and group data in YJS documents in the same way as they are stored in the database.
21
+ // Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
22
+ //
23
+ // Please do not put more DTO conversion here unless you know what you're doing.
24
+
25
+ export function buildDocPagePublishPaths(
26
+ groups: (DocsPageGroup | DocumentationGroupV1)[],
27
+ pages: (DocsPage | DocumentationPageV1)[],
28
+ routingVersion: string
29
+ ): Map<string, string> {
30
+ const groupPersistentIdToGroupMap = mapByUnique(groups, group => group.persistentId);
31
+ const result = new Map<string, string>();
32
+
33
+ for (const page of pages) {
34
+ const parentChain = calculateElementParentChain(page.parentPersistentId, groupPersistentIdToGroupMap);
35
+
36
+ let pathV1 = `${page.userSlug || page.slug}.html`;
37
+ let pathV2 = `${page.slug}-${page.shortPersistentId}`;
38
+
39
+ for (const parent of parentChain) {
40
+ if (!parent.parentPersistentId) continue;
41
+
42
+ pathV1 = `${parent.userSlug || parent.slug || "root"}/${pathV1}`;
43
+ pathV2 = `${parent.slug || "root"}/${pathV2}`;
44
+ }
45
+
46
+ pathV1 = `/${pathV1}`;
47
+ pathV2 = `/${pathV2}`;
48
+
49
+ if (routingVersion === "2") {
50
+ result.set(page.persistentId, pathV2);
51
+ } else {
52
+ result.set(page.persistentId, pathV1);
53
+ }
54
+ }
55
+
56
+ return result;
57
+ }
58
+
59
+ export function calculateElementParentChain<T extends GroupLike>(
60
+ elementParentPersistentId: string,
61
+ groupPersistentIdToGroupMap: Map<string, T>
62
+ ): T[] {
63
+ const result: T[] = [];
64
+
65
+ let parentId: string | undefined = elementParentPersistentId;
66
+ while (parentId) {
67
+ const parent = groupPersistentIdToGroupMap.get(parentId);
68
+ if (parent) result.push(parent);
69
+
70
+ parentId = parent?.parentPersistentId;
71
+ }
72
+
73
+ return result;
74
+ }
75
+
76
+ export function applyPrivacyConfigurationToNestedItems<
77
+ PageType extends DocumentationPageV1 | DocsPage,
78
+ GroupType extends DocumentationGroupV1 | DocsPageGroup,
79
+ ItemConfigurationType extends DocumentationItemConfigurationV1 | DocumentationItemConfigurationV2
80
+ >(
81
+ pages: PageType[],
82
+ groups: GroupType[],
83
+ getDefaultItemConfiguration: () => ItemConfigurationType
84
+ ): { pages: PageType[]; groups: GroupType[] } {
85
+ // copy groups to mutate them later
86
+ const fixedGroups = groups.map(group => ({
87
+ ...group,
88
+ data: {
89
+ ...group.data,
90
+ configuration: group.data?.configuration ?? getDefaultItemConfiguration(),
91
+ },
92
+ }));
93
+ const groupPersistentIdToGroupMap = mapByUnique(fixedGroups, group => group.persistentId);
94
+
95
+ for (const groupToFix of fixedGroups) {
96
+ let isHidden = groupToFix.data.configuration.isHidden;
97
+ let isPrivate = groupToFix.data.configuration.isPrivate;
98
+
99
+ let nextParentId: string | undefined = groupToFix.parentPersistentId;
100
+ while ((!isHidden || !isPrivate) && nextParentId) {
101
+ const parent = groupPersistentIdToGroupMap.get(nextParentId);
102
+ if (!parent) break;
103
+
104
+ isHidden = isHidden || parent.data?.configuration?.isHidden || false;
105
+ isPrivate = isPrivate || parent.data?.configuration?.isPrivate || false;
106
+
107
+ nextParentId = parent.parentPersistentId;
108
+ }
109
+
110
+ groupToFix.data.configuration.isHidden = isHidden;
111
+ groupToFix.data.configuration.isPrivate = isPrivate;
112
+ }
113
+
114
+ const fixedPages: PageType[] = [];
115
+ // set isHidden and isPrivate configuration fields based on page and parents value
116
+ for (const page of pages) {
117
+ const configuration = page.data?.configuration ?? getDefaultItemConfiguration();
118
+ const parent = groupPersistentIdToGroupMap.get(page.parentPersistentId);
119
+
120
+ fixedPages.push({
121
+ ...page,
122
+ data: {
123
+ ...page.data,
124
+ configuration: {
125
+ ...configuration,
126
+ isHidden: configuration.isHidden || parent?.data?.configuration?.isHidden || false,
127
+ isPrivate: configuration.isPrivate || parent?.data?.configuration?.isPrivate || false,
128
+ },
129
+ },
130
+ });
131
+ }
132
+
133
+ return { pages: fixedPages, groups: fixedGroups };
134
+ }
@@ -0,0 +1,69 @@
1
+ import {
2
+ DocumentationGroupV1,
3
+ DocumentationItemConfigurationV1,
4
+ DocumentationPageV1,
5
+ SupernovaException,
6
+ } from "@supernova-studio/model";
7
+ import { DocumentationPageV1DTO } from "../../dto";
8
+ import {
9
+ documentationItemConfigurationToDTOV1,
10
+ getDtoDefaultItemConfigurationV1,
11
+ } from "./documentation-item-configuration-v1-to-dto";
12
+ import { buildDocPagePublishPaths, applyPrivacyConfigurationToNestedItems } from "./documentation-page-to-dto-utils";
13
+
14
+ // The fact that DTO conversion is located here instead of main backend code is due to the fact
15
+ // that we store page and group data in YJS documents in the same way as they are stored in the database.
16
+ // Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
17
+ //
18
+ // Please do not put more DTO conversion here unless you know what you're doing.
19
+
20
+ export function documentationPagesToDTOV1(
21
+ pages: DocumentationPageV1[],
22
+ groups: DocumentationGroupV1[],
23
+ routingVersion: string
24
+ ): DocumentationPageV1DTO[] {
25
+ const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
26
+
27
+ return pages.map(page => documentationPageToDTOV1(page, pathsMap));
28
+ }
29
+
30
+ export function documentationPagesFixedConfigurationToDTOV1(
31
+ pages: DocumentationPageV1[],
32
+ groups: DocumentationGroupV1[],
33
+ routingVersion: string
34
+ ): DocumentationPageV1DTO[] {
35
+ const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
36
+
37
+ const { pages: fixedPages } = applyPrivacyConfigurationToNestedItems<
38
+ DocumentationPageV1,
39
+ DocumentationGroupV1,
40
+ DocumentationItemConfigurationV1
41
+ >(pages, groups, getDtoDefaultItemConfigurationV1);
42
+
43
+ return fixedPages.map((page: DocumentationPageV1) => documentationPageToDTOV1(page, pathsMap));
44
+ }
45
+
46
+ function documentationPageToDTOV1(page: DocumentationPageV1, pagePathMap: Map<string, string>): DocumentationPageV1DTO {
47
+ let path = pagePathMap.get(page.persistentId);
48
+ if (!path) throw SupernovaException.conflict(`Path for page ${page.id} was not calculated`);
49
+
50
+ if (path.startsWith("/")) path = path.substring(1);
51
+
52
+ const configuration = documentationItemConfigurationToDTOV1(page.data.configuration);
53
+
54
+ return {
55
+ id: page.id,
56
+ designSystemVersionId: page.designSystemVersionId,
57
+ persistentId: page.persistentId,
58
+ shortPersistentId: page.shortPersistentId,
59
+ // backward compatibility with custom doc exporters, anyway these pages will not be shown, so we can adjust title
60
+ title: configuration.isHidden && !page.meta.name.startsWith("_") ? "_" + page.meta.name : page.meta.name,
61
+ blocks: page.data.blocks,
62
+ slug: page.slug,
63
+ userSlug: page.userSlug,
64
+ configuration,
65
+ createdAt: page.createdAt,
66
+ updatedAt: page.updatedAt,
67
+ path: path,
68
+ };
69
+ }
@@ -0,0 +1,84 @@
1
+ import { DocumentationItemConfigurationV2 } from "@supernova-studio/model";
2
+ import { LocalDocsPage, LocalDocsPageGroup } from "../../../sync/types";
3
+ import { VersionRoomDocsPage, VersionRoomDocsPageGroup } from "../../../yjs/version-room/types";
4
+ import { DTODocumentationPageV2 } from "../../dto";
5
+ import {
6
+ documentationItemConfigurationToDTOV2,
7
+ getDtoDefaultItemConfigurationV2,
8
+ } from "./documentation-item-configuration-v2-to-dto";
9
+ import { applyPrivacyConfigurationToNestedItems, buildDocPagePublishPaths } from "./documentation-page-to-dto-utils";
10
+
11
+ type DocsPage = LocalDocsPage | VersionRoomDocsPage;
12
+ type DocsPageGroup = LocalDocsPageGroup | VersionRoomDocsPageGroup;
13
+
14
+ // The fact that DTO conversion is located here instead of main backend code is due to the fact
15
+ // that we store page and group data in YJS documents in the same way as they are stored in the database.
16
+ // Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
17
+ //
18
+ // Please do not put more DTO conversion here unless you know what you're doing.
19
+
20
+ export function documentationPageToDTOV2(
21
+ page: DocsPage,
22
+ groups: DocsPageGroup[],
23
+ routingVersion: string,
24
+ pageLiveblocksRoomIdMap: Map<string, string>
25
+ ): DTODocumentationPageV2 {
26
+ const pathsMap = buildDocPagePublishPaths(groups, [page], routingVersion);
27
+ return _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap);
28
+ }
29
+
30
+ export function documentationPagesToDTOV2(
31
+ pages: DocsPage[],
32
+ groups: DocsPageGroup[],
33
+ routingVersion: string,
34
+ pageLiveblocksRoomIdMap: Map<string, string>
35
+ ): DTODocumentationPageV2[] {
36
+ const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
37
+ return pages.map(page => _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap));
38
+ }
39
+
40
+ export function documentationPagesFixedConfigurationToDTOV2(
41
+ pages: DocsPage[],
42
+ groups: DocsPageGroup[],
43
+ routingVersion: string,
44
+ pageLiveblocksRoomIdMap: Map<string, string>
45
+ ): DTODocumentationPageV2[] {
46
+ const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
47
+
48
+ const { pages: fixedPages } = applyPrivacyConfigurationToNestedItems<
49
+ DocsPage,
50
+ DocsPageGroup,
51
+ DocumentationItemConfigurationV2
52
+ >(pages, groups, getDtoDefaultItemConfigurationV2);
53
+
54
+ return fixedPages.map(page => _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap));
55
+ }
56
+
57
+ function _documentationPageToDTOV2(
58
+ page: DocsPage,
59
+ pagePathMap: Map<string, string>,
60
+ pageLiveblocksRoomIdMap: Map<string, string>
61
+ ): DTODocumentationPageV2 {
62
+ let path = pagePathMap.get(page.persistentId);
63
+ if (!path) throw new Error(`Path for page ${page.persistentId} was not calculated`);
64
+
65
+ if (path.startsWith("/")) path = path.substring(1);
66
+
67
+ const liveblocksRoomId = pageLiveblocksRoomIdMap.get(page.persistentId);
68
+
69
+ return {
70
+ id: "to_be_removed",
71
+ designSystemVersionId: page.designSystemVersionId,
72
+ persistentId: page.persistentId,
73
+ shortPersistentId: page.shortPersistentId,
74
+ title: page.meta.name,
75
+ slug: page.slug,
76
+ userSlug: page.userSlug,
77
+ configuration: documentationItemConfigurationToDTOV2(page.data.configuration),
78
+ createdAt: page.createdAt,
79
+ updatedAt: page.updatedAt,
80
+ path: path,
81
+ type: "Page",
82
+ ...(liveblocksRoomId && { liveblocksRoomId }),
83
+ };
84
+ }
@@ -0,0 +1,14 @@
1
+ import { DocumentationConfiguration } from "@supernova-studio/model";
2
+ import { DTODocumentationConfiguration } from "../../dto";
3
+
4
+ export function documentationConfigurationToDto(
5
+ configuration: DocumentationConfiguration
6
+ ): DTODocumentationConfiguration {
7
+ return {
8
+ isPublic: configuration.isPublic,
9
+ renderCodePackageJson: configuration.renderCodePackageJson,
10
+ selectedBrandId: configuration.selectedBrandPersistentId,
11
+ storybookEmbedErrorMessage: configuration.storybookEmbedErrorMessage,
12
+ tabbed: configuration.isTabbedLayoutEnabled,
13
+ };
14
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./documentation-group-v1-to-dto";
2
+ export * from "./documentation-group-v2-to-dto";
3
+ export * from "./documentation-item-configuration-v1-to-dto";
4
+ export * from "./documentation-item-configuration-v2-to-dto";
5
+ export * from "./documentation-page-to-dto-utils";
6
+ export * from "./documentation-page-v1-to-dto";
7
+ export * from "./documentation-page-v2-to-dto";
8
+ export * from "./documentation-settings-to-dto";
@@ -0,0 +1 @@
1
+ export * from "./pipeline";
@@ -0,0 +1,27 @@
1
+ import { Pipeline } from "@supernova-studio/model";
2
+ import { DTOPipeline } from "../../dto/export/pipeline";
3
+
4
+ export function pipelineToDto(pipeline: Pipeline): DTOPipeline {
5
+ return {
6
+ id: pipeline.id,
7
+ name: pipeline.name,
8
+ eventType: pipeline.eventType,
9
+ isEnabled: pipeline.isEnabled,
10
+ workspaceId: pipeline.workspaceId,
11
+ designSystemId: pipeline.designSystemId,
12
+ exporterId: pipeline.exporterId,
13
+ brandPersistentId: pipeline.brandPersistentId,
14
+ themePersistentId: pipeline.themePersistentId,
15
+ themePersistentIds: pipeline.themePersistentIds,
16
+ destinationAzure: pipeline.destinationAzure,
17
+ destinationBitbucket: pipeline.destinationBitbucket,
18
+ destinationSnDocs: pipeline.destinationSnDocs,
19
+ destinationGithub: pipeline.destinationGithub,
20
+ destinationGitlab: pipeline.destinationGitlab,
21
+ destinationS3: pipeline.destinationS3,
22
+ exporterPropertyValues: pipeline.exporterPropertyValues,
23
+ webhookUrl: pipeline.webhookUrl,
24
+ latestJobs: [],
25
+ isExporterDeprecated: pipeline.isExporterDeprecated,
26
+ };
27
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./analytics";
2
+ export * from "./documentation";
3
+ export * from "./export";
4
+ export * from "./integrations";
@@ -0,0 +1,37 @@
1
+ import { GitBranch, GitOrganization, GitProject, GitRepository } from "@supernova-studio/model";
2
+ import { DTOGitBranch, DTOGitOrganization, DTOGitProject, DTOGitRepository } from "../../dto";
3
+
4
+ export function gitOrganizationToDto(org: GitOrganization): DTOGitOrganization {
5
+ return {
6
+ id: org.id,
7
+ name: org.name,
8
+ url: org.url,
9
+ slug: org.slug,
10
+ };
11
+ }
12
+
13
+ export function gitProjectToDto(project: GitProject): DTOGitProject {
14
+ return {
15
+ id: project.id,
16
+ name: project.name,
17
+ url: project.url,
18
+ slug: project.slug,
19
+ };
20
+ }
21
+
22
+ export function gitRepositoryToDto(repo: GitRepository): DTOGitRepository {
23
+ return {
24
+ id: repo.id,
25
+ name: repo.name,
26
+ url: repo.url,
27
+ slug: repo.slug,
28
+ defaultBranch: repo.defaultBranch,
29
+ };
30
+ }
31
+
32
+ export function gitBranchToDto(branch: GitBranch): DTOGitBranch {
33
+ return {
34
+ name: branch.name,
35
+ lastCommitId: branch.lastCommitId,
36
+ };
37
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./git";
2
+ export * from "./integration";
@@ -0,0 +1,37 @@
1
+ import { ExtendedIntegration, IntegrationCredentials } from "@supernova-studio/model";
2
+ import { DTOIntegration, DTOIntegrationCredentials } from "../../dto";
3
+
4
+ export function integrationToDto(integration: ExtendedIntegration): DTOIntegration {
5
+ return {
6
+ id: integration.id,
7
+ workspaceId: integration.workspaceId,
8
+ type: integration.type,
9
+ createdAt: integration.createdAt,
10
+ integrationCredentials: integration.integrationCredentials?.map(integrationCredentialToDto),
11
+ integrationDesignSystems: integration.integrationDesignSystems ?? undefined,
12
+ };
13
+ }
14
+
15
+ export function integrationCredentialToDto(credential: IntegrationCredentials): DTOIntegrationCredentials {
16
+ return {
17
+ id: credential.id,
18
+
19
+ createdAt: credential.createdAt,
20
+ refreshedAt: credential.refreshedAt,
21
+ expiresAt: credential.expiresAt,
22
+
23
+ integrationId: credential.integrationId,
24
+ type: credential.type,
25
+
26
+ userId: credential.userId,
27
+ user: credential.user,
28
+
29
+ customUrl: credential.customUrl,
30
+
31
+ profile: credential.profile,
32
+ tokenName: credential.tokenName,
33
+ username: credential.username,
34
+ appInstallationId: credential.appInstallationId,
35
+ state: credential.state,
36
+ };
37
+ }
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+
3
+ //
4
+ // Read
5
+ //
6
+
7
+ export const DTOAccessToken = z.object({
8
+ id: z.string(),
9
+ createdAt: z.coerce.date(),
10
+ name: z.string(),
11
+ scope: z.string().optional(),
12
+ });
13
+
14
+ export const DTOAccessTokenFull = DTOAccessToken.extend({
15
+ token: z.string(),
16
+ });
17
+
18
+ export const DTOAccessTokenListResponse = z.object({
19
+ tokens: DTOAccessToken.array(),
20
+ });
21
+
22
+ export const DTOAccessTokenResponse = z.object({
23
+ token: DTOAccessToken,
24
+ });
25
+
26
+ export const DTOAccessTokenFullResponse = z.object({
27
+ token: DTOAccessTokenFull,
28
+ });
29
+
30
+ export type DTOAccessToken = z.infer<typeof DTOAccessToken>;
31
+ export type DTOAccessTokenFull = z.infer<typeof DTOAccessTokenFull>;
32
+ export type DTOAccessTokenListResponse = z.infer<typeof DTOAccessTokenListResponse>;
33
+ export type DTOAccessTokenResponse = z.infer<typeof DTOAccessTokenResponse>;
34
+ export type DTOAccessTokenFullResponse = z.infer<typeof DTOAccessTokenFullResponse>;
35
+
36
+ //
37
+ // Write
38
+ //
39
+
40
+ export const DTOAccessTokenCreatePayload = z.object({
41
+ name: z.string(),
42
+ scope: z.string().optional(),
43
+ });
44
+
45
+ export type DTOAccessTokenCreatePayload = z.infer<typeof DTOAccessTokenCreatePayload>;
@@ -0,0 +1 @@
1
+ export * from "./access-token";
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+
3
+ export const DTOColorTokenInlineData = z.object({
4
+ value: z.string().regex(/^#[a-f0-9]{6,8}$/),
5
+ });
6
+
7
+ export type DTOColorTokenInlineData = z.infer<typeof DTOColorTokenInlineData>;
@@ -0,0 +1,4 @@
1
+ export * from "./color";
2
+ export * from "./meta";
3
+ export * from "./object-metadata";
4
+ export * from "./pagination";
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+
3
+ export const DTOObjectMeta = z.object({
4
+ name: z.string().max(512),
5
+ description: z.string().max(2048).optional(),
6
+ });
7
+
8
+ export type DTOObjectMeta = z.infer<typeof DTOObjectMeta>;
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+
3
+ type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
4
+
5
+ const MAX_OBJECT_METADATA_BYTES = 1024 * 1024;
6
+
7
+ function getJsonByteLength(value: JsonValue): number {
8
+ return new TextEncoder().encode(JSON.stringify(value)).length;
9
+ }
10
+
11
+ export const DTOObjectMetadata: z.ZodType<JsonValue> = z.lazy(() =>
12
+ z.union([
13
+ z.string(),
14
+ z.number(),
15
+ z.boolean(),
16
+ z.null(),
17
+ z.array(DTOObjectMetadata),
18
+ z.record(DTOObjectMetadata),
19
+ ])
20
+ ).superRefine((metadata, ctx) => {
21
+ if (getJsonByteLength(metadata) > MAX_OBJECT_METADATA_BYTES) {
22
+ ctx.addIssue({
23
+ code: z.ZodIssueCode.custom,
24
+ message: "Object metadata must be 1MB or smaller.",
25
+ });
26
+ }
27
+ }).describe("Optional JSON metadata for extra structured details. Must be 1MB or smaller when serialized.");
28
+
29
+ export type DTOObjectMetadata = z.infer<typeof DTOObjectMetadata>;
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+
3
+ export const DTOPagination = z.object({
4
+ limit: z.string().optional(),
5
+ offset: z.string().optional(),
6
+ });
7
+
8
+ export type DTOPagination = z.infer<typeof DTOPagination>;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { DTOBrand, DTODesignSystem, DTODesignSystemVersion } from "../design-systems";
3
+ import { DTOUserWorkspaceMembership } from "../workspaces";
4
+
5
+ export const DTOAppBootstrapDataQuery = z.object({
6
+ preferredWorkspaceId: z.string().optional(),
7
+ preferredDesignSystemId: z.string().optional(),
8
+ preferredVersionId: z.string().optional(),
9
+ preferredBrandId: z.string().optional(),
10
+ });
11
+
12
+ export const DTOAppBootstrapDataResponse = z.object({
13
+ workspaceMembership: DTOUserWorkspaceMembership.optional(),
14
+ designSystem: DTODesignSystem.optional(),
15
+ version: DTODesignSystemVersion.optional(),
16
+ brand: DTOBrand.optional(),
17
+ });
18
+
19
+ export type DTOAppBootstrapDataQuery = z.infer<typeof DTOAppBootstrapDataQuery>;
20
+ export type DTOAppBootstrapDataResponse = z.infer<typeof DTOAppBootstrapDataResponse>;
@@ -0,0 +1 @@
1
+ export * from "./app-bootstrap-data";
@@ -0,0 +1 @@
1
+ export * from "./token-collection";
@@ -0,0 +1,32 @@
1
+ import { CollectionOrigin, ColorTokenInlineData, ObjectMeta } from "@supernova-studio/model";
2
+ import { z } from "zod";
3
+
4
+ export const DTOCollectionOrigin = CollectionOrigin.extend({
5
+ /** @deprecated Use `sourceIds` instead. This field will be removed in the future. */
6
+ sourceId: z.string(),
7
+ });
8
+
9
+ export const DTOTokenCollection = z.object({
10
+ id: z.string(),
11
+ persistentId: z.string(),
12
+ designSystemVersionId: z.string(),
13
+
14
+ meta: ObjectMeta,
15
+ backgroundColor: ColorTokenInlineData.optional(),
16
+ elementPropertyOptionId: z.string(),
17
+
18
+ createdAt: z.coerce.date(),
19
+ updatedAt: z.coerce.date(),
20
+
21
+ parentPersistentId: z.string().optional(),
22
+
23
+ origin: DTOCollectionOrigin.optional(),
24
+ });
25
+
26
+ export type DTOCollectionOrigin = z.infer<typeof DTOCollectionOrigin>;
27
+ export const DTOTokenCollectionsListReponse = z.object({
28
+ collections: DTOTokenCollection.array(),
29
+ });
30
+
31
+ export type DTOTokenCollection = z.infer<typeof DTOTokenCollection>;
32
+ export type DTOTokenCollectionsListReponse = z.infer<typeof DTOTokenCollectionsListReponse>;
@@ -0,0 +1,44 @@
1
+ import { ObjectMeta } from "@supernova-studio/model";
2
+ import { z } from "zod";
3
+ import { DTOObjectMeta } from "../aux";
4
+
5
+ //
6
+ // Read
7
+ //
8
+
9
+ export const DTOBrand = z.object({
10
+ id: z.string(),
11
+ designSystemVersionId: z.string(),
12
+ persistentId: z.string(),
13
+ meta: ObjectMeta,
14
+ });
15
+
16
+ export const DTOBrandGetResponse = z.object({ brand: DTOBrand });
17
+
18
+ export const DTOBrandCreateResponse = z.object({
19
+ brand: DTOBrand,
20
+ });
21
+
22
+ export const DTOBrandsListResponse = z.object({ brands: z.array(DTOBrand) });
23
+
24
+ export type DTOBrand = z.infer<typeof DTOBrand>;
25
+ export type DTOBrandGetResponse = z.infer<typeof DTOBrandGetResponse>;
26
+ export type DTOBrandCreateResponse = z.infer<typeof DTOBrandCreateResponse>;
27
+ export type DTOBrandsListResponse = z.infer<typeof DTOBrandsListResponse>;
28
+
29
+ //
30
+ // Write
31
+ //
32
+
33
+ export const DTOBrandCreatePayload = z.object({
34
+ persistentId: z.string().uuid(),
35
+ meta: DTOObjectMeta,
36
+ });
37
+
38
+ export const DTOBrandUpdatePayload = z.object({
39
+ meta: DTOObjectMeta.optional(),
40
+ persistentId: z.string(),
41
+ });
42
+
43
+ export type DTOBrandCreatePayload = z.infer<typeof DTOBrandCreatePayload>;
44
+ export type DTOBrandUpdatePayload = z.infer<typeof DTOBrandUpdatePayload>;