@supernova-studio/client 0.23.0 → 0.25.0
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.
- package/dist/index.d.mts +4532 -14
- package/dist/index.d.ts +4532 -14
- package/dist/index.js +296 -191
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +586 -481
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/documentation/group.ts +2 -2
- package/src/api/dto/elements/elements-action-v2.ts +3 -3
- package/src/api/dto/elements/figma-nodes/figma-node.ts +2 -2
- package/src/api/dto/elements/figma-nodes/node-actions-v2.ts +6 -6
- package/src/api/dto/elements/get-elements-v2.ts +6 -6
- package/src/api/dto/index.ts +1 -0
- package/src/api/dto/workspaces/index.ts +3 -0
- package/src/api/dto/workspaces/membership.ts +29 -0
- package/src/api/dto/workspaces/npm-registry.ts +31 -0
- package/src/api/dto/workspaces/workspace.ts +16 -0
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +17 -1
- package/src/yjs/docs-editor/mock.ts +135 -119
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +19 -9
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@ export const DTOCreateDocumentationGroupInput = z.object({
|
|
|
52
52
|
|
|
53
53
|
export const DTOUpdateDocumentationGroupInput = z.object({
|
|
54
54
|
// Identifier of the group to update
|
|
55
|
-
id: z.string()
|
|
55
|
+
id: z.string(),
|
|
56
56
|
|
|
57
57
|
// Group properties
|
|
58
58
|
title: z.string().optional(),
|
|
@@ -61,7 +61,7 @@ export const DTOUpdateDocumentationGroupInput = z.object({
|
|
|
61
61
|
|
|
62
62
|
export const DTOMoveDocumentationGroupInput = z.object({
|
|
63
63
|
// Identifier of the group to update
|
|
64
|
-
id: z.string()
|
|
64
|
+
id: z.string(),
|
|
65
65
|
|
|
66
66
|
// Group placement properties
|
|
67
67
|
parentPersistentId: z.string().uuid(),
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
DTODocumentationTabGroupDeleteActionInputV2,
|
|
28
28
|
DTODocumentationTabGroupDeleteActionOutputV2,
|
|
29
29
|
} from "./documentation/group-action";
|
|
30
|
-
import {
|
|
30
|
+
import { DTOFigmaNodeRenderActionInput, DTOFigmaNodeRenderActionOutput } from "./figma-nodes/node-actions-v2";
|
|
31
31
|
|
|
32
32
|
//
|
|
33
33
|
// Read
|
|
@@ -51,7 +51,7 @@ export const DTOElementActionOutput = z.discriminatedUnion("type", [
|
|
|
51
51
|
DTODocumentationTabGroupDeleteActionOutputV2,
|
|
52
52
|
|
|
53
53
|
// // Figma frames
|
|
54
|
-
|
|
54
|
+
DTOFigmaNodeRenderActionOutput,
|
|
55
55
|
]);
|
|
56
56
|
|
|
57
57
|
export type DTOElementActionOutput = z.infer<typeof DTOElementActionOutput>;
|
|
@@ -78,7 +78,7 @@ export const DTOElementActionInput = z.discriminatedUnion("type", [
|
|
|
78
78
|
DTODocumentationTabGroupDeleteActionInputV2,
|
|
79
79
|
|
|
80
80
|
// Figma frames
|
|
81
|
-
|
|
81
|
+
DTOFigmaNodeRenderActionInput,
|
|
82
82
|
]);
|
|
83
83
|
|
|
84
84
|
export type DTOElementActionInput = z.infer<typeof DTOElementActionInput>;
|
|
@@ -35,7 +35,7 @@ export type DTOFigmaNode = z.infer<typeof DTOFigmaNode>;
|
|
|
35
35
|
// Write
|
|
36
36
|
//
|
|
37
37
|
|
|
38
|
-
export const
|
|
38
|
+
export const DTOFigmaNodeRenderInput = z.object({
|
|
39
39
|
// Id of a design system's data source representing a linked Figma file
|
|
40
40
|
sourceId: z.string(),
|
|
41
41
|
|
|
@@ -43,4 +43,4 @@ export const DTOFigmaNodeCreateInput = z.object({
|
|
|
43
43
|
figmaFileNodeId: z.string(),
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
export type
|
|
46
|
+
export type DTOFigmaNodeRenderInput = z.infer<typeof DTOFigmaNodeRenderInput>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DTOFigmaNode,
|
|
2
|
+
import { DTOFigmaNode, DTOFigmaNodeRenderInput } from "./figma-node";
|
|
3
3
|
|
|
4
4
|
//
|
|
5
5
|
// Read
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const DTOFigmaNodeRenderActionOutput = z.object({
|
|
9
9
|
type: z.literal("FigmaNodeRender"),
|
|
10
10
|
figmaNodes: z.array(DTOFigmaNode),
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export type DTOFigmaNodeRenderActionOutput = z.infer<typeof DTOFigmaNodeRenderActionOutput>;
|
|
14
14
|
|
|
15
15
|
//
|
|
16
16
|
// Read
|
|
17
17
|
//
|
|
18
18
|
|
|
19
|
-
export const
|
|
19
|
+
export const DTOFigmaNodeRenderActionInput = z.object({
|
|
20
20
|
type: z.literal("FigmaNodeRender"),
|
|
21
|
-
input:
|
|
21
|
+
input: DTOFigmaNodeRenderInput.array(),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
export type
|
|
24
|
+
export type DTOFigmaNodeRenderActionInput = z.infer<typeof DTOFigmaNodeRenderActionInput>;
|
|
@@ -5,10 +5,10 @@ import { DTOFigmaNode } from "./figma-nodes";
|
|
|
5
5
|
// Read
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const DTOElementsGetTypeFilter = z.enum(["FigmaNode"]);
|
|
9
9
|
|
|
10
|
-
export const
|
|
11
|
-
types: z.string().transform(val => val.split(",").map(v =>
|
|
10
|
+
export const DTOElementsGetQuerySchema = z.object({
|
|
11
|
+
types: z.string().transform(val => val.split(",").map(v => DTOElementsGetTypeFilter.parse(v))),
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export const DTOElementsGetOutput = z.object({
|
|
@@ -16,6 +16,6 @@ export const DTOElementsGetOutput = z.object({
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export type DTOElementsGetOutput = z.infer<typeof DTOElementsGetOutput>;
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
19
|
+
export type DTOElementsGetQueryRaw = z.input<typeof DTOElementsGetQuerySchema>;
|
|
20
|
+
export type DTOElementsGetQueryParsed = z.output<typeof DTOElementsGetQuerySchema>;
|
|
21
|
+
export type DTOElementsGetTypeFilter = z.infer<typeof DTOElementsGetTypeFilter>;
|
package/src/api/dto/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DTOWorkspace } from "./workspace";
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Read
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
export const DTOWorkspaceRole = z.enum(["Owner", "Admin", "Creator", "Viewer", "Billing"]);
|
|
9
|
+
|
|
10
|
+
export const DTOUserWorkspaceMembership = z.object({
|
|
11
|
+
// Workspace the user is a member of
|
|
12
|
+
workspace: DTOWorkspace,
|
|
13
|
+
|
|
14
|
+
// Assigned role the user has in the workspace
|
|
15
|
+
role: DTOWorkspaceRole,
|
|
16
|
+
|
|
17
|
+
// Role that determines actual permissions the user has in the workspace
|
|
18
|
+
// E.g. this is different from the default role when editors are downgraded to viewers
|
|
19
|
+
// when a workspace's subscription is downgraded to free tier
|
|
20
|
+
effectiveRole: DTOWorkspaceRole,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const DTOUserWorkspaceMembershipsResponse = z.object({
|
|
24
|
+
membership: z.array(DTOUserWorkspaceMembership),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type DTOWorkspaceRole = z.infer<typeof DTOWorkspaceRole>;
|
|
28
|
+
export type DTOUserWorkspaceMembership = z.infer<typeof DTOUserWorkspaceMembership>;
|
|
29
|
+
export type DTOUserWorkspaceMembershipsResponse = z.infer<typeof DTOUserWorkspaceMembershipsResponse>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NpmRegistryAuthType, NpmRegistryType } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Read
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
export const DTONpmRegistryConfig = z.object({
|
|
9
|
+
// Registry basic configuration
|
|
10
|
+
registryType: NpmRegistryType,
|
|
11
|
+
registryUrl: z.string(),
|
|
12
|
+
customRegistryUrl: z.string().optional(),
|
|
13
|
+
|
|
14
|
+
// URL of Supernova NPM packages proxy
|
|
15
|
+
proxyUrl: z.string(),
|
|
16
|
+
|
|
17
|
+
// Auth configuration
|
|
18
|
+
authType: NpmRegistryAuthType,
|
|
19
|
+
accessToken: z.literal("redacted").optional(),
|
|
20
|
+
username: z.string().optional(),
|
|
21
|
+
password: z.literal("redacted").optional(),
|
|
22
|
+
|
|
23
|
+
// NPM package scopes for whih the proxy should be enabled
|
|
24
|
+
enabledScopes: z.array(z.string()),
|
|
25
|
+
|
|
26
|
+
// True if client should bypass Supernova proxy and connect directly to the registry
|
|
27
|
+
// (e.g. when the NPM registry is behind a VPN or firewall which prevents Supernova from accessing it)
|
|
28
|
+
bypassProxy: z.boolean(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type DTONpmRegistryConfig = z.infer<typeof DTONpmRegistryConfig>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Subscription, WorkspaceProfile } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { DTONpmRegistryConfig } from "./npm-registry";
|
|
4
|
+
|
|
5
|
+
//
|
|
6
|
+
// Read
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
export const DTOWorkspace = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
profile: WorkspaceProfile,
|
|
12
|
+
subscription: Subscription,
|
|
13
|
+
npmRegistry: DTONpmRegistryConfig.optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type DTOWorkspace = z.infer<typeof DTOWorkspace>;
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
PageBlockItemTableRow,
|
|
16
16
|
PageBlockDefinitionRichTextOptions,
|
|
17
17
|
PageBlockDefinitionMutiRichTextOptions,
|
|
18
|
+
PageBlockItemImageValue,
|
|
18
19
|
} from "@supernova-studio/model";
|
|
19
20
|
import { PageBlockEditorModel } from "./model/block";
|
|
20
21
|
import { ProsemirrorNode, ProsemirrorMark } from "./prosemirror/types";
|
|
@@ -354,6 +355,10 @@ function serializeTableNode(node: PageBlockItemTableNode): ProsemirrorNode {
|
|
|
354
355
|
case "RichText":
|
|
355
356
|
return {
|
|
356
357
|
type: "paragraph",
|
|
358
|
+
attrs: {
|
|
359
|
+
id: node.id,
|
|
360
|
+
definitionId: "io.supernova.block.rich-text",
|
|
361
|
+
},
|
|
357
362
|
...serializeRichTextNodePart(node.value),
|
|
358
363
|
};
|
|
359
364
|
|
|
@@ -361,7 +366,18 @@ function serializeTableNode(node: PageBlockItemTableNode): ProsemirrorNode {
|
|
|
361
366
|
return {
|
|
362
367
|
type: "image",
|
|
363
368
|
attrs: {
|
|
364
|
-
|
|
369
|
+
id: node.id,
|
|
370
|
+
definitionId: "io.supernova.block.image",
|
|
371
|
+
items: JSON.stringify([
|
|
372
|
+
{
|
|
373
|
+
id: node.id,
|
|
374
|
+
props: {
|
|
375
|
+
image: {
|
|
376
|
+
value: node.value,
|
|
377
|
+
} satisfies PageBlockItemImageValue,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
]),
|
|
365
381
|
},
|
|
366
382
|
};
|
|
367
383
|
}
|