@runware/sdk-js 1.1.49 → 1.2.0-beta.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/esm/Runware/Runware-base.d.ts +70 -0
- package/dist/esm/Runware/Runware-base.js +1002 -0
- package/dist/esm/Runware/Runware-client.d.ts +5 -0
- package/dist/esm/Runware/Runware-client.js +28 -0
- package/dist/esm/Runware/Runware-server.d.ts +15 -0
- package/dist/esm/Runware/Runware-server.js +145 -0
- package/dist/esm/Runware/Runware.d.ts +4 -0
- package/dist/esm/Runware/Runware.js +13 -0
- package/dist/esm/Runware/async-retry.d.ts +5 -0
- package/dist/esm/Runware/async-retry.js +30 -0
- package/dist/esm/Runware/index.d.ts +4 -0
- package/dist/esm/Runware/index.js +20 -0
- package/dist/esm/Runware/reconnect.d.ts +11 -0
- package/dist/esm/Runware/reconnect.js +175 -0
- package/dist/esm/Runware/types.d.ts +644 -0
- package/dist/esm/Runware/types.js +156 -0
- package/dist/esm/Runware/utils.d.ts +57 -0
- package/dist/esm/Runware/utils.js +262 -0
- package/dist/esm/tests/Runware/enhance-prompt.test.d.ts +1 -0
- package/dist/esm/tests/Runware/enhance-prompt.test.js +58 -0
- package/dist/esm/tests/Runware/remove-image-background.test.d.ts +1 -0
- package/dist/esm/tests/Runware/remove-image-background.test.js +37 -0
- package/dist/esm/tests/Runware/request-image-to-text.test.d.ts +1 -0
- package/dist/esm/tests/Runware/request-image-to-text.test.js +37 -0
- package/dist/esm/tests/Runware/request-images.test.d.ts +1 -0
- package/dist/esm/tests/Runware/request-images.test.js +84 -0
- package/dist/esm/tests/Runware/runware-server.test.d.ts +1 -0
- package/dist/esm/tests/Runware/runware-server.test.js +26 -0
- package/dist/esm/tests/Runware/upload-image.test.d.ts +1 -0
- package/dist/esm/tests/Runware/upload-image.test.js +28 -0
- package/dist/esm/tests/Runware/upscale-gan.test.d.ts +1 -0
- package/dist/esm/tests/Runware/upscale-gan.test.js +41 -0
- package/dist/esm/tests/mockServer.d.ts +12 -0
- package/dist/esm/tests/mockServer.js +38 -0
- package/dist/esm/tests/script.d.ts +8 -0
- package/dist/esm/tests/script.js +570 -0
- package/dist/esm/tests/test-utils.d.ts +40 -0
- package/dist/esm/tests/test-utils.js +45 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -45
- package/dist/index.d.ts +3 -45
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +11 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { IEnhancedPrompt, IError, IImage, IImageToText, IPromptEnhancer, IRemoveImageBackground, IRequestImage, IRequestImageToText, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RunwareBaseType, SdkType, IControlNetPreprocess, IControlNetImage, IRemoveImage, ITextToImage, TAddModel, TPhotoMaker, TPhotoMakerResponse, TModelSearch, TImageMaskingResponse, TImageMasking, TModelSearchResponse, TServerError, TImageUpload, TImageUploadResponse, IRequestVideo, IAsyncResults, IVideoToImage, IRequestRemoveBackground, IMedia } from "./types";
|
|
2
|
+
export declare class RunwareBase {
|
|
3
|
+
_ws: ReconnectingWebsocketProps | any;
|
|
4
|
+
_listeners: ListenerType[];
|
|
5
|
+
_apiKey: string;
|
|
6
|
+
_url?: string;
|
|
7
|
+
_globalMessages: Record<string, any>;
|
|
8
|
+
_globalImages: IImage[];
|
|
9
|
+
_globalError: IError | undefined;
|
|
10
|
+
_connectionSessionUUID: string | undefined;
|
|
11
|
+
_connectionError: TServerError | undefined;
|
|
12
|
+
_sdkType: SdkType;
|
|
13
|
+
_shouldReconnect: boolean;
|
|
14
|
+
_globalMaxRetries: number;
|
|
15
|
+
_timeoutDuration: number;
|
|
16
|
+
ensureConnectionUUID: string | null;
|
|
17
|
+
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeoutDuration, }: RunwareBaseType);
|
|
18
|
+
/**
|
|
19
|
+
* Shared polling logic for async results.
|
|
20
|
+
* @param taskUUID - The task UUID to poll for.
|
|
21
|
+
* @param numberResults - Number of results expected.
|
|
22
|
+
* @param resultKey - Key to identify results (default is "mediaUUID" - "videoUUID" is legacy).
|
|
23
|
+
* @returns Promise resolving to array of results.
|
|
24
|
+
*/
|
|
25
|
+
private pollForAsyncResults;
|
|
26
|
+
static initialize(props: RunwareBaseType): Promise<RunwareBase>;
|
|
27
|
+
protected isWebsocketReadyState: () => boolean;
|
|
28
|
+
protected isInvalidAPIKey: () => boolean;
|
|
29
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
30
|
+
lis: (v: any) => any;
|
|
31
|
+
groupKey?: string;
|
|
32
|
+
taskUUID: string;
|
|
33
|
+
}): {
|
|
34
|
+
destroy: () => void;
|
|
35
|
+
};
|
|
36
|
+
protected connect(): void;
|
|
37
|
+
protected send: (msg: Object) => void;
|
|
38
|
+
private destroy;
|
|
39
|
+
private uploadImage;
|
|
40
|
+
private listenToImages;
|
|
41
|
+
private listenToUpload;
|
|
42
|
+
private globalListener;
|
|
43
|
+
requestImages({ outputType, outputFormat, uploadEndpoint, checkNSFW, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, promptWeighting, numberResults, onPartialImages, includeCost, customTaskUUID, retry, refiner, maskMargin, outputQuality, controlNet, lora, embeddings, ipAdapters, providerSettings, outpaint, acceleratorOptions, advancedFeatures, referenceImages, includeGenerationTime, includePayload, ...rest }: IRequestImage, moreOptions?: Record<string, any>): Promise<ITextToImage[] | undefined>;
|
|
44
|
+
controlNetPreProcess: ({ inputImage, preProcessorType, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, outputQuality, customTaskUUID, retry, includeGenerationTime, includePayload, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
45
|
+
requestImageToText: ({ inputImage, includeCost, customTaskUUID, retry, includePayload, includeGenerationTime, }: IRequestImageToText) => Promise<IImageToText>;
|
|
46
|
+
removeImageBackground: (payload: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
47
|
+
removeBackground: (payload: IRequestRemoveBackground) => Promise<IMedia[] | IMedia>;
|
|
48
|
+
videoInference: (payload: IRequestVideo) => Promise<IVideoToImage[] | IVideoToImage>;
|
|
49
|
+
getResponse: (payload: IAsyncResults) => Promise<IMedia[]>;
|
|
50
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, outputQuality, customTaskUUID, retry, includeGenerationTime, includePayload, }: IUpscaleGan) => Promise<IImage>;
|
|
51
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, includeGenerationTime, includePayload, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
52
|
+
modelUpload: (payload: TAddModel) => Promise<any>;
|
|
53
|
+
photoMaker: (payload: TPhotoMaker, moreOptions?: Record<string, any>) => Promise<TPhotoMakerResponse[] | undefined>;
|
|
54
|
+
modelSearch: (payload: TModelSearch) => Promise<TModelSearchResponse>;
|
|
55
|
+
imageMasking: (payload: TImageMasking) => Promise<TImageMaskingResponse>;
|
|
56
|
+
imageUpload: (payload: TImageUpload) => Promise<TImageUploadResponse>;
|
|
57
|
+
protected baseSingleRequest: <T>({ payload, debugKey, isMultiple, }: {
|
|
58
|
+
payload: Record<string, any>;
|
|
59
|
+
debugKey: string;
|
|
60
|
+
isMultiple?: boolean | undefined;
|
|
61
|
+
}) => Promise<T>;
|
|
62
|
+
ensureConnection(): Promise<unknown>;
|
|
63
|
+
private getSimilarImages;
|
|
64
|
+
private getSingleMessage;
|
|
65
|
+
private getMultipleMessages;
|
|
66
|
+
private insertAdditionalResponse;
|
|
67
|
+
private handleIncompleteImages;
|
|
68
|
+
disconnect: () => Promise<void>;
|
|
69
|
+
private connected;
|
|
70
|
+
}
|