@supernova-studio/client 0.47.69 → 0.47.71
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 +2668 -2541
- package/dist/index.d.ts +2668 -2541
- package/dist/index.js +68 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/documentation/page-actions-v2.ts +26 -1
- package/src/api/dto/elements/documentation/page-v2.ts +12 -0
- package/src/api/dto/elements/elements-action-v2.ts +12 -0
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +4 -0
- package/src/yjs/version-room/backend.ts +2 -0
- package/src/yjs/version-room/frontend.ts +7 -2
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
DTODocumentationPageV2,
|
|
6
6
|
DTODuplicateDocumentationPageInputV2,
|
|
7
7
|
DTOMoveDocumentationPageInputV2,
|
|
8
|
+
DTORestoreDocumentationGroupInput,
|
|
9
|
+
DTORestoreDocumentationPageInput,
|
|
8
10
|
DTOUpdateDocumentationPageInputV2,
|
|
9
11
|
} from "./page-v2";
|
|
10
12
|
|
|
@@ -41,13 +43,24 @@ export const DTODocumentationPageDeleteActionOutputV2 = z.object({
|
|
|
41
43
|
output: SuccessPayload,
|
|
42
44
|
});
|
|
43
45
|
|
|
46
|
+
export const DTODocumentationPageRestoreActionOutput = z.object({
|
|
47
|
+
type: z.literal("DocumentationPageRestore"),
|
|
48
|
+
output: SuccessPayload,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const DTODocumentationGroupRestoreActionOutput = z.object({
|
|
52
|
+
type: z.literal("DocumentationGroupRestore"),
|
|
53
|
+
output: SuccessPayload,
|
|
54
|
+
});
|
|
55
|
+
|
|
44
56
|
export type DTODocumentationPageCreateActionOutputV2 = z.infer<typeof DTODocumentationPageCreateActionOutputV2>;
|
|
45
57
|
export type DTODocumentationPageUpdateActionOutputV2 = z.infer<typeof DTODocumentationPageUpdateActionOutputV2>;
|
|
46
58
|
export type DTODocumentationPageMoveActionOutputV2 = z.infer<typeof DTODocumentationPageMoveActionOutputV2>;
|
|
47
59
|
export type DTODocumentationPageDuplicateActionOutputV2 = z.infer<typeof DTODocumentationPageDuplicateActionOutputV2>;
|
|
48
60
|
export type DTODocumentationPageDeleteActionOutputV2 = z.infer<typeof DTODocumentationPageDeleteActionOutputV2>;
|
|
61
|
+
export type DTODocumentationPageRestoreActionOutput = z.infer<typeof DTODocumentationPageRestoreActionOutput>;
|
|
62
|
+
export type DTODocumentationGroupRestoreActionOutput = z.infer<typeof DTODocumentationGroupRestoreActionOutput>;
|
|
49
63
|
|
|
50
|
-
//
|
|
51
64
|
// Write
|
|
52
65
|
//
|
|
53
66
|
|
|
@@ -76,8 +89,20 @@ export const DTODocumentationPageDeleteActionInputV2 = z.object({
|
|
|
76
89
|
input: DTODeleteDocumentationPageInputV2,
|
|
77
90
|
});
|
|
78
91
|
|
|
92
|
+
export const DTODocumentationPageRestoreActionInput = z.object({
|
|
93
|
+
type: z.literal("DocumentationPageRestore"),
|
|
94
|
+
input: DTORestoreDocumentationPageInput,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const DTODocumentationGroupRestoreActionInput = z.object({
|
|
98
|
+
type: z.literal("DocumentationGroupRestore"),
|
|
99
|
+
input: DTORestoreDocumentationGroupInput,
|
|
100
|
+
});
|
|
101
|
+
|
|
79
102
|
export type DTODocumentationPageCreateActionInputV2 = z.infer<typeof DTODocumentationPageCreateActionInputV2>;
|
|
80
103
|
export type DTODocumentationPageUpdateActionInputV2 = z.infer<typeof DTODocumentationPageUpdateActionInputV2>;
|
|
81
104
|
export type DTODocumentationPageMoveActionInputV2 = z.infer<typeof DTODocumentationPageMoveActionInputV2>;
|
|
82
105
|
export type DTODocumentationPageDuplicateActionInputV2 = z.infer<typeof DTODocumentationPageDuplicateActionInputV2>;
|
|
83
106
|
export type DTODocumentationPageDeleteActionInputV2 = z.infer<typeof DTODocumentationPageDeleteActionInputV2>;
|
|
107
|
+
export type DTODocumentationPageRestoreActionInput = z.infer<typeof DTODocumentationPageRestoreActionInput>;
|
|
108
|
+
export type DTODocumentationGroupRestoreActionInput = z.infer<typeof DTODocumentationGroupRestoreActionInput>;
|
|
@@ -86,8 +86,20 @@ export const DTODeleteDocumentationPageInputV2 = z.object({
|
|
|
86
86
|
id: z.string(),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
+
export const DTORestoreDocumentationPageInput = z.object({
|
|
90
|
+
persistentId: z.string(),
|
|
91
|
+
snapshotId: z.string().optional(),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const DTORestoreDocumentationGroupInput = z.object({
|
|
95
|
+
persistentId: z.string(),
|
|
96
|
+
snapshotId: z.string().optional(),
|
|
97
|
+
});
|
|
98
|
+
|
|
89
99
|
export type DTOCreateDocumentationPageInputV2 = z.infer<typeof DTOCreateDocumentationPageInputV2>;
|
|
90
100
|
export type DTOUpdateDocumentationPageInputV2 = z.infer<typeof DTOUpdateDocumentationPageInputV2>;
|
|
91
101
|
export type DTOMoveDocumentationPageInputV2 = z.infer<typeof DTOMoveDocumentationPageInputV2>;
|
|
92
102
|
export type DTODuplicateDocumentationPageInputV2 = z.infer<typeof DTODuplicateDocumentationPageInputV2>;
|
|
93
103
|
export type DTODeleteDocumentationPageInputV2 = z.infer<typeof DTODeleteDocumentationPageInputV2>;
|
|
104
|
+
export type DTORestoreDocumentationPageInput = z.infer<typeof DTORestoreDocumentationPageInput>;
|
|
105
|
+
export type DTORestoreDocumentationGroupInput = z.infer<typeof DTORestoreDocumentationGroupInput>;
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
DTODocumentationTabGroupDeleteActionOutputV2,
|
|
17
17
|
} from "./documentation/group-action";
|
|
18
18
|
import {
|
|
19
|
+
DTODocumentationGroupRestoreActionInput,
|
|
20
|
+
DTODocumentationGroupRestoreActionOutput,
|
|
19
21
|
DTODocumentationPageCreateActionInputV2,
|
|
20
22
|
DTODocumentationPageCreateActionOutputV2,
|
|
21
23
|
DTODocumentationPageDeleteActionInputV2,
|
|
@@ -24,6 +26,8 @@ import {
|
|
|
24
26
|
DTODocumentationPageDuplicateActionOutputV2,
|
|
25
27
|
DTODocumentationPageMoveActionInputV2,
|
|
26
28
|
DTODocumentationPageMoveActionOutputV2,
|
|
29
|
+
DTODocumentationPageRestoreActionInput,
|
|
30
|
+
DTODocumentationPageRestoreActionOutput,
|
|
27
31
|
DTODocumentationPageUpdateActionInputV2,
|
|
28
32
|
DTODocumentationPageUpdateActionOutputV2,
|
|
29
33
|
} from "./documentation/page-actions-v2";
|
|
@@ -65,6 +69,10 @@ export const DTOElementActionOutput = z.discriminatedUnion("type", [
|
|
|
65
69
|
DTOPropertyDefinitionCreateActionOutputV2,
|
|
66
70
|
DTOPropertyDefinitionUpdateActionOutputV2,
|
|
67
71
|
DTOPropertyDefinitionDeleteActionOutputV2,
|
|
72
|
+
|
|
73
|
+
// Restore
|
|
74
|
+
DTODocumentationPageRestoreActionOutput,
|
|
75
|
+
DTODocumentationGroupRestoreActionOutput,
|
|
68
76
|
]);
|
|
69
77
|
|
|
70
78
|
export type DTOElementActionOutput = z.infer<typeof DTOElementActionOutput>;
|
|
@@ -97,6 +105,10 @@ export const DTOElementActionInput = z.discriminatedUnion("type", [
|
|
|
97
105
|
DTOPropertyDefinitionCreateActionInputV2,
|
|
98
106
|
DTOPropertyDefinitionUpdateActionInputV2,
|
|
99
107
|
DTOPropertyDefinitionDeleteActionInputV2,
|
|
108
|
+
|
|
109
|
+
// Restore
|
|
110
|
+
DTODocumentationPageRestoreActionInput,
|
|
111
|
+
DTODocumentationGroupRestoreActionInput,
|
|
100
112
|
]);
|
|
101
113
|
|
|
102
114
|
export type DTOElementActionInput = z.infer<typeof DTOElementActionInput>;
|
|
@@ -48,6 +48,10 @@ type RichTextInputWithValue = InputWithProperty & {
|
|
|
48
48
|
// Implementation
|
|
49
49
|
//
|
|
50
50
|
|
|
51
|
+
export function pageToYDoc(doc: Y.Doc, page: DocumentationPageEditorModel, definitions: PageBlockDefinition[]) {
|
|
52
|
+
pageToYXmlFragment(page, definitions, doc.getXmlFragment("default"));
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
export function pageToYXmlFragment(
|
|
52
56
|
page: DocumentationPageEditorModel,
|
|
53
57
|
definitions: PageBlockDefinition[],
|
|
@@ -22,6 +22,7 @@ type DocumentationHierarchyTransaction = {
|
|
|
22
22
|
groupSnapshotIdsToDelete?: string[];
|
|
23
23
|
|
|
24
24
|
internalSettings?: DocumentationHierarchySettings;
|
|
25
|
+
pageHashesToUpdate?: Record<string, string>;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export class BackendVersionRoomYDoc {
|
|
@@ -53,6 +54,7 @@ export class BackendVersionRoomYDoc {
|
|
|
53
54
|
|
|
54
55
|
// Settings
|
|
55
56
|
transaction.internalSettings && yDoc.updateDocumentationInternalSettings(transaction.internalSettings);
|
|
57
|
+
transaction.pageHashesToUpdate && yDoc.updateDocumentationPageContentHashes(transaction.pageHashesToUpdate);
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
ElementGroupSnapshot,
|
|
7
7
|
mapByUnique,
|
|
8
8
|
} from "@supernova-studio/model";
|
|
9
|
-
import deepEqual from "deep-equal";
|
|
10
9
|
import * as Y from "yjs";
|
|
11
10
|
import {
|
|
12
11
|
DTODocumentationDraftState,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
documentationPagesToDTOV2,
|
|
17
16
|
elementGroupsToDocumentationGroupDTOV2,
|
|
18
17
|
} from "../../api";
|
|
18
|
+
import { generateHash } from "../../utils";
|
|
19
19
|
import { DocumentationPageEditorModel } from "../docs-editor";
|
|
20
20
|
import { VersionRoomBaseYDoc } from "./base";
|
|
21
21
|
import { generatePageContentHash } from "./utils";
|
|
@@ -231,7 +231,12 @@ export class FrontendVersionRoomYDoc {
|
|
|
231
231
|
updatedDraftState.changes.previousTitle = publishedState.title;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
const currentStateConfigHash = currentState.configuration ? generateHash(currentState.configuration) : "default";
|
|
235
|
+
const publishedStateConfigHash = publishedState.configuration
|
|
236
|
+
? generateHash(publishedState.configuration)
|
|
237
|
+
: "default";
|
|
238
|
+
|
|
239
|
+
if (currentStateConfigHash !== publishedStateConfigHash) {
|
|
235
240
|
if (this.debug) {
|
|
236
241
|
console.log(`Item ${itemPersistentId} (${currentState.title}): updated configuration`);
|
|
237
242
|
}
|