@supernova-studio/model 0.57.9 → 0.57.11

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.57.9",
3
+ "version": "0.57.11",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,49 @@
1
+ import { z } from "zod";
2
+ import { DbCreateInputOmit, DbUpdate } from "../helpers";
3
+ import { OmitStrict } from "../utils";
4
+ import { ColorTokenInlineData } from "./properties";
5
+
6
+ export const CollectionOrigin = z.object({
7
+ id: z.string(),
8
+ sourceId: z.string(),
9
+ });
10
+
11
+ export const Collection = z.object({
12
+ id: z.string(),
13
+ persistentId: z.string(),
14
+
15
+ designSystemVersionId: z.string(),
16
+
17
+ name: z.string(),
18
+ description: z.string(),
19
+ backgroundColor: ColorTokenInlineData.optional(),
20
+
21
+ /**
22
+ * ID of Select element property definition's option that corresponds to this collection.
23
+ *
24
+ * Each collection is represented by an option in a special kind of element property that
25
+ * is present in each design system where a collections are present. The property is maintained
26
+ * automatically and is not available to the user (see immutable element properties).
27
+ *
28
+ * Collections have an immutable element property that allows bridging places where element properites
29
+ * can be selected (e.g. documentation blocks) with the concept of collection without having to add
30
+ * specific logic for collection selection.
31
+ */
32
+ elementPropertyOptionId: z.string(),
33
+
34
+ createdAt: z.coerce.date(),
35
+ updatedAt: z.coerce.date(),
36
+
37
+ origin: CollectionOrigin.optional(),
38
+ });
39
+
40
+ export type CollectionOrigin = z.infer<typeof CollectionOrigin>;
41
+ export type Collection = z.infer<typeof Collection>;
42
+
43
+ export type CreateCollection = OmitStrict<DbCreateInputOmit<Collection>, "elementPropertyOptionId">;
44
+ export type UpdateCollection = OmitStrict<
45
+ DbUpdate<Collection>,
46
+ "designSystemVersionId" | "origin" | "elementPropertyOptionId"
47
+ > & {
48
+ origin?: Partial<CollectionOrigin>;
49
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { CollectionOrigin } from "../collection";
3
+
4
+ export const CollectionImportModelInput = z.object({
5
+ id: z.string(),
6
+ name: z.string(),
7
+ });
8
+
9
+ export const CollectionImportModel = z.object({
10
+ id: z.string(),
11
+ name: z.string(),
12
+ origin: CollectionOrigin,
13
+ });
14
+
15
+ export type CollectionImportModelInput = z.infer<typeof CollectionImportModelInput>;
16
+ export type CollectionImportModel = z.infer<typeof CollectionImportModel>;
@@ -1,6 +1,7 @@
1
1
  export * from "./support";
2
2
  export * from "./asset";
3
3
  export * from "./base";
4
+ export * from "./collection";
4
5
  export * from "./component";
5
6
  export * from "./data-source";
6
7
  export * from "./figma-frames";
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CollectionImportModel, CollectionImportModelInput } from "../collection";
2
3
  import { AssetImportModelInput, FigmaComponentImportModel, FigmaComponentImportModelInput } from "../component";
3
4
  import { DataSourceImportModel } from "../data-source";
4
5
  import { FigmaFileStructureImportModel, FigmaFileStructureImportModelInput } from "../figma-frames";
@@ -17,6 +18,7 @@ export const ImportModelInputCollection = z.object({
17
18
  themeUpdates: z.array(ThemeUpdateImportModelInput).default([]),
18
19
  themes: z.array(ThemeImportModelInput).default([]),
19
20
  figmaFileStructure: FigmaFileStructureImportModelInput.optional(),
21
+ collections: z.array(CollectionImportModelInput),
20
22
  });
21
23
 
22
24
  export const ImportModelCollection = z.object({
@@ -26,6 +28,7 @@ export const ImportModelCollection = z.object({
26
28
  themeUpdates: z.array(ThemeUpdateImportModel).default([]),
27
29
  themes: z.array(ThemeImportModel).default([]),
28
30
  figmaFileStructures: z.array(FigmaFileStructureImportModel),
31
+ collections: z.array(CollectionImportModel),
29
32
  });
30
33
 
31
34
  export type ImportModelCollection = z.infer<typeof ImportModelCollection>;
@@ -42,5 +45,6 @@ export function addImportModelCollections(
42
45
  themeUpdates: [...lhs.themeUpdates, ...rhs.themeUpdates],
43
46
  themes: [...lhs.themes, ...rhs.themes],
44
47
  figmaFileStructures: [...lhs.figmaFileStructures, ...rhs.figmaFileStructures],
48
+ collections: [...lhs.collections, ...rhs.collections],
45
49
  };
46
50
  }
package/src/dsm/index.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./membership";
9
9
  export * from "./properties";
10
10
  export * from "./views";
11
11
  export * from "./brand";
12
+ export * from "./collection";
12
13
  export * from "./design-system";
13
14
  export * from "./exporter-property-values-collection";
14
15
  export * from "./published-doc-page";