@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/dist/index.d.mts +22047 -23694
- package/dist/index.d.ts +22047 -23694
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1768 -1771
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/export/export-destinations.ts +3 -4
- package/src/export/export-jobs.ts +0 -1
- package/src/export/export-runner/export-context.ts +1 -0
- package/src/export/export-runner/exporter-payload.ts +1 -0
- package/src/helpers/db.ts +40 -54
- package/src/utils/errors.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supernova-studio/model",
|
|
3
|
-
"version": "0.47.
|
|
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.
|
|
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
|
-
|
|
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,
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
>(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
|
|
60
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
function zodUpdate<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
>(schema: ZodObject<T, UnknownKeysParam, ZodTypeAny, I, O>) {
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
63
|
+
// function makeOptionalPropsNullable<Schema extends z.AnyZodObject>(schema: Schema) {
|
|
64
|
+
// type SchemaType = typeof schema;
|
|
79
65
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
96
|
-
}
|
|
81
|
+
// return z.object(newProps);
|
|
82
|
+
// }
|
package/src/utils/errors.ts
CHANGED
|
@@ -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("
|
|
84
|
+
return new SupernovaException("MissingIntegration", message);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
static noAccess(message?: string): SupernovaException {
|