@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -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 DocumentationPageStructureV2DTO = DocumentationPageV2.omit({
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 DocumentationPageV2DTO = DocumentationPageStructureV2DTO.extend(DocumentationPageV2.shape.data.shape);
19
+ export const DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend(DocumentationPageV2.shape.data.shape);
20
20
 
21
- export const DocumentationHierarchyV2DTO = z.object({
22
- pages: z.array(DocumentationPageStructureV2DTO),
21
+ export const DTODocumentationHierarchyV2 = z.object({
22
+ pages: z.array(DTODocumentationPageStructureV2),
23
23
  groups: z.array(DocumentationGroupStructureDTO),
24
24
  });
25
25
 
26
- export type DocumentationPageV2DTO = z.infer<typeof DocumentationPageV2DTO>;
27
- export type DocumentationPageStructureV2DTO = z.infer<typeof DocumentationPageStructureV2DTO>;
28
- export type DocumentationHierarchyV2DTO = z.infer<typeof DocumentationHierarchyV2DTO>;
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 DTODocumentationTransactionInput = z.object({
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 DTODocumentationTransactionInput = z.infer<typeof DTODocumentationTransactionInput>;
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: DTODocumentationTransactionInput,
50
+ documentationPages: DTODocumentationElementsTransactionInput,
51
51
  });
52
52
 
53
53
  export type DTOElementsTransactionInput = z.infer<typeof DTOElementsTransactionInput>;
@@ -1,8 +1,8 @@
1
- import { DocumentationPageV2DTO } from "../../dto";
1
+ import { DTODocumentationPageV2 } from "../../dto";
2
2
 
3
3
  export type DTODocumentationElementsTransactionOutput = {
4
- created: DocumentationPageV2DTO[];
5
- updated: DocumentationPageV2DTO[];
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 { DocumentationHierarchyV2DTO, DocumentationPageStructureV2DTO } from "../api/dto/documentation-v2";
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: DocumentationHierarchyV2DTO,
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): DocumentationHierarchyV2DTO {
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: DocumentationPageStructureV2DTO[] = [];
48
+ const pages: DTODocumentationPageStructureV2[] = [];
49
49
  pagesMap.forEach(page => {
50
- pages.push(DocumentationPageStructureV2DTO.parse(page));
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<DocumentationPageStructureV2DTO>("documentationPages");
69
+ return doc.getMap<DTODocumentationPageStructureV2>("documentationPages");
70
70
  }
71
71
 
72
72
  function getGroupsYMap(doc: Y.Doc) {