@animaapp/anima-sdk 0.12.0 → 0.13.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/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +914 -891
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ export declare class Anima {
|
|
|
51
51
|
/**
|
|
52
52
|
* @deprecated This method will be removed soon, please use `generateCodeFromWebsite` instead.
|
|
53
53
|
*/
|
|
54
|
-
generateLink2Code(params: GetLink2CodeParams, handler?:
|
|
54
|
+
generateLink2Code(params: GetLink2CodeParams, handler?: GetCodeFromWebsiteHandler, signal?: AbortSignal): Promise<AnimaSDKResult>;
|
|
55
|
+
attachToGenerationJob<T extends SSEGetCodeFromFigmaMessage | SSEGetCodeFromWebsiteMessage | SSEGetCodeFromPromptMessage>(params: AttachToGenerationJobParams, handler?: ((message: T) => void) | Record<string, any>, signal?: AbortSignal): Promise<AnimaSDKResult>;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export declare type AnimaFiles = Record<string, {
|
|
@@ -74,6 +75,32 @@ export declare type AssetsStorage = {
|
|
|
74
75
|
url: string;
|
|
75
76
|
};
|
|
76
77
|
|
|
78
|
+
export declare type AttachToGenerationJobParams = {
|
|
79
|
+
sessionId: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Creates a Server-Sent Events (SSE) `Response` that forwards all messages from the code generation stream.
|
|
84
|
+
*
|
|
85
|
+
* But, if the first message indicates an error (e.g., connection failed), the function returns a 500 response with the error message.
|
|
86
|
+
*
|
|
87
|
+
* @param {Anima} anima - The Anima instance to use for creating the data stream.
|
|
88
|
+
* @param {GetCodeFromPromptParams} params - The parameters for the code generation request.
|
|
89
|
+
* @returns {Promise<Response>} - A promise that resolves to an HTTP response.
|
|
90
|
+
*/
|
|
91
|
+
export declare const attachToGenerationJobResponseEventStream: (anima: Anima, params: AttachToGenerationJobParams) => Promise<Response>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Creates a ReadableStream to output code generation result.
|
|
95
|
+
*
|
|
96
|
+
* The stream is closed when the code generation ends.
|
|
97
|
+
*
|
|
98
|
+
* @param {Anima} anima - An Anima service instance to generate the code from.
|
|
99
|
+
* @param {GetCodeFromPromptParams} params - Parameters required for the code generation process.
|
|
100
|
+
* @returns {ReadableStream<StreamCodeFromPromptMessage>} - A ReadableStream that emits messages related to the code generation process.
|
|
101
|
+
*/
|
|
102
|
+
export declare const attachToGenerationJobStream: (anima: Anima, params: AttachToGenerationJobParams) => ReadableStream<StreamCodgenMessage | StreamCodeFromWebsiteMessage | StreamCodeFromPromptMessage>;
|
|
103
|
+
|
|
77
104
|
export declare type Auth = {
|
|
78
105
|
token: string;
|
|
79
106
|
teamId: string;
|
|
@@ -153,7 +180,7 @@ export declare type CodegenSettings = BaseSettings & {
|
|
|
153
180
|
/**
|
|
154
181
|
* Errors from Anima API, common across multiple routes.
|
|
155
182
|
*/
|
|
156
|
-
export declare type CommonApiError = "Missing Authorization header" | "Invalid Authorization header" | "Missing teamId" | "Internal server error" | "Forbidden, no team access" | "Requested Usage Exceeds Limit" | "Too many concurrent jobs" | "Invalid Anima token";
|
|
183
|
+
export declare type CommonApiError = "Missing Authorization header" | "Invalid Authorization header" | "Missing teamId" | "Internal server error" | "Forbidden, no team access" | "Requested Usage Exceeds Limit" | "Too many concurrent jobs" | "Invalid Anima token" | "Job not found";
|
|
157
184
|
|
|
158
185
|
/**
|
|
159
186
|
* Creates a Server-Sent Events (SSE) `Response` that forwards all messages from the code generation from prompt stream.
|
|
@@ -496,6 +523,8 @@ export declare const isUnknownFigmaApiException: (error: Error) => boolean;
|
|
|
496
523
|
|
|
497
524
|
export declare const isValidFigmaUrl: (figmaLink: string) => [hasCorrectPrefix: boolean, fileKey: string, nodeId: string];
|
|
498
525
|
|
|
526
|
+
export declare type JobType = "f2c" | "l2c" | "p2c";
|
|
527
|
+
|
|
499
528
|
/**
|
|
500
529
|
* @deprecated This type is deprecated and will be removed soon.
|
|
501
530
|
*/
|
|
@@ -652,11 +681,13 @@ export declare type SSECommonMessage<TErrorReason extends string = string> = {
|
|
|
652
681
|
type: "progress_messages_updated";
|
|
653
682
|
payload: {
|
|
654
683
|
progressMessages: ProgressMessage[];
|
|
684
|
+
jobType?: string | null;
|
|
655
685
|
};
|
|
656
686
|
} | {
|
|
657
687
|
type: "job_status_updated";
|
|
658
688
|
payload: {
|
|
659
689
|
jobStatus: Record<string, any>;
|
|
690
|
+
jobType?: string | null;
|
|
660
691
|
};
|
|
661
692
|
} | {
|
|
662
693
|
type: "aborted";
|
|
@@ -669,6 +700,11 @@ export declare type SSECommonMessage<TErrorReason extends string = string> = {
|
|
|
669
700
|
} | {
|
|
670
701
|
type: "error";
|
|
671
702
|
payload: SSEErrorPayload<TErrorReason>;
|
|
703
|
+
} | {
|
|
704
|
+
type: "set_job_type";
|
|
705
|
+
payload: {
|
|
706
|
+
jobType: JobType;
|
|
707
|
+
};
|
|
672
708
|
};
|
|
673
709
|
|
|
674
710
|
export declare type SSEErrorPayload<Reason> = {
|