Skip to content

Commit a321852

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(figma): correct URL and nullable output contracts
1 parent 3b12e41 commit a321852

9 files changed

Lines changed: 10 additions & 35 deletions

File tree

‎apps/sim/tools/figma/export-nodes.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,11 @@ export const figmaExportNodesTool: ToolConfig<
151151
err: {
152152
type: 'string',
153153
description: 'Rendering error message; null on success',
154-
optional: true,
155154
nullable: true,
156155
},
157156
status: {
158157
type: 'number',
159158
description: 'Provider rendering status; null when omitted on success',
160-
optional: true,
161159
nullable: true,
162160
},
163161
images: {

‎apps/sim/tools/figma/get-file-nodes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const figmaGetFileNodesTool: ToolConfig<
8989
role: { type: 'string', description: 'Caller file role' },
9090
lastModified: { type: 'string', description: 'Last modification timestamp' },
9191
editorType: { type: 'string', description: 'Figma editor type' },
92-
thumbnailUrl: { type: 'string', description: 'Thumbnail URL', optional: true, nullable: true },
92+
thumbnailUrl: { type: 'string', description: 'Thumbnail URL', nullable: true },
9393
version: { type: 'string', description: 'Current version ID' },
9494
nodes: {
9595
type: 'json',

‎apps/sim/tools/figma/get-file.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const figmaGetFileTool: ToolConfig<
100100
role: { type: 'string', description: 'Caller file role' },
101101
lastModified: { type: 'string', description: 'Last modification timestamp' },
102102
editorType: { type: 'string', description: 'Figma editor type' },
103-
thumbnailUrl: { type: 'string', description: 'Thumbnail URL', optional: true, nullable: true },
103+
thumbnailUrl: { type: 'string', description: 'Thumbnail URL', nullable: true },
104104
version: { type: 'string', description: 'Current version ID' },
105105
document: {
106106
type: 'json',
@@ -136,13 +136,11 @@ export const figmaGetFileTool: ToolConfig<
136136
linkAccess: {
137137
type: 'string',
138138
description: 'Link access policy',
139-
optional: true,
140139
nullable: true,
141140
},
142141
mainFileKey: {
143142
type: 'string',
144143
description: 'Main file key for a branch',
145-
optional: true,
146144
nullable: true,
147145
},
148146
branches: {
@@ -156,14 +154,12 @@ export const figmaGetFileTool: ToolConfig<
156154
thumbnail_url: {
157155
type: 'string',
158156
description: 'Branch thumbnail URL',
159-
optional: true,
160157
nullable: true,
161158
},
162159
last_modified: { type: 'string', description: 'Branch last modification timestamp' },
163160
link_access: {
164161
type: 'string',
165162
description: 'Branch link access policy',
166-
optional: true,
167163
nullable: true,
168164
},
169165
},

‎apps/sim/tools/figma/list-file-components.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,45 +57,38 @@ export const figmaListFileComponentsTool: ToolConfig<
5757
containing_frame: {
5858
type: 'object',
5959
description: 'Containing page/frame',
60-
optional: true,
6160
nullable: true,
6261
properties: {
6362
nodeId: {
6463
type: 'string',
6564
description: 'Containing node ID',
66-
optional: true,
6765
nullable: true,
6866
},
6967
name: {
7068
type: 'string',
7169
description: 'Containing node name',
72-
optional: true,
7370
nullable: true,
7471
},
7572
backgroundColor: {
7673
type: 'string',
7774
description: 'Frame background color',
78-
optional: true,
7975
nullable: true,
8076
},
8177
pageId: { type: 'string', description: 'Containing page ID' },
8278
pageName: { type: 'string', description: 'Containing page name' },
8379
containingComponentSet: {
8480
type: 'object',
8581
description: 'Containing component set',
86-
optional: true,
8782
nullable: true,
8883
properties: {
8984
nodeId: {
9085
type: 'string',
9186
description: 'Containing node ID',
92-
optional: true,
9387
nullable: true,
9488
},
9589
name: {
9690
type: 'string',
9791
description: 'Containing node name',
98-
optional: true,
9992
nullable: true,
10093
},
10194
},

‎apps/sim/tools/figma/list-file-versions.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ export const figmaListFileVersionsTool: ToolConfig<
9292
prev_page: {
9393
type: 'string',
9494
description: 'Previous-page URL',
95-
optional: true,
9695
nullable: true,
9796
},
98-
next_page: { type: 'string', description: 'Next-page URL', optional: true, nullable: true },
97+
next_page: { type: 'string', description: 'Next-page URL', nullable: true },
9998
},
10099
},
101100
},

‎apps/sim/tools/figma/types.ts‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export const FIGMA_FILE_METADATA_OUTPUT_PROPERTIES = {
136136
folder_name: {
137137
type: 'string',
138138
description: 'Containing folder name',
139-
optional: true,
140139
nullable: true,
141140
},
142141
last_touched_at: { type: 'string', description: 'Last content update timestamp' },
@@ -157,25 +156,22 @@ export const FIGMA_FILE_METADATA_OUTPUT_PROPERTIES = {
157156
handle: { type: 'string', description: 'User display name' },
158157
img_url: { type: 'string', description: 'Profile image URL' },
159158
},
160-
optional: true,
161159
nullable: true,
162160
},
163161
thumbnail_url: {
164162
type: 'string',
165163
description: 'Thumbnail URL',
166-
optional: true,
167164
nullable: true,
168165
},
169166
editorType: { type: 'string', description: 'Editor type' },
170-
version: { type: 'string', description: 'Version ID', optional: true, nullable: true },
171-
role: { type: 'string', description: 'Caller role', optional: true, nullable: true },
167+
version: { type: 'string', description: 'Version ID', nullable: true },
168+
role: { type: 'string', description: 'Caller role', nullable: true },
172169
link_access: {
173170
type: 'string',
174171
description: 'Link access policy',
175-
optional: true,
176172
nullable: true,
177173
},
178-
url: { type: 'string', description: 'File URL', optional: true, nullable: true },
174+
url: { type: 'string', description: 'File URL', nullable: true },
179175
} satisfies Record<string, OutputProperty>
180176

181177
export const FIGMA_COMMENT_OUTPUT_PROPERTIES = {
@@ -185,7 +181,6 @@ export const FIGMA_COMMENT_OUTPUT_PROPERTIES = {
185181
parent_id: {
186182
type: 'string',
187183
description: 'Root comment ID for a reply',
188-
optional: true,
189184
nullable: true,
190185
},
191186
user: {
@@ -201,20 +196,17 @@ export const FIGMA_COMMENT_OUTPUT_PROPERTIES = {
201196
resolved_at: {
202197
type: 'string',
203198
description: 'Resolution timestamp',
204-
optional: true,
205199
nullable: true,
206200
},
207201
order_id: {
208202
type: 'string',
209203
description: 'Number displayed for a root comment',
210-
optional: true,
211204
nullable: true,
212205
},
213206
client_meta: {
214207
type: 'json',
215208
description:
216209
'Canvas coordinates or frame-relative position, optionally including region dimensions',
217-
optional: true,
218210
nullable: true,
219211
properties: {
220212
x: { type: 'number', description: 'Canvas X coordinate', optional: true },
@@ -259,11 +251,10 @@ export const FIGMA_COMMENT_OUTPUT_PROPERTIES = {
259251
export const FIGMA_VERSION_OUTPUT_PROPERTIES = {
260252
id: { type: 'string', description: 'Version ID, preserved as a string' },
261253
created_at: { type: 'string', description: 'Version creation timestamp' },
262-
label: { type: 'string', description: 'Version label', optional: true, nullable: true },
254+
label: { type: 'string', description: 'Version label', nullable: true },
263255
description: {
264256
type: 'string',
265257
description: 'Version description',
266-
optional: true,
267258
nullable: true,
268259
},
269260
user: {
@@ -278,7 +269,6 @@ export const FIGMA_VERSION_OUTPUT_PROPERTIES = {
278269
thumbnail_url: {
279270
type: 'string',
280271
description: 'Version thumbnail URL',
281-
optional: true,
282272
nullable: true,
283273
},
284274
} satisfies Record<string, OutputProperty>
@@ -303,7 +293,6 @@ export const FIGMA_PUBLISHED_RESOURCE_OUTPUT_PROPERTIES = {
303293
thumbnail_url: {
304294
type: 'string',
305295
description: 'Resource thumbnail URL',
306-
optional: true,
307296
nullable: true,
308297
},
309298
} satisfies Record<string, OutputProperty>

‎apps/sim/tools/figma/utils.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@/tools/figma/utils'
99

1010
describe('Figma resource locators', () => {
11-
it.each(['design', 'file', 'proto', 'board', 'slides'])(
11+
it.each(['design', 'file', 'proto', 'board', 'slides', 'deck', 'site', 'buzz', 'make'])(
1212
'extracts a file key from a %s URL without fetching it',
1313
(kind) => {
1414
expect(

‎apps/sim/tools/figma/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function figmaFileKey(value: unknown): string {
2424
)
2525
throw new Error('Enter a Figma file URL or file key')
2626
const match = url.pathname.match(
27-
/^\/(?:file|design|proto|board|slides|buzz|sites|make)\/([^/]+)(?:\/|$)/
27+
/^\/(?:file|design|proto|board|slides|deck|buzz|site|make)\/([^/]+)(?:\/|$)/
2828
)
2929
if (!match?.[1]) throw new Error('The Figma URL does not contain a file key')
3030
const key = decodeURIComponent(match[1])

‎apps/sim/tools/generated/tool-outputs.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)