@supernova-studio/client 0.58.23 → 0.58.25
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 +183 -102
- package/dist/index.d.ts +183 -102
- package/dist/index.js +87 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2938 -2876
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/figma-nodes/figma-node.ts +5 -0
- package/src/api/dto/export/exporter-property.ts +4 -1
- package/src/api/dto/export/job.ts +1 -1
- package/src/api/dto/export/pipeline.ts +1 -1
- package/src/api/payloads/export/pipeline.ts +1 -1
- package/src/utils/figma.ts +4 -4
package/package.json
CHANGED
|
@@ -94,6 +94,11 @@ const DTOFigmaNodeRenderUrlInput = DTOFigmaNodeRenderInputBase.extend({
|
|
|
94
94
|
* Id of a design system's data source representing a linked Figma file
|
|
95
95
|
*/
|
|
96
96
|
figmaNodeUrl: z.string(),
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Brand persistent id to use in case a source has to be created for this render
|
|
100
|
+
*/
|
|
101
|
+
brandPersistentId: z.string(),
|
|
97
102
|
});
|
|
98
103
|
|
|
99
104
|
export const DTOFigmaNodeRenderInput = z.discriminatedUnion("inputType", [
|
|
@@ -24,6 +24,8 @@ const PropertyDefinitionBase = z.object({
|
|
|
24
24
|
description: z.string(),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
export type DTOPropertyDefinitionBase = z.infer<typeof PropertyDefinitionBase>;
|
|
28
|
+
|
|
27
29
|
export const DTOExporterPropertyDefinitionEnum = PropertyDefinitionBase.extend({
|
|
28
30
|
type: z.literal(DTOExporterPropertyType.Enum.Enum),
|
|
29
31
|
options: z.string().array(),
|
|
@@ -56,11 +58,12 @@ export const DTOExporterPropertyDefinitionObject = PropertyDefinitionBase.extend
|
|
|
56
58
|
allowedKeys: z
|
|
57
59
|
.object({
|
|
58
60
|
options: z.string().array(),
|
|
61
|
+
type: z.string(),
|
|
59
62
|
})
|
|
60
63
|
.optional(),
|
|
61
64
|
allowedValues: z
|
|
62
65
|
.object({
|
|
63
|
-
|
|
66
|
+
type: z.string(),
|
|
64
67
|
})
|
|
65
68
|
.optional(),
|
|
66
69
|
});
|
|
@@ -71,7 +71,7 @@ export const DTOExportJob = z.object({
|
|
|
71
71
|
themePersistentId: z.string().optional(),
|
|
72
72
|
themePersistentIds: z.string().array().optional(),
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
exporterConfigurationProperties: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
export const DTOExportJobResponse = z.object({
|
|
@@ -22,7 +22,7 @@ export const DTOPipeline = z.object({
|
|
|
22
22
|
themePersistentId: z.string().optional(),
|
|
23
23
|
themePersistentIds: z.string().array().optional(),
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
exporterConfigurationProperties: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
26
26
|
|
|
27
27
|
...ExportDestinationsMap.shape,
|
|
28
28
|
|
|
@@ -22,7 +22,7 @@ export const DTOPipelineCreateBody = z.object({
|
|
|
22
22
|
themePersistentId: z.string().optional(),
|
|
23
23
|
themePersistentIds: z.string().array().optional(),
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
exporterConfigurationProperties: DTOExporterPropertyDefinitionValueMap.optional(),
|
|
26
26
|
|
|
27
27
|
destination: PipelineDestinationType.optional(),
|
|
28
28
|
gitQuery: GitObjectsQuery,
|
package/src/utils/figma.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const figmaFileIdRegex = /^[0-9a-zA-Z]{22,128}$/;
|
|
2
|
-
const nodeIdRegex =
|
|
2
|
+
const nodeIdRegex = /^\d+-\d+$/;
|
|
3
3
|
const nodeTypeRegex = /^[0-9a-zA-Z]^/;
|
|
4
4
|
|
|
5
5
|
type ParsedFigmaFileURL = {
|
|
@@ -19,15 +19,15 @@ export const FigmaUtils = {
|
|
|
19
19
|
|
|
20
20
|
// Validate that the URL type is the correct one (pointing to a design file)
|
|
21
21
|
const pathSegments = url.pathname.split("/");
|
|
22
|
-
if (pathSegments[
|
|
22
|
+
if (pathSegments[1] !== "design" && pathSegments[1] !== "file") return null;
|
|
23
23
|
|
|
24
24
|
// Validate Figma file ID
|
|
25
|
-
const fileId = pathSegments[
|
|
25
|
+
const fileId = pathSegments[2];
|
|
26
26
|
if (!fileId || !fileId.match(figmaFileIdRegex)) return null;
|
|
27
27
|
|
|
28
28
|
// Parse Figma file name
|
|
29
29
|
let fileName: string | null = null;
|
|
30
|
-
const rawFileName = pathSegments[
|
|
30
|
+
const rawFileName = pathSegments[3];
|
|
31
31
|
if (rawFileName) {
|
|
32
32
|
fileName = rawFileName.replaceAll("-", " ");
|
|
33
33
|
}
|