@supernova-studio/model 0.23.0 → 0.25.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/model",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,26 +1,27 @@
1
1
  import { z } from "zod";
2
+ import { nullishToOptional } from "../helpers";
2
3
 
3
4
  export const Customer = z.object({
4
5
  id: z.string(),
5
6
  });
6
7
 
7
8
  export const Address = z.object({
8
- street1: z.string().optional(),
9
- street2: z.string().optional(),
10
- city: z.string().optional(),
11
- postal: z.string().optional(),
12
- country: z.string().optional(),
13
- state: z.string().optional(),
9
+ street1: nullishToOptional(z.string()),
10
+ street2: nullishToOptional(z.string()),
11
+ city: nullishToOptional(z.string()),
12
+ postal: nullishToOptional(z.string()),
13
+ country: nullishToOptional(z.string()),
14
+ state: nullishToOptional(z.string()),
14
15
  });
15
16
 
16
17
  export const BillingDetails = z.object({
17
- address: Address.optional(),
18
- email: z.string().optional(),
19
- companyName: z.string().optional(),
20
- companyId: z.string().optional(),
21
- notes: z.string().optional(),
22
- vat: z.string().optional(),
23
- poNumber: z.string().optional(),
18
+ address: nullishToOptional(Address),
19
+ email: nullishToOptional(z.string()),
20
+ companyName: nullishToOptional(z.string()),
21
+ companyId: nullishToOptional(z.string()),
22
+ notes: nullishToOptional(z.string()),
23
+ vat: nullishToOptional(z.string()),
24
+ poNumber: nullishToOptional(z.string()),
24
25
  });
25
26
 
26
27
  export type Customer = z.infer<typeof Customer>;
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { PageBlockCalloutType, PageBlockCodeLanguage, PageBlockText } from "./documentation-block-v1";
3
- import { Size } from "../primitives";
4
3
  import { DesignTokenType } from "../raw-element";
5
4
 
6
5
  //
@@ -48,6 +47,18 @@ export const PageBlockColorV2 = z.object({
48
47
  referencedTokenId: z.string().optional(),
49
48
  });
50
49
 
50
+ export const PageBlockAssetEntityMeta = z.object({
51
+ title: z.string().optional(),
52
+ description: z.string().optional(),
53
+ backgroundColor: PageBlockColorV2.optional(),
54
+ });
55
+
56
+ export const PageBlockFigmaNodeEntityMeta = z.object({
57
+ title: z.string().optional(),
58
+ description: z.string().optional(),
59
+ backgroundColor: PageBlockColorV2.optional(),
60
+ });
61
+
51
62
  export const PageBlockAppearanceV2 = z.object({
52
63
  itemBackgroundColor: PageBlockColorV2.optional(),
53
64
  numberOfColumns: z.number().optional(),
@@ -83,6 +94,8 @@ export const PageBlockDataV2 = z.object({
83
94
 
84
95
  export type PageBlockImageReference = z.infer<typeof PageBlockImageReference>;
85
96
  export type PageBlockColorV2 = z.infer<typeof PageBlockColorV2>;
97
+ export type PageBlockAssetEntityMeta = z.infer<typeof PageBlockAssetEntityMeta>;
98
+ export type PageBlockFigmaNodeEntityMeta = z.infer<typeof PageBlockFigmaNodeEntityMeta>;
86
99
  export type PageBlockAppearanceV2 = z.infer<typeof PageBlockAppearanceV2>;
87
100
  export type PageBlockItemUntypedValue = z.infer<typeof PageBlockItemUntypedValue>;
88
101
  export type PageBlockLinkV2 = z.infer<typeof PageBlockLinkV2>;
@@ -102,12 +115,7 @@ export const PageBlockItemAssetValue = z.object({
102
115
  z.object({
103
116
  entityId: z.string(),
104
117
  entityType: z.enum(["Asset", "AssetGroup"]),
105
- entityMeta: z
106
- .object({
107
- title: z.string().optional(),
108
- description: z.string().optional(),
109
- })
110
- .optional(),
118
+ entityMeta: PageBlockAssetEntityMeta.optional(),
111
119
  })
112
120
  ),
113
121
  });
@@ -128,6 +136,7 @@ export const PageBlockItemCodeValue = z.object({
128
136
 
129
137
  export const PageBlockItemSandboxValue = z.object({
130
138
  showCode: z.boolean().optional(),
139
+ showControls: z.boolean().optional(),
131
140
  backgroundColor: z.string().optional(),
132
141
  alignPreview: z.enum(["Left", "Center"]).optional(),
133
142
  previewHeight: z.number().optional(),
@@ -169,16 +178,11 @@ export const PageBlockItemFigmaNodeValue = z.object({
169
178
  selectedPropertyIds: z.array(z.string()).optional(),
170
179
  showSearch: z.boolean().optional(),
171
180
  previewContainerSize: PageBlockPreviewContainerSize.optional(),
172
- backgroundColor: z.string().optional(),
181
+ backgroundColor: PageBlockColorV2.optional(),
173
182
  value: z.array(
174
183
  z.object({
175
184
  entityId: z.string(),
176
- entityMeta: z
177
- .object({
178
- title: z.string().optional(),
179
- description: z.string().optional(),
180
- })
181
- .optional(),
185
+ entityMeta: PageBlockFigmaNodeEntityMeta.optional(),
182
186
  })
183
187
  ),
184
188
  });
@@ -288,6 +292,7 @@ export type PageBlockItemUrlValue = z.infer<typeof PageBlockItemUrlValue>;
288
292
 
289
293
  export const PageBlockItemTableRichTextNode = z.object({
290
294
  type: z.literal("RichText"),
295
+ id: z.string(),
291
296
  value: PageBlockItemRichTextValue.shape.value,
292
297
  });
293
298
 
@@ -298,6 +303,7 @@ export const PageBlockItemTableMultiRichTextNode = z.object({
298
303
 
299
304
  export const PageBlockItemTableImageNode = z.object({
300
305
  type: z.literal("Image"),
306
+ id: z.string(),
301
307
  caption: PageBlockItemImageValue.shape.caption,
302
308
  value: PageBlockItemImageValue.shape.value,
303
309
  });
@@ -3,6 +3,7 @@ import { Subscription } from "../billing";
3
3
  import { SsoProvider } from "./sso-provider";
4
4
  import { DesignSystem } from "../dsm";
5
5
  import { BillingDetails } from "../billing";
6
+ import { nullishToOptional } from "../helpers";
6
7
 
7
8
  export const WorkspaceIpWhitelistEntry = z.object({
8
9
  isEnabled: z.boolean(),
@@ -22,8 +23,8 @@ export const WorkspaceProfile = z.object({
22
23
  name: z.string(),
23
24
  handle: z.string(),
24
25
  color: z.string(),
25
- avatar: z.string().optional(),
26
- billingDetails: BillingDetails.optional(),
26
+ avatar: nullishToOptional(z.string()),
27
+ billingDetails: nullishToOptional(BillingDetails),
27
28
  });
28
29
 
29
30
  export const Workspace = z.object({