@intuned/runtime-dev 1.3.4-dev.4 → 1.3.4-enhancements.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebTemplate.zip +0 -0
- package/bin/intuned +0 -0
- package/dist/commands/api/run.js +1 -2
- package/dist/commands/auth-sessions/run-check.js +0 -1
- package/dist/commands/auth-sessions/run-create.js +0 -1
- package/dist/commands/common/projectExclusions.js +1 -1
- package/dist/commands/common/tsNodeImport.js +1 -1
- package/dist/commands/common/utils/settings.js +5 -7
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +10 -20
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -7
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +5 -17
- package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
- package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +31 -0
- package/dist/commands/intuned-cli/commands/build.command.js +1 -1
- package/dist/commands/intuned-cli/commands/deploy.command.js +2 -7
- package/dist/commands/intuned-cli/commands/index.d.ts +2 -0
- package/dist/commands/intuned-cli/commands/index.js +22 -0
- package/dist/commands/intuned-cli/commands/init.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +13 -21
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +9 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +5 -1
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +16 -20
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +16 -20
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +16 -20
- package/dist/commands/intuned-cli/commands/save.command.d.ts +3 -2
- package/dist/commands/intuned-cli/commands/save.command.js +6 -10
- package/dist/commands/intuned-cli/commands/types.d.ts +10 -0
- package/dist/commands/intuned-cli/commands/types.js +11 -3
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +128 -10
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +428 -45
- package/dist/commands/intuned-cli/controller/api.d.ts +5 -7
- package/dist/commands/intuned-cli/controller/api.js +16 -7
- package/dist/commands/intuned-cli/controller/authSession.d.ts +18 -7
- package/dist/commands/intuned-cli/controller/authSession.js +153 -24
- package/dist/commands/intuned-cli/controller/save.js +10 -3
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +103 -0
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +40 -0
- package/dist/commands/intuned-cli/helpers/auth.d.ts +7 -2
- package/dist/commands/intuned-cli/helpers/auth.js +38 -23
- package/dist/commands/intuned-cli/helpers/backend.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/backend.js +2 -2
- package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
- package/dist/commands/intuned-cli/helpers/browser.js +57 -0
- package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -1
- package/dist/commands/intuned-cli/helpers/errors.js +0 -22
- package/dist/commands/intuned-cli/helpers/index.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/index.js +22 -0
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +69 -1
- package/dist/commands/intuned-cli/helpers/intunedJson.js +59 -7
- package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/traces.js +32 -0
- package/dist/commands/intuned-cli/helpers/validation.js +5 -3
- package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/wrapper.js +60 -0
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +1 -2
- package/dist/common/playwrightContext.d.ts +1 -0
- package/dist/common/playwrightContext.js +5 -18
- package/dist/common/runApi/types.d.ts +0 -5
- package/dist/common/runApi/types.js +1 -2
- package/dist/common/settingsSchema.d.ts +0 -513
- package/dist/common/settingsSchema.js +2 -40
- package/package.json +4 -1
- package/dist/common/extensionsHelpers.d.ts +0 -15
- package/dist/common/extensionsHelpers.js +0 -84
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.4-
|
|
3
|
+
"version": "1.3.4-enhancements.1",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"fs-extra": "^11.3.0",
|
|
73
73
|
"image-size": "^1.1.1",
|
|
74
74
|
"inquirer": "12.6.0",
|
|
75
|
+
"jsonc-parser": "^3.3.1",
|
|
75
76
|
"jsonwebtoken": "9.0.2",
|
|
76
77
|
"lodash": "4.17.21",
|
|
77
78
|
"milliparsec": "2.3.0",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"prettier": "2.8.0",
|
|
84
85
|
"promptly": "3.2.0",
|
|
85
86
|
"rollup": "3.26.2",
|
|
87
|
+
"smol-toml": "^1.4.2",
|
|
86
88
|
"source-map": "0.7.4",
|
|
87
89
|
"terminal-kit": "^3.1.2",
|
|
88
90
|
"ts-morph": "21.0.1",
|
|
@@ -91,6 +93,7 @@
|
|
|
91
93
|
"typescript": "5.1.6",
|
|
92
94
|
"uuid": "11.1.0",
|
|
93
95
|
"wait-on": "7.2.0",
|
|
96
|
+
"yaml": "2.8.1",
|
|
94
97
|
"zod": "^3.21.4"
|
|
95
98
|
},
|
|
96
99
|
"devDependencies": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as playwright from "playwright";
|
|
2
|
-
import { CaptchaSolverSettings } from "./settingsSchema";
|
|
3
|
-
type CaptchaSolverSettingsWithRunContext = CaptchaSolverSettings & {
|
|
4
|
-
workspaceId: string;
|
|
5
|
-
projectId: string;
|
|
6
|
-
baseUrl: string;
|
|
7
|
-
token?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function buildExtensionsList(): string[];
|
|
10
|
-
export declare function getIntunedExtensionPath(): string;
|
|
11
|
-
export declare function isIntunedExtensionEnabled(): boolean;
|
|
12
|
-
export declare function getIntunedExtensionWorker(context: playwright.BrowserContext): Promise<playwright.Worker | null>;
|
|
13
|
-
export declare function getIntunedExtensionSettings(): Promise<CaptchaSolverSettingsWithRunContext>;
|
|
14
|
-
export declare function setupIntunedExtension(): Promise<void>;
|
|
15
|
-
export {};
|
|
@@ -1,84 +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
|
-
console.log("Getting Intuned worker");
|
|
41
|
-
while (attemptCount < 4) {
|
|
42
|
-
const intunedServiceWorker = context.serviceWorkers().find(serviceWorker => serviceWorker.url().includes(INTUNED_WORKER));
|
|
43
|
-
if (intunedServiceWorker) {
|
|
44
|
-
console.log(`Found Intuned Worker. URL ${intunedServiceWorker.url()}`);
|
|
45
|
-
return intunedServiceWorker;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
console.log(`Worker not found. Awaiting for serviceworker event`);
|
|
49
|
-
await context.waitForEvent("serviceworker", {
|
|
50
|
-
timeout: 3000
|
|
51
|
-
});
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.log(`Error accessing service workers (attempt ${attemptCount})`);
|
|
54
|
-
}
|
|
55
|
-
attemptCount++;
|
|
56
|
-
}
|
|
57
|
-
console.error("Failed to get intuned worker after 5 attmepts");
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
async function getIntunedExtensionSettings() {
|
|
61
|
-
const settings = await (0, _settings.getSettings)();
|
|
62
|
-
const captchaSolverSettings = settings.captchaSolver ?? _settingsSchema.captchaSolverSettingsSchema.parse({});
|
|
63
|
-
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]];
|
|
64
|
-
if (!domain || !workspaceId || !projectId) {
|
|
65
|
-
const missingEnvVars = [domain && "FUNCTIONS_DOMAIN", workspaceId && _constants.WORKSPACE_ID_ENV_VAR_KEY, projectId && `INTUNED_INTEGRATION_ID OR ${_constants.PROJECT_ID_ENV_VAR_KEY}`];
|
|
66
|
-
throw new Error(`Missing required environment variables: ${missingEnvVars}`);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
...captchaSolverSettings,
|
|
70
|
-
baseUrl: domain,
|
|
71
|
-
token: _jwtTokenManager.backendFunctionsTokenManager.token,
|
|
72
|
-
workspaceId,
|
|
73
|
-
projectId
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async function setupIntunedExtension() {
|
|
77
|
-
if (!isIntunedExtensionEnabled()) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const intunedExtensionPath = getIntunedExtensionPath();
|
|
81
|
-
const intunedExtensionSettingsPath = _path.default.join(intunedExtensionPath, INTUNED_EXTENSION_SETTINGS_FILE_NAME);
|
|
82
|
-
const settings = await getIntunedExtensionSettings();
|
|
83
|
-
await (0, _promises.writeFile)(intunedExtensionSettingsPath, JSON.stringify(settings));
|
|
84
|
-
}
|