@supernova-studio/client 0.55.34 → 0.56.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/dist/index.d.mts +6628 -360
- package/dist/index.d.ts +6628 -360
- package/dist/index.js +140 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +826 -704
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-systems/data-source.ts +11 -18
- package/src/api/dto/design-systems/figma-variables.ts +108 -0
- package/src/api/dto/design-systems/import-job.ts +1 -0
- package/src/api/dto/design-systems/index.ts +1 -0
- package/src/api/dto/design-tokens/design-token.ts +21 -0
- package/src/api/dto/design-tokens/index.ts +1 -0
- package/src/api/dto/index.ts +1 -0
- package/src/api/endpoints/design-system/design-systems.ts +3 -0
- package/src/api/endpoints/design-system/index.ts +1 -0
- package/src/api/endpoints/design-system/sources.ts +10 -0
- package/src/api/endpoints/design-system/versions/tokens.ts +8 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import {
|
|
2
|
+
DataSourceAutoImportMode,
|
|
3
|
+
DataSourceFigmaScope,
|
|
3
4
|
DataSourceFigmaState,
|
|
4
5
|
DataSourceRemoteType,
|
|
5
|
-
DataSourceAutoImportMode,
|
|
6
6
|
DataSourceStats,
|
|
7
|
-
SourceImportSummary,
|
|
8
|
-
DataSourceUploadRemoteSource,
|
|
9
7
|
DataSourceUploadImportMetadata,
|
|
10
|
-
|
|
8
|
+
DataSourceUploadRemoteSource,
|
|
9
|
+
SourceImportSummary,
|
|
11
10
|
} from "@supernova-studio/model";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
const DTODataSourceFigmaFileVersion = z.object({
|
|
14
14
|
id: z.string(),
|
|
@@ -23,7 +23,7 @@ export const DTODataSourceFigmaCloud = z.object({
|
|
|
23
23
|
autoImportMode: DataSourceAutoImportMode,
|
|
24
24
|
fileThumbnailUrl: z.string().optional(),
|
|
25
25
|
lastImportResult: SourceImportSummary.nullish(),
|
|
26
|
-
lastImportedAt: z.date().nullish(),
|
|
26
|
+
lastImportedAt: z.coerce.date().nullish(),
|
|
27
27
|
lastImportedVersion: DTODataSourceFigmaFileVersion.nullish(),
|
|
28
28
|
lastUpdatesCheckedAt: z.date().nullish(),
|
|
29
29
|
ownerId: z.string(),
|
|
@@ -40,9 +40,6 @@ export const DTODataSourceFigma = z.object({
|
|
|
40
40
|
brandId: z.string(),
|
|
41
41
|
themeId: z.string().nullish(),
|
|
42
42
|
cloud: DTODataSourceFigmaCloud.nullish(),
|
|
43
|
-
tokenStudio: z.literal(null),
|
|
44
|
-
upload: z.literal(null),
|
|
45
|
-
figmaVariablesPlugin: z.literal(null),
|
|
46
43
|
});
|
|
47
44
|
|
|
48
45
|
// TS is not yet implemented in new BE
|
|
@@ -52,7 +49,6 @@ export const DTODataSourceTokenStudio = z.object({
|
|
|
52
49
|
fileName: z.string(),
|
|
53
50
|
brandId: z.string(),
|
|
54
51
|
themeId: z.string().nullish(),
|
|
55
|
-
cloud: z.literal(null),
|
|
56
52
|
tokenStudio: z.object({
|
|
57
53
|
settings: z.object({
|
|
58
54
|
dryRun: z.boolean(),
|
|
@@ -60,7 +56,7 @@ export const DTODataSourceTokenStudio = z.object({
|
|
|
60
56
|
preciseCopy: z.boolean(),
|
|
61
57
|
}),
|
|
62
58
|
connectionName: z.string(),
|
|
63
|
-
lastImportedAt: z.date(),
|
|
59
|
+
lastImportedAt: z.coerce.date(),
|
|
64
60
|
lastImportedResults: z.array(
|
|
65
61
|
z.object({
|
|
66
62
|
mapping: z.object({
|
|
@@ -75,8 +71,6 @@ export const DTODataSourceTokenStudio = z.object({
|
|
|
75
71
|
})
|
|
76
72
|
),
|
|
77
73
|
}),
|
|
78
|
-
upload: z.literal(null),
|
|
79
|
-
figmaVariablesPlugin: z.literal(null),
|
|
80
74
|
});
|
|
81
75
|
|
|
82
76
|
export const DTODataSourceFigmaVariablesPlugin = z.object({
|
|
@@ -84,19 +78,18 @@ export const DTODataSourceFigmaVariablesPlugin = z.object({
|
|
|
84
78
|
type: z.literal(DataSourceRemoteType.Enum.FigmaVariablesPlugin),
|
|
85
79
|
fileName: z.string(),
|
|
86
80
|
brandId: z.string(),
|
|
87
|
-
themeId: z.literal(null),
|
|
88
|
-
cloud: z.literal(null),
|
|
89
|
-
tokenStudio: z.literal(null),
|
|
90
81
|
upload: z.object({
|
|
91
82
|
remoteId: z.string(),
|
|
92
83
|
remoteSourceType: DataSourceUploadRemoteSource,
|
|
93
|
-
lastImportedAt: z.date().optional(),
|
|
84
|
+
lastImportedAt: z.coerce.date().optional(),
|
|
94
85
|
lastImportMetadata: DataSourceUploadImportMetadata.optional(),
|
|
86
|
+
isTokenTypeSplitEnabled: z.boolean(),
|
|
95
87
|
}),
|
|
96
88
|
figmaVariablesPlugin: z.object({
|
|
97
89
|
fileId: z.string(),
|
|
98
|
-
lastImportedAt: z.date().optional(),
|
|
90
|
+
lastImportedAt: z.coerce.date().optional(),
|
|
99
91
|
lastImportMetadata: DataSourceUploadImportMetadata.optional(),
|
|
92
|
+
isTokenTypeSplitEnabled: z.boolean(),
|
|
100
93
|
}),
|
|
101
94
|
});
|
|
102
95
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const DimensionsVariableScopeSchema = z.enum([
|
|
4
|
+
"CORNER_RADIUS",
|
|
5
|
+
"WIDTH_HEIGHT",
|
|
6
|
+
"GAP",
|
|
7
|
+
"STROKE_FLOAT",
|
|
8
|
+
"EFFECT_FLOAT",
|
|
9
|
+
"OPACITY",
|
|
10
|
+
"FONT_SIZE",
|
|
11
|
+
"LINE_HEIGHT",
|
|
12
|
+
"LETTER_SPACING",
|
|
13
|
+
"PARAGRAPH_SPACING",
|
|
14
|
+
"PARAGRAPH_INDENT",
|
|
15
|
+
"FONT_WEIGHT",
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const StringVariableScopeSchema = z.enum(["TEXT_CONTENT", "FONT_FAMILY", "FONT_STYLE"]);
|
|
19
|
+
|
|
20
|
+
export type DimensionsVariableScopeType = z.infer<typeof DimensionsVariableScopeSchema>;
|
|
21
|
+
export const DimensionsVariableScopeType = DimensionsVariableScopeSchema.enum;
|
|
22
|
+
|
|
23
|
+
export type StringVariableScopeType = z.infer<typeof StringVariableScopeSchema>;
|
|
24
|
+
export const StringVariableScopeType = StringVariableScopeSchema.enum;
|
|
25
|
+
|
|
26
|
+
const VariableScope = z.string();
|
|
27
|
+
|
|
28
|
+
const ReferencedVariableOrigin = z.object({
|
|
29
|
+
name: z.string(),
|
|
30
|
+
remote: z.boolean(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const RGB = z.object({
|
|
34
|
+
r: z.number(),
|
|
35
|
+
g: z.number(),
|
|
36
|
+
b: z.number(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const RGBA = RGB.extend({
|
|
40
|
+
a: z.number(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const VariableAlias = z.object({
|
|
44
|
+
type: z.literal("VARIABLE_ALIAS"),
|
|
45
|
+
id: z.string(),
|
|
46
|
+
resolvedValue: z.boolean().or(z.number()).or(z.string()).or(RGBA).or(RGB).optional(),
|
|
47
|
+
referenceOrigin: ReferencedVariableOrigin.optional().or(z.null()),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const VariableValue = z.boolean().or(z.number()).or(z.string()).or(RGBA).or(RGB).or(VariableAlias);
|
|
51
|
+
export const ResolvedVariableType = z.enum(["BOOLEAN", "FLOAT", "STRING", "COLOR"]);
|
|
52
|
+
|
|
53
|
+
export const Variable = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
name: z.string(),
|
|
56
|
+
key: z.string(),
|
|
57
|
+
variableCollectionId: z.string(),
|
|
58
|
+
resolvedType: ResolvedVariableType,
|
|
59
|
+
valuesByMode: z.record(VariableValue),
|
|
60
|
+
remote: z.boolean(),
|
|
61
|
+
description: z.string(),
|
|
62
|
+
hiddenFromPublishing: z.boolean(),
|
|
63
|
+
scopes: z.array(VariableScope),
|
|
64
|
+
codeSyntax: z.record(z.any()).optional(),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const VariableMode = z.object({
|
|
68
|
+
modeId: z.string(),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const Collection = z.object({
|
|
73
|
+
id: z.string(),
|
|
74
|
+
name: z.string(),
|
|
75
|
+
modes: z.array(VariableMode),
|
|
76
|
+
defaultModeId: z.string(),
|
|
77
|
+
remote: z.boolean(),
|
|
78
|
+
hiddenFromPublishing: z.boolean(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const VariablesMapping = z.object({
|
|
82
|
+
variableCollections: z.array(z.string()).min(1),
|
|
83
|
+
variableMode: z.string().min(1),
|
|
84
|
+
supernovaBrand: z.string().min(1),
|
|
85
|
+
supernovaTheme: z.string().min(1).optional().or(z.null()),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export const FormattedCollections = z.object({
|
|
89
|
+
variables: z.record(z.string(), Variable),
|
|
90
|
+
variableCollections: z.record(z.string(), Collection),
|
|
91
|
+
mappings: z.array(VariablesMapping).optional(),
|
|
92
|
+
variablesOrder: z.string().array().optional(),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
//
|
|
96
|
+
// Types
|
|
97
|
+
//
|
|
98
|
+
|
|
99
|
+
export type RGB = z.infer<typeof RGB>;
|
|
100
|
+
export type RGBA = z.infer<typeof RGBA>;
|
|
101
|
+
export type ResolvedVariableType = z.infer<typeof ResolvedVariableType>;
|
|
102
|
+
export type Variable = z.infer<typeof Variable>;
|
|
103
|
+
export type VariableAlias = z.infer<typeof VariableAlias>;
|
|
104
|
+
export type VariableValue = z.infer<typeof VariableValue>;
|
|
105
|
+
export type VariableMode = z.infer<typeof VariableMode>;
|
|
106
|
+
export type Collection = z.infer<typeof Collection>;
|
|
107
|
+
export type VariablesMapping = z.infer<typeof VariablesMapping>;
|
|
108
|
+
export type FormattedCollections = z.infer<typeof FormattedCollections>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DesignTokenOrigin, DesignTokenTypedData, ObjectMeta } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const DTODesignToken = DesignTokenTypedData.and(
|
|
5
|
+
z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
persistentId: z.string(),
|
|
8
|
+
designSystemVersionId: z.string(),
|
|
9
|
+
meta: ObjectMeta,
|
|
10
|
+
origin: DesignTokenOrigin.optional(),
|
|
11
|
+
brandId: z.string(),
|
|
12
|
+
updatedAt: z.coerce.date(),
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const DTODesignTokenListResponse = z.object({
|
|
17
|
+
tokens: DTODesignToken.array(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type DTODesignToken = z.infer<typeof DTODesignToken>;
|
|
21
|
+
export type DTODesignTokenListResponse = z.infer<typeof DTODesignTokenListResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./design-token";
|
package/src/api/dto/index.ts
CHANGED
|
@@ -4,17 +4,20 @@ import { DTODesignSystemUpdateAccessModeInput, DTODesignSystemUpdateInput } from
|
|
|
4
4
|
import { RequestExecutor } from "../../transport/request-executor";
|
|
5
5
|
import { DesignSystemBffEndpoint } from "./bff";
|
|
6
6
|
import { DesignSystemMembersEndpoint } from "./members";
|
|
7
|
+
import { DesignSystemSourcesEndpoint } from "./sources";
|
|
7
8
|
import { DesignSystemVersionsEndpoint } from "./versions";
|
|
8
9
|
|
|
9
10
|
export class DesignSystemsEndpoint {
|
|
10
11
|
readonly members: DesignSystemMembersEndpoint;
|
|
11
12
|
readonly versions: DesignSystemVersionsEndpoint;
|
|
12
13
|
readonly bff: DesignSystemBffEndpoint;
|
|
14
|
+
readonly sources: DesignSystemSourcesEndpoint;
|
|
13
15
|
|
|
14
16
|
constructor(private readonly requestExecutor: RequestExecutor) {
|
|
15
17
|
this.members = new DesignSystemMembersEndpoint(requestExecutor);
|
|
16
18
|
this.versions = new DesignSystemVersionsEndpoint(requestExecutor);
|
|
17
19
|
this.bff = new DesignSystemBffEndpoint(requestExecutor);
|
|
20
|
+
this.sources = new DesignSystemSourcesEndpoint(requestExecutor);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
create(body: DTODesignSystemCreateInput) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DTODataSourcesListResponse } from "../../dto";
|
|
2
|
+
import { RequestExecutor } from "../../transport/request-executor";
|
|
3
|
+
|
|
4
|
+
export class DesignSystemSourcesEndpoint {
|
|
5
|
+
constructor(private readonly requestExecutor: RequestExecutor) {}
|
|
6
|
+
|
|
7
|
+
list(dsId: string) {
|
|
8
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/sources`, DTODataSourcesListResponse);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { DTODesignTokenListResponse } from "../../../dto";
|
|
2
3
|
import { RequestExecutor } from "../../../transport/request-executor";
|
|
3
4
|
|
|
4
5
|
export class TokensEndpoint {
|
|
@@ -10,4 +11,11 @@ export class TokensEndpoint {
|
|
|
10
11
|
body,
|
|
11
12
|
});
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
list(dsId: string, versionId: string): Promise<DTODesignTokenListResponse> {
|
|
16
|
+
return this.requestExecutor.json(
|
|
17
|
+
`/design-systems/${dsId}/versions/${versionId}/tokens`,
|
|
18
|
+
DTODesignTokenListResponse
|
|
19
|
+
);
|
|
20
|
+
}
|
|
13
21
|
}
|