@supernova-studio/client 0.24.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 +4521 -3
- package/dist/index.d.ts +4521 -3
- package/dist/index.js +287 -182
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +572 -467
- 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/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(),
|
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
|
}
|