@supernova-studio/client 0.21.0 → 0.22.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.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -64,8 +64,8 @@ export const DTOMoveDocumentationGroupInput = z.object({
64
64
  id: z.string().uuid(),
65
65
 
66
66
  // Group placement properties
67
- afterPersistentId: z.string().uuid(),
68
67
  parentPersistentId: z.string().uuid(),
68
+ afterPersistentId: z.string().uuid().optional(),
69
69
  });
70
70
 
71
71
  export const DTODuplicateDocumentationGroupInput = z.object({
@@ -67,7 +67,7 @@ export const DTOMoveDocumentationPageInputV2 = z.object({
67
67
 
68
68
  // Page placement properties
69
69
  parentPersistentId: z.string().uuid(),
70
- afterPersistentId: z.string().uuid(),
70
+ afterPersistentId: z.string().uuid().optional(),
71
71
  });
72
72
 
73
73
  export const DTODuplicateDocumentationPageInputV2 = z.object({
@@ -27,6 +27,7 @@ import {
27
27
  DTODocumentationTabGroupDeleteActionInputV2,
28
28
  DTODocumentationTabGroupDeleteActionOutputV2,
29
29
  } from "./documentation/group-action";
30
+ import { DTOFigmaNodeActionInput, DTOFigmaNodeActionOutput } from "./figma-nodes/node-actions-v2";
30
31
 
31
32
  //
32
33
  // Read
@@ -48,6 +49,9 @@ export const DTOElementActionOutput = z.discriminatedUnion("type", [
48
49
  DTODocumentationGroupDuplicateActionOutputV2,
49
50
  DTODocumentationGroupDeleteActionOutputV2,
50
51
  DTODocumentationTabGroupDeleteActionOutputV2,
52
+
53
+ // // Figma frames
54
+ DTOFigmaNodeActionOutput,
51
55
  ]);
52
56
 
53
57
  export type DTOElementActionOutput = z.infer<typeof DTOElementActionOutput>;
@@ -72,14 +76,9 @@ export const DTOElementActionInput = z.discriminatedUnion("type", [
72
76
  DTODocumentationGroupDuplicateActionInputV2,
73
77
  DTODocumentationGroupDeleteActionInputV2,
74
78
  DTODocumentationTabGroupDeleteActionInputV2,
79
+
80
+ // Figma frames
81
+ DTOFigmaNodeActionInput,
75
82
  ]);
76
83
 
77
84
  export type DTOElementActionInput = z.infer<typeof DTOElementActionInput>;
78
-
79
- function hue(action: DTOElementActionInput) {
80
- action.type;
81
- }
82
-
83
- function hue2(action: DTOElementActionOutput) {
84
- action.type;
85
- }
@@ -0,0 +1,46 @@
1
+ import { FigmaFileStructure } from "@supernova-studio/model";
2
+ import { z } from "zod";
3
+
4
+ //
5
+ // Read
6
+ //
7
+
8
+ export const DTOFigmaNodeData = z.object({
9
+ // Id of the node in the Figma file
10
+ figmaNodeId: z.string(),
11
+
12
+ // Validity
13
+ isValid: z.boolean(),
14
+
15
+ // Asset data
16
+ assetId: z.string(),
17
+ assetUrl: z.string(),
18
+
19
+ // Asset metadata
20
+ assetScale: z.number(),
21
+ assetWidth: z.number().optional(),
22
+ assetHeight: z.number().optional(),
23
+ });
24
+
25
+ export const DTOFigmaNode = FigmaFileStructure.omit({
26
+ data: true,
27
+ }).extend({
28
+ data: DTOFigmaNodeData,
29
+ });
30
+
31
+ export type DTOFigmaNodeData = z.infer<typeof DTOFigmaNodeData>;
32
+ export type DTOFigmaNode = z.infer<typeof DTOFigmaNode>;
33
+
34
+ //
35
+ // Write
36
+ //
37
+
38
+ export const DTOFigmaNodeCreateInput = z.object({
39
+ // Id of a design system's data source representing a linked Figma file
40
+ sourceId: z.string(),
41
+
42
+ // Id of a node within the Figma file
43
+ figmaFileNodeId: z.string(),
44
+ });
45
+
46
+ export type DTOFigmaNodeCreateInput = z.infer<typeof DTOFigmaNodeCreateInput>;
@@ -0,0 +1,2 @@
1
+ export * from "./node-actions-v2";
2
+ export * from "./figma-node";
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import { DTOFigmaNode, DTOFigmaNodeCreateInput } from "./figma-node";
3
+
4
+ //
5
+ // Read
6
+ //
7
+
8
+ export const DTOFigmaNodeActionOutput = z.object({
9
+ type: z.literal("FigmaNodeRender"),
10
+ figmaNodes: z.array(DTOFigmaNode),
11
+ });
12
+
13
+ export type DTOFigmaNodeActionOutput = z.infer<typeof DTOFigmaNodeActionOutput>;
14
+
15
+ //
16
+ // Read
17
+ //
18
+
19
+ export const DTOFigmaNodeActionInput = z.object({
20
+ type: z.literal("FigmaNodeRender"),
21
+ input: DTOFigmaNodeCreateInput.array(),
22
+ });
23
+
24
+ export type DTOFigmaNodeActionInput = z.infer<typeof DTOFigmaNodeActionInput>;
@@ -1,2 +1,3 @@
1
1
  export * from "./documentation";
2
+ export * from "./figma-nodes";
2
3
  export * from "./elements-action-v2";