@supernova-studio/model 0.47.47 → 0.47.49
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 +1339 -435
- package/dist/index.d.ts +1339 -435
- package/dist/index.js +33 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +677 -672
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/data-sources/data-source.ts +3 -1
- package/src/dsm/elements/tokens.ts +22 -20
- package/src/dsm/import/warning.ts +3 -0
- package/src/utils/common.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DbCreateInputOmit, DbUpdate } from "../../helpers";
|
|
2
|
+
import { DbCreateInputOmit, DbUpdate, nullishToOptional } from "../../helpers";
|
|
3
3
|
import { OmitStrict } from "../../utils";
|
|
4
|
+
import { ImportWarning } from "../import/warning";
|
|
4
5
|
import { SourceImportSummary } from "./import-summary";
|
|
5
6
|
|
|
6
7
|
//
|
|
@@ -104,6 +105,7 @@ export const DataSourceUploadRemote = z.object({
|
|
|
104
105
|
remoteId: z.string(),
|
|
105
106
|
remoteSourceType: DataSourceUploadRemoteSource,
|
|
106
107
|
lastImportMetadata: DataSourceUploadImportMetadata.optional(),
|
|
108
|
+
warnings: nullishToOptional(ImportWarning.array()),
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
export type DataSourceUploadImportMetadata = z.infer<typeof DataSourceUploadImportMetadata>;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { DbUpdate, zodCreateInputOmit, zodUpdateInputOmit } from "../../helpers";
|
|
3
|
+
import { OmitStrict } from "../../utils";
|
|
2
4
|
import {
|
|
3
5
|
DesignElementBase,
|
|
4
6
|
DesignElementBrandedPart,
|
|
5
7
|
DesignElementGroupableRequiredPart,
|
|
6
8
|
DesignElementOrigin,
|
|
7
9
|
} from "./base";
|
|
8
|
-
import { DbUpdate, zodCreateInputOmit, zodUpdateInputOmit } from "../../helpers";
|
|
9
|
-
import { OmitStrict } from "../../utils";
|
|
10
|
-
import { DesignTokenType } from "./raw-element";
|
|
11
10
|
import {
|
|
12
|
-
|
|
11
|
+
BlurTokenData,
|
|
12
|
+
BorderRadiusTokenData,
|
|
13
|
+
BorderTokenData,
|
|
14
|
+
BorderWidthTokenData,
|
|
15
|
+
ColorTokenData,
|
|
16
|
+
DimensionTokenData,
|
|
17
|
+
DurationTokenData,
|
|
18
|
+
FontFamilyTokenData,
|
|
19
|
+
FontSizeTokenData,
|
|
13
20
|
FontWeightTokenData,
|
|
21
|
+
GradientTokenData,
|
|
14
22
|
LetterSpacingTokenData,
|
|
15
23
|
LineHeightTokenData,
|
|
24
|
+
OpacityTokenData,
|
|
16
25
|
ParagraphSpacingTokenData,
|
|
26
|
+
ProductCopyTokenData,
|
|
27
|
+
ShadowTokenData,
|
|
28
|
+
SizeTokenData,
|
|
29
|
+
SpaceTokenData,
|
|
17
30
|
StringTokenData,
|
|
31
|
+
TextCaseTokenData,
|
|
18
32
|
TextDecorationTokenData,
|
|
19
|
-
BorderRadiusTokenData,
|
|
20
|
-
BorderWidthTokenData,
|
|
21
|
-
BorderTokenData,
|
|
22
|
-
ProductCopyTokenData,
|
|
23
|
-
FontFamilyTokenData,
|
|
24
|
-
FontSizeTokenData,
|
|
25
|
-
DimensionTokenData,
|
|
26
33
|
TypographyTokenData,
|
|
27
|
-
ShadowTokenData,
|
|
28
|
-
OpacityTokenData,
|
|
29
|
-
GradientTokenData,
|
|
30
|
-
ColorTokenData,
|
|
31
|
-
BlurTokenData,
|
|
32
|
-
DurationTokenData,
|
|
33
|
-
ZIndexTokenData,
|
|
34
34
|
VisibilityTokenData,
|
|
35
|
-
|
|
36
|
-
SizeTokenData,
|
|
35
|
+
ZIndexTokenData,
|
|
37
36
|
} from "./data";
|
|
37
|
+
import { DesignTokenType } from "./raw-element";
|
|
38
38
|
|
|
39
39
|
//
|
|
40
40
|
// Base
|
|
@@ -43,6 +43,8 @@ import {
|
|
|
43
43
|
export const DesignTokenOriginPart = z.object({
|
|
44
44
|
referenceOriginId: z.string().optional(),
|
|
45
45
|
referencePersistentId: z.string().optional(),
|
|
46
|
+
referenceResolutionFailed: z.boolean().optional(),
|
|
47
|
+
key: z.string().optional(),
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
export const DesignTokenOrigin = DesignElementOrigin.extend(DesignTokenOriginPart.shape);
|
|
@@ -20,6 +20,8 @@ export const ImportWarningType = z.enum([
|
|
|
20
20
|
"DuplicateImportedStylePath",
|
|
21
21
|
|
|
22
22
|
"NoUnpublishedStyles",
|
|
23
|
+
|
|
24
|
+
"ReferenceResolutionFailed",
|
|
23
25
|
]);
|
|
24
26
|
|
|
25
27
|
export const ImportWarning = z.object({
|
|
@@ -29,6 +31,7 @@ export const ImportWarning = z.object({
|
|
|
29
31
|
styleId: z.string().optional(),
|
|
30
32
|
styleName: z.string().optional(),
|
|
31
33
|
unsupportedStyleValueType: z.string().optional(),
|
|
34
|
+
referenceId: z.string().optional(),
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
export type ImportWarningType = z.infer<typeof ImportWarningType>;
|
package/src/utils/common.ts
CHANGED
|
@@ -27,6 +27,9 @@ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
|
27
27
|
|
|
28
28
|
export type Defined<T> = T extends null | undefined ? never : T;
|
|
29
29
|
|
|
30
|
+
// Makes specific properties in the type required
|
|
31
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }
|
|
32
|
+
|
|
30
33
|
export function forceUnwrapNullish<T>(value: Nullish<T>): T {
|
|
31
34
|
if (value === null) throw new Error("Illegal null");
|
|
32
35
|
if (value === undefined) throw new Error("Illegal undefined");
|