@intuned/runtime-dev 1.1.3-windows-version → 1.1.4-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.
Files changed (39) hide show
  1. package/.babelrc +2 -2
  2. package/dist/commands/api/run.js +2 -8
  3. package/dist/commands/auth-sessions/run-check.js +4 -18
  4. package/dist/commands/auth-sessions/run-create.js +1 -2
  5. package/dist/commands/cli-auth-sessions/create.js +1 -1
  6. package/dist/commands/cli-auth-sessions/utils.d.ts +1 -1
  7. package/dist/commands/cli-auth-sessions/utils.js +3 -2
  8. package/dist/commands/common/browserUtils.d.ts +1 -1
  9. package/dist/commands/common/browserUtils.js +1 -1
  10. package/dist/commands/common/getFirstLineNumber.js +4 -2
  11. package/dist/commands/deploy/utils.js +2 -1
  12. package/dist/commands/init/utils.js +7 -1
  13. package/dist/commands/interface/run.js +6 -7
  14. package/dist/commands/run-api-cli/utils.js +6 -6
  15. package/dist/common/assets/browser_scripts.js +2143 -2509
  16. package/dist/common/asyncLocalStorage/index.d.ts +2 -1
  17. package/dist/common/cli/types.d.ts +1 -1
  18. package/dist/common/contextStorageStateHelpers.d.ts +1 -1
  19. package/dist/common/getPlaywrightConstructs.d.ts +1 -1
  20. package/dist/common/getPlaywrightConstructs.js +12 -10
  21. package/dist/common/jwtTokenManager.js +5 -3
  22. package/dist/common/runApi/errors.d.ts +1 -1
  23. package/dist/common/runApi/errors.js +6 -5
  24. package/dist/common/runApi/index.d.ts +1 -1
  25. package/dist/common/runApi/index.js +11 -8
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +0 -6
  28. package/dist/runtime/executionHelpers.test.js +4 -3
  29. package/dist/runtime/export.d.ts +0 -16
  30. package/dist/runtime/extendPayload.js +1 -1
  31. package/dist/runtime/extendTimeout.js +7 -0
  32. package/dist/runtime/index.d.ts +0 -1
  33. package/dist/runtime/index.js +0 -7
  34. package/package.json +4 -2
  35. package/template.tsconfig.json +7 -4
  36. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
  37. package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
  38. package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
  39. package/dist/runtime/getAuthSessionParameters.js +0 -20
@@ -5,11 +5,12 @@ export declare const asyncLocalStorage: AsyncLocalStorage<InternalRunInfo>;
5
5
  export declare function runWithContext<R, TArgs extends any[]>(contextData: InternalRunInfo, callback: (...args: TArgs) => R, ...args: TArgs): R;
6
6
  interface TimeoutInfo {
7
7
  extendTimeoutCallback?: () => Promise<void>;
8
+ timeoutDuration?: number;
9
+ timeoutTimestamp?: number;
8
10
  }
9
11
  export interface InternalRunInfo extends RunInfo {
10
12
  extendedPayloads: Payload[];
11
13
  timeoutInfo?: TimeoutInfo;
12
- getAuthSessionParameters?: () => Promise<any>;
13
14
  }
14
15
  export declare function getExecutionContext(): InternalRunInfo | undefined;
15
16
  export {};
@@ -1,5 +1,5 @@
1
1
  export declare const templateIds: string[];
2
- export type TemplateId = typeof templateIds[number];
2
+ export type TemplateId = (typeof templateIds)[number];
3
3
  /**
4
4
  * A simple, tree-like structure to describe the contents of a folder to be mounted.
5
5
  *
@@ -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";
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"));
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");
@@ -43,12 +43,19 @@ async function getProductionPlaywrightConstructs({
43
43
  if (headless) {
44
44
  extraArgs.push("--headless=new");
45
45
  }
46
+ const executablePath = playwright.chromium.executablePath();
47
+ const chromium127Path = executablePath.replace("chromium-1117", "chromium-1124");
48
+ const isChrome127There = await (0, _fsExtra.exists)(chromium127Path);
49
+ const userAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${isChrome127There ? 127 : 125}.0.0.0 Safari/537.36`;
46
50
  const userDataDir = await createUserDirWithPreferences();
47
51
  const context = await playwright.chromium.launchPersistentContext(userDataDir, {
48
52
  headless,
49
- viewport: null,
53
+ ignoreDefaultArgs: [...getChromiumLaunchArgsToIgnore(), "--headless"],
50
54
  proxy,
51
- downloadsPath
55
+ executablePath: isChrome127There ? chromium127Path : executablePath,
56
+ args: extraArgs,
57
+ downloadsPath,
58
+ userAgent
52
59
  });
53
60
  context.once("close", async () => {
54
61
  try {
@@ -69,9 +76,6 @@ async function getProductionPlaywrightConstructs({
69
76
  });
70
77
  }
71
78
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
72
- await context.addInitScript({
73
- path: assetsFile
74
- });
75
79
  let page = context.pages().at(0);
76
80
  if (page) {
77
81
  const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
@@ -84,6 +88,7 @@ async function getProductionPlaywrightConstructs({
84
88
  context
85
89
  };
86
90
  }
91
+ const getChromiumLaunchArgsToIgnore = () => ["--disable-field-trial-config", "--disable-background-networking", "--enable-features=NetworkService,NetworkServiceInProcess", "--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows", "--disable-back-forward-cache", "--disable-breakpad", "--disable-client-side-phishing-detection", "--disable-component-extensions-with-background-pages", "--disable-component-update", "--no-default-browser-check", "--disable-default-apps", "--disable-dev-shm-usage", "--disable-extensions", "--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,TranslateUI", "--allow-pre-commit-input", "--disable-hang-monitor", "--disable-ipc-flooding-protection", "--disable-prompt-on-repost", "--disable-renderer-backgrounding", "--force-color-profile=srgb", "--metrics-recording-only", "--no-first-run", "--enable-automation", "--password-store=basic", "--use-mock-keychain", "--no-service-autorun", "--export-tagged-pdf", "--enable-use-zoom-for-dsf=false"];
87
92
  async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
88
93
  if (mode == "playwright-standalone") {
89
94
  if (!cdpAddress) {
@@ -96,9 +101,6 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
96
101
  throw new Error("no context found");
97
102
  }
98
103
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
99
- await context.addInitScript({
100
- path: assetsFile
101
- });
102
104
  const pages = await context.pages();
103
105
  let page = null;
104
106
  if (pages.length > 0) {
@@ -155,7 +157,7 @@ async function loadSessionToContext({
155
157
  await (0, _contextStorageStateHelpers.setStorageState)(context, sessionToLoad);
156
158
  }
157
159
  async function getRemotePlaywrightContext(cdpAddress) {
158
- const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright")));
160
+ const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-core")));
159
161
  let browser = null;
160
162
  if (!cdpAddress) {
161
163
  throw new Error("cdpAddress is required");
@@ -36,7 +36,8 @@ class JwtTokenManager {
36
36
  return Math.max(timeToRefresh, timeWindow);
37
37
  }
38
38
  async scheduleTokenRefresh() {
39
- if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring") return;
39
+ var _process$env$RUN_ENVI;
40
+ if (((_process$env$RUN_ENVI = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI === void 0 ? void 0 : _process$env$RUN_ENVI.toLowerCase()) !== "authoring") return;
40
41
  const timeToRefresh = this.timeToRefresh;
41
42
  if (timeToRefresh === undefined) return;
42
43
  if (this.tokenRefreshTimeout) clearTimeout(this.tokenRefreshTimeout);
@@ -50,7 +51,8 @@ class JwtTokenManager {
50
51
  }, timeToRefresh);
51
52
  }
52
53
  async refreshToken() {
53
- if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring") return;
54
+ var _process$env$RUN_ENVI2;
55
+ if (((_process$env$RUN_ENVI2 = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI2 === void 0 ? void 0 : _process$env$RUN_ENVI2.toLowerCase()) !== "authoring") return;
54
56
  const res = await this.fetchWithToken(this.refreshTokenPath, {
55
57
  method: "GET"
56
58
  });
@@ -63,7 +65,7 @@ class JwtTokenManager {
63
65
  if (newToken) this._token = newToken;
64
66
  }
65
67
  fetchWithToken(...[input, init]) {
66
- const headers = new Headers(init?.headers);
68
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
67
69
  headers.set("Authorization", `Bearer ${this.token}`);
68
70
  return (0, _crossFetch.default)(input, {
69
71
  ...init,
@@ -10,7 +10,7 @@ export declare const maxLevelsExceededErrorCode = "MaxLevelsExceededError";
10
10
  export declare const automationError = "AutomationError";
11
11
  export declare const internalInvalidInputErrorCode = "InternalInvalidInputError";
12
12
  export declare const runAutomationErrorCodes: readonly ["APINotFoundError", "InvalidAPIError", "InvalidCheckError", "AbortedError", "AuthRequiredError", "AuthCheckNotFoundError", "AuthCheckFailedError", "MaxLevelsExceededError", "AutomationError", "InternalInvalidInputError"];
13
- export type RunAutomationErrorCode = typeof runAutomationErrorCodes[number];
13
+ export type RunAutomationErrorCode = (typeof runAutomationErrorCodes)[number];
14
14
  export declare abstract class RunAutomationError<T = any> {
15
15
  code: RunAutomationErrorCode;
16
16
  statusCode: number;
@@ -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";
@@ -22,10 +22,11 @@ const runAutomationErrorCodes = exports.runAutomationErrorCodes = [apiNotFoundEr
22
22
  class RunAutomationError {
23
23
  wrapped = false;
24
24
  get json() {
25
+ var _this$cause;
25
26
  return {
26
27
  code: this.code,
27
28
  details: this.details,
28
- cause: this.cause?.json
29
+ cause: (_this$cause = this.cause) === null || _this$cause === void 0 ? void 0 : _this$cause.json
29
30
  };
30
31
  }
31
32
  }
@@ -135,10 +136,10 @@ class AutomationError extends RunAutomationError {
135
136
  };
136
137
  }
137
138
  this.statusCode = 500;
138
- this.message = `[${error?.name ?? error}] ${error?.message}`;
139
+ this.message = `[${(error === null || error === void 0 ? void 0 : error.name) ?? error}] ${error === null || error === void 0 ? void 0 : error.message}`;
139
140
  this.details = {
140
- name: error?.name,
141
- message: error?.message
141
+ name: error === null || error === void 0 ? void 0 : error.name,
142
+ message: error === null || error === void 0 ? void 0 : error.message
142
143
  };
143
144
  }
144
145
  }
@@ -1,6 +1,6 @@
1
1
  import { Result } from "neverthrow";
2
2
  import { RunAutomationError } from "./errors";
3
- import { Page, BrowserContext } from "playwright";
3
+ import { Page, BrowserContext } from "patchright";
4
4
  import { ExtendedRunApiParameters, RunApiResult, RunApiResultWithSessionOk } from "./types";
5
5
  export * from "./types";
6
6
  export * from "./errors";
@@ -80,15 +80,17 @@ async function* runApiGenerator({
80
80
  return;
81
81
  }
82
82
  try {
83
- await context?.tracing.stop({
83
+ var _context;
84
+ await ((_context = context) === null || _context === void 0 ? void 0 : _context.tracing.stop({
84
85
  path: tracing.filePath
85
- });
86
+ }));
86
87
  } catch (error) {
87
- console.log(errorMessage, error?.message);
88
+ console.log(errorMessage, error === null || error === void 0 ? void 0 : error.message);
88
89
  await (0, _fsExtra.remove)(tracing.filePath);
89
90
  }
90
91
  }
91
92
  async function* runAutomation() {
93
+ var _getExecutionContext;
92
94
  let page;
93
95
  const validatedModuleResult = await importUsingImportFunction(automationFunction.name, importFunction);
94
96
  if (validatedModuleResult.isErr()) {
@@ -96,7 +98,7 @@ async function* runApiGenerator({
96
98
  }
97
99
  const importedModule = validatedModuleResult.value;
98
100
  let checkFn;
99
- if (auth?.runCheck) {
101
+ if (auth !== null && auth !== void 0 && auth.runCheck) {
100
102
  if (!auth.session) {
101
103
  return (0, _neverthrow.err)(new _errors.AuthRequiredError());
102
104
  }
@@ -128,7 +130,7 @@ async function* runApiGenerator({
128
130
  headless,
129
131
  proxy,
130
132
  downloadsPath,
131
- storageState: auth?.session
133
+ storageState: auth === null || auth === void 0 ? void 0 : auth.session
132
134
  }));
133
135
  } else {
134
136
  const {
@@ -138,7 +140,7 @@ async function* runApiGenerator({
138
140
  ({
139
141
  page,
140
142
  context
141
- } = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth?.session));
143
+ } = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth === null || auth === void 0 ? void 0 : auth.session));
142
144
  }
143
145
  if (tracing.enabled) {
144
146
  await context.tracing.start({
@@ -183,7 +185,7 @@ async function* runApiGenerator({
183
185
  }
184
186
  return (0, _neverthrow.ok)({
185
187
  result,
186
- extendedPayloads: (0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads,
188
+ extendedPayloads: (_getExecutionContext = (0, _asyncLocalStorage.getExecutionContext)()) === null || _getExecutionContext === void 0 ? void 0 : _getExecutionContext.extendedPayloads,
187
189
  session: retrieveSession ? await (0, _contextStorageStateHelpers.getStorageState)(context) : undefined
188
190
  });
189
191
  }
@@ -204,10 +206,11 @@ async function* runApiGenerator({
204
206
  } catch (error) {
205
207
  return (0, _neverthrow.err)(new _errors.AutomationError(error));
206
208
  } finally {
209
+ var _context2;
207
210
  await saveTraceIfNeeded({
208
211
  errorMessage: "failed to save trace"
209
212
  });
210
- await context?.close();
213
+ await ((_context2 = context) === null || _context2 === void 0 ? void 0 : _context2.close());
211
214
  if (downloadsPath !== undefined) {
212
215
  await fs.remove(downloadsPath);
213
216
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, getAuthSessionParameters, } from "./runtime";
1
+ export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime";
2
2
  export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
3
3
  export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
4
4
  export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
package/dist/index.js CHANGED
@@ -21,12 +21,6 @@ Object.defineProperty(exports, "extendTimeout", {
21
21
  return _runtime.extendTimeout;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "getAuthSessionParameters", {
25
- enumerable: true,
26
- get: function () {
27
- return _runtime.getAuthSessionParameters;
28
- }
29
- });
30
24
  Object.defineProperty(exports, "getDownloadDirectoryPath", {
31
25
  enumerable: true,
32
26
  get: function () {
@@ -24,12 +24,13 @@ var _enums = require("./enums");
24
24
  runId: "test-run-id",
25
25
  extendedPayloads: []
26
26
  }, () => {
27
- (0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([]);
27
+ var _getExecutionContext, _getExecutionContext2;
28
+ (0, _vitest.expect)((_getExecutionContext = (0, _asyncLocalStorage.getExecutionContext)()) === null || _getExecutionContext === void 0 ? void 0 : _getExecutionContext.extendedPayloads).toEqual([]);
28
29
  (0, _.extendPayload)({
29
30
  api: "test-api",
30
31
  parameters: {}
31
32
  });
32
- (0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([{
33
+ (0, _vitest.expect)((_getExecutionContext2 = (0, _asyncLocalStorage.getExecutionContext)()) === null || _getExecutionContext2 === void 0 ? void 0 : _getExecutionContext2.extendedPayloads).toEqual([{
33
34
  api: "test-api",
34
35
  parameters: {}
35
36
  }]);
@@ -46,7 +47,7 @@ var _enums = require("./enums");
46
47
  parameters: {}
47
48
  });
48
49
  const context = (0, _asyncLocalStorage.getExecutionContext)();
49
- (0, _vitest.expect)(context?.extendedPayloads).toHaveLength(4);
50
+ (0, _vitest.expect)(context === null || context === void 0 ? void 0 : context.extendedPayloads).toHaveLength(4);
50
51
  });
51
52
  });
52
53
  });
@@ -99,7 +99,6 @@ export interface RunInfo {
99
99
  jobRunId?: string;
100
100
  queueId?: string;
101
101
  proxy?: string;
102
- authSessionId?: string;
103
102
  }
104
103
 
105
104
  /**
@@ -201,18 +200,3 @@ export declare function requestMultipleChoice(
201
200
  * ```
202
201
  */
203
202
  export declare function requestOTP(message: string): unknown;
204
-
205
- /**
206
- * Retrieves the parameters for the authentication session currently being used.
207
- *
208
- * @returns {AuthSessionParameters} An object containing the parameters for the current authentication session.
209
- *
210
- * @example
211
- * ```typescript getAuthSessionParameters
212
- * import { getAuthSessionParameters } from "@intuned/sdk/runtime"
213
- *
214
- * const authSessionParams = getAuthSessionParameters();
215
- * console.log(authSessionParams);
216
- * ```
217
- */
218
- export declare function getAuthSessionParameters(): Promise<any>;
@@ -16,6 +16,6 @@ function extendPayload(payload) {
16
16
  context.extendedPayloads = [...items];
17
17
  return;
18
18
  }
19
- context?.extendedPayloads.push(...items);
19
+ context === null || context === void 0 || context.extendedPayloads.push(...items);
20
20
  (0, _extendTimeout.extendTimeout)();
21
21
  }
@@ -17,6 +17,13 @@ function extendTimeout() {
17
17
  if (!timeoutInfo) {
18
18
  return;
19
19
  }
20
+ if (timeoutInfo.timeoutTimestamp !== undefined && timeoutInfo.timeoutDuration !== undefined) {
21
+ const newTimeoutStamp = Date.now() + timeoutInfo.timeoutDuration;
22
+ if (newTimeoutStamp - timeoutInfo.timeoutTimestamp < _DEBOUNCE_TIME) {
23
+ return;
24
+ }
25
+ timeoutInfo.timeoutTimestamp = newTimeoutStamp;
26
+ }
20
27
  if (timeoutInfo.extendTimeoutCallback !== undefined) {
21
28
  void timeoutInfo.extendTimeoutCallback().catch(() => undefined);
22
29
  }
@@ -1,6 +1,5 @@
1
1
  export { extendPayload } from "./extendPayload";
2
2
  export { extendTimeout } from "./extendTimeout";
3
- export { getAuthSessionParameters } from "./getAuthSessionParameters";
4
3
  export { runInfo } from "./runInfo";
5
4
  export { RunError } from "./RunError";
6
5
  export { requestMultipleChoice, requestOTP } from "./requestMoreInfo";
@@ -21,12 +21,6 @@ Object.defineProperty(exports, "extendTimeout", {
21
21
  return _extendTimeout.extendTimeout;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "getAuthSessionParameters", {
25
- enumerable: true,
26
- get: function () {
27
- return _getAuthSessionParameters.getAuthSessionParameters;
28
- }
29
- });
30
24
  Object.defineProperty(exports, "getDownloadDirectoryPath", {
31
25
  enumerable: true,
32
26
  get: function () {
@@ -53,7 +47,6 @@ Object.defineProperty(exports, "runInfo", {
53
47
  });
54
48
  var _extendPayload = require("./extendPayload");
55
49
  var _extendTimeout = require("./extendTimeout");
56
- var _getAuthSessionParameters = require("./getAuthSessionParameters");
57
50
  var _runInfo = require("./runInfo");
58
51
  var _RunError = require("./RunError");
59
52
  var _requestMoreInfo = require("./requestMoreInfo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.1.3-windows-version",
3
+ "version": "1.1.4-bot-detection",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -69,6 +69,7 @@
69
69
  "@types/node": "20.4.1",
70
70
  "applicationinsights": "2.9.2",
71
71
  "babel-plugin-dynamic-import-node": "2.3.3",
72
+ "boxen": "8.0.1",
72
73
  "chalk": "^4.1.2",
73
74
  "commander": "^11.0.0",
74
75
  "cross-fetch": "^4.0.0",
@@ -82,6 +83,7 @@
82
83
  "minimatch": "10.0.1",
83
84
  "nanoid": "3",
84
85
  "neverthrow": "6.1.0",
86
+ "patchright": "1.48.2",
85
87
  "playwright-extra": "4.3.6",
86
88
  "prettier": "2.8.0",
87
89
  "promptly": "3.2.0",
@@ -129,6 +131,6 @@
129
131
  "vitest": "^1.1.3"
130
132
  },
131
133
  "peerDependencies": {
132
- "playwright": "*"
134
+ "@intuned/runtime": "*"
133
135
  }
134
136
  }
@@ -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
+ }
@@ -1 +0,0 @@
1
- export declare function getAuthSessionParameters(): Promise<any>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAuthSessionParameters = getAuthSessionParameters;
7
- var _isNil = _interopRequireDefault(require("lodash/isNil"));
8
- var _asyncLocalStorage = require("../asyncLocalStorage");
9
- var _zod = require("zod");
10
- var _jwtTokenManager = require("../jwtTokenManager");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- const authSessionParametersResponseSchema = _zod.z.object({
13
- parameters: _zod.z.any().refine(v => v !== undefined)
14
- });
15
- async function getAuthSessionParameters() {
16
- const context = (0, _asyncLocalStorage.getExecutionContext)();
17
- if (!context) {
18
- throw new Error("getAuthSessionParameters failed due to an internal error (context was not found).");
19
- }
20
- const authSessionId = context.authSessionId;
21
- if ((0, _isNil.default)(authSessionId)) {
22
- throw new Error("Auth sessions are not enabled");
23
- }
24
- const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`auth-session/${authSessionId}/parameters`, {
25
- method: "GET"
26
- });
27
- const body = await response.text();
28
- if (!response.ok) {
29
- throw new Error(`getAuthSessionParameters failed with status ${response.status}: ${body}`);
30
- }
31
- let json;
32
- try {
33
- json = JSON.parse(body);
34
- } catch (e) {
35
- throw new Error(`Expected JSON response, but got ${body}`);
36
- }
37
- return authSessionParametersResponseSchema.parse(json).parameters;
38
- }
@@ -1 +0,0 @@
1
- export declare function getAuthSessionParameters(): Promise<any>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAuthSessionParameters = getAuthSessionParameters;
7
- var _asyncLocalStorage = require("../common/asyncLocalStorage");
8
- async function getAuthSessionParameters() {
9
- const context = (0, _asyncLocalStorage.getExecutionContext)();
10
- if (!context) {
11
- throw new Error("getAuthSessionParameters failed due to an internal error (context was not found).");
12
- }
13
- const {
14
- getAuthSessionParameters
15
- } = context;
16
- if (!getAuthSessionParameters) {
17
- throw new Error("getAuthSessionParameters failed due to an internal error (helper was not found on context).");
18
- }
19
- return await getAuthSessionParameters();
20
- }