@supernova-studio/client 0.48.7 → 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 (121) hide show
  1. package/dist/index.d.mts +1166 -44514
  2. package/dist/index.mjs +4583 -9906
  3. package/dist/index.mjs.map +1 -1
  4. package/package.json +11 -30
  5. package/dist/index.d.ts +0 -44757
  6. package/dist/index.js +0 -11011
  7. package/dist/index.js.map +0 -1
  8. package/src/api/conversion/documentation/documentation-group-v1-to-dto.ts +0 -114
  9. package/src/api/conversion/documentation/documentation-group-v2-to-dto.ts +0 -92
  10. package/src/api/conversion/documentation/documentation-item-configuration-v1-to-dto.ts +0 -52
  11. package/src/api/conversion/documentation/documentation-item-configuration-v2-to-dto.ts +0 -34
  12. package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +0 -132
  13. package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +0 -69
  14. package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +0 -72
  15. package/src/api/conversion/documentation/index.ts +0 -7
  16. package/src/api/conversion/export/index.ts +0 -1
  17. package/src/api/conversion/export/pipeline.ts +0 -24
  18. package/src/api/conversion/index.ts +0 -3
  19. package/src/api/conversion/integrations/git.ts +0 -37
  20. package/src/api/conversion/integrations/index.ts +0 -2
  21. package/src/api/conversion/integrations/integration.ts +0 -37
  22. package/src/api/dto/design-systems/brand.ts +0 -22
  23. package/src/api/dto/design-systems/data-source.ts +0 -122
  24. package/src/api/dto/design-systems/design-system.ts +0 -18
  25. package/src/api/dto/design-systems/elements-diff.ts +0 -14
  26. package/src/api/dto/design-systems/exporter-property.ts +0 -8
  27. package/src/api/dto/design-systems/index.ts +0 -7
  28. package/src/api/dto/design-systems/version.ts +0 -57
  29. package/src/api/dto/design-systems/view.ts +0 -45
  30. package/src/api/dto/documentation/anchor.ts +0 -15
  31. package/src/api/dto/documentation/block-definition.ts +0 -28
  32. package/src/api/dto/documentation/block.ts +0 -6
  33. package/src/api/dto/documentation/documentation-page-snapshot.ts +0 -18
  34. package/src/api/dto/documentation/index.ts +0 -6
  35. package/src/api/dto/documentation/link-preview.ts +0 -23
  36. package/src/api/dto/documentation/publish.ts +0 -23
  37. package/src/api/dto/elements/documentation/draft-state.ts +0 -35
  38. package/src/api/dto/elements/documentation/group-action.ts +0 -108
  39. package/src/api/dto/elements/documentation/group-v1.ts +0 -35
  40. package/src/api/dto/elements/documentation/group-v2.ts +0 -109
  41. package/src/api/dto/elements/documentation/hierarchy.ts +0 -36
  42. package/src/api/dto/elements/documentation/index.ts +0 -11
  43. package/src/api/dto/elements/documentation/item-configuration-v1.ts +0 -24
  44. package/src/api/dto/elements/documentation/item-configuration-v2.ts +0 -14
  45. package/src/api/dto/elements/documentation/page-actions-v2.ts +0 -108
  46. package/src/api/dto/elements/documentation/page-content.ts +0 -15
  47. package/src/api/dto/elements/documentation/page-v1.ts +0 -21
  48. package/src/api/dto/elements/documentation/page-v2.ts +0 -105
  49. package/src/api/dto/elements/elements-action-v2.ts +0 -114
  50. package/src/api/dto/elements/figma-nodes/figma-node.ts +0 -55
  51. package/src/api/dto/elements/figma-nodes/index.ts +0 -2
  52. package/src/api/dto/elements/figma-nodes/node-actions-v2.ts +0 -24
  53. package/src/api/dto/elements/get-elements-v2.ts +0 -21
  54. package/src/api/dto/elements/index.ts +0 -5
  55. package/src/api/dto/elements/properties/index.ts +0 -3
  56. package/src/api/dto/elements/properties/property-definitions-actions-v2.ts +0 -53
  57. package/src/api/dto/elements/properties/property-definitions.ts +0 -62
  58. package/src/api/dto/elements/properties/property-values.ts +0 -17
  59. package/src/api/dto/export/exporter.ts +0 -73
  60. package/src/api/dto/export/index.ts +0 -3
  61. package/src/api/dto/export/job.ts +0 -75
  62. package/src/api/dto/export/pipeline.ts +0 -20
  63. package/src/api/dto/figma-components/assets/download.ts +0 -30
  64. package/src/api/dto/figma-components/assets/index.ts +0 -1
  65. package/src/api/dto/figma-components/index.ts +0 -1
  66. package/src/api/dto/index.ts +0 -8
  67. package/src/api/dto/liveblocks/auth-response.ts +0 -7
  68. package/src/api/dto/liveblocks/index.ts +0 -1
  69. package/src/api/dto/users/index.ts +0 -1
  70. package/src/api/dto/users/profile/index.ts +0 -1
  71. package/src/api/dto/users/profile/update.ts +0 -7
  72. package/src/api/dto/workspaces/git.ts +0 -32
  73. package/src/api/dto/workspaces/index.ts +0 -5
  74. package/src/api/dto/workspaces/integrations.ts +0 -34
  75. package/src/api/dto/workspaces/membership.ts +0 -29
  76. package/src/api/dto/workspaces/npm-registry.ts +0 -35
  77. package/src/api/dto/workspaces/workspace.ts +0 -16
  78. package/src/api/index.ts +0 -3
  79. package/src/api/payloads/design-systems/brand.ts +0 -11
  80. package/src/api/payloads/design-systems/index.ts +0 -2
  81. package/src/api/payloads/design-systems/version.ts +0 -29
  82. package/src/api/payloads/documentation/block-definitions.ts +0 -12
  83. package/src/api/payloads/documentation/design-data-doc-diff.ts +0 -7
  84. package/src/api/payloads/documentation/index.ts +0 -2
  85. package/src/api/payloads/export/index.ts +0 -1
  86. package/src/api/payloads/export/pipeline.ts +0 -46
  87. package/src/api/payloads/index.ts +0 -6
  88. package/src/api/payloads/liveblocks/auth.ts +0 -7
  89. package/src/api/payloads/liveblocks/index.ts +0 -1
  90. package/src/api/payloads/users/index.ts +0 -2
  91. package/src/api/payloads/users/notifications/index.ts +0 -1
  92. package/src/api/payloads/users/notifications/notification-settings.ts +0 -17
  93. package/src/api/payloads/users/profile/index.ts +0 -1
  94. package/src/api/payloads/users/profile/update.ts +0 -4
  95. package/src/api/payloads/workspaces/index.ts +0 -2
  96. package/src/api/payloads/workspaces/workspace-configuration.ts +0 -50
  97. package/src/api/payloads/workspaces/workspace-integrations.ts +0 -26
  98. package/src/index.ts +0 -3
  99. package/src/utils/hash.ts +0 -62
  100. package/src/utils/index.ts +0 -1
  101. package/src/yjs/design-system-content/documentation-hierarchy.ts +0 -33
  102. package/src/yjs/design-system-content/index.ts +0 -2
  103. package/src/yjs/design-system-content/item-configuration.ts +0 -93
  104. package/src/yjs/docs-editor/blocks-to-prosemirror.ts +0 -697
  105. package/src/yjs/docs-editor/index.ts +0 -7
  106. package/src/yjs/docs-editor/list-tree-builder.ts +0 -135
  107. package/src/yjs/docs-editor/mock.ts +0 -2447
  108. package/src/yjs/docs-editor/model/block.ts +0 -8
  109. package/src/yjs/docs-editor/model/index.ts +0 -2
  110. package/src/yjs/docs-editor/model/page.ts +0 -8
  111. package/src/yjs/docs-editor/prosemirror/index.ts +0 -2
  112. package/src/yjs/docs-editor/prosemirror/schema.ts +0 -657
  113. package/src/yjs/docs-editor/prosemirror/types.ts +0 -19
  114. package/src/yjs/docs-editor/prosemirror-to-blocks.ts +0 -900
  115. package/src/yjs/docs-editor/utils.ts +0 -115
  116. package/src/yjs/index.ts +0 -3
  117. package/src/yjs/version-room/backend.ts +0 -60
  118. package/src/yjs/version-room/base.ts +0 -185
  119. package/src/yjs/version-room/frontend.ts +0 -298
  120. package/src/yjs/version-room/index.ts +0 -4
  121. package/src/yjs/version-room/utils.ts +0 -6
@@ -1,6 +0,0 @@
1
- export * from "./design-systems";
2
- export * from "./documentation";
3
- export * from "./export";
4
- export * from "./liveblocks";
5
- export * from "./users";
6
- export * from "./workspaces";
@@ -1,7 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const DTOLiveblocksAuthRequest = z.object({
4
- room: z.string().optional(),
5
- });
6
-
7
- export type DTOLiveblocksAuthRequest = z.infer<typeof DTOLiveblocksAuthRequest>;
@@ -1 +0,0 @@
1
- export * from "./auth";
@@ -1,2 +0,0 @@
1
- export * from "./notifications";
2
- export * from "./profile";
@@ -1 +0,0 @@
1
- export * from "./notification-settings";
@@ -1,17 +0,0 @@
1
- import { UserNotificationSettings } from "@supernova-studio/model";
2
- import { z } from "zod";
3
-
4
- export const DTOUpdateUserNotificationSettingsPayload = z.object({
5
- notificationSettings: UserNotificationSettings,
6
- });
7
-
8
- export type DTOUpdateUserNotificationSettingsPayload = z.infer<typeof DTOUpdateUserNotificationSettingsPayload>;
9
-
10
-
11
- export const DTOUserNotificationSettingsResponse = z.object({
12
- userId: z.string(),
13
- workspaceId: z.string(),
14
- notificationSettings: UserNotificationSettings,
15
- });
16
-
17
- export type DTOUserNotificationSettingsResponse = z.infer<typeof DTOUserNotificationSettingsResponse>;
@@ -1 +0,0 @@
1
- export * from "./update";
@@ -1,4 +0,0 @@
1
- import { UserProfileUpdate } from "@supernova-studio/model";
2
-
3
-
4
- export const DTOUserProfileUpdatePayload = UserProfileUpdate;
@@ -1,2 +0,0 @@
1
- export * from "./workspace-configuration";
2
- export * from "./workspace-integrations";
@@ -1,50 +0,0 @@
1
- import { z } from "zod";
2
- import { SsoProvider, WorkspaceIpSettings, WorkspaceProfile } from "@supernova-studio/model";
3
-
4
- const prohibitedSsoKeys = ["providerId", "metadataXml", "emailDomains"];
5
-
6
- export function validateSsoPayload(ssoPayload: Partial<SsoProvider> | undefined) {
7
- const keys = [];
8
- let valid = true;
9
- if (!ssoPayload) {
10
- valid = true;
11
- return {
12
- valid,
13
- keys: [],
14
- };
15
- }
16
- for (const key of Object.keys(ssoPayload)) {
17
- if (prohibitedSsoKeys.includes(key)) {
18
- keys.push(key);
19
- valid = false;
20
- }
21
- }
22
- return {
23
- valid,
24
- keys,
25
- };
26
- }
27
-
28
- export const NpmRegistryInput = z.object({
29
- enabledScopes: z.array(z.string()),
30
- customRegistryUrl: z.string().optional(),
31
- bypassProxy: z.boolean().optional(),
32
- npmProxyRegistryConfigId: z.string().optional(),
33
- npmProxyVersion: z.number().optional(),
34
- registryType: z.string(),
35
- authType: z.string(),
36
- authHeaderName: z.string(),
37
- authHeaderValue: z.string(),
38
- accessToken: z.string(),
39
- username: z.string(),
40
- password: z.string(),
41
- });
42
-
43
- export const WorkspaceConfigurationPayload = z.object({
44
- ipWhitelist: WorkspaceIpSettings.partial().optional(),
45
- sso: SsoProvider.partial().optional(),
46
- npmRegistrySettings: NpmRegistryInput.partial().optional(),
47
- profile: WorkspaceProfile.partial().optional(),
48
- });
49
-
50
- export type WorkspaceConfigurationPayload = z.infer<typeof WorkspaceConfigurationPayload>;
@@ -1,26 +0,0 @@
1
- import { IntegrationToken, IntegrationType } from "@supernova-studio/model";
2
- import { z } from "zod";
3
-
4
- export const DTOWorkspaceIntegrationOauthInput = z.object({
5
- type: IntegrationType,
6
- });
7
-
8
- export type DTOWorkspaceIntegrationOauthInput = z.infer<typeof DTOWorkspaceIntegrationOauthInput>;
9
-
10
- export const DTOWorkspaceIntegrationPATInput = z.object({
11
- userId: z.string(),
12
- type: IntegrationType,
13
- token: IntegrationToken,
14
- });
15
-
16
- export type DTOWorkspaceIntegrationPATInput = z.infer<typeof DTOWorkspaceIntegrationPATInput>;
17
-
18
- export const DTOWorkspaceIntegrationGetGitObjectsInput = z.object({
19
- organization: z.string().optional(), // Azure Organization | Bitbucket Workspace slug | Gitlab Group and Sub-Groups | Github Account (User or Organization)
20
- project: z.string().optional(), // Only for Bitbucket and Azure
21
- repository: z.string().optional(), // For all providers. Pay attention for Gitlab, they call repositories "projects".
22
- branch: z.string().optional(), // For all providers, useful for PR creations.
23
- user: z.string().optional(), // Only for Gitlab User Repositories
24
- });
25
-
26
- export type DTOWorkspaceIntegrationGetGitObjectsInput = z.infer<typeof DTOWorkspaceIntegrationGetGitObjectsInput>;
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./api";
2
- export * from "./utils";
3
- export * from "./yjs";
package/src/utils/hash.ts DELETED
@@ -1,62 +0,0 @@
1
- function hash(input: string): string {
2
- return farmhash(input).toString(16);
3
- }
4
-
5
- function farmhash(input: string): number {
6
- const seed = 0x9e3779b9;
7
- let hash = seed;
8
-
9
- for (let i = 0; i < input.length; i++) {
10
- const charCode = input.charCodeAt(i);
11
- hash ^= charCode;
12
- hash = Math.imul(hash, 0x5bd1e995);
13
- hash ^= hash >>> 15;
14
- }
15
-
16
- hash = Math.imul(hash, 0x5bd1e995);
17
- hash ^= hash >>> 13;
18
- hash = Math.imul(hash, 0x5bd1e995);
19
- hash ^= hash >>> 15;
20
-
21
- return hash >>> 0;
22
- }
23
-
24
- function prepareObject(obj: any): any {
25
- if (obj === null || typeof obj !== "object") {
26
- return obj;
27
- }
28
- if (Array.isArray(obj)) {
29
- return obj.map(prepareObject);
30
- }
31
- const sortedObj: any = {};
32
- for (const key of Object.keys(obj).sort()) {
33
- if (obj[key] === null || obj[key] === undefined) {
34
- continue;
35
- }
36
- sortedObj[key] = prepareObject(obj[key]);
37
- }
38
- return sortedObj;
39
- }
40
-
41
- export function generateHash(input: object | string, debug = false): string {
42
- if (typeof input === "object") {
43
- const sanitized = JSON.stringify(prepareObject(input));
44
- if (debug) {
45
- console.log("Hashing sanitized string:");
46
- console.log(sanitized);
47
- }
48
- return hash(sanitized);
49
- } else {
50
- try {
51
- const obj = JSON.parse(input);
52
- const sanitized = JSON.stringify(prepareObject(obj));
53
- if (debug) {
54
- console.log("Hashing sanitized string:");
55
- console.log(sanitized);
56
- }
57
- return hash(sanitized);
58
- } catch {
59
- return hash(input);
60
- }
61
- }
62
- }
@@ -1 +0,0 @@
1
- export * from "./hash";
@@ -1,33 +0,0 @@
1
- import * as Y from "yjs";
2
- import { z } from "zod";
3
- import { DTODocumentationHierarchyV2 } from "../../api";
4
- import { FrontendVersionRoomYDoc } from "../version-room/frontend";
5
-
6
- // We store pages and groups in the same way they are stored in the database.
7
- // This means that instead of groups having childrenIds array, all items have
8
- // parentPersistentId property that points to the parent item in the tree.
9
- // Upon read this gets converted to the format that client expects, which is
10
- // ordered childrenIds array on all groups.
11
- //
12
- // The decision behind it is that we potentially want to get rid of childrenIds
13
- // array entirely because it makes group updates more complicated. For now
14
- // resolving it on fly is a tradeoff for not rewriting client to stop relying
15
- // on children ids array.
16
-
17
- //
18
- // Types
19
- //
20
-
21
- export const DocumentationHierarchySettings = z.object({
22
- routingVersion: z.string(),
23
- isDraftFeatureAdopted: z.boolean(),
24
- });
25
-
26
- export type DocumentationHierarchySettings = z.infer<typeof DocumentationHierarchySettings>;
27
-
28
- /**
29
- * @deprecated - Use FrontendVersionRoomYDoc.getDocumentationHierarchy
30
- */
31
- export function yjsToDocumentationHierarchy(doc: Y.Doc): DTODocumentationHierarchyV2 {
32
- return new FrontendVersionRoomYDoc(doc).getDocumentationHierarchy();
33
- }
@@ -1,2 +0,0 @@
1
- export * from "./documentation-hierarchy";
2
- export * from "./item-configuration";
@@ -1,93 +0,0 @@
1
- import { DocumentationItemHeaderV2 } from "@supernova-studio/model";
2
- import * as Y from "yjs";
3
- import { z } from "zod";
4
- import { DTODocumentationItemConfigurationV2 } from "../../api/dto/elements/documentation/item-configuration-v2";
5
-
6
- //
7
- // Types
8
- //
9
-
10
- export const DTODocumentationPageRoomHeaderData = z.object({
11
- title: z.string(),
12
- configuration: DTODocumentationItemConfigurationV2,
13
- });
14
-
15
- export const DTODocumentationPageRoomHeaderDataUpdate = z.object({
16
- title: z.string().optional(),
17
- configuration: DTODocumentationItemConfigurationV2.omit({ header: true })
18
- .extend({ header: DocumentationItemHeaderV2.partial() })
19
- .optional(),
20
- });
21
-
22
- export type DTODocumentationPageRoomHeaderData = z.infer<typeof DTODocumentationPageRoomHeaderData>;
23
- export type DTODocumentationPageRoomHeaderDataUpdate = z.infer<typeof DTODocumentationPageRoomHeaderDataUpdate>;
24
-
25
- //
26
- // YJS Bindings
27
- //
28
-
29
- export function itemConfigurationToYjs(yDoc: Y.Doc, item: DTODocumentationPageRoomHeaderDataUpdate) {
30
- yDoc.transact(trx => {
31
- const { title, configuration } = item;
32
-
33
- const header = configuration?.header;
34
-
35
- if (title !== undefined) {
36
- const headerYMap = trx.doc.getMap("itemTitle");
37
- headerYMap.set("title", title);
38
- }
39
-
40
- if (header) {
41
- const headerYMap = trx.doc.getMap("itemHeader");
42
-
43
- header.description !== undefined && headerYMap.set("description", header.description);
44
- header.alignment !== undefined && headerYMap.set("alignment", header.alignment);
45
- header.foregroundColor !== undefined && headerYMap.set("foregroundColor", header.foregroundColor);
46
- header.backgroundColor !== undefined && headerYMap.set("backgroundColor", header.backgroundColor);
47
- header.backgroundImageAsset !== undefined && headerYMap.set("backgroundImageAsset", header.backgroundImageAsset);
48
- header.backgroundImageScaleType !== undefined &&
49
- headerYMap.set("backgroundImageScaleType", header.backgroundImageScaleType);
50
- header.showBackgroundOverlay !== undefined &&
51
- headerYMap.set("showBackgroundOverlay", header.showBackgroundOverlay);
52
- header.showCoverText !== undefined && headerYMap.set("showCoverText", header.showCoverText);
53
- header.minHeight !== undefined && headerYMap.set("minHeight", header.minHeight);
54
- }
55
-
56
- const configYMap = trx.doc.getMap("itemConfiguration");
57
-
58
- configuration?.showSidebar !== undefined && configYMap.set("showSidebar", configuration.showSidebar);
59
- configuration?.isHidden !== undefined && configYMap.set("isHidden", configuration.isHidden);
60
- configuration?.isPrivate !== undefined && configYMap.set("isPrivate", configuration.isPrivate);
61
- });
62
- }
63
-
64
- export function yjsToItemConfiguration(yDoc: Y.Doc): DTODocumentationPageRoomHeaderData {
65
- const title = yDoc.getMap("itemTitle").get("title");
66
-
67
- const headerYMap = yDoc.getMap("itemHeader");
68
- const rawHeader = {
69
- description: headerYMap.get("description"),
70
- alignment: headerYMap.get("alignment"),
71
- foregroundColor: headerYMap.get("foregroundColor"),
72
- backgroundColor: headerYMap.get("backgroundColor"),
73
- backgroundImageAsset: headerYMap.get("backgroundImageAsset"),
74
- backgroundImageScaleType: headerYMap.get("backgroundImageScaleType"),
75
- showBackgroundOverlay: headerYMap.get("showBackgroundOverlay"),
76
- showCoverText: headerYMap.get("showCoverText"),
77
- minHeight: headerYMap.get("minHeight"),
78
- };
79
-
80
- const configYMap = yDoc.getMap("itemConfiguration");
81
-
82
- const rawConfig = {
83
- showSidebar: configYMap.get("showSidebar"),
84
- isHidden: configYMap.get("isHidden") ?? false,
85
- isPrivate: configYMap.get("isPrivate") ?? false,
86
- header: rawHeader,
87
- } satisfies Record<keyof DTODocumentationItemConfigurationV2, unknown>;
88
-
89
- return {
90
- title: z.string().parse(title),
91
- configuration: DTODocumentationItemConfigurationV2.parse(rawConfig),
92
- };
93
- }