@animaapp/anima-sdk 0.2.8 → 0.3.1

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.ts CHANGED
@@ -55,14 +55,19 @@ export declare type BaseResult = {
55
55
 
56
56
  export declare class CodegenError extends Error {
57
57
  status?: number;
58
- constructor({ name, reason, status }: {
58
+ detail?: unknown;
59
+ constructor({ name, reason, status, detail, }: {
59
60
  name: string;
60
- reason: CodegenErrorReason;
61
+ reason: CodegenErrorReason | SDKErrorReason;
61
62
  status?: number;
63
+ detail?: unknown;
62
64
  });
63
65
  }
64
66
 
65
- export declare type CodegenErrorReason = "The selected node is not a frame" | "There is no node with the given id" | "Invalid Figma token" | "Figma token expired" | "No files found" | "Connection closed before the 'done' message" | "Unknown" | "Response body is null";
67
+ /**
68
+ * Errors from Public API
69
+ */
70
+ export declare type CodegenErrorReason = "Selected node type is not supported" | "Invisible group nodes are unsupported" | "Selected node is a page with multiple children" | "There is no node with the given id" | "Invalid Figma token" | "Anima API connection error" | "Figma token expired" | "Invalid user token" | "Figma file not found" | "Figma rate limit exceeded" | "Unknown";
66
71
 
67
72
  export declare type CodegenResult = BaseResult & {
68
73
  files: Record<string, {
@@ -138,9 +143,10 @@ export declare class FigmaTokenIssue extends Error {
138
143
  });
139
144
  }
140
145
 
141
- export declare const formatToFigmaLink: ({ fileKey, nodeId, }: {
146
+ export declare const formatToFigmaLink: ({ fileKey, nodeId, duplicate, }: {
142
147
  fileKey: string;
143
148
  nodeId: string;
149
+ duplicate?: boolean;
144
150
  }) => URL;
145
151
 
146
152
  export declare type GeneratingCodePayload = {
@@ -266,6 +272,11 @@ export declare class ResponseError extends Error {
266
272
  constructor(message: string, res: Response);
267
273
  }
268
274
 
275
+ /**
276
+ * Errors from the SDK
277
+ */
278
+ export declare type SDKErrorReason = "Invalid body payload" | "No code generated" | "Connection closed before the 'done' message" | "Response body is null";
279
+
269
280
  export declare type SSECodgenMessage = {
270
281
  type: "queueing";
271
282
  } | {
@@ -317,8 +328,10 @@ export declare type StreamCodgenMessage = Exclude<SSECodgenMessage, {
317
328
  }> | {
318
329
  type: "error";
319
330
  payload: {
331
+ name: string;
320
332
  message: CodegenErrorReason;
321
333
  status?: number;
334
+ detail?: unknown;
322
335
  };
323
336
  };
324
337