@animaapp/anima-sdk 0.2.8 → 0.3.0
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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-dev.log +0 -0
- package/.turbo/turbo-test.log +21 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.js +734 -718
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/anima.ts +35 -13
- package/src/dataStream.ts +26 -11
- package/src/errors.ts +31 -5
- package/src/utils/figma.spec.ts +31 -0
- package/src/utils/figma.ts +6 -0
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
|
-
|
|
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
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Errors from Public API
|
|
69
|
+
*/
|
|
70
|
+
export declare type CodegenErrorReason = "Selected node type is not supported" | "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
|
|