@intuned/runtime-dev 1.1.5-dev-52 → 1.1.5-fingerprint.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/.babelrc +2 -2
- package/dist/commands/api/run.js +2 -2
- package/dist/commands/cli-auth-sessions/create.js +1 -1
- package/dist/commands/cli-auth-sessions/utils.js +1 -2
- package/dist/commands/common/browserUtils.d.ts +1 -1
- package/dist/commands/common/browserUtils.js +1 -1
- package/dist/commands/common/getFirstLineNumber.js +2 -4
- package/dist/commands/deploy/utils.js +1 -2
- package/dist/commands/init/utils.js +1 -7
- package/dist/commands/interface/run.js +5 -6
- package/dist/commands/run-api-cli/utils.js +6 -6
- package/dist/common/assets/browser_scripts.js +2509 -2143
- package/dist/common/assets/nopecha-extension/background.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/awscaptcha.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/funcaptcha.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/geetest.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/lemincaptcha.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/perimeterx.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/recaptcha.js +2 -0
- package/dist/common/assets/nopecha-extension/captcha/textcaptcha.js +1 -0
- package/dist/common/assets/nopecha-extension/captcha/turnstile.js +1 -0
- package/dist/common/assets/nopecha-extension/eventhook/loader.js +1 -0
- package/dist/common/assets/nopecha-extension/eventhook.js +1 -0
- package/dist/common/assets/nopecha-extension/icon/128.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/128g.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/16.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/16g.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/32.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/32g.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/48.png +0 -0
- package/dist/common/assets/nopecha-extension/icon/48g.png +0 -0
- package/dist/common/assets/nopecha-extension/lib/selector.js +1 -0
- package/dist/common/assets/nopecha-extension/locate.js +76 -0
- package/dist/common/assets/nopecha-extension/manifest.json +59 -0
- package/dist/common/assets/nopecha-extension/pages/funcaptcha-demo.js +1 -0
- package/dist/common/assets/nopecha-extension/pages/integrate.js +1 -0
- package/dist/common/assets/nopecha-extension/pages/setup.js +1 -0
- package/dist/common/assets/nopecha-extension/popup.css +1 -0
- package/dist/common/assets/nopecha-extension/popup.html +19 -0
- package/dist/common/assets/nopecha-extension/popup.js +2 -0
- package/dist/common/assets/nopecha-extension/setup.html +18 -0
- package/dist/common/cli/constants.d.ts +1 -0
- package/dist/common/cli/constants.js +2 -1
- package/dist/common/getPlaywrightConstructs.d.ts +1 -1
- package/dist/common/getPlaywrightConstructs.js +13 -11
- package/dist/common/jwtTokenManager.js +3 -5
- package/dist/common/runApi/errors.js +4 -5
- package/dist/common/runApi/index.d.ts +1 -1
- package/dist/common/runApi/index.js +8 -11
- package/dist/runtime/executionHelpers.test.js +3 -4
- package/dist/runtime/export.d.ts +15 -0
- package/dist/runtime/extendPayload.js +1 -1
- package/package.json +3 -2
package/.babelrc
CHANGED
package/dist/commands/api/run.js
CHANGED
|
@@ -96,7 +96,7 @@ async function executeCLI(apiName, mode, inputData, options) {
|
|
|
96
96
|
_Logger.logger.info("This will only take an effect if this API run was part of a job.");
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
_commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").option("--
|
|
99
|
+
_commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used auth session").argument("[apiName]", "name of the api", "default").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone", "playwright-headless"]).default("playwright-standalone").argOptional()).action(async (apiName, mode, options) => {
|
|
100
100
|
let inputData = null;
|
|
101
101
|
if (options.input) {
|
|
102
102
|
inputData = await fs.readJSON(options.input);
|
|
@@ -106,7 +106,7 @@ _commander.program.description("run the user function in the cli for testing pur
|
|
|
106
106
|
inputData = {};
|
|
107
107
|
}
|
|
108
108
|
let authSessionParametersJson = undefined;
|
|
109
|
-
if (!(0, _isNil.default)(options
|
|
109
|
+
if (!(0, _isNil.default)(options?.authSessionParameters)) {
|
|
110
110
|
authSessionParametersJson = JSON.parse(options.authSessionParameters);
|
|
111
111
|
}
|
|
112
112
|
await (0, _asyncLocalStorage.runWithContext)({
|
|
@@ -32,7 +32,7 @@ _commander.program.description("Create an auth session").argument("[auth-session
|
|
|
32
32
|
if (!createApiExists) {
|
|
33
33
|
throw new Error("Auth session create API not implemented, please create it in the auth sessions specified directory");
|
|
34
34
|
}
|
|
35
|
-
const authSessionInput = (await (0, _utils2.loadParameters)(options
|
|
35
|
+
const authSessionInput = (await (0, _utils2.loadParameters)(options?.input)) ?? {};
|
|
36
36
|
const session = await (0, _utils.runCreateApi)(authSessionInput);
|
|
37
37
|
if (!session) {
|
|
38
38
|
console.error(_chalk.default.red("Failed to create auth session."));
|
|
@@ -32,9 +32,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
32
32
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
33
33
|
async function isAuthEnabled() {
|
|
34
34
|
try {
|
|
35
|
-
var _intunedJson$authSess;
|
|
36
35
|
const intunedJson = await fs.readJSON(_path.default.join(process.cwd(), "Intuned.json"));
|
|
37
|
-
return Boolean(intunedJson
|
|
36
|
+
return Boolean(intunedJson?.authSessions?.enabled);
|
|
38
37
|
} catch (error) {
|
|
39
38
|
return false;
|
|
40
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BrowserContext } from "playwright
|
|
1
|
+
import { BrowserContext } from "playwright";
|
|
2
2
|
export declare const REMOTE_DEBUGGING_PORT = 9222;
|
|
3
3
|
export declare const getChromiumLaunchArgs: () => string[];
|
|
4
4
|
export declare function startOrRestartBrowser(): Promise<void>;
|
|
@@ -9,7 +9,7 @@ exports.saveSession = saveSession;
|
|
|
9
9
|
exports.saveSessionFromOpenedBrowser = saveSessionFromOpenedBrowser;
|
|
10
10
|
exports.startOrRestartBrowser = startOrRestartBrowser;
|
|
11
11
|
var _child_process = require("child_process");
|
|
12
|
-
var playwright = _interopRequireWildcard(require("playwright
|
|
12
|
+
var playwright = _interopRequireWildcard(require("playwright"));
|
|
13
13
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
14
14
|
var _fileUtils = require("./utils/fileUtils");
|
|
15
15
|
var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
|
|
@@ -32,10 +32,9 @@ function compileTypeScript(apiFilePath) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
function findFirstExecutableLine(sourceFile) {
|
|
35
|
-
var _defaultExportSymbol$;
|
|
36
35
|
let functionBody;
|
|
37
36
|
const defaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
38
|
-
const defaultExportDeclaration = defaultExportSymbol
|
|
37
|
+
const defaultExportDeclaration = defaultExportSymbol?.getDeclarations()?.[0];
|
|
39
38
|
if (defaultExportDeclaration) {
|
|
40
39
|
if (defaultExportDeclaration.getKind() === _tsMorph.ts.SyntaxKind.FunctionDeclaration) {
|
|
41
40
|
functionBody = defaultExportDeclaration.getBody();
|
|
@@ -45,9 +44,8 @@ function findFirstExecutableLine(sourceFile) {
|
|
|
45
44
|
const expression = exportAssignment.getExpression();
|
|
46
45
|
if (!expression) continue;
|
|
47
46
|
if (expression.getKind() === _tsMorph.ts.SyntaxKind.Identifier || expression.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || expression.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction) {
|
|
48
|
-
var _sourceFile$getVariab;
|
|
49
47
|
const identifier = expression.getText();
|
|
50
|
-
const possiblyExportedFunction = sourceFile.getFunction(identifier) ||
|
|
48
|
+
const possiblyExportedFunction = sourceFile.getFunction(identifier) || sourceFile.getVariableStatement(identifier)?.getDescendants().find(node => node.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || node.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction);
|
|
51
49
|
if (possiblyExportedFunction) {
|
|
52
50
|
functionBody = possiblyExportedFunction.getBody();
|
|
53
51
|
break;
|
|
@@ -228,13 +228,12 @@ const validateIntunedProject = async () => {
|
|
|
228
228
|
name: "package.json",
|
|
229
229
|
check: async () => {
|
|
230
230
|
try {
|
|
231
|
-
var _packageJson$dependen;
|
|
232
231
|
const packageJsonPath = path.join(currentDirectoryToDeploy, "package.json");
|
|
233
232
|
await fs.exists(packageJsonPath);
|
|
234
233
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, {
|
|
235
234
|
encoding: "utf-8"
|
|
236
235
|
}));
|
|
237
|
-
const userCodePlaywrightVersion =
|
|
236
|
+
const userCodePlaywrightVersion = packageJson.dependencies?.playwright;
|
|
238
237
|
if (userCodePlaywrightVersion !== _constants.CURRENT_PLAYWRIGHT_VERSION) {
|
|
239
238
|
return {
|
|
240
239
|
isValid: false,
|
|
@@ -15,7 +15,6 @@ var _types = require("../../common/cli/types");
|
|
|
15
15
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
16
|
var _inquirer = _interopRequireDefault(require("inquirer"));
|
|
17
17
|
var _path = _interopRequireDefault(require("path"));
|
|
18
|
-
var _boxen = _interopRequireDefault(require("boxen"));
|
|
19
18
|
var _projectExclusions = _interopRequireDefault(require("../common/projectExclusions"));
|
|
20
19
|
var _constants = require("../../common/cli/constants");
|
|
21
20
|
var _cliReadme = require("../../common/cli/cliReadme");
|
|
@@ -139,12 +138,7 @@ async function scaffoldProject(templateId, isTargetDirectoryEmpty) {
|
|
|
139
138
|
await prepareCLITemplate(codeTree);
|
|
140
139
|
await mountFiles(cwd, codeTree);
|
|
141
140
|
console.log(_chalk.default.green("✓ Project files created"));
|
|
142
|
-
console.log(
|
|
143
|
-
padding: 1,
|
|
144
|
-
margin: 1,
|
|
145
|
-
borderStyle: "round",
|
|
146
|
-
borderColor: "green"
|
|
147
|
-
}));
|
|
141
|
+
console.log(_chalk.default.cyan(`\n🎉 Project initialized successfully!`), _chalk.default.yellow(`\n\nRun ${_chalk.default.bold("yarn")} to install dependencies and start coding!`));
|
|
148
142
|
}
|
|
149
143
|
async function fetchProjectTemplate(templateId) {
|
|
150
144
|
const baseUrl = (0, _utils.getBaseUrl)();
|
|
@@ -29,7 +29,8 @@ const startRunApiSchema = _zod.default.object({
|
|
|
29
29
|
jobId: _zod.default.string().optional(),
|
|
30
30
|
jobRunId: _zod.default.string().optional(),
|
|
31
31
|
runId: _zod.default.string().optional(),
|
|
32
|
-
queueId: _zod.default.string().optional()
|
|
32
|
+
queueId: _zod.default.string().optional(),
|
|
33
|
+
authSessionId: _zod.default.string().optional()
|
|
33
34
|
}).optional()
|
|
34
35
|
})
|
|
35
36
|
});
|
|
@@ -66,14 +67,12 @@ function runAutomationCLI(importFunction) {
|
|
|
66
67
|
let generator = null;
|
|
67
68
|
const abortController = new AbortController();
|
|
68
69
|
client.on("error", err => {
|
|
69
|
-
|
|
70
|
-
void ((_generator = generator) === null || _generator === void 0 ? void 0 : _generator.throw(err).catch(() => undefined));
|
|
70
|
+
void generator?.throw(err).catch(() => undefined);
|
|
71
71
|
});
|
|
72
72
|
const interruptSignalHandler = async () => {
|
|
73
|
-
var _generator2;
|
|
74
73
|
abortController.abort();
|
|
75
74
|
await (0, _promises.setTimeout)(60_000);
|
|
76
|
-
void
|
|
75
|
+
void generator?.throw(new Error("Interrupted")).catch(() => undefined);
|
|
77
76
|
client.end();
|
|
78
77
|
process.exit(1);
|
|
79
78
|
};
|
|
@@ -214,7 +213,7 @@ function runAutomationCLI(importFunction) {
|
|
|
214
213
|
_commander.program.parse(process.argv);
|
|
215
214
|
}
|
|
216
215
|
function getProxyUrlFromRunOptions(runOptions) {
|
|
217
|
-
if (
|
|
216
|
+
if (runOptions?.environment !== "standalone") return undefined;
|
|
218
217
|
const proxy = runOptions.proxy;
|
|
219
218
|
if (!proxy) return undefined;
|
|
220
219
|
const url = new URL(proxy.server);
|
|
@@ -62,10 +62,10 @@ async function writeResultToFile(runId, result, payloadToAppend) {
|
|
|
62
62
|
}
|
|
63
63
|
async function runApiViaCLI(apiName, inputData, options) {
|
|
64
64
|
let authSessionPathToUse = null;
|
|
65
|
-
if (options
|
|
65
|
+
if (options?.authSession) {
|
|
66
66
|
const {
|
|
67
67
|
authSessionInstanceStoragePath
|
|
68
|
-
} = await (0, _utils.retrieveAuthSessionInstance)(options
|
|
68
|
+
} = await (0, _utils.retrieveAuthSessionInstance)(options?.authSession, true);
|
|
69
69
|
authSessionPathToUse = authSessionInstanceStoragePath;
|
|
70
70
|
}
|
|
71
71
|
if (authSessionPathToUse) {
|
|
@@ -82,17 +82,17 @@ async function runApiViaCLI(apiName, inputData, options) {
|
|
|
82
82
|
}
|
|
83
83
|
const {
|
|
84
84
|
metadata
|
|
85
|
-
} = await (0, _utils.retrieveAuthSessionInstance)(options
|
|
86
|
-
if (
|
|
85
|
+
} = await (0, _utils.retrieveAuthSessionInstance)(options?.authSession);
|
|
86
|
+
if (metadata?.authSessionType === "MANUAL") {
|
|
87
87
|
throw new Error("Expired Auth session is recorder-based, please provide a new one or refresh it manually");
|
|
88
88
|
}
|
|
89
|
-
const authSessionInput =
|
|
89
|
+
const authSessionInput = metadata?.authSessionInput ?? {};
|
|
90
90
|
try {
|
|
91
91
|
const refresehAuthSessionInstance = await (0, _utils.runCreateApiViaCLI)(authSessionInput);
|
|
92
92
|
if (!refresehAuthSessionInstance) {
|
|
93
93
|
throw new Error("Failed to refresh auth session");
|
|
94
94
|
}
|
|
95
|
-
await (0, _utils.storeAuthSessionInstance)(refresehAuthSessionInstance, options
|
|
95
|
+
await (0, _utils.storeAuthSessionInstance)(refresehAuthSessionInstance, options?.authSession, authSessionInput);
|
|
96
96
|
const checkResult = await (0, _utils.runCheckApiViaCLI)(authSessionPathToUse);
|
|
97
97
|
if (!checkResult) {
|
|
98
98
|
throw new Error("Failed to refresh auth session");
|