@supernova-studio/model 0.21.1 → 0.23.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.21.1",
3
+ "version": "0.23.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,8 @@ export const Asset = z.object({
25
25
  filePath: z.string(),
26
26
  scope: AssetScope,
27
27
  properties: AssetProperties.nullish(),
28
- origin: AssetOrigin.nullish(),
28
+ origin: AssetOrigin.optional(),
29
+ originKey: z.string().optional(),
29
30
  });
30
31
 
31
32
  export type AssetType = z.infer<typeof AssetType>;
@@ -35,8 +36,8 @@ export type AssetProperties = z.infer<typeof AssetProperties>;
35
36
  export type AssetOrigin = z.infer<typeof AssetOrigin>;
36
37
  export type Asset = z.infer<typeof Asset>;
37
38
 
38
- export type ImportedAsset = OmitStrict<Asset, "origin"> & {
39
- origin: AssetOrigin;
39
+ export type ImportedAsset = OmitStrict<Asset, "originKey"> & {
40
+ originKey: string;
40
41
  };
41
42
 
42
43
  export type ResolvedAsset = OmitStrict<Asset, "filePath"> & {
@@ -44,5 +45,5 @@ export type ResolvedAsset = OmitStrict<Asset, "filePath"> & {
44
45
  };
45
46
 
46
47
  export function isImportedAsset(asset: Asset): asset is ImportedAsset {
47
- return !!asset.origin;
48
+ return !!asset.originKey;
48
49
  }
@@ -16,6 +16,7 @@ export const ImportJob = Entity.extend({
16
16
  importContextId: z.string(),
17
17
  error: z.string().optional(),
18
18
  sourceType: DataSourceRemoteType,
19
+ importContextCleanedUp: z.boolean(),
19
20
  });
20
21
 
21
22
  export type ImportJobState = z.infer<typeof ImportJobState>;
@@ -5,11 +5,14 @@ export const FigmaNodeReferenceData = z.object({
5
5
  nodeId: z.string(),
6
6
  fileId: z.string().optional(),
7
7
  valid: z.boolean(),
8
+
9
+ // Asset data
8
10
  assetId: z.string().optional(),
9
11
  assetScale: z.number().optional(),
10
12
  assetWidth: z.number().optional(),
11
13
  assetHeight: z.number().optional(),
12
14
  assetUrl: z.string().optional(),
15
+ assetOriginKey: z.string().optional(),
13
16
  });
14
17
 
15
18
  export const FigmaNodeReferenceElementData = z.object({
@@ -4,10 +4,16 @@ import { FigmaNodeReferenceData } from "./data/figma-node-reference";
4
4
  import { DbCreateInputOmit, DbUpdate } from "../../helpers";
5
5
  import { OmitStrict } from "../../utils";
6
6
 
7
+ export const FigmaNodeReferenceOrigin = z.object({
8
+ sourceId: z.string(),
9
+ });
10
+
7
11
  export const FigmaNodeReference = DesignElementBase.extend({
8
12
  data: FigmaNodeReferenceData,
13
+ origin: FigmaNodeReferenceOrigin,
9
14
  });
10
15
 
16
+ export type FigmaNodeReferenceOrigin = z.infer<typeof FigmaNodeReferenceOrigin>;
11
17
  export type FigmaNodeReference = z.infer<typeof FigmaNodeReference>;
12
18
 
13
19
  export type CreateFigmaNodeReference = DbCreateInputOmit<FigmaNodeReference>;
@@ -110,6 +110,7 @@ export const ShallowDesignElement = z.object({
110
110
  shortPersistentId: z.string().optional(),
111
111
  childType: DesignElementType.optional(),
112
112
  sortOrder: z.number(),
113
+ origin: z.record(z.any()).optional(),
113
114
  });
114
115
 
115
116
  export const DesignElement = ShallowDesignElement.extend({
@@ -20,7 +20,7 @@ export const UrlImageImportModel = ImageImportModelBase.extend({
20
20
  type: z.literal(ImageImportModelType.enum.Url),
21
21
  url: z.string(),
22
22
  originKey: z.string(),
23
- extension: z.enum(["png", "svg", "jpg"]),
23
+ extension: z.string(),
24
24
  });
25
25
 
26
26
  export type UrlImageImportModel = z.infer<typeof UrlImageImportModel>;
@@ -2,6 +2,7 @@ export type SupernovaExceptionType =
2
2
  | "AccessDenied"
3
3
  | "ResourceNotFound"
4
4
  | "WrongFormat"
5
+ | "TooMuchWork"
5
6
  | "Timeout"
6
7
  | "Conflict"
7
8
  | "NotImplemented"
@@ -24,6 +25,10 @@ export class SupernovaException extends Error {
24
25
  return new SupernovaException("AccessDenied", message);
25
26
  }
26
27
 
28
+ static tooMuchWork(message?: string): SupernovaException {
29
+ return new SupernovaException("TooMuchWork", message);
30
+ }
31
+
27
32
  static notFound(message?: string): SupernovaException {
28
33
  return new SupernovaException("ResourceNotFound", message);
29
34
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { UserInvites } from "./user-invite";
3
- import { ProductCodeSchema } from "../billing";
3
+ import { BillingIntervalSchema, CardSchema, InternalStatusSchema, ProductCodeSchema } from "../billing";
4
4
  import { slugRegex } from "../utils/validation";
5
5
 
6
6
  const WORKSPACE_NAME_MIN_LENGTH: number = 2;
@@ -22,6 +22,11 @@ export const CreateWorkspaceInput = z.object({
22
22
  .optional(),
23
23
  invites: UserInvites.optional(),
24
24
  promoCode: z.string().optional(),
25
+ status: InternalStatusSchema.optional(),
26
+ planInterval: BillingIntervalSchema.optional(),
27
+ seats: z.number().optional(),
28
+ seatLimit: z.number().optional(),
29
+ card: CardSchema.optional(),
25
30
  });
26
31
 
27
32
  export type CreateWorkspaceInput = z.infer<typeof CreateWorkspaceInput>;