@supernova-studio/client 0.15.0 → 0.17.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 +35218 -4953
- package/dist/index.d.ts +35218 -4953
- package/dist/index.js +1167 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1195 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts +20 -0
- package/src/api/conversion/documentation/documentation-group-to-dto.ts +83 -0
- package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +54 -0
- package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +43 -0
- package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +57 -0
- package/src/api/conversion/documentation/index.ts +5 -0
- package/src/api/conversion/index.ts +1 -0
- package/src/api/dto/{design-system.ts → design-systems/design-system.ts} +6 -2
- package/src/api/dto/design-systems/index.ts +1 -0
- package/src/api/dto/documentation/index.ts +0 -0
- package/src/api/dto/elements/documentation/group-action.ts +66 -0
- package/src/api/dto/elements/documentation/group-bulk-action.ts +32 -0
- package/src/api/dto/elements/documentation/group.ts +85 -0
- package/src/api/dto/elements/documentation/index.ts +7 -0
- package/src/api/dto/elements/documentation/page-actions-v2.ts +66 -0
- package/src/api/dto/elements/documentation/page-bulk-action-v2.ts +33 -0
- package/src/api/dto/{documentation-v1.ts → elements/documentation/page-v1.ts} +4 -0
- package/src/api/dto/elements/documentation/page-v2.ts +87 -0
- package/src/api/dto/elements/elements-action-v2.ts +61 -0
- package/src/api/dto/elements/elements-bulk-action-v2.ts +25 -0
- package/src/api/dto/elements/index.ts +3 -0
- package/src/api/dto/index.ts +2 -3
- package/src/api/index.ts +2 -2
- package/src/api/payloads/documentation/block-definitions.ts +12 -0
- package/src/api/payloads/documentation/index.ts +1 -0
- package/src/api/payloads/index.ts +2 -0
- package/src/api/payloads/liveblocks/auth.ts +7 -0
- package/src/api/payloads/liveblocks/index.ts +1 -0
- package/src/index.ts +1 -2
- package/src/yjs/design-system-content/documentation-hierarchy.ts +100 -0
- package/src/yjs/index.ts +2 -0
- package/src/api/dto/documentation-v2.ts +0 -28
- package/src/api/dto/documentation.ts +0 -29
- package/src/api/requests/elements/elements-transaction-v2.ts +0 -53
- package/src/api/requests/elements/index.ts +0 -1
- package/src/api/requests/index.ts +0 -2
- package/src/api/requests/post-liveblocks-auth.ts +0 -4
- package/src/api/responses/elements/elements-transaction-v2.ts +0 -11
- package/src/api/responses/elements/index.ts +0 -1
- package/src/api/responses/get-block-definitions.ts +0 -8
- package/src/api/responses/index.ts +0 -2
- package/src/design-system-content/documentation-hierarchy.ts +0 -74
- /package/src/{design-system-content → yjs/design-system-content}/index.ts +0 -0
- /package/src/{design-system-content → yjs/design-system-content}/item-configuration.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/blocks-to-prosemirror.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/mock.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/model/block.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/model/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/model/page.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/schema.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/types.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror-to-blocks.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/utils.ts +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { documentationPagesToStructureDTOV2 } from "./documentation-page-v2-to-dto";
|
|
2
|
+
import { elementGroupsToDocumentationGroupStructureDTO } from "./documentation-group-to-dto";
|
|
3
|
+
import { DocumentationPageV2, ElementGroup } from "@supernova-studio/model";
|
|
4
|
+
import { DTODocumentationHierarchyV2 } from "../../dto";
|
|
5
|
+
|
|
6
|
+
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
7
|
+
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
8
|
+
// Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
|
|
9
|
+
//
|
|
10
|
+
// Please do not put more DTO conversion here unless you know what you're doing.
|
|
11
|
+
|
|
12
|
+
export function documentationElementsToHierarchyDto(
|
|
13
|
+
docPages: DocumentationPageV2[],
|
|
14
|
+
docGroups: ElementGroup[]
|
|
15
|
+
): DTODocumentationHierarchyV2 {
|
|
16
|
+
return {
|
|
17
|
+
pages: documentationPagesToStructureDTOV2(docPages, docGroups),
|
|
18
|
+
groups: elementGroupsToDocumentationGroupStructureDTO(docGroups, docPages),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defaultDocumentationItemHeader, DocumentationPageV1, groupBy } from "@supernova-studio/model";
|
|
2
|
+
import { DocumentationPageV2 } from "@supernova-studio/model";
|
|
3
|
+
import { ElementGroup } from "@supernova-studio/model";
|
|
4
|
+
import { DTODocumentationGroup, DTODocumentationGroupStructure } from "../../dto";
|
|
5
|
+
|
|
6
|
+
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
7
|
+
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
8
|
+
// Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
|
|
9
|
+
//
|
|
10
|
+
// Please do not put more DTO conversion here unless you know what you're doing.
|
|
11
|
+
|
|
12
|
+
export function elementGroupsToDocumentationGroupStructureDTO(
|
|
13
|
+
groups: ElementGroup[],
|
|
14
|
+
pages: (DocumentationPageV1 | DocumentationPageV2)[]
|
|
15
|
+
): DTODocumentationGroupStructure[] {
|
|
16
|
+
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
17
|
+
|
|
18
|
+
return groups.map(group => elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function elementGroupsToDocumentationGroupDTO(
|
|
22
|
+
groups: ElementGroup[],
|
|
23
|
+
pages: (DocumentationPageV1 | DocumentationPageV2)[]
|
|
24
|
+
): DTODocumentationGroup[] {
|
|
25
|
+
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
26
|
+
|
|
27
|
+
return groups.map(group => {
|
|
28
|
+
return {
|
|
29
|
+
...elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap),
|
|
30
|
+
configuration: group.data?.configuration ?? {
|
|
31
|
+
showSidebar: true,
|
|
32
|
+
header: defaultDocumentationItemHeader,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function elementGroupToDocumentationGroupStructureDTO(
|
|
39
|
+
group: ElementGroup,
|
|
40
|
+
childrenIdsMap: Map<string, string[]>
|
|
41
|
+
): DTODocumentationGroupStructure {
|
|
42
|
+
const childrenIds = childrenIdsMap.get(group.persistentId) ?? [];
|
|
43
|
+
|
|
44
|
+
if (!group.shortPersistentId) {
|
|
45
|
+
throw new Error(`Short persistent id is required for docs groups, group id: ${group.id}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
id: group.id,
|
|
50
|
+
designSystemVersionId: group.designSystemVersionId,
|
|
51
|
+
persistentId: group.persistentId,
|
|
52
|
+
slug: group.slug,
|
|
53
|
+
userSlug: group.userSlug,
|
|
54
|
+
createdAt: group.createdAt,
|
|
55
|
+
updatedAt: group.updatedAt,
|
|
56
|
+
title: group.meta.name,
|
|
57
|
+
childrenIds: childrenIds,
|
|
58
|
+
isRoot: !group.parentPersistentId,
|
|
59
|
+
groupBehavior: group.data?.behavior ?? "Group",
|
|
60
|
+
shortPersistentId: group.shortPersistentId,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function calculateChildrenIdsMap(
|
|
65
|
+
elements: { persistentId: string; parentPersistentId: string; sortOrder: number }[],
|
|
66
|
+
groups: ElementGroup[]
|
|
67
|
+
): Map<string, string[]> {
|
|
68
|
+
const byParentId = groupBy([...elements, ...groups], e => e.parentPersistentId);
|
|
69
|
+
|
|
70
|
+
const childrenIdsMap = new Map<string, string[]>();
|
|
71
|
+
|
|
72
|
+
for (const [parentPersistentId, children] of byParentId) {
|
|
73
|
+
if (!parentPersistentId) continue;
|
|
74
|
+
children.sort((lhs, rhs) => lhs.sortOrder - rhs.sortOrder);
|
|
75
|
+
|
|
76
|
+
childrenIdsMap.set(
|
|
77
|
+
parentPersistentId,
|
|
78
|
+
children.map(c => c.persistentId)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return childrenIdsMap;
|
|
83
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DocumentationPageV1, DocumentationPageV2, ElementGroup, slugify } from "@supernova-studio/model";
|
|
2
|
+
import { mapByUnique } from "@supernova-studio/model";
|
|
3
|
+
|
|
4
|
+
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
5
|
+
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
6
|
+
// Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
|
|
7
|
+
//
|
|
8
|
+
// Please do not put more DTO conversion here unless you know what you're doing.
|
|
9
|
+
|
|
10
|
+
export function buildDocPagePublishPaths(
|
|
11
|
+
groups: ElementGroup[],
|
|
12
|
+
pages: (DocumentationPageV1 | DocumentationPageV2)[]
|
|
13
|
+
): Map<string, string> {
|
|
14
|
+
const groupPersistentIdToGroupMap = mapByUnique(groups, group => group.persistentId);
|
|
15
|
+
const result = new Map<string, string>();
|
|
16
|
+
|
|
17
|
+
for (const page of pages) {
|
|
18
|
+
const parentChain = calculateElementParentChain(page.parentPersistentId, groupPersistentIdToGroupMap);
|
|
19
|
+
|
|
20
|
+
let pathV1 = `${page.userSlug || page.slug}.html`;
|
|
21
|
+
let pathV2 = `${slugify(page.meta.name)}-${page.shortPersistentId}`;
|
|
22
|
+
|
|
23
|
+
for (const parent of parentChain) {
|
|
24
|
+
if (!parent.parentPersistentId) continue;
|
|
25
|
+
|
|
26
|
+
pathV1 = `${parent.userSlug || parent.slug}/${pathV1}`;
|
|
27
|
+
pathV2 = `${slugify(parent.meta.name)}/${pathV2}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pathV1 = `/${pathV1}`;
|
|
31
|
+
pathV2 = `/${pathV2}`;
|
|
32
|
+
|
|
33
|
+
result.set(page.persistentId, pathV2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function calculateElementParentChain(
|
|
40
|
+
elementParentPersistentId: string,
|
|
41
|
+
groupPersistentIdToGroupMap: Map<string, ElementGroup>
|
|
42
|
+
): ElementGroup[] {
|
|
43
|
+
const result: ElementGroup[] = [];
|
|
44
|
+
|
|
45
|
+
let parentId: string | undefined = elementParentPersistentId;
|
|
46
|
+
while (parentId) {
|
|
47
|
+
const parent = groupPersistentIdToGroupMap.get(parentId);
|
|
48
|
+
if (parent) result.push(parent);
|
|
49
|
+
|
|
50
|
+
parentId = parent?.parentPersistentId;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SupernovaException } from "@supernova-studio/model";
|
|
2
|
+
import { defaultDocumentationItemHeader, DocumentationPageV1 } from "@supernova-studio/model";
|
|
3
|
+
import { ElementGroup } from "@supernova-studio/model";
|
|
4
|
+
import { buildDocPagePublishPaths } from "./documentation-page-to-dto-utils";
|
|
5
|
+
import { DocumentationPageV1DTO } from "../../dto";
|
|
6
|
+
|
|
7
|
+
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
8
|
+
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
9
|
+
// Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
|
|
10
|
+
//
|
|
11
|
+
// Please do not put more DTO conversion here unless you know what you're doing.
|
|
12
|
+
|
|
13
|
+
export function documentationPagesToDTOV1(
|
|
14
|
+
pages: DocumentationPageV1[],
|
|
15
|
+
groups: ElementGroup[]
|
|
16
|
+
): DocumentationPageV1DTO[] {
|
|
17
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
18
|
+
|
|
19
|
+
return pages.map(page => {
|
|
20
|
+
let path = pathsMap.get(page.persistentId);
|
|
21
|
+
if (!path) throw SupernovaException.conflict(`Path for page ${page.id} was not calculated`);
|
|
22
|
+
|
|
23
|
+
if (path.startsWith("/")) path = path.substring(1);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
id: page.id,
|
|
27
|
+
designSystemVersionId: page.designSystemVersionId,
|
|
28
|
+
persistentId: page.persistentId,
|
|
29
|
+
shortPersistentId: page.shortPersistentId,
|
|
30
|
+
title: page.meta.name,
|
|
31
|
+
blocks: page.data.blocks,
|
|
32
|
+
slug: page.slug,
|
|
33
|
+
userSlug: page.userSlug,
|
|
34
|
+
configuration: page.data.configuration ?? {
|
|
35
|
+
showSidebar: true,
|
|
36
|
+
header: defaultDocumentationItemHeader,
|
|
37
|
+
},
|
|
38
|
+
createdAt: page.createdAt,
|
|
39
|
+
updatedAt: page.updatedAt,
|
|
40
|
+
path: path,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defaultDocumentationItemHeader, DocumentationPageV2 } from "@supernova-studio/model";
|
|
2
|
+
import { ElementGroup } from "@supernova-studio/model";
|
|
3
|
+
import { buildDocPagePublishPaths } from "./documentation-page-to-dto-utils";
|
|
4
|
+
import { DTODocumentationPageStructureV2, DTODocumentationPageV2 } from "../../dto";
|
|
5
|
+
|
|
6
|
+
// The fact that DTO conversion is located here instead of main backend code is due to the fact
|
|
7
|
+
// that we store page and group data in YJS documents in the same way as they are stored in the database.
|
|
8
|
+
// Therefore, we need to expose this conversion to the client so that it can consume data from YJS documents.
|
|
9
|
+
//
|
|
10
|
+
// Please do not put more DTO conversion here unless you know what you're doing.
|
|
11
|
+
|
|
12
|
+
export function documentationPagesToStructureDTOV2(
|
|
13
|
+
pages: DocumentationPageV2[],
|
|
14
|
+
groups: ElementGroup[]
|
|
15
|
+
): DTODocumentationPageStructureV2[] {
|
|
16
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
17
|
+
return pages.map(page => documentationPageToStructureDTOV2(page, pathsMap));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function documentationPagesToDTOV2(
|
|
21
|
+
pages: DocumentationPageV2[],
|
|
22
|
+
groups: ElementGroup[]
|
|
23
|
+
): DTODocumentationPageV2[] {
|
|
24
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
25
|
+
return pages.map(page => {
|
|
26
|
+
return {
|
|
27
|
+
...documentationPageToStructureDTOV2(page, pathsMap),
|
|
28
|
+
configuration: page.data.configuration ?? {
|
|
29
|
+
showSidebar: true,
|
|
30
|
+
header: defaultDocumentationItemHeader,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function documentationPageToStructureDTOV2(
|
|
37
|
+
page: DocumentationPageV2,
|
|
38
|
+
pagePathMap: Map<string, string>
|
|
39
|
+
): DTODocumentationPageStructureV2 {
|
|
40
|
+
let path = pagePathMap.get(page.persistentId);
|
|
41
|
+
if (!path) throw new Error(`Path for page ${page.id} was not calculated`);
|
|
42
|
+
|
|
43
|
+
if (path.startsWith("/")) path = path.substring(1);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
id: page.id,
|
|
47
|
+
designSystemVersionId: page.designSystemVersionId,
|
|
48
|
+
persistentId: page.persistentId,
|
|
49
|
+
shortPersistentId: page.shortPersistentId,
|
|
50
|
+
title: page.meta.name,
|
|
51
|
+
slug: page.slug,
|
|
52
|
+
userSlug: page.userSlug,
|
|
53
|
+
createdAt: page.createdAt,
|
|
54
|
+
updatedAt: page.updatedAt,
|
|
55
|
+
path: path,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./documentation";
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { DesignSystem, ObjectMeta } from "@supernova-studio/model";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
//
|
|
5
|
+
// Read
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
export const DTODesignSystem = DesignSystem.omit({
|
|
5
9
|
name: true,
|
|
6
10
|
description: true,
|
|
7
11
|
}).extend({
|
|
8
12
|
meta: ObjectMeta,
|
|
9
13
|
});
|
|
10
14
|
|
|
11
|
-
export type
|
|
15
|
+
export type DTODesignSystem = z.infer<typeof DTODesignSystem>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./design-system";
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
DTOCreateDocumentationGroupInput,
|
|
4
|
+
DTODeleteDocumentationGroupInput,
|
|
5
|
+
DTODocumentationGroup,
|
|
6
|
+
DTODuplicateDocumentationGroupInput,
|
|
7
|
+
DTOUpdateDocumentationGroupInput,
|
|
8
|
+
} from "./group";
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// Read
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
export const DTODocumentationGroupCreateActionOutputV2 = z.object({
|
|
15
|
+
type: z.literal("DocumentationGroupCreate"),
|
|
16
|
+
output: DTODocumentationGroup,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const DTODocumentationGroupUpdateActionOutputV2 = z.object({
|
|
20
|
+
type: z.literal("DocumentationGroupUpdate"),
|
|
21
|
+
output: DTODocumentationGroup,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const DTODocumentationGroupDuplicateActionOutputV2 = z.object({
|
|
25
|
+
type: z.literal("DocumentationGroupDuplicate"),
|
|
26
|
+
output: DTODocumentationGroup,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const DTODocumentationGroupDeleteActionOutputV2 = z.object({
|
|
30
|
+
type: z.literal("DocumentationGroupDelete"),
|
|
31
|
+
output: z.string(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type DTODocumentationGroupCreateActionOutputV2 = z.infer<typeof DTODocumentationGroupCreateActionOutputV2>;
|
|
35
|
+
export type DTODocumentationGroupUpdateActionOutputV2 = z.infer<typeof DTODocumentationGroupUpdateActionOutputV2>;
|
|
36
|
+
export type DTODocumentationGroupDuplicateActionOutputV2 = z.infer<typeof DTODocumentationGroupDuplicateActionOutputV2>;
|
|
37
|
+
export type DTODocumentationGroupDeleteActionOutputV2 = z.infer<typeof DTODocumentationGroupDeleteActionOutputV2>;
|
|
38
|
+
|
|
39
|
+
//
|
|
40
|
+
// Write
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
export const DTODocumentationGroupCreateActionInputV2 = z.object({
|
|
44
|
+
type: z.literal("DocumentationGroupCreate"),
|
|
45
|
+
input: DTOCreateDocumentationGroupInput,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const DTODocumentationGroupUpdateActionInputV2 = z.object({
|
|
49
|
+
type: z.literal("DocumentationGroupUpdate"),
|
|
50
|
+
input: DTOUpdateDocumentationGroupInput,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const DTODocumentationGroupDuplicateActionInputV2 = z.object({
|
|
54
|
+
type: z.literal("DocumentationGroupDuplicate"),
|
|
55
|
+
input: DTODuplicateDocumentationGroupInput,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const DTODocumentationGroupDeleteActionInputV2 = z.object({
|
|
59
|
+
type: z.literal("DocumentationGroupDelete"),
|
|
60
|
+
input: DTODeleteDocumentationGroupInput,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export type DTODocumentationGroupCreateActionInputV2 = z.infer<typeof DTODocumentationGroupCreateActionInputV2>;
|
|
64
|
+
export type DTODocumentationGroupUpdateActionInputV2 = z.infer<typeof DTODocumentationGroupUpdateActionInputV2>;
|
|
65
|
+
export type DTODocumentationGroupDuplicateActionInputV2 = z.infer<typeof DTODocumentationGroupDuplicateActionInputV2>;
|
|
66
|
+
export type DTODocumentationGroupDeleteActionInputV2 = z.infer<typeof DTODocumentationGroupDeleteActionInputV2>;
|
|
@@ -0,0 +1,32 @@
|
|
|
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>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DocumentationGroupBehavior, DocumentationItemConfiguration, ElementGroup } from "@supernova-studio/model";
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Read
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Structure DTO is element properties minus element data (in other words data required
|
|
10
|
+
* to display the element in the left panel)
|
|
11
|
+
*/
|
|
12
|
+
export const DTODocumentationGroupStructure = ElementGroup.omit({
|
|
13
|
+
sortOrder: true,
|
|
14
|
+
parentPersistentId: true,
|
|
15
|
+
brandPersistentId: true,
|
|
16
|
+
meta: true,
|
|
17
|
+
childType: true,
|
|
18
|
+
data: true,
|
|
19
|
+
shortPersistentId: true,
|
|
20
|
+
}).extend({
|
|
21
|
+
title: z.string(),
|
|
22
|
+
isRoot: z.boolean(),
|
|
23
|
+
childrenIds: z.array(z.string()),
|
|
24
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
25
|
+
shortPersistentId: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const DTODocumentationGroup = DTODocumentationGroupStructure.extend({
|
|
29
|
+
configuration: DocumentationItemConfiguration,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type DTODocumentationGroupStructure = z.infer<typeof DTODocumentationGroupStructure>;
|
|
33
|
+
export type DTODocumentationGroup = z.infer<typeof DTODocumentationGroup>;
|
|
34
|
+
|
|
35
|
+
//
|
|
36
|
+
// Write
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
export const DTOCreateDocumentationGroupInput = z.object({
|
|
40
|
+
// Identifier
|
|
41
|
+
persistentId: z.string().uuid(),
|
|
42
|
+
|
|
43
|
+
// Group properties
|
|
44
|
+
title: z.string(),
|
|
45
|
+
configuration: DocumentationItemConfiguration.optional(),
|
|
46
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
47
|
+
|
|
48
|
+
// Group placement properties
|
|
49
|
+
afterPersistentId: z.string().uuid().optional(),
|
|
50
|
+
parentPersistentId: z.string().uuid(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const DTOUpdateDocumentationGroupInput = z.object({
|
|
54
|
+
// Identifier of the group to update
|
|
55
|
+
id: z.string().uuid(),
|
|
56
|
+
|
|
57
|
+
// Group properties
|
|
58
|
+
title: z.string().optional(),
|
|
59
|
+
configuration: DocumentationItemConfiguration.optional(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const DTODuplicateDocumentationGroupInput = z.object({
|
|
63
|
+
// Identifier of the group to duplicate from
|
|
64
|
+
id: z.string(),
|
|
65
|
+
|
|
66
|
+
// New group persistent id
|
|
67
|
+
persistentId: z.string().uuid(),
|
|
68
|
+
|
|
69
|
+
// Group placement properties
|
|
70
|
+
afterPersistentId: z.string().uuid().optional(),
|
|
71
|
+
parentPersistentId: z.string().uuid(),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const DTODeleteDocumentationGroupInput = z.object({
|
|
75
|
+
// Identifier
|
|
76
|
+
id: z.string(),
|
|
77
|
+
|
|
78
|
+
// Deletion options
|
|
79
|
+
deleteSubtree: z.boolean().default(false),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export type DTOCreateDocumentationGroupInput = z.infer<typeof DTOCreateDocumentationGroupInput>;
|
|
83
|
+
export type DTOUpdateDocumentationGroupInput = z.infer<typeof DTOUpdateDocumentationGroupInput>;
|
|
84
|
+
export type DTODuplicateDocumentationGroupInput = z.infer<typeof DTODuplicateDocumentationGroupInput>;
|
|
85
|
+
export type DTODeleteDocumentationGroupInput = z.infer<typeof DTODeleteDocumentationGroupInput>;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 DTODocumentationPageCreateActionOutputV2 = z.object({
|
|
15
|
+
type: z.literal("DocumentationPageCreate"),
|
|
16
|
+
output: DTODocumentationPageV2,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const DTODocumentationPageUpdateActionOutputV2 = z.object({
|
|
20
|
+
type: z.literal("DocumentationPageUpdate"),
|
|
21
|
+
output: DTODocumentationPageV2,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const DTODocumentationPageDuplicateActionOutputV2 = z.object({
|
|
25
|
+
type: z.literal("DocumentationPageDuplicate"),
|
|
26
|
+
output: DTODocumentationPageV2,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const DTODocumentationPageDeleteActionOutputV2 = z.object({
|
|
30
|
+
type: z.literal("DocumentationPageDelete"),
|
|
31
|
+
output: z.string(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type DTODocumentationPageCreateActionOutputV2 = z.infer<typeof DTODocumentationPageCreateActionOutputV2>;
|
|
35
|
+
export type DTODocumentationPageUpdateActionOutputV2 = z.infer<typeof DTODocumentationPageUpdateActionOutputV2>;
|
|
36
|
+
export type DTODocumentationPageDuplicateActionOutputV2 = z.infer<typeof DTODocumentationPageDuplicateActionOutputV2>;
|
|
37
|
+
export type DTODocumentationPageDeleteActionOutputV2 = z.infer<typeof DTODocumentationPageDeleteActionOutputV2>;
|
|
38
|
+
|
|
39
|
+
//
|
|
40
|
+
// Write
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
export const DTODocumentationPageCreateActionInputV2 = z.object({
|
|
44
|
+
type: z.literal("DocumentationPageCreate"),
|
|
45
|
+
input: DTOCreateDocumentationPageInputV2,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const DTODocumentationPageUpdateActionInputV2 = z.object({
|
|
49
|
+
type: z.literal("DocumentationPageUpdate"),
|
|
50
|
+
input: DTOUpdateDocumentationPageInputV2,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const DTODocumentationPageDuplicateActionInputV2 = z.object({
|
|
54
|
+
type: z.literal("DocumentationPageDuplicate"),
|
|
55
|
+
input: DTODuplicateDocumentationPageInputV2,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const DTODocumentationPageDeleteActionInputV2 = z.object({
|
|
59
|
+
type: z.literal("DocumentationPageDelete"),
|
|
60
|
+
input: DTODeleteDocumentationPageInputV2,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export type DTODocumentationPageCreateActionInputV2 = z.infer<typeof DTODocumentationPageCreateActionInputV2>;
|
|
64
|
+
export type DTODocumentationPageUpdateActionInputV2 = z.infer<typeof DTODocumentationPageUpdateActionInputV2>;
|
|
65
|
+
export type DTODocumentationPageDuplicateActionInputV2 = z.infer<typeof DTODocumentationPageDuplicateActionInputV2>;
|
|
66
|
+
export type DTODocumentationPageDeleteActionInputV2 = z.infer<typeof DTODocumentationPageDeleteActionInputV2>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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>;
|