@supernova-studio/model 0.47.33 → 0.47.35

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.33",
3
+ "version": "0.47.35",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { Exporter } from "../export/exporter";
3
+ import { Pipeline } from "../export/pipeline";
4
+
5
+ export const ExportJobDump = z.object({
6
+ id: z.string(),
7
+ createdAt: z.coerce.date(),
8
+ finishedAt: z.coerce.date(),
9
+ exportArtefacts: z.string(),
10
+ });
11
+
12
+ export const CodeIntegrationDump = z.object({
13
+ exporters: Exporter.array(),
14
+ pipelines: Pipeline.array(),
15
+ exportJobs: ExportJobDump.array(),
16
+ });
17
+
18
+ export type ExportJobDump = z.infer<typeof ExportJobDump>;
19
+ export type CodeIntegrationDump = z.infer<typeof CodeIntegrationDump>;
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { CustomDomain } from "../custom-domains";
3
+ import { ResolvedAsset } from "../dsm/assets/asset";
4
+ import { DataSource } from "../dsm/data-sources/data-source";
5
+ import { DesignSystem } from "../dsm/design-system";
6
+ import { DesignSystemVersionDump } from "./design-system-version-dump";
7
+
8
+ export const DesignSystemDump = z.object({
9
+ designSystem: DesignSystem,
10
+ dataSources: DataSource.array(),
11
+ versions: DesignSystemVersionDump.array(),
12
+ customDomain: CustomDomain.optional(),
13
+ files: ResolvedAsset.array(),
14
+ });
15
+
16
+ export type DesignSystemDump = z.infer<typeof DesignSystemDump>;
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ import { Brand } from "../dsm/brand";
3
+ import { DocumentationPageContent } from "../dsm/documentation/page-content";
4
+ import { DocumentationComment, DocumentationCommentThread } from "../dsm/documentation/thread";
5
+ import { DesignElement } from "../dsm/elements/raw-element";
6
+ import { ElementPropertyDefinition } from "../dsm/properties/property-definition";
7
+ import { ElementPropertyValue } from "../dsm/properties/property-value";
8
+ import { DesignSystemVersion } from "../dsm/version";
9
+ import { ElementViewColumn } from "../dsm/views/column";
10
+ import { ElementView } from "../dsm/views/view";
11
+ import { DocumentationPageRoom } from "../liveblocks";
12
+ import { PublishedDocsDump } from "./published-docs-dump";
13
+
14
+ export const DocumentationThreadDump = z.object({
15
+ thread: DocumentationCommentThread,
16
+ comments: DocumentationComment.array(),
17
+ });
18
+
19
+ export const DocumentationPageRoomDump = z.object({
20
+ room: DocumentationPageRoom,
21
+ threads: DocumentationThreadDump.array(),
22
+ });
23
+
24
+ export const DesignSystemVersionMultiplayerDump = z.object({
25
+ documentationPages: DocumentationPageRoomDump.array(),
26
+ });
27
+
28
+ export const DesignSystemVersionDump = z.object({
29
+ version: DesignSystemVersion,
30
+ brands: Brand.array(),
31
+ elements: DesignElement.array(),
32
+ elementPropertyDefinitions: ElementPropertyDefinition.array(),
33
+ elementPropertyValues: ElementPropertyValue.array(),
34
+ elementViews: ElementView.array(),
35
+ elementColumns: ElementViewColumn.array(),
36
+ documentationPageContents: DocumentationPageContent.array(),
37
+ documentationPageRooms: DocumentationPageRoomDump.array(),
38
+ publishedDocumentations: PublishedDocsDump.array(),
39
+ });
40
+
41
+ export type DocumentationThreadDump = z.infer<typeof DocumentationThreadDump>;
42
+ export type DocumentationPageRoomDump = z.infer<typeof DocumentationPageRoomDump>;
43
+ export type DesignSystemVersionDump = z.infer<typeof DesignSystemVersionDump>;
@@ -0,0 +1,5 @@
1
+ export * from "./code-integration-dump";
2
+ export * from "./design-system-dump";
3
+ export * from "./design-system-version-dump";
4
+ export * from "./published-docs-dump";
5
+ export * from "./workspace-dump";
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { PublishedDoc } from "../dsm/published-doc";
3
+ import { PublishedDocPage } from "../dsm/published-doc-page";
4
+
5
+ export const PublishedDocsDump = z.object({
6
+ documentation: PublishedDoc,
7
+ pages: PublishedDocPage.array(),
8
+ });
9
+
10
+ export type PublishedDocsDump = z.infer<typeof PublishedDocsDump>;
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { Integration } from "../integrations/integration";
3
+ import { Workspace } from "../workspace/workspace";
4
+ import { CodeIntegrationDump } from "./code-integration-dump";
5
+ import { DesignSystemDump } from "./design-system-dump";
6
+
7
+ export const WorkspaceDump = z.object({
8
+ workspace: Workspace,
9
+ designSystems: DesignSystemDump.array(),
10
+ codeIntegration: CodeIntegrationDump,
11
+ integrations: Integration.array(),
12
+ });
13
+
14
+ export type WorkspaceDump = z.infer<typeof WorkspaceDump>;
@@ -38,21 +38,24 @@ export const Asset = z.object({
38
38
  originKey: z.string().optional(),
39
39
  });
40
40
 
41
+ export const ResolvedAsset = Asset.omit({
42
+ filePath: true,
43
+ }).extend({
44
+ url: z.string(),
45
+ });
46
+
41
47
  export type AssetType = z.infer<typeof AssetType>;
42
48
  export type AssetScope = z.infer<typeof AssetScope>;
43
49
  export type AssetFontProperties = z.infer<typeof AssetFontProperties>;
44
50
  export type AssetProperties = z.infer<typeof AssetProperties>;
45
51
  export type AssetOrigin = z.infer<typeof AssetOrigin>;
46
52
  export type Asset = z.infer<typeof Asset>;
53
+ export type ResolvedAsset = z.infer<typeof ResolvedAsset>;
47
54
 
48
55
  export type ImportedAsset = OmitStrict<Asset, "originKey"> & {
49
56
  originKey: string;
50
57
  };
51
58
 
52
- export type ResolvedAsset = OmitStrict<Asset, "filePath"> & {
53
- url: string;
54
- };
55
-
56
59
  export function isImportedAsset(asset: Asset): asset is ImportedAsset {
57
60
  return !!asset.originKey;
58
61
  }
@@ -119,31 +119,27 @@ export const DataSourceRemote = z.discriminatedUnion("type", [
119
119
  DataSourceTokenStudioRemote,
120
120
  ]);
121
121
 
122
- export type DataSource = {
123
- id: string;
124
-
125
- name: string;
126
- thumbnailUrl: string | undefined;
122
+ export const DataSource = z.object({
123
+ id: z.string(),
127
124
 
128
- createdAt: Date | null;
129
- // updatedAt: Date;
125
+ name: z.string(),
126
+ thumbnailUrl: z.string().optional(),
130
127
 
131
- lastImportedAt: Date | undefined;
132
- lastImportSummary: SourceImportSummary | undefined;
128
+ createdAt: z.coerce.date().optional(),
133
129
 
134
- // lastImportJobId: Nullish<string>;
135
- // lastNonEmptyImportJobId: Nullish<string>;
130
+ lastImportedAt: z.coerce.date().optional(),
131
+ lastImportSummary: SourceImportSummary.optional(),
136
132
 
137
- designSystemId: string;
138
- brandPersistentId: string;
133
+ designSystemId: z.string(),
134
+ brandPersistentId: z.string(),
139
135
 
140
- autoImportMode: DataSourceAutoImportMode;
141
- stats: DataSourceStats;
136
+ autoImportMode: DataSourceAutoImportMode,
137
+ stats: DataSourceStats,
142
138
 
143
- remote: DataSourceRemote;
139
+ remote: DataSourceRemote,
144
140
 
145
- sortOrder: number;
146
- };
141
+ sortOrder: z.number(),
142
+ });
147
143
 
148
144
  export const DataSourceVersion = z.object({
149
145
  id: z.string(),
@@ -155,6 +151,7 @@ export const DataSourceVersion = z.object({
155
151
  export type DataSourceVersion = z.infer<typeof DataSourceVersion>;
156
152
 
157
153
  export type DataSourceRemote = z.infer<typeof DataSourceRemote>;
154
+ export type DataSource = z.infer<typeof DataSource>;
158
155
 
159
156
  export type CreateDataSource = OmitStrict<DbCreateInputOmit<DataSource>, "sortOrder">;
160
157
  export type UpdateDataSource = OmitStrict<DbUpdate<DataSource>, "brandPersistentId" | "designSystemId">;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Workspace } from "../workspace";
3
2
  import { nullishToOptional } from "../helpers";
3
+ import { Workspace } from "../workspace/workspace";
4
4
 
5
5
  export const DesignSystemSwitcher = z.object({
6
6
  isEnabled: z.boolean(),
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./auth";
3
3
  export * from "./billing";
4
4
  export * from "./common";
5
5
  export * from "./custom-domains";
6
+ export * from "./data-dumps";
6
7
  export * from "./docs-server";
7
8
  export * from "./dsm";
8
9
  export * from "./export";
@@ -1,11 +1,10 @@
1
+ import IPCIDR from "ip-cidr";
1
2
  import { z } from "zod";
2
- import { Subscription } from "../billing";
3
- import { SsoProvider } from "./sso-provider";
3
+ import { BillingDetails, Subscription } from "../billing";
4
4
  import { DesignSystem } from "../dsm";
5
- import { BillingDetails } from "../billing";
6
- import IPCIDR from "ip-cidr";
7
- import { NpmRegistryConfig } from "./npm-registry-settings";
8
5
  import { nullishToOptional } from "../helpers";
6
+ import { NpmRegistryConfig } from "./npm-registry-settings";
7
+ import { SsoProvider } from "./sso-provider";
9
8
 
10
9
  const isValidCIDR = (value: string) => {
11
10
  return IPCIDR.isValidAddress(value);
@@ -46,7 +45,6 @@ export const Workspace = z.object({
46
45
  ipWhitelist: nullishToOptional(WorkspaceIpSettings),
47
46
  sso: nullishToOptional(SsoProvider),
48
47
  npmRegistrySettings: nullishToOptional(NpmRegistryConfig),
49
- designSystems: z.array(DesignSystem).nullish(),
50
48
  });
51
49
 
52
50
  export const WorkspaceWithDesignSystems = z.object({