@intuned/runtime-dev 1.3.17-ws.0 → 1.3.18-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +6 -0
- package/CHANGELOG.md +1 -1
- package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
- package/InterfaceTemplate/index.playwright.ts +1 -1
- package/bin/intuned +0 -0
- package/bin/intuned-interface +7 -0
- package/dist/commands/api/run.js +7 -11
- package/dist/commands/auth-sessions/load.js +2 -2
- package/dist/commands/auth-sessions/run-check.js +8 -8
- package/dist/commands/auth-sessions/run-create.js +6 -6
- package/dist/commands/build.js +2 -3
- package/dist/commands/common/browserUtils.d.ts +3 -3
- package/dist/commands/common/browserUtils.js +3 -4
- package/dist/commands/common/getFirstLineNumber.test.js +1 -2
- package/dist/commands/common/projectExclusions.js +1 -1
- package/dist/commands/common/tsNodeImport.d.ts +1 -1
- package/dist/commands/common/tsNodeImport.js +10 -2
- package/dist/commands/common/utils/fileUtils.js +1 -2
- package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
- package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
- package/dist/commands/common/utils/template.js +1 -2
- package/dist/commands/interface/run.js +23 -49
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -2
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +13 -9
- package/dist/commands/intuned-cli/commands/index.d.ts +2 -2
- package/dist/commands/intuned-cli/commands/index.js +15 -15
- package/dist/commands/intuned-cli/commands/{save.command.d.ts → provision.command.d.ts} +3 -3
- package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +8 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +2 -2
- package/dist/commands/intuned-cli/commands/types.d.ts +9 -1
- package/dist/commands/intuned-cli/commands/types.js +9 -5
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +30 -19
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +140 -77
- package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/api.js +6 -3
- package/dist/commands/intuned-cli/controller/authSession.d.ts +16 -16
- package/dist/commands/intuned-cli/controller/authSession.js +50 -39
- package/dist/commands/intuned-cli/controller/build.js +1 -2
- package/dist/commands/intuned-cli/controller/deploy.js +53 -12
- package/dist/commands/intuned-cli/controller/index.js +2 -3
- package/dist/commands/intuned-cli/controller/{save.d.ts → provision.d.ts} +5 -1
- package/dist/commands/intuned-cli/controller/provision.js +299 -0
- package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +45 -5
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +4 -3
- package/dist/commands/intuned-cli/helpers/api.js +4 -7
- package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/auth.js +24 -21
- package/dist/commands/intuned-cli/helpers/backend.js +12 -4
- package/dist/commands/intuned-cli/helpers/browser.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/browser.js +40 -5
- package/dist/commands/intuned-cli/helpers/context.js +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 +6 -5
- package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
- package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
- package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/wrapper.js +14 -4
- package/dist/commands/intuned-cli/main.js +1 -2
- package/dist/commands/intuned-cli/types.d.ts +41 -12
- package/dist/commands/intuned-cli/types.js +12 -2
- package/dist/commands/ts-check.js +1 -2
- package/dist/common/backendFunctions/getAuthSessionParameters.js +1 -1
- package/dist/common/binStartupScript.js +1 -2
- package/dist/common/browserTabs.d.ts +72 -0
- package/dist/common/browserTabs.js +74 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/contextStorageStateHelpers.d.ts +4 -3
- package/dist/common/contextStorageStateHelpers.js +4 -1
- package/dist/common/extension/extensionsHelpers.d.ts +1 -1
- package/dist/common/extension/types.d.ts +14 -7
- package/dist/common/formatZodError.d.ts +1 -1
- package/dist/common/intunedJson.d.ts +19 -14
- package/dist/common/intunedJson.js +4 -4
- package/dist/common/jwtTokenManager.js +10 -6
- package/dist/common/launchBrowser.d.ts +10 -0
- package/dist/common/launchBrowser.js +67 -7
- package/dist/common/playwrightContext.d.ts +5 -5
- package/dist/common/playwrightContext.js +24 -14
- package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
- package/dist/common/runApi/importUsingImportFunction.js +7 -7
- package/dist/common/runApi/index.d.ts +3 -6
- package/dist/common/runApi/index.js +28 -52
- package/dist/common/settingsSchema.d.ts +52 -45
- package/dist/common/settingsSchema.js +3 -3
- package/dist/common/setupContextHook.d.ts +1 -2
- package/dist/common/setupContextHook.js +2 -2
- package/dist/common/telemetry.js +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -7
- package/dist/runtime/downloadDirectory.js +2 -2
- package/dist/vendor/runtime-interface.d.ts +1 -0
- package/dist/vendor/runtime-interface.js +493 -0
- package/package.json +19 -11
- package/tsup.config.ts +12 -0
- package/WebTemplate.zip +0 -0
- package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/init.command.js +0 -13
- package/dist/commands/intuned-cli/commands/save.command.js +0 -42
- package/dist/commands/intuned-cli/controller/save.js +0 -357
- package/dist/common/runApi/errors.d.ts +0 -72
- package/dist/common/runApi/errors.js +0 -169
- package/dist/common/runApi/types.d.ts +0 -830
- package/dist/common/runApi/types.js +0 -73
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Payload } from "../../../runtime/export";
|
|
2
|
-
import { RunApiStorageState } from "
|
|
2
|
+
import { RunApiStorageState } from "@intuned/runtime-interface";
|
|
3
3
|
import type { BaseCommandOptions } from "../commands/types";
|
|
4
4
|
export declare function executeRunApiCLI({ apiName, inputData, retries, authSession, outputFile, trace, ...rest }: {
|
|
5
5
|
apiName: string;
|
|
@@ -36,7 +36,7 @@ declare function attemptApi({ apiName, inputData, auth, proxy, headless, timeout
|
|
|
36
36
|
traceId?: string;
|
|
37
37
|
} & Omit<BaseCommandOptions, "trace">): Promise<{
|
|
38
38
|
result: any;
|
|
39
|
-
payloadToAppend: Payload[] | undefined;
|
|
39
|
+
payloadToAppend: import("@intuned/runtime-interface").Payload[] | undefined;
|
|
40
40
|
}>;
|
|
41
41
|
export declare const _attemptApi: typeof attemptApi;
|
|
42
42
|
export {};
|
|
@@ -10,12 +10,14 @@ var fs = _interopRequireWildcard(require("fs-extra"));
|
|
|
10
10
|
var _runApi = require("../../../common/runApi");
|
|
11
11
|
var _tsNodeImport = require("../../common/tsNodeImport");
|
|
12
12
|
var _authSession = require("./authSession");
|
|
13
|
+
var _runtimeInterface = require("../../../vendor/runtime-interface");
|
|
13
14
|
var _helpers = require("../helpers");
|
|
14
15
|
var _terminal = require("../helpers/terminal");
|
|
15
16
|
var _constants = require("../../../common/constants");
|
|
16
17
|
var _browser = require("../helpers/browser");
|
|
17
|
-
|
|
18
|
-
function
|
|
18
|
+
var _path = _interopRequireDefault(require("path"));
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
21
|
async function executeRunApiCLI({
|
|
20
22
|
apiName,
|
|
21
23
|
inputData,
|
|
@@ -48,7 +50,7 @@ async function executeRunApiCLI({
|
|
|
48
50
|
...rest
|
|
49
51
|
});
|
|
50
52
|
} catch (error) {
|
|
51
|
-
if (error instanceof
|
|
53
|
+
if (error instanceof _runtimeInterface.RunAutomationError) {
|
|
52
54
|
(0, _helpers.logAutomationError)(error);
|
|
53
55
|
(0, _terminal.terminal)(`^r^+Attempt ${i + 1} failed^:\n`);
|
|
54
56
|
continue;
|
|
@@ -133,6 +135,7 @@ async function writeResultToFile(outputFile, result, payloadToAppend) {
|
|
|
133
135
|
resultToWrite["extendedPayloads"] = payloadToAppend;
|
|
134
136
|
}
|
|
135
137
|
try {
|
|
138
|
+
await fs.ensureDir(_path.default.dirname(outputFile));
|
|
136
139
|
await fs.writeJSON(outputFile, resultToWrite, {
|
|
137
140
|
spaces: 2
|
|
138
141
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseCommandOptions } from "../commands/types";
|
|
2
|
-
import { RunApiStorageState } from "../../../common/runApi";
|
|
3
2
|
import { AuthSessionMetadata } from "../types";
|
|
3
|
+
import { RunApiStorageState } from "@intuned/runtime-interface";
|
|
4
4
|
export declare function executeRunValidateAuthSessionCLI({ id, autoRecreate, checkRetries, createRetries, ...rest }: {
|
|
5
5
|
id: string;
|
|
6
6
|
autoRecreate: boolean;
|
|
@@ -16,10 +16,10 @@ export declare function executeRunCreateAuthSessionCLI({ id, input, checkRetries
|
|
|
16
16
|
metadata?: AuthSessionMetadata;
|
|
17
17
|
} & BaseCommandOptions): Promise<{
|
|
18
18
|
cookies: {
|
|
19
|
-
path: string;
|
|
20
19
|
value: string;
|
|
21
|
-
|
|
20
|
+
path: string;
|
|
22
21
|
name: string;
|
|
22
|
+
domain: string;
|
|
23
23
|
expires: number;
|
|
24
24
|
httpOnly: boolean;
|
|
25
25
|
secure: boolean;
|
|
@@ -47,10 +47,10 @@ export declare function executeRunUpdateAuthSessionCLI({ id, input, checkRetries
|
|
|
47
47
|
createRetries: number;
|
|
48
48
|
} & BaseCommandOptions): Promise<{
|
|
49
49
|
cookies: {
|
|
50
|
-
path: string;
|
|
51
50
|
value: string;
|
|
52
|
-
|
|
51
|
+
path: string;
|
|
53
52
|
name: string;
|
|
53
|
+
domain: string;
|
|
54
54
|
expires: number;
|
|
55
55
|
httpOnly: boolean;
|
|
56
56
|
secure: boolean;
|
|
@@ -76,10 +76,10 @@ export declare function executeAttemptCreateAuthSessionCLI({ id, input, ...rest
|
|
|
76
76
|
input: any;
|
|
77
77
|
} & BaseCommandOptions): Promise<{
|
|
78
78
|
cookies: {
|
|
79
|
-
path: string;
|
|
80
79
|
value: string;
|
|
81
|
-
|
|
80
|
+
path: string;
|
|
82
81
|
name: string;
|
|
82
|
+
domain: string;
|
|
83
83
|
expires: number;
|
|
84
84
|
httpOnly: boolean;
|
|
85
85
|
secure: boolean;
|
|
@@ -104,10 +104,10 @@ export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
|
|
|
104
104
|
id: string;
|
|
105
105
|
} & BaseCommandOptions): Promise<{
|
|
106
106
|
cookies: {
|
|
107
|
-
path: string;
|
|
108
107
|
value: string;
|
|
109
|
-
|
|
108
|
+
path: string;
|
|
110
109
|
name: string;
|
|
110
|
+
domain: string;
|
|
111
111
|
expires: number;
|
|
112
112
|
httpOnly: boolean;
|
|
113
113
|
secure: boolean;
|
|
@@ -128,20 +128,20 @@ export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
|
|
|
128
128
|
}[];
|
|
129
129
|
}[] | undefined;
|
|
130
130
|
}>;
|
|
131
|
-
declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
131
|
+
declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, ignoreHttpErrors, }: {
|
|
132
132
|
auth: RunApiStorageState;
|
|
133
133
|
traceId?: string;
|
|
134
134
|
} & Omit<BaseCommandOptions, "trace">): Promise<boolean>;
|
|
135
135
|
export declare const _runCheck: typeof runCheck;
|
|
136
|
-
declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
136
|
+
declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, ignoreHttpErrors, }: {
|
|
137
137
|
authSessionInput: Record<string, any>;
|
|
138
138
|
traceId?: string;
|
|
139
139
|
} & Omit<BaseCommandOptions, "trace">): Promise<{
|
|
140
140
|
cookies: {
|
|
141
|
-
path: string;
|
|
142
141
|
value: string;
|
|
143
|
-
|
|
142
|
+
path: string;
|
|
144
143
|
name: string;
|
|
144
|
+
domain: string;
|
|
145
145
|
expires: number;
|
|
146
146
|
httpOnly: boolean;
|
|
147
147
|
secure: boolean;
|
|
@@ -175,10 +175,10 @@ declare function runCreateWithRetries({ authSessionId, authSessionInput, retries
|
|
|
175
175
|
metadata?: AuthSessionMetadata;
|
|
176
176
|
} & BaseCommandOptions): Promise<{
|
|
177
177
|
cookies: {
|
|
178
|
-
path: string;
|
|
179
178
|
value: string;
|
|
180
|
-
|
|
179
|
+
path: string;
|
|
181
180
|
name: string;
|
|
181
|
+
domain: string;
|
|
182
182
|
expires: number;
|
|
183
183
|
httpOnly: boolean;
|
|
184
184
|
secure: boolean;
|
|
@@ -200,7 +200,7 @@ declare function runCreateWithRetries({ authSessionId, authSessionInput, retries
|
|
|
200
200
|
}[] | undefined;
|
|
201
201
|
}>;
|
|
202
202
|
export declare const _runCreateWithRetries: typeof runCreateWithRetries;
|
|
203
|
-
export declare function executeRecordAuthSessionCLI({ id, checkRetries, timeout, headless, proxy, trace, keepBrowserOpen, startUrl, finishUrl, }: {
|
|
203
|
+
export declare function executeRecordAuthSessionCLI({ id, checkRetries, timeout, headless, proxy, trace, keepBrowserOpen, startUrl, finishUrl, ignoreHttpErrors, }: {
|
|
204
204
|
id?: string;
|
|
205
205
|
checkRetries: number;
|
|
206
206
|
startUrl: string;
|
|
@@ -19,6 +19,7 @@ var _browser = require("../helpers/browser");
|
|
|
19
19
|
var _launchBrowser = require("../../../common/launchBrowser");
|
|
20
20
|
var _promises = require("timers/promises");
|
|
21
21
|
var _contextStorageStateHelpers = require("../../../common/contextStorageStateHelpers");
|
|
22
|
+
var _runtimeInterface = require("../../../vendor/runtime-interface");
|
|
22
23
|
async function executeRunValidateAuthSessionCLI({
|
|
23
24
|
id,
|
|
24
25
|
autoRecreate,
|
|
@@ -26,7 +27,7 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
26
27
|
createRetries,
|
|
27
28
|
...rest
|
|
28
29
|
}) {
|
|
29
|
-
(0, _terminal.terminal)(`^+Validating
|
|
30
|
+
(0, _terminal.terminal)(`^+Validating AuthSession with id ^c${id}^:\n`);
|
|
30
31
|
const {
|
|
31
32
|
storageState
|
|
32
33
|
} = await (0, _helpers.loadAuthSessionInstance)(id);
|
|
@@ -39,13 +40,13 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
39
40
|
});
|
|
40
41
|
if (!checkResult) {
|
|
41
42
|
if (!autoRecreate) {
|
|
42
|
-
throw new _helpers.CLIError("Auto recreate is disabled
|
|
43
|
+
throw new _helpers.CLIError("Auto recreate is disabled. Use a different AuthSession or update it by running 'intuned run authsession update <id>' command.");
|
|
43
44
|
}
|
|
44
45
|
const {
|
|
45
46
|
metadata
|
|
46
47
|
} = await (0, _helpers.loadAuthSessionInstance)(id);
|
|
47
48
|
if (metadata?.authSessionType === "MANUAL") {
|
|
48
|
-
throw new _helpers.CLIError("
|
|
49
|
+
throw new _helpers.CLIError("AuthSession is recorder-based, it cannot be auto-recreated. Use a different AuthSession.");
|
|
49
50
|
}
|
|
50
51
|
(0, _terminal.terminal)("^+Auto recreate is enabled - trying to re-create it^:\n");
|
|
51
52
|
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
|
|
@@ -63,10 +64,10 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
63
64
|
...rest
|
|
64
65
|
});
|
|
65
66
|
if (!checkResult) {
|
|
66
|
-
throw new _helpers.CLIError("Failed to re-create
|
|
67
|
+
throw new _helpers.CLIError("Failed to re-create AuthSession");
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
(0, _terminal.terminal)(`^+^
|
|
70
|
+
(0, _terminal.terminal)(`^+^gAuthSession validated successfully^:\n`);
|
|
70
71
|
return storageState;
|
|
71
72
|
}
|
|
72
73
|
async function executeRunCreateAuthSessionCLI({
|
|
@@ -78,7 +79,7 @@ async function executeRunCreateAuthSessionCLI({
|
|
|
78
79
|
...rest
|
|
79
80
|
}) {
|
|
80
81
|
id = id ?? generateAuthSessionId();
|
|
81
|
-
(0, _terminal.terminal)(`^+Creating
|
|
82
|
+
(0, _terminal.terminal)(`^+Creating AuthSession with id ^c${id}^:\n`);
|
|
82
83
|
await Promise.all([await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create"), await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check")]);
|
|
83
84
|
const createdStorageState = await runCreateWithRetries({
|
|
84
85
|
authSessionId: id,
|
|
@@ -93,10 +94,10 @@ async function executeRunCreateAuthSessionCLI({
|
|
|
93
94
|
...rest
|
|
94
95
|
});
|
|
95
96
|
if (!checkResult) {
|
|
96
|
-
throw new _helpers.CLIError("Failed to create
|
|
97
|
+
throw new _helpers.CLIError("Failed to create AuthSession");
|
|
97
98
|
}
|
|
98
99
|
if (log) {
|
|
99
|
-
(0, _terminal.terminal)(`^+^
|
|
100
|
+
(0, _terminal.terminal)(`^+^gAuthSession created successfully^:\n`);
|
|
100
101
|
}
|
|
101
102
|
return auth;
|
|
102
103
|
}
|
|
@@ -107,14 +108,14 @@ async function executeRunUpdateAuthSessionCLI({
|
|
|
107
108
|
createRetries,
|
|
108
109
|
...rest
|
|
109
110
|
}) {
|
|
110
|
-
(0, _terminal.terminal)(`^+Updating
|
|
111
|
+
(0, _terminal.terminal)(`^+Updating AuthSession with id ^c${id}^:\n`);
|
|
111
112
|
let metadata = undefined;
|
|
112
113
|
if (input === undefined) {
|
|
113
114
|
({
|
|
114
115
|
metadata
|
|
115
116
|
} = await (0, _helpers.loadAuthSessionInstance)(id));
|
|
116
117
|
if (metadata?.authSessionType === "MANUAL") {
|
|
117
|
-
throw new _helpers.CLIError("
|
|
118
|
+
throw new _helpers.CLIError("AuthSession is recorder-based, it cannot be updated. Use a different AuthSession.");
|
|
118
119
|
}
|
|
119
120
|
input = metadata?.authSessionInput ?? {};
|
|
120
121
|
}
|
|
@@ -128,7 +129,7 @@ async function executeRunUpdateAuthSessionCLI({
|
|
|
128
129
|
metadata,
|
|
129
130
|
...rest
|
|
130
131
|
});
|
|
131
|
-
(0, _terminal.terminal)(`^+^
|
|
132
|
+
(0, _terminal.terminal)(`^+^gAuthSession updated successfully^:\n`);
|
|
132
133
|
return authSession;
|
|
133
134
|
}
|
|
134
135
|
async function executeAttemptCreateAuthSessionCLI({
|
|
@@ -137,7 +138,7 @@ async function executeAttemptCreateAuthSessionCLI({
|
|
|
137
138
|
...rest
|
|
138
139
|
}) {
|
|
139
140
|
id = id ?? generateAuthSessionId(true);
|
|
140
|
-
(0, _terminal.terminal)(`^+Executing create
|
|
141
|
+
(0, _terminal.terminal)(`^+Executing create AuthSession attempt with id ^c${id}^:\n`);
|
|
141
142
|
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
|
|
142
143
|
return await runCreateWithRetries({
|
|
143
144
|
authSessionId: id,
|
|
@@ -149,7 +150,7 @@ async function executeAttemptCheckAuthSessionCLI({
|
|
|
149
150
|
id,
|
|
150
151
|
...rest
|
|
151
152
|
}) {
|
|
152
|
-
(0, _terminal.terminal)(`^+Executing check
|
|
153
|
+
(0, _terminal.terminal)(`^+Executing check AuthSession attempt with id ^c${id}^:\n`);
|
|
153
154
|
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
|
|
154
155
|
(0, _helpers.registerGetAuthSessionParameters)(id);
|
|
155
156
|
const {
|
|
@@ -162,7 +163,7 @@ async function executeAttemptCheckAuthSessionCLI({
|
|
|
162
163
|
if (!checkResult) {
|
|
163
164
|
throw new _helpers.CLIError("Check failed");
|
|
164
165
|
}
|
|
165
|
-
(0, _terminal.terminal)(`^+^
|
|
166
|
+
(0, _terminal.terminal)(`^+^gAuthSession check passed^:\n`);
|
|
166
167
|
return storageState;
|
|
167
168
|
}
|
|
168
169
|
async function runCheck({
|
|
@@ -172,7 +173,8 @@ async function runCheck({
|
|
|
172
173
|
timeout,
|
|
173
174
|
traceId,
|
|
174
175
|
keepBrowserOpen,
|
|
175
|
-
cdpUrl
|
|
176
|
+
cdpUrl,
|
|
177
|
+
ignoreHttpErrors
|
|
176
178
|
}) {
|
|
177
179
|
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
178
180
|
const runApiResult = await (0, _runApi.runApi)({
|
|
@@ -183,7 +185,8 @@ async function runCheck({
|
|
|
183
185
|
headless,
|
|
184
186
|
proxy,
|
|
185
187
|
keepBrowserOpen,
|
|
186
|
-
cdpUrl
|
|
188
|
+
cdpUrl,
|
|
189
|
+
ignoreHttpErrors
|
|
187
190
|
}),
|
|
188
191
|
auth: {
|
|
189
192
|
session: {
|
|
@@ -213,7 +216,8 @@ async function runCreate({
|
|
|
213
216
|
timeout,
|
|
214
217
|
traceId,
|
|
215
218
|
keepBrowserOpen,
|
|
216
|
-
cdpUrl
|
|
219
|
+
cdpUrl,
|
|
220
|
+
ignoreHttpErrors
|
|
217
221
|
}) {
|
|
218
222
|
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
219
223
|
const result = await (0, _runApi.runApi)({
|
|
@@ -225,7 +229,8 @@ async function runCreate({
|
|
|
225
229
|
headless,
|
|
226
230
|
proxy,
|
|
227
231
|
keepBrowserOpen,
|
|
228
|
-
cdpUrl
|
|
232
|
+
cdpUrl,
|
|
233
|
+
ignoreHttpErrors
|
|
229
234
|
}),
|
|
230
235
|
retrieveSession: true,
|
|
231
236
|
tracing,
|
|
@@ -245,7 +250,7 @@ async function runCheckWithRetries({
|
|
|
245
250
|
...rest
|
|
246
251
|
}) {
|
|
247
252
|
for (let i = 0; i < (retries ?? 1); i++) {
|
|
248
|
-
(0, _terminal.terminal)(`\n^+Running ^
|
|
253
|
+
(0, _terminal.terminal)(`\n^+Running ^cAuthSession check${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
249
254
|
try {
|
|
250
255
|
let traceId = undefined;
|
|
251
256
|
if (rest.trace) {
|
|
@@ -260,19 +265,19 @@ async function runCheckWithRetries({
|
|
|
260
265
|
...rest
|
|
261
266
|
});
|
|
262
267
|
if (checkResult) {
|
|
263
|
-
(0, _terminal.terminal)(`^+^
|
|
268
|
+
(0, _terminal.terminal)(`^+^gAuthSession check passed^:\n`);
|
|
264
269
|
return true;
|
|
265
270
|
}
|
|
266
271
|
} catch (error) {
|
|
267
|
-
if (error instanceof
|
|
272
|
+
if (error instanceof _runtimeInterface.RunAutomationError) {
|
|
268
273
|
(0, _helpers.logAutomationError)(error);
|
|
269
274
|
} else {
|
|
270
275
|
throw error;
|
|
271
276
|
}
|
|
272
277
|
}
|
|
273
|
-
(0, _terminal.terminal)(`^+^
|
|
278
|
+
(0, _terminal.terminal)(`^+^yAuthSession check failed^:\n`);
|
|
274
279
|
}
|
|
275
|
-
(0, _terminal.terminal)(`^+^
|
|
280
|
+
(0, _terminal.terminal)(`^+^rAuthSession check failed after ${retries} attempts^:\n`);
|
|
276
281
|
return false;
|
|
277
282
|
}
|
|
278
283
|
const _runCheckWithRetries = exports._runCheckWithRetries = runCheckWithRetries;
|
|
@@ -286,7 +291,7 @@ async function runCreateWithRetries({
|
|
|
286
291
|
}) {
|
|
287
292
|
let newAuthSessionInstance = null;
|
|
288
293
|
for (let i = 0; i < (retries ?? 1); i++) {
|
|
289
|
-
(0, _terminal.terminal)(`\n^+Running ^
|
|
294
|
+
(0, _terminal.terminal)(`\n^+Running ^cAuthSession create${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
290
295
|
try {
|
|
291
296
|
let traceId = undefined;
|
|
292
297
|
if (trace) {
|
|
@@ -300,19 +305,19 @@ async function runCreateWithRetries({
|
|
|
300
305
|
traceId,
|
|
301
306
|
...rest
|
|
302
307
|
});
|
|
303
|
-
(0, _terminal.terminal)(`^+^
|
|
308
|
+
(0, _terminal.terminal)(`^+^gAuthSession create succeeded^:\n`);
|
|
304
309
|
break;
|
|
305
310
|
} catch (error) {
|
|
306
|
-
if (error instanceof
|
|
311
|
+
if (error instanceof _runtimeInterface.RunAutomationError) {
|
|
307
312
|
(0, _helpers.logAutomationError)(error);
|
|
308
313
|
} else {
|
|
309
314
|
throw error;
|
|
310
315
|
}
|
|
311
|
-
(0, _terminal.terminal)(`^+^
|
|
316
|
+
(0, _terminal.terminal)(`^+^yAuthSession create failed^:\n`);
|
|
312
317
|
}
|
|
313
318
|
}
|
|
314
319
|
if (!newAuthSessionInstance) {
|
|
315
|
-
throw new _helpers.CLIError(`Failed to create
|
|
320
|
+
throw new _helpers.CLIError(`Failed to create AuthSession after ${retries} retries. Check errors above for more details.`);
|
|
316
321
|
}
|
|
317
322
|
await (0, _helpers.storeAuthSessionInstance)({
|
|
318
323
|
state: newAuthSessionInstance,
|
|
@@ -333,21 +338,23 @@ async function executeRecordAuthSessionCLI({
|
|
|
333
338
|
trace = false,
|
|
334
339
|
keepBrowserOpen,
|
|
335
340
|
startUrl,
|
|
336
|
-
finishUrl
|
|
341
|
+
finishUrl,
|
|
342
|
+
ignoreHttpErrors
|
|
337
343
|
}) {
|
|
338
344
|
id = id ?? generateAuthSessionId();
|
|
339
|
-
(0, _terminal.terminal)(`^+Recording
|
|
345
|
+
(0, _terminal.terminal)(`^+Recording AuthSession with id ^c${id}^:\n`);
|
|
340
346
|
let authSession;
|
|
341
347
|
try {
|
|
342
348
|
authSession = await recordAuthSession({
|
|
343
349
|
startUrl,
|
|
344
350
|
finishUrl,
|
|
345
351
|
timeout,
|
|
346
|
-
proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined
|
|
352
|
+
proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined,
|
|
353
|
+
ignoreHttpErrors
|
|
347
354
|
});
|
|
348
355
|
} catch (error) {
|
|
349
356
|
if (error instanceof _helpers.CLIError) {
|
|
350
|
-
throw new _helpers.CLIError(`Failed to record
|
|
357
|
+
throw new _helpers.CLIError(`Failed to record AuthSession: ${error.message}`);
|
|
351
358
|
}
|
|
352
359
|
throw error;
|
|
353
360
|
}
|
|
@@ -373,23 +380,27 @@ async function executeRecordAuthSessionCLI({
|
|
|
373
380
|
checkRetries,
|
|
374
381
|
createRetries: 0,
|
|
375
382
|
trace,
|
|
376
|
-
keepBrowserOpen
|
|
383
|
+
keepBrowserOpen,
|
|
384
|
+
ignoreHttpErrors
|
|
377
385
|
});
|
|
378
|
-
(0, _terminal.terminal)(`^+^
|
|
386
|
+
(0, _terminal.terminal)(`^+^gAuthSession ^c${id}^ ^+^grecorded successfully^:\n`);
|
|
379
387
|
}
|
|
380
388
|
async function recordAuthSession({
|
|
381
389
|
startUrl,
|
|
382
390
|
finishUrl,
|
|
383
391
|
timeout,
|
|
384
|
-
proxy
|
|
392
|
+
proxy,
|
|
393
|
+
ignoreHttpErrors: cliIgnoreHttpErrors
|
|
385
394
|
}) {
|
|
395
|
+
const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)(cliIgnoreHttpErrors);
|
|
386
396
|
const {
|
|
387
397
|
context,
|
|
388
398
|
page
|
|
389
399
|
} = await (0, _launchBrowser.launchChromium)({
|
|
390
400
|
headless: false,
|
|
391
401
|
proxy,
|
|
392
|
-
appModeInitialUrl: startUrl
|
|
402
|
+
appModeInitialUrl: startUrl,
|
|
403
|
+
ignoreHttpErrors
|
|
393
404
|
});
|
|
394
405
|
try {
|
|
395
406
|
if (!page.url().startsWith(startUrl)) {
|
|
@@ -400,17 +411,17 @@ async function recordAuthSession({
|
|
|
400
411
|
const timeoutTimestamp = Date.now() + timeout;
|
|
401
412
|
while (true) {
|
|
402
413
|
if (Date.now() > timeoutTimestamp) {
|
|
403
|
-
throw new _helpers.CLIError("Timeout waiting for finish URL");
|
|
414
|
+
throw new _helpers.CLIError("AuthSession recording failed - Timeout waiting for finish URL");
|
|
404
415
|
}
|
|
405
416
|
if (context.pages().length === 0) {
|
|
406
|
-
throw new _helpers.CLIError("Browser was closed before reaching the finish URL");
|
|
417
|
+
throw new _helpers.CLIError("AuthSession recording failed - Browser was closed before reaching the finish URL");
|
|
407
418
|
}
|
|
408
419
|
if (context.pages()[0].url().startsWith(finishUrl)) {
|
|
409
420
|
break;
|
|
410
421
|
}
|
|
411
422
|
await (0, _promises.setTimeout)(1000);
|
|
412
423
|
}
|
|
413
|
-
(0, _terminal.terminal)(`^+Finish URL reached, capturing
|
|
424
|
+
(0, _terminal.terminal)(`^+Finish URL reached, capturing AuthSession...^:\n`);
|
|
414
425
|
await page.waitForLoadState("load");
|
|
415
426
|
const authSession = await (0, _contextStorageStateHelpers.getStorageState)(context);
|
|
416
427
|
return authSession;
|
|
@@ -9,8 +9,7 @@ var path = _interopRequireWildcard(require("path"));
|
|
|
9
9
|
var _child_process = require("child_process");
|
|
10
10
|
var _util = require("util");
|
|
11
11
|
var _terminal = require("../helpers/terminal");
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
const execPromise = (0, _util.promisify)(_child_process.exec);
|
|
15
14
|
const runBuild = async () => {
|
|
16
15
|
const distPath = path.join(process.cwd(), "dist");
|
|
@@ -11,23 +11,62 @@ var _helpers = require("../helpers");
|
|
|
11
11
|
var _terminal = require("../helpers/terminal");
|
|
12
12
|
var _promises = require("timers/promises");
|
|
13
13
|
var _ms = _interopRequireDefault(require("ms"));
|
|
14
|
-
var
|
|
14
|
+
var _provision = require("./provision");
|
|
15
15
|
var _constants2 = require("../../../common/constants");
|
|
16
16
|
var _path = _interopRequireDefault(require("path"));
|
|
17
17
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
18
18
|
var _prompts = _interopRequireDefault(require("prompts"));
|
|
19
19
|
var _terminalLink = _interopRequireDefault(require("terminal-link"));
|
|
20
|
-
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
20
|
+
var _pressAnyKey = _interopRequireDefault(require("press-any-key"));
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
23
|
const START_RUN_INPUT_QUERY_PARAM_KEY = exports.START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
24
24
|
async function runDeployProject(projectName, auth) {
|
|
25
|
-
|
|
26
|
-
const enableFirstRunExperience = result?.enableFirstRunExperience ?? false;
|
|
25
|
+
let enableFirstRunExperience = false;
|
|
27
26
|
let firstRunExperienceInput = undefined;
|
|
28
27
|
const settings = await (0, _helpers.loadIntunedJson)();
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const provisionResult = await (0, _provision.runProvisionProject)(projectName, auth, true);
|
|
29
|
+
if (provisionResult) {
|
|
30
|
+
enableFirstRunExperience = provisionResult?.enableFirstRunExperience ?? false;
|
|
31
|
+
if (enableFirstRunExperience) {
|
|
32
|
+
firstRunExperienceInput = await promptFirstRunExperience(settings);
|
|
33
|
+
}
|
|
34
|
+
const {
|
|
35
|
+
projectId,
|
|
36
|
+
dotenvContent,
|
|
37
|
+
environmentVariablesKeys
|
|
38
|
+
} = provisionResult;
|
|
39
|
+
if (dotenvContent) {
|
|
40
|
+
const dotenvKeys = Object.keys(dotenvContent);
|
|
41
|
+
const missingKeys = dotenvKeys.filter(key => dotenvContent[key] && !environmentVariablesKeys.includes(key));
|
|
42
|
+
if (missingKeys.length > 0) {
|
|
43
|
+
(0, _terminal.terminal)(`^yWarning: The following environment variables are defined in your .env file but are not defined on Intuned platform^:\n`);
|
|
44
|
+
for (const key of missingKeys) {
|
|
45
|
+
(0, _terminal.terminal)(`^y • ${key}^:\n`);
|
|
46
|
+
}
|
|
47
|
+
(0, _terminal.terminal)(`^yPlease add them to your project or workspace on Intuned platform to ensure proper functionality.^:\n`);
|
|
48
|
+
const projectEnvVarsUrl = `${(0, _helpers.getBaseUrl)()}/projects/${projectId}/env-vars`;
|
|
49
|
+
const workspaceEnvVarsUrl = `${(0, _helpers.getBaseUrl)()}/settings/env-vars`;
|
|
50
|
+
if (_terminalLink.default.isSupported) {
|
|
51
|
+
const projectEnvVarsTerminalLink = (0, _terminalLink.default)(`[ Project Env Vars ]`, projectEnvVarsUrl).replaceAll("%", "%%");
|
|
52
|
+
const workspaceEnvVarsTerminalLink = (0, _terminalLink.default)(`[ Workspace Env Vars ]`, workspaceEnvVarsUrl).replaceAll("%", "%%");
|
|
53
|
+
(0, _terminal.terminal)(`^Y${projectEnvVarsTerminalLink} ${workspaceEnvVarsTerminalLink}^:\n`);
|
|
54
|
+
} else {
|
|
55
|
+
(0, _terminal.terminal)(`^yProject Env Vars: ^_${projectEnvVarsUrl}^:\n`);
|
|
56
|
+
(0, _terminal.terminal)(`^yWorkspace Env Vars: ^_${workspaceEnvVarsUrl}^:\n`);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
(0, _terminal.terminal)("Press any key to continue...");
|
|
60
|
+
await (0, _pressAnyKey.default)("", {
|
|
61
|
+
ctrlC: "reject",
|
|
62
|
+
hideMessage: true
|
|
63
|
+
});
|
|
64
|
+
(0, _terminal.terminal)("\n");
|
|
65
|
+
} catch {
|
|
66
|
+
throw new _helpers.AbortedCLIError();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
31
70
|
}
|
|
32
71
|
const {
|
|
33
72
|
workspaceId,
|
|
@@ -48,9 +87,9 @@ async function runDeployProject(projectName, auth) {
|
|
|
48
87
|
});
|
|
49
88
|
if (!response.ok) {
|
|
50
89
|
if (response.status === 401) {
|
|
51
|
-
throw new _helpers.CLIError(`Invalid API key. Please
|
|
90
|
+
throw new _helpers.CLIError(`Invalid API key. The provided API key is not authorized to access this workspace.\n` + `Please verify your API key at: https://app.intuned.io/settings/api-keys`);
|
|
52
91
|
}
|
|
53
|
-
throw new _helpers.CLIError(`^r^+Invalid response from server\n^:^R${response.status} ${await response.text()}^:\n^r^+
|
|
92
|
+
throw new _helpers.CLIError(`^r^+Invalid response from server\n^:^R${response.status} ${await response.text()}^:\n^r^+Deployment failed. Report this issue to the Intuned team.^:\n`, {
|
|
54
93
|
autoColor: false
|
|
55
94
|
});
|
|
56
95
|
}
|
|
@@ -90,7 +129,7 @@ async function runDeployProject(projectName, auth) {
|
|
|
90
129
|
if (status === "pending") {
|
|
91
130
|
const elapsedTime = Date.now() - startTime;
|
|
92
131
|
if (elapsedTime > _constants.PROJECT_DEPLOY_TIMEOUT) {
|
|
93
|
-
throw new _helpers.CLIError(`Deployment timed out after ${Math.floor(_constants.PROJECT_DEPLOY_TIMEOUT / (0, _ms.default)("1 minute"))} minutes`);
|
|
132
|
+
throw new _helpers.CLIError(`Deployment failed - timed out after ${Math.floor(_constants.PROJECT_DEPLOY_TIMEOUT / (0, _ms.default)("1 minute"))} minutes`);
|
|
94
133
|
}
|
|
95
134
|
continue;
|
|
96
135
|
}
|
|
@@ -140,8 +179,10 @@ async function runDeployProject(projectName, auth) {
|
|
|
140
179
|
let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
|
|
141
180
|
if (rest.reason) {
|
|
142
181
|
errorMessage += `^r^+Reason:^:\n^R${rest.reason}^:\n`;
|
|
182
|
+
} else {
|
|
183
|
+
errorMessage += `^r^+Unknown error occurred, please report this issue to the Intuned team.^:\n`;
|
|
143
184
|
}
|
|
144
|
-
errorMessage += `^r^+
|
|
185
|
+
errorMessage += `^r^+Deployment failed^:\n`;
|
|
145
186
|
throw new _helpers.CLIError(errorMessage, {
|
|
146
187
|
autoColor: false
|
|
147
188
|
});
|
|
@@ -222,7 +263,7 @@ async function promptFirstRunExperienceTestAuthSessionParameters({
|
|
|
222
263
|
if (!metadata.authSessionId) {
|
|
223
264
|
return;
|
|
224
265
|
}
|
|
225
|
-
const message = shouldPromptForDefaultJob ? `^:^+Create a test
|
|
266
|
+
const message = shouldPromptForDefaultJob ? `^:^+Create a test AuthSession using^ ^c${authSessionId}^:^+ parameters?^ ^/(required for creating default job)^:` : `^:^+Create a test AuthSession using^ ^c${authSessionId}^:^+ parameters?^:`;
|
|
226
267
|
const {
|
|
227
268
|
value
|
|
228
269
|
} = await (0, _prompts.default)({
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.loadParameters = loadParameters;
|
|
7
7
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
8
8
|
var _helpers = require("../helpers");
|
|
9
|
-
function
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
async function loadParameters(parameters) {
|
|
12
11
|
let inputData;
|
|
13
12
|
if (await fs.exists(parameters)) {
|
|
@@ -16,7 +15,7 @@ async function loadParameters(parameters) {
|
|
|
16
15
|
try {
|
|
17
16
|
inputData = JSON.parse(parameters);
|
|
18
17
|
} catch (err) {
|
|
19
|
-
throw new _helpers.CLIError("
|
|
18
|
+
throw new _helpers.CLIError("Invalid parameters - must be a valid JSON string or a path to a JSON file");
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
return inputData;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthCredentials } from "../types";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function runProvisionProject(projectName: string, auth: AuthCredentials, silent?: boolean): Promise<{
|
|
4
4
|
projectId: string;
|
|
5
5
|
enableFirstRunExperience: boolean | undefined;
|
|
6
|
+
environmentVariablesKeys: string[];
|
|
7
|
+
dotenvContent: {
|
|
8
|
+
[x: string]: string;
|
|
9
|
+
};
|
|
6
10
|
} | undefined>;
|
|
7
11
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
8
12
|
export declare const validateProjectName: (projectName: string) => {
|