@intuned/runtime-dev 1.3.17-source.0 → 1.3.18-dev.2
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 +6 -0
- package/CHANGELOG.md +1 -1
- package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
- package/InterfaceTemplate/index.playwright.ts +1 -1
- package/bin/intuned +0 -0
- package/bin/intuned-interface +7 -0
- package/dist/commands/api/run.js +3 -3
- package/dist/commands/auth-sessions/run-check.js +3 -3
- package/dist/commands/auth-sessions/run-create.js +3 -3
- package/dist/commands/build.js +1 -3
- package/dist/commands/common/browserUtils.d.ts +3 -3
- package/dist/commands/common/browserUtils.js +3 -4
- package/dist/commands/common/getFirstLineNumber.test.js +1 -2
- package/dist/commands/common/tsNodeImport.d.ts +1 -1
- package/dist/commands/common/tsNodeImport.js +1 -2
- package/dist/commands/common/utils/fileUtils.js +1 -2
- package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
- package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
- package/dist/commands/common/utils/template.js +1 -2
- package/dist/commands/interface/run.js +23 -49
- package/dist/commands/intuned-cli/commands/deploy.command.js +2 -2
- package/dist/commands/intuned-cli/commands/provision.command.d.ts +2 -2
- package/dist/commands/intuned-cli/commands/provision.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +8 -1
- package/dist/commands/intuned-cli/commands/types.d.ts +9 -1
- package/dist/commands/intuned-cli/commands/types.js +7 -3
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +24 -14
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +128 -66
- package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/api.js +3 -3
- package/dist/commands/intuned-cli/controller/authSession.d.ts +16 -16
- package/dist/commands/intuned-cli/controller/authSession.js +22 -11
- package/dist/commands/intuned-cli/controller/build.js +1 -2
- package/dist/commands/intuned-cli/controller/deploy.js +1 -2
- package/dist/commands/intuned-cli/controller/index.js +1 -2
- package/dist/commands/intuned-cli/controller/provision.js +1 -2
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +44 -5
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +3 -3
- package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/auth.js +2 -2
- package/dist/commands/intuned-cli/helpers/browser.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/browser.js +40 -5
- package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.js +2 -2
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
- package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
- package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/wrapper.js +2 -2
- package/dist/commands/intuned-cli/main.js +1 -2
- package/dist/commands/intuned-cli/types.d.ts +8 -8
- package/dist/commands/ts-check.js +1 -2
- package/dist/common/binStartupScript.js +1 -2
- package/dist/common/browserTabs.d.ts +72 -0
- package/dist/common/browserTabs.js +74 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/contextStorageStateHelpers.d.ts +4 -3
- package/dist/common/contextStorageStateHelpers.js +4 -1
- package/dist/common/extension/extensionsHelpers.d.ts +1 -1
- package/dist/common/extension/types.d.ts +14 -7
- package/dist/common/formatZodError.d.ts +1 -1
- package/dist/common/intunedJson.d.ts +19 -14
- package/dist/common/intunedJson.js +2 -2
- package/dist/common/jwtTokenManager.js +10 -6
- package/dist/common/launchBrowser.d.ts +8 -0
- package/dist/common/launchBrowser.js +39 -7
- package/dist/common/playwrightContext.d.ts +5 -5
- package/dist/common/playwrightContext.js +17 -13
- package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
- package/dist/common/runApi/importUsingImportFunction.js +7 -7
- package/dist/common/runApi/index.d.ts +3 -6
- package/dist/common/runApi/index.js +27 -51
- package/dist/common/settingsSchema.d.ts +52 -45
- package/dist/common/settingsSchema.js +3 -3
- package/dist/common/setupContextHook.d.ts +1 -2
- package/dist/common/setupContextHook.js +2 -2
- package/dist/common/telemetry.js +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -7
- package/dist/runtime/downloadDirectory.js +2 -2
- package/dist/vendor/runtime-interface.d.ts +1 -0
- package/dist/vendor/runtime-interface.js +493 -0
- package/package.json +17 -10
- package/tsup.config.ts +12 -0
- package/WebTemplate.zip +0 -0
- package/dist/common/runApi/errors.d.ts +0 -72
- package/dist/common/runApi/errors.js +0 -169
- package/dist/common/runApi/types.d.ts +0 -830
- package/dist/common/runApi/types.js +0 -73
|
@@ -3,17 +3,17 @@ declare const fileNodeSchema: z.ZodObject<{
|
|
|
3
3
|
file: z.ZodObject<{
|
|
4
4
|
contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
|
5
5
|
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
contents:
|
|
6
|
+
contents: string | Uint8Array;
|
|
7
7
|
}, {
|
|
8
|
-
contents:
|
|
8
|
+
contents: string | Uint8Array;
|
|
9
9
|
}>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
file: {
|
|
12
|
-
contents:
|
|
12
|
+
contents: string | Uint8Array;
|
|
13
13
|
};
|
|
14
14
|
}, {
|
|
15
15
|
file: {
|
|
16
|
-
contents:
|
|
16
|
+
contents: string | Uint8Array;
|
|
17
17
|
};
|
|
18
18
|
}>;
|
|
19
19
|
export type FileNode = z.infer<typeof fileNodeSchema>;
|
|
@@ -26,17 +26,17 @@ export declare const fileSystemTreeSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[
|
|
|
26
26
|
file: z.ZodObject<{
|
|
27
27
|
contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
contents:
|
|
29
|
+
contents: string | Uint8Array;
|
|
30
30
|
}, {
|
|
31
|
-
contents:
|
|
31
|
+
contents: string | Uint8Array;
|
|
32
32
|
}>;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
34
|
file: {
|
|
35
|
-
contents:
|
|
35
|
+
contents: string | Uint8Array;
|
|
36
36
|
};
|
|
37
37
|
}, {
|
|
38
38
|
file: {
|
|
39
|
-
contents:
|
|
39
|
+
contents: string | Uint8Array;
|
|
40
40
|
};
|
|
41
41
|
}>]>>;
|
|
42
42
|
export type FileSystemTree = z.infer<typeof fileSystemTreeSchema>;
|
|
@@ -6,8 +6,7 @@ var _commander = require("commander");
|
|
|
6
6
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
7
7
|
var path = _interopRequireWildcard(require("path"));
|
|
8
8
|
var _template = require("./common/utils/template");
|
|
9
|
-
function
|
|
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; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
_commander.program.description("Check TypeScript types in the project").option("-t, --template <type>", "template to use", "InterfaceTemplate").allowUnknownOption().action(async ({
|
|
12
11
|
template
|
|
13
12
|
}) => {
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
4
4
|
var path = _interopRequireWildcard(require("path"));
|
|
5
5
|
var _intunedJson = require("./intunedJson");
|
|
6
|
-
function
|
|
7
|
-
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; }
|
|
6
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
8
|
_dotenv.default.config({
|
|
10
9
|
path: `.env`
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab management utilities using CDP HTTP API.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to interact with browser tabs via Chrome DevTools Protocol HTTP endpoints.
|
|
5
|
+
* Refer to https://chromedevtools.github.io/devtools-protocol/ for the endpoints documentation.
|
|
6
|
+
* This approach is simpler than using the playwright API because it doesn't require us to create a playwright context.
|
|
7
|
+
*/
|
|
8
|
+
export interface CDPTabInfo {
|
|
9
|
+
id: string;
|
|
10
|
+
type: string;
|
|
11
|
+
title: string;
|
|
12
|
+
url: string;
|
|
13
|
+
webSocketDebuggerUrl?: string;
|
|
14
|
+
devtoolsFrontendUrl?: string;
|
|
15
|
+
faviconUrl?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fetch current tabs from CDP /json endpoint.
|
|
20
|
+
*
|
|
21
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
22
|
+
* @returns List of tab info dictionaries from CDP (filtered to only "page" type)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const tabs = await getCDPTabs("http://localhost:9222");
|
|
26
|
+
* // Returns:
|
|
27
|
+
* // [
|
|
28
|
+
* // {
|
|
29
|
+
* // "id": "1234",
|
|
30
|
+
* // "type": "page",
|
|
31
|
+
* // "title": "Google",
|
|
32
|
+
* // "url": "https://google.com",
|
|
33
|
+
* // ...
|
|
34
|
+
* // }
|
|
35
|
+
* // ]
|
|
36
|
+
*/
|
|
37
|
+
export declare function getCDPTabs(cdpAddress: string): Promise<CDPTabInfo[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Create new tab via CDP /json/new endpoint with optional URL.
|
|
40
|
+
*
|
|
41
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
42
|
+
* @param url - Initial URL for the tab (default: "about:blank")
|
|
43
|
+
* @returns Tab info dictionary from CDP
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const tab = await createCDPTab("http://localhost:9222", "https://google.com");
|
|
47
|
+
* // Returns:
|
|
48
|
+
* // {
|
|
49
|
+
* // "id": "1234",
|
|
50
|
+
* // "type": "page",
|
|
51
|
+
* // "title": "New Tab",
|
|
52
|
+
* // "url": "about:blank",
|
|
53
|
+
* // ...
|
|
54
|
+
* // }
|
|
55
|
+
*/
|
|
56
|
+
export declare function createCDPTab(cdpAddress: string, url?: string): Promise<CDPTabInfo>;
|
|
57
|
+
/**
|
|
58
|
+
* Close tab via CDP /json/close/{id} endpoint.
|
|
59
|
+
*
|
|
60
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
61
|
+
* @param cdpTargetId - Full CDP target ID to close
|
|
62
|
+
* @returns True if successful, False otherwise
|
|
63
|
+
*/
|
|
64
|
+
export declare function closeCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Activate/bring to front a tab via CDP /json/activate/{id} endpoint.
|
|
67
|
+
*
|
|
68
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
69
|
+
* @param cdpTargetId - Full CDP target ID to activate
|
|
70
|
+
* @returns True if successful, False otherwise
|
|
71
|
+
*/
|
|
72
|
+
export declare function activateCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.activateCDPTab = activateCDPTab;
|
|
7
|
+
exports.closeCDPTab = closeCDPTab;
|
|
8
|
+
exports.createCDPTab = createCDPTab;
|
|
9
|
+
exports.getCDPTabs = getCDPTabs;
|
|
10
|
+
const DEFAULT_TIMEOUT = 5000;
|
|
11
|
+
async function getCDPTabs(cdpAddress) {
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(`${cdpAddress}/json`, {
|
|
16
|
+
signal: controller.signal
|
|
17
|
+
});
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
20
|
+
}
|
|
21
|
+
const tabs = await response.json();
|
|
22
|
+
return tabs.filter(tab => tab.type === "page");
|
|
23
|
+
} finally {
|
|
24
|
+
clearTimeout(timeoutId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function createCDPTab(cdpAddress, url = "about:blank") {
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
30
|
+
try {
|
|
31
|
+
let endpoint = `${cdpAddress}/json/new`;
|
|
32
|
+
if (url && url !== "about:blank") {
|
|
33
|
+
endpoint = `${endpoint}?${url}`;
|
|
34
|
+
}
|
|
35
|
+
const response = await fetch(endpoint, {
|
|
36
|
+
method: "PUT",
|
|
37
|
+
signal: controller.signal
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
41
|
+
}
|
|
42
|
+
return await response.json();
|
|
43
|
+
} finally {
|
|
44
|
+
clearTimeout(timeoutId);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function closeCDPTab(cdpAddress, cdpTargetId) {
|
|
48
|
+
const controller = new AbortController();
|
|
49
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetch(`${cdpAddress}/json/close/${cdpTargetId}`, {
|
|
52
|
+
signal: controller.signal
|
|
53
|
+
});
|
|
54
|
+
return response.status === 200;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
} finally {
|
|
58
|
+
clearTimeout(timeoutId);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function activateCDPTab(cdpAddress, cdpTargetId) {
|
|
62
|
+
const controller = new AbortController();
|
|
63
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
64
|
+
try {
|
|
65
|
+
const response = await fetch(`${cdpAddress}/json/activate/${cdpTargetId}`, {
|
|
66
|
+
signal: controller.signal
|
|
67
|
+
});
|
|
68
|
+
return response.status === 200;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
} finally {
|
|
72
|
+
clearTimeout(timeoutId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -5,6 +5,7 @@ export declare const WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
|
|
|
5
5
|
export declare const EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
6
6
|
export declare const PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
7
7
|
export declare const API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
8
|
+
export declare const AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
8
9
|
export declare const API_KEY_HEADER_NAME = "x-api-key";
|
|
9
10
|
export declare const API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
10
11
|
export declare const CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
package/dist/common/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
|
|
6
|
+
exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
|
|
7
7
|
const API_FOLDER_NAME = exports.API_FOLDER_NAME = "api";
|
|
8
8
|
const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
9
9
|
const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
@@ -11,6 +11,7 @@ const WORKSPACE_ID_ENV_VAR_KEY = exports.WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WOR
|
|
|
11
11
|
const EXTENSION_PATH_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
12
12
|
const PROJECT_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
13
13
|
const API_KEY_ENV_VAR_KEY = exports.API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
14
|
+
const AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
14
15
|
const API_KEY_HEADER_NAME = exports.API_KEY_HEADER_NAME = "x-api-key";
|
|
15
16
|
const API_BASE_URL_ENV_VAR_KEY = exports.API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
16
17
|
const CLI_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as playwright from "playwright";
|
|
1
|
+
import type * as playwright from "playwright";
|
|
2
|
+
import type { RunApiStorageState } from "@intuned/runtime-interface";
|
|
2
3
|
interface StorageEntry {
|
|
3
4
|
name: string;
|
|
4
5
|
value: string;
|
|
@@ -16,6 +17,6 @@ export interface StorageState {
|
|
|
16
17
|
origins?: LocalStorageState[] | null;
|
|
17
18
|
sessionStorage?: SessionStorageState[] | null;
|
|
18
19
|
}
|
|
19
|
-
export declare function setStorageState(context: playwright.BrowserContext, state:
|
|
20
|
-
export declare function getStorageState(context: playwright.BrowserContext): Promise<
|
|
20
|
+
export declare function setStorageState(context: playwright.BrowserContext, state: RunApiStorageState): Promise<void>;
|
|
21
|
+
export declare function getStorageState(context: playwright.BrowserContext): Promise<RunApiStorageState>;
|
|
21
22
|
export {};
|
|
@@ -50,7 +50,10 @@ async function setStorageState(context, state) {
|
|
|
50
50
|
await page.close();
|
|
51
51
|
}
|
|
52
52
|
async function getStorageState(context) {
|
|
53
|
-
const result = {
|
|
53
|
+
const result = {
|
|
54
|
+
cookies: [],
|
|
55
|
+
origins: []
|
|
56
|
+
};
|
|
54
57
|
const storageState = await context.storageState();
|
|
55
58
|
result.cookies = storageState.cookies;
|
|
56
59
|
result.origins = storageState.origins;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as playwright from "playwright";
|
|
1
|
+
import type * as playwright from "playwright";
|
|
2
2
|
import { CaptchaSolverSettings, CaptchaSolverSettingsWithRunContext } from "../settingsSchema";
|
|
3
3
|
export declare function resolveCaptchaSolverSettings(input?: unknown): Promise<CaptchaSolverSettings>;
|
|
4
4
|
export declare function isIntunedExtensionLoaded(): boolean;
|
|
@@ -34,10 +34,11 @@ declare const captchaBaseSchema: z.ZodObject<{
|
|
|
34
34
|
}>;
|
|
35
35
|
export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
|
|
36
36
|
declare const captchaNonErrorSchema: z.ZodObject<{
|
|
37
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
38
37
|
id: z.ZodString;
|
|
39
38
|
tabId: z.ZodNumber;
|
|
39
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
40
40
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
} & {
|
|
41
42
|
status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
|
|
42
43
|
}, "strip", z.ZodTypeAny, {
|
|
43
44
|
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
@@ -54,10 +55,11 @@ declare const captchaNonErrorSchema: z.ZodObject<{
|
|
|
54
55
|
}>;
|
|
55
56
|
export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
|
|
56
57
|
declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
57
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
58
58
|
id: z.ZodString;
|
|
59
59
|
tabId: z.ZodNumber;
|
|
60
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
60
61
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
} & {
|
|
61
63
|
status: z.ZodLiteral<"error">;
|
|
62
64
|
error: z.ZodObject<{
|
|
63
65
|
code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
|
|
@@ -92,10 +94,11 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
|
92
94
|
}>;
|
|
93
95
|
export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
|
|
94
96
|
export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
95
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
96
97
|
id: z.ZodString;
|
|
97
98
|
tabId: z.ZodNumber;
|
|
99
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
98
100
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
} & {
|
|
99
102
|
status: z.ZodLiteral<"attached">;
|
|
100
103
|
}, "strip", z.ZodTypeAny, {
|
|
101
104
|
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
@@ -110,10 +113,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
110
113
|
tabId: number;
|
|
111
114
|
retryCount?: number | undefined;
|
|
112
115
|
}>, z.ZodObject<{
|
|
113
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
114
116
|
id: z.ZodString;
|
|
115
117
|
tabId: z.ZodNumber;
|
|
118
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
116
119
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
} & {
|
|
117
121
|
status: z.ZodLiteral<"solving">;
|
|
118
122
|
}, "strip", z.ZodTypeAny, {
|
|
119
123
|
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
@@ -128,10 +132,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
128
132
|
tabId: number;
|
|
129
133
|
retryCount?: number | undefined;
|
|
130
134
|
}>, z.ZodObject<{
|
|
131
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
132
135
|
id: z.ZodString;
|
|
133
136
|
tabId: z.ZodNumber;
|
|
137
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
134
138
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
} & {
|
|
135
140
|
status: z.ZodLiteral<"solved">;
|
|
136
141
|
}, "strip", z.ZodTypeAny, {
|
|
137
142
|
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
@@ -146,10 +151,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
146
151
|
tabId: number;
|
|
147
152
|
retryCount?: number | undefined;
|
|
148
153
|
}>, z.ZodObject<{
|
|
149
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
150
154
|
id: z.ZodString;
|
|
151
155
|
tabId: z.ZodNumber;
|
|
156
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
152
157
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
} & {
|
|
153
159
|
status: z.ZodLiteral<"detached">;
|
|
154
160
|
}, "strip", z.ZodTypeAny, {
|
|
155
161
|
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
@@ -164,10 +170,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
164
170
|
tabId: number;
|
|
165
171
|
retryCount?: number | undefined;
|
|
166
172
|
}>, z.ZodObject<{
|
|
167
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
168
173
|
id: z.ZodString;
|
|
169
174
|
tabId: z.ZodNumber;
|
|
175
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
170
176
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
} & {
|
|
171
178
|
status: z.ZodLiteral<"error">;
|
|
172
179
|
error: z.ZodObject<{
|
|
173
180
|
code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ZodError } from "zod";
|
|
1
|
+
import { ZodError } from "zod/v3";
|
|
2
2
|
export declare function formatZodError(zodError: ZodError): string[];
|
|
@@ -3,6 +3,7 @@ import { type Err, type Ok } from "neverthrow";
|
|
|
3
3
|
export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
4
4
|
projectName: z.ZodOptional<z.ZodString>;
|
|
5
5
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
|
|
6
7
|
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
7
8
|
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
8
9
|
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
@@ -26,6 +27,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
26
27
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
28
|
projectName: z.ZodOptional<z.ZodString>;
|
|
28
29
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
|
|
29
31
|
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
30
32
|
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
31
33
|
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
@@ -49,6 +51,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
49
51
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
50
52
|
projectName: z.ZodOptional<z.ZodString>;
|
|
51
53
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
|
|
52
55
|
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
53
56
|
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
54
57
|
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
@@ -111,12 +114,12 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
111
114
|
startUrl: z.ZodOptional<z.ZodString>;
|
|
112
115
|
finishUrl: z.ZodOptional<z.ZodString>;
|
|
113
116
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
type: "
|
|
117
|
+
type: "MANUAL" | "API";
|
|
115
118
|
enabled: true;
|
|
116
119
|
startUrl?: string | undefined;
|
|
117
120
|
finishUrl?: string | undefined;
|
|
118
121
|
}, {
|
|
119
|
-
type: "
|
|
122
|
+
type: "MANUAL" | "API";
|
|
120
123
|
enabled: true;
|
|
121
124
|
startUrl?: string | undefined;
|
|
122
125
|
finishUrl?: string | undefined;
|
|
@@ -132,7 +135,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
132
135
|
authSessions: {
|
|
133
136
|
enabled: false;
|
|
134
137
|
} | {
|
|
135
|
-
type: "
|
|
138
|
+
type: "MANUAL" | "API";
|
|
136
139
|
enabled: true;
|
|
137
140
|
startUrl?: string | undefined;
|
|
138
141
|
finishUrl?: string | undefined;
|
|
@@ -144,7 +147,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
144
147
|
authSessions: {
|
|
145
148
|
enabled: false;
|
|
146
149
|
} | {
|
|
147
|
-
type: "
|
|
150
|
+
type: "MANUAL" | "API";
|
|
148
151
|
enabled: true;
|
|
149
152
|
startUrl?: string | undefined;
|
|
150
153
|
finishUrl?: string | undefined;
|
|
@@ -156,16 +159,17 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
156
159
|
export type IntunedJson = z.infer<typeof intunedJsonSchema>;
|
|
157
160
|
export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
158
161
|
export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
|
|
159
|
-
|
|
162
|
+
stealthMode?: {
|
|
163
|
+
enabled: boolean;
|
|
164
|
+
} | undefined;
|
|
165
|
+
ignoreHttpErrors?: boolean | undefined;
|
|
160
166
|
workspaceId?: string | undefined;
|
|
167
|
+
projectName?: string | undefined;
|
|
161
168
|
metadata?: {
|
|
162
169
|
defaultJobInput?: Record<string, any> | undefined;
|
|
163
170
|
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
164
171
|
testAuthSessionInput?: Record<string, any> | undefined;
|
|
165
172
|
} | undefined;
|
|
166
|
-
stealthMode?: {
|
|
167
|
-
enabled: boolean;
|
|
168
|
-
} | undefined;
|
|
169
173
|
} & {
|
|
170
174
|
[k: string]: unknown;
|
|
171
175
|
} & ({
|
|
@@ -179,7 +183,7 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
|
|
|
179
183
|
authSessions: {
|
|
180
184
|
enabled: false;
|
|
181
185
|
} | {
|
|
182
|
-
type: "
|
|
186
|
+
type: "MANUAL" | "API";
|
|
183
187
|
enabled: true;
|
|
184
188
|
startUrl?: string | undefined;
|
|
185
189
|
finishUrl?: string | undefined;
|
|
@@ -195,16 +199,17 @@ export declare function getIntunedSettingsFile(): Promise<Ok<{
|
|
|
195
199
|
}, never> | Err<never, string>>;
|
|
196
200
|
export declare function getIntunedSettingsFileName(): Promise<Err<never, string> | Ok<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml", never>>;
|
|
197
201
|
export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
|
|
198
|
-
|
|
202
|
+
stealthMode?: {
|
|
203
|
+
enabled: boolean;
|
|
204
|
+
} | undefined;
|
|
205
|
+
ignoreHttpErrors?: boolean | undefined;
|
|
199
206
|
workspaceId?: string | undefined;
|
|
207
|
+
projectName?: string | undefined;
|
|
200
208
|
metadata?: {
|
|
201
209
|
defaultJobInput?: Record<string, any> | undefined;
|
|
202
210
|
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
203
211
|
testAuthSessionInput?: Record<string, any> | undefined;
|
|
204
212
|
} | undefined;
|
|
205
|
-
stealthMode?: {
|
|
206
|
-
enabled: boolean;
|
|
207
|
-
} | undefined;
|
|
208
213
|
} & {
|
|
209
214
|
[k: string]: unknown;
|
|
210
215
|
} & ({
|
|
@@ -218,7 +223,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
|
|
|
218
223
|
authSessions: {
|
|
219
224
|
enabled: false;
|
|
220
225
|
} | {
|
|
221
|
-
type: "
|
|
226
|
+
type: "MANUAL" | "API";
|
|
222
227
|
enabled: true;
|
|
223
228
|
startUrl?: string | undefined;
|
|
224
229
|
finishUrl?: string | undefined;
|
|
@@ -16,13 +16,13 @@ var YAML = _interopRequireWildcard(require("yaml"));
|
|
|
16
16
|
var TOML = _interopRequireWildcard(require("smol-toml"));
|
|
17
17
|
var _neverthrow = require("neverthrow");
|
|
18
18
|
var _formatZodError = require("./formatZodError");
|
|
19
|
-
function
|
|
20
|
-
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; }
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
21
|
const playwright = undefined;
|
|
23
22
|
const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
|
|
24
23
|
projectName: _zod.z.string().optional(),
|
|
25
24
|
workspaceId: _zod.z.string().optional(),
|
|
25
|
+
ignoreHttpErrors: _zod.z.boolean().optional(),
|
|
26
26
|
metadata: _zod.z.object({
|
|
27
27
|
defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
28
28
|
defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
@@ -9,8 +9,7 @@ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
|
|
|
9
9
|
var jwt = _interopRequireWildcard(require("jsonwebtoken"));
|
|
10
10
|
var _neverthrow = require("neverthrow");
|
|
11
11
|
var _constants = require("./constants");
|
|
12
|
-
function
|
|
13
|
-
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; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
14
|
class JwtTokenManager {
|
|
16
15
|
constructor(refreshTokenPath) {
|
|
@@ -65,8 +64,13 @@ class JwtTokenManager {
|
|
|
65
64
|
}
|
|
66
65
|
async fetchWithToken(...[input, init]) {
|
|
67
66
|
const headers = new Headers(init?.headers);
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const apiKey = process.env[_constants.API_KEY_ENV_VAR_KEY];
|
|
68
|
+
if (apiKey) {
|
|
69
|
+
headers.set(_constants.API_KEY_HEADER_NAME, apiKey);
|
|
70
|
+
}
|
|
71
|
+
const token = process.env[_constants.AUTH_TOKEN_ENV_VAR_KEY];
|
|
72
|
+
if (token) {
|
|
73
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
70
74
|
}
|
|
71
75
|
if (this.token !== undefined) {
|
|
72
76
|
headers.set("Authorization", `Bearer ${this.token}`);
|
|
@@ -76,7 +80,7 @@ class JwtTokenManager {
|
|
|
76
80
|
headers
|
|
77
81
|
});
|
|
78
82
|
if (result.status === 401 && process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
|
|
79
|
-
console.warn("Unauthorized backend function call - make sure to provision your project to Intuned to set up the correct API credentials.\n" + "Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#
|
|
83
|
+
console.warn("Unauthorized backend function call - make sure to provision your project to Intuned to set up the correct API credentials.\n" + "Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.");
|
|
80
84
|
}
|
|
81
85
|
return result;
|
|
82
86
|
}
|
|
@@ -97,7 +101,7 @@ class JwtTokenManager {
|
|
|
97
101
|
return `${domain}/api/${workspaceId}/functions/${projectId}`;
|
|
98
102
|
} catch (e) {
|
|
99
103
|
if (process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
|
|
100
|
-
throw new Error(`API credentials not set - make sure to provision your project to Intuned to set up the correct API credentials.\n` + `Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#
|
|
104
|
+
throw new Error(`API credentials not set - make sure to provision your project to Intuned to set up the correct API credentials.\n` + `Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.\n` + `Original error: ${e.message}`);
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
}
|
|
@@ -5,6 +5,11 @@ export interface Proxy {
|
|
|
5
5
|
username: string;
|
|
6
6
|
password: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Get ignore_http_errors setting from CLI option, Intuned.json, or environment variable.
|
|
10
|
+
* Priority: cliOption > environment variable > Intuned.json > false
|
|
11
|
+
*/
|
|
12
|
+
export declare function getIgnoreHttpErrorsFromConfig(cliOption?: boolean): Promise<boolean>;
|
|
8
13
|
export type LaunchBrowserResult = {
|
|
9
14
|
page: playwright.Page;
|
|
10
15
|
context: playwright.BrowserContext;
|
|
@@ -16,9 +21,12 @@ export type LaunchChromiumStandaloneOptions = {
|
|
|
16
21
|
cdpPort?: number;
|
|
17
22
|
appModeInitialUrl?: string;
|
|
18
23
|
executablePath?: string;
|
|
24
|
+
ignoreHttpErrors?: boolean;
|
|
19
25
|
};
|
|
20
26
|
export type LaunchChromiumCdpOptions = {
|
|
21
27
|
cdpAddress: string;
|
|
28
|
+
cdpTargetId?: string;
|
|
29
|
+
ignoreHttpErrors?: boolean;
|
|
22
30
|
};
|
|
23
31
|
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
24
32
|
export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|