@runware/sdk-js 1.1.20-beta.2 → 1.1.20-beta.4
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 +2 -1510
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +76 -28
- package/dist/index.d.ts +76 -28
- package/dist/index.js +2 -1487
- package/dist/index.js.map +1 -0
- package/package.json +6 -5
- package/dist/Runware-base-EVIFLT6I.mjs +0 -8
- package/dist/Runware-client-RIKDIM4I.mjs +0 -6
- package/dist/chunk-GKWTIXRV.mjs +0 -1064
- package/dist/chunk-IZ7MFCL7.mjs +0 -1249
- package/dist/esm/Runware/Runware-base.d.ts +0 -40
- package/dist/esm/Runware/Runware-base.js +0 -651
- package/dist/esm/Runware/Runware-client.d.ts +0 -5
- package/dist/esm/Runware/Runware-client.js +0 -18
- package/dist/esm/Runware/Runware-server.d.ts +0 -14
- package/dist/esm/Runware/Runware-server.js +0 -155
- package/dist/esm/Runware/Runware.d.ts +0 -4
- package/dist/esm/Runware/Runware.js +0 -13
- package/dist/esm/Runware/async-retry.d.ts +0 -5
- package/dist/esm/Runware/async-retry.js +0 -27
- package/dist/esm/Runware/index.d.ts +0 -4
- package/dist/esm/Runware/index.js +0 -20
- package/dist/esm/Runware/reconnect.d.ts +0 -11
- package/dist/esm/Runware/reconnect.js +0 -175
- package/dist/esm/Runware/types.d.ts +0 -244
- package/dist/esm/Runware/types.js +0 -84
- package/dist/esm/Runware/utils.d.ts +0 -45
- package/dist/esm/Runware/utils.js +0 -212
- package/dist/esm/tests/Runware/enhance-prompt.test.d.ts +0 -1
- package/dist/esm/tests/Runware/enhance-prompt.test.js +0 -58
- package/dist/esm/tests/Runware/remove-image-background.test.d.ts +0 -1
- package/dist/esm/tests/Runware/remove-image-background.test.js +0 -37
- package/dist/esm/tests/Runware/request-image-to-text.test.d.ts +0 -1
- package/dist/esm/tests/Runware/request-image-to-text.test.js +0 -37
- package/dist/esm/tests/Runware/request-images.test.d.ts +0 -1
- package/dist/esm/tests/Runware/request-images.test.js +0 -72
- package/dist/esm/tests/Runware/runware-server.test.d.ts +0 -1
- package/dist/esm/tests/Runware/runware-server.test.js +0 -26
- package/dist/esm/tests/Runware/upload-image.test.d.ts +0 -1
- package/dist/esm/tests/Runware/upload-image.test.js +0 -52
- package/dist/esm/tests/Runware/upscale-gan.test.d.ts +0 -1
- package/dist/esm/tests/Runware/upscale-gan.test.js +0 -41
- package/dist/esm/tests/mockServer.d.ts +0 -12
- package/dist/esm/tests/mockServer.js +0 -38
- package/dist/esm/tests/test-utils.d.ts +0 -39
- package/dist/esm/tests/test-utils.js +0 -44
- package/dist/index.d.mts +0 -338
- package/dist/index.mjs +0 -1464
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const test_utils_1 = require("../test-utils");
|
|
5
|
-
const mockServer_1 = require("../mockServer");
|
|
6
|
-
const Runware_1 = require("../../Runware");
|
|
7
|
-
vitest_1.vi.mock("../../Runware/utils", async () => {
|
|
8
|
-
const actual = await vitest_1.vi.importActual("../../Runware/utils");
|
|
9
|
-
return Object.assign(Object.assign({}, actual), { fileToBase64: vitest_1.vi.fn().mockReturnValue("FILE_TO_BASE_64"), getIntervalWithPromise: vitest_1.vi.fn(), getUUID: vitest_1.vi.fn().mockImplementation(() => "UNIQUE_UID") });
|
|
10
|
-
});
|
|
11
|
-
(0, vitest_1.describe)("When user request to upscale gan", async () => {
|
|
12
|
-
const { mockServer, runware } = await (0, mockServer_1.startMockServer)();
|
|
13
|
-
(0, vitest_1.afterEach)(() => {
|
|
14
|
-
vitest_1.vi.clearAllMocks();
|
|
15
|
-
});
|
|
16
|
-
(0, vitest_1.beforeEach)(() => {
|
|
17
|
-
mockServer.stop();
|
|
18
|
-
});
|
|
19
|
-
(0, vitest_1.beforeAll)(async () => {
|
|
20
|
-
vitest_1.vi.spyOn(runware, "uploadImage").mockReturnValue(test_utils_1.testExamples.imageUploadRes);
|
|
21
|
-
});
|
|
22
|
-
(0, vitest_1.test)("it should upscale gan", async () => {
|
|
23
|
-
const imageUploadSpy = vitest_1.vi.spyOn(runware, "uploadImage");
|
|
24
|
-
const globalListenerSpy = vitest_1.vi.spyOn(runware, "globalListener");
|
|
25
|
-
const sendSpy = vitest_1.vi.spyOn(runware, "send");
|
|
26
|
-
await runware.upscaleGan({
|
|
27
|
-
inputImage: test_utils_1.mockUploadFile,
|
|
28
|
-
upscaleFactor: 2,
|
|
29
|
-
});
|
|
30
|
-
(0, vitest_1.expect)(imageUploadSpy).toHaveBeenCalled();
|
|
31
|
-
(0, vitest_1.expect)(sendSpy).toHaveBeenCalledWith({
|
|
32
|
-
inputImage: test_utils_1.testExamples.imageUploadRes.imageUUID,
|
|
33
|
-
taskUUID: test_utils_1.mockTaskUUID,
|
|
34
|
-
upscaleFactor: 2,
|
|
35
|
-
taskType: Runware_1.ETaskType.IMAGE_UPSCALE,
|
|
36
|
-
});
|
|
37
|
-
(0, vitest_1.expect)(globalListenerSpy).toHaveBeenCalledWith({
|
|
38
|
-
taskUUID: test_utils_1.mockTaskUUID,
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="ws" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { Server } from "mock-socket";
|
|
4
|
-
import { RunwareServer } from "../Runware";
|
|
5
|
-
export declare const startMockServer: () => Promise<{
|
|
6
|
-
runware: import("../Runware").RunwareClient | RunwareServer;
|
|
7
|
-
mockServer: Server;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const startMockBackendServer: () => Promise<{
|
|
10
|
-
runwareServer: RunwareServer;
|
|
11
|
-
mockServer: import("ws").Server<typeof import("ws"), typeof import("http").IncomingMessage>;
|
|
12
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.startMockBackendServer = exports.startMockServer = void 0;
|
|
4
|
-
const mock_socket_1 = require("mock-socket");
|
|
5
|
-
const Runware_1 = require("../Runware");
|
|
6
|
-
const utils_1 = require("../Runware/utils");
|
|
7
|
-
const ws_1 = require("ws");
|
|
8
|
-
const startMockServer = async () => {
|
|
9
|
-
const mockServer = new mock_socket_1.Server("ws://localhost:8080");
|
|
10
|
-
mockServer.on("connection", (socket) => {
|
|
11
|
-
socket.on("message", (data) => {
|
|
12
|
-
// socket.send("test message from mock server");
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
const runware = new Runware_1.Runware({
|
|
16
|
-
apiKey: "API_KEY",
|
|
17
|
-
url: utils_1.BASE_RUNWARE_URLS.TEST,
|
|
18
|
-
});
|
|
19
|
-
await (0, utils_1.delay)(1);
|
|
20
|
-
return { runware, mockServer };
|
|
21
|
-
};
|
|
22
|
-
exports.startMockServer = startMockServer;
|
|
23
|
-
const startMockBackendServer = async () => {
|
|
24
|
-
const mockServer = new ws_1.WebSocketServer({ port: 8080 });
|
|
25
|
-
mockServer.on("connection", (socket) => {
|
|
26
|
-
socket.on("message", (data, isBinary) => {
|
|
27
|
-
const message = !isBinary ? data === null || data === void 0 ? void 0 : data.toString() : data;
|
|
28
|
-
// socket.send("test message from mock server");
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
const runwareServer = new Runware_1.RunwareServer({
|
|
32
|
-
apiKey: "API_KEY",
|
|
33
|
-
url: utils_1.BASE_RUNWARE_URLS.TEST,
|
|
34
|
-
});
|
|
35
|
-
await (0, utils_1.delay)(1);
|
|
36
|
-
return { runwareServer, mockServer };
|
|
37
|
-
};
|
|
38
|
-
exports.startMockBackendServer = startMockBackendServer;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { EControlMode, ETaskType } from "../Runware";
|
|
2
|
-
export declare const mockTaskUUID = "UNIQUE_UID";
|
|
3
|
-
export declare const mockTextImageUpload = "IMAGE_UPLOAD";
|
|
4
|
-
export declare const mockFileToBase64 = "FILE_TO_BASE_64";
|
|
5
|
-
export declare const mockNewImageUID = "NEW_IMAGE_UID";
|
|
6
|
-
export declare const mockUploadFile: any;
|
|
7
|
-
export declare const testExamples: {
|
|
8
|
-
imageReq: {
|
|
9
|
-
numberResults: number;
|
|
10
|
-
positivePrompt: string;
|
|
11
|
-
model: number;
|
|
12
|
-
steps: number;
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
};
|
|
16
|
-
imageRes: {
|
|
17
|
-
model: number;
|
|
18
|
-
numberResults: number;
|
|
19
|
-
positivePrompt: string;
|
|
20
|
-
steps: number;
|
|
21
|
-
taskType: ETaskType;
|
|
22
|
-
taskUUID: string;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
};
|
|
26
|
-
imageUploadRes: {
|
|
27
|
-
imageUUID: string;
|
|
28
|
-
imageURL: string;
|
|
29
|
-
taskUUID: string;
|
|
30
|
-
};
|
|
31
|
-
controlNet: {
|
|
32
|
-
endStep: number;
|
|
33
|
-
startStep: number;
|
|
34
|
-
guideImage: string;
|
|
35
|
-
preprocessor: any;
|
|
36
|
-
weight: number;
|
|
37
|
-
controlMode: EControlMode;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testExamples = exports.mockUploadFile = exports.mockNewImageUID = exports.mockFileToBase64 = exports.mockTextImageUpload = exports.mockTaskUUID = void 0;
|
|
4
|
-
const Runware_1 = require("../Runware");
|
|
5
|
-
const utils_1 = require("../Runware/utils");
|
|
6
|
-
const promptText = "A beautiful runware";
|
|
7
|
-
exports.mockTaskUUID = "UNIQUE_UID";
|
|
8
|
-
exports.mockTextImageUpload = "IMAGE_UPLOAD";
|
|
9
|
-
exports.mockFileToBase64 = "FILE_TO_BASE_64";
|
|
10
|
-
exports.mockNewImageUID = "NEW_IMAGE_UID";
|
|
11
|
-
exports.mockUploadFile = new utils_1.MockFile().create("pic.jpg", 1024 * 1024 * 2, "image/jpeg");
|
|
12
|
-
exports.testExamples = {
|
|
13
|
-
imageReq: {
|
|
14
|
-
numberResults: 8,
|
|
15
|
-
positivePrompt: promptText,
|
|
16
|
-
model: 13,
|
|
17
|
-
steps: 30,
|
|
18
|
-
width: 512,
|
|
19
|
-
height: 512,
|
|
20
|
-
},
|
|
21
|
-
imageRes: {
|
|
22
|
-
model: 13,
|
|
23
|
-
numberResults: 8,
|
|
24
|
-
positivePrompt: promptText,
|
|
25
|
-
steps: 30,
|
|
26
|
-
taskType: Runware_1.ETaskType.IMAGE_INFERENCE,
|
|
27
|
-
taskUUID: exports.mockTaskUUID,
|
|
28
|
-
width: 512,
|
|
29
|
-
height: 512,
|
|
30
|
-
},
|
|
31
|
-
imageUploadRes: {
|
|
32
|
-
imageUUID: exports.mockNewImageUID,
|
|
33
|
-
imageURL: "data:image/png;base64,iVBORw0KGgoAAAA...",
|
|
34
|
-
taskUUID: "50836053-a0ee-4cf5-b9d6-ae7c5d140ada",
|
|
35
|
-
},
|
|
36
|
-
controlNet: {
|
|
37
|
-
endStep: 20,
|
|
38
|
-
startStep: 0,
|
|
39
|
-
guideImage: exports.mockTextImageUpload,
|
|
40
|
-
preprocessor: "canny",
|
|
41
|
-
weight: 1,
|
|
42
|
-
controlMode: Runware_1.EControlMode.CONTROL_NET,
|
|
43
|
-
},
|
|
44
|
-
};
|
package/dist/index.d.mts
DELETED
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
declare enum Environment {
|
|
2
|
-
PRODUCTION = "PRODUCTION",
|
|
3
|
-
DEVELOPMENT = "DEVELOPMENT",
|
|
4
|
-
TEST = "TEST"
|
|
5
|
-
}
|
|
6
|
-
declare enum SdkType {
|
|
7
|
-
CLIENT = "CLIENT",
|
|
8
|
-
SERVER = "SERVER"
|
|
9
|
-
}
|
|
10
|
-
declare enum ETaskType {
|
|
11
|
-
IMAGE_INFERENCE = "imageInference",
|
|
12
|
-
IMAGE_UPLOAD = "imageUpload",
|
|
13
|
-
IMAGE_UPSCALE = "imageUpscale",
|
|
14
|
-
IMAGE_BACKGROUND_REMOVAL = "imageBackgroundRemoval",
|
|
15
|
-
IMAGE_CAPTION = "imageCaption",
|
|
16
|
-
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
|
-
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
-
AUTHENTICATION = "authentication",
|
|
19
|
-
MODEL_UPLOAD = "modelUpload"
|
|
20
|
-
}
|
|
21
|
-
type RunwareBaseType = {
|
|
22
|
-
apiKey: string;
|
|
23
|
-
url?: string;
|
|
24
|
-
shouldReconnect?: boolean;
|
|
25
|
-
globalMaxRetries?: number;
|
|
26
|
-
timeoutDuration?: number;
|
|
27
|
-
};
|
|
28
|
-
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
29
|
-
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
30
|
-
interface IImage {
|
|
31
|
-
taskType: ETaskType;
|
|
32
|
-
imageUUID: string;
|
|
33
|
-
inputImageUUID?: string;
|
|
34
|
-
taskUUID: string;
|
|
35
|
-
imageURL?: string;
|
|
36
|
-
imageBase64Data?: string;
|
|
37
|
-
imageDataURI?: string;
|
|
38
|
-
NSFWContent?: boolean;
|
|
39
|
-
cost?: number;
|
|
40
|
-
}
|
|
41
|
-
interface ITextToImage extends IImage {
|
|
42
|
-
positivePrompt?: string;
|
|
43
|
-
negativePrompt?: string;
|
|
44
|
-
}
|
|
45
|
-
interface IControlNetImage {
|
|
46
|
-
taskUUID: string;
|
|
47
|
-
inputImageUUID: string;
|
|
48
|
-
guideImageUUID: string;
|
|
49
|
-
guideImageURL?: string;
|
|
50
|
-
guideImageBase64Data?: string;
|
|
51
|
-
guideImageDataURI?: string;
|
|
52
|
-
cost?: number;
|
|
53
|
-
}
|
|
54
|
-
interface ILora {
|
|
55
|
-
model: string | number;
|
|
56
|
-
weight: number;
|
|
57
|
-
}
|
|
58
|
-
declare enum EControlMode {
|
|
59
|
-
BALANCED = "balanced",
|
|
60
|
-
PROMPT = "prompt",
|
|
61
|
-
CONTROL_NET = "controlnet"
|
|
62
|
-
}
|
|
63
|
-
type IControlNetGeneral = {
|
|
64
|
-
model: string;
|
|
65
|
-
guideImage: string | File;
|
|
66
|
-
weight?: number;
|
|
67
|
-
startStep?: number;
|
|
68
|
-
startStepPercentage?: number;
|
|
69
|
-
endStep?: number;
|
|
70
|
-
endStepPercentage?: number;
|
|
71
|
-
controlMode: EControlMode;
|
|
72
|
-
};
|
|
73
|
-
type IControlNetPreprocess = {
|
|
74
|
-
inputImage: string | File;
|
|
75
|
-
preProcessorType: EPreProcessorGroup;
|
|
76
|
-
height?: number;
|
|
77
|
-
width?: number;
|
|
78
|
-
outputType?: IOutputType;
|
|
79
|
-
outputFormat?: IOutputFormat;
|
|
80
|
-
highThresholdCanny?: number;
|
|
81
|
-
lowThresholdCanny?: number;
|
|
82
|
-
includeHandsAndFaceOpenPose?: boolean;
|
|
83
|
-
includeCost?: boolean;
|
|
84
|
-
customTaskUUID?: string;
|
|
85
|
-
retry?: number;
|
|
86
|
-
};
|
|
87
|
-
type IControlNet = IControlNetGeneral;
|
|
88
|
-
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
89
|
-
guideImage?: string;
|
|
90
|
-
};
|
|
91
|
-
interface IError {
|
|
92
|
-
error: boolean;
|
|
93
|
-
errorMessage: string;
|
|
94
|
-
taskUUID: string;
|
|
95
|
-
}
|
|
96
|
-
interface IRequestImage {
|
|
97
|
-
outputType?: IOutputType;
|
|
98
|
-
outputFormat?: IOutputFormat;
|
|
99
|
-
uploadEndpoint?: string;
|
|
100
|
-
checkNsfw?: boolean;
|
|
101
|
-
positivePrompt: string;
|
|
102
|
-
negativePrompt?: string;
|
|
103
|
-
seedImage?: File | string;
|
|
104
|
-
maskImage?: File | string;
|
|
105
|
-
strength?: number;
|
|
106
|
-
height?: number;
|
|
107
|
-
width?: number;
|
|
108
|
-
model: number | string;
|
|
109
|
-
steps?: number;
|
|
110
|
-
scheduler?: string;
|
|
111
|
-
seed?: number;
|
|
112
|
-
CFGScale?: number;
|
|
113
|
-
clipSkip?: number;
|
|
114
|
-
usePromptWeighting?: boolean;
|
|
115
|
-
numberResults?: number;
|
|
116
|
-
controlNet?: IControlNet[];
|
|
117
|
-
lora?: ILora[];
|
|
118
|
-
includeCost?: boolean;
|
|
119
|
-
customTaskUUID?: string;
|
|
120
|
-
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
121
|
-
retry?: number;
|
|
122
|
-
}
|
|
123
|
-
interface IRequestImageToText {
|
|
124
|
-
inputImage?: File | string;
|
|
125
|
-
includeCost?: boolean;
|
|
126
|
-
customTaskUUID?: string;
|
|
127
|
-
retry?: number;
|
|
128
|
-
}
|
|
129
|
-
interface IImageToText {
|
|
130
|
-
taskType: ETaskType;
|
|
131
|
-
taskUUID: string;
|
|
132
|
-
text: string;
|
|
133
|
-
cost?: number;
|
|
134
|
-
}
|
|
135
|
-
interface IRemoveImageBackground extends IRequestImageToText {
|
|
136
|
-
outputType?: IOutputType;
|
|
137
|
-
outputFormat?: IOutputFormat;
|
|
138
|
-
rgba?: number[];
|
|
139
|
-
postProcessMask?: boolean;
|
|
140
|
-
returnOnlyMask?: boolean;
|
|
141
|
-
alphaMatting?: boolean;
|
|
142
|
-
alphaMattingForegroundThreshold?: number;
|
|
143
|
-
alphaMattingBackgroundThreshold?: number;
|
|
144
|
-
alphaMattingErodeSize?: number;
|
|
145
|
-
includeCost?: boolean;
|
|
146
|
-
retry?: number;
|
|
147
|
-
}
|
|
148
|
-
interface IRemoveImage {
|
|
149
|
-
taskType: ETaskType;
|
|
150
|
-
taskUUID: string;
|
|
151
|
-
imageUUID: string;
|
|
152
|
-
inputImageUUID: string;
|
|
153
|
-
imageURL?: string;
|
|
154
|
-
imageBase64Data?: string;
|
|
155
|
-
imageDataURI?: string;
|
|
156
|
-
cost?: number;
|
|
157
|
-
}
|
|
158
|
-
interface IPromptEnhancer {
|
|
159
|
-
promptMaxLength?: number;
|
|
160
|
-
promptVersions?: number;
|
|
161
|
-
prompt: string;
|
|
162
|
-
includeCost?: boolean;
|
|
163
|
-
customTaskUUID?: string;
|
|
164
|
-
retry?: number;
|
|
165
|
-
}
|
|
166
|
-
interface IEnhancedPrompt extends IImageToText {
|
|
167
|
-
}
|
|
168
|
-
interface IUpscaleGan {
|
|
169
|
-
inputImage: File | string;
|
|
170
|
-
upscaleFactor: number;
|
|
171
|
-
outputType?: IOutputType;
|
|
172
|
-
outputFormat?: IOutputFormat;
|
|
173
|
-
includeCost?: boolean;
|
|
174
|
-
customTaskUUID?: string;
|
|
175
|
-
retry?: number;
|
|
176
|
-
}
|
|
177
|
-
type ReconnectingWebsocketProps = {
|
|
178
|
-
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
179
|
-
send: (data: any) => void;
|
|
180
|
-
} & WebSocket;
|
|
181
|
-
type UploadImageType = {
|
|
182
|
-
imageURL: string;
|
|
183
|
-
imageUUID: string;
|
|
184
|
-
taskUUID: string;
|
|
185
|
-
taskType: ETaskType;
|
|
186
|
-
};
|
|
187
|
-
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
188
|
-
resolve: <T>(value: T) => void;
|
|
189
|
-
reject: <T>(value: T) => void;
|
|
190
|
-
intervalId: any;
|
|
191
|
-
}) => boolean | undefined;
|
|
192
|
-
declare enum EPreProcessorGroup {
|
|
193
|
-
"canny" = "canny",
|
|
194
|
-
"depth" = "depth",
|
|
195
|
-
"mlsd" = "mlsd",
|
|
196
|
-
"normalbae" = "normalbae",
|
|
197
|
-
"openpose" = "openpose",
|
|
198
|
-
"tile" = "tile",
|
|
199
|
-
"seg" = "seg",
|
|
200
|
-
"lineart" = "lineart",
|
|
201
|
-
"lineart_anime" = "lineart_anime",
|
|
202
|
-
"shuffle" = "shuffle",
|
|
203
|
-
"scribble" = "scribble",
|
|
204
|
-
"softedge" = "softedge"
|
|
205
|
-
}
|
|
206
|
-
declare enum EPreProcessor {
|
|
207
|
-
"canny" = "canny",
|
|
208
|
-
"depth_leres" = "depth_leres",
|
|
209
|
-
"depth_midas" = "depth_midas",
|
|
210
|
-
"depth_zoe" = "depth_zoe",
|
|
211
|
-
"inpaint_global_harmonious" = "inpaint_global_harmonious",
|
|
212
|
-
"lineart_anime" = "lineart_anime",
|
|
213
|
-
"lineart_coarse" = "lineart_coarse",
|
|
214
|
-
"lineart_realistic" = "lineart_realistic",
|
|
215
|
-
"lineart_standard" = "lineart_standard",
|
|
216
|
-
"mlsd" = "mlsd",
|
|
217
|
-
"normal_bae" = "normal_bae",
|
|
218
|
-
"scribble_hed" = "scribble_hed",
|
|
219
|
-
"scribble_pidinet" = "scribble_pidinet",
|
|
220
|
-
"seg_ofade20k" = "seg_ofade20k",
|
|
221
|
-
"seg_ofcoco" = "seg_ofcoco",
|
|
222
|
-
"seg_ufade20k" = "seg_ufade20k",
|
|
223
|
-
"shuffle" = "shuffle",
|
|
224
|
-
"softedge_hed" = "softedge_hed",
|
|
225
|
-
"softedge_hedsafe" = "softedge_hedsafe",
|
|
226
|
-
"softedge_pidinet" = "softedge_pidinet",
|
|
227
|
-
"softedge_pidisafe" = "softedge_pidisafe",
|
|
228
|
-
"tile_gaussian" = "tile_gaussian",
|
|
229
|
-
"openpose" = "openpose",
|
|
230
|
-
"openpose_face" = "openpose_face",
|
|
231
|
-
"openpose_faceonly" = "openpose_faceonly",
|
|
232
|
-
"openpose_full" = "openpose_full",
|
|
233
|
-
"openpose_hand" = "openpose_hand"
|
|
234
|
-
}
|
|
235
|
-
declare enum EOpenPosePreProcessor {
|
|
236
|
-
"openpose" = "openpose",
|
|
237
|
-
"openpose_face" = "openpose_face",
|
|
238
|
-
"openpose_faceonly" = "openpose_faceonly",
|
|
239
|
-
"openpose_full" = "openpose_full",
|
|
240
|
-
"openpose_hand" = "openpose_hand"
|
|
241
|
-
}
|
|
242
|
-
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
243
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
244
|
-
}[Keys];
|
|
245
|
-
type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
246
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
247
|
-
}[Keys];
|
|
248
|
-
type ListenerType = {
|
|
249
|
-
key: string;
|
|
250
|
-
listener: (msg: any) => void;
|
|
251
|
-
groupKey?: string;
|
|
252
|
-
};
|
|
253
|
-
type TAddModel = {
|
|
254
|
-
modelType: string;
|
|
255
|
-
modelAIR: string;
|
|
256
|
-
modelName: string;
|
|
257
|
-
modelHeroImageUrl: string;
|
|
258
|
-
modelDownloadUrl: string;
|
|
259
|
-
modelUniqueIdentifier: string;
|
|
260
|
-
modelVersion: string;
|
|
261
|
-
modelTags: string[];
|
|
262
|
-
modelTypeId: number;
|
|
263
|
-
modelDefaultWeight: number;
|
|
264
|
-
modelFormatId: number;
|
|
265
|
-
modelPositiveTriggerWords: string;
|
|
266
|
-
modelShortDescription: string;
|
|
267
|
-
privateModel: true;
|
|
268
|
-
modelComment: string;
|
|
269
|
-
retry?: number;
|
|
270
|
-
customTaskUUID?: string;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
declare class RunwareBase {
|
|
274
|
-
_ws: ReconnectingWebsocketProps | any;
|
|
275
|
-
_listeners: ListenerType[];
|
|
276
|
-
_apiKey: string;
|
|
277
|
-
_url?: string;
|
|
278
|
-
_globalMessages: Record<string, any>;
|
|
279
|
-
_globalImages: IImage[];
|
|
280
|
-
_globalError: IError | undefined;
|
|
281
|
-
_connectionSessionUUID: string | undefined;
|
|
282
|
-
_invalidAPIkey: string | undefined;
|
|
283
|
-
_sdkType: SdkType;
|
|
284
|
-
_shouldReconnect: boolean;
|
|
285
|
-
_globalMaxRetries: number;
|
|
286
|
-
_timeoutDuration: number;
|
|
287
|
-
constructor({ apiKey, url, shouldReconnect, globalMaxRetries, timeoutDuration, }: RunwareBaseType);
|
|
288
|
-
static initialize(props: RunwareBaseType): Promise<RunwareBase>;
|
|
289
|
-
protected isWebsocketReadyState: () => boolean;
|
|
290
|
-
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
291
|
-
lis: (v: any) => any;
|
|
292
|
-
groupKey?: string;
|
|
293
|
-
taskUUID: string;
|
|
294
|
-
}): {
|
|
295
|
-
destroy: () => void;
|
|
296
|
-
};
|
|
297
|
-
protected connect(): void;
|
|
298
|
-
protected send: (msg: Object) => void;
|
|
299
|
-
private destroy;
|
|
300
|
-
private uploadImage;
|
|
301
|
-
private listenToImages;
|
|
302
|
-
private globalListener;
|
|
303
|
-
requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, onPartialImages, includeCost, customTaskUUID, retry, }: IRequestImage): Promise<ITextToImage[] | undefined>;
|
|
304
|
-
controlNetPreProcess: ({ inputImage, preProcessorType, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, customTaskUUID, retry, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
305
|
-
requestImageToText: ({ inputImage, includeCost, customTaskUUID, retry, }: IRequestImageToText) => Promise<IImageToText>;
|
|
306
|
-
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, customTaskUUID, retry, }: IRemoveImageBackground) => Promise<IRemoveImage>;
|
|
307
|
-
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, customTaskUUID, retry, }: IUpscaleGan) => Promise<IImage>;
|
|
308
|
-
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, customTaskUUID, retry, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
309
|
-
modelUpload: (payload: TAddModel) => Promise<any>;
|
|
310
|
-
ensureConnection(): Promise<unknown>;
|
|
311
|
-
private getSimilarImages;
|
|
312
|
-
private getSingleMessage;
|
|
313
|
-
private handleIncompleteImages;
|
|
314
|
-
disconnect: () => Promise<void>;
|
|
315
|
-
private connected;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
declare class RunwareClient extends RunwareBase {
|
|
319
|
-
constructor(props: RunwareBaseType);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
declare class RunwareServer extends RunwareBase {
|
|
323
|
-
_instantiated: boolean;
|
|
324
|
-
_listeners: any[];
|
|
325
|
-
_reconnectingIntervalId: null | any;
|
|
326
|
-
_pingTimeout: any;
|
|
327
|
-
_pongListener: any;
|
|
328
|
-
constructor(props: RunwareBaseType);
|
|
329
|
-
protected connect(): Promise<void>;
|
|
330
|
-
protected send: (msg: Object) => void;
|
|
331
|
-
protected handleClose(): void;
|
|
332
|
-
protected resetConnection: () => void;
|
|
333
|
-
protected heartBeat(): void;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
declare let Runware: typeof RunwareClient | typeof RunwareServer;
|
|
337
|
-
|
|
338
|
-
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, ITextToImage, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareClient, RunwareServer, SdkType, TAddModel, UploadImageType };
|