@intuned/runtime 1.3.9 → 1.3.11
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/CHANGELOG.md +9 -0
- package/InterfaceTemplate/index.playwright.ts +1 -0
- package/bin/intuned +2 -0
- package/bin/intuned-api-run +2 -0
- package/bin/intuned-auth-session-check +2 -0
- package/bin/intuned-auth-session-create +2 -0
- package/bin/intuned-auth-session-load +2 -0
- package/dist/commands/common/utils/settings.js +3 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/controller/deploy.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/deploy.js +143 -6
- package/dist/commands/intuned-cli/controller/save.d.ts +4 -1
- package/dist/commands/intuned-cli/controller/save.js +8 -2
- package/dist/commands/intuned-cli/helpers/backend.js +1 -1
- package/dist/commands/intuned-cli/helpers/errors.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/errors.js +8 -1
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +113 -11
- package/dist/commands/intuned-cli/helpers/intunedJson.js +19 -3
- package/dist/commands/intuned-cli/helpers/wrapper.js +5 -0
- package/dist/commands/intuned-cli/main.js +1 -0
- package/dist/common/binStartupScript.d.ts +1 -0
- package/dist/common/binStartupScript.js +34 -0
- package/dist/common/settingsSchema.d.ts +13 -0
- package/dist/common/settingsSchema.js +6 -0
- package/package.json +15 -13
- package/bin/intuned-auth-session-refresh +0 -2
package/CHANGELOG.md
CHANGED
package/bin/intuned
CHANGED
package/bin/intuned-api-run
CHANGED
|
@@ -15,7 +15,7 @@ const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
|
15
15
|
authSession: _zod.z.string().optional(),
|
|
16
16
|
outputFile: _zod.z.string().optional()
|
|
17
17
|
});
|
|
18
|
-
const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-
|
|
18
|
+
const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-sessions-instances/<id>.json").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
|
|
19
19
|
authSession,
|
|
20
20
|
...rest
|
|
21
21
|
}) => {
|
|
@@ -14,7 +14,7 @@ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required
|
|
|
14
14
|
const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
15
15
|
id: _zod.z.string().optional()
|
|
16
16
|
});
|
|
17
|
-
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new auth session").argument("<parameters>", "Parameters for the auth session command").option("--id <id>", "ID of the auth session to use for the command. Defaults to ./auth-
|
|
17
|
+
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new auth session").argument("<parameters>", "Parameters for the auth session command").option("--id <id>", "ID of the auth session to use for the command. Defaults to ./auth-sessions-instances/[current timestamp].json")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], options) => {
|
|
18
18
|
await (0, _helpers.assertAuthEnabled)();
|
|
19
19
|
const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
|
|
20
20
|
await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
|
|
@@ -19,7 +19,7 @@ const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
|
19
19
|
authSessionCheckAttempts: _types.authSessionCheckAttemptsSchema,
|
|
20
20
|
authSessionCreateAttempts: _types.authSessionCreateAttemptsSchema
|
|
21
21
|
});
|
|
22
|
-
const runApiCommand = exports.runApiCommand = (0, _types.withBaseOptions)(_run.runCommand.command("api").description("Execute an Intuned API run with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-
|
|
22
|
+
const runApiCommand = exports.runApiCommand = (0, _types.withBaseOptions)(_run.runCommand.command("api").description("Execute an Intuned API run with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-sessions-instances/<id>").option("--retries <number>", "Number of retries for the API call", "1").option("--no-auth-session-auto-recreate", "disable auto recreate for auth session").option("--auth-session-check-attempts <number>", "auth session check attempts", "1").option("--auth-session-create-attempts <number>", "auth session create attempts", "1").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
|
|
23
23
|
retries,
|
|
24
24
|
outputFile,
|
|
25
25
|
authSession,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthCredentials } from "../types";
|
|
3
|
+
export declare const START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
3
4
|
export declare function runDeployProject(projectName: string, auth: AuthCredentials): Promise<void>;
|
|
4
5
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.projectNameSchema = void 0;
|
|
6
|
+
exports.projectNameSchema = exports.START_RUN_INPUT_QUERY_PARAM_KEY = void 0;
|
|
7
7
|
exports.runDeployProject = runDeployProject;
|
|
8
8
|
var _zod = require("zod");
|
|
9
9
|
var _constants = require("../constants");
|
|
@@ -13,9 +13,22 @@ var _promises = require("timers/promises");
|
|
|
13
13
|
var _ms = _interopRequireDefault(require("ms"));
|
|
14
14
|
var _save = require("./save");
|
|
15
15
|
var _constants2 = require("../../../common/constants");
|
|
16
|
+
var _path = _interopRequireDefault(require("path"));
|
|
17
|
+
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
18
|
+
var _prompts = _interopRequireDefault(require("prompts"));
|
|
19
|
+
var _terminalLink = _interopRequireDefault(require("terminal-link"));
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
16
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
const START_RUN_INPUT_QUERY_PARAM_KEY = exports.START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
17
24
|
async function runDeployProject(projectName, auth) {
|
|
18
|
-
await (0, _save.runSaveProject)(projectName, auth);
|
|
25
|
+
const result = await (0, _save.runSaveProject)(projectName, auth);
|
|
26
|
+
const enableFirstRunExperience = result?.enableFirstRunExperience ?? false;
|
|
27
|
+
let firstRunExperienceInput = undefined;
|
|
28
|
+
const settings = await (0, _helpers.loadIntunedJson)();
|
|
29
|
+
if (enableFirstRunExperience) {
|
|
30
|
+
firstRunExperienceInput = await promptFirstRunExperience(settings);
|
|
31
|
+
}
|
|
19
32
|
const {
|
|
20
33
|
workspaceId,
|
|
21
34
|
apiKey
|
|
@@ -28,7 +41,10 @@ async function runDeployProject(projectName, auth) {
|
|
|
28
41
|
};
|
|
29
42
|
const response = await fetch(url, {
|
|
30
43
|
headers,
|
|
31
|
-
method: "POST"
|
|
44
|
+
method: "POST",
|
|
45
|
+
body: JSON.stringify({
|
|
46
|
+
firstRunExperienceInput
|
|
47
|
+
})
|
|
32
48
|
});
|
|
33
49
|
if (!response.ok) {
|
|
34
50
|
if (response.status === 401) {
|
|
@@ -85,8 +101,40 @@ async function runDeployProject(projectName, auth) {
|
|
|
85
101
|
}
|
|
86
102
|
if (status === "completed") {
|
|
87
103
|
const url = (0, _helpers.getBaseUrl)();
|
|
88
|
-
(0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n`);
|
|
89
|
-
|
|
104
|
+
(0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n\n`);
|
|
105
|
+
const projectUrl = `${url}/projects/${projectId}`;
|
|
106
|
+
const runsUrl = `${projectUrl}/runs`;
|
|
107
|
+
const jobsUrl = `${projectUrl}/jobs`;
|
|
108
|
+
const runsPlaygroundUrl = `${runsUrl}?${buildRunsPlaygroundQueryParams({
|
|
109
|
+
enableFirstRunExperience,
|
|
110
|
+
settings,
|
|
111
|
+
testAuthSessionId: rest.testAuthSessionId
|
|
112
|
+
})}`;
|
|
113
|
+
const defaultJobTriggerUrl = rest.defaultJobId ? `${jobsUrl}/${rest.defaultJobId}?action=trigger` : undefined;
|
|
114
|
+
const actions = [{
|
|
115
|
+
label: "View Project",
|
|
116
|
+
url: runsUrl
|
|
117
|
+
}, ...(settings.apiAccess.enabled ? [{
|
|
118
|
+
label: "Run Playground",
|
|
119
|
+
url: runsPlaygroundUrl
|
|
120
|
+
}] : []), {
|
|
121
|
+
label: "Manage Jobs",
|
|
122
|
+
url: jobsUrl
|
|
123
|
+
}, ...(defaultJobTriggerUrl !== undefined ? [{
|
|
124
|
+
label: "Trigger Default Job",
|
|
125
|
+
url: defaultJobTriggerUrl
|
|
126
|
+
}] : [])];
|
|
127
|
+
if (_terminalLink.default.isSupported) {
|
|
128
|
+
for (const action of actions) {
|
|
129
|
+
const link = (0, _terminalLink.default)(`[ ${action.label} ]`, action.url);
|
|
130
|
+
(0, _terminal.terminal)(`^+${link.replaceAll("%", "%%")}^ `);
|
|
131
|
+
}
|
|
132
|
+
(0, _terminal.terminal)("\n");
|
|
133
|
+
} else {
|
|
134
|
+
for (const action of actions) {
|
|
135
|
+
(0, _terminal.terminal)(`^+${action.label}:^ ^c^_${action.url}^:\n`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
90
138
|
return;
|
|
91
139
|
}
|
|
92
140
|
let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
|
|
@@ -136,4 +184,93 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
136
184
|
status: "failed",
|
|
137
185
|
message: `Deployment failed, please try again: ${data.message}`
|
|
138
186
|
};
|
|
139
|
-
};
|
|
187
|
+
};
|
|
188
|
+
async function promptFirstRunExperience(settings) {
|
|
189
|
+
let testAuthSessionInput = undefined;
|
|
190
|
+
const shouldPromptForTestAuthSession = settings.authSessions.enabled && settings.authSessions.type === "API";
|
|
191
|
+
const defaultJobInput = settings.metadata?.defaultJobInput;
|
|
192
|
+
const shouldPromptForDefaultJob = defaultJobInput !== undefined;
|
|
193
|
+
if (shouldPromptForTestAuthSession) {
|
|
194
|
+
testAuthSessionInput = await promptFirstRunExperienceTestAuthSessionParameters({
|
|
195
|
+
shouldPromptForDefaultJob
|
|
196
|
+
});
|
|
197
|
+
if (!testAuthSessionInput) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
testAuthSessionInput,
|
|
203
|
+
defaultJobInput: shouldPromptForDefaultJob ? await promptFirstRunExperienceDefaultJobParameters({
|
|
204
|
+
defaultJobInput
|
|
205
|
+
}) : undefined
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
async function promptFirstRunExperienceTestAuthSessionParameters({
|
|
209
|
+
shouldPromptForDefaultJob
|
|
210
|
+
}) {
|
|
211
|
+
const authSessionInstancesDirectory = _path.default.join(process.cwd(), _constants2.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
|
|
212
|
+
if (!(await fs.exists(authSessionInstancesDirectory))) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const authSessionId = (await fs.readdir(authSessionInstancesDirectory)).shift();
|
|
216
|
+
if (!authSessionId) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const {
|
|
220
|
+
metadata
|
|
221
|
+
} = await (0, _helpers.loadAuthSessionInstance)(authSessionId);
|
|
222
|
+
if (!metadata.authSessionId) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const message = shouldPromptForDefaultJob ? `^:^+Create a test auth session using^ ^c${authSessionId}^:^+ parameters?^ ^/(required for creating default job)^:` : `^:^+Create a test auth session using^ ^c${authSessionId}^:^+ parameters?^:`;
|
|
226
|
+
const {
|
|
227
|
+
value
|
|
228
|
+
} = await (0, _prompts.default)({
|
|
229
|
+
type: "confirm",
|
|
230
|
+
name: "value",
|
|
231
|
+
message: _terminal.terminal.str(message).toString(),
|
|
232
|
+
initial: true
|
|
233
|
+
});
|
|
234
|
+
if (value === undefined) {
|
|
235
|
+
throw new _helpers.AbortedCLIError();
|
|
236
|
+
}
|
|
237
|
+
if (value) {
|
|
238
|
+
return metadata.authSessionInput;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async function promptFirstRunExperienceDefaultJobParameters({
|
|
242
|
+
defaultJobInput
|
|
243
|
+
}) {
|
|
244
|
+
const {
|
|
245
|
+
value
|
|
246
|
+
} = await (0, _prompts.default)({
|
|
247
|
+
type: "confirm",
|
|
248
|
+
name: "value",
|
|
249
|
+
message: _terminal.terminal.str(`^:^+Create a default job with sample parameters?^:`).toString(),
|
|
250
|
+
initial: true
|
|
251
|
+
});
|
|
252
|
+
if (value === undefined) {
|
|
253
|
+
throw new _helpers.AbortedCLIError();
|
|
254
|
+
}
|
|
255
|
+
if (value) {
|
|
256
|
+
return defaultJobInput;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function buildRunsPlaygroundQueryParams({
|
|
260
|
+
enableFirstRunExperience,
|
|
261
|
+
settings,
|
|
262
|
+
testAuthSessionId
|
|
263
|
+
}) {
|
|
264
|
+
const params = new URLSearchParams();
|
|
265
|
+
if (!enableFirstRunExperience) return params.toString();
|
|
266
|
+
params.set(START_RUN_INPUT_QUERY_PARAM_KEY, JSON.stringify({}));
|
|
267
|
+
const input = settings.metadata?.defaultRunPlaygroundInput;
|
|
268
|
+
if (!input) return params.toString();
|
|
269
|
+
if (testAuthSessionId) {
|
|
270
|
+
input.authSessionId = testAuthSessionId;
|
|
271
|
+
}
|
|
272
|
+
params.set(START_RUN_INPUT_QUERY_PARAM_KEY, JSON.stringify({
|
|
273
|
+
...input
|
|
274
|
+
}));
|
|
275
|
+
return params.toString();
|
|
276
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthCredentials } from "../types";
|
|
3
|
-
export declare function runSaveProject(projectName: string, auth: AuthCredentials): Promise<
|
|
3
|
+
export declare function runSaveProject(projectName: string, auth: AuthCredentials): Promise<{
|
|
4
|
+
projectId: string;
|
|
5
|
+
enableFirstRunExperience: boolean | undefined;
|
|
6
|
+
} | undefined>;
|
|
4
7
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
5
8
|
export declare const validateProjectName: (projectName: string) => {
|
|
6
9
|
isValid: true;
|
|
@@ -33,7 +33,8 @@ const saveProjectApiResponseSchema = _zod.z.string().transform((val, ctx) => {
|
|
|
33
33
|
return _zod.z.NEVER;
|
|
34
34
|
}
|
|
35
35
|
}).pipe(_zod.z.object({
|
|
36
|
-
id: _zod.z.string().uuid()
|
|
36
|
+
id: _zod.z.string().uuid(),
|
|
37
|
+
enableFirstRunExperience: _zod.z.boolean().optional()
|
|
37
38
|
}));
|
|
38
39
|
async function runSaveProject(projectName, auth) {
|
|
39
40
|
const {
|
|
@@ -86,7 +87,8 @@ async function runSaveProject(projectName, auth) {
|
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
const {
|
|
89
|
-
id: projectId
|
|
90
|
+
id: projectId,
|
|
91
|
+
enableFirstRunExperience
|
|
90
92
|
} = parseResult.data;
|
|
91
93
|
const dotEnvPath = path.join(projectPath, ".env");
|
|
92
94
|
if (!(await fs.exists(dotEnvPath))) {
|
|
@@ -111,6 +113,10 @@ ${_constants2.API_KEY_ENV_VAR_KEY}=${apiKey}`);
|
|
|
111
113
|
await fs.appendFile(dotEnvPath, contentToAppend + "\n");
|
|
112
114
|
(0, _terminal.terminal)(`^g^+Updated .env file with project credentials.^:\n`);
|
|
113
115
|
}
|
|
116
|
+
return {
|
|
117
|
+
projectId,
|
|
118
|
+
enableFirstRunExperience
|
|
119
|
+
};
|
|
114
120
|
}
|
|
115
121
|
const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(200, "Name must be 200 characters or less").regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/, "Name can only contain lowercase letters, numbers, hyphens, and underscores in between").refine(value => !_zod.z.string().uuid().safeParse(value).success, {
|
|
116
122
|
message: "Name cannot be a UUID"
|
|
@@ -23,5 +23,5 @@ async function getAuthCredentials(options) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function getBaseUrl() {
|
|
26
|
-
return process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io
|
|
26
|
+
return new URL(process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io`).origin;
|
|
27
27
|
}
|
|
@@ -5,6 +5,9 @@ export declare class CLIError extends Error {
|
|
|
5
5
|
autoColor?: boolean;
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
|
+
export declare class AbortedCLIError extends CLIError {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
8
11
|
export declare class CLIAssertionError extends CLIError {
|
|
9
12
|
constructor(message: string, options?: {
|
|
10
13
|
autoColor?: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CLIError = exports.CLIAssertionError = void 0;
|
|
6
|
+
exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
|
|
7
7
|
exports.logAutomationError = logAutomationError;
|
|
8
8
|
var _runApi = require("../../../common/runApi");
|
|
9
9
|
var _terminal = require("./terminal");
|
|
@@ -15,6 +15,13 @@ class CLIError extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.CLIError = CLIError;
|
|
18
|
+
class AbortedCLIError extends CLIError {
|
|
19
|
+
constructor() {
|
|
20
|
+
super("Aborted");
|
|
21
|
+
this.name = "AbortedCLIError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.AbortedCLIError = AbortedCLIError;
|
|
18
25
|
class CLIAssertionError extends CLIError {
|
|
19
26
|
constructor(message, options) {
|
|
20
27
|
super(message, options);
|
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const intunedJsonSchema: z.ZodObject<{
|
|
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<{
|
|
3
80
|
authSessions: z.ZodUnion<[z.ZodObject<{
|
|
4
81
|
enabled: z.ZodLiteral<false>;
|
|
5
82
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -22,8 +99,13 @@ export declare const intunedJsonSchema: z.ZodObject<{
|
|
|
22
99
|
startUrl?: string | undefined;
|
|
23
100
|
finishUrl?: string | undefined;
|
|
24
101
|
}>]>;
|
|
25
|
-
|
|
26
|
-
|
|
102
|
+
apiAccess: z.ZodObject<{
|
|
103
|
+
enabled: z.ZodLiteral<true>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
enabled: true;
|
|
106
|
+
}, {
|
|
107
|
+
enabled: true;
|
|
108
|
+
}>;
|
|
27
109
|
}, "strip", z.ZodTypeAny, {
|
|
28
110
|
authSessions: {
|
|
29
111
|
enabled: false;
|
|
@@ -33,8 +115,9 @@ export declare const intunedJsonSchema: z.ZodObject<{
|
|
|
33
115
|
startUrl?: string | undefined;
|
|
34
116
|
finishUrl?: string | undefined;
|
|
35
117
|
};
|
|
36
|
-
|
|
37
|
-
|
|
118
|
+
apiAccess: {
|
|
119
|
+
enabled: true;
|
|
120
|
+
};
|
|
38
121
|
}, {
|
|
39
122
|
authSessions: {
|
|
40
123
|
enabled: false;
|
|
@@ -44,12 +127,30 @@ export declare const intunedJsonSchema: z.ZodObject<{
|
|
|
44
127
|
startUrl?: string | undefined;
|
|
45
128
|
finishUrl?: string | undefined;
|
|
46
129
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
130
|
+
apiAccess: {
|
|
131
|
+
enabled: true;
|
|
132
|
+
};
|
|
133
|
+
}>]>>;
|
|
50
134
|
export type IntunedJson = z.infer<typeof intunedJsonSchema>;
|
|
51
135
|
export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
52
136
|
export declare function loadIntunedJson(): Promise<{
|
|
137
|
+
projectName?: string | undefined;
|
|
138
|
+
workspaceId?: string | undefined;
|
|
139
|
+
metadata?: {
|
|
140
|
+
defaultJobInput?: Record<string, any> | undefined;
|
|
141
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
142
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
} & {
|
|
145
|
+
[k: string]: unknown;
|
|
146
|
+
} & ({
|
|
147
|
+
authSessions: {
|
|
148
|
+
enabled: false;
|
|
149
|
+
};
|
|
150
|
+
apiAccess: {
|
|
151
|
+
enabled: false;
|
|
152
|
+
};
|
|
153
|
+
} | {
|
|
53
154
|
authSessions: {
|
|
54
155
|
enabled: false;
|
|
55
156
|
} | {
|
|
@@ -58,9 +159,10 @@ export declare function loadIntunedJson(): Promise<{
|
|
|
58
159
|
startUrl?: string | undefined;
|
|
59
160
|
finishUrl?: string | undefined;
|
|
60
161
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
162
|
+
apiAccess: {
|
|
163
|
+
enabled: true;
|
|
164
|
+
};
|
|
165
|
+
})>;
|
|
64
166
|
export declare function getIntunedSettingsFile(): Promise<{
|
|
65
167
|
name: typeof intunedSettingsFileNames[number];
|
|
66
168
|
path: string;
|
|
@@ -18,6 +18,21 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
18
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
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
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({
|
|
21
36
|
authSessions: _zod.z.union([_zod.z.object({
|
|
22
37
|
enabled: _zod.z.literal(false)
|
|
23
38
|
}), _zod.z.object({
|
|
@@ -26,9 +41,10 @@ const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
|
|
|
26
41
|
startUrl: _zod.z.string().optional(),
|
|
27
42
|
finishUrl: _zod.z.string().optional()
|
|
28
43
|
})]),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
44
|
+
apiAccess: _zod.z.object({
|
|
45
|
+
enabled: _zod.z.literal(true)
|
|
46
|
+
})
|
|
47
|
+
})]));
|
|
32
48
|
const intunedSettingsFileNames = exports.intunedSettingsFileNames = ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
33
49
|
async function loadIntunedJson() {
|
|
34
50
|
const settingsFile = await getIntunedSettingsFile();
|
|
@@ -34,6 +34,11 @@ function cliCommandWrapper(argsSchema, optionsSchema, fn) {
|
|
|
34
34
|
await (0, _browser.closeCliBrowser)();
|
|
35
35
|
process.exit(0);
|
|
36
36
|
} catch (error) {
|
|
37
|
+
if (error instanceof _errors.AbortedCLIError) {
|
|
38
|
+
(0, _terminal.terminal)(`\n^r^+Aborted.^:\n`);
|
|
39
|
+
await (0, _browser.closeCliBrowser)();
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
37
42
|
if (error instanceof _errors.CLIError) {
|
|
38
43
|
if (error.autoColor) {
|
|
39
44
|
(0, _terminal.terminal)(`^r^+${error.message}^:\n`);
|
|
@@ -6,6 +6,7 @@ var _backend = require("./helpers/backend");
|
|
|
6
6
|
var _commands = require("./commands");
|
|
7
7
|
var _helpers = require("./helpers");
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
require("../../common/binStartupScript");
|
|
9
10
|
_dotenv.default.config({
|
|
10
11
|
path: `.env`
|
|
11
12
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
4
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
5
|
+
var path = _interopRequireWildcard(require("path"));
|
|
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
|
+
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
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
_dotenv.default.config({
|
|
10
|
+
path: `.env`
|
|
11
|
+
});
|
|
12
|
+
function isStealthModeEnabled() {
|
|
13
|
+
try {
|
|
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;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error("Error reading Intuned.json:", error.message);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
if (isStealthModeEnabled()) {
|
|
25
|
+
const currentNodeModules = path.resolve(process.cwd(), "node_modules");
|
|
26
|
+
process.env.NODE_PATH = process.env.NODE_PATH ? `${process.env.NODE_PATH}:${currentNodeModules}` : currentNodeModules;
|
|
27
|
+
require("module").Module._initPaths();
|
|
28
|
+
if (process.env.PLAYWRIGHT_PATCH_SCRIPT_PATH) {
|
|
29
|
+
require(process.env.PLAYWRIGHT_PATCH_SCRIPT_PATH);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Failed to apply stealth mode");
|
|
34
|
+
}
|
|
@@ -208,6 +208,13 @@ export declare const settingsSchema: z.ZodObject<{
|
|
|
208
208
|
}, {
|
|
209
209
|
enabled: boolean;
|
|
210
210
|
}>>>;
|
|
211
|
+
stealthMode: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
212
|
+
enabled: z.ZodBoolean;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
enabled: boolean;
|
|
215
|
+
}, {
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
}>>>;
|
|
211
218
|
captchaSolver: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
212
219
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
213
220
|
cloudflare: z.ZodOptional<z.ZodObject<{
|
|
@@ -407,6 +414,9 @@ export declare const settingsSchema: z.ZodObject<{
|
|
|
407
414
|
authSessions: {
|
|
408
415
|
enabled: boolean;
|
|
409
416
|
};
|
|
417
|
+
stealthMode: {
|
|
418
|
+
enabled: boolean;
|
|
419
|
+
};
|
|
410
420
|
captchaSolver?: {
|
|
411
421
|
enabled: boolean;
|
|
412
422
|
settings: {
|
|
@@ -456,6 +466,9 @@ export declare const settingsSchema: z.ZodObject<{
|
|
|
456
466
|
authSessions?: {
|
|
457
467
|
enabled: boolean;
|
|
458
468
|
} | undefined;
|
|
469
|
+
stealthMode?: {
|
|
470
|
+
enabled: boolean;
|
|
471
|
+
} | undefined;
|
|
459
472
|
captchaSolver?: {
|
|
460
473
|
enabled?: boolean | undefined;
|
|
461
474
|
cloudflare?: {
|
|
@@ -45,7 +45,13 @@ const authSessionsSchema = z.object({
|
|
|
45
45
|
}).optional().default({
|
|
46
46
|
enabled: false
|
|
47
47
|
});
|
|
48
|
+
const stealthModeSchema = z.object({
|
|
49
|
+
enabled: z.boolean()
|
|
50
|
+
}).optional().default({
|
|
51
|
+
enabled: false
|
|
52
|
+
});
|
|
48
53
|
const settingsSchema = exports.settingsSchema = z.object({
|
|
49
54
|
authSessions: authSessionsSchema,
|
|
55
|
+
stealthMode: stealthModeSchema,
|
|
50
56
|
captchaSolver: captchaSolverSettingsSchema.optional()
|
|
51
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
|
|
15
15
|
"./dist/common/constants": "./dist/common/constants.js",
|
|
16
16
|
"./dist/commands/interface/run": "./dist/commands/interface/run.js",
|
|
17
|
-
"./dist/commands/intuned-run/intuned-run": "./dist/commands/intuned-run/intuned-run.js"
|
|
17
|
+
"./dist/commands/intuned-run/intuned-run": "./dist/commands/intuned-run/intuned-run.js",
|
|
18
|
+
"./dist/common/binStartupScript": "./dist/common/binStartupScript.js"
|
|
18
19
|
},
|
|
19
20
|
"types": "./dist/index.d.ts",
|
|
20
21
|
"author": "Intuned Team",
|
|
@@ -26,7 +27,6 @@
|
|
|
26
27
|
"intuned-build": "yarn prepublishOnly && vite-node ./src/commands/build.ts",
|
|
27
28
|
"intuned-auth-session-check": "vite-node ./src/commands/auth/run-check.ts",
|
|
28
29
|
"intuned-auth-session-create": "vite-node ./src/commands/auth/run-create.ts",
|
|
29
|
-
"intuned-auth-session-refresh": "vite-node ./src/commands/auth/run-refresh.ts",
|
|
30
30
|
"intuned-auth-session-load": "vite-node ./src/commands/auth/load.ts",
|
|
31
31
|
"intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
|
|
32
32
|
"intuned": "vite-node ./src/commands/intuned-cli/main.ts",
|
|
@@ -42,16 +42,15 @@
|
|
|
42
42
|
"copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
|
|
43
43
|
},
|
|
44
44
|
"bin": {
|
|
45
|
-
"intuned-api-run": "
|
|
46
|
-
"intuned-auth-session-create": "
|
|
47
|
-
"intuned-auth-session-
|
|
48
|
-
"intuned-auth-session-
|
|
49
|
-
"intuned-
|
|
50
|
-
"intuned-
|
|
51
|
-
"intuned-browser-
|
|
52
|
-
"intuned-
|
|
53
|
-
"intuned
|
|
54
|
-
"intuned": "./bin/intuned"
|
|
45
|
+
"intuned-api-run": "bin/intuned-api-run",
|
|
46
|
+
"intuned-auth-session-create": "bin/intuned-auth-session-create",
|
|
47
|
+
"intuned-auth-session-load": "bin/intuned-auth-session-load",
|
|
48
|
+
"intuned-auth-session-check": "bin/intuned-auth-session-check",
|
|
49
|
+
"intuned-build": "bin/intuned-build",
|
|
50
|
+
"intuned-browser-start": "bin/intuned-browser-start",
|
|
51
|
+
"intuned-browser-save-state": "bin/intuned-browser-save-state",
|
|
52
|
+
"intuned-ts-check": "bin/intuned-ts-check",
|
|
53
|
+
"intuned": "bin/intuned"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
56
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
@@ -82,10 +81,12 @@
|
|
|
82
81
|
"portfinder": "^1.0.37",
|
|
83
82
|
"prettier": "2.8.0",
|
|
84
83
|
"promptly": "3.2.0",
|
|
84
|
+
"prompts": "^2.4.2",
|
|
85
85
|
"rollup": "3.26.2",
|
|
86
86
|
"smol-toml": "^1.4.2",
|
|
87
87
|
"source-map": "0.7.4",
|
|
88
88
|
"terminal-kit": "^3.1.2",
|
|
89
|
+
"terminal-link": "2.1.1",
|
|
89
90
|
"ts-morph": "21.0.1",
|
|
90
91
|
"ts-node": "10.9.1",
|
|
91
92
|
"tslib": "2.6.0",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
"@types/jsdom": "^21.1.1",
|
|
108
109
|
"@types/ms": "^2.1.0",
|
|
109
110
|
"@types/promptly": "^3.0.4",
|
|
111
|
+
"@types/prompts": "^2.4.9",
|
|
110
112
|
"@types/terminal-kit": "^2.5.7",
|
|
111
113
|
"@types/wait-on": "^5.3.4",
|
|
112
114
|
"@typescript-eslint/eslint-plugin": "^5.47.1",
|