@intuned/runtime-dev 1.3.18-interface.10 → 1.3.18-interface.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/interface/run.js +20 -32
- package/dist/common/runApi/index.js +18 -30
- package/package.json +2 -2
|
@@ -398,8 +398,8 @@ var require_interfaceClient = __commonJS({
|
|
|
398
398
|
exports2.SocketClient = SocketClient;
|
|
399
399
|
SocketClient.LENGTH_HEADER_LENGTH = 4;
|
|
400
400
|
var UnixSocketClient2 = class extends SocketClient {
|
|
401
|
-
constructor(
|
|
402
|
-
super(net.createConnection(
|
|
401
|
+
constructor(path3) {
|
|
402
|
+
super(net.createConnection(path3));
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
405
|
exports2.UnixSocketClient = UnixSocketClient2;
|
|
@@ -647,9 +647,9 @@ var backendFunctionsTokenManager = new JwtTokenManager(
|
|
|
647
647
|
`refreshBackendFunctionsToken`
|
|
648
648
|
);
|
|
649
649
|
backendFunctionsTokenManager.token = process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
|
|
650
|
-
function callBackendFunctionWithToken(
|
|
650
|
+
function callBackendFunctionWithToken(path3, init) {
|
|
651
651
|
return backendFunctionsTokenManager.fetchWithToken(
|
|
652
|
-
`${backendFunctionsTokenManager.backendFunctionsBaseUrl}/${
|
|
652
|
+
`${backendFunctionsTokenManager.backendFunctionsBaseUrl}/${path3}`,
|
|
653
653
|
init
|
|
654
654
|
);
|
|
655
655
|
}
|
|
@@ -887,8 +887,8 @@ function getIntunedExtensionPath() {
|
|
|
887
887
|
return process.env.INTUNED_EXTENSION_PATH;
|
|
888
888
|
}
|
|
889
889
|
async function isIntunedExtensionEnabled() {
|
|
890
|
-
const
|
|
891
|
-
if (!
|
|
890
|
+
const path3 = getIntunedExtensionPath();
|
|
891
|
+
if (!path3) {
|
|
892
892
|
return false;
|
|
893
893
|
}
|
|
894
894
|
const captchaSolverSettings2 = await getIntunedCaptchaSolverSettings();
|
|
@@ -1144,11 +1144,11 @@ function getDownloadDirectoryPath() {
|
|
|
1144
1144
|
if (!context) {
|
|
1145
1145
|
throw new Error("ExecutionContext not found");
|
|
1146
1146
|
}
|
|
1147
|
-
const
|
|
1148
|
-
(0, import_fs_extra.ensureDirSync)(
|
|
1147
|
+
const path3 = `/tmp/downloads/${context.runId}`;
|
|
1148
|
+
(0, import_fs_extra.ensureDirSync)(path3, {
|
|
1149
1149
|
mode: 1533
|
|
1150
1150
|
});
|
|
1151
|
-
return
|
|
1151
|
+
return path3;
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
1154
|
// src/common/runApi/index.ts
|
|
@@ -1237,7 +1237,6 @@ async function getStorageState(context) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
1239
|
// src/common/playwrightContext.ts
|
|
1240
|
-
var import_path3 = __toESM(require("path"));
|
|
1241
1240
|
var fs3 = __toESM(require("fs-extra"));
|
|
1242
1241
|
var import_neverthrow5 = require("neverthrow");
|
|
1243
1242
|
|
|
@@ -1248,27 +1247,27 @@ var import_neverthrow3 = require("neverthrow");
|
|
|
1248
1247
|
var import_neverthrow2 = require("neverthrow");
|
|
1249
1248
|
var import_runtime_interface = __toESM(require_dist());
|
|
1250
1249
|
async function importUsingImportFunction({
|
|
1251
|
-
path:
|
|
1250
|
+
path: path3,
|
|
1252
1251
|
allowGenerators = true,
|
|
1253
1252
|
importFunction
|
|
1254
1253
|
}) {
|
|
1255
1254
|
try {
|
|
1256
|
-
const importedResult = await importFunction(
|
|
1255
|
+
const importedResult = await importFunction(path3);
|
|
1257
1256
|
if (importedResult.isErr()) {
|
|
1258
1257
|
if (importedResult.error.type === "not_found") {
|
|
1259
|
-
return (0, import_neverthrow2.err)(new import_runtime_interface.ApiNotFoundError(
|
|
1258
|
+
return (0, import_neverthrow2.err)(new import_runtime_interface.ApiNotFoundError(path3));
|
|
1260
1259
|
}
|
|
1261
1260
|
return (0, import_neverthrow2.err)(new import_runtime_interface.AutomationError(importedResult.error.error));
|
|
1262
1261
|
}
|
|
1263
1262
|
const imported = importedResult.value;
|
|
1264
1263
|
if (!imported || !imported.default || !imported.default.constructor) {
|
|
1265
|
-
return (0, import_neverthrow2.err)(new import_runtime_interface.InvalidApiError(`${
|
|
1264
|
+
return (0, import_neverthrow2.err)(new import_runtime_interface.InvalidApiError(`${path3} does not have a default export`));
|
|
1266
1265
|
}
|
|
1267
1266
|
if (imported.default.constructor.name === "AsyncGeneratorFunction") {
|
|
1268
1267
|
if (!allowGenerators) {
|
|
1269
1268
|
return (0, import_neverthrow2.err)(
|
|
1270
1269
|
new import_runtime_interface.InvalidApiError(
|
|
1271
|
-
`${
|
|
1270
|
+
`${path3} default export must be an async function`
|
|
1272
1271
|
)
|
|
1273
1272
|
);
|
|
1274
1273
|
}
|
|
@@ -1287,7 +1286,7 @@ async function importUsingImportFunction({
|
|
|
1287
1286
|
return (0, import_neverthrow2.ok)(imported.default);
|
|
1288
1287
|
}
|
|
1289
1288
|
return (0, import_neverthrow2.err)(
|
|
1290
|
-
new import_runtime_interface.InvalidApiError(`${
|
|
1289
|
+
new import_runtime_interface.InvalidApiError(`${path3} default export must be an async function`)
|
|
1291
1290
|
);
|
|
1292
1291
|
} catch (error) {
|
|
1293
1292
|
return (0, import_neverthrow2.err)(new import_runtime_interface.AutomationError(error));
|
|
@@ -1560,10 +1559,6 @@ async function getHeadlessUserAgent({
|
|
|
1560
1559
|
|
|
1561
1560
|
// src/common/playwrightContext.ts
|
|
1562
1561
|
var import_runtime_interface3 = __toESM(require_dist());
|
|
1563
|
-
var browserScriptsFile = import_path3.default.join(
|
|
1564
|
-
__dirname,
|
|
1565
|
-
"./assets/browser_scripts.js"
|
|
1566
|
-
);
|
|
1567
1562
|
async function withPlaywrightContext({
|
|
1568
1563
|
cdpAddress,
|
|
1569
1564
|
cdpTargetId,
|
|
@@ -1674,11 +1669,11 @@ async function loadSessionToContext({
|
|
|
1674
1669
|
// src/common/formatZodError.ts
|
|
1675
1670
|
function formatZodError(zodError) {
|
|
1676
1671
|
const formattedErrors = zodError.errors.map((error) => {
|
|
1677
|
-
const
|
|
1672
|
+
const path3 = error.path.map((segment) => {
|
|
1678
1673
|
return typeof segment === "number" ? `[${segment}]` : segment;
|
|
1679
1674
|
}).join(".");
|
|
1680
|
-
if (
|
|
1681
|
-
return `${
|
|
1675
|
+
if (path3) {
|
|
1676
|
+
return `${path3} is invalid - ${error.message}`;
|
|
1682
1677
|
}
|
|
1683
1678
|
return error.message;
|
|
1684
1679
|
});
|
|
@@ -1779,13 +1774,6 @@ async function runApi({
|
|
|
1779
1774
|
intunedContext.getAuthSessionParameters = async () => auth.parameters;
|
|
1780
1775
|
}
|
|
1781
1776
|
}
|
|
1782
|
-
const scriptContent = await fs4.readFile(browserScriptsFile, "utf-8");
|
|
1783
|
-
await context.addInitScript({
|
|
1784
|
-
content: scriptContent
|
|
1785
|
-
});
|
|
1786
|
-
for (const page2 of context.pages()) {
|
|
1787
|
-
await page2.evaluate(scriptContent);
|
|
1788
|
-
}
|
|
1789
1777
|
if (tracing.enabled) {
|
|
1790
1778
|
await context.tracing.start({
|
|
1791
1779
|
screenshots: true,
|
|
@@ -2057,9 +2045,9 @@ function getProxyUrlFromRunOptions(runOptions) {
|
|
|
2057
2045
|
url.password = proxy.password;
|
|
2058
2046
|
return url.toString();
|
|
2059
2047
|
}
|
|
2060
|
-
var _defaultImport = async (
|
|
2048
|
+
var _defaultImport = async (path3) => {
|
|
2061
2049
|
try {
|
|
2062
|
-
const imported = await Promise.resolve().then(() => require(`${process.cwd()}/${
|
|
2050
|
+
const imported = await Promise.resolve().then(() => require(`${process.cwd()}/${path3}`));
|
|
2063
2051
|
return (0, import_neverthrow7.ok)(imported);
|
|
2064
2052
|
} catch (e) {
|
|
2065
2053
|
if ("code" in e && e.code === "MODULE_NOT_FOUND" || e.code === "ERR_MODULE_NOT_FOUND") {
|
|
@@ -398,8 +398,8 @@ var require_interfaceClient = __commonJS({
|
|
|
398
398
|
exports2.SocketClient = SocketClient;
|
|
399
399
|
SocketClient.LENGTH_HEADER_LENGTH = 4;
|
|
400
400
|
var UnixSocketClient = class extends SocketClient {
|
|
401
|
-
constructor(
|
|
402
|
-
super(net.createConnection(
|
|
401
|
+
constructor(path3) {
|
|
402
|
+
super(net.createConnection(path3));
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
405
|
exports2.UnixSocketClient = UnixSocketClient;
|
|
@@ -644,9 +644,9 @@ var backendFunctionsTokenManager = new JwtTokenManager(
|
|
|
644
644
|
`refreshBackendFunctionsToken`
|
|
645
645
|
);
|
|
646
646
|
backendFunctionsTokenManager.token = process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
|
|
647
|
-
function callBackendFunctionWithToken(
|
|
647
|
+
function callBackendFunctionWithToken(path3, init) {
|
|
648
648
|
return backendFunctionsTokenManager.fetchWithToken(
|
|
649
|
-
`${backendFunctionsTokenManager.backendFunctionsBaseUrl}/${
|
|
649
|
+
`${backendFunctionsTokenManager.backendFunctionsBaseUrl}/${path3}`,
|
|
650
650
|
init
|
|
651
651
|
);
|
|
652
652
|
}
|
|
@@ -884,8 +884,8 @@ function getIntunedExtensionPath() {
|
|
|
884
884
|
return process.env.INTUNED_EXTENSION_PATH;
|
|
885
885
|
}
|
|
886
886
|
async function isIntunedExtensionEnabled() {
|
|
887
|
-
const
|
|
888
|
-
if (!
|
|
887
|
+
const path3 = getIntunedExtensionPath();
|
|
888
|
+
if (!path3) {
|
|
889
889
|
return false;
|
|
890
890
|
}
|
|
891
891
|
const captchaSolverSettings2 = await getIntunedCaptchaSolverSettings();
|
|
@@ -1141,11 +1141,11 @@ function getDownloadDirectoryPath() {
|
|
|
1141
1141
|
if (!context) {
|
|
1142
1142
|
throw new Error("ExecutionContext not found");
|
|
1143
1143
|
}
|
|
1144
|
-
const
|
|
1145
|
-
(0, import_fs_extra.ensureDirSync)(
|
|
1144
|
+
const path3 = `/tmp/downloads/${context.runId}`;
|
|
1145
|
+
(0, import_fs_extra.ensureDirSync)(path3, {
|
|
1146
1146
|
mode: 1533
|
|
1147
1147
|
});
|
|
1148
|
-
return
|
|
1148
|
+
return path3;
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
// src/common/runApi/index.ts
|
|
@@ -1234,7 +1234,6 @@ async function getStorageState(context) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
1236
|
// src/common/playwrightContext.ts
|
|
1237
|
-
var import_path3 = __toESM(require("path"));
|
|
1238
1237
|
var fs3 = __toESM(require("fs-extra"));
|
|
1239
1238
|
var import_neverthrow5 = require("neverthrow");
|
|
1240
1239
|
|
|
@@ -1245,27 +1244,27 @@ var import_neverthrow3 = require("neverthrow");
|
|
|
1245
1244
|
var import_neverthrow2 = require("neverthrow");
|
|
1246
1245
|
var import_runtime_interface = __toESM(require_dist());
|
|
1247
1246
|
async function importUsingImportFunction({
|
|
1248
|
-
path:
|
|
1247
|
+
path: path3,
|
|
1249
1248
|
allowGenerators = true,
|
|
1250
1249
|
importFunction
|
|
1251
1250
|
}) {
|
|
1252
1251
|
try {
|
|
1253
|
-
const importedResult = await importFunction(
|
|
1252
|
+
const importedResult = await importFunction(path3);
|
|
1254
1253
|
if (importedResult.isErr()) {
|
|
1255
1254
|
if (importedResult.error.type === "not_found") {
|
|
1256
|
-
return (0, import_neverthrow2.err)(new import_runtime_interface.ApiNotFoundError(
|
|
1255
|
+
return (0, import_neverthrow2.err)(new import_runtime_interface.ApiNotFoundError(path3));
|
|
1257
1256
|
}
|
|
1258
1257
|
return (0, import_neverthrow2.err)(new import_runtime_interface.AutomationError(importedResult.error.error));
|
|
1259
1258
|
}
|
|
1260
1259
|
const imported = importedResult.value;
|
|
1261
1260
|
if (!imported || !imported.default || !imported.default.constructor) {
|
|
1262
|
-
return (0, import_neverthrow2.err)(new import_runtime_interface.InvalidApiError(`${
|
|
1261
|
+
return (0, import_neverthrow2.err)(new import_runtime_interface.InvalidApiError(`${path3} does not have a default export`));
|
|
1263
1262
|
}
|
|
1264
1263
|
if (imported.default.constructor.name === "AsyncGeneratorFunction") {
|
|
1265
1264
|
if (!allowGenerators) {
|
|
1266
1265
|
return (0, import_neverthrow2.err)(
|
|
1267
1266
|
new import_runtime_interface.InvalidApiError(
|
|
1268
|
-
`${
|
|
1267
|
+
`${path3} default export must be an async function`
|
|
1269
1268
|
)
|
|
1270
1269
|
);
|
|
1271
1270
|
}
|
|
@@ -1284,7 +1283,7 @@ async function importUsingImportFunction({
|
|
|
1284
1283
|
return (0, import_neverthrow2.ok)(imported.default);
|
|
1285
1284
|
}
|
|
1286
1285
|
return (0, import_neverthrow2.err)(
|
|
1287
|
-
new import_runtime_interface.InvalidApiError(`${
|
|
1286
|
+
new import_runtime_interface.InvalidApiError(`${path3} default export must be an async function`)
|
|
1288
1287
|
);
|
|
1289
1288
|
} catch (error) {
|
|
1290
1289
|
return (0, import_neverthrow2.err)(new import_runtime_interface.AutomationError(error));
|
|
@@ -1557,10 +1556,6 @@ async function getHeadlessUserAgent({
|
|
|
1557
1556
|
|
|
1558
1557
|
// src/common/playwrightContext.ts
|
|
1559
1558
|
var import_runtime_interface3 = __toESM(require_dist());
|
|
1560
|
-
var browserScriptsFile = import_path3.default.join(
|
|
1561
|
-
__dirname,
|
|
1562
|
-
"./assets/browser_scripts.js"
|
|
1563
|
-
);
|
|
1564
1559
|
async function withPlaywrightContext({
|
|
1565
1560
|
cdpAddress,
|
|
1566
1561
|
cdpTargetId,
|
|
@@ -1671,11 +1666,11 @@ async function loadSessionToContext({
|
|
|
1671
1666
|
// src/common/formatZodError.ts
|
|
1672
1667
|
function formatZodError(zodError) {
|
|
1673
1668
|
const formattedErrors = zodError.errors.map((error) => {
|
|
1674
|
-
const
|
|
1669
|
+
const path3 = error.path.map((segment) => {
|
|
1675
1670
|
return typeof segment === "number" ? `[${segment}]` : segment;
|
|
1676
1671
|
}).join(".");
|
|
1677
|
-
if (
|
|
1678
|
-
return `${
|
|
1672
|
+
if (path3) {
|
|
1673
|
+
return `${path3} is invalid - ${error.message}`;
|
|
1679
1674
|
}
|
|
1680
1675
|
return error.message;
|
|
1681
1676
|
});
|
|
@@ -1776,13 +1771,6 @@ async function runApi({
|
|
|
1776
1771
|
intunedContext.getAuthSessionParameters = async () => auth.parameters;
|
|
1777
1772
|
}
|
|
1778
1773
|
}
|
|
1779
|
-
const scriptContent = await fs4.readFile(browserScriptsFile, "utf-8");
|
|
1780
|
-
await context.addInitScript({
|
|
1781
|
-
content: scriptContent
|
|
1782
|
-
});
|
|
1783
|
-
for (const page2 of context.pages()) {
|
|
1784
|
-
await page2.evaluate(scriptContent);
|
|
1785
|
-
}
|
|
1786
1774
|
if (tracing.enabled) {
|
|
1787
1775
|
await context.tracing.start({
|
|
1788
1776
|
screenshots: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.18-interface.
|
|
3
|
+
"version": "1.3.18-interface.11",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"packageManager": "yarn@4.12.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
|
|
77
77
|
"intuned": "vite-node ./src/commands/intuned-cli/main.ts",
|
|
78
78
|
"intuned-get-headless-user-agent": "vite-node ./src/commands/get-headless-user-agent.ts",
|
|
79
|
-
"build": "tsup && cp -r ./src/common/assets dist/common/assets",
|
|
79
|
+
"build": "rm -rf ./dist && tsup && cp -r ./src/common/assets dist/common/assets",
|
|
80
80
|
"test": "vitest run",
|
|
81
81
|
"test:watch": "vitest",
|
|
82
82
|
"e2e": "yarn playwright test --config ./playwright.config.ts",
|