@intuned/runtime 1.3.14 → 1.3.16

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.
@@ -5,5 +5,6 @@ export { persistentStore } from "./persistentStore";
5
5
  export { getAuthSessionParameters } from "./getAuthSessionParameters";
6
6
  export { runInfo } from "./runInfo";
7
7
  export { RunError } from "./RunError";
8
+ export { waitForCaptchaSolve, withWaitForCaptchaSolve, onCaptchaEvent, onceCaptchaEvent, removeCaptchaEventListener, pauseCaptchaSolver, resumeCaptchaSolver, } from "./captcha";
8
9
  export { getAiGatewayConfig } from "./getAiGatewayConfig";
9
10
  export { getDownloadDirectoryPath } from "./downloadDirectory";
@@ -45,18 +45,60 @@ Object.defineProperty(exports, "getDownloadDirectoryPath", {
45
45
  return _downloadDirectory.getDownloadDirectoryPath;
46
46
  }
47
47
  });
48
+ Object.defineProperty(exports, "onCaptchaEvent", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _captcha.onCaptchaEvent;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "onceCaptchaEvent", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _captcha.onceCaptchaEvent;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "pauseCaptchaSolver", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _captcha.pauseCaptchaSolver;
64
+ }
65
+ });
48
66
  Object.defineProperty(exports, "persistentStore", {
49
67
  enumerable: true,
50
68
  get: function () {
51
69
  return _persistentStore.persistentStore;
52
70
  }
53
71
  });
72
+ Object.defineProperty(exports, "removeCaptchaEventListener", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _captcha.removeCaptchaEventListener;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "resumeCaptchaSolver", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _captcha.resumeCaptchaSolver;
82
+ }
83
+ });
54
84
  Object.defineProperty(exports, "runInfo", {
55
85
  enumerable: true,
56
86
  get: function () {
57
87
  return _runInfo.runInfo;
58
88
  }
59
89
  });
90
+ Object.defineProperty(exports, "waitForCaptchaSolve", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _captcha.waitForCaptchaSolve;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "withWaitForCaptchaSolve", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _captcha.withWaitForCaptchaSolve;
100
+ }
101
+ });
60
102
  var _extendPayload = require("./extendPayload");
61
103
  var _extendTimeout = require("./extendTimeout");
62
104
  var _attemptStore = require("./attemptStore");
@@ -64,5 +106,6 @@ var _persistentStore = require("./persistentStore");
64
106
  var _getAuthSessionParameters = require("./getAuthSessionParameters");
65
107
  var _runInfo = require("./runInfo");
66
108
  var _RunError = require("./RunError");
109
+ var _captcha = require("./captcha");
67
110
  var _getAiGatewayConfig = require("./getAiGatewayConfig");
68
111
  var _downloadDirectory = require("./downloadDirectory");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -70,6 +70,7 @@
70
70
  "commander": "14.0.0",
71
71
  "cross-fetch": "^4.0.0",
72
72
  "dotenv": "^16.3.1",
73
+ "fastify": "4.29.1",
73
74
  "fs-extra": "^11.3.0",
74
75
  "image-size": "^1.1.1",
75
76
  "jsonc-parser": "^3.3.1",
@@ -1,8 +0,0 @@
1
- import * as playwright from "playwright";
2
- import { CaptchaSolverSettingsWithRunContext } from "./settingsSchema";
3
- export declare function buildExtensionsList(): string[];
4
- export declare function getIntunedExtensionPath(): string;
5
- export declare function isIntunedExtensionEnabled(): boolean;
6
- export declare function getIntunedExtensionWorker(context: playwright.BrowserContext): Promise<playwright.Worker | null>;
7
- export declare function getIntunedExtensionSettings(): Promise<CaptchaSolverSettingsWithRunContext>;
8
- export declare function setupIntunedExtension(): Promise<void>;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildExtensionsList = buildExtensionsList;
7
- exports.getIntunedExtensionPath = getIntunedExtensionPath;
8
- exports.getIntunedExtensionSettings = getIntunedExtensionSettings;
9
- exports.getIntunedExtensionWorker = getIntunedExtensionWorker;
10
- exports.isIntunedExtensionEnabled = isIntunedExtensionEnabled;
11
- exports.setupIntunedExtension = setupIntunedExtension;
12
- var _settings = require("../commands/common/utils/settings");
13
- var _settingsSchema = require("./settingsSchema");
14
- var _constants = require("./constants");
15
- var _jwtTokenManager = require("./jwtTokenManager");
16
- var _path = _interopRequireDefault(require("path"));
17
- var _promises = require("fs/promises");
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
- const INTUNED_WORKER = "intunedWorker.js";
20
- const INTUNED_EXTENSION_SETTINGS_FILE_NAME = "intunedSettings.json";
21
- function buildExtensionsList() {
22
- const extensionsList = [];
23
- if (isIntunedExtensionEnabled()) {
24
- const intunedExtensionPath = getIntunedExtensionPath();
25
- extensionsList.push(intunedExtensionPath);
26
- }
27
- return extensionsList;
28
- }
29
- function getIntunedExtensionPath() {
30
- return process.env.INTUNED_EXTENSION_PATH;
31
- }
32
- function isIntunedExtensionEnabled() {
33
- return !!getIntunedExtensionPath();
34
- }
35
- async function getIntunedExtensionWorker(context) {
36
- if (!isIntunedExtensionEnabled()) {
37
- return null;
38
- }
39
- let attemptCount = 0;
40
- while (attemptCount < 4) {
41
- const intunedServiceWorker = context.serviceWorkers().find(serviceWorker => serviceWorker.url().includes(INTUNED_WORKER));
42
- if (intunedServiceWorker) {
43
- return intunedServiceWorker;
44
- }
45
- try {
46
- await context.waitForEvent("serviceworker", {
47
- timeout: 3000
48
- });
49
- } catch (err) {
50
- console.log(`Error accessing service workers (attempt ${attemptCount})`);
51
- }
52
- attemptCount++;
53
- }
54
- console.error("Failed to get intuned worker after 5 attmepts");
55
- return null;
56
- }
57
- async function getIntunedExtensionSettings() {
58
- const settings = await (0, _settings.getSettings)();
59
- 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]];
60
- if (!domain || !workspaceId || !projectId) {
61
- const missingEnvVars = [domain && "FUNCTIONS_DOMAIN", workspaceId && _constants.WORKSPACE_ID_ENV_VAR_KEY, projectId && `INTUNED_INTEGRATION_ID OR ${_constants.PROJECT_ID_ENV_VAR_KEY}`];
62
- throw new Error(`Missing required environment variables: ${missingEnvVars}`);
63
- }
64
- return {
65
- ...(settings.captchaSolver ?? _settingsSchema.captchaSolverSettingsSchema.parse({})),
66
- workspaceId,
67
- projectId,
68
- baseUrl: domain,
69
- token: _jwtTokenManager.backendFunctionsTokenManager.token
70
- };
71
- }
72
- async function setupIntunedExtension() {
73
- if (!isIntunedExtensionEnabled()) {
74
- return;
75
- }
76
- const intunedExtensionPath = getIntunedExtensionPath();
77
- const intunedExtensionSettingsPath = _path.default.join(intunedExtensionPath, INTUNED_EXTENSION_SETTINGS_FILE_NAME);
78
- const settings = await getIntunedExtensionSettings();
79
- await (0, _promises.writeFile)(intunedExtensionSettingsPath, JSON.stringify(settings));
80
- }