@supernova-studio/client 0.19.2 → 0.20.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 +657 -6065
- package/dist/index.d.ts +657 -6065
- package/dist/index.js +78 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1068 -1034
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/conversion/documentation/documentation-group-to-dto.ts +6 -6
- package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +2 -2
- package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +2 -2
- package/src/api/dto/elements/documentation/group-action.ts +1 -1
- package/src/api/dto/elements/documentation/group.ts +8 -8
- package/src/api/dto/elements/documentation/page-v2.ts +3 -3
- package/src/yjs/design-system-content/index.ts +1 -0
- package/src/yjs/design-system-content/item-configuration.ts +5 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultDocumentationItemHeaderV2, DocumentationPageV1, groupBy } from "@supernova-studio/model";
|
|
2
2
|
import { DocumentationPageV2 } from "@supernova-studio/model";
|
|
3
3
|
import { ElementGroup } from "@supernova-studio/model";
|
|
4
|
-
import {
|
|
4
|
+
import { DTODocumentationGroupV2, DTODocumentationGroupStructureV2 } from "../../dto";
|
|
5
5
|
|
|
6
6
|
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
7
7
|
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
@@ -12,7 +12,7 @@ import { DTODocumentationGroup, DTODocumentationGroupStructure } from "../../dto
|
|
|
12
12
|
export function elementGroupsToDocumentationGroupStructureDTO(
|
|
13
13
|
groups: ElementGroup[],
|
|
14
14
|
pages: (DocumentationPageV1 | DocumentationPageV2)[]
|
|
15
|
-
):
|
|
15
|
+
): DTODocumentationGroupStructureV2[] {
|
|
16
16
|
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
17
17
|
|
|
18
18
|
return groups.map(group => elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap));
|
|
@@ -21,7 +21,7 @@ export function elementGroupsToDocumentationGroupStructureDTO(
|
|
|
21
21
|
export function elementGroupsToDocumentationGroupDTO(
|
|
22
22
|
groups: ElementGroup[],
|
|
23
23
|
pages: (DocumentationPageV1 | DocumentationPageV2)[]
|
|
24
|
-
):
|
|
24
|
+
): DTODocumentationGroupV2[] {
|
|
25
25
|
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
26
26
|
|
|
27
27
|
return groups.map(group => {
|
|
@@ -29,7 +29,7 @@ export function elementGroupsToDocumentationGroupDTO(
|
|
|
29
29
|
...elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap),
|
|
30
30
|
configuration: group.data?.configuration ?? {
|
|
31
31
|
showSidebar: true,
|
|
32
|
-
header:
|
|
32
|
+
header: defaultDocumentationItemHeaderV2,
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
35
|
});
|
|
@@ -38,7 +38,7 @@ export function elementGroupsToDocumentationGroupDTO(
|
|
|
38
38
|
function elementGroupToDocumentationGroupStructureDTO(
|
|
39
39
|
group: ElementGroup,
|
|
40
40
|
childrenIdsMap: Map<string, string[]>
|
|
41
|
-
):
|
|
41
|
+
): DTODocumentationGroupStructureV2 {
|
|
42
42
|
const childrenIds = childrenIdsMap.get(group.persistentId) ?? [];
|
|
43
43
|
|
|
44
44
|
if (!group.shortPersistentId) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SupernovaException } from "@supernova-studio/model";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultDocumentationItemHeaderV1, DocumentationPageV1 } from "@supernova-studio/model";
|
|
3
3
|
import { ElementGroup } from "@supernova-studio/model";
|
|
4
4
|
import { buildDocPagePublishPaths } from "./documentation-page-to-dto-utils";
|
|
5
5
|
import { DocumentationPageV1DTO } from "../../dto";
|
|
@@ -33,7 +33,7 @@ export function documentationPagesToDTOV1(
|
|
|
33
33
|
userSlug: page.userSlug,
|
|
34
34
|
configuration: page.data.configuration ?? {
|
|
35
35
|
showSidebar: true,
|
|
36
|
-
header:
|
|
36
|
+
header: defaultDocumentationItemHeaderV1,
|
|
37
37
|
},
|
|
38
38
|
createdAt: page.createdAt,
|
|
39
39
|
updatedAt: page.updatedAt,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DocumentationPageV2, defaultDocumentationItemHeaderV2 } from "@supernova-studio/model";
|
|
2
2
|
import { ElementGroup } from "@supernova-studio/model";
|
|
3
3
|
import { buildDocPagePublishPaths } from "./documentation-page-to-dto-utils";
|
|
4
4
|
import { DTODocumentationPageStructureV2, DTODocumentationPageV2 } from "../../dto";
|
|
@@ -27,7 +27,7 @@ export function documentationPagesToDTOV2(
|
|
|
27
27
|
...documentationPageToStructureDTOV2(page, pathsMap),
|
|
28
28
|
configuration: page.data.configuration ?? {
|
|
29
29
|
showSidebar: true,
|
|
30
|
-
header:
|
|
30
|
+
header: defaultDocumentationItemHeaderV2,
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
33
|
});
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import {
|
|
3
3
|
DTOCreateDocumentationGroupInput,
|
|
4
4
|
DTODeleteDocumentationGroupInput,
|
|
5
|
-
|
|
5
|
+
DTODocumentationGroupV2,
|
|
6
6
|
DTODuplicateDocumentationGroupInput,
|
|
7
7
|
DTOMoveDocumentationGroupInput,
|
|
8
8
|
DTOUpdateDocumentationGroupInput,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DocumentationGroupBehavior,
|
|
2
|
+
import { DocumentationGroupBehavior, DocumentationItemConfigurationV2, ElementGroup } from "@supernova-studio/model";
|
|
3
3
|
|
|
4
4
|
//
|
|
5
5
|
// Read
|
|
@@ -9,7 +9,7 @@ import { DocumentationGroupBehavior, DocumentationItemConfiguration, ElementGrou
|
|
|
9
9
|
* Structure DTO is element properties minus element data (in other words data required
|
|
10
10
|
* to display the element in the left panel)
|
|
11
11
|
*/
|
|
12
|
-
export const
|
|
12
|
+
export const DTODocumentationGroupStructureV2 = ElementGroup.omit({
|
|
13
13
|
sortOrder: true,
|
|
14
14
|
parentPersistentId: true,
|
|
15
15
|
brandPersistentId: true,
|
|
@@ -26,12 +26,12 @@ export const DTODocumentationGroupStructure = ElementGroup.omit({
|
|
|
26
26
|
type: z.literal("Group"),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const
|
|
30
|
-
configuration:
|
|
29
|
+
export const DTODocumentationGroupV2 = DTODocumentationGroupStructureV2.extend({
|
|
30
|
+
configuration: DocumentationItemConfigurationV2,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
export type
|
|
34
|
-
export type
|
|
33
|
+
export type DTODocumentationGroupStructureV2 = z.infer<typeof DTODocumentationGroupStructureV2>;
|
|
34
|
+
export type DTODocumentationGroupV2 = z.infer<typeof DTODocumentationGroupV2>;
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Write
|
|
@@ -43,7 +43,7 @@ export const DTOCreateDocumentationGroupInput = z.object({
|
|
|
43
43
|
|
|
44
44
|
// Group properties
|
|
45
45
|
title: z.string(),
|
|
46
|
-
configuration:
|
|
46
|
+
configuration: DocumentationItemConfigurationV2.optional(),
|
|
47
47
|
groupBehavior: DocumentationGroupBehavior,
|
|
48
48
|
|
|
49
49
|
// Group placement properties
|
|
@@ -57,7 +57,7 @@ export const DTOUpdateDocumentationGroupInput = z.object({
|
|
|
57
57
|
|
|
58
58
|
// Group properties
|
|
59
59
|
title: z.string().optional(),
|
|
60
|
-
configuration:
|
|
60
|
+
configuration: DocumentationItemConfigurationV2.optional(),
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
export const DTOMoveDocumentationGroupInput = z.object({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { DocumentationItemConfigurationV2 } from "@supernova-studio/model";
|
|
3
3
|
import { DocumentationPageV2 } from "@supernova-studio/model";
|
|
4
|
-
import {
|
|
4
|
+
import { DTODocumentationGroupStructureV2 } from "./group";
|
|
5
5
|
|
|
6
6
|
//
|
|
7
7
|
// Read
|
|
@@ -28,7 +28,7 @@ export const DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend({
|
|
|
28
28
|
|
|
29
29
|
export const DTODocumentationHierarchyV2 = z.object({
|
|
30
30
|
pages: z.array(DTODocumentationPageStructureV2),
|
|
31
|
-
groups: z.array(
|
|
31
|
+
groups: z.array(DTODocumentationGroupStructureV2),
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
export type DTODocumentationPageV2 = z.infer<typeof DTODocumentationPageV2>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DocumentationItemConfigurationV2, DocumentationItemHeaderV2 } from "@supernova-studio/model";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
@@ -8,13 +8,13 @@ import { z } from "zod";
|
|
|
8
8
|
|
|
9
9
|
export const DTODocumentationPageRoomHeaderData = z.object({
|
|
10
10
|
title: z.string(),
|
|
11
|
-
configuration:
|
|
11
|
+
configuration: DocumentationItemConfigurationV2,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export const DTODocumentationPageRoomHeaderDataUpdate = z.object({
|
|
15
15
|
title: z.string().optional(),
|
|
16
|
-
configuration:
|
|
17
|
-
.extend({ header:
|
|
16
|
+
configuration: DocumentationItemConfigurationV2.omit({ header: true })
|
|
17
|
+
.extend({ header: DocumentationItemHeaderV2.partial() })
|
|
18
18
|
.optional(),
|
|
19
19
|
});
|
|
20
20
|
|
|
@@ -83,6 +83,6 @@ export function yjsToItemConfiguration(yDoc: Y.Doc): DTODocumentationPageRoomHea
|
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
85
|
title: z.string().parse(title),
|
|
86
|
-
configuration:
|
|
86
|
+
configuration: DocumentationItemConfigurationV2.parse(rawConfig),
|
|
87
87
|
};
|
|
88
88
|
}
|