@supernova-studio/model 0.47.9 → 0.47.11

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.9",
3
+ "version": "0.47.11",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@sindresorhus/slugify": "1.1.2",
34
34
  "ip-cidr": "^3.1.0",
35
- "zod": "^3.22.4"
35
+ "zod": "^3.23.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "fs": "^0.0.1-security",
@@ -11,12 +11,11 @@ export const ExporterDestinationDocs = z.object({
11
11
  export const ExporterDestinationS3 = z.object({});
12
12
 
13
13
  export const ExporterDestinationGithub = z.object({
14
- connectionId: z.string(),
14
+ url: z.string(),
15
15
  branch: z.string(),
16
+ userId: z.string(),
17
+ connectionId: z.string(),
16
18
  relativePath: z.string(),
17
-
18
- // // +
19
- // userId: z.coerce.string(),
20
19
  });
21
20
 
22
21
  export const ExporterDestinationAzure = z.object({
@@ -93,7 +93,6 @@ export type UpdateExportJob = Pick<DbUpdate<ExportJob>, "id" | "status" | "resul
93
93
  export const ExportJobFindByFilter = ExportJob.pick({
94
94
  exporterId: true,
95
95
  designSystemVersionId: true,
96
- destinations: true,
97
96
  createdByUserId: true,
98
97
  status: true,
99
98
  scheduleId: true,
@@ -15,6 +15,7 @@ export const ExportJobContext = z.object({
15
15
  brandId: z.string().optional(),
16
16
  exporterPackageUrl: z.string(),
17
17
  exporterPropertyValues: ExporterPropertyValue.array(),
18
+
18
19
  documentation: ExportJobDocumentationContext.optional(),
19
20
  });
20
21
 
@@ -4,6 +4,7 @@ export const ExporterFunctionPayload = z.object({
4
4
  exportJobId: z.string(),
5
5
  exportContextId: z.string(),
6
6
  designSystemId: z.string(),
7
+ workspaceId: z.string(),
7
8
  });
8
9
 
9
10
  export type ExporterFunctionPayload = z.infer<typeof ExporterFunctionPayload>;
package/src/helpers/db.ts CHANGED
@@ -1,17 +1,3 @@
1
- import {
2
- UnknownKeysParam,
3
- ZodNullable,
4
- ZodObject,
5
- ZodObjectDef,
6
- ZodOptional,
7
- ZodRawShape,
8
- ZodSchema,
9
- ZodTypeAny,
10
- objectInputType,
11
- objectOutputType,
12
- z,
13
- } from "zod";
14
-
15
1
  export type DbCreateInputOmit<T> = Omit<T, "id" | "createdAt" | "updatedAt">;
16
2
 
17
3
  export type DbUpdateInputOmit<T> = Omit<T, "createdAt" | "updatedAt" | "persistentId">;
@@ -50,47 +36,47 @@ export function zodUpdateInputOmit() {
50
36
  } as const;
51
37
  }
52
38
 
53
- function zodCreate<
54
- T extends ZodRawShape,
55
- UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
56
- Catchall extends ZodTypeAny = ZodTypeAny,
57
- O = objectOutputType<T, Catchall, UnknownKeys>,
58
- I = objectInputType<T, Catchall, UnknownKeys>
59
- >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
60
- return schema.omit(zodCreateInputOmit());
61
- }
39
+ // function zodCreate<
40
+ // T extends ZodRawShape,
41
+ // UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
42
+ // Catchall extends ZodTypeAny = ZodTypeAny,
43
+ // O = objectOutputType<T, Catchall, UnknownKeys>,
44
+ // I = objectInputType<T, Catchall, UnknownKeys>
45
+ // >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
46
+ // return schema.omit(zodCreateInputOmit());
47
+ // }
62
48
 
63
- /**
64
- * Don't use it yet, produces too complex type
65
- */
66
- function zodUpdate<
67
- T extends ZodRawShape,
68
- UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
69
- Catchall extends ZodTypeAny = ZodTypeAny,
70
- O = objectOutputType<T, Catchall, UnknownKeys>,
71
- I = objectInputType<T, Catchall, UnknownKeys>
72
- >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
73
- const hue = schema.omit(zodUpdateInputOmit());
74
- return makeOptionalPropsNullable(hue).partial();
75
- }
49
+ // /**
50
+ // * Don't use it yet, produces too complex type
51
+ // */
52
+ // function zodUpdate<
53
+ // T extends ZodRawShape,
54
+ // UnknownKeys extends UnknownKeysParam = UnknownKeysParam,
55
+ // Catchall extends ZodTypeAny = ZodTypeAny,
56
+ // O = objectOutputType<T, Catchall, UnknownKeys>,
57
+ // I = objectInputType<T, Catchall, UnknownKeys>
58
+ // >(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
59
+ // const hue = schema.omit(zodUpdateInputOmit());
60
+ // return makeOptionalPropsNullable(hue).partial();
61
+ // }
76
62
 
77
- function makeOptionalPropsNullable<Schema extends z.AnyZodObject>(schema: Schema) {
78
- type SchemaType = typeof schema;
63
+ // function makeOptionalPropsNullable<Schema extends z.AnyZodObject>(schema: Schema) {
64
+ // type SchemaType = typeof schema;
79
65
 
80
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
81
- const entries = Object.entries(schema.shape) as [keyof SchemaType["shape"], z.ZodTypeAny][];
82
- const newProps = entries.reduce(
83
- (acc, [key, value]) => {
84
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
85
- acc[key] = value instanceof z.ZodOptional ? value.unwrap().nullable() : value;
86
- return acc;
87
- },
88
- {} as {
89
- [key in keyof SchemaType["shape"]]: SchemaType["shape"][key] extends z.ZodOptional<infer T>
90
- ? z.ZodNullable<T>
91
- : SchemaType["shape"][key];
92
- }
93
- );
66
+ // // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
67
+ // const entries = Object.entries(schema.shape) as [keyof SchemaType["shape"], z.ZodTypeAny][];
68
+ // const newProps = entries.reduce(
69
+ // (acc, [key, value]) => {
70
+ // // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
71
+ // acc[key] = value instanceof z.ZodOptional ? value.unwrap().nullable() : value;
72
+ // return acc;
73
+ // },
74
+ // {} as {
75
+ // [key in keyof SchemaType["shape"]]: SchemaType["shape"][key] extends z.ZodOptional<infer T>
76
+ // ? z.ZodNullable<T>
77
+ // : SchemaType["shape"][key];
78
+ // }
79
+ // );
94
80
 
95
- return z.object(newProps);
96
- }
81
+ // return z.object(newProps);
82
+ // }
@@ -14,6 +14,7 @@ export type SupernovaExceptionType =
14
14
  | "PlanRestricted"
15
15
  | "MissingWorkspacePermission"
16
16
  | "MissingExporterPermission"
17
+ | "MissingIntegration"
17
18
  | "NoAccess"
18
19
  | "MissingCredentials"
19
20
  | "ValidationError";
@@ -80,7 +81,7 @@ export class SupernovaException extends Error {
80
81
  }
81
82
 
82
83
  static missingIntegration(message?: string): SupernovaException {
83
- return new SupernovaException("AccessDenied", message);
84
+ return new SupernovaException("MissingIntegration", message);
84
85
  }
85
86
 
86
87
  static noAccess(message?: string): SupernovaException {