@supernova-studio/client 0.17.0 → 0.19.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 +8568 -31209
- package/dist/index.d.ts +8568 -31209
- package/dist/index.js +88 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -137
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/documentation/group-action.ts +8 -4
- package/src/api/dto/elements/documentation/group.ts +20 -0
- package/src/api/dto/elements/documentation/index.ts +0 -2
- package/src/api/dto/elements/documentation/page-actions-v2.ts +8 -4
- package/src/api/dto/elements/index.ts +0 -1
- package/src/yjs/design-system-content/item-configuration.ts +41 -10
- package/src/yjs/design-system-content/item-title.ts +0 -0
- package/src/yjs/docs-editor/model/block.ts +2 -6
- package/src/api/dto/elements/documentation/group-bulk-action.ts +0 -32
- package/src/api/dto/elements/documentation/page-bulk-action-v2.ts +0 -33
- package/src/api/dto/elements/elements-bulk-action-v2.ts +0 -25
package/package.json
CHANGED
|
@@ -11,24 +11,28 @@ import {
|
|
|
11
11
|
// Read
|
|
12
12
|
//
|
|
13
13
|
|
|
14
|
+
const SuccessPayload = z.object({
|
|
15
|
+
success: z.literal(true),
|
|
16
|
+
});
|
|
17
|
+
|
|
14
18
|
export const DTODocumentationGroupCreateActionOutputV2 = z.object({
|
|
15
19
|
type: z.literal("DocumentationGroupCreate"),
|
|
16
|
-
output:
|
|
20
|
+
output: SuccessPayload,
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
export const DTODocumentationGroupUpdateActionOutputV2 = z.object({
|
|
20
24
|
type: z.literal("DocumentationGroupUpdate"),
|
|
21
|
-
output:
|
|
25
|
+
output: SuccessPayload,
|
|
22
26
|
});
|
|
23
27
|
|
|
24
28
|
export const DTODocumentationGroupDuplicateActionOutputV2 = z.object({
|
|
25
29
|
type: z.literal("DocumentationGroupDuplicate"),
|
|
26
|
-
output:
|
|
30
|
+
output: SuccessPayload,
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
export const DTODocumentationGroupDeleteActionOutputV2 = z.object({
|
|
30
34
|
type: z.literal("DocumentationGroupDelete"),
|
|
31
|
-
output:
|
|
35
|
+
output: SuccessPayload,
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
export type DTODocumentationGroupCreateActionOutputV2 = z.infer<typeof DTODocumentationGroupCreateActionOutputV2>;
|
|
@@ -57,6 +57,10 @@ export const DTOUpdateDocumentationGroupInput = z.object({
|
|
|
57
57
|
// Group properties
|
|
58
58
|
title: z.string().optional(),
|
|
59
59
|
configuration: DocumentationItemConfiguration.optional(),
|
|
60
|
+
|
|
61
|
+
// Group placement properties
|
|
62
|
+
afterPersistentId: z.string().uuid().optional(),
|
|
63
|
+
parentPersistentId: z.string().uuid().optional(),
|
|
60
64
|
});
|
|
61
65
|
|
|
62
66
|
export const DTODuplicateDocumentationGroupInput = z.object({
|
|
@@ -71,6 +75,20 @@ export const DTODuplicateDocumentationGroupInput = z.object({
|
|
|
71
75
|
parentPersistentId: z.string().uuid(),
|
|
72
76
|
});
|
|
73
77
|
|
|
78
|
+
export const DTOCreateDocumentationTabGroupInput = z.object({
|
|
79
|
+
// New group persistent id
|
|
80
|
+
persistentId: z.string().uuid(),
|
|
81
|
+
|
|
82
|
+
// Page that will become first tab of the tab group
|
|
83
|
+
fromPageId: z.string(),
|
|
84
|
+
tabName: z.string(),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const DTODeleteDocumentationTabGroupInput = z.object({
|
|
88
|
+
// Deleted group id
|
|
89
|
+
id: z.string(),
|
|
90
|
+
});
|
|
91
|
+
|
|
74
92
|
export const DTODeleteDocumentationGroupInput = z.object({
|
|
75
93
|
// Identifier
|
|
76
94
|
id: z.string(),
|
|
@@ -82,4 +100,6 @@ export const DTODeleteDocumentationGroupInput = z.object({
|
|
|
82
100
|
export type DTOCreateDocumentationGroupInput = z.infer<typeof DTOCreateDocumentationGroupInput>;
|
|
83
101
|
export type DTOUpdateDocumentationGroupInput = z.infer<typeof DTOUpdateDocumentationGroupInput>;
|
|
84
102
|
export type DTODuplicateDocumentationGroupInput = z.infer<typeof DTODuplicateDocumentationGroupInput>;
|
|
103
|
+
export type DTOCreateDocumentationTabGroupInput = z.infer<typeof DTOCreateDocumentationTabGroupInput>;
|
|
104
|
+
export type DTODeleteDocumentationTabGroupInput = z.infer<typeof DTODeleteDocumentationTabGroupInput>;
|
|
85
105
|
export type DTODeleteDocumentationGroupInput = z.infer<typeof DTODeleteDocumentationGroupInput>;
|
|
@@ -11,24 +11,28 @@ import {
|
|
|
11
11
|
// Read
|
|
12
12
|
//
|
|
13
13
|
|
|
14
|
+
const SuccessPayload = z.object({
|
|
15
|
+
success: z.literal(true),
|
|
16
|
+
});
|
|
17
|
+
|
|
14
18
|
export const DTODocumentationPageCreateActionOutputV2 = z.object({
|
|
15
19
|
type: z.literal("DocumentationPageCreate"),
|
|
16
|
-
output:
|
|
20
|
+
output: SuccessPayload,
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
export const DTODocumentationPageUpdateActionOutputV2 = z.object({
|
|
20
24
|
type: z.literal("DocumentationPageUpdate"),
|
|
21
|
-
output:
|
|
25
|
+
output: SuccessPayload,
|
|
22
26
|
});
|
|
23
27
|
|
|
24
28
|
export const DTODocumentationPageDuplicateActionOutputV2 = z.object({
|
|
25
29
|
type: z.literal("DocumentationPageDuplicate"),
|
|
26
|
-
output:
|
|
30
|
+
output: SuccessPayload,
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
export const DTODocumentationPageDeleteActionOutputV2 = z.object({
|
|
30
34
|
type: z.literal("DocumentationPageDelete"),
|
|
31
|
-
output:
|
|
35
|
+
output: SuccessPayload,
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
export type DTODocumentationPageCreateActionOutputV2 = z.infer<typeof DTODocumentationPageCreateActionOutputV2>;
|
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
import { DocumentationItemConfiguration, DocumentationItemHeader } from "@supernova-studio/model";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
//
|
|
6
|
+
// Types
|
|
7
|
+
//
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
+
export const DTODocumentationPageRoomHeaderData = z.object({
|
|
10
|
+
title: z.string(),
|
|
11
|
+
configuration: DocumentationItemConfiguration,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const DTODocumentationPageRoomHeaderDataUpdate = z.object({
|
|
15
|
+
title: z.string().optional(),
|
|
16
|
+
configuration: DocumentationItemConfiguration.omit({ header: true })
|
|
17
|
+
.extend({ header: DocumentationItemHeader.partial() })
|
|
18
|
+
.optional(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type DTODocumentationPageRoomHeaderData = z.infer<typeof DTODocumentationPageRoomHeaderData>;
|
|
22
|
+
export type DTODocumentationPageRoomHeaderDataUpdate = z.infer<typeof DTODocumentationPageRoomHeaderDataUpdate>;
|
|
23
|
+
|
|
24
|
+
//
|
|
25
|
+
// YJS Bindings
|
|
26
|
+
//
|
|
27
|
+
|
|
28
|
+
export function itemConfigurationToYjs(yDoc: Y.Doc, item: DTODocumentationPageRoomHeaderDataUpdate) {
|
|
9
29
|
yDoc.transact(trx => {
|
|
10
|
-
const
|
|
30
|
+
const { title, configuration } = item;
|
|
31
|
+
|
|
32
|
+
const header = configuration?.header;
|
|
33
|
+
|
|
34
|
+
if (title !== undefined) {
|
|
35
|
+
const headerYMap = trx.doc.getMap("itemTitle");
|
|
36
|
+
headerYMap.set("title", title);
|
|
37
|
+
}
|
|
11
38
|
|
|
12
39
|
if (header) {
|
|
13
40
|
const headerYMap = trx.doc.getMap("itemHeader");
|
|
@@ -25,15 +52,16 @@ export function itemConfigurationToYjs(yDoc: Y.Doc, item: UpdateDocumentationIte
|
|
|
25
52
|
header.minHeight !== undefined && headerYMap.set("minHeight", header.minHeight);
|
|
26
53
|
}
|
|
27
54
|
|
|
28
|
-
if (
|
|
55
|
+
if (configuration?.showSidebar !== undefined) {
|
|
29
56
|
const configYMap = trx.doc.getMap("itemConfiguration");
|
|
30
|
-
|
|
31
|
-
configYMap.set("showSidebar", item.showSidebar);
|
|
57
|
+
configYMap.set("showSidebar", configuration.showSidebar);
|
|
32
58
|
}
|
|
33
59
|
});
|
|
34
60
|
}
|
|
35
61
|
|
|
36
|
-
export function yjsToItemConfiguration(yDoc: Y.Doc):
|
|
62
|
+
export function yjsToItemConfiguration(yDoc: Y.Doc): DTODocumentationPageRoomHeaderData {
|
|
63
|
+
const title = yDoc.getMap("itemTitle").get("title");
|
|
64
|
+
|
|
37
65
|
const headerYMap = yDoc.getMap("itemHeader");
|
|
38
66
|
const rawHeader = {
|
|
39
67
|
description: headerYMap.get("description"),
|
|
@@ -53,5 +81,8 @@ export function yjsToItemConfiguration(yDoc: Y.Doc): DocumentationItemConfigurat
|
|
|
53
81
|
header: rawHeader,
|
|
54
82
|
};
|
|
55
83
|
|
|
56
|
-
return
|
|
84
|
+
return {
|
|
85
|
+
title: z.string().parse(title),
|
|
86
|
+
configuration: DocumentationItemConfiguration.parse(rawConfig),
|
|
87
|
+
};
|
|
57
88
|
}
|
|
File without changes
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PageBlockEditorModel as ModelPageBlockEditorModel } from "@supernova-studio/model";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
|
-
export const PageBlockEditorModel =
|
|
5
|
-
id: z.string(),
|
|
6
|
-
data: PageBlockDataV2,
|
|
7
|
-
});
|
|
8
|
-
|
|
4
|
+
export const PageBlockEditorModel = ModelPageBlockEditorModel;
|
|
9
5
|
export type PageBlockEditorModel = z.infer<typeof PageBlockEditorModel>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
DTOCreateDocumentationGroupInput,
|
|
4
|
-
DTODocumentationGroup,
|
|
5
|
-
DTODuplicateDocumentationGroupInput,
|
|
6
|
-
DTOUpdateDocumentationGroupInput,
|
|
7
|
-
} from "./group";
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
// Read
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
export const DTODocumentationGroupBulkActionOutputV2 = z.object({
|
|
14
|
-
created: z.array(DTODocumentationGroup),
|
|
15
|
-
updated: z.array(DTODocumentationGroup),
|
|
16
|
-
deleted: z.array(z.string()),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export type DTODocumentationGroupBulkActionOutputV2 = z.infer<typeof DTODocumentationGroupBulkActionOutputV2>;
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
// Write
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
export const DTODocumentationGroupBulkActionInputV2 = z.object({
|
|
26
|
-
create: z.array(DTOCreateDocumentationGroupInput).optional(),
|
|
27
|
-
update: z.array(DTOUpdateDocumentationGroupInput).optional(),
|
|
28
|
-
duplicate: z.array(DTODuplicateDocumentationGroupInput).optional(),
|
|
29
|
-
delete: z.array(z.string()).optional(),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export type DTODocumentationGroupBulkActionInputV2 = z.infer<typeof DTODocumentationGroupBulkActionInputV2>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
DTOCreateDocumentationPageInputV2,
|
|
4
|
-
DTODeleteDocumentationPageInputV2,
|
|
5
|
-
DTODocumentationPageV2,
|
|
6
|
-
DTODuplicateDocumentationPageInputV2,
|
|
7
|
-
DTOUpdateDocumentationPageInputV2,
|
|
8
|
-
} from "./page-v2";
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
// Read
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
export const DTODocumentationPageBulkActionOutputV2 = z.object({
|
|
15
|
-
created: z.array(DTODocumentationPageV2),
|
|
16
|
-
updated: z.array(DTODocumentationPageV2),
|
|
17
|
-
deleted: z.array(z.string()),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export type DTODocumentationPageBulkActionOutputV2 = z.infer<typeof DTODocumentationPageBulkActionOutputV2>;
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
// Write
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
export const DTODocumentationPageBulkActionInputV2 = z.object({
|
|
27
|
-
create: z.array(DTOCreateDocumentationPageInputV2).optional(),
|
|
28
|
-
update: z.array(DTOUpdateDocumentationPageInputV2).optional(),
|
|
29
|
-
duplicate: z.array(DTODuplicateDocumentationPageInputV2).optional(),
|
|
30
|
-
delete: z.array(DTODeleteDocumentationPageInputV2).optional(),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export type DTODocumentationPageBulkActionInputV2 = z.infer<typeof DTODocumentationPageBulkActionInputV2>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
DTODocumentationPageBulkActionInputV2,
|
|
4
|
-
DTODocumentationPageBulkActionOutputV2,
|
|
5
|
-
} from "./documentation/page-bulk-action-v2";
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
// Read
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
export const DTOElementsBulkActionOutputV2 = z.object({
|
|
12
|
-
documentationPages: DTODocumentationPageBulkActionOutputV2,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export type DTOElementsBulkActionOutputV2 = z.infer<typeof DTOElementsBulkActionOutputV2>;
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
// Write
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
export const DTOElementsBulkActionInputV2 = z.object({
|
|
22
|
-
documentationPages: DTODocumentationPageBulkActionInputV2,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export type DTOElementsBulkActionInputV2 = z.infer<typeof DTOElementsBulkActionInputV2>;
|