@supernova-studio/model 0.47.43 → 0.47.44

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/model",
3
- "version": "0.47.43",
3
+ "version": "0.47.44",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+
3
+ export const DesignElementSnapshotReason = z.enum(["Publish", "Deletion"]);
4
+
5
+ export const DesignElementSnapshotBase = z.object({
6
+ id: z.string(),
7
+ designSystemVersionId: z.string(),
8
+ createdAt: z.coerce.date(),
9
+ updatedAt: z.coerce.date(),
10
+ reason: DesignElementSnapshotReason,
11
+ });
12
+
13
+ export type DesignElementSnapshotReason = z.infer<typeof DesignElementSnapshotReason>;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
+ import { OmitStrict } from "../../utils";
4
+ import { DocumentationPageV2 } from "../elements";
5
+ import { DesignElementSnapshotBase } from "./base";
6
+
7
+ /**
8
+ * Snapshot of a documentation page.
9
+ *
10
+ * Please note that existence of snapshot's references (including parent persistent id) is not guaranteed.
11
+ */
12
+ export const DocumentationPageSnapshot = DesignElementSnapshotBase.extend({
13
+ page: DocumentationPageV2,
14
+ pageContentHash: z.string(),
15
+ });
16
+
17
+ export type DocumentationPageSnapshot = z.infer<typeof DocumentationPageSnapshot>;
18
+
19
+ export type CreateDocumentationPageSnapshot = DbCreateInputOmit<DocumentationPageSnapshot>;
20
+ export type UpdateDocumentationPageSnapshot = OmitStrict<DbUpdate<DocumentationPageSnapshot>, "designSystemVersionId">;
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { DbCreateInputOmit, DbUpdate } from "../../helpers";
3
+ import { OmitStrict } from "../../utils";
4
+ import { ElementGroup } from "../elements";
5
+ import { DesignElementSnapshotBase } from "./base";
6
+
7
+ /**
8
+ * Snapshot of an element group.
9
+ *
10
+ * Please note that existence of snapshot's references (including parent persistent id) is not guaranteed.
11
+ */
12
+ export const ElementGroupSnapshot = DesignElementSnapshotBase.extend({
13
+ group: ElementGroup,
14
+ });
15
+
16
+ export type ElementGroupSnapshot = z.infer<typeof ElementGroupSnapshot>;
17
+
18
+ export type CreateElementGroupSnapshot = DbCreateInputOmit<ElementGroupSnapshot>;
19
+ export type UpdateElementGroupSnapshot = OmitStrict<DbUpdate<ElementGroupSnapshot>, "designSystemVersionId">;
@@ -0,0 +1,3 @@
1
+ export * from "./base";
2
+ export * from "./documentation-page-snapshot";
3
+ export * from "./group-snapshot";
@@ -4,7 +4,6 @@ export * from "./base";
4
4
  export * from "./component";
5
5
  export * from "./documentation-page-v1";
6
6
  export * from "./documentation-page-v2";
7
- export * from "./element-snapshot";
8
7
  export * from "./figma-file-structures";
9
8
  export * from "./figma-node-reference";
10
9
  export * from "./group";
package/src/dsm/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./assets";
2
2
  export * from "./data-sources";
3
3
  export * from "./documentation";
4
+ export * from "./element-snapshots";
4
5
  export * from "./elements";
5
6
  export * from "./import";
6
7
  export * from "./properties";
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Entity } from "../../common/entity";
3
3
  import { DocumentationPageV2 } from "../../dsm/elements/documentation-page-v2";
4
- import { DesignElementSnapshot } from "../../dsm/elements/element-snapshot";
5
4
  import { ElementGroup } from "../../dsm/elements/group";
6
5
  import { DbCreateInputOmit, DbUpdate } from "../../helpers";
7
6
 
@@ -31,14 +30,14 @@ export const DesignSystemVersionRoomInternalSettings = z.object({
31
30
  export const DesignSystemVersionRoomInitialState = z.object({
32
31
  pages: z.array(DocumentationPageV2),
33
32
  groups: z.array(ElementGroup),
34
- documentationPublishedState: z.array(DesignElementSnapshot),
33
+
35
34
  internalSettings: DesignSystemVersionRoomInternalSettings,
36
35
  });
37
36
 
38
37
  export const DesignSystemVersionRoomUpdate = z.object({
39
38
  pages: z.array(DocumentationPageV2),
40
39
  groups: z.array(ElementGroup),
41
- documentationPublishedState: z.array(DesignElementSnapshot),
40
+
42
41
  deletedPageIds: z.array(z.string()),
43
42
  deletedGroupIds: z.array(z.string()),
44
43
  });
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- import { DesignElementType } from "./raw-element";
3
-
4
- export const DesignElementSnapshot = z.object({
5
- id: z.string(),
6
-
7
- // Scope
8
- designSystemVersionId: z.string(),
9
-
10
- // Metadata about the element that needs to be indexed in the db
11
- elementId: z.string(),
12
- elementType: DesignElementType,
13
- elementPersistentId: z.string(),
14
- elementParentPersistentId: z.string(),
15
- elementName: z.string(),
16
-
17
- // Computed hash to compare to current state of the element
18
- hash: z.string(),
19
-
20
- // Where is the element's full shapshot stored
21
- storageKey: z.string(),
22
-
23
- // When the element was snapshotted
24
- createdAt: z.coerce.date(),
25
- });
26
-
27
- export type DesignElementSnapshot = z.infer<typeof DesignElementSnapshot>;