@intuned/runtime-dev 1.3.8-jsonl.0 → 1.3.9-deploy.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/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/authsession_record.command.d.ts +1 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +3 -2
- 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 +144 -7
- package/dist/commands/intuned-cli/controller/save.d.ts +4 -1
- package/dist/commands/intuned-cli/controller/save.js +9 -3
- 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/package.json +4 -2
|
@@ -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)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const authSessionRecordCommand: import("commander").Command;
|
|
1
|
+
export declare const authSessionRecordCommand: import("commander").Command | null;
|
|
@@ -13,7 +13,8 @@ var _types = require("./types");
|
|
|
13
13
|
const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
14
14
|
id: _zod.z.string().optional()
|
|
15
15
|
});
|
|
16
|
-
const
|
|
16
|
+
const isAuthSessionRecorderEnabled = process.env.INTUNED_AUTH_SESSION_RECORDER_ENABLED === "true";
|
|
17
|
+
const authSessionRecordCommand = exports.authSessionRecordCommand = isAuthSessionRecorderEnabled ? (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("record").description("Record a new auth session").option("--id <id>", "ID of the auth session to use for the command. Defaults to auth-session-[current timestamp]").option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async (_, {
|
|
17
18
|
checkAttempts,
|
|
18
19
|
...rest
|
|
19
20
|
}) => {
|
|
@@ -28,4 +29,4 @@ const authSessionRecordCommand = exports.authSessionRecordCommand = (0, _types.w
|
|
|
28
29
|
finishUrl,
|
|
29
30
|
...rest
|
|
30
31
|
});
|
|
31
|
-
}));
|
|
32
|
+
})) : null;
|
|
@@ -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 firstRunInfo = undefined;
|
|
28
|
+
const settings = await (0, _helpers.loadIntunedJson)();
|
|
29
|
+
if (enableFirstRunExperience) {
|
|
30
|
+
firstRunInfo = 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
|
+
firstRunInfo
|
|
47
|
+
})
|
|
32
48
|
});
|
|
33
49
|
if (!response.ok) {
|
|
34
50
|
if (response.status === 401) {
|
|
@@ -85,8 +101,39 @@ 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
|
+
(0, _terminal.terminal)(`^+${(0, _terminalLink.default)(`[ ${action.label} ]`, action.url)}^ `);
|
|
130
|
+
}
|
|
131
|
+
(0, _terminal.terminal)("\n");
|
|
132
|
+
} else {
|
|
133
|
+
for (const action of actions) {
|
|
134
|
+
(0, _terminal.terminal)(`^+${action.label}:^ ^c^_${action.url}^:\n`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
90
137
|
return;
|
|
91
138
|
}
|
|
92
139
|
let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
|
|
@@ -105,7 +152,7 @@ async function runDeployProject(projectName, auth) {
|
|
|
105
152
|
throw e;
|
|
106
153
|
}
|
|
107
154
|
}
|
|
108
|
-
const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(
|
|
155
|
+
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, {
|
|
109
156
|
message: "Name cannot be a UUID"
|
|
110
157
|
});
|
|
111
158
|
const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey) => {
|
|
@@ -136,4 +183,94 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
136
183
|
status: "failed",
|
|
137
184
|
message: `Deployment failed, please try again: ${data.message}`
|
|
138
185
|
};
|
|
139
|
-
};
|
|
186
|
+
};
|
|
187
|
+
async function promptFirstRunExperience(settings) {
|
|
188
|
+
let testAuthSessionInput = undefined;
|
|
189
|
+
const shouldPromptForTestAuthSession = settings.authSessions.enabled && settings.authSessions.type === "API";
|
|
190
|
+
const defaultJobInput = settings.metadata?.defaultJobInput;
|
|
191
|
+
const shouldPromptForDefaultJob = defaultJobInput !== undefined;
|
|
192
|
+
if (shouldPromptForTestAuthSession) {
|
|
193
|
+
testAuthSessionInput = await promptFirstRunExperienceTestAuthSessionParameters({
|
|
194
|
+
shouldPromptForDefaultJob
|
|
195
|
+
});
|
|
196
|
+
if (!testAuthSessionInput) {
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
testAuthSessionInput,
|
|
202
|
+
defaultJobInput: shouldPromptForDefaultJob ? await promptFirstRunExperienceDefaultJobParameters({
|
|
203
|
+
defaultJobInput
|
|
204
|
+
}) : undefined
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
async function promptFirstRunExperienceTestAuthSessionParameters({
|
|
208
|
+
shouldPromptForDefaultJob
|
|
209
|
+
}) {
|
|
210
|
+
const authSessionInstancesDirectory = _path.default.join(process.cwd(), _constants2.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
|
|
211
|
+
if (!(await fs.exists(authSessionInstancesDirectory))) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const authSessionId = (await fs.readdir(authSessionInstancesDirectory)).shift();
|
|
215
|
+
if (!authSessionId) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const {
|
|
219
|
+
metadata
|
|
220
|
+
} = await (0, _helpers.loadAuthSessionInstance)(authSessionId);
|
|
221
|
+
if (!metadata.authSessionId) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
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?^:`;
|
|
225
|
+
const {
|
|
226
|
+
value
|
|
227
|
+
} = await (0, _prompts.default)({
|
|
228
|
+
type: "confirm",
|
|
229
|
+
name: "value",
|
|
230
|
+
message: _terminal.terminal.str(message).toString(),
|
|
231
|
+
initial: true
|
|
232
|
+
});
|
|
233
|
+
if (value === undefined) {
|
|
234
|
+
throw new _helpers.AbortedCLIError();
|
|
235
|
+
}
|
|
236
|
+
if (value) {
|
|
237
|
+
return metadata.authSessionInput;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async function promptFirstRunExperienceDefaultJobParameters({
|
|
241
|
+
defaultJobInput
|
|
242
|
+
}) {
|
|
243
|
+
const {
|
|
244
|
+
value
|
|
245
|
+
} = await (0, _prompts.default)({
|
|
246
|
+
type: "confirm",
|
|
247
|
+
name: "value",
|
|
248
|
+
message: _terminal.terminal.str(`^:^+Create a default job with sample parameters?^:`).toString(),
|
|
249
|
+
initial: true
|
|
250
|
+
});
|
|
251
|
+
if (value === undefined) {
|
|
252
|
+
throw new _helpers.AbortedCLIError();
|
|
253
|
+
}
|
|
254
|
+
if (value) {
|
|
255
|
+
return defaultJobInput;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function buildRunsPlaygroundQueryParams({
|
|
259
|
+
enableFirstRunExperience,
|
|
260
|
+
settings,
|
|
261
|
+
testAuthSessionId
|
|
262
|
+
}) {
|
|
263
|
+
const params = new URLSearchParams();
|
|
264
|
+
if (!enableFirstRunExperience) return params.toString();
|
|
265
|
+
const input = settings.metadata?.defaultRunPlaygroundInput ?? {};
|
|
266
|
+
if (!input) return params.toString();
|
|
267
|
+
if (testAuthSessionId) {
|
|
268
|
+
input.authSession = {
|
|
269
|
+
id: testAuthSessionId
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
params.append(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,8 +113,12 @@ ${_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
|
-
const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(
|
|
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"
|
|
117
123
|
});
|
|
118
124
|
const validateProjectName = projectName => {
|
|
@@ -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.ZodOptional<z.ZodObject<{
|
|
6
|
+
defaultJobInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
7
|
+
defaultRunPlaygroundInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
8
|
+
testAuthSessionInput: 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?: Record<string, any> | undefined;
|
|
15
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
16
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
19
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
20
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
defaultJobInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
23
|
+
defaultRunPlaygroundInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
24
|
+
testAuthSessionInput: 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?: Record<string, any> | undefined;
|
|
31
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
32
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
33
|
+
}>>;
|
|
34
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
35
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
37
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
defaultJobInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
39
|
+
defaultRunPlaygroundInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
40
|
+
testAuthSessionInput: 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?: Record<string, any> | undefined;
|
|
47
|
+
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
48
|
+
testAuthSessionInput?: Record<string, any> | undefined;
|
|
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(),
|
|
25
|
+
defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional(),
|
|
26
|
+
testAuthSessionInput: _zod.z.record(_zod.z.any()).optional()
|
|
27
|
+
}).optional()
|
|
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();
|
|
@@ -33,6 +33,11 @@ function cliCommandWrapper(argsSchema, optionsSchema, fn) {
|
|
|
33
33
|
await (0, _browser.closeCliBrowser)();
|
|
34
34
|
process.exit(0);
|
|
35
35
|
} catch (error) {
|
|
36
|
+
if (error instanceof _errors.AbortedCLIError) {
|
|
37
|
+
(0, _terminal.terminal)(`\n^r^+Aborted.^:\n`);
|
|
38
|
+
await (0, _browser.closeCliBrowser)();
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
36
41
|
if (error instanceof _errors.CLIError) {
|
|
37
42
|
if (error.autoColor) {
|
|
38
43
|
(0, _terminal.terminal)(`^r^+${error.message}^:\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9-deploy.0",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
"dotenv": "^16.3.1",
|
|
72
72
|
"fs-extra": "^11.3.0",
|
|
73
73
|
"image-size": "^1.1.1",
|
|
74
|
-
"inquirer": "12.6.0",
|
|
75
74
|
"jsonc-parser": "^3.3.1",
|
|
76
75
|
"jsonwebtoken": "9.0.2",
|
|
77
76
|
"lodash": "4.17.21",
|
|
@@ -83,10 +82,12 @@
|
|
|
83
82
|
"portfinder": "^1.0.37",
|
|
84
83
|
"prettier": "2.8.0",
|
|
85
84
|
"promptly": "3.2.0",
|
|
85
|
+
"prompts": "^2.4.2",
|
|
86
86
|
"rollup": "3.26.2",
|
|
87
87
|
"smol-toml": "^1.4.2",
|
|
88
88
|
"source-map": "0.7.4",
|
|
89
89
|
"terminal-kit": "^3.1.2",
|
|
90
|
+
"terminal-link": "2.1.1",
|
|
90
91
|
"ts-morph": "21.0.1",
|
|
91
92
|
"ts-node": "10.9.1",
|
|
92
93
|
"tslib": "2.6.0",
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
"@types/jsdom": "^21.1.1",
|
|
109
110
|
"@types/ms": "^2.1.0",
|
|
110
111
|
"@types/promptly": "^3.0.4",
|
|
112
|
+
"@types/prompts": "^2.4.9",
|
|
111
113
|
"@types/terminal-kit": "^2.5.7",
|
|
112
114
|
"@types/wait-on": "^5.3.4",
|
|
113
115
|
"@typescript-eslint/eslint-plugin": "^5.47.1",
|