@intuned/runtime-dev 1.3.12-ua.6 → 1.3.13-kv.0
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/dist/commands/intuned-cli/controller/authSession.d.ts +12 -12
- package/dist/commands/intuned-cli/helpers/auth.d.ts +2 -2
- 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 +139 -7
- package/dist/commands/intuned-cli/helpers/intunedJson.js +79 -12
- package/dist/common/binStartupScript.js +5 -8
- package/dist/common/launchBrowser.d.ts +0 -5
- package/dist/common/launchBrowser.js +1 -37
- package/dist/common/runApi/types.d.ts +40 -40
- package/dist/runtime/attemptStore.d.ts +2 -2
- package/dist/runtime/export.d.ts +69 -13
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/persistentStore.d.ts +2 -0
- package/dist/runtime/{store.js → persistentStore.js} +8 -9
- package/package.json +1 -3
- package/bin/intuned-get-headless-user-agent +0 -4
- package/dist/commands/get-headless-user-agent.d.ts +0 -1
- package/dist/commands/get-headless-user-agent.js +0 -16
- package/dist/common/intunedJson.d.ts +0 -229
- package/dist/common/intunedJson.js +0 -133
- package/dist/runtime/store.d.ts +0 -6
|
@@ -16,9 +16,9 @@ export declare function executeRunCreateAuthSessionCLI({ id, input, checkRetries
|
|
|
16
16
|
metadata?: AuthSessionMetadata;
|
|
17
17
|
} & BaseCommandOptions): Promise<{
|
|
18
18
|
cookies: {
|
|
19
|
+
path: string;
|
|
19
20
|
value: string;
|
|
20
21
|
name: string;
|
|
21
|
-
path: string;
|
|
22
22
|
domain: string;
|
|
23
23
|
expires: number;
|
|
24
24
|
httpOnly: boolean;
|
|
@@ -33,11 +33,11 @@ export declare function executeRunCreateAuthSessionCLI({ id, input, checkRetries
|
|
|
33
33
|
}[];
|
|
34
34
|
}[];
|
|
35
35
|
sessionStorage?: {
|
|
36
|
+
origin: string;
|
|
36
37
|
sessionStorage: {
|
|
37
38
|
value: string;
|
|
38
39
|
name: string;
|
|
39
40
|
}[];
|
|
40
|
-
origin: string;
|
|
41
41
|
}[] | undefined;
|
|
42
42
|
}>;
|
|
43
43
|
export declare function executeRunUpdateAuthSessionCLI({ id, input, checkRetries, createRetries, ...rest }: {
|
|
@@ -47,9 +47,9 @@ export declare function executeRunUpdateAuthSessionCLI({ id, input, checkRetries
|
|
|
47
47
|
createRetries: number;
|
|
48
48
|
} & BaseCommandOptions): Promise<{
|
|
49
49
|
cookies: {
|
|
50
|
+
path: string;
|
|
50
51
|
value: string;
|
|
51
52
|
name: string;
|
|
52
|
-
path: string;
|
|
53
53
|
domain: string;
|
|
54
54
|
expires: number;
|
|
55
55
|
httpOnly: boolean;
|
|
@@ -64,11 +64,11 @@ export declare function executeRunUpdateAuthSessionCLI({ id, input, checkRetries
|
|
|
64
64
|
}[];
|
|
65
65
|
}[];
|
|
66
66
|
sessionStorage?: {
|
|
67
|
+
origin: string;
|
|
67
68
|
sessionStorage: {
|
|
68
69
|
value: string;
|
|
69
70
|
name: string;
|
|
70
71
|
}[];
|
|
71
|
-
origin: string;
|
|
72
72
|
}[] | undefined;
|
|
73
73
|
}>;
|
|
74
74
|
export declare function executeAttemptCreateAuthSessionCLI({ id, input, ...rest }: {
|
|
@@ -76,9 +76,9 @@ export declare function executeAttemptCreateAuthSessionCLI({ id, input, ...rest
|
|
|
76
76
|
input: any;
|
|
77
77
|
} & BaseCommandOptions): Promise<{
|
|
78
78
|
cookies: {
|
|
79
|
+
path: string;
|
|
79
80
|
value: string;
|
|
80
81
|
name: string;
|
|
81
|
-
path: string;
|
|
82
82
|
domain: string;
|
|
83
83
|
expires: number;
|
|
84
84
|
httpOnly: boolean;
|
|
@@ -93,20 +93,20 @@ export declare function executeAttemptCreateAuthSessionCLI({ id, input, ...rest
|
|
|
93
93
|
}[];
|
|
94
94
|
}[];
|
|
95
95
|
sessionStorage?: {
|
|
96
|
+
origin: string;
|
|
96
97
|
sessionStorage: {
|
|
97
98
|
value: string;
|
|
98
99
|
name: string;
|
|
99
100
|
}[];
|
|
100
|
-
origin: string;
|
|
101
101
|
}[] | undefined;
|
|
102
102
|
}>;
|
|
103
103
|
export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
|
|
104
104
|
id: string;
|
|
105
105
|
} & BaseCommandOptions): Promise<{
|
|
106
106
|
cookies: {
|
|
107
|
+
path: string;
|
|
107
108
|
value: string;
|
|
108
109
|
name: string;
|
|
109
|
-
path: string;
|
|
110
110
|
domain: string;
|
|
111
111
|
expires: number;
|
|
112
112
|
httpOnly: boolean;
|
|
@@ -121,11 +121,11 @@ export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
|
|
|
121
121
|
}[];
|
|
122
122
|
}[];
|
|
123
123
|
sessionStorage?: {
|
|
124
|
+
origin: string;
|
|
124
125
|
sessionStorage: {
|
|
125
126
|
value: string;
|
|
126
127
|
name: string;
|
|
127
128
|
}[];
|
|
128
|
-
origin: string;
|
|
129
129
|
}[] | undefined;
|
|
130
130
|
}>;
|
|
131
131
|
declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
@@ -138,9 +138,9 @@ declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId
|
|
|
138
138
|
traceId?: string;
|
|
139
139
|
} & Omit<BaseCommandOptions, "trace">): Promise<{
|
|
140
140
|
cookies: {
|
|
141
|
+
path: string;
|
|
141
142
|
value: string;
|
|
142
143
|
name: string;
|
|
143
|
-
path: string;
|
|
144
144
|
domain: string;
|
|
145
145
|
expires: number;
|
|
146
146
|
httpOnly: boolean;
|
|
@@ -155,11 +155,11 @@ declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId
|
|
|
155
155
|
}[];
|
|
156
156
|
}[];
|
|
157
157
|
sessionStorage?: {
|
|
158
|
+
origin: string;
|
|
158
159
|
sessionStorage: {
|
|
159
160
|
value: string;
|
|
160
161
|
name: string;
|
|
161
162
|
}[];
|
|
162
|
-
origin: string;
|
|
163
163
|
}[] | undefined;
|
|
164
164
|
}>;
|
|
165
165
|
export declare const _runCreate: typeof runCreate;
|
|
@@ -175,9 +175,9 @@ declare function runCreateWithRetries({ authSessionId, authSessionInput, retries
|
|
|
175
175
|
metadata?: AuthSessionMetadata;
|
|
176
176
|
} & BaseCommandOptions): Promise<{
|
|
177
177
|
cookies: {
|
|
178
|
+
path: string;
|
|
178
179
|
value: string;
|
|
179
180
|
name: string;
|
|
180
|
-
path: string;
|
|
181
181
|
domain: string;
|
|
182
182
|
expires: number;
|
|
183
183
|
httpOnly: boolean;
|
|
@@ -192,11 +192,11 @@ declare function runCreateWithRetries({ authSessionId, authSessionInput, retries
|
|
|
192
192
|
}[];
|
|
193
193
|
}[];
|
|
194
194
|
sessionStorage?: {
|
|
195
|
+
origin: string;
|
|
195
196
|
sessionStorage: {
|
|
196
197
|
value: string;
|
|
197
198
|
name: string;
|
|
198
199
|
}[];
|
|
199
|
-
origin: string;
|
|
200
200
|
}[] | undefined;
|
|
201
201
|
}>;
|
|
202
202
|
export declare const _runCreateWithRetries: typeof runCreateWithRetries;
|
|
@@ -6,9 +6,9 @@ export declare function assertAuthConsistent(authSession: string | undefined): P
|
|
|
6
6
|
export declare function loadAuthSessionInstance(authSessionId: string): Promise<{
|
|
7
7
|
storageState: {
|
|
8
8
|
cookies: {
|
|
9
|
+
path: string;
|
|
9
10
|
value: string;
|
|
10
11
|
name: string;
|
|
11
|
-
path: string;
|
|
12
12
|
domain: string;
|
|
13
13
|
expires: number;
|
|
14
14
|
httpOnly: boolean;
|
|
@@ -23,11 +23,11 @@ export declare function loadAuthSessionInstance(authSessionId: string): Promise<
|
|
|
23
23
|
}[];
|
|
24
24
|
}[];
|
|
25
25
|
sessionStorage?: {
|
|
26
|
+
origin: string;
|
|
26
27
|
sessionStorage: {
|
|
27
28
|
value: string;
|
|
28
29
|
name: string;
|
|
29
30
|
}[];
|
|
30
|
-
origin: string;
|
|
31
31
|
}[] | undefined;
|
|
32
32
|
};
|
|
33
33
|
metadata: AuthSessionMetadata;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
|
|
7
7
|
exports.logAutomationError = logAutomationError;
|
|
8
|
-
var
|
|
8
|
+
var _runApi = require("../../../common/runApi");
|
|
9
9
|
var _terminal = require("./terminal");
|
|
10
10
|
class CLIError extends Error {
|
|
11
11
|
constructor(message, options) {
|
|
@@ -31,7 +31,7 @@ class CLIAssertionError extends CLIError {
|
|
|
31
31
|
exports.CLIAssertionError = CLIAssertionError;
|
|
32
32
|
function logAutomationError(error) {
|
|
33
33
|
(0, _terminal.terminal)(`^r^+An error occurred while running the API:^:\n`);
|
|
34
|
-
if (error instanceof
|
|
34
|
+
if (error instanceof _runApi.AutomationError) {
|
|
35
35
|
if (error.error.stack) {
|
|
36
36
|
const stackLines = error.error.stack.split("\n").filter(line => !line.includes("@intuned/runtime") && !line.includes("node:"));
|
|
37
37
|
(0, _terminal.terminal)(`^r${stackLines.join("\n")}^:\n`);
|
|
@@ -1,4 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
3
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
4
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
6
|
+
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
7
|
+
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
8
|
+
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
defaultJobInput?: Record<string, any> | undefined;
|
|
11
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
12
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
defaultJobInput?: unknown;
|
|
15
|
+
defaultRunPlaygroundInput?: unknown;
|
|
16
|
+
testAuthSessionInput?: unknown;
|
|
17
|
+
}>>>;
|
|
18
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
19
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
20
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
22
|
+
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
23
|
+
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
24
|
+
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
defaultJobInput?: Record<string, any> | undefined;
|
|
27
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
28
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
defaultJobInput?: unknown;
|
|
31
|
+
defaultRunPlaygroundInput?: unknown;
|
|
32
|
+
testAuthSessionInput?: unknown;
|
|
33
|
+
}>>>;
|
|
34
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
35
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
37
|
+
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
38
|
+
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
39
|
+
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
40
|
+
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
defaultJobInput?: Record<string, any> | undefined;
|
|
43
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
44
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
defaultJobInput?: unknown;
|
|
47
|
+
defaultRunPlaygroundInput?: unknown;
|
|
48
|
+
testAuthSessionInput?: unknown;
|
|
49
|
+
}>>>;
|
|
50
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodUnion<[z.ZodObject<{
|
|
51
|
+
authSessions: z.ZodObject<{
|
|
52
|
+
enabled: z.ZodLiteral<false>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
enabled: false;
|
|
55
|
+
}, {
|
|
56
|
+
enabled: false;
|
|
57
|
+
}>;
|
|
58
|
+
apiAccess: z.ZodObject<{
|
|
59
|
+
enabled: z.ZodLiteral<false>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
enabled: false;
|
|
62
|
+
}, {
|
|
63
|
+
enabled: false;
|
|
64
|
+
}>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
authSessions: {
|
|
67
|
+
enabled: false;
|
|
68
|
+
};
|
|
69
|
+
apiAccess: {
|
|
70
|
+
enabled: false;
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
73
|
+
authSessions: {
|
|
74
|
+
enabled: false;
|
|
75
|
+
};
|
|
76
|
+
apiAccess: {
|
|
77
|
+
enabled: false;
|
|
78
|
+
};
|
|
79
|
+
}>, z.ZodObject<{
|
|
80
|
+
authSessions: z.ZodUnion<[z.ZodObject<{
|
|
81
|
+
enabled: z.ZodLiteral<false>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
enabled: false;
|
|
84
|
+
}, {
|
|
85
|
+
enabled: false;
|
|
86
|
+
}>, z.ZodObject<{
|
|
87
|
+
enabled: z.ZodLiteral<true>;
|
|
88
|
+
type: z.ZodEnum<["MANUAL", "API"]>;
|
|
89
|
+
startUrl: z.ZodOptional<z.ZodString>;
|
|
90
|
+
finishUrl: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
type: "API" | "MANUAL";
|
|
93
|
+
enabled: true;
|
|
94
|
+
startUrl?: string | undefined;
|
|
95
|
+
finishUrl?: string | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
type: "API" | "MANUAL";
|
|
98
|
+
enabled: true;
|
|
99
|
+
startUrl?: string | undefined;
|
|
100
|
+
finishUrl?: string | undefined;
|
|
101
|
+
}>]>;
|
|
102
|
+
apiAccess: z.ZodObject<{
|
|
103
|
+
enabled: z.ZodLiteral<true>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
enabled: true;
|
|
106
|
+
}, {
|
|
107
|
+
enabled: true;
|
|
108
|
+
}>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
authSessions: {
|
|
111
|
+
enabled: false;
|
|
112
|
+
} | {
|
|
113
|
+
type: "API" | "MANUAL";
|
|
114
|
+
enabled: true;
|
|
115
|
+
startUrl?: string | undefined;
|
|
116
|
+
finishUrl?: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
apiAccess: {
|
|
119
|
+
enabled: true;
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
authSessions: {
|
|
123
|
+
enabled: false;
|
|
124
|
+
} | {
|
|
125
|
+
type: "API" | "MANUAL";
|
|
126
|
+
enabled: true;
|
|
127
|
+
startUrl?: string | undefined;
|
|
128
|
+
finishUrl?: string | undefined;
|
|
129
|
+
};
|
|
130
|
+
apiAccess: {
|
|
131
|
+
enabled: true;
|
|
132
|
+
};
|
|
133
|
+
}>]>>;
|
|
134
|
+
export type IntunedJson = z.infer<typeof intunedJsonSchema>;
|
|
135
|
+
export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
136
|
+
export declare function loadIntunedJson(): Promise<{
|
|
2
137
|
projectName?: string | undefined;
|
|
3
138
|
workspaceId?: string | undefined;
|
|
4
139
|
metadata?: {
|
|
@@ -6,9 +141,6 @@ export declare const loadIntunedJson: () => Promise<{
|
|
|
6
141
|
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
7
142
|
testAuthSessionInput?: Record<string, any> | undefined;
|
|
8
143
|
} | undefined;
|
|
9
|
-
stealthMode?: {
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
} | undefined;
|
|
12
144
|
} & {
|
|
13
145
|
[k: string]: unknown;
|
|
14
146
|
} & ({
|
|
@@ -31,9 +163,9 @@ export declare const loadIntunedJson: () => Promise<{
|
|
|
31
163
|
enabled: true;
|
|
32
164
|
};
|
|
33
165
|
})>;
|
|
34
|
-
export declare
|
|
35
|
-
name:
|
|
166
|
+
export declare function getIntunedSettingsFile(): Promise<{
|
|
167
|
+
name: typeof intunedSettingsFileNames[number];
|
|
36
168
|
path: string;
|
|
37
169
|
parse: (content: string) => any;
|
|
38
170
|
}>;
|
|
39
|
-
export declare
|
|
171
|
+
export declare function getIntunedSettingsFileName(): Promise<string>;
|
|
@@ -3,18 +3,85 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getIntunedSettingsFile = getIntunedSettingsFile;
|
|
7
|
+
exports.getIntunedSettingsFileName = getIntunedSettingsFileName;
|
|
8
|
+
exports.intunedSettingsFileNames = exports.intunedJsonSchema = void 0;
|
|
9
|
+
exports.loadIntunedJson = loadIntunedJson;
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
12
|
+
var _zod = require("zod");
|
|
7
13
|
var _errors = require("./errors");
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
var JSONC = _interopRequireWildcard(require("jsonc-parser"));
|
|
15
|
+
var YAML = _interopRequireWildcard(require("yaml"));
|
|
16
|
+
var TOML = _interopRequireWildcard(require("smol-toml"));
|
|
17
|
+
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); }
|
|
18
|
+
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 _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
|
|
21
|
+
projectName: _zod.z.string().optional(),
|
|
22
|
+
workspaceId: _zod.z.string().optional(),
|
|
23
|
+
metadata: _zod.z.object({
|
|
24
|
+
defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
25
|
+
defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
26
|
+
testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
|
|
27
|
+
}).optional().catch(undefined)
|
|
28
|
+
}).passthrough().and(_zod.z.union([_zod.z.object({
|
|
29
|
+
authSessions: _zod.z.object({
|
|
30
|
+
enabled: _zod.z.literal(false)
|
|
31
|
+
}),
|
|
32
|
+
apiAccess: _zod.z.object({
|
|
33
|
+
enabled: _zod.z.literal(false)
|
|
34
|
+
})
|
|
35
|
+
}), _zod.z.object({
|
|
36
|
+
authSessions: _zod.z.union([_zod.z.object({
|
|
37
|
+
enabled: _zod.z.literal(false)
|
|
38
|
+
}), _zod.z.object({
|
|
39
|
+
enabled: _zod.z.literal(true),
|
|
40
|
+
type: _zod.z.enum(["MANUAL", "API"]),
|
|
41
|
+
startUrl: _zod.z.string().optional(),
|
|
42
|
+
finishUrl: _zod.z.string().optional()
|
|
43
|
+
})]),
|
|
44
|
+
apiAccess: _zod.z.object({
|
|
45
|
+
enabled: _zod.z.literal(true)
|
|
46
|
+
})
|
|
47
|
+
})]));
|
|
48
|
+
const intunedSettingsFileNames = exports.intunedSettingsFileNames = ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
49
|
+
async function loadIntunedJson() {
|
|
50
|
+
const settingsFile = await getIntunedSettingsFile();
|
|
51
|
+
const intunedJsonContent = await fs.readFile(settingsFile.path, "utf-8");
|
|
52
|
+
let intunedJson;
|
|
53
|
+
try {
|
|
54
|
+
intunedJson = settingsFile.parse(intunedJsonContent);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
throw new _errors.CLIError(`Failed to parse ${settingsFile.name}: ${e.message}`);
|
|
57
|
+
}
|
|
58
|
+
const parseResult = intunedJsonSchema.safeParse(intunedJson);
|
|
59
|
+
if (!parseResult.success) {
|
|
60
|
+
const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
|
|
61
|
+
throw new _errors.CLIError(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
|
|
62
|
+
}
|
|
63
|
+
return parseResult.data;
|
|
64
|
+
}
|
|
65
|
+
const intunedSettingsParsers = {
|
|
66
|
+
"Intuned.json": JSON.parse,
|
|
67
|
+
"Intuned.jsonc": JSONC.parse,
|
|
68
|
+
"Intuned.yaml": YAML.parse,
|
|
69
|
+
"Intuned.yml": YAML.parse,
|
|
70
|
+
"Intuned.toml": TOML.parse
|
|
71
|
+
};
|
|
72
|
+
async function getIntunedSettingsFile() {
|
|
73
|
+
for (const fileName of intunedSettingsFileNames) {
|
|
74
|
+
const filePath = _path.default.join(process.cwd(), fileName);
|
|
75
|
+
if (await fs.exists(filePath)) {
|
|
76
|
+
return {
|
|
77
|
+
name: fileName,
|
|
78
|
+
path: filePath,
|
|
79
|
+
parse: intunedSettingsParsers[fileName]
|
|
80
|
+
};
|
|
14
81
|
}
|
|
15
|
-
|
|
16
|
-
|
|
82
|
+
}
|
|
83
|
+
throw new _errors.CLIError(`No Intuned settings file found.`);
|
|
17
84
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
85
|
+
async function getIntunedSettingsFileName() {
|
|
86
|
+
return (await getIntunedSettingsFile()).name;
|
|
87
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
4
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
4
5
|
var path = _interopRequireWildcard(require("path"));
|
|
5
|
-
var _intunedJson = require("./intunedJson");
|
|
6
6
|
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); }
|
|
7
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; }
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -11,13 +11,10 @@ _dotenv.default.config({
|
|
|
11
11
|
});
|
|
12
12
|
function isStealthModeEnabled() {
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
return settingsResult.value.stealthMode?.enabled === true;
|
|
14
|
+
const intunedConfigPath = path.resolve(process.cwd(), process.env.ROOT || "./", "Intuned.json");
|
|
15
|
+
const configContent = fs.readFileSync(intunedConfigPath, "utf8");
|
|
16
|
+
const config = JSON.parse(configContent);
|
|
17
|
+
return config.stealthMode?.enabled === true;
|
|
21
18
|
} catch (error) {
|
|
22
19
|
console.error("Error reading Intuned.json:", error.message);
|
|
23
20
|
return false;
|
|
@@ -23,8 +23,3 @@ export declare function launchChromium(options: LaunchChromiumStandaloneOptions)
|
|
|
23
23
|
export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
24
24
|
export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
25
25
|
export declare function getLocalCdpAddress(port: number): string;
|
|
26
|
-
export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
|
|
27
|
-
executablePath?: string;
|
|
28
|
-
args?: string[];
|
|
29
|
-
ignoreDefaultArgs?: string[];
|
|
30
|
-
}): Promise<string | undefined>;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getHeadlessUserAgent = getHeadlessUserAgent;
|
|
7
6
|
exports.getLocalCdpAddress = getLocalCdpAddress;
|
|
8
7
|
exports.launchBrowser = launchBrowser;
|
|
9
8
|
exports.launchChromium = launchChromium;
|
|
@@ -87,15 +86,10 @@ async function launchChromium(options) {
|
|
|
87
86
|
executablePath = undefined;
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
|
-
const viewport = null;
|
|
91
|
-
const userAgent = process.env.PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
|
|
92
|
-
executablePath
|
|
93
|
-
}));
|
|
94
89
|
const context = await playwright.chromium.launchPersistentContext(userDataDir, {
|
|
95
|
-
userAgent,
|
|
96
90
|
executablePath,
|
|
97
91
|
headless,
|
|
98
|
-
viewport,
|
|
92
|
+
viewport: null,
|
|
99
93
|
proxy,
|
|
100
94
|
downloadsPath,
|
|
101
95
|
args: extraArgs,
|
|
@@ -175,34 +169,4 @@ async function waitOnCdpAddress(cdpAddress) {
|
|
|
175
169
|
tcpTimeout: 1000,
|
|
176
170
|
window: 1000
|
|
177
171
|
});
|
|
178
|
-
}
|
|
179
|
-
async function getHeadlessUserAgent({
|
|
180
|
-
executablePath,
|
|
181
|
-
args,
|
|
182
|
-
ignoreDefaultArgs
|
|
183
|
-
}) {
|
|
184
|
-
if (!executablePath) {
|
|
185
|
-
const browserType = getBrowserType();
|
|
186
|
-
if (browserType === "brave") {
|
|
187
|
-
const braveExecutablePath = await getBraveExecutablePath();
|
|
188
|
-
if (await fs.exists(braveExecutablePath)) {
|
|
189
|
-
executablePath = braveExecutablePath;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const browser = await playwright.chromium.launch({
|
|
194
|
-
headless: true,
|
|
195
|
-
executablePath,
|
|
196
|
-
args,
|
|
197
|
-
ignoreDefaultArgs
|
|
198
|
-
});
|
|
199
|
-
const context = await browser.newContext();
|
|
200
|
-
const page = await context.newPage();
|
|
201
|
-
let userAgent = await page.evaluate(() => navigator.userAgent);
|
|
202
|
-
await browser.close();
|
|
203
|
-
if (!userAgent || typeof userAgent !== "string") {
|
|
204
|
-
return undefined;
|
|
205
|
-
}
|
|
206
|
-
userAgent = userAgent.replace("HeadlessChrome", "Chrome");
|
|
207
|
-
return userAgent;
|
|
208
172
|
}
|