@supernova-studio/client 0.14.0 → 0.16.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 +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/documentation-v2.ts +7 -7
- package/src/api/requests/elements/elements-transaction-v2.ts +3 -3
- package/src/api/responses/elements/elements-transaction-v2.ts +3 -3
- package/src/design-system-content/documentation-hierarchy.ts +6 -6
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { DocumentationGroupStructureDTO } from "./documentation";
|
|
|
6
6
|
* Structure DTO is element properties minus element data (in other words data required
|
|
7
7
|
* to display the element in the left panel)
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const DTODocumentationPageStructureV2 = DocumentationPageV2.omit({
|
|
10
10
|
data: true,
|
|
11
11
|
meta: true,
|
|
12
12
|
parentPersistentId: true,
|
|
@@ -16,13 +16,13 @@ export const DocumentationPageStructureV2DTO = DocumentationPageV2.omit({
|
|
|
16
16
|
path: z.string(),
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
export const
|
|
19
|
+
export const DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend(DocumentationPageV2.shape.data.shape);
|
|
20
20
|
|
|
21
|
-
export const
|
|
22
|
-
pages: z.array(
|
|
21
|
+
export const DTODocumentationHierarchyV2 = z.object({
|
|
22
|
+
pages: z.array(DTODocumentationPageStructureV2),
|
|
23
23
|
groups: z.array(DocumentationGroupStructureDTO),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
26
|
+
export type DTODocumentationPageV2 = z.infer<typeof DTODocumentationPageV2>;
|
|
27
|
+
export type DTODocumentationPageStructureV2 = z.infer<typeof DTODocumentationPageStructureV2>;
|
|
28
|
+
export type DTODocumentationHierarchyV2 = z.infer<typeof DTODocumentationHierarchyV2>;
|
|
@@ -29,7 +29,7 @@ export const DTODuplicateDocumentationPageInput = z.object({
|
|
|
29
29
|
afterPersistentId: z.string().uuid().optional(),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
export const
|
|
32
|
+
export const DTODocumentationElementsTransactionInput = z.object({
|
|
33
33
|
create: z.array(DTOCreateDocumentationPageInput).optional(),
|
|
34
34
|
update: z.array(DTOUpdateDocumentationPageInput).optional(),
|
|
35
35
|
duplicate: z.array(DTODuplicateDocumentationPageInput).optional(),
|
|
@@ -40,14 +40,14 @@ export type DTOCreateDocumentationPageInput = z.infer<typeof DTOCreateDocumentat
|
|
|
40
40
|
export type DTOUpdateDocumentationPageInput = z.infer<typeof DTOUpdateDocumentationPageInput>;
|
|
41
41
|
export type DTODuplicateDocumentationPageInput = z.infer<typeof DTODuplicateDocumentationPageInput>;
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type DTODocumentationElementsTransactionInput = z.infer<typeof DTODocumentationElementsTransactionInput>;
|
|
44
44
|
|
|
45
45
|
//
|
|
46
46
|
// Transaction
|
|
47
47
|
//
|
|
48
48
|
|
|
49
49
|
export const DTOElementsTransactionInput = z.object({
|
|
50
|
-
documentationPages:
|
|
50
|
+
documentationPages: DTODocumentationElementsTransactionInput,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
export type DTOElementsTransactionInput = z.infer<typeof DTOElementsTransactionInput>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DTODocumentationPageV2 } from "../../dto";
|
|
2
2
|
|
|
3
3
|
export type DTODocumentationElementsTransactionOutput = {
|
|
4
|
-
created:
|
|
5
|
-
updated:
|
|
4
|
+
created: DTODocumentationPageV2[];
|
|
5
|
+
updated: DTODocumentationPageV2[];
|
|
6
6
|
deleted: string[];
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Y from "yjs";
|
|
2
|
-
import {
|
|
2
|
+
import { DTODocumentationHierarchyV2, DTODocumentationPageStructureV2 } from "../api/dto/documentation-v2";
|
|
3
3
|
import { DocumentationGroupStructureDTO } from "../api";
|
|
4
4
|
|
|
5
5
|
//
|
|
@@ -17,7 +17,7 @@ type ItemsToDelete = {
|
|
|
17
17
|
|
|
18
18
|
export function documentationHierarchyToYjs(
|
|
19
19
|
doc: Y.Doc,
|
|
20
|
-
documentationHierarchy:
|
|
20
|
+
documentationHierarchy: DTODocumentationHierarchyV2,
|
|
21
21
|
itemsToDelete: ItemsToDelete
|
|
22
22
|
) {
|
|
23
23
|
doc.transact(trx => {
|
|
@@ -41,13 +41,13 @@ export function documentationHierarchyToYjs(
|
|
|
41
41
|
return doc;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export function yjsToDocumentationHierarchy(doc: Y.Doc):
|
|
44
|
+
export function yjsToDocumentationHierarchy(doc: Y.Doc): DTODocumentationHierarchyV2 {
|
|
45
45
|
const pagesMap = getPagesYMap(doc);
|
|
46
46
|
const groupsMap = getGroupsYMap(doc);
|
|
47
47
|
|
|
48
|
-
const pages:
|
|
48
|
+
const pages: DTODocumentationPageStructureV2[] = [];
|
|
49
49
|
pagesMap.forEach(page => {
|
|
50
|
-
pages.push(
|
|
50
|
+
pages.push(DTODocumentationPageStructureV2.parse(page));
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
const groups: DocumentationGroupStructureDTO[] = [];
|
|
@@ -66,7 +66,7 @@ export function yjsToDocumentationHierarchy(doc: Y.Doc): DocumentationHierarchyV
|
|
|
66
66
|
//
|
|
67
67
|
|
|
68
68
|
function getPagesYMap(doc: Y.Doc) {
|
|
69
|
-
return doc.getMap<
|
|
69
|
+
return doc.getMap<DTODocumentationPageStructureV2>("documentationPages");
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function getGroupsYMap(doc: Y.Doc) {
|