@intuned/runtime-dev 1.1.8-bot-detection → 1.2.0-dev-peer

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 "patchright";
3
+ import * as playwright from "playwright-core";
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("patchright"));
29
+ var playwright = _interopRequireWildcard(require("playwright-core"));
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 "patchright";
1
+ import { BrowserContext } from "playwright-core";
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("patchright"));
12
+ var playwright = _interopRequireWildcard(require("playwright-core"));
13
13
  var fs = _interopRequireWildcard(require("fs-extra"));
14
14
  var _fileUtils = require("./utils/fileUtils");
15
15
  var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
@@ -1,4 +1,4 @@
1
- import * as playwright from "patchright";
1
+ import * as playwright from "playwright";
2
2
  interface StorageEntry {
3
3
  name: string;
4
4
  value: string;
@@ -1,4 +1,4 @@
1
- import * as playwright from "patchright";
1
+ import * as playwright from "playwright-core";
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("patchright"));
10
+ var playwright = _interopRequireWildcard(require("playwright-core"));
11
11
  var _fsExtra = _interopRequireWildcard(require("fs-extra"));
12
12
  var fs = _fsExtra;
13
13
  var _contextStorageStateHelpers = require("./contextStorageStateHelpers");
@@ -76,6 +76,9 @@ 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
+ });
79
82
  let page = context.pages().at(0);
80
83
  if (page) {
81
84
  const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
@@ -101,10 +104,15 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
101
104
  throw new Error("no context found");
102
105
  }
103
106
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
107
+ await context.addInitScript({
108
+ path: assetsFile
109
+ });
104
110
  const pages = await context.pages();
105
111
  let page = null;
106
112
  if (pages.length > 0) {
107
113
  page = pages[0];
114
+ const scriptString = await fs.readFile(assetsFile, "utf8");
115
+ await page.evaluate(scriptString);
108
116
  } else {
109
117
  page = await context.newPage();
110
118
  }
@@ -155,7 +163,7 @@ async function loadSessionToContext({
155
163
  await (0, _contextStorageStateHelpers.setStorageState)(context, sessionToLoad);
156
164
  }
157
165
  async function getRemotePlaywrightContext(cdpAddress) {
158
- const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("patchright")));
166
+ const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-core")));
159
167
  let browser = null;
160
168
  if (!cdpAddress) {
161
169
  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("patchright"));
8
+ var playwright = _interopRequireWildcard(require("playwright-core"));
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 "patchright";
3
+ import { Page, BrowserContext } from "playwright-core";
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.8-bot-detection",
3
+ "version": "1.2.0-dev-peer",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -83,8 +83,6 @@
83
83
  "minimatch": "10.0.1",
84
84
  "nanoid": "3",
85
85
  "neverthrow": "6.1.0",
86
- "patchright": "1.52.4",
87
- "playwright-extra": "4.3.6",
88
86
  "prettier": "2.8.0",
89
87
  "promptly": "3.2.0",
90
88
  "rollup": "3.26.2",
@@ -131,6 +129,6 @@
131
129
  "vitest": "^1.1.3"
132
130
  },
133
131
  "peerDependencies": {
134
- "@intuned/runtime": "*"
132
+ "playwright": "*"
135
133
  }
136
134
  }