@intuned/runtime-dev 1.1.6 → 1.1.7-bot-detection

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.
@@ -1,6 +1,6 @@
1
1
  import { StorageState } from "../../common/contextStorageStateHelpers";
2
2
  import { AuthSessionMetadata, AuthSessionType } from "../../common/cli/types";
3
- import * as playwright from "playwright-core";
3
+ import * as playwright from "patchright";
4
4
  export declare function isAuthEnabled(): Promise<boolean>;
5
5
  export declare function getAuthType(): Promise<AuthSessionType>;
6
6
  export declare function ensureRecorderURLs(): Promise<{
@@ -26,7 +26,7 @@ var _tsNodeImport = require("../common/tsNodeImport");
26
26
  var _promptly = require("promptly");
27
27
  var _utils = require("../../common/cli/utils");
28
28
  var _types = require("../../common/cli/types");
29
- var playwright = _interopRequireWildcard(require("playwright-core"));
29
+ var playwright = _interopRequireWildcard(require("patchright"));
30
30
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
31
31
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
32
32
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1,4 +1,4 @@
1
- import { BrowserContext } from "playwright-core";
1
+ import { BrowserContext } from "patchright";
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-core"));
12
+ var playwright = _interopRequireWildcard(require("patchright"));
13
13
  var fs = _interopRequireWildcard(require("fs-extra"));
14
14
  var _fileUtils = require("./utils/fileUtils");
15
15
  var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
@@ -27,7 +27,7 @@ const userCLIScripts = exports.userCLIScripts = {
27
27
  };
28
28
  const tsConfigCli = exports.tsConfigCli = {
29
29
  compilerOptions: {
30
- moduleResolution: "bundler",
30
+ moduleResolution: "node",
31
31
  target: "ES2021",
32
32
  outDir: "./dist",
33
33
  sourceMap: false,
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright";
1
+ import * as playwright from "patchright";
2
2
  interface StorageEntry {
3
3
  name: string;
4
4
  value: string;
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright-core";
1
+ import * as playwright from "patchright";
2
2
  import type { RunApiSession } from "./runApi";
3
3
  interface Proxy {
4
4
  server: string;
@@ -7,7 +7,7 @@ exports.getPlaywrightConstructsForMode = getPlaywrightConstructsForMode;
7
7
  exports.getProductionPlaywrightConstructs = getProductionPlaywrightConstructs;
8
8
  exports.getRemotePlaywrightContext = getRemotePlaywrightContext;
9
9
  exports.loadSessionToContext = loadSessionToContext;
10
- var playwright = _interopRequireWildcard(require("playwright-core"));
10
+ var playwright = _interopRequireWildcard(require("patchright"));
11
11
  var _fsExtra = _interopRequireWildcard(require("fs-extra"));
12
12
  var fs = _fsExtra;
13
13
  var _contextStorageStateHelpers = require("./contextStorageStateHelpers");
@@ -76,9 +76,6 @@ async function getProductionPlaywrightConstructs({
76
76
  });
77
77
  }
78
78
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
79
- await context.addInitScript({
80
- path: assetsFile
81
- });
82
79
  let page = context.pages().at(0);
83
80
  if (page) {
84
81
  const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
@@ -104,15 +101,10 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
104
101
  throw new Error("no context found");
105
102
  }
106
103
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
107
- await context.addInitScript({
108
- path: assetsFile
109
- });
110
104
  const pages = await context.pages();
111
105
  let page = null;
112
106
  if (pages.length > 0) {
113
107
  page = pages[0];
114
- const scriptString = await fs.readFile(assetsFile, "utf8");
115
- await page.evaluate(scriptString);
116
108
  } else {
117
109
  page = await context.newPage();
118
110
  }
@@ -163,7 +155,7 @@ async function loadSessionToContext({
163
155
  await (0, _contextStorageStateHelpers.setStorageState)(context, sessionToLoad);
164
156
  }
165
157
  async function getRemotePlaywrightContext(cdpAddress) {
166
- const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-core")));
158
+ const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("patchright")));
167
159
  let browser = null;
168
160
  if (!cdpAddress) {
169
161
  throw new Error("cdpAddress is required");
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.runAutomationErrorCodes = exports.maxLevelsExceededErrorCode = exports.invalidCheckErrorCode = exports.invalidApiErrorCode = exports.internalInvalidInputErrorCode = exports.automationError = exports.authRequiredErrorCode = exports.authCheckNotFoundErrorCode = exports.authCheckFailedErrorCode = exports.apiNotFoundErrorCode = exports.abortedErrorCode = exports.RunAutomationError = exports.MaxLevelsExceededError = exports.InvalidCheckError = exports.InvalidApiError = exports.InternalInvalidInputError = exports.AutomationError = exports.AuthRequiredError = exports.AuthCheckNotFoundError = exports.AuthCheckFailedError = exports.ApiNotFoundError = exports.AbortedError = void 0;
7
7
  var _runtime = require("../../runtime");
8
- var playwright = _interopRequireWildcard(require("playwright-core"));
8
+ var playwright = _interopRequireWildcard(require("patchright"));
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
11
  const apiNotFoundErrorCode = exports.apiNotFoundErrorCode = "APINotFoundError";
@@ -1,6 +1,6 @@
1
1
  import { Result } from "neverthrow";
2
2
  import { RunAutomationError } from "./errors";
3
- import { Page, BrowserContext } from "playwright-core";
3
+ import { Page, BrowserContext } from "patchright";
4
4
  import { ExtendedRunApiParameters, RunApiResult, RunApiResultWithSessionOk } from "./types";
5
5
  export * from "./types";
6
6
  export * from "./errors";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.1.6",
3
+ "version": "1.1.7-bot-detection",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -83,7 +83,7 @@
83
83
  "minimatch": "10.0.1",
84
84
  "nanoid": "3",
85
85
  "neverthrow": "6.1.0",
86
- "playwright": "1.44.1",
86
+ "patchright": "1.48.2",
87
87
  "playwright-extra": "4.3.6",
88
88
  "prettier": "2.8.0",
89
89
  "promptly": "3.2.0",
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "module": "ESNext",
3
4
  "target": "ES2021",
4
- "lib": ["dom", "es2021"],
5
+ "lib": [
6
+ "dom",
7
+ "es2021"
8
+ ],
5
9
  "resolveJsonModule": true,
6
10
  "esModuleInterop": true,
7
- "moduleResolution": "bundler",
8
- "module": "esnext",
11
+ "moduleResolution": "node",
9
12
  "skipLibCheck": true
10
13
  }
11
- }
14
+ }