@supernova-studio/client 0.59.3 → 0.59.4
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 +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/utils/figma.ts +31 -12
package/dist/index.mjs
CHANGED
|
@@ -7287,19 +7287,28 @@ var DTOThemeCreatePayload = z255.object({
|
|
|
7287
7287
|
var figmaFileIdRegex = /^[0-9a-zA-Z]{22,128}$/;
|
|
7288
7288
|
var nodeIdRegex = /^\d+-\d+$/;
|
|
7289
7289
|
var nodeTypeRegex = /^[0-9a-zA-Z]^/;
|
|
7290
|
+
var ParsedFigmaFileURLError = /* @__PURE__ */ ((ParsedFigmaFileURLError2) => {
|
|
7291
|
+
ParsedFigmaFileURLError2["InvalidUrl"] = "InvalidUrl";
|
|
7292
|
+
ParsedFigmaFileURLError2["InvalidFigmaFileId"] = "InvalidFigmaFileId";
|
|
7293
|
+
return ParsedFigmaFileURLError2;
|
|
7294
|
+
})(ParsedFigmaFileURLError || {});
|
|
7290
7295
|
var FigmaUtils = {
|
|
7291
7296
|
tryParseFigmaFileURL(urlString) {
|
|
7292
|
-
if (!URL.canParse(urlString))
|
|
7293
|
-
return
|
|
7297
|
+
if (!URL.canParse(urlString)) {
|
|
7298
|
+
return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
|
|
7299
|
+
}
|
|
7294
7300
|
const url = new URL(urlString);
|
|
7295
|
-
if (!url.hostname.endsWith("figma.com"))
|
|
7296
|
-
return
|
|
7301
|
+
if (!url.hostname.endsWith("figma.com")) {
|
|
7302
|
+
return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
|
|
7303
|
+
}
|
|
7297
7304
|
const pathSegments = url.pathname.split("/");
|
|
7298
|
-
if (pathSegments[1] !== "design" && pathSegments[1] !== "file")
|
|
7299
|
-
return
|
|
7305
|
+
if (pathSegments[1] !== "design" && pathSegments[1] !== "file") {
|
|
7306
|
+
return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
|
|
7307
|
+
}
|
|
7300
7308
|
const fileId = pathSegments[2];
|
|
7301
|
-
if (!fileId || !fileId.match(figmaFileIdRegex))
|
|
7302
|
-
return
|
|
7309
|
+
if (!fileId || !fileId.match(figmaFileIdRegex)) {
|
|
7310
|
+
return { status: "Error", error: "InvalidFigmaFileId" /* InvalidFigmaFileId */ };
|
|
7311
|
+
}
|
|
7303
7312
|
let fileName = null;
|
|
7304
7313
|
const rawFileName = pathSegments[3];
|
|
7305
7314
|
if (rawFileName) {
|
|
@@ -7315,7 +7324,7 @@ var FigmaUtils = {
|
|
|
7315
7324
|
if (nodeTypeRaw && nodeTypeRaw.match(nodeTypeRegex)) {
|
|
7316
7325
|
nodeType = nodeTypeRaw;
|
|
7317
7326
|
}
|
|
7318
|
-
return { fileId, fileName, nodeId, nodeType };
|
|
7327
|
+
return { status: "Success", fileId, fileName, nodeId, nodeType };
|
|
7319
7328
|
}
|
|
7320
7329
|
};
|
|
7321
7330
|
|
|
@@ -13481,6 +13490,7 @@ export {
|
|
|
13481
13490
|
OverridesEndpoint,
|
|
13482
13491
|
PageBlockEditorModel,
|
|
13483
13492
|
PageSectionEditorModel,
|
|
13493
|
+
ParsedFigmaFileURLError,
|
|
13484
13494
|
PipelinesEndpoint,
|
|
13485
13495
|
RGB,
|
|
13486
13496
|
RGBA,
|