@intuned/runtime-dev 1.3.18-interface.4 → 1.3.18-interface.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/dist/chunk-6ZRJOUQS.mjs +16 -0
  2. package/dist/chunk-6ZRJOUQS.mjs.map +1 -0
  3. package/dist/chunk-7YL2JUTE.mjs +146 -0
  4. package/dist/chunk-7YL2JUTE.mjs.map +1 -0
  5. package/dist/chunk-B3T6RXPC.mjs +794 -0
  6. package/dist/chunk-B3T6RXPC.mjs.map +1 -0
  7. package/dist/chunk-FGV5T6SI.mjs +27 -0
  8. package/dist/chunk-FGV5T6SI.mjs.map +1 -0
  9. package/dist/chunk-G4PO5RIV.mjs +85 -0
  10. package/dist/chunk-G4PO5RIV.mjs.map +1 -0
  11. package/dist/chunk-LZOMFHX3.mjs +38 -0
  12. package/dist/chunk-LZOMFHX3.mjs.map +1 -0
  13. package/dist/{common/formatZodError.js → chunk-NDMVGENG.mjs} +9 -9
  14. package/dist/chunk-NDMVGENG.mjs.map +1 -0
  15. package/dist/chunk-W4UX6G4X.mjs +17 -0
  16. package/dist/chunk-W4UX6G4X.mjs.map +1 -0
  17. package/dist/chunk-XC75QGFG.mjs +1106 -0
  18. package/dist/chunk-XC75QGFG.mjs.map +1 -0
  19. package/dist/chunk-XOAZ2MGA.mjs +59 -0
  20. package/dist/chunk-XOAZ2MGA.mjs.map +1 -0
  21. package/dist/commands/interface/run.d.mts +3 -0
  22. package/dist/commands/interface/run.d.ts +3 -1
  23. package/dist/commands/interface/run.js +2047 -140
  24. package/dist/commands/interface/run.js.map +1 -0
  25. package/dist/commands/interface/run.mjs +255 -0
  26. package/dist/commands/interface/run.mjs.map +1 -0
  27. package/dist/common/asyncLocalStorage/index.d.mts +17 -0
  28. package/dist/common/asyncLocalStorage/index.d.ts +9 -8
  29. package/dist/common/asyncLocalStorage/index.js +34 -9
  30. package/dist/common/asyncLocalStorage/index.js.map +1 -0
  31. package/dist/common/asyncLocalStorage/index.mjs +12 -0
  32. package/dist/common/asyncLocalStorage/index.mjs.map +1 -0
  33. package/dist/common/binStartupScript.d.mts +2 -0
  34. package/dist/common/binStartupScript.d.ts +2 -1
  35. package/dist/common/binStartupScript.js +127 -11
  36. package/dist/common/binStartupScript.js.map +1 -0
  37. package/dist/common/binStartupScript.mjs +135 -0
  38. package/dist/common/binStartupScript.mjs.map +1 -0
  39. package/dist/common/cleanEnvironmentVariables.d.mts +3 -0
  40. package/dist/common/cleanEnvironmentVariables.d.ts +3 -1
  41. package/dist/common/cleanEnvironmentVariables.js +30 -7
  42. package/dist/common/cleanEnvironmentVariables.js.map +1 -0
  43. package/dist/common/cleanEnvironmentVariables.mjs +8 -0
  44. package/dist/common/cleanEnvironmentVariables.mjs.map +1 -0
  45. package/dist/common/constants.d.mts +13 -0
  46. package/dist/common/constants.d.ts +13 -11
  47. package/dist/common/constants.js +58 -15
  48. package/dist/common/constants.js.map +1 -0
  49. package/dist/common/constants.mjs +28 -0
  50. package/dist/common/constants.mjs.map +1 -0
  51. package/dist/common/contextStorageStateHelpers.d.mts +24 -0
  52. package/dist/common/contextStorageStateHelpers.d.ts +8 -6
  53. package/dist/common/contextStorageStateHelpers.js +47 -22
  54. package/dist/common/contextStorageStateHelpers.js.map +1 -0
  55. package/dist/common/contextStorageStateHelpers.mjs +10 -0
  56. package/dist/common/contextStorageStateHelpers.mjs.map +1 -0
  57. package/dist/common/jwtTokenManager.d.mts +19 -0
  58. package/dist/common/jwtTokenManager.d.ts +6 -4
  59. package/dist/common/jwtTokenManager.js +108 -41
  60. package/dist/common/jwtTokenManager.js.map +1 -0
  61. package/dist/common/jwtTokenManager.mjs +11 -0
  62. package/dist/common/jwtTokenManager.mjs.map +1 -0
  63. package/dist/common/runApi/index.d.mts +11 -0
  64. package/dist/common/runApi/index.d.ts +9 -6
  65. package/dist/common/runApi/index.js +1774 -74
  66. package/dist/common/runApi/index.js.map +1 -0
  67. package/dist/common/runApi/index.mjs +18 -0
  68. package/dist/common/runApi/index.mjs.map +1 -0
  69. package/dist/common/settingsSchema.d.mts +540 -0
  70. package/dist/common/settingsSchema.d.ts +58 -51
  71. package/dist/common/settingsSchema.js +55 -20
  72. package/dist/common/settingsSchema.js.map +1 -0
  73. package/dist/common/settingsSchema.mjs +10 -0
  74. package/dist/common/settingsSchema.mjs.map +1 -0
  75. package/dist/common/telemetry.d.mts +6 -0
  76. package/dist/common/telemetry.d.ts +6 -3
  77. package/dist/common/telemetry.js +41 -9
  78. package/dist/common/telemetry.js.map +1 -0
  79. package/dist/common/telemetry.mjs +31 -0
  80. package/dist/common/telemetry.mjs.map +1 -0
  81. package/dist/export.d-BAUMB-lG.d.mts +140 -0
  82. package/dist/export.d-BAUMB-lG.d.ts +140 -0
  83. package/dist/index.d.mts +6 -0
  84. package/dist/index.d.ts +6 -4
  85. package/dist/index.js +784 -92
  86. package/dist/index.js.map +1 -0
  87. package/dist/index.mjs +47 -0
  88. package/dist/index.mjs.map +1 -0
  89. package/dist/runtime/index.d.mts +168 -0
  90. package/dist/runtime/index.d.ts +168 -10
  91. package/dist/runtime/index.js +779 -88
  92. package/dist/runtime/index.js.map +1 -0
  93. package/dist/runtime/index.mjs +42 -0
  94. package/dist/runtime/index.mjs.map +1 -0
  95. package/package.json +77 -16
  96. package/.babelrc +0 -21
  97. package/.eslintignore +0 -10
  98. package/.eslintrc.js +0 -39
  99. package/.turbo/turbo-build.log +0 -2
  100. package/InterfaceTemplate/__utils.ts +0 -61
  101. package/InterfaceTemplate/index.playwright.ts +0 -6
  102. package/WebTemplate.zip +0 -0
  103. package/dist/commands/api/run.d.ts +0 -6
  104. package/dist/commands/api/run.js +0 -120
  105. package/dist/commands/auth-sessions/load.d.ts +0 -2
  106. package/dist/commands/auth-sessions/load.js +0 -35
  107. package/dist/commands/auth-sessions/run-check.d.ts +0 -2
  108. package/dist/commands/auth-sessions/run-check.js +0 -75
  109. package/dist/commands/auth-sessions/run-create.d.ts +0 -2
  110. package/dist/commands/auth-sessions/run-create.js +0 -79
  111. package/dist/commands/browser/save-state.d.ts +0 -2
  112. package/dist/commands/browser/save-state.js +0 -17
  113. package/dist/commands/browser/start-browser.d.ts +0 -2
  114. package/dist/commands/browser/start-browser.js +0 -14
  115. package/dist/commands/build.d.ts +0 -1
  116. package/dist/commands/build.js +0 -84
  117. package/dist/commands/common/browserUtils.d.ts +0 -14
  118. package/dist/commands/common/browserUtils.js +0 -58
  119. package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
  120. package/dist/commands/common/getFirstLineNumber.js +0 -101
  121. package/dist/commands/common/getFirstLineNumber.test.js +0 -228
  122. package/dist/commands/common/projectExclusions.d.ts +0 -2
  123. package/dist/commands/common/projectExclusions.js +0 -8
  124. package/dist/commands/common/sendMessageToClient.d.ts +0 -1
  125. package/dist/commands/common/sendMessageToClient.js +0 -10
  126. package/dist/commands/common/tsNodeImport.d.ts +0 -2
  127. package/dist/commands/common/tsNodeImport.js +0 -43
  128. package/dist/commands/common/utils/fileUtils.d.ts +0 -6
  129. package/dist/commands/common/utils/fileUtils.js +0 -33
  130. package/dist/commands/common/utils/interfaceClient.d.ts +0 -31
  131. package/dist/commands/common/utils/interfaceClient.js +0 -99
  132. package/dist/commands/common/utils/settings.d.ts +0 -2
  133. package/dist/commands/common/utils/settings.js +0 -31
  134. package/dist/commands/common/utils/template.d.ts +0 -2
  135. package/dist/commands/common/utils/template.js +0 -31
  136. package/dist/commands/get-headless-user-agent.d.ts +0 -1
  137. package/dist/commands/get-headless-user-agent.js +0 -18
  138. package/dist/commands/interface/pingPong.d.ts +0 -2
  139. package/dist/commands/interface/pingPong.js +0 -11
  140. package/dist/commands/interface/runApi.d.ts +0 -1
  141. package/dist/commands/interface/runApi.js +0 -102
  142. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
  143. package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
  144. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
  145. package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
  146. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
  147. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
  148. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
  149. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
  150. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
  151. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
  152. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
  153. package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
  154. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
  155. package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
  156. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +0 -1
  157. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +0 -16
  158. package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
  159. package/dist/commands/intuned-cli/commands/build.command.js +0 -12
  160. package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
  161. package/dist/commands/intuned-cli/commands/command.js +0 -9
  162. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
  163. package/dist/commands/intuned-cli/commands/deploy.command.js +0 -42
  164. package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
  165. package/dist/commands/intuned-cli/commands/index.js +0 -203
  166. package/dist/commands/intuned-cli/commands/provision.command.d.ts +0 -13
  167. package/dist/commands/intuned-cli/commands/provision.command.js +0 -50
  168. package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
  169. package/dist/commands/intuned-cli/commands/run.command.js +0 -8
  170. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
  171. package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
  172. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -34
  173. package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
  174. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
  175. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
  176. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
  177. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
  178. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
  179. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
  180. package/dist/commands/intuned-cli/commands/types.d.ts +0 -39
  181. package/dist/commands/intuned-cli/commands/types.js +0 -33
  182. package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
  183. package/dist/commands/intuned-cli/constants/index.js +0 -25
  184. package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -398
  185. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1060
  186. package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
  187. package/dist/commands/intuned-cli/controller/api.js +0 -195
  188. package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
  189. package/dist/commands/intuned-cli/controller/authSession.js +0 -425
  190. package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
  191. package/dist/commands/intuned-cli/controller/build.js +0 -36
  192. package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
  193. package/dist/commands/intuned-cli/controller/deploy.js +0 -318
  194. package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
  195. package/dist/commands/intuned-cli/controller/index.js +0 -46
  196. package/dist/commands/intuned-cli/controller/provision.d.ts +0 -21
  197. package/dist/commands/intuned-cli/controller/provision.js +0 -300
  198. package/dist/commands/intuned-cli/controller/scaffold.d.ts +0 -1
  199. package/dist/commands/intuned-cli/controller/scaffold.js +0 -77
  200. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -152
  201. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -41
  202. package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
  203. package/dist/commands/intuned-cli/helpers/api.js +0 -16
  204. package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
  205. package/dist/commands/intuned-cli/helpers/auth.js +0 -147
  206. package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
  207. package/dist/commands/intuned-cli/helpers/backend.js +0 -35
  208. package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -14
  209. package/dist/commands/intuned-cli/helpers/browser.js +0 -93
  210. package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
  211. package/dist/commands/intuned-cli/helpers/context.js +0 -33
  212. package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
  213. package/dist/commands/intuned-cli/helpers/errors.js +0 -44
  214. package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
  215. package/dist/commands/intuned-cli/helpers/index.js +0 -137
  216. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -39
  217. package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
  218. package/dist/commands/intuned-cli/helpers/prompts.d.ts +0 -3
  219. package/dist/commands/intuned-cli/helpers/prompts.js +0 -71
  220. package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
  221. package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
  222. package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
  223. package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
  224. package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
  225. package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
  226. package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
  227. package/dist/commands/intuned-cli/helpers/traces.js +0 -32
  228. package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
  229. package/dist/commands/intuned-cli/helpers/validation.js +0 -14
  230. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
  231. package/dist/commands/intuned-cli/helpers/wrapper.js +0 -76
  232. package/dist/commands/intuned-cli/index.d.ts +0 -1
  233. package/dist/commands/intuned-cli/index.js +0 -16
  234. package/dist/commands/intuned-cli/main.d.ts +0 -1
  235. package/dist/commands/intuned-cli/main.js +0 -36
  236. package/dist/commands/intuned-cli/types.d.ts +0 -70
  237. package/dist/commands/intuned-cli/types.js +0 -22
  238. package/dist/commands/ts-check.d.ts +0 -2
  239. package/dist/commands/ts-check.js +0 -56
  240. package/dist/common/Logger/Logger/index.d.ts +0 -12
  241. package/dist/common/Logger/Logger/index.js +0 -60
  242. package/dist/common/Logger/Logger/types.d.ts +0 -8
  243. package/dist/common/Logger/Logger/types.js +0 -5
  244. package/dist/common/Logger/index.d.ts +0 -12
  245. package/dist/common/Logger/index.js +0 -60
  246. package/dist/common/Logger/types.d.ts +0 -8
  247. package/dist/common/Logger/types.js +0 -5
  248. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
  249. package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
  250. package/dist/common/browserTabs.d.ts +0 -72
  251. package/dist/common/browserTabs.js +0 -74
  252. package/dist/common/extension/extensionsHelpers.d.ts +0 -11
  253. package/dist/common/extension/extensionsHelpers.js +0 -147
  254. package/dist/common/extension/intunedExtensionServer.d.ts +0 -24
  255. package/dist/common/extension/intunedExtensionServer.js +0 -178
  256. package/dist/common/extension/types.d.ts +0 -212
  257. package/dist/common/extension/types.js +0 -51
  258. package/dist/common/formatZodError.d.ts +0 -2
  259. package/dist/common/intunedJson.d.ts +0 -229
  260. package/dist/common/intunedJson.js +0 -133
  261. package/dist/common/launchBrowser.d.ts +0 -34
  262. package/dist/common/launchBrowser.js +0 -248
  263. package/dist/common/playwrightContext.d.ts +0 -30
  264. package/dist/common/playwrightContext.js +0 -153
  265. package/dist/common/runApi/importUsingImportFunction.d.ts +0 -7
  266. package/dist/common/runApi/importUsingImportFunction.js +0 -46
  267. package/dist/common/setupContextHook.d.ts +0 -16
  268. package/dist/common/setupContextHook.js +0 -22
  269. package/dist/runtime/RunError.d.ts +0 -5
  270. package/dist/runtime/RunError.js +0 -19
  271. package/dist/runtime/attemptStore.d.ts +0 -2
  272. package/dist/runtime/attemptStore.js +0 -23
  273. package/dist/runtime/captcha.d.ts +0 -15
  274. package/dist/runtime/captcha.js +0 -191
  275. package/dist/runtime/captcha.test.js +0 -821
  276. package/dist/runtime/downloadDirectory.d.ts +0 -1
  277. package/dist/runtime/downloadDirectory.js +0 -19
  278. package/dist/runtime/enums.d.js +0 -5
  279. package/dist/runtime/enums.d.ts +0 -11
  280. package/dist/runtime/enums.js +0 -18
  281. package/dist/runtime/executionHelpers.test.js +0 -52
  282. package/dist/runtime/export.d.js +0 -5
  283. package/dist/runtime/export.d.ts +0 -284
  284. package/dist/runtime/extendPayload.d.ts +0 -2
  285. package/dist/runtime/extendPayload.js +0 -21
  286. package/dist/runtime/extendTimeout.d.ts +0 -1
  287. package/dist/runtime/extendTimeout.js +0 -23
  288. package/dist/runtime/getAiGatewayConfig.d.ts +0 -10
  289. package/dist/runtime/getAiGatewayConfig.js +0 -16
  290. package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
  291. package/dist/runtime/getAuthSessionParameters.js +0 -20
  292. package/dist/runtime/persistentStore.d.ts +0 -2
  293. package/dist/runtime/persistentStore.js +0 -37
  294. package/dist/runtime/persistentStore.test.js +0 -101
  295. package/dist/runtime/runInfo.d.ts +0 -2
  296. package/dist/runtime/runInfo.js +0 -21
  297. package/template.tsconfig.json +0 -11
  298. package/tsconfig.eslint.json +0 -5
  299. package/tsconfig.json +0 -25
  300. package/typedoc.json +0 -49
  301. /package/dist/common/assets/{browser_scripts.js → assets/browser_scripts.js} +0 -0
@@ -1,147 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildExtensionsList = buildExtensionsList;
7
- exports.getIntunedCaptchaSolverSettings = getIntunedCaptchaSolverSettings;
8
- exports.getIntunedExtensionPath = getIntunedExtensionPath;
9
- exports.getIntunedExtensionSettings = getIntunedExtensionSettings;
10
- exports.getIntunedExtensionWorker = getIntunedExtensionWorker;
11
- exports.isIntunedExtensionEnabled = isIntunedExtensionEnabled;
12
- exports.isIntunedExtensionLoaded = isIntunedExtensionLoaded;
13
- exports.resolveCaptchaSolverSettings = resolveCaptchaSolverSettings;
14
- exports.setupIntunedExtension = setupIntunedExtension;
15
- var _settings = require("../../commands/common/utils/settings");
16
- var _settingsSchema = require("../settingsSchema");
17
- var _constants = require("../constants");
18
- var _jwtTokenManager = require("../jwtTokenManager");
19
- var _path = _interopRequireDefault(require("path"));
20
- var _promises = require("fs/promises");
21
- var _intunedExtensionServer = require("./intunedExtensionServer");
22
- var _portfinder = require("portfinder");
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
- const INTUNED_WORKER = "intunedWorker.js";
25
- const INTUNED_EXTENSION_SETTINGS_FILE_NAME = "intunedSettings.json";
26
- const INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR = "INTUNED_CAPTCHA_EXTENSION_PORT";
27
- let captchaSolverSettings = null;
28
- async function getIntunedCaptchaExtensionPort() {
29
- if (process.env.INTUNED_CAPTCHA_EXTENSION_PORT) {
30
- return parseInt(process.env.INTUNED_CAPTCHA_EXTENSION_PORT, 10);
31
- }
32
- return await (0, _portfinder.getPort)({});
33
- }
34
- async function resolveCaptchaSolverSettings(input) {
35
- const parsed = _settingsSchema.captchaSolverSettingsSchema.parse(input || {});
36
- if (!parsed.port) {
37
- parsed.port = await getIntunedCaptchaExtensionPort();
38
- }
39
- return parsed;
40
- }
41
- function getIntunedCaptchaExtensionPortFromEnv() {
42
- const raw = process.env[INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR];
43
- if (!raw) return null;
44
- const parsed = Number(raw);
45
- if (!Number.isFinite(parsed) || parsed <= 0 || parsed > 65535) {
46
- throw new Error(`Invalid ${INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR}: ${raw}`);
47
- }
48
- return parsed;
49
- }
50
- function isIntunedExtensionLoaded() {
51
- return !!getIntunedExtensionPath();
52
- }
53
- function buildExtensionsList() {
54
- const extensionsList = [];
55
- if (isIntunedExtensionLoaded()) {
56
- const intunedExtensionPath = getIntunedExtensionPath();
57
- extensionsList.push(intunedExtensionPath);
58
- }
59
- return extensionsList;
60
- }
61
- function getIntunedExtensionPath() {
62
- return process.env.INTUNED_EXTENSION_PATH;
63
- }
64
- async function isIntunedExtensionEnabled() {
65
- const path = getIntunedExtensionPath();
66
- if (!path) {
67
- return false;
68
- }
69
- const captchaSolverSettings = await getIntunedCaptchaSolverSettings();
70
- return captchaSolverSettings.enabled;
71
- }
72
- async function getIntunedExtensionWorker(context) {
73
- if (!(await isIntunedExtensionEnabled())) {
74
- return null;
75
- }
76
- let attemptCount = 0;
77
- while (attemptCount < 4) {
78
- const intunedServiceWorker = context.serviceWorkers().find(serviceWorker => serviceWorker.url().includes(INTUNED_WORKER));
79
- if (intunedServiceWorker) {
80
- return intunedServiceWorker;
81
- }
82
- try {
83
- await context.waitForEvent("serviceworker", {
84
- timeout: 3000
85
- });
86
- } catch (err) {
87
- console.log(`Error accessing service workers (attempt ${attemptCount})`);
88
- }
89
- attemptCount++;
90
- }
91
- console.error("Failed to get intuned worker after 5 attmepts");
92
- return null;
93
- }
94
- async function getIntunedExtensionSettings(captchaSolverSettings) {
95
- const [domain, workspaceId, projectId] = [process.env.FUNCTIONS_DOMAIN, process.env[_constants.WORKSPACE_ID_ENV_VAR_KEY], process.env.INTUNED_INTEGRATION_ID ?? process.env[_constants.PROJECT_ID_ENV_VAR_KEY]];
96
- if (!domain || !workspaceId || !projectId) {
97
- const missingEnvVars = [domain && "FUNCTIONS_DOMAIN", workspaceId && _constants.WORKSPACE_ID_ENV_VAR_KEY, projectId && `INTUNED_INTEGRATION_ID OR ${_constants.PROJECT_ID_ENV_VAR_KEY}`];
98
- throw new Error(`Missing required environment variables: ${missingEnvVars}`);
99
- }
100
- const authentication = (() => {
101
- if (process.env.INTUNED_API_KEY) {
102
- return {
103
- type: "apiKey",
104
- apiKey: process.env.INTUNED_API_KEY
105
- };
106
- }
107
- if (process.env.INTUNED_BASIC_AUTH_USERNAME && process.env.INTUNED_BASIC_AUTH_PASSWORD) {
108
- const credentials = `${process.env.INTUNED_BASIC_AUTH_USERNAME}:${process.env.INTUNED_BASIC_AUTH_PASSWORD}`;
109
- const token = Buffer.from(credentials, "utf-8").toString("base64");
110
- return {
111
- type: "basic",
112
- token
113
- };
114
- }
115
- return {
116
- type: "bearer",
117
- token: _jwtTokenManager.backendFunctionsTokenManager.token
118
- };
119
- })();
120
- const baseUrl = process.env.INTUNED_API_BASE_URL ?? domain;
121
- return {
122
- ...captchaSolverSettings,
123
- workspaceId,
124
- projectId,
125
- baseUrl,
126
- authentication
127
- };
128
- }
129
- async function getIntunedCaptchaSolverSettings() {
130
- if (captchaSolverSettings) {
131
- return captchaSolverSettings;
132
- }
133
- const settings = await (0, _settings.getSettings)();
134
- captchaSolverSettings = await resolveCaptchaSolverSettings(settings.captchaSolver);
135
- return captchaSolverSettings;
136
- }
137
- async function setupIntunedExtension() {
138
- if (!(await isIntunedExtensionEnabled())) {
139
- return;
140
- }
141
- const intunedExtensionPath = getIntunedExtensionPath();
142
- const intunedExtensionSettingsPath = _path.default.join(intunedExtensionPath, INTUNED_EXTENSION_SETTINGS_FILE_NAME);
143
- const captchaSolverSettings = await getIntunedCaptchaSolverSettings();
144
- await (0, _intunedExtensionServer.setupIntunedExtensionServer)(captchaSolverSettings);
145
- const captchaSolverSettingsWithRunContext = await getIntunedExtensionSettings(captchaSolverSettings);
146
- await (0, _promises.writeFile)(intunedExtensionSettingsPath, JSON.stringify(captchaSolverSettingsWithRunContext));
147
- }
@@ -1,24 +0,0 @@
1
- import type * as playwright from "playwright";
2
- import { Captcha, CaptchaCallback, CaptchaStatus } from "./types";
3
- import { CaptchaSolverSettings } from "../settingsSchema";
4
- export declare class ExtensionServer {
5
- private tabs;
6
- private app;
7
- constructor();
8
- private getOrCreateTab;
9
- handleUpsertCaptcha(captcha: Captcha): Promise<void>;
10
- start({ port, host, }: {
11
- port: number;
12
- host?: string;
13
- }): Promise<void>;
14
- stop(): Promise<void>;
15
- getCaptchas(page: playwright.Page, status?: CaptchaStatus): Promise<Captcha[]>;
16
- subscribe(page: playwright.Page, handler: CaptchaCallback, status?: CaptchaStatus): Promise<void>;
17
- unsubscribe(page: playwright.Page, handler: CaptchaCallback, status?: CaptchaStatus): Promise<void>;
18
- removeTab(tabId: number): void;
19
- getTabId(page: playwright.Page): Promise<number>;
20
- }
21
- export declare function getIntunedExtensionServer(): ExtensionServer;
22
- export declare function setupIntunedExtensionServer(captchaSolverSettings?: CaptchaSolverSettings): Promise<void>;
23
- export declare function cleanIntunedExtensionServer(): Promise<void>;
24
- export declare function getTabId(page: playwright.Page): Promise<number>;
@@ -1,178 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ExtensionServer = void 0;
7
- exports.cleanIntunedExtensionServer = cleanIntunedExtensionServer;
8
- exports.getIntunedExtensionServer = getIntunedExtensionServer;
9
- exports.getTabId = getTabId;
10
- exports.setupIntunedExtensionServer = setupIntunedExtensionServer;
11
- var _fastify = _interopRequireDefault(require("fastify"));
12
- var _types = require("./types");
13
- var _extensionsHelpers = require("./extensionsHelpers");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- class TabCaptchaState {
16
- constructor(tabId) {
17
- this.tabId = tabId;
18
- this.captchasById = new Map();
19
- this.subscribers = new Array();
20
- }
21
- subscribe(handler) {
22
- this.subscribers.push(handler);
23
- }
24
- unsubscribe(handler, status) {
25
- const index = this.subscribers.findIndex(subscriber => subscriber.handler === handler && (subscriber.status === status || !status));
26
- if (index !== -1) {
27
- this.subscribers.splice(index, 1);
28
- }
29
- }
30
- getCaptchas() {
31
- return [...this.captchasById.values()];
32
- }
33
- async upsertCaptcha(captcha) {
34
- this.captchasById.set(captcha.id, captcha);
35
- for (const subscriber of this.subscribers) {
36
- if (!subscriber.status || subscriber.status === captcha.status) {
37
- await subscriber.handler(captcha);
38
- }
39
- }
40
- }
41
- }
42
- class ExtensionServer {
43
- app = null;
44
- constructor() {
45
- this.tabs = new Map();
46
- }
47
- getOrCreateTab(tabId) {
48
- const existing = this.tabs.get(tabId);
49
- if (existing) return existing;
50
- const created = new TabCaptchaState(tabId);
51
- this.tabs.set(tabId, created);
52
- return created;
53
- }
54
- async handleUpsertCaptcha(captcha) {
55
- const tab = this.getOrCreateTab(captcha.tabId);
56
- await tab.upsertCaptcha(captcha);
57
- }
58
- async start({
59
- port,
60
- host = "0.0.0.0"
61
- }) {
62
- if (this.app) {
63
- return;
64
- }
65
- this.app = (0, _fastify.default)({
66
- logger: false,
67
- bodyLimit: 1_000_000
68
- });
69
- this.app.post("/state", async (request, reply) => {
70
- try {
71
- const result = _types.captchaSchema.safeParse(request.body);
72
- if (!result.success) {
73
- return reply.code(400).send({
74
- error: "Invalid captcha payload",
75
- details: result.error.flatten().fieldErrors
76
- });
77
- }
78
- await this.handleUpsertCaptcha(result.data);
79
- return reply.code(200).send({});
80
- } catch (error) {
81
- console.error("Error processing captcha state update:", error);
82
- return reply.code(500).send({
83
- error: "Internal server error",
84
- message: error?.message ?? String(error)
85
- });
86
- }
87
- });
88
- this.app.setNotFoundHandler((_request, reply) => {
89
- return reply.code(404).send({
90
- error: "Not found"
91
- });
92
- });
93
- await this.app.listen({
94
- port,
95
- host
96
- });
97
- }
98
- async stop() {
99
- if (!this.app) return;
100
- const toClose = this.app;
101
- this.app = null;
102
- await toClose.close();
103
- }
104
- async getCaptchas(page, status) {
105
- const tabId = await getTabId(page);
106
- const tab = this.tabs.get(tabId);
107
- if (!tab) return [];
108
- const captchas = tab.getCaptchas();
109
- if (!status) return captchas;
110
- return captchas.filter(c => c.status === status && c.tabId === tabId);
111
- }
112
- async subscribe(page, handler, status) {
113
- const tabId = await getTabId(page);
114
- const tab = this.getOrCreateTab(tabId);
115
- tab.subscribe({
116
- handler,
117
- status
118
- });
119
- }
120
- async unsubscribe(page, handler, status) {
121
- const tabId = await getTabId(page);
122
- const tab = this.tabs.get(tabId);
123
- if (!tab) return;
124
- tab.unsubscribe(handler, status);
125
- }
126
- removeTab(tabId) {
127
- this.tabs.delete(tabId);
128
- }
129
- async getTabId(page) {
130
- return await getTabId(page);
131
- }
132
- }
133
- exports.ExtensionServer = ExtensionServer;
134
- let extensionServerSingleton = null;
135
- function getIntunedExtensionServer() {
136
- if (!extensionServerSingleton) {
137
- throw new Error("Intuned Extension Server is not initialized.");
138
- }
139
- return extensionServerSingleton;
140
- }
141
- async function setupIntunedExtensionServer(captchaSolverSettings) {
142
- if (!captchaSolverSettings) {
143
- captchaSolverSettings = await (0, _extensionsHelpers.resolveCaptchaSolverSettings)();
144
- }
145
- if (!extensionServerSingleton) {
146
- extensionServerSingleton = new ExtensionServer();
147
- }
148
- await extensionServerSingleton.start({
149
- port: captchaSolverSettings.port ?? 9000
150
- });
151
- }
152
- async function cleanIntunedExtensionServer() {
153
- if (extensionServerSingleton) {
154
- await extensionServerSingleton.stop();
155
- extensionServerSingleton = null;
156
- }
157
- }
158
- const TAB_ID_CACHE_KEY = "__INTUNED_CACHED_TAB_ID__";
159
- async function getTabId(page) {
160
- const cached = page[TAB_ID_CACHE_KEY];
161
- if (cached !== undefined && typeof cached === "number") {
162
- return cached;
163
- }
164
- let tabId;
165
- try {
166
- tabId = await page.evaluate("window.__INTUNED_TAB_ID__", {
167
- timeout: 100
168
- });
169
- } catch {
170
- await page.waitForFunction("window.__INTUNED_TAB_ID__ !== undefined", {
171
- timeout: 15_000
172
- });
173
- tabId = await page.evaluate("window.__INTUNED_TAB_ID__");
174
- }
175
- const numericTabId = Number(tabId);
176
- page[TAB_ID_CACHE_KEY] = numericTabId;
177
- return numericTabId;
178
- }
@@ -1,212 +0,0 @@
1
- import { z } from "zod";
2
- export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
3
- export type CaptchaType = z.infer<typeof captchaTypeSchema>;
4
- export declare const captchaStatusSchema: z.ZodEnum<["attached", "solving", "solved", "error", "detached"]>;
5
- export type CaptchaStatus = z.infer<typeof captchaStatusSchema>;
6
- export declare const captchaErrorCodeSchema: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
7
- export type CaptchaErrorCode = z.infer<typeof captchaErrorCodeSchema>;
8
- export declare const captchaErrorSchema: z.ZodObject<{
9
- code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
10
- error: z.ZodOptional<z.ZodUnknown>;
11
- }, "strip", z.ZodTypeAny, {
12
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
13
- error?: unknown;
14
- }, {
15
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
16
- error?: unknown;
17
- }>;
18
- export type CaptchaError = z.infer<typeof captchaErrorSchema>;
19
- declare const captchaBaseSchema: z.ZodObject<{
20
- id: z.ZodString;
21
- tabId: z.ZodNumber;
22
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
23
- retryCount: z.ZodOptional<z.ZodNumber>;
24
- }, "strip", z.ZodTypeAny, {
25
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
26
- id: string;
27
- tabId: number;
28
- retryCount?: number | undefined;
29
- }, {
30
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
31
- id: string;
32
- tabId: number;
33
- retryCount?: number | undefined;
34
- }>;
35
- export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
36
- declare const captchaNonErrorSchema: z.ZodObject<{
37
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
38
- id: z.ZodString;
39
- tabId: z.ZodNumber;
40
- retryCount: z.ZodOptional<z.ZodNumber>;
41
- status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
42
- }, "strip", z.ZodTypeAny, {
43
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
44
- status: "attached" | "solving" | "solved" | "detached";
45
- id: string;
46
- tabId: number;
47
- retryCount?: number | undefined;
48
- }, {
49
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
50
- status: "attached" | "solving" | "solved" | "detached";
51
- id: string;
52
- tabId: number;
53
- retryCount?: number | undefined;
54
- }>;
55
- export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
56
- declare const captchaErrorStatusSchema: z.ZodObject<{
57
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
58
- id: z.ZodString;
59
- tabId: z.ZodNumber;
60
- retryCount: z.ZodOptional<z.ZodNumber>;
61
- status: z.ZodLiteral<"error">;
62
- error: z.ZodObject<{
63
- code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
64
- error: z.ZodOptional<z.ZodUnknown>;
65
- }, "strip", z.ZodTypeAny, {
66
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
67
- error?: unknown;
68
- }, {
69
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
70
- error?: unknown;
71
- }>;
72
- }, "strip", z.ZodTypeAny, {
73
- error: {
74
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
75
- error?: unknown;
76
- };
77
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
78
- status: "error";
79
- id: string;
80
- tabId: number;
81
- retryCount?: number | undefined;
82
- }, {
83
- error: {
84
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
85
- error?: unknown;
86
- };
87
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
88
- status: "error";
89
- id: string;
90
- tabId: number;
91
- retryCount?: number | undefined;
92
- }>;
93
- export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
94
- export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
95
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
96
- id: z.ZodString;
97
- tabId: z.ZodNumber;
98
- retryCount: z.ZodOptional<z.ZodNumber>;
99
- status: z.ZodLiteral<"attached">;
100
- }, "strip", z.ZodTypeAny, {
101
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
102
- status: "attached";
103
- id: string;
104
- tabId: number;
105
- retryCount?: number | undefined;
106
- }, {
107
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
108
- status: "attached";
109
- id: string;
110
- tabId: number;
111
- retryCount?: number | undefined;
112
- }>, z.ZodObject<{
113
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
114
- id: z.ZodString;
115
- tabId: z.ZodNumber;
116
- retryCount: z.ZodOptional<z.ZodNumber>;
117
- status: z.ZodLiteral<"solving">;
118
- }, "strip", z.ZodTypeAny, {
119
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
120
- status: "solving";
121
- id: string;
122
- tabId: number;
123
- retryCount?: number | undefined;
124
- }, {
125
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
126
- status: "solving";
127
- id: string;
128
- tabId: number;
129
- retryCount?: number | undefined;
130
- }>, z.ZodObject<{
131
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
132
- id: z.ZodString;
133
- tabId: z.ZodNumber;
134
- retryCount: z.ZodOptional<z.ZodNumber>;
135
- status: z.ZodLiteral<"solved">;
136
- }, "strip", z.ZodTypeAny, {
137
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
138
- status: "solved";
139
- id: string;
140
- tabId: number;
141
- retryCount?: number | undefined;
142
- }, {
143
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
144
- status: "solved";
145
- id: string;
146
- tabId: number;
147
- retryCount?: number | undefined;
148
- }>, z.ZodObject<{
149
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
150
- id: z.ZodString;
151
- tabId: z.ZodNumber;
152
- retryCount: z.ZodOptional<z.ZodNumber>;
153
- status: z.ZodLiteral<"detached">;
154
- }, "strip", z.ZodTypeAny, {
155
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
156
- status: "detached";
157
- id: string;
158
- tabId: number;
159
- retryCount?: number | undefined;
160
- }, {
161
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
162
- status: "detached";
163
- id: string;
164
- tabId: number;
165
- retryCount?: number | undefined;
166
- }>, z.ZodObject<{
167
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
168
- id: z.ZodString;
169
- tabId: z.ZodNumber;
170
- retryCount: z.ZodOptional<z.ZodNumber>;
171
- status: z.ZodLiteral<"error">;
172
- error: z.ZodObject<{
173
- code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
174
- error: z.ZodOptional<z.ZodUnknown>;
175
- }, "strip", z.ZodTypeAny, {
176
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
177
- error?: unknown;
178
- }, {
179
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
180
- error?: unknown;
181
- }>;
182
- }, "strip", z.ZodTypeAny, {
183
- error: {
184
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
185
- error?: unknown;
186
- };
187
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
188
- status: "error";
189
- id: string;
190
- tabId: number;
191
- retryCount?: number | undefined;
192
- }, {
193
- error: {
194
- code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
195
- error?: unknown;
196
- };
197
- type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
198
- status: "error";
199
- id: string;
200
- tabId: number;
201
- retryCount?: number | undefined;
202
- }>]>;
203
- export type Captcha = z.infer<typeof captchaSchema>;
204
- export type CaptchaCallback = (captcha: Captcha) => Promise<void> | void;
205
- export declare class CaptchaSolveError extends Error {
206
- error: CaptchaError;
207
- constructor(message: string, error: CaptchaError);
208
- }
209
- export declare class TimeoutError extends Error {
210
- constructor(message: string);
211
- }
212
- export {};
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.captchaTypeSchema = exports.captchaStatusSchema = exports.captchaSchema = exports.captchaErrorSchema = exports.captchaErrorCodeSchema = exports.TimeoutError = exports.CaptchaSolveError = void 0;
7
- var _zod = require("zod");
8
- const captchaTypeSchema = exports.captchaTypeSchema = _zod.z.enum(["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]);
9
- const captchaStatusSchema = exports.captchaStatusSchema = _zod.z.enum(["attached", "solving", "solved", "error", "detached"]);
10
- const captchaErrorCodeSchema = exports.captchaErrorCodeSchema = _zod.z.enum(["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]);
11
- const captchaErrorSchema = exports.captchaErrorSchema = _zod.z.object({
12
- code: captchaErrorCodeSchema,
13
- error: _zod.z.unknown().optional()
14
- });
15
- const captchaBaseSchema = _zod.z.object({
16
- id: _zod.z.string().min(1),
17
- tabId: _zod.z.number().int().positive(),
18
- type: captchaTypeSchema,
19
- retryCount: _zod.z.number().int().nonnegative().optional()
20
- });
21
- const captchaNonErrorSchema = captchaBaseSchema.extend({
22
- status: captchaStatusSchema.exclude(["error"])
23
- });
24
- const captchaErrorStatusSchema = captchaBaseSchema.extend({
25
- status: _zod.z.literal("error"),
26
- error: captchaErrorSchema
27
- });
28
- const captchaSchema = exports.captchaSchema = _zod.z.discriminatedUnion("status", [captchaBaseSchema.extend({
29
- status: _zod.z.literal("attached")
30
- }), captchaBaseSchema.extend({
31
- status: _zod.z.literal("solving")
32
- }), captchaBaseSchema.extend({
33
- status: _zod.z.literal("solved")
34
- }), captchaBaseSchema.extend({
35
- status: _zod.z.literal("detached")
36
- }), captchaErrorStatusSchema]);
37
- class CaptchaSolveError extends Error {
38
- constructor(message, error) {
39
- super(message);
40
- this.error = error;
41
- this.name = "CaptchaSolveError";
42
- }
43
- }
44
- exports.CaptchaSolveError = CaptchaSolveError;
45
- class TimeoutError extends Error {
46
- constructor(message) {
47
- super(message);
48
- this.name = "TimeoutError";
49
- }
50
- }
51
- exports.TimeoutError = TimeoutError;
@@ -1,2 +0,0 @@
1
- import { ZodError } from "zod/v3";
2
- export declare function formatZodError(zodError: ZodError): string[];