@supernova-studio/model 0.25.0 → 0.26.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.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,9 +65,14 @@ export const DataSourceFigmaRemote = z.object({
65
65
  ownerName: z.string(),
66
66
  scope: DataSourceFigmaScope,
67
67
  state: DataSourceFigmaState,
68
+ requiresSync: z
69
+ .boolean()
70
+ .optional()
71
+ .transform(v => v ?? false),
68
72
  lastImportMetadata: DataSourceFigmaImportMetadata.optional(),
69
73
  downloadChunkSize: z.number().optional(),
70
74
  figmaRenderChunkSize: z.number().optional(),
75
+ maxFileDepth: z.number().optional(),
71
76
  });
72
77
 
73
78
  export type DataSourceFigmaFileData = z.infer<typeof DataSourceFigmaFileData>;
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { PageBlockEditorModelV2 } from "../page-block-v2";
3
+ import { PageBlockColorV2 } from "./documentation-block-v2";
4
+
5
+ export const PageSectionTypeV2 = z.enum(["Tabs"]);
6
+
7
+ export const PageSectionColumnV2 = z.object({
8
+ id: z.string(),
9
+ blocks: z.array(PageBlockEditorModelV2),
10
+ });
11
+
12
+ export const PageSectionItemV2 = z.object({
13
+ id: z.string(),
14
+ title: z.string(),
15
+ columns: z.array(PageSectionColumnV2),
16
+ });
17
+
18
+ export const PageSectionPaddingV2 = z.object({
19
+ top: z.number().optional(),
20
+ bottom: z.number().optional(),
21
+ left: z.number().optional(),
22
+ right: z.number().optional(),
23
+ });
24
+
25
+ export const PageSectionAppearanceV2 = z.object({
26
+ expandToEdges: z.boolean(),
27
+ contentExpandToEdges: z.boolean(),
28
+ backgroundColor: PageBlockColorV2.optional(),
29
+ foregroundColor: PageBlockColorV2.optional(),
30
+ padding: PageSectionPaddingV2.optional(),
31
+ });
32
+
33
+ export const PageSectionEditorModelV2 = z.object({
34
+ id: z.string(),
35
+ type: z.literal("Section"),
36
+ variantId: z.string().optional(),
37
+ sectionType: PageSectionTypeV2,
38
+ appearance: PageSectionAppearanceV2,
39
+ items: z.array(PageSectionItemV2),
40
+ });
41
+
42
+ export type PageSectionTypeV2 = z.infer<typeof PageSectionTypeV2>;
43
+ export type PageSectionColumnV2 = z.infer<typeof PageSectionColumnV2>;
44
+ export type PageSectionItemV2 = z.infer<typeof PageSectionItemV2>;
45
+ export type PageSectionPaddingV2 = z.infer<typeof PageSectionPaddingV2>;
46
+ export type PageSectionAppearanceV2 = z.infer<typeof PageSectionAppearanceV2>;
47
+ export type PageSectionEditorModelV2 = z.infer<typeof PageSectionEditorModelV2>;
@@ -10,6 +10,7 @@ export * from "./documentation-block-v1";
10
10
  export * from "./documentation-block-v2";
11
11
  export * from "./documentation-page-v1";
12
12
  export * from "./documentation-page-v2";
13
+ export * from "./documentation-section-v2";
13
14
  export * from "./documentation-v1";
14
15
  export * from "./documentation-v2";
15
16
  export * from "./duration";
@@ -18,6 +18,7 @@ export type PageBlockV2 = z.infer<typeof PageBlockV2>;
18
18
 
19
19
  export const PageBlockEditorModelV2 = z.object({
20
20
  id: z.string(),
21
+ type: z.literal("Block"),
21
22
  data: PageBlockDataV2,
22
23
  });
23
24
 
@@ -6,6 +6,7 @@ export const FigmaFileDownloadScope = z.object({
6
6
  currentVersion: z.literal("__latest__").nullable(),
7
7
  publishedVersion: z.string().nullable(),
8
8
  downloadChunkSize: z.number().optional(),
9
+ maxFileDepth: z.number().optional(),
9
10
  });
10
11
 
11
12
  export const FigmaFileAccessData = z.object({
@@ -45,6 +45,16 @@ export const FigmaImportBaseContext = z.object({
45
45
  export type ImportedFigmaSourceData = z.infer<typeof ImportedFigmaSourceData>;
46
46
  export type FigmaImportBaseContext = z.infer<typeof FigmaImportBaseContext>;
47
47
 
48
+ //
49
+ // Context with source state updates
50
+ //
51
+
52
+ export const FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
53
+ sourcesWithMissingAccess: z.array(z.string()).default([]),
54
+ });
55
+
56
+ export type FigmaImportContextWithSourcesState = z.infer<typeof FigmaImportContextWithSourcesState>;
57
+
48
58
  //
49
59
  // Context with file download scope
50
60
  //
@@ -53,7 +63,7 @@ export const ChangedImportedFigmaSourceData = ImportedFigmaSourceData.extend({
53
63
  importMetadata: DataSourceFigmaImportMetadata,
54
64
  });
55
65
 
56
- export const FigmaImportContextWithDownloadScopes = FigmaImportBaseContext.extend({
66
+ export const FigmaImportContextWithDownloadScopes = FigmaImportContextWithSourcesState.extend({
57
67
  /**
58
68
  * Describes what to download from each file, this should contain all file id mentioned in
59
69
  * importMetadataBySourceId.
@@ -1,9 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { Entity } from "../common/entity";
3
3
  import { DbCreateInputOmit, DbUpdate } from "../helpers";
4
- import { DocumentationPageV2, ElementGroup, PageBlockDataV2, PageBlockDefinition } from "../dsm";
5
-
6
- export type PageBlockEditorModel = z.infer<typeof PageBlockEditorModel>;
4
+ import {
5
+ DocumentationPageV2,
6
+ ElementGroup,
7
+ PageBlockDefinition,
8
+ PageBlockEditorModelV2,
9
+ PageSectionEditorModelV2,
10
+ } from "../dsm";
7
11
 
8
12
  export const DocumentationPageRoom = Entity.extend({
9
13
  designSystemVersionId: z.string(),
@@ -20,18 +24,13 @@ export type UpdateDocumentationPageRoom = DbUpdate<DocumentationPageRoom>;
20
24
  // Room content
21
25
  //
22
26
 
23
- export const PageBlockEditorModel = z.object({
24
- id: z.string(),
25
- data: PageBlockDataV2,
26
- });
27
-
28
27
  export const DocumentationPageRoomRoomUpdate = z.object({
29
28
  page: DocumentationPageV2,
30
29
  pageParent: ElementGroup,
31
30
  });
32
31
 
33
32
  export const DocumentationPageRoomInitialState = DocumentationPageRoomRoomUpdate.extend({
34
- pageBlocks: z.array(PageBlockEditorModel),
33
+ pageBlocks: z.array(PageBlockEditorModelV2.or(PageSectionEditorModelV2)),
35
34
  blockDefinitions: z.array(PageBlockDefinition),
36
35
  });
37
36
 
@@ -1,30 +1,24 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  export const NpmRegistryAuthType = z.enum(["Basic", "Bearer", "None", "Custom"]);
4
- const registryTypesWithoutAzure = ["NPMJS", "GitHub", "Artifactory", "Custom"] as const;
5
- export const NpmRegistryType = z.enum([...registryTypesWithoutAzure, "AzureDevOps"]);
6
- export const NpmRegistryTypeWithoutAzure = z.enum(registryTypesWithoutAzure);
4
+ export const NpmRegistryType = z.enum(["NPMJS", "GitHub", "AzureDevOps", "Artifactory", "Custom"]);
7
5
 
8
6
  export const NpmRegistryBasicAuthConfig = z.object({
9
- registryType: NpmRegistryType,
10
7
  authType: z.literal(NpmRegistryAuthType.Enum.Basic),
11
8
  username: z.string(),
12
9
  password: z.string(),
13
10
  });
14
11
 
15
12
  export const NpmRegistryBearerAuthConfig = z.object({
16
- registryType: NpmRegistryTypeWithoutAzure,
17
13
  authType: z.literal(NpmRegistryAuthType.Enum.Bearer),
18
14
  accessToken: z.string(),
19
15
  });
20
16
 
21
17
  export const NpmRegistryNoAuthConfig = z.object({
22
- registryType: NpmRegistryTypeWithoutAzure,
23
18
  authType: z.literal(NpmRegistryAuthType.Enum.None),
24
19
  });
25
20
 
26
21
  export const NpmRegistrCustomAuthConfig = z.object({
27
- registryType: NpmRegistryTypeWithoutAzure,
28
22
  authType: z.literal(NpmRegistryAuthType.Enum.Custom),
29
23
  authHeaderName: z.string(),
30
24
  authHeaderValue: z.string(),
@@ -38,6 +32,7 @@ export const NpmRegistryAuthConfig = z.discriminatedUnion("authType", [
38
32
  ]);
39
33
 
40
34
  const NpmRegistryConfigBase = z.object({
35
+ registryType: NpmRegistryType,
41
36
  enabledScopes: z.array(z.string()),
42
37
  customRegistryUrl: z.string().optional(),
43
38
  bypassProxy: z.boolean().default(false),