From 5666a83b94e42b5218bf0015a63f1181fb10cc82 Mon Sep 17 00:00:00 2001 From: Max Shyn Date: Mon, 19 Feb 2024 02:47:57 +0600 Subject: [PATCH] Update package --- .eslintrc.cjs | 2 +- capsolver/README.md | 26 +++- capsolver/index.ts | 18 +-- capsolver/package-lock.json | 4 +- capsolver/package.json | 2 +- capsolver/project.json | 3 +- .../Classification/AwsWafClassification.ts | 15 +- .../FunCaptchaClassification.ts | 15 +- .../Classification/HCaptchaClassification.ts | 15 +- .../Classification/ImageToTextTask.ts | 21 ++- .../ReCaptchaV2Classification.ts | 15 +- .../lib/Requests/Token/AntiAkamaiBMPTask.ts | 15 +- .../lib/Requests/Token/AntiAkamaiPowTask.ts | 13 +- .../Requests/Token/AntiAkamaiSensorTask.ts | 13 +- .../lib/Requests/Token/AntiAkamaiWebTask.ts | 11 +- .../src/lib/Requests/Token/AntiAwsWafTask.ts | 27 +++- .../Requests/Token/AntiAwsWafTaskProxyLess.ts | 12 +- .../Token/AntiCloudflareChallengeTask.ts | 17 ++- .../Token/AntiCloudflareTurnstileTask.ts | 26 ++-- .../lib/Requests/Token/AntiCyberSiAraTask.ts | 19 ++- .../Token/AntiCyberSiAraTaskProxyLess.ts | 12 +- .../src/lib/Requests/Token/AntiImpervaTask.ts | 19 ++- .../Token/AntiImpervaTaskProxyLess.ts | 12 +- .../Token/{ => Base}/_AntiAwsWafBase.ts | 29 +++- .../Token/{ => Base}/_AntiCloudflareBase.ts | 27 +++- .../Token/{ => Base}/_AntiCyberSiAraBase.ts | 28 +++- .../Token/{ => Base}/_AntiImpervaBase.ts | 27 +++- .../Token/{ => Base}/_FunCaptchaBase.ts | 27 +++- .../Token/{ => Base}/_GeeTestTaskBase.ts | 27 +++- .../Token/{ => Base}/_GeeTestV3TaskBase.ts | 27 +++- .../Token/{ => Base}/_GeeTestV4TaskBase.ts | 27 +++- .../Token/{ => Base}/_HCaptchaTaskBase.ts | 33 +++-- .../Token/{ => Base}/_MtCaptchaTaskBase.ts | 27 +++- .../Token/{ => Base}/_RecaptchaV2TaskBase.ts | 36 +++-- .../Token/{ => Base}/_RecaptchaV3TaskBase.ts | 27 +++- .../lib/Requests/Token/DataDomeSliderTask.ts | 36 +++-- .../Requests/Token/FunCaptchaTaskProxyLess.ts | 17 ++- .../src/lib/Requests/Token/GeeTestTask.ts | 15 +- .../Requests/Token/GeeTestTaskProxyLess.ts | 8 +- .../src/lib/Requests/Token/GeeTestV3Task.ts | 18 ++- .../Requests/Token/GeeTestV3TaskProxyLess.ts | 16 ++- .../src/lib/Requests/Token/GeeTestV4Task.ts | 18 ++- .../Requests/Token/GeeTestV4TaskProxyLess.ts | 16 ++- .../src/lib/Requests/Token/HCaptchaTask.ts | 18 ++- .../Requests/Token/HCaptchaTaskProxyLess.ts | 11 +- .../src/lib/Requests/Token/MtCaptchaTask.ts | 18 ++- .../Requests/Token/MtCaptchaTaskProxyLess.ts | 11 +- .../Token/ReCaptchaV2EnterpriseTask.ts | 33 +++-- .../ReCaptchaV2EnterpriseTaskProxyLess.ts | 12 +- .../src/lib/Requests/Token/ReCaptchaV2Task.ts | 35 +++-- .../Token/ReCaptchaV2TaskProxyLess.ts | 26 ++-- .../Token/ReCaptchaV3EnterpriseTask.ts | 19 ++- .../ReCaptchaV3EnterpriseTaskProxyLess.ts | 12 +- .../Token/ReCaptchaV3M1TaskProxyLess.ts | 12 +- .../src/lib/Requests/Token/ReCaptchaV3Task.ts | 19 ++- .../Token/ReCaptchaV3TaskProxyLess.ts | 12 +- capsolver/src/lib/Requests/Token/index.ts | 4 +- .../src/lib/Requests/_BaseTaskRequest.ts | 14 +- capsolver/src/lib/Requests/index.ts | 55 ++------ .../AwsWafClassificationSolution.ts | 4 + .../FunCaptchaClassificationSolution.ts | 4 + .../HCaptchaClassificationSolution.ts | 5 +- .../Classification/ImageToTextSolution.ts | 4 + .../ReCaptchaV2ClassificationSolution.ts | 8 +- .../index.ts | 8 +- .../AwsWafClassificationSolution.ts | 5 - .../FunCaptchaClassificationSolution.ts | 5 - .../ImageToTextSolution.ts | 5 - .../Token/AntiAkamaiPowTaskSolution.ts | 3 + .../AntiAkamaiSensorTaskSolution.ts | 5 +- .../Token/AntiAkamaiWebTaskSolution.ts | 4 + .../Solution/Token/AntiAwsWafTaskSolution.ts | 3 + .../Token/AntiCloudflareTaskSolution.ts | 5 + .../Token/AntiCyberSiAraTaskSolution.ts | 1 + .../Solution/Token/AntiImpervaTaskSolution.ts | 1 + .../Token/DataDomeSliderTaskSolution.ts | 4 + .../Solution/Token/FunCaptchaTaskSolution.ts | 4 + .../Solution/Token/GeeTestV3TaskSolution.ts | 4 + .../GeeTestV4TaskSolution.ts | 6 +- .../HCaptchaTaskSolution.ts | 6 +- .../Solution/Token/MtCaptchaTaskSolution.ts | 3 + .../Solution/Token/ReCaptchaV2TaskSolution.ts | 5 + .../Solution/Token/ReCaptchaV3TaskSolution.ts | 5 + capsolver/src/lib/Solution/Token/index.ts | 33 +++++ .../AntiAkamaiPowTaskSolution.ts | 4 - .../AntiAkamaiWebTaskSolution.ts | 6 - .../TokenSolution/AntiAwsWafTaskSolution.ts | 5 - .../AntiCloudflareTaskSolution.ts | 7 - .../AntiCyberSiAraTaskSolution.ts | 3 - .../TokenSolution/AntiImpervaTaskSolution.ts | 3 - .../DataDomeSliderTaskSolution.ts | 6 - .../TokenSolution/FunCaptchaTaskSolution.ts | 6 - .../TokenSolution/GeeTestV3TaskSolution.ts | 6 - .../TokenSolution/MtCaptchaTaskSolution.ts | 5 - .../TokenSolution/ReCaptchaV2TaskSolution.ts | 7 - .../TokenSolution/ReCaptchaV3TaskSolution.ts | 7 - .../src/lib/Solution/TokenSolution/index.ts | 0 capsolver/src/lib/Solution/_BaseSolution.ts | 1 - capsolver/src/lib/Solution/index.ts | 2 + capsolver/src/lib/capsolver.ts | 133 ++++++++++-------- capsolver/src/lib/types.ts | 22 +-- .../Requests/Token/AntiAwsWafTask.spec.ts | 26 +++- .../Token/AntiCloudflareTaskChallenge.spec.ts | 14 +- .../Token/AntiCloudflareTaskTurnstile.spec.ts | 26 +++- .../Requests/Token/AntiCyberSiAraTask.spec.ts | 13 +- .../Requests/Token/AntiImpervaTask.spec.ts | 26 +++- .../Requests/Token/DataDomeSliderTask.spec.ts | 13 +- .../Token/FunCaptchaTaskProxyLess.spec.ts | 13 +- .../tests/Requests/Token/GeeTestTask.spec.ts | 26 +++- .../Requests/Token/GeeTestV3Task.spec.ts | 26 +++- .../Requests/Token/GeeTestV4Task.spec.ts | 26 +++- .../tests/Requests/Token/HCaptchaTask.spec.ts | 26 +++- .../Requests/Token/MtCaptchaTask.spec.ts | 13 +- .../Token/ReCaptchaV2EnterpriseTask.spec.ts | 27 +++- .../Requests/Token/ReCaptchaV2Task.spec.ts | 26 +++- .../Token/ReCaptchaV3EnterpriseTask.spec.ts | 26 +++- .../Requests/Token/ReCaptchaV3Task.spec.ts | 26 +++- capsolver/yarn.lock | 34 ----- tsconfig.base.json | 7 +- .../lib/Requests/Token/_GeeTestTaskBase.ts | 7 +- 120 files changed, 1219 insertions(+), 674 deletions(-) rename capsolver/src/lib/Requests/Token/{ => Base}/_AntiAwsWafBase.ts (72%) rename capsolver/src/lib/Requests/Token/{ => Base}/_AntiCloudflareBase.ts (51%) rename capsolver/src/lib/Requests/Token/{ => Base}/_AntiCyberSiAraBase.ts (61%) rename capsolver/src/lib/Requests/Token/{ => Base}/_AntiImpervaBase.ts (72%) rename capsolver/src/lib/Requests/Token/{ => Base}/_FunCaptchaBase.ts (75%) rename capsolver/src/lib/Requests/Token/{ => Base}/_GeeTestTaskBase.ts (73%) rename capsolver/src/lib/Requests/Token/{ => Base}/_GeeTestV3TaskBase.ts (71%) rename capsolver/src/lib/Requests/Token/{ => Base}/_GeeTestV4TaskBase.ts (70%) rename capsolver/src/lib/Requests/Token/{ => Base}/_HCaptchaTaskBase.ts (70%) rename capsolver/src/lib/Requests/Token/{ => Base}/_MtCaptchaTaskBase.ts (58%) rename capsolver/src/lib/Requests/Token/{ => Base}/_RecaptchaV2TaskBase.ts (75%) rename capsolver/src/lib/Requests/Token/{ => Base}/_RecaptchaV3TaskBase.ts (77%) create mode 100644 capsolver/src/lib/Solution/Classification/AwsWafClassificationSolution.ts create mode 100644 capsolver/src/lib/Solution/Classification/FunCaptchaClassificationSolution.ts rename capsolver/src/lib/Solution/{ClassificationSolution => Classification}/HCaptchaClassificationSolution.ts (65%) create mode 100644 capsolver/src/lib/Solution/Classification/ImageToTextSolution.ts rename capsolver/src/lib/Solution/{ClassificationSolution => Classification}/ReCaptchaV2ClassificationSolution.ts (76%) rename capsolver/src/lib/Solution/{ClassificationSolution => Classification}/index.ts (68%) delete mode 100644 capsolver/src/lib/Solution/ClassificationSolution/AwsWafClassificationSolution.ts delete mode 100644 capsolver/src/lib/Solution/ClassificationSolution/FunCaptchaClassificationSolution.ts delete mode 100644 capsolver/src/lib/Solution/ClassificationSolution/ImageToTextSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/AntiAkamaiPowTaskSolution.ts rename capsolver/src/lib/Solution/{TokenSolution => Token}/AntiAkamaiSensorTaskSolution.ts (62%) create mode 100644 capsolver/src/lib/Solution/Token/AntiAkamaiWebTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/AntiAwsWafTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/AntiCloudflareTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/AntiCyberSiAraTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/AntiImpervaTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/DataDomeSliderTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/FunCaptchaTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/GeeTestV3TaskSolution.ts rename capsolver/src/lib/Solution/{TokenSolution => Token}/GeeTestV4TaskSolution.ts (61%) rename capsolver/src/lib/Solution/{TokenSolution => Token}/HCaptchaTaskSolution.ts (58%) create mode 100644 capsolver/src/lib/Solution/Token/MtCaptchaTaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/ReCaptchaV2TaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/ReCaptchaV3TaskSolution.ts create mode 100644 capsolver/src/lib/Solution/Token/index.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiAkamaiPowTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiAkamaiWebTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiAwsWafTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiCloudflareTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiCyberSiAraTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/AntiImpervaTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/DataDomeSliderTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/FunCaptchaTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/GeeTestV3TaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/MtCaptchaTaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/ReCaptchaV2TaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/ReCaptchaV3TaskSolution.ts delete mode 100644 capsolver/src/lib/Solution/TokenSolution/index.ts delete mode 100644 capsolver/yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 0297a80..c0ddd0e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -193,7 +193,7 @@ module.exports = { "tailwindcss/classnames-order": "off", "template-curly-spacing": "error", - "@typescript-eslint/consistent-type-imports": "off", + "@typescript-eslint/consistent-type-imports": "error", "unused-imports/no-unused-imports": [ "warn", { args: "after-used", diff --git a/capsolver/README.md b/capsolver/README.md index 6bafecb..1b85734 100644 --- a/capsolver/README.md +++ b/capsolver/README.md @@ -16,7 +16,7 @@ yarn ### Usage ```javascript //import CapSolver client and desired task -import { CapSolver, ReCaptchaV3EnterpriseTask } from "@captcha-libs/capsolver"; +import { CapSolver, ReCaptchaV3EnterpriseTaskProxyLess } from "@captcha-libs/capsolver"; const capsolverClient = new CapSolver({ clientKey: "", @@ -25,8 +25,7 @@ const capsolverClient = new CapSolver({ }); // Pass captcha params to solve -const reCaptchaV3Request = new ReCaptchaV3EnterpriseTask({ - proxy: "http:ip:port:user:pass", +const reCaptchaV3Request = new ReCaptchaV3EnterpriseTaskProxyLess({ websiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", websiteURL: "https://www.google.com/recaptcha/api2/demo" }); @@ -57,7 +56,28 @@ const feedback = await capsolverClient.feedbackTask({ //to get balance const balance = await capsolverClient.getBalance() ``` +### [Usage with proxies](https://docs.capsolver.com/guide/api-how-to-use-proxy.html) +```javascript +const reCaptchaV3Request = new ReCaptchaV3EnterpriseTask({ + websiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", + websiteURL: "https://www.google.com/recaptcha/api2/demo", + + //------> You can send the proxy information with one of these proxy format, please read carefully + + //pass proxy connection string + proxy: "socks5:192.191.100.10:4780:user:pwd", + //or + proxy: "198.199.100.10:4780:user:pwd", + + //or use object format + proxyAddress: "198.199.100.10", + proxyType: "https", // socks5 | http | https + proxyLogin: "user", + proxyPassword: "pass", + proxyPort: 3949, +}); +``` ### Features * Supports all captcha types, solutions and methods from CapSolver docs (updated at Feb. 2024) * TypeScript-first design diff --git a/capsolver/index.ts b/capsolver/index.ts index fbfe591..3051368 100644 --- a/capsolver/index.ts +++ b/capsolver/index.ts @@ -1,22 +1,6 @@ -import { ReCaptchaV2TaskProxyLess } from "./src/lib/Requests"; import { CapSolver } from "./src/lib/capsolver"; export * from "./src/lib/Requests/Classification"; export * from "./src/lib/Requests/Token"; -export { CapSolver }; - -(async() => { - - const capsolver = new CapSolver({ clientKey: "CAP-207EF70B18643D1AE925CE66BB19294A" }); - - const req = new ReCaptchaV2TaskProxyLess({ - isInvisible: true, - websiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", - websiteURL: "https://www.google.com/recaptcha/api2/demo" - }); - - const solution = await capsolver.solve(req); - - console.log({ solution }); -})(); \ No newline at end of file +export { CapSolver }; \ No newline at end of file diff --git a/capsolver/package-lock.json b/capsolver/package-lock.json index 877f94e..08cc4d3 100644 --- a/capsolver/package-lock.json +++ b/capsolver/package-lock.json @@ -1,12 +1,12 @@ { "name": "@captcha-libs/capsolver", - "version": "1.1.4", + "version": "1.1.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@captcha-libs/capsolver", - "version": "1.1.4", + "version": "1.1.5", "license": "ISC", "dependencies": { "@captcha-libs/captcha-client": "latest", diff --git a/capsolver/package.json b/capsolver/package.json index 3cc1488..4a620ff 100644 --- a/capsolver/package.json +++ b/capsolver/package.json @@ -1,6 +1,6 @@ { "name": "@captcha-libs/capsolver", - "version": "1.1.4", + "version": "1.1.5", "keywords": [ "CapSolver", "Captcha recognition", diff --git a/capsolver/project.json b/capsolver/project.json index ff09402..a8ce7b6 100644 --- a/capsolver/project.json +++ b/capsolver/project.json @@ -6,7 +6,8 @@ "targets": { "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] + "outputs": ["{options.outputFile}"], + "options": {"fix": true} }, "test": { "executor": "@nx/jest:jest", diff --git a/capsolver/src/lib/Requests/Classification/AwsWafClassification.ts b/capsolver/src/lib/Requests/Classification/AwsWafClassification.ts index 2ec4899..87128a1 100644 --- a/capsolver/src/lib/Requests/Classification/AwsWafClassification.ts +++ b/capsolver/src/lib/Requests/Classification/AwsWafClassification.ts @@ -1,13 +1,12 @@ -import { - BaseTask, type BaseParams, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; -type AwsWafClassificationParams = Omit & { +interface AwsWafClassificationParams { images: Array; question: string; websiteKey?: string; websiteURL?: string; -}; +} /** * @classdesc AWS WAF Images Recognize @@ -16,7 +15,11 @@ type AwsWafClassificationParams = Omit & { * {@link https://docs.capsolver.com/guide/recognition/AwsWafClassification.html} */ export class AwsWafClassification extends BaseTask implements AwsWafClassificationParams, _IsTaskType { - readonly _isAwsWafClassification = true; + + /** + * @type {boolean} _isAwsWafClassification - Only used for correct method overloading intellisense + */ + readonly _isAwsWafClassification: _IsTaskType["_isAwsWafClassification"] = true; /** * Create AwsWafClassification diff --git a/capsolver/src/lib/Requests/Classification/FunCaptchaClassification.ts b/capsolver/src/lib/Requests/Classification/FunCaptchaClassification.ts index badc79c..31b8ef4 100644 --- a/capsolver/src/lib/Requests/Classification/FunCaptchaClassification.ts +++ b/capsolver/src/lib/Requests/Classification/FunCaptchaClassification.ts @@ -1,14 +1,13 @@ -import { - BaseTask, type BaseParams, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; -type FunCaptchaClassificationParams = Omit & { +interface FunCaptchaClassificationParams { images: string; module?: string; question: string; websiteKey?: string; websiteURL?: string; -}; +} /** * @classdesc FunCaptcha Images Recognize @@ -17,7 +16,11 @@ type FunCaptchaClassificationParams = Omit & { * {@link https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html} */ export class FunCaptchaClassification extends BaseTask implements FunCaptchaClassificationParams, _IsTaskType { - readonly _isFunCaptchaClassification = true; + + /** + * @type {boolean} _isFunCaptchaClassification - Only used for correct method overloading intellisense + */ + readonly _isFunCaptchaClassification: _IsTaskType["_isFunCaptchaClassification"] = true; /** * Create FunCaptchaClassification diff --git a/capsolver/src/lib/Requests/Classification/HCaptchaClassification.ts b/capsolver/src/lib/Requests/Classification/HCaptchaClassification.ts index 7385b22..5f23e18 100644 --- a/capsolver/src/lib/Requests/Classification/HCaptchaClassification.ts +++ b/capsolver/src/lib/Requests/Classification/HCaptchaClassification.ts @@ -1,13 +1,12 @@ -import { - BaseTask, type BaseParams, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; -type HCaptchaClassificationParams = Omit & { +interface HCaptchaClassificationParams { queries: Array; question: string; websiteKey?: string; websiteURL?: string; -}; +} /** * @classdesc HCaptcha Images Recognize @@ -16,7 +15,11 @@ type HCaptchaClassificationParams = Omit & { * {@link https://docs.capsolver.com/guide/recognition/HCaptchaClassification.html} */ export class HCaptchaClassification extends BaseTask implements HCaptchaClassificationParams, _IsTaskType { - readonly _isHCaptchaClassification = true; + + /** + * @type {boolean} _isHCaptchaClassification - Only used for correct method overloading intellisense + */ + readonly _isHCaptchaClassification: _IsTaskType["_isHCaptchaClassification"] = true; /** * Create HCaptchaClassification diff --git a/capsolver/src/lib/Requests/Classification/ImageToTextTask.ts b/capsolver/src/lib/Requests/Classification/ImageToTextTask.ts index 5422dd3..9533cf5 100644 --- a/capsolver/src/lib/Requests/Classification/ImageToTextTask.ts +++ b/capsolver/src/lib/Requests/Classification/ImageToTextTask.ts @@ -1,6 +1,5 @@ -import { - BaseTask, type BaseParams, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; const _ImageToTextModules = [ "amazon", @@ -20,15 +19,15 @@ const _ImageToTextModules = [ "webde-register" ] as const; -type ImageToTextModules =typeof _ImageToTextModules[number]; +type ImageToTextModules = typeof _ImageToTextModules[number]; -type ImageToTextParams = Omit & { +interface ImageToTextParams { body: string; isCaseSensitive?: boolean; module?: ImageToTextModules; score?: number; websiteURL?: string; -}; +} /** * @classdesc OCR ImageToText @@ -39,9 +38,9 @@ type ImageToTextParams = Omit & { export class ImageToTextTask extends BaseTask implements ImageToTextParams, _IsTaskType { /** - * @type {boolean} _isImageToTextTask - Only used for correct method overloading intellisense - */ - readonly _isImageToTextTask = true; + * @type {boolean} _isImageToTextTask - Only used for correct method overloading intellisense + */ + readonly _isImageToTextTask: _IsTaskType["_isImageToTextTask"] = true; /** * Create ImageToTextTask @@ -54,13 +53,13 @@ export class ImageToTextTask extends BaseTask implements ImageToTextParams, _IsT * @param {string} [params.websiteURL] - Page source url to improve accuracy */ constructor({ - body, isCaseSensitive, module, score, websiteURL + body, isCaseSensitive, module: _module, score, websiteURL }: ImageToTextParams) { super({ type: "ImageToTextTask" }); this.body = body; this.case = isCaseSensitive; this.score = score; - this.module = module; + this.module = _module; this.websiteURL = websiteURL; } diff --git a/capsolver/src/lib/Requests/Classification/ReCaptchaV2Classification.ts b/capsolver/src/lib/Requests/Classification/ReCaptchaV2Classification.ts index 30506b8..c1ef60f 100644 --- a/capsolver/src/lib/Requests/Classification/ReCaptchaV2Classification.ts +++ b/capsolver/src/lib/Requests/Classification/ReCaptchaV2Classification.ts @@ -1,13 +1,12 @@ -import { - BaseTask, type BaseParams, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; -type ReCaptchaClassificationParams = Omit & { +interface ReCaptchaClassificationParams { image: string; question: string; websiteKey?: string; websiteURL?: string; -}; +} /** * @classdesc ReCaptcha Images Recognize @@ -16,7 +15,11 @@ type ReCaptchaClassificationParams = Omit & { * {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html} */ export class ReCaptchaV2Classification extends BaseTask implements ReCaptchaClassificationParams, _IsTaskType { - readonly _isReCaptchaV2Classification = true; + + /** + * @type {boolean} _isReCaptchaV2Classification - Only used for correct method overloading intellisense + */ + readonly _isReCaptchaV2Classification: _IsTaskType["_isReCaptchaV2Classification"] = true; /** * Create ReCaptchaV2Classification diff --git a/capsolver/src/lib/Requests/Token/AntiAkamaiBMPTask.ts b/capsolver/src/lib/Requests/Token/AntiAkamaiBMPTask.ts index e9fd66a..a504369 100644 --- a/capsolver/src/lib/Requests/Token/AntiAkamaiBMPTask.ts +++ b/capsolver/src/lib/Requests/Token/AntiAkamaiBMPTask.ts @@ -1,8 +1,7 @@ -import { - BaseTask, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; -export type AntiAkamaiBMPTaskParams = { +export interface AntiAkamaiBMPTaskParams { count?: number; country?: string; deviceId?: string; @@ -11,7 +10,7 @@ export type AntiAkamaiBMPTaskParams = { packageName?: string; pow?: string; version?: string; -}; +} /** * @classdesc Class for AntiAkamaiBMPTask. This task type uses a separate endpoint for fetching /akamaibmp/invoke @@ -22,9 +21,9 @@ export type AntiAkamaiBMPTaskParams = { export class AntiAkamaiBMPTask extends BaseTask implements AntiAkamaiBMPTaskParams, _IsTaskType { /** - * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense - */ - readonly _isAntiAkamaiBMPTask = true; + * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense + */ + readonly _isAntiAkamaiBMPTask: _IsTaskType["_isAntiAkamaiBMPTask"] = true; /** * Create AntiAkamaiBMPTaskBase diff --git a/capsolver/src/lib/Requests/Token/AntiAkamaiPowTask.ts b/capsolver/src/lib/Requests/Token/AntiAkamaiPowTask.ts index cb1854a..bb7a149 100644 --- a/capsolver/src/lib/Requests/Token/AntiAkamaiPowTask.ts +++ b/capsolver/src/lib/Requests/Token/AntiAkamaiPowTask.ts @@ -1,7 +1,6 @@ -import { - BaseTask, _IsTaskType -} from "../_BaseTaskRequest"; -import { AntiAkamaiBMPTaskParams } from "./AntiAkamaiBMPTask"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; +import type { AntiAkamaiBMPTaskParams } from "./AntiAkamaiBMPTask"; type AntiAkamaiPowTaskParams = Required>; @@ -14,9 +13,9 @@ type AntiAkamaiPowTaskParams = Required & Required>; @@ -14,9 +13,9 @@ type AntiAkamaiSensorTaskParams = Omit & Require export class AntiAkamaiSensorTask extends BaseTask implements AntiAkamaiSensorTaskParams, _IsTaskType { /** - * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense - */ - readonly _isAntiAkamaiBMPTask = true; + * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense + */ + readonly _isAntiAkamaiBMPTask: _IsTaskType["_isAntiAkamaiBMPTask"] = true; /** * Create AntiAkamaiSensorTask diff --git a/capsolver/src/lib/Requests/Token/AntiAkamaiWebTask.ts b/capsolver/src/lib/Requests/Token/AntiAkamaiWebTask.ts index f245963..58e9e4b 100644 --- a/capsolver/src/lib/Requests/Token/AntiAkamaiWebTask.ts +++ b/capsolver/src/lib/Requests/Token/AntiAkamaiWebTask.ts @@ -1,6 +1,5 @@ -import { - BaseTask, _IsTaskType -} from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; +import { BaseTask } from "../_BaseTaskRequest"; type AntiAkamaiWebTaskParams ={ abck?: string; @@ -18,9 +17,9 @@ type AntiAkamaiWebTaskParams ={ export class AntiAkamaiWebTask extends BaseTask implements AntiAkamaiWebTaskParams, _IsTaskType { /** - * @type {boolean} _isAntiAkamaiWebTask - Only used for correct method overloading intellisense - */ - readonly _isAntiAkamaiWebTask = true; + * @type {boolean} _isAntiAkamaiWebTask - Only used for correct method overloading intellisense + */ + readonly _isAntiAkamaiWebTask: _IsTaskType["_isAntiAkamaiWebTask"] = true; /** * Create AntiAkamaiWebTaskBase diff --git a/capsolver/src/lib/Requests/Token/AntiAwsWafTask.ts b/capsolver/src/lib/Requests/Token/AntiAwsWafTask.ts index ef8dfe1..9e3d41a 100644 --- a/capsolver/src/lib/Requests/Token/AntiAwsWafTask.ts +++ b/capsolver/src/lib/Requests/Token/AntiAwsWafTask.ts @@ -2,10 +2,10 @@ import type { ProxyRequiredTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import type { AntiAwsWafTaskBaseParams } from "./_AntiAwsWafBase"; -import { AntiAwsWafTaskBase } from "./_AntiAwsWafBase"; +import type { AntiAwsWafTaskBaseParams } from "./Base/_AntiAwsWafBase"; +import { AntiAwsWafTaskBase } from "./Base/_AntiAwsWafBase"; -type AntiAwsWafTaskParams = ProxyRequiredTaskParams>; +type AntiAwsWafTaskParams = ProxyRequiredTaskParams; /** * @classdesc AntiAwsWafTask this task type require your own proxies. @@ -16,9 +16,9 @@ type AntiAwsWafTaskParams = ProxyRequiredTaskParams>; +type AntiAwsWafTaskProxyLessParams = ProxylessTaskParams; /** * @classdesc AntiAwsWafTaskProxyLess this task type don't require your own proxies. @@ -16,9 +16,9 @@ type AntiAwsWafTaskProxyLessParams = ProxylessTaskParams>; +type AntiCyberSiAraTaskParams = ProxyRequiredTaskParams; /** * @classdesc AntiCyberSiAraTask this task type require your own proxies. @@ -16,9 +16,9 @@ type AntiCyberSiAraTaskParams = ProxyRequiredTaskParams>; +type AntiCyberSiAraTaskProxyLessParams = ProxylessTaskParams; /** * @classdesc AntiCyberSiAraTaskProxyLess this task type don't require your own proxies. @@ -16,9 +16,9 @@ type AntiCyberSiAraTaskProxyLessParams = ProxylessTaskParams>; +type AntiImpervaTaskParams = ProxyRequiredTaskParams; /** * @classdesc AntiImpervaTask this task type require your own proxies. @@ -16,21 +16,26 @@ type AntiImpervaTaskParams = ProxyRequiredTaskParams>; +type AntiImpervaTaskProxyLessParams = ProxylessTaskParams; /** * @classdesc AntiImpervaTaskProxyLess this task type require your own proxies. @@ -16,9 +16,9 @@ type AntiImpervaTaskProxyLessParams = ProxylessTaskParams & { awsChallengeJS?: string; awsContext?: string; awsIv?: string; @@ -26,11 +29,17 @@ export abstract class AntiAwsWafTaskBase extends BaseTask implements AntiAwsWafT * @param {string=} [params.awsContext] - When the status code returned by the websiteURL page is 405, you need to pass in awsContext * @param {string=} [params.awsIv] - When the status code returned by the websiteURL page is 405, you need to pass in awsIv * @param {string=} [params.awsKey] - When the status code returned by the websiteURL page is 405, you need to pass in awsKey - * @param {string=} [params.proxy] - proxy * @param {string} [params.websiteURL] - The URL of the page that returns the captcha info + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {string} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType + */ constructor({ - awsChallengeJS, awsContext, awsIv, awsKey, proxy, websiteURL + awsChallengeJS, awsContext, awsIv, awsKey, proxy, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiAwsWafTaskBaseParams, type: TaskTypes) { super({ type }); this.awsChallengeJS = awsChallengeJS; @@ -39,7 +48,17 @@ export abstract class AntiAwsWafTaskBase extends BaseTask implements AntiAwsWafT this.awsKey = awsKey; this.websiteURL = websiteURL; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; /** * @type {string=} awsChallengeJS - When the status code returned by the websiteURL page is 202, you only need to pass in awsChallengeJs; diff --git a/capsolver/src/lib/Requests/Token/_AntiCloudflareBase.ts b/capsolver/src/lib/Requests/Token/Base/_AntiCloudflareBase.ts similarity index 51% rename from capsolver/src/lib/Requests/Token/_AntiCloudflareBase.ts rename to capsolver/src/lib/Requests/Token/Base/_AntiCloudflareBase.ts index 0c0f03c..6f4f6fa 100644 --- a/capsolver/src/lib/Requests/Token/_AntiCloudflareBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_AntiCloudflareBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type AntiCloudflareTaskBaseParams = { +export type AntiCloudflareTaskBaseParams = Partial & { proxy?: string; websiteURL: string; }; @@ -19,15 +21,25 @@ export abstract class AntiCloudflareTaskBase extends BaseTask implements AntiClo * Create AntiCloudflareTask * {@link https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html} * @param {object} params - AntiCloudflareTaskParams - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] - The address of the target page. + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteURL, proxy + websiteURL, proxy, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiCloudflareTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteURL = websiteURL; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -39,4 +51,9 @@ export abstract class AntiCloudflareTaskBase extends BaseTask implements AntiClo * @type {string} websiteURL - The address of the target page. */ websiteURL: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_AntiCyberSiAraBase.ts b/capsolver/src/lib/Requests/Token/Base/_AntiCyberSiAraBase.ts similarity index 61% rename from capsolver/src/lib/Requests/Token/_AntiCyberSiAraBase.ts rename to capsolver/src/lib/Requests/Token/Base/_AntiCyberSiAraBase.ts index d705f8d..01bfdaf 100644 --- a/capsolver/src/lib/Requests/Token/_AntiCyberSiAraBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_AntiCyberSiAraBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type AntiCyberSiAraTaskBaseParams = { +export type AntiCyberSiAraTaskBaseParams = Partial & { SlideMasterUrlId: string; proxy?: string; userAgent: string; @@ -23,16 +25,26 @@ export abstract class AntiCyberSiAraTaskBase extends BaseTask implements AntiCyb * @param {string} [params.SlideMasterUrlId] - you can get MasterUrlId param form api/CyberSiara/GetCyberSiara endpoint * @param {string} [params.userAgent] - browser userAgent,you need submit your userAgent * @param {string} [params.websiteURL] - the current website home page url - * @param {string=} [params.proxy] - proxy + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {string} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - proxy, SlideMasterUrlId, userAgent, websiteURL + proxy, SlideMasterUrlId, userAgent, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiCyberSiAraTaskBaseParams, type: TaskTypes) { super({ type }); this.SlideMasterUrlId = SlideMasterUrlId; this.userAgent = userAgent; this.websiteURL = websiteURL; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -54,5 +66,9 @@ export abstract class AntiCyberSiAraTaskBase extends BaseTask implements AntiCyb * @type {string} websiteURL - the current website home page url */ websiteURL: string; - + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_AntiImpervaBase.ts b/capsolver/src/lib/Requests/Token/Base/_AntiImpervaBase.ts similarity index 72% rename from capsolver/src/lib/Requests/Token/_AntiImpervaBase.ts rename to capsolver/src/lib/Requests/Token/Base/_AntiImpervaBase.ts index f5e6428..9c00c6c 100644 --- a/capsolver/src/lib/Requests/Token/_AntiImpervaBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_AntiImpervaBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type AntiImpervaTaskBaseParams = { +export type AntiImpervaTaskBaseParams = Partial & { proxy?: string; reese84?: boolean; reeseScriptUrl?: string; @@ -23,16 +25,21 @@ export abstract class AntiImpervaTaskBase extends BaseTask implements AntiImperv * Create AntiImpervaTaskBase * {@link https://docs.capsolver.com/guide/antibots/imperva.html} * @param {object} params - AntiImpervaTaskBaseParams - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteUrl] - The website url * @param {string} [params.userAgent] - browser userAgent * @param {boolean} [params.utmvc] - if type is AntiImpervaTask,you need submit it. Default: false * @param {boolean} [params.reese84=false] - if cookie contains incap_see_xxx,nlbi_xxx,visid_inap_xxx,mean is true. Default = false * @param {string} [params.reeseScriptUrl] - The URL typically has several dashes (-) and random words * @param {string} [params.reeseToken] - If your reeseToken has expired, you can send current reeseToken to obtain a new + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteUrl, userAgent, utmvc = false, reese84 = false, reeseScriptUrl, reeseToken, proxy + websiteUrl, userAgent, utmvc = false, reese84 = false, reeseScriptUrl, reeseToken, proxy, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiImpervaTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteUrl = websiteUrl; @@ -42,6 +49,11 @@ export abstract class AntiImpervaTaskBase extends BaseTask implements AntiImperv this.reeseScriptUrl = reeseScriptUrl; this.reeseToken = reeseToken; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -78,4 +90,9 @@ export abstract class AntiImpervaTaskBase extends BaseTask implements AntiImperv * @type {string=} reeseToken - If your reeseToken has expired, you can send current reeseToken to obtain a new reeseToken. */ reeseToken?: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_FunCaptchaBase.ts b/capsolver/src/lib/Requests/Token/Base/_FunCaptchaBase.ts similarity index 75% rename from capsolver/src/lib/Requests/Token/_FunCaptchaBase.ts rename to capsolver/src/lib/Requests/Token/Base/_FunCaptchaBase.ts index 6c836a3..578b2bf 100644 --- a/capsolver/src/lib/Requests/Token/_FunCaptchaBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_FunCaptchaBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type FunCaptchaTaskBaseParams = { +export type FunCaptchaTaskBaseParams = Partial & { data?: string; funcaptchaApiJSSubdomain?: string; proxy?: string; @@ -22,14 +24,19 @@ export abstract class FunCaptchaTaskBase extends BaseTask implements FunCaptchaT * Create FunCaptchaTask * {@link https://docs.capsolver.com/guide/captcha/FunCaptcha.html} * @param {object} params - FunCaptchaTaskParams - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] - Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [params.websitePublicKey] - The domain public key, rarely updated. (Ex: E8A75615-1CBA-5DFF-8031-D16BCF234E10) * @param {string} [param.funcaptchaApiJSSubdomain] - A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. * @param {string} [params.data] - Additional parameter that may be required by FunCaptcha implementation. Use this property to send "blob" value as a stringified array. See example how it may look like. {"\blob":"HERE_COMES_THE_blob_VALUE"} Learn how to get FunCaptcha blob data + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteURL, proxy, websitePublicKey, data, funcaptchaApiJSSubdomain + websiteURL, proxy, websitePublicKey, data, funcaptchaApiJSSubdomain, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: FunCaptchaTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteURL = websiteURL; @@ -37,6 +44,11 @@ export abstract class FunCaptchaTaskBase extends BaseTask implements FunCaptchaT this.websitePublicKey = websitePublicKey; this.data = data; this.funcaptchaApiJSSubdomain = funcaptchaApiJSSubdomain; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -63,4 +75,9 @@ export abstract class FunCaptchaTaskBase extends BaseTask implements FunCaptchaT * @type {string} websiteURL - Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) */ websiteURL: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_GeeTestTaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_GeeTestTaskBase.ts similarity index 73% rename from capsolver/src/lib/Requests/Token/_GeeTestTaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_GeeTestTaskBase.ts index af4466f..ef13808 100644 --- a/capsolver/src/lib/Requests/Token/_GeeTestTaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_GeeTestTaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type GeeTestTaskBaseParams = { +export type GeeTestTaskBaseParams = Partial &{ captchaId?: string; challenge?: string; geetestApiServerSubdomain?: string; @@ -25,15 +27,20 @@ export abstract class GeeTestTaskBase extends BaseTask implements GeeTestTaskBas * {@link https://docs.capsolver.com/guide/captcha/Geetest.html} * @param {object} params - GeeTestTaskParams * @param {string} [params.gt] - The domain gt field. - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] - Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [params.challenge] - If you need to solve Geetest V4 you must use this parameter, don't need if you need to solve GeetestV3 * @param {string} [param.geetestApiServerSubdomain] - Special api subdomain * @param {string} [params.captchaId] - If you need to solve Geetest V4 you must use this parameter, don't need if you need to solve GeetestV3 * @param {string} [params.userAgent] - Browser userAgent + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteURL, proxy, challenge, geetestApiServerSubdomain, gt, captchaId, userAgent + websiteURL, proxy, challenge, geetestApiServerSubdomain, gt, captchaId, userAgent, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: GeeTestTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteURL = websiteURL; @@ -43,6 +50,11 @@ export abstract class GeeTestTaskBase extends BaseTask implements GeeTestTaskBas this.gt = gt; this.captchaId = captchaId; this.userAgent = userAgent; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -79,4 +91,9 @@ export abstract class GeeTestTaskBase extends BaseTask implements GeeTestTaskBas * @type {string} userAgent - Browser userAgent */ userAgent?: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_GeeTestV3TaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_GeeTestV3TaskBase.ts similarity index 71% rename from capsolver/src/lib/Requests/Token/_GeeTestV3TaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_GeeTestV3TaskBase.ts index 9dddf4f..0908769 100644 --- a/capsolver/src/lib/Requests/Token/_GeeTestV3TaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_GeeTestV3TaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type GeeTestV3TaskBaseParams = { +export type GeeTestV3TaskBaseParams = Partial & { challenge: string; geetestApiServerSubdomain?: string; gt: string; @@ -25,13 +27,18 @@ export abstract class GeeTestV3TaskBase extends BaseTask implements GeeTestV3Tas * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.gt] - required. The domain gt field. * @param {string} [params.challenge] - required. If you need to solve Geetest V3 you must use this parameter - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [param.geetestApiServerSubdomain] - optional. Special api subdomain * @param {string} [param.userAgent] - Browser userAgent + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteURL, proxy, challenge, geetestApiServerSubdomain, gt, userAgent + websiteURL, proxy, challenge, geetestApiServerSubdomain, gt, userAgent, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: GeeTestV3TaskBaseParams, type: TaskTypes) { super({ type }); this.websiteURL = websiteURL; @@ -40,6 +47,11 @@ export abstract class GeeTestV3TaskBase extends BaseTask implements GeeTestV3Tas this.geetestApiServerSubdomain = geetestApiServerSubdomain; this.gt = gt; this.userAgent = userAgent; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -71,4 +83,9 @@ export abstract class GeeTestV3TaskBase extends BaseTask implements GeeTestV3Tas * @type {string} userAgent - Browser userAgent */ userAgent?: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_GeeTestV4TaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_GeeTestV4TaskBase.ts similarity index 70% rename from capsolver/src/lib/Requests/Token/_GeeTestV4TaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_GeeTestV4TaskBase.ts index 7b617ac..63f9bf3 100644 --- a/capsolver/src/lib/Requests/Token/_GeeTestV4TaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_GeeTestV4TaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type GeeTestV4TaskBaseParams = { +export type GeeTestV4TaskBaseParams = Partial & { captchaId: string; geetestApiServerSubdomain?: string; proxy?: string; @@ -24,13 +26,18 @@ export abstract class GeeTestV4TaskBase extends BaseTask implements GeeTestV4Tas * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.gt] - required. The domain gt field. * @param {string} [params.captchaId] - required. If you need to solve Geetest V4 you must use this parameter. - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [param.geetestApiServerSubdomain] - optional. Special api subdomain * @param {string} [param.userAgent] - Browser userAgent + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteURL, proxy, geetestApiServerSubdomain, userAgent, captchaId + websiteURL, proxy, geetestApiServerSubdomain, userAgent, captchaId, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: GeeTestV4TaskBaseParams, type: TaskTypes) { super({ type }); this.websiteURL = websiteURL; @@ -38,6 +45,11 @@ export abstract class GeeTestV4TaskBase extends BaseTask implements GeeTestV4Tas this.geetestApiServerSubdomain = geetestApiServerSubdomain; this.userAgent = userAgent; this.captchaId = captchaId; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -64,4 +76,9 @@ export abstract class GeeTestV4TaskBase extends BaseTask implements GeeTestV4Tas * @type {string} userAgent - Browser userAgent */ userAgent?: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_HCaptchaTaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_HCaptchaTaskBase.ts similarity index 70% rename from capsolver/src/lib/Requests/Token/_HCaptchaTaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_HCaptchaTaskBase.ts index b530fe0..75bbf17 100644 --- a/capsolver/src/lib/Requests/Token/_HCaptchaTaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_HCaptchaTaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type HCaptchaBaseTaskParams = { +export type HCaptchaTaskBaseParams = Partial & { enterprisePayload?: Record; isInvisible?: boolean; proxy?: string; @@ -16,22 +18,27 @@ export type HCaptchaBaseTaskParams = { * {@link https://docs.capsolver.com/guide/captcha/HCaptcha.html} * @extends {BaseTask} */ -export abstract class HCaptchaTaskBase extends BaseTask implements HCaptchaBaseTaskParams { +export abstract class HCaptchaTaskBase extends BaseTask implements HCaptchaTaskBaseParams { /** * Create HCaptchaTaskBase * {@link https://docs.capsolver.com/guide/captcha/HCaptcha.html} - * @param {Object} params - HCaptchaBaseTaskParams + * @param {Object} params - HCaptchaTaskBaseParams * @param {Object=} params.enterprisePayload - Enterprise Payload - * @param {string=} params.proxy - proxy * @param {string} params.websiteURL - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} params.websiteKey - The domain public key, rarely updated. (Ex: b989d9e8-0d14-41sda0-870f-97b5283ba67d) * @param {boolean=} params.isInvisible - if recaptcha don't have pageAction, reload request body content flag have "fi" * @param {string} [params.userAgent] - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser". + * @param {string=} params.proxy - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - isInvisible = false, websiteKey, websiteURL, proxy, enterprisePayload, userAgent - }: HCaptchaBaseTaskParams, type: TaskTypes) { + isInvisible = false, websiteKey, websiteURL, proxy, enterprisePayload, userAgent, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword + }: HCaptchaTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteKey = websiteKey; this.websiteURL = websiteURL; @@ -39,6 +46,11 @@ export abstract class HCaptchaTaskBase extends BaseTask implements HCaptchaBaseT this.isInvisible = isInvisible; this.enterprisePayload = enterprisePayload; this.userAgent = userAgent; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -70,4 +82,9 @@ export abstract class HCaptchaTaskBase extends BaseTask implements HCaptchaBaseT * @type {string} websiteURL - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) */ websiteURL: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_MtCaptchaTaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_MtCaptchaTaskBase.ts similarity index 58% rename from capsolver/src/lib/Requests/Token/_MtCaptchaTaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_MtCaptchaTaskBase.ts index fd645b3..8abc066 100644 --- a/capsolver/src/lib/Requests/Token/_MtCaptchaTaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_MtCaptchaTaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type MtCaptchaTaskBaseParams = { +export type MtCaptchaTaskBaseParams = Partial & { proxy?: string; websiteKey: string; websiteURL: string; @@ -19,17 +21,27 @@ export abstract class MtCaptchaTaskBase extends BaseTask implements MtCaptchaTas * Create MtCaptchaTaskBase * {@link https://docs.capsolver.com/guide/captcha/MtCaptcha.html} * @param {object} params - MtCaptchaTaskBaseParams - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] - The website url * @param {string} [params.websiteKey] - The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key) + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - websiteKey, websiteURL, proxy + websiteKey, websiteURL, proxy, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: MtCaptchaTaskBaseParams, type: TaskTypes) { super({ type }); this.websiteKey = websiteKey; this.websiteURL = websiteURL; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -46,4 +58,9 @@ export abstract class MtCaptchaTaskBase extends BaseTask implements MtCaptchaTas * @type {string} websiteURL - Web address of the website using hcaptcha, generally it's fixed value. (Ex: https://google.com) */ websiteURL: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_RecaptchaV2TaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_RecaptchaV2TaskBase.ts similarity index 75% rename from capsolver/src/lib/Requests/Token/_RecaptchaV2TaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_RecaptchaV2TaskBase.ts index cafbf66..cd4ad5d 100644 --- a/capsolver/src/lib/Requests/Token/_RecaptchaV2TaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_RecaptchaV2TaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type RecaptchaV2BaseTaskParams = { +export type RecaptchaV2TaskBaseParams = Partial & { apiDomain?: string; cookies?: Array>; enterprisePayload?: Record; @@ -19,35 +21,46 @@ export type RecaptchaV2BaseTaskParams = { * {@link https://docs.capsolver.com/guide/captcha/ReCaptchaV2.html} * @extends {BaseTask} */ -export abstract class RecaptchaV2TaskBase extends BaseTask implements RecaptchaV2BaseTaskParams { +export abstract class RecaptchaV2TaskBase extends BaseTask implements RecaptchaV2TaskBaseParams { /** * Create RecaptchaV2TaskBase * {@link https://docs.capsolver.com/guide/captcha/ReCaptchaV2.html} - * @param {Object} params - RecaptchaV2BaseTaskParams + * @param {Object} params - RecaptchaV2TaskBaseParams * @param {string} params.apiDomain - Domain address from which to load reCAPTCHA Enterprise. For example: http://www.google.com/, http://www.recaptcha.net/. Don't use a parameter if you don't know why it's needed. * @param {Object=} params.enterprisePayload - Enterprise Payload * @param {Object=} params.cookies - cookies - * @param {string=} params.proxy - proxy * @param {string} params.websiteURL - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} params.websiteKey - The domain public key, rarely updated. (Ex: b989d9e8-0d14-41sda0-870f-97b5283ba67d) * @param {string=} params.pageAction - some site in anchor endpoint have sa param ,it's action value * @param {boolean=} params.isInvisible - if recaptcha don't have pageAction, reload request body content flag have "fi" * @param {string} [params.userAgent] - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser". + * @param {string=} params.proxy - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - apiDomain, cookies, isInvisible = false, websiteKey, websiteURL, pageAction, proxy, enterprisePayload, userAgent - }: RecaptchaV2BaseTaskParams, type: TaskTypes) { + apiDomain, cookies, isInvisible = false, websiteKey, websiteURL, pageAction, enterprisePayload, userAgent, ...proxyObject + }: RecaptchaV2TaskBaseParams, type: TaskTypes) { super({ type }); this.apiDomain = apiDomain; this.cookies = cookies; this.websiteKey = websiteKey; this.websiteURL = websiteURL; this.pageAction = pageAction; - this.proxy = proxy; this.isInvisible = isInvisible; this.enterprisePayload = enterprisePayload; this.userAgent = userAgent; + + this.proxy = proxyObject.proxy; + this.proxyAddress = proxyObject.proxyAddress; + this.proxyLogin = proxyObject.proxyLogin; + this.proxyPort = proxyObject.proxyPort; + this.proxyType = proxyObject.proxyType; + this.proxyPassword = proxyObject.proxyPassword; } /** @@ -94,4 +107,9 @@ export abstract class RecaptchaV2TaskBase extends BaseTask implements RecaptchaV * @type {string} websiteURL - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) */ websiteURL: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/_RecaptchaV3TaskBase.ts b/capsolver/src/lib/Requests/Token/Base/_RecaptchaV3TaskBase.ts similarity index 77% rename from capsolver/src/lib/Requests/Token/_RecaptchaV3TaskBase.ts rename to capsolver/src/lib/Requests/Token/Base/_RecaptchaV3TaskBase.ts index 9d7fbab..3a9fbb4 100644 --- a/capsolver/src/lib/Requests/Token/_RecaptchaV3TaskBase.ts +++ b/capsolver/src/lib/Requests/Token/Base/_RecaptchaV3TaskBase.ts @@ -1,7 +1,9 @@ -import type { TaskTypes } from "../_BaseTaskRequest"; -import { BaseTask } from "../_BaseTaskRequest"; +import type { + ProxyCredentials, TaskTypes +} from "../../_BaseTaskRequest"; +import { BaseTask } from "../../_BaseTaskRequest"; -export type RecaptchaV3TaskBaseParams = { +export type RecaptchaV3TaskBaseParams = Partial & { anchor?: string; apiDomain?: string; cookies?: Array>; @@ -32,12 +34,17 @@ export abstract class RecaptchaV3TaskBase extends BaseTask implements RecaptchaV * @param {Object=} [params.cookies] - cookies * @param {string} [params.websiteURL] - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [params.websiteKey] - The domain public key, rarely updated. (Ex: b989d9e8-0d14-41sda0-870f-97b5283ba67d) - * @param {string=} [params.proxy] - proxy * @param {string=} [params.pageAction] - Widget action value. Website owner defines what user is doing on the page through this parameter. Default value: verify * @param {number=} [params.minScore] - Value from 0.1 to 0.9. + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {string} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - apiDomain, cookies, websiteKey, websiteURL, pageAction, proxy, minScore, enterprisePayload, userAgent + apiDomain, cookies, websiteKey, websiteURL, pageAction, proxy, minScore, enterprisePayload, userAgent, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: RecaptchaV3TaskBaseParams, type: TaskTypes) { super({ type }); this.apiDomain = apiDomain; @@ -49,6 +56,11 @@ export abstract class RecaptchaV3TaskBase extends BaseTask implements RecaptchaV this.minScore = minScore; this.enterprisePayload = enterprisePayload; this.userAgent = userAgent; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -95,5 +107,10 @@ export abstract class RecaptchaV3TaskBase extends BaseTask implements RecaptchaV * @type {number} minScore - description Value from 0.1 to 0.9. */ minScore?: number; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } diff --git a/capsolver/src/lib/Requests/Token/DataDomeSliderTask.ts b/capsolver/src/lib/Requests/Token/DataDomeSliderTask.ts index 9a877de..3134989 100644 --- a/capsolver/src/lib/Requests/Token/DataDomeSliderTask.ts +++ b/capsolver/src/lib/Requests/Token/DataDomeSliderTask.ts @@ -1,12 +1,15 @@ import type { - ProxyRequiredTaskParams, _IsTaskType + ProxyCredentials, ProxyRequiredTaskParams, _IsTaskType } from "../_BaseTaskRequest"; import { BaseTask } from "../_BaseTaskRequest"; -type DataDomeSliderTaskParams = Omit & ProxyRequiredTaskParams<{ +type _DataDomeSliderTaskParams = Partial & { captchaUrl: string; + proxy?: string; userAgent: string; -}>; +}; + +type DataDomeSliderTaskParams = ProxyRequiredTaskParams<_DataDomeSliderTaskParams>; /** * @classdesc DataDome: solving DataDome captcha @@ -14,12 +17,12 @@ type DataDomeSliderTaskParams = Omit & ProxyRequ * @extends {BaseTask} * {@link https://docs.capsolver.com/guide/antibots/datadome.html} */ -export class DataDomeSliderTask extends BaseTask implements DataDomeSliderTaskParams, _IsTaskType { +export class DataDomeSliderTask extends BaseTask implements _IsTaskType, _DataDomeSliderTaskParams { /** - * @type {boolean} _isDataDomeSliderTask - Only used for correct method overloading intellisense - */ - readonly _isDataDomeSliderTask = true; + * @type {boolean} _isDataDomeSliderTask - Only used for correct method overloading intellisense + */ + readonly _isDataDomeSliderTask: _IsTaskType["_isDataDomeSliderTask"] = true; /** * Create DataDome: solving DataDome captcha @@ -28,14 +31,24 @@ export class DataDomeSliderTask extends BaseTask implements DataDomeSliderTaskPa * @param {string} [params.captchaUrl] - If the url contains t=bv that means that your ip must be banned, t should be t=fe * @param {string} [params.userAgent] - You need to keep your userAgent consistent with the one used to request the captchaUrl. Currently, we only support two fixed userAgents. * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {string} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor({ - captchaUrl, userAgent, proxy + captchaUrl, userAgent, proxy, proxyType, proxyAddress, proxyLogin, proxyPassword, proxyPort }: DataDomeSliderTaskParams) { super({ type: "DataDomeSliderTask" }); this.captchaUrl = captchaUrl; this.userAgent = userAgent; this.proxy = proxy; + this.proxyAddress = proxyAddress; + this.proxyLogin = proxyLogin; + this.proxyPort = proxyPort; + this.proxyType = proxyType; + this.proxyPassword = proxyPassword; } /** @@ -51,5 +64,10 @@ export class DataDomeSliderTask extends BaseTask implements DataDomeSliderTaskPa /** * @type {string} proxy - proxy */ - proxy: string; + proxy?: string; + proxyAddress?: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort?: number; + proxyType?: ProxyCredentials["proxyType"]; } \ No newline at end of file diff --git a/capsolver/src/lib/Requests/Token/FunCaptchaTaskProxyLess.ts b/capsolver/src/lib/Requests/Token/FunCaptchaTaskProxyLess.ts index 0c95305..28a98ed 100644 --- a/capsolver/src/lib/Requests/Token/FunCaptchaTaskProxyLess.ts +++ b/capsolver/src/lib/Requests/Token/FunCaptchaTaskProxyLess.ts @@ -1,7 +1,7 @@ -import { _IsTaskType } from "../_BaseTaskRequest"; +import type { _IsTaskType } from "../_BaseTaskRequest"; import { FunCaptchaTaskBase, type FunCaptchaTaskBaseParams -} from "./_FunCaptchaBase"; +} from "./Base/_FunCaptchaBase"; export type FunCaptchaTaskProxyLessParams = Omit; @@ -16,19 +16,24 @@ export type FunCaptchaTaskProxyLessParams = Omit; @@ -18,21 +18,26 @@ import { export class GeeTestTask extends GeeTestTaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTask = true; + * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTask: _IsTaskType["_isGeeTestTask"] = true; /** * Create GeeTestTask this task type require your own proxies. * {@link https://docs.capsolver.com/guide/captcha/Geetest.html} * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.gt] - The domain gt field. - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] - Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [params.challenge] - If you need to solve Geetest V4 you must use this parameter, don't need if you need to solve GeetestV3 * @param {string} [param.geetestApiServerSubdomain] - A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. * @param {string} [params.data] - Additional parameter that may be required by FunCaptcha implementation. Use this property to send "blob" value as a stringified array. See example how it may look like. {"\blob":"HERE_COMES_THE_blob_VALUE"} Learn how to get FunCaptcha blob data * @param {string} [params.captchaId] - If you need to solve Geetest V4 you must use this parameter, don't need if you need to solve GeetestV3 + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor(params: GeeTestTaskParams) { super(params, "GeeTestTask"); diff --git a/capsolver/src/lib/Requests/Token/GeeTestTaskProxyLess.ts b/capsolver/src/lib/Requests/Token/GeeTestTaskProxyLess.ts index bd98f64..339fc77 100644 --- a/capsolver/src/lib/Requests/Token/GeeTestTaskProxyLess.ts +++ b/capsolver/src/lib/Requests/Token/GeeTestTaskProxyLess.ts @@ -3,7 +3,7 @@ import type { } from "../_BaseTaskRequest"; import { GeeTestTaskBase, type GeeTestTaskBaseParams -} from "./_GeeTestTaskBase"; +} from "./Base/_GeeTestTaskBase"; type GeeTestTaskProxyLessParams = ProxylessTaskParams; @@ -18,9 +18,9 @@ type GeeTestTaskProxyLessParams = ProxylessTaskParams; export class GeeTestTaskProxyLess extends GeeTestTaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTaskProxyLess = true; + * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTaskProxyLess: _IsTaskType["_isGeeTestTaskProxyLess"] = true; /** * Create GeeTestTaskProxyLess this task type require your own proxies. diff --git a/capsolver/src/lib/Requests/Token/GeeTestV3Task.ts b/capsolver/src/lib/Requests/Token/GeeTestV3Task.ts index a515f7f..5b7a743 100644 --- a/capsolver/src/lib/Requests/Token/GeeTestV3Task.ts +++ b/capsolver/src/lib/Requests/Token/GeeTestV3Task.ts @@ -1,9 +1,8 @@ import type { ProxyRequiredTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { - GeeTestV3TaskBase, GeeTestV3TaskBaseParams -} from "./_GeeTestV3TaskBase"; +import type { GeeTestV3TaskBaseParams } from "./Base/_GeeTestV3TaskBase"; +import { GeeTestV3TaskBase } from "./Base/_GeeTestV3TaskBase"; type GeeTestV3TaskParams = ProxyRequiredTaskParams; @@ -18,9 +17,9 @@ type GeeTestV3TaskParams = ProxyRequiredTaskParams; export class GeeTestV3Task extends GeeTestV3TaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTask = true; + * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTask: _IsTaskType["_isGeeTestTask"] = true; /** * Create GeeTestTask V3, this task type require your own proxies. @@ -28,10 +27,15 @@ export class GeeTestV3Task extends GeeTestV3TaskBase implements _IsTaskType { * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.gt] - required. The domain gt field. * @param {string} [params.challenge] - required. If you need to solve Geetest V3 you must use this parameter - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [param.geetestApiServerSubdomain] - optional. Special api subdomain * @param {string} [param.userAgent] - Browser userAgent + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor(params: GeeTestV3TaskParams) { super(params, "GeeTestTask"); diff --git a/capsolver/src/lib/Requests/Token/GeeTestV3TaskProxyLess.ts b/capsolver/src/lib/Requests/Token/GeeTestV3TaskProxyLess.ts index 8132857..ff1e642 100644 --- a/capsolver/src/lib/Requests/Token/GeeTestV3TaskProxyLess.ts +++ b/capsolver/src/lib/Requests/Token/GeeTestV3TaskProxyLess.ts @@ -1,9 +1,8 @@ import type { ProxylessTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { - GeeTestV3TaskBase, GeeTestV3TaskBaseParams -} from "./_GeeTestV3TaskBase"; +import type { GeeTestV3TaskBaseParams } from "./Base/_GeeTestV3TaskBase"; +import { GeeTestV3TaskBase } from "./Base/_GeeTestV3TaskBase"; type GeeTestV3TaskProxyLessParams = ProxylessTaskParams; @@ -18,9 +17,9 @@ type GeeTestV3TaskProxyLessParams = ProxylessTaskParams export class GeeTestV3TaskProxyLess extends GeeTestV3TaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTaskProxyLess = true; + * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTaskProxyLess: _IsTaskType["_isGeeTestTaskProxyLess"] = true; /** * @classdesc GeeTestTask V3 this using the server's built-in proxy @@ -28,6 +27,11 @@ export class GeeTestV3TaskProxyLess extends GeeTestV3TaskBase implements _IsTask * @param { * @param {string} [params.gt] - required. The domain gt field. * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com)} params - GeeTestTaskBaseParams * @param {string} [param.geetestApiServerSubdomain] - optional. Special api subdomain */ diff --git a/capsolver/src/lib/Requests/Token/GeeTestV4Task.ts b/capsolver/src/lib/Requests/Token/GeeTestV4Task.ts index 5c4aa29..7c340b0 100644 --- a/capsolver/src/lib/Requests/Token/GeeTestV4Task.ts +++ b/capsolver/src/lib/Requests/Token/GeeTestV4Task.ts @@ -1,9 +1,8 @@ import type { ProxyRequiredTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { - GeeTestV4TaskBase, GeeTestV4TaskBaseParams -} from "./_GeeTestV4TaskBase"; +import type { GeeTestV4TaskBaseParams } from "./Base/_GeeTestV4TaskBase"; +import { GeeTestV4TaskBase } from "./Base/_GeeTestV4TaskBase"; type GeeTestV4TaskParams = ProxyRequiredTaskParams; @@ -18,18 +17,23 @@ type GeeTestV4TaskParams = ProxyRequiredTaskParams; export class GeeTestV4Task extends GeeTestV4TaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTask = true; + * @type {boolean} _isGeeTestTask - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTask: _IsTaskType["_isGeeTestTask"] = true; /** * @classdesc GeeTestTask V4 this task type require your own proxies. * {@link https://docs.capsolver.com/guide/captcha/Geetest.html} * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.captchaId] - required. captchaId - * @param {string} [params.proxy] - proxy * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [param.geetestApiServerSubdomain] - optional. A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. + * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType */ constructor(params: GeeTestV4TaskParams) { super(params, "GeeTestTask"); diff --git a/capsolver/src/lib/Requests/Token/GeeTestV4TaskProxyLess.ts b/capsolver/src/lib/Requests/Token/GeeTestV4TaskProxyLess.ts index df6283b..eb05c85 100644 --- a/capsolver/src/lib/Requests/Token/GeeTestV4TaskProxyLess.ts +++ b/capsolver/src/lib/Requests/Token/GeeTestV4TaskProxyLess.ts @@ -1,9 +1,8 @@ import type { ProxylessTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { - GeeTestV4TaskBase, GeeTestV4TaskBaseParams -} from "./_GeeTestV4TaskBase"; +import type { GeeTestV4TaskBaseParams } from "./Base/_GeeTestV4TaskBase"; +import { GeeTestV4TaskBase } from "./Base/_GeeTestV4TaskBase"; type GeeTestV4TaskProxyLessParams = ProxylessTaskParams; @@ -18,9 +17,9 @@ type GeeTestV4TaskProxyLessParams = ProxylessTaskParams export class GeeTestV4TaskProxyLess extends GeeTestV4TaskBase implements _IsTaskType { /** - * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense - */ - readonly _isGeeTestTaskProxyLess = true; + * @type {boolean} _isGeeTestTaskProxyLess - Only used for correct method overloading intellisense + */ + readonly _isGeeTestTaskProxyLess: _IsTaskType["_isGeeTestTaskProxyLess"] = true; /** * @classdesc GeeTestTask V4 this task type require your own proxies. @@ -28,6 +27,11 @@ export class GeeTestV4TaskProxyLess extends GeeTestV4TaskBase implements _IsTask * @param {object} params - GeeTestTaskBaseParams * @param {string} [params.captchaId] - required. captchaId * @param {string} [params.proxy] - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType * @param {string} [params.websiteURL] -required. Web address of the website using funcaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} [param.geetestApiServerSubdomain] - optional. A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. */ diff --git a/capsolver/src/lib/Requests/Token/HCaptchaTask.ts b/capsolver/src/lib/Requests/Token/HCaptchaTask.ts index 0c98aa2..476b88c 100644 --- a/capsolver/src/lib/Requests/Token/HCaptchaTask.ts +++ b/capsolver/src/lib/Requests/Token/HCaptchaTask.ts @@ -2,23 +2,24 @@ import type { ProxyRequiredTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { HCaptchaTaskBase } from "./_HCaptchaTaskBase"; +import type { HCaptchaTaskBaseParams } from "./Base/_HCaptchaTaskBase"; +import { HCaptchaTaskBase } from "./Base/_HCaptchaTaskBase"; -type HCaptchaTaskParams = ProxyRequiredTaskParams>; +type HCaptchaTaskParams = ProxyRequiredTaskParams; /** * @classdesc HCaptchaTask this task type require your own proxies * @class * {@link https://docs.capsolver.com/guide/captcha/HCaptcha.html} * @extends {BaseTask} - * @implements {HCaptchaBaseTaskParams} + * @implements {HCaptchaTaskBaseParams} */ export class HCaptchaTask extends HCaptchaTaskBase implements _IsTaskType { /** - * @type {boolean} _isHCaptchaTask - Only used for correct method overloading intellisense - */ - readonly _isHCaptchaTask = true; + * @type {boolean} _isHCaptchaTask - Only used for correct method overloading intellisense + */ + readonly _isHCaptchaTask: _IsTaskType["_isHCaptchaTask"] = true; /** * Create HCaptchaTask this task type require your own proxies @@ -26,6 +27,11 @@ export class HCaptchaTask extends HCaptchaTaskBase implements _IsTaskType { * @param {Object} params - HCaptchaTaskParams * @param {Object=} params.enterprisePayload - Enterprise Payload * @param {string=} params.proxy - proxy + * @param {string} [params.proxyAddress] - proxyAddress + * @param {string} [params.proxyLogin] - proxyLogin + * @param {string} [params.proxyPassword] - proxyPassword + * @param {number} [params.proxyPort] - proxyPort + * @param {string} [params.proxyType] - proxyType * @param {string} params.websiteURL - Web address of the website using recaptcha, generally it's fixed value. (Ex: https://google.com) * @param {string} params.websiteKey - The domain public key, rarely updated. (Ex: b989d9e8-0d14-41sda0-870f-97b5283ba67d) * @param {boolean=} params.isInvisible - if recaptcha don't have pageAction, reload request body content flag have "fi" diff --git a/capsolver/src/lib/Requests/Token/HCaptchaTaskProxyLess.ts b/capsolver/src/lib/Requests/Token/HCaptchaTaskProxyLess.ts index 2fc4ddb..b1c563e 100644 --- a/capsolver/src/lib/Requests/Token/HCaptchaTaskProxyLess.ts +++ b/capsolver/src/lib/Requests/Token/HCaptchaTaskProxyLess.ts @@ -2,9 +2,10 @@ import type { ProxylessTaskParams, _IsTaskType } from "../_BaseTaskRequest"; -import { HCaptchaTaskBase } from "./_HCaptchaTaskBase"; +import type { HCaptchaTaskBaseParams } from "./Base/_HCaptchaTaskBase"; +import { HCaptchaTaskBase } from "./Base/_HCaptchaTaskBase"; -type HCaptchaTaskProxyLessParams = ProxylessTaskParams>; +type HCaptchaTaskProxyLessParams = ProxylessTaskParams; /** * @classdesc HCaptchaTaskProxyLess this task type require your own proxies @@ -16,9 +17,9 @@ type HCaptchaTaskProxyLessParams = ProxylessTaskParams>; +type MtCaptchaTaskParams = ProxyRequiredTaskParams; /** * @classdesc MtCaptchaTask this task type require your own proxies @@ -14,17 +15,22 @@ type MtCaptchaTaskParams = ProxyRequiredTaskParams>; +type MtCaptchaTaskProxyLessParams = ProxylessTaskParams; /** * @classdesc MtCaptchaTaskProxyLess is using the server's built-in proxy. @@ -14,9 +15,9 @@ type MtCaptchaTaskProxyLessParams = ProxylessTaskParams>; +type ReCaptchaV2EnterpriseTaskParams = ProxyRequiredTaskParams; /** * ReCaptchaV2EnterpriseTask this task type require your own proxies @@ -13,23 +13,28 @@ type ReCaptchaV2EnterpriseTaskParams = ProxyRequiredTaskParams>; +type ReCaptchaV2EnterpriseTaskProxyLessParams = ProxylessTaskParams; /** * ReCaptchaV2EnterpriseTaskProxyLess is using the server's built-in proxy. @@ -13,9 +13,9 @@ type ReCaptchaV2EnterpriseTaskProxyLessParams = ProxylessTaskParams>; +type RecaptchaV2TaskParams = ProxyRequiredTaskParams; /** * @classdesc ReCaptchaV2Task this task type require your own proxies. @@ -16,23 +16,28 @@ type RecaptchaV2TaskParams = ProxyRequiredTaskParams>; +type RecaptchaV2TaskProxylessParams = ProxylessTaskParams; /** * @classdesc ReCaptchaV2TaskProxyLess is using the server's built-in proxy. @@ -15,21 +15,21 @@ type RecaptchaV2TaskProxylessParams = ProxylessTaskParams>; +type ReCaptchaV3EnterpriseTaskParams = ProxyRequiredTaskParams; /** * ReCaptchaV3EnterpriseTask this task type require your own proxies. @@ -13,9 +13,9 @@ type ReCaptchaV3EnterpriseTaskParams = ProxyRequiredTaskParams>; +type ReCaptchaV3EnterpriseTaskProxyLessParams =ProxylessTaskParams; /** * @classdesc ReCaptchaV3EnterpriseTaskProxyLess is using the server's built-in proxy. @@ -15,9 +15,9 @@ type ReCaptchaV3EnterpriseTaskProxyLessParams =ProxylessTaskParams>; +type ReCaptchaV3M1TaskProxyLessParams = ProxylessTaskParams; /** * @classdesc ReCaptchaV3M1TaskProxyLess built-in with high-quality proxies, the score can remain stable at 0.7 or above. @@ -15,9 +15,9 @@ type ReCaptchaV3M1TaskProxyLessParams = ProxylessTaskParams>; +type ReCaptchaV3TaskParams = ProxyRequiredTaskParams; /** * @classdesc ReCaptchaV3Task this task type require your own proxies. @@ -15,9 +15,9 @@ type ReCaptchaV3TaskParams = ProxyRequiredTaskParams>; +type ReCaptchaV3TaskProxyLessParams =ProxylessTaskParams; /** * @classdesc ReCaptchaV3TaskProxyLess is using the server's built-in proxy. @@ -15,9 +15,9 @@ type ReCaptchaV3TaskProxyLessParams =ProxylessTaskParams = Omit; +type ProxyTypes = "http" | "https" | "socks5"; -export type ProxyRequiredTaskParams = T & { proxy: string }; +export interface ProxyCredentials { + proxyAddress: string; + proxyLogin?: string; + proxyPassword?: string; + proxyPort: number; + proxyType: ProxyTypes; +} + +export type ProxylessTaskParams = Omit; + +export type ProxyRequiredTaskParams = ProxyCredentials & T & { proxy?: never } | T & { [PC in keyof ProxyCredentials]?: never } & { proxy: string }; /** * @type {_IsTaskType} _IsTaskType - Only used for correct method overloading intellisense diff --git a/capsolver/src/lib/Requests/index.ts b/capsolver/src/lib/Requests/index.ts index e6bddaf..03a3146 100644 --- a/capsolver/src/lib/Requests/index.ts +++ b/capsolver/src/lib/Requests/index.ts @@ -1,45 +1,16 @@ -import type { AwsWafClassification } from "./Classification/AwsWafClassification"; -import type { FunCaptchaClassification } from "./Classification/FunCaptchaClassification"; -import type { HCaptchaClassification } from "./Classification/HCaptchaClassification"; -import type { ImageToTextTask } from "./Classification/ImageToTextTask"; -import type { ReCaptchaV2Classification } from "./Classification/ReCaptchaV2Classification"; -import { AntiAkamaiBMPTask } from "./Token/AntiAkamaiBMPTask"; -import type { AntiAkamaiPowTask } from "./Token/AntiAkamaiPowTask"; -import type { AntiAkamaiSensorTask } from "./Token/AntiAkamaiSensorTask"; -import type { AntiAkamaiWebTask } from "./Token/AntiAkamaiWebTask"; -import type { AntiAwsWafTask } from "./Token/AntiAwsWafTask"; -import type { AntiAwsWafTaskProxyLess } from "./Token/AntiAwsWafTaskProxyLess"; -import type { AntiCloudflareChallengeTask } from "./Token/AntiCloudflareChallengeTask"; -import type { AntiCloudflareTurnstileTask } from "./Token/AntiCloudflareTurnstileTask"; -import type { AntiCyberSiAraTask } from "./Token/AntiCyberSiAraTask"; -import type { AntiCyberSiAraTaskProxyLess } from "./Token/AntiCyberSiAraTaskProxyLess"; -import type { AntiImpervaTask } from "./Token/AntiImpervaTask"; -import type { AntiImpervaTaskProxyLess } from "./Token/AntiImpervaTaskProxyLess"; -import type { DataDomeSliderTask } from "./Token/DataDomeSliderTask"; -import type { FunCaptchaTaskProxyLess } from "./Token/FunCaptchaTaskProxyLess"; -import { GeeTestTask } from "./Token/GeeTestTask"; -import { GeeTestTaskProxyLess } from "./Token/GeeTestTaskProxyLess"; -import type { GeeTestV3Task } from "./Token/GeeTestV3Task"; -import type { GeeTestV3TaskProxyLess } from "./Token/GeeTestV3TaskProxyLess"; -import type { GeeTestV4Task } from "./Token/GeeTestV4Task"; -import type { GeeTestV4TaskProxyLess } from "./Token/GeeTestV4TaskProxyLess"; -import type { HCaptchaTask } from "./Token/HCaptchaTask"; -import type { HCaptchaTaskProxyLess } from "./Token/HCaptchaTaskProxyLess"; -import type { MtCaptchaTask } from "./Token/MtCaptchaTask"; -import type { MtCaptchaTaskProxyLess } from "./Token/MtCaptchaTaskProxyLess"; -import type { ReCaptchaV2EnterpriseTask } from "./Token/ReCaptchaV2EnterpriseTask"; -import type { ReCaptchaV2EnterpriseTaskProxyLess } from "./Token/ReCaptchaV2EnterpriseTaskProxyLess"; -import type { ReCaptchaV2Task } from "./Token/ReCaptchaV2Task"; -import type { ReCaptchaV2TaskProxyLess } from "./Token/ReCaptchaV2TaskProxyLess"; -import type { ReCaptchaV3EnterpriseTask } from "./Token/ReCaptchaV3EnterpriseTask"; -import type { ReCaptchaV3EnterpriseTaskProxyLess } from "./Token/ReCaptchaV3EnterpriseTaskProxyLess"; -import type { ReCaptchaV3M1TaskProxyLess } from "./Token/ReCaptchaV3M1TaskProxyLess"; -import type { ReCaptchaV3Task } from "./Token/ReCaptchaV3Task"; -import type { ReCaptchaV3TaskProxyLess } from "./Token/ReCaptchaV3TaskProxyLess"; -import type { BaseTask } from "./_BaseTaskRequest"; +import type { + AwsWafClassification, + FunCaptchaClassification, + HCaptchaClassification, + ImageToTextTask, + ReCaptchaV2Classification +} from "./Classification"; +import type { + AntiAkamaiPowTask, AntiAkamaiBMPTask, AntiAkamaiSensorTask, AntiAkamaiWebTask, AntiAwsWafTask, AntiAwsWafTaskProxyLess, AntiCloudflareChallengeTask, AntiCloudflareTurnstileTask, AntiCyberSiAraTask, AntiCyberSiAraTaskProxyLess, AntiImpervaTask, AntiImpervaTaskProxyLess, DataDomeSliderTask, FunCaptchaTaskProxyLess, GeeTestTask, GeeTestTaskProxyLess, GeeTestV3Task, GeeTestV3TaskProxyLess, GeeTestV4Task, GeeTestV4TaskProxyLess, HCaptchaTask, HCaptchaTaskProxyLess, MtCaptchaTask, MtCaptchaTaskProxyLess, ReCaptchaV2EnterpriseTask, ReCaptchaV2EnterpriseTaskProxyLess, ReCaptchaV2Task, ReCaptchaV2TaskProxyLess, ReCaptchaV3EnterpriseTask, ReCaptchaV3EnterpriseTaskProxyLess, ReCaptchaV3M1TaskProxyLess, ReCaptchaV3Task, ReCaptchaV3TaskProxyLess +} from "./Token"; -export type Requests = AntiAkamaiBMPTask | AntiAkamaiPowTask | AntiAkamaiSensorTask | AntiAkamaiWebTask | AntiAwsWafTask | AntiAwsWafTaskProxyLess | AntiCloudflareChallengeTask | AntiCloudflareTurnstileTask | AntiCyberSiAraTask | AntiCyberSiAraTaskProxyLess | AntiImpervaTask | AntiImpervaTaskProxyLess | AwsWafClassification | BaseTask | DataDomeSliderTask | FunCaptchaClassification | FunCaptchaTaskProxyLess | GeeTestTask | GeeTestTaskProxyLess | GeeTestV3Task | GeeTestV3TaskProxyLess | GeeTestV4Task | GeeTestV4TaskProxyLess | HCaptchaClassification | HCaptchaTask | HCaptchaTaskProxyLess | ImageToTextTask | MtCaptchaTask | MtCaptchaTaskProxyLess | ReCaptchaV2Classification | ReCaptchaV2EnterpriseTask | ReCaptchaV2EnterpriseTaskProxyLess | ReCaptchaV2Task | ReCaptchaV2TaskProxyLess | ReCaptchaV3EnterpriseTask | ReCaptchaV3EnterpriseTaskProxyLess | ReCaptchaV3M1TaskProxyLess | ReCaptchaV3Task | ReCaptchaV3TaskProxyLess; +export type Requests = AntiAkamaiBMPTask | AntiAkamaiPowTask | AntiAkamaiSensorTask | AntiAkamaiWebTask | AntiAwsWafTask | AntiAwsWafTaskProxyLess | AntiCloudflareChallengeTask | AntiCloudflareTurnstileTask | AntiCyberSiAraTask | AntiCyberSiAraTaskProxyLess | AntiImpervaTask | AntiImpervaTaskProxyLess | AwsWafClassification | DataDomeSliderTask | FunCaptchaClassification | FunCaptchaTaskProxyLess | GeeTestTask | GeeTestTaskProxyLess | GeeTestV3Task | GeeTestV3TaskProxyLess | GeeTestV4Task | GeeTestV4TaskProxyLess | HCaptchaClassification | HCaptchaTask | HCaptchaTaskProxyLess | ImageToTextTask | MtCaptchaTask | MtCaptchaTaskProxyLess | ReCaptchaV2Classification | ReCaptchaV2EnterpriseTask | ReCaptchaV2EnterpriseTaskProxyLess | ReCaptchaV2Task | ReCaptchaV2TaskProxyLess | ReCaptchaV3EnterpriseTask | ReCaptchaV3EnterpriseTaskProxyLess | ReCaptchaV3M1TaskProxyLess | ReCaptchaV3Task | ReCaptchaV3TaskProxyLess; -export * from "./Classification/index"; +export * from "./Classification"; -export * from "./Token/index"; \ No newline at end of file +export * from "./Token"; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Classification/AwsWafClassificationSolution.ts b/capsolver/src/lib/Solution/Classification/AwsWafClassificationSolution.ts new file mode 100644 index 0000000..7cacf01 --- /dev/null +++ b/capsolver/src/lib/Solution/Classification/AwsWafClassificationSolution.ts @@ -0,0 +1,4 @@ +export interface AwsWafClassificationSolution { + box: number[]; + distance: number; +} diff --git a/capsolver/src/lib/Solution/Classification/FunCaptchaClassificationSolution.ts b/capsolver/src/lib/Solution/Classification/FunCaptchaClassificationSolution.ts new file mode 100644 index 0000000..9cdb2c7 --- /dev/null +++ b/capsolver/src/lib/Solution/Classification/FunCaptchaClassificationSolution.ts @@ -0,0 +1,4 @@ +export interface FunCaptchaClassificationSolution { + objects: Array; +} + diff --git a/capsolver/src/lib/Solution/ClassificationSolution/HCaptchaClassificationSolution.ts b/capsolver/src/lib/Solution/Classification/HCaptchaClassificationSolution.ts similarity index 65% rename from capsolver/src/lib/Solution/ClassificationSolution/HCaptchaClassificationSolution.ts rename to capsolver/src/lib/Solution/Classification/HCaptchaClassificationSolution.ts index ec29e74..7efb810 100644 --- a/capsolver/src/lib/Solution/ClassificationSolution/HCaptchaClassificationSolution.ts +++ b/capsolver/src/lib/Solution/Classification/HCaptchaClassificationSolution.ts @@ -1,7 +1,6 @@ - -export type HCaptchaClassificationSolution = { +export interface HCaptchaClassificationSolution { box: Array; imageSize: Array; objects: Array; tags: Array; -}; +} diff --git a/capsolver/src/lib/Solution/Classification/ImageToTextSolution.ts b/capsolver/src/lib/Solution/Classification/ImageToTextSolution.ts new file mode 100644 index 0000000..1bb0de0 --- /dev/null +++ b/capsolver/src/lib/Solution/Classification/ImageToTextSolution.ts @@ -0,0 +1,4 @@ +export interface ImageToTextSolution { + text: string; +} + diff --git a/capsolver/src/lib/Solution/ClassificationSolution/ReCaptchaV2ClassificationSolution.ts b/capsolver/src/lib/Solution/Classification/ReCaptchaV2ClassificationSolution.ts similarity index 76% rename from capsolver/src/lib/Solution/ClassificationSolution/ReCaptchaV2ClassificationSolution.ts rename to capsolver/src/lib/Solution/Classification/ReCaptchaV2ClassificationSolution.ts index e74139b..a776af4 100644 --- a/capsolver/src/lib/Solution/ClassificationSolution/ReCaptchaV2ClassificationSolution.ts +++ b/capsolver/src/lib/Solution/Classification/ReCaptchaV2ClassificationSolution.ts @@ -1,14 +1,14 @@ -type MultiSolution = { +interface MultiSolution { objects: number[]; size: number; type: string; -}; +} -type SingleSolution = { +interface SingleSolution { hasObject: boolean; size: number; type: string; -}; +} export type ReCaptchaV2ClassificationSolution = MultiSolution | SingleSolution; diff --git a/capsolver/src/lib/Solution/ClassificationSolution/index.ts b/capsolver/src/lib/Solution/Classification/index.ts similarity index 68% rename from capsolver/src/lib/Solution/ClassificationSolution/index.ts rename to capsolver/src/lib/Solution/Classification/index.ts index c958c8a..2aa4a55 100644 --- a/capsolver/src/lib/Solution/ClassificationSolution/index.ts +++ b/capsolver/src/lib/Solution/Classification/index.ts @@ -4,4 +4,10 @@ import type { HCaptchaClassificationSolution } from "./HCaptchaClassificationSol import type { ImageToTextSolution } from "./ImageToTextSolution"; import type { ReCaptchaV2ClassificationSolution } from "./ReCaptchaV2ClassificationSolution"; -export type ClassificationSolutions = AwsWafClassificationSolution & FunCaptchaClassificationSolution & HCaptchaClassificationSolution & ImageToTextSolution & ReCaptchaV2ClassificationSolution; +export { + AwsWafClassificationSolution, + FunCaptchaClassificationSolution, + HCaptchaClassificationSolution, + ImageToTextSolution, + ReCaptchaV2ClassificationSolution +}; diff --git a/capsolver/src/lib/Solution/ClassificationSolution/AwsWafClassificationSolution.ts b/capsolver/src/lib/Solution/ClassificationSolution/AwsWafClassificationSolution.ts deleted file mode 100644 index 8930e0c..0000000 --- a/capsolver/src/lib/Solution/ClassificationSolution/AwsWafClassificationSolution.ts +++ /dev/null @@ -1,5 +0,0 @@ - -export type AwsWafClassificationSolution = { - box: number[]; - distance: number; -}; diff --git a/capsolver/src/lib/Solution/ClassificationSolution/FunCaptchaClassificationSolution.ts b/capsolver/src/lib/Solution/ClassificationSolution/FunCaptchaClassificationSolution.ts deleted file mode 100644 index 3cd5363..0000000 --- a/capsolver/src/lib/Solution/ClassificationSolution/FunCaptchaClassificationSolution.ts +++ /dev/null @@ -1,5 +0,0 @@ - -export type FunCaptchaClassificationSolution = { - objects: Array; -}; - diff --git a/capsolver/src/lib/Solution/ClassificationSolution/ImageToTextSolution.ts b/capsolver/src/lib/Solution/ClassificationSolution/ImageToTextSolution.ts deleted file mode 100644 index 67d50ad..0000000 --- a/capsolver/src/lib/Solution/ClassificationSolution/ImageToTextSolution.ts +++ /dev/null @@ -1,5 +0,0 @@ - -export type ImageToTextSolution = { - text: string; -}; - diff --git a/capsolver/src/lib/Solution/Token/AntiAkamaiPowTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiAkamaiPowTaskSolution.ts new file mode 100644 index 0000000..0199490 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiAkamaiPowTaskSolution.ts @@ -0,0 +1,3 @@ +export interface AntiAkamaiPowTaskSolution { + pow: string; +} diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiSensorTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiAkamaiSensorTaskSolution.ts similarity index 62% rename from capsolver/src/lib/Solution/TokenSolution/AntiAkamaiSensorTaskSolution.ts rename to capsolver/src/lib/Solution/Token/AntiAkamaiSensorTaskSolution.ts index e790f8f..d47778f 100644 --- a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiSensorTaskSolution.ts +++ b/capsolver/src/lib/Solution/Token/AntiAkamaiSensorTaskSolution.ts @@ -1,7 +1,6 @@ - -export type AntiAkamaiSensorTaskSolution = { +export interface AntiAkamaiSensorTaskSolution { deviceId: string; deviceName: string; sensors: string[]; version: string; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/AntiAkamaiWebTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiAkamaiWebTaskSolution.ts new file mode 100644 index 0000000..b002eae --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiAkamaiWebTaskSolution.ts @@ -0,0 +1,4 @@ +export interface AntiAkamaiWebTaskSolution { + sensorData: string; +} + diff --git a/capsolver/src/lib/Solution/Token/AntiAwsWafTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiAwsWafTaskSolution.ts new file mode 100644 index 0000000..bd7cac8 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiAwsWafTaskSolution.ts @@ -0,0 +1,3 @@ +export interface AntiAwsWafTaskSolution { + cookie: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/AntiCloudflareTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiCloudflareTaskSolution.ts new file mode 100644 index 0000000..da9f116 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiCloudflareTaskSolution.ts @@ -0,0 +1,5 @@ +export interface AntiCloudflareTaskSolution { + token: string; + type: string; + userAgent: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/AntiCyberSiAraTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiCyberSiAraTaskSolution.ts new file mode 100644 index 0000000..eda7561 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiCyberSiAraTaskSolution.ts @@ -0,0 +1 @@ +export interface AntiCyberSiAraTaskSolution { token: string } \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/AntiImpervaTaskSolution.ts b/capsolver/src/lib/Solution/Token/AntiImpervaTaskSolution.ts new file mode 100644 index 0000000..f1e2692 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/AntiImpervaTaskSolution.ts @@ -0,0 +1 @@ +export interface AntiImpervaTaskSolution { token: string } \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/DataDomeSliderTaskSolution.ts b/capsolver/src/lib/Solution/Token/DataDomeSliderTaskSolution.ts new file mode 100644 index 0000000..96b8a52 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/DataDomeSliderTaskSolution.ts @@ -0,0 +1,4 @@ +export interface DataDomeSliderTaskSolution { + cookie: string; + userAgent: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/FunCaptchaTaskSolution.ts b/capsolver/src/lib/Solution/Token/FunCaptchaTaskSolution.ts new file mode 100644 index 0000000..2eeeb9f --- /dev/null +++ b/capsolver/src/lib/Solution/Token/FunCaptchaTaskSolution.ts @@ -0,0 +1,4 @@ +export interface FunCaptchaTaskSolution { + token: string; + userAgent: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/GeeTestV3TaskSolution.ts b/capsolver/src/lib/Solution/Token/GeeTestV3TaskSolution.ts new file mode 100644 index 0000000..cb62938 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/GeeTestV3TaskSolution.ts @@ -0,0 +1,4 @@ +export interface GeeTestV3TaskSolution { + challenge: string; + validate: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/GeeTestV4TaskSolution.ts b/capsolver/src/lib/Solution/Token/GeeTestV4TaskSolution.ts similarity index 61% rename from capsolver/src/lib/Solution/TokenSolution/GeeTestV4TaskSolution.ts rename to capsolver/src/lib/Solution/Token/GeeTestV4TaskSolution.ts index 83a6419..4f5fb72 100644 --- a/capsolver/src/lib/Solution/TokenSolution/GeeTestV4TaskSolution.ts +++ b/capsolver/src/lib/Solution/Token/GeeTestV4TaskSolution.ts @@ -1,10 +1,8 @@ -import type { } from "../_BaseSolution"; - -export type GeeTestV4TaskSolution = { +export interface GeeTestV4TaskSolution { captcha_id: string; captcha_output: string; gen_time: string; lot_number: string; pass_token: string; risk_type: string; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/HCaptchaTaskSolution.ts b/capsolver/src/lib/Solution/Token/HCaptchaTaskSolution.ts similarity index 58% rename from capsolver/src/lib/Solution/TokenSolution/HCaptchaTaskSolution.ts rename to capsolver/src/lib/Solution/Token/HCaptchaTaskSolution.ts index 32b1b18..baf1cb1 100644 --- a/capsolver/src/lib/Solution/TokenSolution/HCaptchaTaskSolution.ts +++ b/capsolver/src/lib/Solution/Token/HCaptchaTaskSolution.ts @@ -1,9 +1,7 @@ -import type { } from "../_BaseSolution"; - -export type HCaptchaTaskSolution = { +export interface HCaptchaTaskSolution { captchaKey: string; expireTime: number; gRecaptchaResponse: string; timestamp: number; userAgent: string; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/MtCaptchaTaskSolution.ts b/capsolver/src/lib/Solution/Token/MtCaptchaTaskSolution.ts new file mode 100644 index 0000000..4ea1e6c --- /dev/null +++ b/capsolver/src/lib/Solution/Token/MtCaptchaTaskSolution.ts @@ -0,0 +1,3 @@ +export interface MtCaptchaTaskSolution { + token: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/ReCaptchaV2TaskSolution.ts b/capsolver/src/lib/Solution/Token/ReCaptchaV2TaskSolution.ts new file mode 100644 index 0000000..356c9c2 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/ReCaptchaV2TaskSolution.ts @@ -0,0 +1,5 @@ +export interface ReCaptchaV2TaskSolution { + expireTime: number; + gRecaptchaResponse: string; + userAgent: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/ReCaptchaV3TaskSolution.ts b/capsolver/src/lib/Solution/Token/ReCaptchaV3TaskSolution.ts new file mode 100644 index 0000000..5376b6d --- /dev/null +++ b/capsolver/src/lib/Solution/Token/ReCaptchaV3TaskSolution.ts @@ -0,0 +1,5 @@ +export interface ReCaptchaV3TaskSolution { + expireTime: number; + gRecaptchaResponse: string; + userAgent: string; +} \ No newline at end of file diff --git a/capsolver/src/lib/Solution/Token/index.ts b/capsolver/src/lib/Solution/Token/index.ts new file mode 100644 index 0000000..68746e6 --- /dev/null +++ b/capsolver/src/lib/Solution/Token/index.ts @@ -0,0 +1,33 @@ +import { ReCaptchaV2TaskSolution } from "./ReCaptchaV2TaskSolution"; +import { MtCaptchaTaskSolution } from "./MtCaptchaTaskSolution"; +import { HCaptchaTaskSolution } from "./HCaptchaTaskSolution"; +import { GeeTestV3TaskSolution } from "./GeeTestV3TaskSolution"; +import { FunCaptchaTaskSolution } from "./FunCaptchaTaskSolution"; +import { DataDomeSliderTaskSolution } from "./DataDomeSliderTaskSolution"; +import { AntiImpervaTaskSolution } from "./AntiImpervaTaskSolution"; +import { AntiCyberSiAraTaskSolution } from "./AntiCyberSiAraTaskSolution"; +import { AntiCloudflareTaskSolution } from "./AntiCloudflareTaskSolution"; +import { AntiAwsWafTaskSolution } from "./AntiAwsWafTaskSolution"; +import { AntiAkamaiPowTaskSolution } from "./AntiAkamaiPowTaskSolution"; +import { AntiAkamaiSensorTaskSolution } from "./AntiAkamaiSensorTaskSolution"; +import { AntiAkamaiWebTaskSolution } from "./AntiAkamaiWebTaskSolution"; +import { GeeTestV4TaskSolution } from "./GeeTestV4TaskSolution"; +import { ReCaptchaV3TaskSolution } from "./ReCaptchaV3TaskSolution"; + +export { + AntiAkamaiPowTaskSolution, + AntiAkamaiSensorTaskSolution, + AntiAkamaiWebTaskSolution, + AntiAwsWafTaskSolution, + AntiCloudflareTaskSolution, + AntiCyberSiAraTaskSolution, + AntiImpervaTaskSolution, + DataDomeSliderTaskSolution, + FunCaptchaTaskSolution, + GeeTestV3TaskSolution, + GeeTestV4TaskSolution, + HCaptchaTaskSolution, + MtCaptchaTaskSolution, + ReCaptchaV2TaskSolution, + ReCaptchaV3TaskSolution +}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiPowTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiPowTaskSolution.ts deleted file mode 100644 index f445d8f..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiPowTaskSolution.ts +++ /dev/null @@ -1,4 +0,0 @@ - -export type AntiAkamaiPowTaskSolution = { - pow: string; -}; diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiWebTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiWebTaskSolution.ts deleted file mode 100644 index 419eaa0..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiAkamaiWebTaskSolution.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type AntiAkamaiWebTaskSolution = { - sensorData: string; -}; - diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiAwsWafTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiAwsWafTaskSolution.ts deleted file mode 100644 index 890d7ae..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiAwsWafTaskSolution.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type AntiAwsWafTaskSolution = { - cookie: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiCloudflareTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiCloudflareTaskSolution.ts deleted file mode 100644 index 28bda51..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiCloudflareTaskSolution.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type AntiCloudflareTaskSolution = { - token: string; - type: string; - userAgent: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiCyberSiAraTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiCyberSiAraTaskSolution.ts deleted file mode 100644 index d7cada9..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiCyberSiAraTaskSolution.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type AntiCyberSiAraTaskSolution = { token: string }; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/AntiImpervaTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/AntiImpervaTaskSolution.ts deleted file mode 100644 index 0c5a1d1..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/AntiImpervaTaskSolution.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type AntiImpervaTaskSolution = { token: string }; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/DataDomeSliderTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/DataDomeSliderTaskSolution.ts deleted file mode 100644 index 65c229f..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/DataDomeSliderTaskSolution.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type DataDomeSliderTaskSolution = { - cookie: string; - userAgent: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/FunCaptchaTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/FunCaptchaTaskSolution.ts deleted file mode 100644 index 9cf68df..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/FunCaptchaTaskSolution.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type FunCaptchaTaskSolution = { - token: string; - userAgent: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/GeeTestV3TaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/GeeTestV3TaskSolution.ts deleted file mode 100644 index a39f3ca..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/GeeTestV3TaskSolution.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type GeeTestV3TaskSolution = { - challenge: string; - validate: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/MtCaptchaTaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/MtCaptchaTaskSolution.ts deleted file mode 100644 index fbdc650..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/MtCaptchaTaskSolution.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type MtCaptchaTaskSolution = { - token: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV2TaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV2TaskSolution.ts deleted file mode 100644 index 7f0e656..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV2TaskSolution.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type ReCaptchaV2TaskSolution = { - expireTime: number; - gRecaptchaResponse: string; - userAgent: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV3TaskSolution.ts b/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV3TaskSolution.ts deleted file mode 100644 index 79dfa44..0000000 --- a/capsolver/src/lib/Solution/TokenSolution/ReCaptchaV3TaskSolution.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { } from "../_BaseSolution"; - -export type ReCaptchaV3TaskSolution = { - expireTime: number; - gRecaptchaResponse: string; - userAgent: string; -}; \ No newline at end of file diff --git a/capsolver/src/lib/Solution/TokenSolution/index.ts b/capsolver/src/lib/Solution/TokenSolution/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/capsolver/src/lib/Solution/_BaseSolution.ts b/capsolver/src/lib/Solution/_BaseSolution.ts index ae0d451..8cbee3d 100644 --- a/capsolver/src/lib/Solution/_BaseSolution.ts +++ b/capsolver/src/lib/Solution/_BaseSolution.ts @@ -1,4 +1,3 @@ - export interface CapSolverSolution { errorCode?: string; errorDescription?: string; diff --git a/capsolver/src/lib/Solution/index.ts b/capsolver/src/lib/Solution/index.ts index e69de29..b1ff244 100644 --- a/capsolver/src/lib/Solution/index.ts +++ b/capsolver/src/lib/Solution/index.ts @@ -0,0 +1,2 @@ +export * from "./Classification"; +export * from "./Token"; \ No newline at end of file diff --git a/capsolver/src/lib/capsolver.ts b/capsolver/src/lib/capsolver.ts index d974270..0480239 100644 --- a/capsolver/src/lib/capsolver.ts +++ b/capsolver/src/lib/capsolver.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env node --no-warnings -import { MtCaptchaTask } from "./Requests/Token/MtCaptchaTask"; import type { $Fetch } from "ofetch"; import { FetchError, ofetch @@ -10,63 +8,70 @@ import { import type { CapSolverCreateTaskResponse, CaptchaClientParams, CapSolverBalanceResponse, FeedbackTaskParams, FeedbackResponse } from "./types"; -import { ReCaptchaV3TaskProxyLess } from "./Requests/Token/ReCaptchaV3TaskProxyLess"; -import { ReCaptchaV3M1TaskProxyLess } from "./Requests/Token/ReCaptchaV3M1TaskProxyLess"; -import { ReCaptchaV3EnterpriseTask } from "./Requests/Token/ReCaptchaV3EnterpriseTask"; -import { ReCaptchaV3EnterpriseTaskProxyLess } from "./Requests/Token/ReCaptchaV3EnterpriseTaskProxyLess"; -import { ReCaptchaV3Task } from "./Requests/Token/ReCaptchaV3Task"; -import { ReCaptchaV2EnterpriseTask } from "./Requests/Token/ReCaptchaV2EnterpriseTask"; -import { ReCaptchaV2EnterpriseTaskProxyLess } from "./Requests/Token/ReCaptchaV2EnterpriseTaskProxyLess"; -import { ReCaptchaV2Task } from "./Requests/Token/ReCaptchaV2Task"; -import { ReCaptchaV2TaskProxyLess } from "./Requests/Token/ReCaptchaV2TaskProxyLess"; -import { MtCaptchaTaskProxyLess } from "./Requests/Token/MtCaptchaTaskProxyLess"; -import { MtCaptchaTaskSolution } from "./Solution/TokenSolution/MtCaptchaTaskSolution"; -import { ReCaptchaV2TaskSolution } from "./Solution/TokenSolution/ReCaptchaV2TaskSolution"; -import { ReCaptchaV3TaskSolution } from "./Solution/TokenSolution/ReCaptchaV3TaskSolution"; -import { CapSolverSolution } from "./Solution/_BaseSolution"; -import { HCaptchaTask } from "./Requests/Token/HCaptchaTask"; -import { HCaptchaTaskProxyLess } from "./Requests/Token/HCaptchaTaskProxyLess"; -import { HCaptchaTaskSolution } from "./Solution/TokenSolution/HCaptchaTaskSolution"; -import { AwsWafClassification } from "./Requests/Classification/AwsWafClassification"; -import { HCaptchaClassification } from "./Requests/Classification/HCaptchaClassification"; -import { ImageToTextTask } from "./Requests/Classification/ImageToTextTask"; -import { ReCaptchaV2Classification } from "./Requests/Classification/ReCaptchaV2Classification"; -import { AntiAwsWafTaskProxyLess } from "./Requests/Token/AntiAwsWafTaskProxyLess"; -import { AntiCloudflareChallengeTask } from "./Requests/Token/AntiCloudflareChallengeTask"; -import { AntiCloudflareTurnstileTask } from "./Requests/Token/AntiCloudflareTurnstileTask"; -import { AntiCyberSiAraTask } from "./Requests/Token/AntiCyberSiAraTask"; -import { AntiCyberSiAraTaskProxyLess } from "./Requests/Token/AntiCyberSiAraTaskProxyLess"; -import { AntiImpervaTask } from "./Requests/Token/AntiImpervaTask"; -import { AntiImpervaTaskProxyLess } from "./Requests/Token/AntiImpervaTaskProxyLess"; -import { DataDomeSliderTask } from "./Requests/Token/DataDomeSliderTask"; -import { FunCaptchaTaskProxyLess } from "./Requests/Token/FunCaptchaTaskProxyLess"; -import { GeeTestV3Task } from "./Requests/Token/GeeTestV3Task"; -import { GeeTestV3TaskProxyLess } from "./Requests/Token/GeeTestV3TaskProxyLess"; -import { GeeTestV4Task } from "./Requests/Token/GeeTestV4Task"; -import { GeeTestV4TaskProxyLess } from "./Requests/Token/GeeTestV4TaskProxyLess"; -import { AwsWafClassificationSolution } from "./Solution/ClassificationSolution/AwsWafClassificationSolution"; -import { HCaptchaClassificationSolution } from "./Solution/ClassificationSolution/HCaptchaClassificationSolution"; -import { ReCaptchaV2ClassificationSolution } from "./Solution/ClassificationSolution/ReCaptchaV2ClassificationSolution"; -import { AntiAwsWafTaskSolution } from "./Solution/TokenSolution/AntiAwsWafTaskSolution"; -import { AntiCyberSiAraTaskSolution } from "./Solution/TokenSolution/AntiCyberSiAraTaskSolution"; -import { AntiImpervaTaskSolution } from "./Solution/TokenSolution/AntiImpervaTaskSolution"; -import { DataDomeSliderTaskSolution } from "./Solution/TokenSolution/DataDomeSliderTaskSolution"; -import { FunCaptchaTaskSolution } from "./Solution/TokenSolution/FunCaptchaTaskSolution"; -import { ImageToTextSolution } from "./Solution/ClassificationSolution/ImageToTextSolution"; -import { AntiCloudflareTaskSolution } from "./Solution/TokenSolution/AntiCloudflareTaskSolution"; -import { Requests } from "./Requests"; -import { AntiAwsWafTask } from "./Requests/Token/AntiAwsWafTask"; -import { AntiAkamaiPowTask } from "./Requests/Token/AntiAkamaiPowTask"; -import { AntiAkamaiSensorTask } from "./Requests/Token/AntiAkamaiSensorTask"; -import { AntiAkamaiWebTask } from "./Requests/Token/AntiAkamaiWebTask"; -import { AntiAkamaiPowTaskSolution } from "./Solution/TokenSolution/AntiAkamaiPowTaskSolution"; -import { AntiAkamaiSensorTaskSolution } from "./Solution/TokenSolution/AntiAkamaiSensorTaskSolution"; -import { AntiAkamaiWebTaskSolution } from "./Solution/TokenSolution/AntiAkamaiWebTaskSolution"; -import { GeeTestV3TaskSolution } from "./Solution/TokenSolution/GeeTestV3TaskSolution"; -import { GeeTestV4TaskSolution } from "./Solution/TokenSolution/GeeTestV4TaskSolution"; -import { AntiAkamaiBMPTask } from "./Requests/Token/AntiAkamaiBMPTask"; -import { GeeTestTask } from "./Requests/Token/GeeTestTask"; -import { GeeTestTaskProxyLess } from "./Requests/Token/GeeTestTaskProxyLess"; +import type { + AntiAkamaiPowTaskSolution, + AntiAkamaiSensorTaskSolution, + AntiAkamaiWebTaskSolution, + AntiAwsWafTaskSolution, + AntiCloudflareTaskSolution, + AntiCyberSiAraTaskSolution, + AntiImpervaTaskSolution, + DataDomeSliderTaskSolution, + FunCaptchaTaskSolution, + GeeTestV3TaskSolution, + GeeTestV4TaskSolution, + HCaptchaTaskSolution, + MtCaptchaTaskSolution, + ReCaptchaV2TaskSolution, + ReCaptchaV3TaskSolution, + AwsWafClassificationSolution, + HCaptchaClassificationSolution, + ImageToTextSolution, + ReCaptchaV2ClassificationSolution, + FunCaptchaClassificationSolution +} from "./Solution"; +import type { + AntiAkamaiPowTask, + AntiAkamaiSensorTask, + AntiAkamaiWebTask, + AntiAwsWafTask, + AntiAwsWafTaskProxyLess, + AntiCloudflareChallengeTask, + AntiCloudflareTurnstileTask, + AntiCyberSiAraTask, + AntiCyberSiAraTaskProxyLess, + AntiImpervaTask, + AntiImpervaTaskProxyLess, + DataDomeSliderTask, + FunCaptchaTaskProxyLess, + GeeTestTask, + GeeTestTaskProxyLess, + FunCaptchaClassification, + GeeTestV3Task, + GeeTestV3TaskProxyLess, + GeeTestV4Task, + GeeTestV4TaskProxyLess, + HCaptchaTask, + HCaptchaTaskProxyLess, + MtCaptchaTask, + MtCaptchaTaskProxyLess, + Requests, + ReCaptchaV2EnterpriseTask, + ReCaptchaV2EnterpriseTaskProxyLess, + ReCaptchaV2Task, + ReCaptchaV2TaskProxyLess, + ReCaptchaV3EnterpriseTask, + ReCaptchaV3EnterpriseTaskProxyLess, + ReCaptchaV3M1TaskProxyLess, + ReCaptchaV3Task, + ReCaptchaV3TaskProxyLess, + AntiAkamaiBMPTask, + AwsWafClassification, + HCaptchaClassification, + ImageToTextTask, + ReCaptchaV2Classification +} from "./Requests"; +import type { CapSolverSolution } from "./Solution/_BaseSolution"; process.removeAllListeners("warning"); /** @@ -194,7 +199,7 @@ export class CapSolver extends CaptchaClient>} - response of createTask + * @return {Promise>} - response of createTask */ public async solve(request: ReCaptchaV3EnterpriseTask | ReCaptchaV3EnterpriseTaskProxyLess | ReCaptchaV3M1TaskProxyLess | ReCaptchaV3Task | ReCaptchaV3TaskProxyLess): Promise>; @@ -312,6 +317,12 @@ export class CapSolver extends CaptchaClient>; + /** + * @param {FunCaptchaClassification} request - task payload to create task + * @return {Promise>} - response of createTask + */ + public async solve(request: FunCaptchaClassification): Promise>; + /** * @param {Requests} request - task payload to create task * @return {Promise>} - response of createTask @@ -364,8 +375,6 @@ export class CapSolver extends CaptchaClient(payload as Requests); if (createTaskResponse.solution) diff --git a/capsolver/src/lib/types.ts b/capsolver/src/lib/types.ts index dbf6d08..e19050d 100644 --- a/capsolver/src/lib/types.ts +++ b/capsolver/src/lib/types.ts @@ -1,10 +1,10 @@ -export type CaptchaClientParams = { +export interface CaptchaClientParams { clientKey: string; pollingInterval?: number; timeout?: number; -}; +} -export type CapSolverCreateTaskResponse = { +export type CapSolverCreateTaskResponse = { errorCode: string; errorDescription: string; errorId: number; @@ -12,15 +12,15 @@ export type CapSolverCreateTaskResponse = { taskId: string; }; -export type CapSolverBalanceResponse = { +export interface CapSolverBalanceResponse { balance: number; errorCode?: string; errorDescription?: string; errorId: number; packages?: Package[]; -}; +} -export type Package = { +export interface Package { activeTime: number; expireTime: number; numberOfCalls: number; @@ -28,18 +28,18 @@ export type Package = { status: number; token: string; type: number; -}; +} -export type FeedbackTaskParams = { +export interface FeedbackTaskParams { code?: number; invalid: boolean; message?: string; taskId: string; -}; +} -export type FeedbackResponse = { +export interface FeedbackResponse { errorCode?: string; errorDescription?: string; errorId: number; message: string; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/capsolver/src/tests/Requests/Token/AntiAwsWafTask.spec.ts b/capsolver/src/tests/Requests/Token/AntiAwsWafTask.spec.ts index 1bfb378..7600508 100644 --- a/capsolver/src/tests/Requests/Token/AntiAwsWafTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/AntiAwsWafTask.spec.ts @@ -7,7 +7,11 @@ describe("AntiAwsWafTask", () => { awsContext: "some-context", awsIv: "some-iv", awsKey: "some-key", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -18,21 +22,35 @@ describe("AntiAwsWafTask", () => { awsContext: "some-context", awsIv: "some-iv", awsKey: "some-key", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiAwsWafTask", websiteURL: "https://some-url.com" }); }); it("To be equal to object without optional params", () => { const task = new AntiAwsWafTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); expect(task).toEqual({ _endpoint: "createTask", _isAntiAwsWafTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiAwsWafTask", websiteURL: "https://some-url.com" }); diff --git a/capsolver/src/tests/Requests/Token/AntiCloudflareTaskChallenge.spec.ts b/capsolver/src/tests/Requests/Token/AntiCloudflareTaskChallenge.spec.ts index 12d35ec..0135b43 100644 --- a/capsolver/src/tests/Requests/Token/AntiCloudflareTaskChallenge.spec.ts +++ b/capsolver/src/tests/Requests/Token/AntiCloudflareTaskChallenge.spec.ts @@ -3,14 +3,23 @@ import { AntiCloudflareChallengeTask } from "../../../lib/Requests/Token/AntiClo describe("AntiCloudflareChallengeTask", () => { it("To be equal to object", () => { const task = new AntiCloudflareChallengeTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); expect(task).toEqual({ _endpoint: "createTask", _isAntiCloudflareTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiCloudflareTask", websiteURL: "https://some-url.com" }); @@ -21,6 +30,7 @@ describe("AntiCloudflareChallengeTask", () => { expect(task).toEqual({ _endpoint: "createTask", _isAntiCloudflareTask: true, + proxy: undefined, type: "AntiCloudflareTask", websiteURL: "https://some-url.com" }); diff --git a/capsolver/src/tests/Requests/Token/AntiCloudflareTaskTurnstile.spec.ts b/capsolver/src/tests/Requests/Token/AntiCloudflareTaskTurnstile.spec.ts index db9ff1a..4ac7b3e 100644 --- a/capsolver/src/tests/Requests/Token/AntiCloudflareTaskTurnstile.spec.ts +++ b/capsolver/src/tests/Requests/Token/AntiCloudflareTaskTurnstile.spec.ts @@ -8,7 +8,11 @@ describe("AntiCloudflareTurnstileTask", () => { cdata: "some-cdata", type: "challenge" }, - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -21,7 +25,12 @@ describe("AntiCloudflareTurnstileTask", () => { cdata: "some-cdata", type: "challenge" }, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiCloudflareTask", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -30,7 +39,11 @@ describe("AntiCloudflareTurnstileTask", () => { it("To be equal to object without optional params", () => { const task = new AntiCloudflareTurnstileTask({ metadata: { type: "turnstile" }, - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -43,7 +56,12 @@ describe("AntiCloudflareTurnstileTask", () => { cdata: undefined, type: "turnstile" }, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiCloudflareTask", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" diff --git a/capsolver/src/tests/Requests/Token/AntiCyberSiAraTask.spec.ts b/capsolver/src/tests/Requests/Token/AntiCyberSiAraTask.spec.ts index b4d1c44..c0270fc 100644 --- a/capsolver/src/tests/Requests/Token/AntiCyberSiAraTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/AntiCyberSiAraTask.spec.ts @@ -4,7 +4,11 @@ describe("AntiCyberSiAraTask", () => { it("To be equal to object", () => { const task = new AntiCyberSiAraTask({ SlideMasterUrlId: "some-SlideMasterUrlId", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteURL: "https://some-url.com" }); @@ -13,7 +17,12 @@ describe("AntiCyberSiAraTask", () => { SlideMasterUrlId: "some-SlideMasterUrlId", _endpoint: "createTask", _isAntiCyberSiAraTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "AntiCyberSiAraTask", userAgent: "some-userAgent", websiteURL: "https://some-url.com" diff --git a/capsolver/src/tests/Requests/Token/AntiImpervaTask.spec.ts b/capsolver/src/tests/Requests/Token/AntiImpervaTask.spec.ts index ca7cedc..449c1cd 100644 --- a/capsolver/src/tests/Requests/Token/AntiImpervaTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/AntiImpervaTask.spec.ts @@ -3,7 +3,11 @@ import { AntiImpervaTask } from "../../../lib/Requests/Token/AntiImpervaTask"; describe("AntiImpervaTask", () => { it("To be equal to object", () => { const task = new AntiImpervaTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", reese84: true, reeseScriptUrl: "some-reeseScriptUrl", reeseToken: "some-reeseToken", @@ -15,7 +19,12 @@ describe("AntiImpervaTask", () => { expect(task).toEqual({ _endpoint: "createTask", _isAntiImpervaTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", reese84: true, reeseScriptUrl: "some-reeseScriptUrl", reeseToken: "some-reeseToken", @@ -27,7 +36,11 @@ describe("AntiImpervaTask", () => { }); it("To be equal to object without optional params", () => { const task = new AntiImpervaTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteUrl: "https://some-url.com" }); @@ -35,7 +48,12 @@ describe("AntiImpervaTask", () => { expect(task).toEqual({ _endpoint: "createTask", _isAntiImpervaTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", reese84: false, reeseScriptUrl: undefined, reeseToken: undefined, diff --git a/capsolver/src/tests/Requests/Token/DataDomeSliderTask.spec.ts b/capsolver/src/tests/Requests/Token/DataDomeSliderTask.spec.ts index f72ee72..ca25b9f 100644 --- a/capsolver/src/tests/Requests/Token/DataDomeSliderTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/DataDomeSliderTask.spec.ts @@ -4,7 +4,11 @@ describe("DataDomeSliderTask", () => { it("To be equal to object", () => { const task = new DataDomeSliderTask({ captchaUrl: "https://some-url.com", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent" }); @@ -12,7 +16,12 @@ describe("DataDomeSliderTask", () => { _endpoint: "createTask", _isDataDomeSliderTask: true, captchaUrl: "https://some-url.com", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "DataDomeSliderTask", userAgent: "some-userAgent" }); diff --git a/capsolver/src/tests/Requests/Token/FunCaptchaTaskProxyLess.spec.ts b/capsolver/src/tests/Requests/Token/FunCaptchaTaskProxyLess.spec.ts index 246fdd9..608367d 100644 --- a/capsolver/src/tests/Requests/Token/FunCaptchaTaskProxyLess.spec.ts +++ b/capsolver/src/tests/Requests/Token/FunCaptchaTaskProxyLess.spec.ts @@ -5,7 +5,11 @@ describe("FunCaptchaTaskProxyLess", () => { const task = new FunCaptchaTaskProxyLess({ data: "some-data", funcaptchaApiJSSubdomain: "https://some-api-domain.com", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websitePublicKey: "some-websitePublicKey", websiteURL: "https://some-url.com" }); @@ -15,7 +19,12 @@ describe("FunCaptchaTaskProxyLess", () => { _isFunCaptchaTaskProxyLess: true, data: "some-data", funcaptchaApiJSSubdomain: "https://some-api-domain.com", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "FunCaptchaTaskProxyLess", websitePublicKey: "some-websitePublicKey", websiteURL: "https://some-url.com" diff --git a/capsolver/src/tests/Requests/Token/GeeTestTask.spec.ts b/capsolver/src/tests/Requests/Token/GeeTestTask.spec.ts index 20d2761..9222299 100644 --- a/capsolver/src/tests/Requests/Token/GeeTestTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/GeeTestTask.spec.ts @@ -6,7 +6,11 @@ describe("GeeTestTask", () => { captchaId: "some-captchaId", challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -16,7 +20,12 @@ describe("GeeTestTask", () => { captchaId: "some-captchaId", challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", websiteURL: "https://some-url.com" }); @@ -25,7 +34,11 @@ describe("GeeTestTask", () => { const task = new GeeTestTask({ challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -34,7 +47,12 @@ describe("GeeTestTask", () => { _isGeeTestTask: true, challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", websiteURL: "https://some-url.com" }); diff --git a/capsolver/src/tests/Requests/Token/GeeTestV3Task.spec.ts b/capsolver/src/tests/Requests/Token/GeeTestV3Task.spec.ts index a275101..0eaa0fa 100644 --- a/capsolver/src/tests/Requests/Token/GeeTestV3Task.spec.ts +++ b/capsolver/src/tests/Requests/Token/GeeTestV3Task.spec.ts @@ -6,7 +6,11 @@ describe("GeeTestV3Task", () => { challenge: "some-challenge", geetestApiServerSubdomain: "https://some-api-domain.com", gt: "some-gt", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteURL: "https://some-url.com" }); @@ -17,7 +21,12 @@ describe("GeeTestV3Task", () => { challenge: "some-challenge", geetestApiServerSubdomain: "https://some-api-domain.com", gt: "some-gt", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", userAgent: "some-userAgent", websiteURL: "https://some-url.com" @@ -27,7 +36,11 @@ describe("GeeTestV3Task", () => { const task = new GeeTestV3Task({ challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -36,7 +49,12 @@ describe("GeeTestV3Task", () => { _isGeeTestTask: true, challenge: "some-challenge", gt: "some-gt", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", websiteURL: "https://some-url.com" }); diff --git a/capsolver/src/tests/Requests/Token/GeeTestV4Task.spec.ts b/capsolver/src/tests/Requests/Token/GeeTestV4Task.spec.ts index f1b30a9..05c862a 100644 --- a/capsolver/src/tests/Requests/Token/GeeTestV4Task.spec.ts +++ b/capsolver/src/tests/Requests/Token/GeeTestV4Task.spec.ts @@ -4,7 +4,11 @@ describe("GeeTestV4Task", () => { it("To be equal to object", () => { const task = new GeeTestV4Task({ captchaId: "some-captchaId", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -12,7 +16,12 @@ describe("GeeTestV4Task", () => { _endpoint: "createTask", _isGeeTestTask: true, captchaId: "some-captchaId", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", websiteURL: "https://some-url.com" }); @@ -20,7 +29,11 @@ describe("GeeTestV4Task", () => { it("To be equal to object without optional params", () => { const task = new GeeTestV4Task({ captchaId: "some-captchaId", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteURL: "https://some-url.com" }); @@ -28,7 +41,12 @@ describe("GeeTestV4Task", () => { _endpoint: "createTask", _isGeeTestTask: true, captchaId: "some-captchaId", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "GeeTestTask", websiteURL: "https://some-url.com" }); diff --git a/capsolver/src/tests/Requests/Token/HCaptchaTask.spec.ts b/capsolver/src/tests/Requests/Token/HCaptchaTask.spec.ts index 572b982..24245ea 100644 --- a/capsolver/src/tests/Requests/Token/HCaptchaTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/HCaptchaTask.spec.ts @@ -5,7 +5,11 @@ describe("HCaptchaTask test", () => { const task = new HCaptchaTask({ enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -16,7 +20,12 @@ describe("HCaptchaTask test", () => { _isHCaptchaTask: true, enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "HCaptchaTask", userAgent: "some-userAgent", websiteKey: "some-websiteKey", @@ -25,7 +34,11 @@ describe("HCaptchaTask test", () => { }); it("To be equal to object without optional params", () => { const task = new HCaptchaTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -35,7 +48,12 @@ describe("HCaptchaTask test", () => { _isHCaptchaTask: true, enterprisePayload: undefined, isInvisible: false, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "HCaptchaTask", userAgent: undefined, websiteKey: "some-websiteKey", diff --git a/capsolver/src/tests/Requests/Token/MtCaptchaTask.spec.ts b/capsolver/src/tests/Requests/Token/MtCaptchaTask.spec.ts index a2a70db..6db15d8 100644 --- a/capsolver/src/tests/Requests/Token/MtCaptchaTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/MtCaptchaTask.spec.ts @@ -3,7 +3,11 @@ import { MtCaptchaTask } from "../../../lib/Requests/Token/MtCaptchaTask"; describe("TASK", () => { it("To be equal to object", () => { const task = new MtCaptchaTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -11,7 +15,12 @@ describe("TASK", () => { expect(task).toEqual({ _endpoint: "createTask", _isMtCaptchaTask: true, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "MtCaptchaTask", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" diff --git a/capsolver/src/tests/Requests/Token/ReCaptchaV2EnterpriseTask.spec.ts b/capsolver/src/tests/Requests/Token/ReCaptchaV2EnterpriseTask.spec.ts index 5535c24..0ca2409 100644 --- a/capsolver/src/tests/Requests/Token/ReCaptchaV2EnterpriseTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/ReCaptchaV2EnterpriseTask.spec.ts @@ -17,7 +17,12 @@ describe("ReCaptchaV2EnterpriseTask", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, pageAction: "some-action", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", + userAgent: "some-userAgent", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -40,7 +45,12 @@ describe("ReCaptchaV2EnterpriseTask", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, pageAction: "some-action", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV2EnterpriseTask", userAgent: "some-userAgent", websiteKey: "some-websiteKey", @@ -49,7 +59,11 @@ describe("ReCaptchaV2EnterpriseTask", () => { }); it("To be equal to object without optional params", () => { const task = new ReCaptchaV2EnterpriseTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -62,7 +76,12 @@ describe("ReCaptchaV2EnterpriseTask", () => { enterprisePayload: undefined, isInvisible: false, pageAction: undefined, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV2EnterpriseTask", userAgent: undefined, websiteKey: "some-websiteKey", diff --git a/capsolver/src/tests/Requests/Token/ReCaptchaV2Task.spec.ts b/capsolver/src/tests/Requests/Token/ReCaptchaV2Task.spec.ts index d48d0be..27128b0 100644 --- a/capsolver/src/tests/Requests/Token/ReCaptchaV2Task.spec.ts +++ b/capsolver/src/tests/Requests/Token/ReCaptchaV2Task.spec.ts @@ -17,7 +17,11 @@ describe("ReCaptchaV2Task", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, pageAction: "some-action", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -40,7 +44,12 @@ describe("ReCaptchaV2Task", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, isInvisible: false, pageAction: "some-action", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV2Task", userAgent: "some-userAgent", websiteKey: "some-websiteKey", @@ -49,7 +58,11 @@ describe("ReCaptchaV2Task", () => { }); it("To be equal to object without optional params", () => { const task = new ReCaptchaV2Task({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -62,7 +75,12 @@ describe("ReCaptchaV2Task", () => { enterprisePayload: undefined, isInvisible: false, pageAction: undefined, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV2Task", userAgent: undefined, websiteKey: "some-websiteKey", diff --git a/capsolver/src/tests/Requests/Token/ReCaptchaV3EnterpriseTask.spec.ts b/capsolver/src/tests/Requests/Token/ReCaptchaV3EnterpriseTask.spec.ts index 7b147c9..611a006 100644 --- a/capsolver/src/tests/Requests/Token/ReCaptchaV3EnterpriseTask.spec.ts +++ b/capsolver/src/tests/Requests/Token/ReCaptchaV3EnterpriseTask.spec.ts @@ -17,7 +17,11 @@ describe("ReCaptchaV3EnterpriseTask", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, minScore: 0.7, pageAction: "some-action", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -40,7 +44,12 @@ describe("ReCaptchaV3EnterpriseTask", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, minScore: 0.7, pageAction: "some-action", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV3EnterpriseTask", userAgent: "some-userAgent", websiteKey: "some-websiteKey", @@ -49,7 +58,11 @@ describe("ReCaptchaV3EnterpriseTask", () => { }); it("To be equal to object without optional params", () => { const task = new ReCaptchaV3EnterpriseTask({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -62,7 +75,12 @@ describe("ReCaptchaV3EnterpriseTask", () => { enterprisePayload: undefined, minScore: undefined, pageAction: undefined, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV3EnterpriseTask", userAgent: undefined, websiteKey: "some-websiteKey", diff --git a/capsolver/src/tests/Requests/Token/ReCaptchaV3Task.spec.ts b/capsolver/src/tests/Requests/Token/ReCaptchaV3Task.spec.ts index 1fb92fc..24bd86b 100644 --- a/capsolver/src/tests/Requests/Token/ReCaptchaV3Task.spec.ts +++ b/capsolver/src/tests/Requests/Token/ReCaptchaV3Task.spec.ts @@ -17,7 +17,11 @@ describe("ReCaptchaV3Task", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, minScore: 0.7, pageAction: "some-action", - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", userAgent: "some-userAgent", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" @@ -40,7 +44,12 @@ describe("ReCaptchaV3Task", () => { enterprisePayload: { s: "SOME_ADDITIONAL_TOKEN" }, minScore: 0.7, pageAction: "some-action", - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV3Task", userAgent: "some-userAgent", websiteKey: "some-websiteKey", @@ -49,7 +58,11 @@ describe("ReCaptchaV3Task", () => { }); it("To be equal to object without optional params", () => { const task = new ReCaptchaV3Task({ - proxy: "proxy", + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", websiteKey: "some-websiteKey", websiteURL: "https://some-url.com" }); @@ -62,7 +75,12 @@ describe("ReCaptchaV3Task", () => { enterprisePayload: undefined, minScore: undefined, pageAction: undefined, - proxy: "proxy", + proxy: undefined, + proxyAddress: "some-proxyAddress", + proxyLogin: "some-proxyLogin", + proxyPassword: "some-proxyPassword", + proxyPort: 1010, + proxyType: "http", type: "ReCaptchaV3Task", userAgent: undefined, websiteKey: "some-websiteKey", diff --git a/capsolver/yarn.lock b/capsolver/yarn.lock deleted file mode 100644 index 1d5a309..0000000 --- a/capsolver/yarn.lock +++ /dev/null @@ -1,34 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@captcha-libs/captcha-client@latest": - "integrity" "sha512-oz0LIWvN0gvrE3RaJfwkwy3Sf+YVpzD8Fd2Xaqnpev+RJ7/rynHa0rupFd2W2PGFoGNR72oZWvb+ESBl6vrA8Q==" - "resolved" "https://registry.npmjs.org/@captcha-libs/captcha-client/-/captcha-client-0.0.5.tgz" - "version" "0.0.5" - dependencies: - "ofetch" "^1.3.3" - -"destr@^2.0.1": - "integrity" "sha512-65AlobnZMiCET00KaFFjUefxDX0khFA/E4myqZ7a6Sq1yZtR8+FVIvilVX66vF2uobSumxooYZChiRPCKNqhmg==" - "resolved" "https://registry.npmjs.org/destr/-/destr-2.0.2.tgz" - "version" "2.0.2" - -"node-fetch-native@^1.4.0": - "integrity" "sha512-bW9T/uJDPAJB2YNYEpWzE54U5O3MQidXsOyTfnbKYtTtFexRvGzb1waphBN4ZwP6EcIvYYEOwW0b72BpAqydTw==" - "resolved" "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.1.tgz" - "version" "1.6.1" - -"ofetch@^1.3.3": - "integrity" "sha512-s1ZCMmQWXy4b5K/TW9i/DtiN8Ku+xCiHcjQ6/J/nDdssirrQNOoB165Zu8EqLMA2lln1JUth9a0aW9Ap2ctrUg==" - "resolved" "https://registry.npmjs.org/ofetch/-/ofetch-1.3.3.tgz" - "version" "1.3.3" - dependencies: - "destr" "^2.0.1" - "node-fetch-native" "^1.4.0" - "ufo" "^1.3.0" - -"ufo@^1.3.0": - "integrity" "sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==" - "resolved" "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz" - "version" "1.3.2" diff --git a/tsconfig.base.json b/tsconfig.base.json index 456e52e..5409d26 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -12,6 +12,7 @@ "module": "esnext", "lib": ["es2020" ], "skipLibCheck": true, + "strict": true, "baseUrl": ".", "skipDefaultLibCheck": true, "esModuleInterop": true, @@ -24,9 +25,5 @@ "@captcha-libs/twocaptcha": ["twocaptcha/index.ts"] } }, - "exclude": ["node_modules", "tmp"], - "ts-node": { - "esm": true, - "experimentalSpecifierResolution": "node" - } + "exclude": ["node_modules", "tmp"] } diff --git a/twocaptcha/src/lib/Requests/Token/_GeeTestTaskBase.ts b/twocaptcha/src/lib/Requests/Token/_GeeTestTaskBase.ts index 18019ad..d2c7cb4 100644 --- a/twocaptcha/src/lib/Requests/Token/_GeeTestTaskBase.ts +++ b/twocaptcha/src/lib/Requests/Token/_GeeTestTaskBase.ts @@ -1,5 +1,8 @@ +import type { + ProxyCredentials, ProxyTypes, TaskTypes +} from "../_BaseTaskRequest"; import { - BaseTask, ProxyCredentials, ProxyTypes, TaskTypes, _IsTaskType + BaseTask, _IsTaskType } from "../_BaseTaskRequest"; export type GeetestV3TaskBaseParams = { @@ -12,7 +15,7 @@ export type GeetestV4TaskBaseParams = { initParameters: Record & { captcha_id: string }; }; -export type GeetestCommonParams ={ +export type GeetestCommonParams = { userAgent?: string; websiteURL?: string; };