@supernova-studio/client 0.58.15 → 0.58.17

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.mjs CHANGED
@@ -6862,7 +6862,14 @@ var DTOFigmaNode = FigmaNodeReference.omit({
6862
6862
  data: DTOFigmaNodeData,
6863
6863
  origin: DTOFigmaNodeOrigin
6864
6864
  });
6865
- var DTOFigmaNodeRenderInput = z240.object({
6865
+ var DTOFigmaNodeRenderInputBase = z240.object({
6866
+ /**
6867
+ * Format in which the node must be rendered, png by default.
6868
+ */
6869
+ format: FigmaNodeRenderFormat.default("Png")
6870
+ });
6871
+ var DTOFigmaNodeRenderIdInput = DTOFigmaNodeRenderInputBase.extend({
6872
+ inputType: z240.literal("NodeId").optional().transform((v) => v ?? "NodeId"),
6866
6873
  /**
6867
6874
  * Id of a design system's data source representing a linked Figma file
6868
6875
  */
@@ -6870,12 +6877,19 @@ var DTOFigmaNodeRenderInput = z240.object({
6870
6877
  /**
6871
6878
  * Id of a node within the Figma file
6872
6879
  */
6873
- figmaFileNodeId: z240.string(),
6880
+ figmaFileNodeId: z240.string()
6881
+ });
6882
+ var DTOFigmaNodeRenderUrlInput = DTOFigmaNodeRenderInputBase.extend({
6883
+ inputType: z240.literal("URL"),
6874
6884
  /**
6875
- * Format in which the node must be rendered, png by default.
6885
+ * Id of a design system's data source representing a linked Figma file
6876
6886
  */
6877
- format: FigmaNodeRenderFormat.default("Png")
6887
+ figmaNodeUrl: z240.string()
6878
6888
  });
6889
+ var DTOFigmaNodeRenderInput = z240.discriminatedUnion("inputType", [
6890
+ DTOFigmaNodeRenderIdInput,
6891
+ DTOFigmaNodeRenderUrlInput
6892
+ ]);
6879
6893
 
6880
6894
  // src/api/dto/elements/figma-nodes/node-actions-v2.ts
6881
6895
  import { z as z241 } from "zod";
@@ -7093,6 +7107,42 @@ var DTOThemeCreatePayload = z250.object({
7093
7107
  overrides: DTOThemeOverride.array()
7094
7108
  });
7095
7109
 
7110
+ // src/utils/figma.ts
7111
+ var figmaFileIdRegex = /^[0-9a-zA-Z]{22,128}$/;
7112
+ var nodeIdRegex = /^d+-d+$/;
7113
+ var nodeTypeRegex = /^[0-9a-zA-Z]^/;
7114
+ var FigmaUtils = {
7115
+ tryParseFigmaFileURL(urlString) {
7116
+ if (!URL.canParse(urlString))
7117
+ return null;
7118
+ const url = new URL(urlString);
7119
+ if (!url.hostname.endsWith("figma.com"))
7120
+ return null;
7121
+ const pathSegments = url.pathname.split("/");
7122
+ if (pathSegments[0] !== "design" && pathSegments[0] !== "file")
7123
+ return null;
7124
+ const fileId = pathSegments[1];
7125
+ if (!fileId || !fileId.match(figmaFileIdRegex))
7126
+ return null;
7127
+ let fileName = null;
7128
+ const rawFileName = pathSegments[2];
7129
+ if (rawFileName) {
7130
+ fileName = rawFileName.replaceAll("-", " ");
7131
+ }
7132
+ let nodeId = null;
7133
+ const nodeIdRaw = url.searchParams.get("node-id");
7134
+ if (nodeIdRaw && nodeIdRaw.match(nodeIdRegex)) {
7135
+ nodeId = nodeIdRaw.replace("-", ":");
7136
+ }
7137
+ let nodeType = null;
7138
+ const nodeTypeRaw = url.searchParams.get("node-type");
7139
+ if (nodeTypeRaw && nodeTypeRaw.match(nodeTypeRegex)) {
7140
+ nodeType = nodeTypeRaw;
7141
+ }
7142
+ return { fileId, fileName, nodeId, nodeType };
7143
+ }
7144
+ };
7145
+
7096
7146
  // src/utils/hash.ts
7097
7147
  function hash(input) {
7098
7148
  return farmhash(input).toString(16);
@@ -13143,6 +13193,7 @@ export {
13143
13193
  FigmaComponentGroupsEndpoint,
13144
13194
  FigmaComponentsEndpoint,
13145
13195
  FigmaFrameStructuresEndpoint,
13196
+ FigmaUtils,
13146
13197
  FormattedCollections,
13147
13198
  FrontendVersionRoomYDoc,
13148
13199
  ImportJobsEndpoint,