@intuned/runtime-dev 1.3.17-ws.0 → 1.3.17
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/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 +5 -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 +5 -1
- package/dist/commands/intuned-cli/commands/types.js +7 -5
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +12 -10
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +18 -16
- 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 +13 -13
- package/dist/commands/intuned-cli/controller/authSession.js +31 -30
- 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 +40 -2
- 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 +3 -4
- package/dist/commands/intuned-cli/helpers/browser.js +31 -2
- 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 +16 -7
- 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 +29 -14
- package/dist/common/intunedJson.js +26 -5
- package/dist/common/jwtTokenManager.js +10 -6
- package/dist/common/launchBrowser.d.ts +3 -0
- package/dist/common/launchBrowser.js +60 -5
- package/dist/common/playwrightContext.d.ts +3 -5
- package/dist/common/playwrightContext.js +16 -12
- 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 +26 -52
- package/dist/common/settingsSchema.d.ts +49 -45
- package/dist/common/settingsSchema.js +1 -2
- 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 +491 -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
|
@@ -5,6 +5,7 @@ var _authSession = require("../authSession");
|
|
|
5
5
|
var _helpers = require("../../helpers");
|
|
6
6
|
var _neverthrow = require("neverthrow");
|
|
7
7
|
var _runApi = require("../../../../common/runApi");
|
|
8
|
+
var _runtimeInterface = require("../../../../vendor/runtime-interface");
|
|
8
9
|
var _browser = require("../../helpers/browser");
|
|
9
10
|
var _launchBrowser = require("../../../../common/launchBrowser");
|
|
10
11
|
var _promises = require("timers/promises");
|
|
@@ -14,7 +15,7 @@ const _checkPassedResult = (0, _neverthrow.ok)({
|
|
|
14
15
|
const _checkFailedResult = (0, _neverthrow.ok)({
|
|
15
16
|
result: false
|
|
16
17
|
});
|
|
17
|
-
const _errorResult = (0, _neverthrow.err)(new
|
|
18
|
+
const _errorResult = (0, _neverthrow.err)(new _runtimeInterface.AutomationError("failed"));
|
|
18
19
|
function _createSuccessResult(session) {
|
|
19
20
|
return (0, _neverthrow.ok)({
|
|
20
21
|
session
|
|
@@ -39,6 +40,7 @@ function getMockTimeout() {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
_vitest.vi.mock("fs-extra", () => ({
|
|
43
|
+
ensureDir: _vitest.vi.fn(),
|
|
42
44
|
writeJSON: _vitest.vi.fn(),
|
|
43
45
|
exists: _vitest.vi.fn().mockResolvedValue(true)
|
|
44
46
|
}));
|
|
@@ -92,7 +94,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
92
94
|
registerGetAuthSessionParameters: _vitest.vi.fn()
|
|
93
95
|
};
|
|
94
96
|
});
|
|
95
|
-
(0, _vitest.describe)("
|
|
97
|
+
(0, _vitest.describe)("AuthSession controller", () => {
|
|
96
98
|
(0, _vitest.beforeEach)(() => {
|
|
97
99
|
_vitest.vi.clearAllMocks();
|
|
98
100
|
});
|
|
@@ -418,7 +420,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
418
420
|
});
|
|
419
421
|
(0, _vitest.expect)(_helpers.withCLITrace).toHaveBeenCalledWith(_vitest.expect.any(Function), _vitest.expect.any(String));
|
|
420
422
|
});
|
|
421
|
-
(0, _vitest.it)("saves the
|
|
423
|
+
(0, _vitest.it)("saves the AuthSession instance", async () => {
|
|
422
424
|
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce(_createSuccessResult("session"));
|
|
423
425
|
_vitest.vi.mocked(_helpers.parseUrlProxy).mockReturnValueOnce("parsed-proxy");
|
|
424
426
|
await (0, _authSession._runCreateWithRetries)({
|
|
@@ -558,7 +560,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
558
560
|
(0, _vitest.beforeEach)(() => {
|
|
559
561
|
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce(_checkFailedResult);
|
|
560
562
|
});
|
|
561
|
-
afterEach(() => {
|
|
563
|
+
(0, _vitest.afterEach)(() => {
|
|
562
564
|
_vitest.vi.mocked(_runApi.runApi).mockReset();
|
|
563
565
|
_vitest.vi.mocked(_helpers.loadAuthSessionInstance).mockReset();
|
|
564
566
|
});
|
|
@@ -576,7 +578,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
576
578
|
});
|
|
577
579
|
(0, _vitest.expect)(_helpers.assertApiFileExists).toHaveBeenCalledWith("auth-sessions", "create");
|
|
578
580
|
});
|
|
579
|
-
(0, _vitest.it)("throws if
|
|
581
|
+
(0, _vitest.it)("throws if AuthSession is manual", async () => {
|
|
580
582
|
_vitest.vi.mocked(_helpers.loadAuthSessionInstance).mockResolvedValue({
|
|
581
583
|
storageState: {},
|
|
582
584
|
metadata: {
|
|
@@ -680,7 +682,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
680
682
|
trace: false
|
|
681
683
|
})).rejects.toThrow(_helpers.CLIError);
|
|
682
684
|
});
|
|
683
|
-
(0, _vitest.it)("saves to
|
|
685
|
+
(0, _vitest.it)("saves to AuthSession instance path if create and check succeed", async () => {
|
|
684
686
|
await (0, _authSession.executeRunCreateAuthSessionCLI)({
|
|
685
687
|
input: "authSessionInput",
|
|
686
688
|
checkRetries: 1,
|
|
@@ -694,7 +696,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
694
696
|
id: _vitest.expect.any(String)
|
|
695
697
|
}));
|
|
696
698
|
});
|
|
697
|
-
(0, _vitest.it)("uses
|
|
699
|
+
(0, _vitest.it)("uses AuthSession id to save if provided", async () => {
|
|
698
700
|
const result = await (0, _authSession.executeRunCreateAuthSessionCLI)({
|
|
699
701
|
id: "authSessionId",
|
|
700
702
|
input: "authSessionInput",
|
|
@@ -724,11 +726,11 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
724
726
|
}
|
|
725
727
|
});
|
|
726
728
|
});
|
|
727
|
-
afterEach(() => {
|
|
729
|
+
(0, _vitest.afterEach)(() => {
|
|
728
730
|
_vitest.vi.mocked(_runApi.runApi).mockReset();
|
|
729
731
|
_vitest.vi.mocked(_helpers.loadAuthSessionInstance).mockReset();
|
|
730
732
|
});
|
|
731
|
-
(0, _vitest.it)("throws if
|
|
733
|
+
(0, _vitest.it)("throws if AuthSession is manual", async () => {
|
|
732
734
|
_vitest.vi.mocked(_helpers.loadAuthSessionInstance).mockResolvedValue({
|
|
733
735
|
storageState: {},
|
|
734
736
|
metadata: {
|
|
@@ -798,7 +800,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
798
800
|
retrieveSession: true
|
|
799
801
|
}));
|
|
800
802
|
});
|
|
801
|
-
(0, _vitest.it)("saves the
|
|
803
|
+
(0, _vitest.it)("saves the AuthSession with existing input if create and check succeed without providing input", async () => {
|
|
802
804
|
const result = await (0, _authSession.executeRunUpdateAuthSessionCLI)({
|
|
803
805
|
id: "authSessionId",
|
|
804
806
|
checkRetries: 1,
|
|
@@ -814,7 +816,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
814
816
|
proxy: undefined
|
|
815
817
|
}));
|
|
816
818
|
});
|
|
817
|
-
(0, _vitest.it)("saves the
|
|
819
|
+
(0, _vitest.it)("saves the AuthSession with new input if create and check succeed with new input", async () => {
|
|
818
820
|
const result = await (0, _authSession.executeRunUpdateAuthSessionCLI)({
|
|
819
821
|
id: "authSessionId",
|
|
820
822
|
input: "newAuthSessionInput",
|
|
@@ -847,7 +849,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
847
849
|
});
|
|
848
850
|
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce(_checkPassedResult);
|
|
849
851
|
});
|
|
850
|
-
afterEach(() => {
|
|
852
|
+
(0, _vitest.afterEach)(() => {
|
|
851
853
|
_vitest.vi.mocked(_runApi.runApi).mockReset();
|
|
852
854
|
_vitest.vi.mocked(_helpers.loadAuthSessionInstance).mockReset();
|
|
853
855
|
});
|
|
@@ -905,7 +907,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
905
907
|
trace: false
|
|
906
908
|
})).rejects.toThrow(_helpers.CLIError);
|
|
907
909
|
});
|
|
908
|
-
(0, _vitest.it)("saves to
|
|
910
|
+
(0, _vitest.it)("saves to AuthSession instance path if create and check succeed", async () => {
|
|
909
911
|
await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
|
|
910
912
|
input: "authSessionInput",
|
|
911
913
|
headless: false,
|
|
@@ -917,7 +919,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
917
919
|
id: _vitest.expect.any(String)
|
|
918
920
|
}));
|
|
919
921
|
});
|
|
920
|
-
(0, _vitest.it)("uses
|
|
922
|
+
(0, _vitest.it)("uses AuthSession id to save if provided", async () => {
|
|
921
923
|
await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
|
|
922
924
|
id: "authSessionId",
|
|
923
925
|
input: "authSessionInput",
|
|
@@ -962,7 +964,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
962
964
|
}
|
|
963
965
|
});
|
|
964
966
|
});
|
|
965
|
-
afterEach(() => {
|
|
967
|
+
(0, _vitest.afterEach)(() => {
|
|
966
968
|
_vitest.vi.mocked(_runApi.runApi).mockReset();
|
|
967
969
|
_vitest.vi.mocked(_launchBrowser.launchChromium).mockReset();
|
|
968
970
|
_vitest.vi.useRealTimers();
|
|
@@ -1032,7 +1034,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
1032
1034
|
await mockTimeout.resolve();
|
|
1033
1035
|
await (0, _vitest.expect)(p).rejects.toThrow(_helpers.CLIError);
|
|
1034
1036
|
});
|
|
1035
|
-
(0, _vitest.it)("stores
|
|
1037
|
+
(0, _vitest.it)("stores AuthSession and validates it if successful", async () => {
|
|
1036
1038
|
mockPage.url.mockReturnValue("finishUrl");
|
|
1037
1039
|
await (0, _authSession.executeRecordAuthSessionCLI)({
|
|
1038
1040
|
checkRetries: 1,
|
|
@@ -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;
|
|
@@ -138,10 +138,10 @@ declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId
|
|
|
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;
|
|
@@ -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({
|
|
@@ -245,7 +246,7 @@ async function runCheckWithRetries({
|
|
|
245
246
|
...rest
|
|
246
247
|
}) {
|
|
247
248
|
for (let i = 0; i < (retries ?? 1); i++) {
|
|
248
|
-
(0, _terminal.terminal)(`\n^+Running ^
|
|
249
|
+
(0, _terminal.terminal)(`\n^+Running ^cAuthSession check${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
249
250
|
try {
|
|
250
251
|
let traceId = undefined;
|
|
251
252
|
if (rest.trace) {
|
|
@@ -260,19 +261,19 @@ async function runCheckWithRetries({
|
|
|
260
261
|
...rest
|
|
261
262
|
});
|
|
262
263
|
if (checkResult) {
|
|
263
|
-
(0, _terminal.terminal)(`^+^
|
|
264
|
+
(0, _terminal.terminal)(`^+^gAuthSession check passed^:\n`);
|
|
264
265
|
return true;
|
|
265
266
|
}
|
|
266
267
|
} catch (error) {
|
|
267
|
-
if (error instanceof
|
|
268
|
+
if (error instanceof _runtimeInterface.RunAutomationError) {
|
|
268
269
|
(0, _helpers.logAutomationError)(error);
|
|
269
270
|
} else {
|
|
270
271
|
throw error;
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
|
-
(0, _terminal.terminal)(`^+^
|
|
274
|
+
(0, _terminal.terminal)(`^+^yAuthSession check failed^:\n`);
|
|
274
275
|
}
|
|
275
|
-
(0, _terminal.terminal)(`^+^
|
|
276
|
+
(0, _terminal.terminal)(`^+^rAuthSession check failed after ${retries} attempts^:\n`);
|
|
276
277
|
return false;
|
|
277
278
|
}
|
|
278
279
|
const _runCheckWithRetries = exports._runCheckWithRetries = runCheckWithRetries;
|
|
@@ -286,7 +287,7 @@ async function runCreateWithRetries({
|
|
|
286
287
|
}) {
|
|
287
288
|
let newAuthSessionInstance = null;
|
|
288
289
|
for (let i = 0; i < (retries ?? 1); i++) {
|
|
289
|
-
(0, _terminal.terminal)(`\n^+Running ^
|
|
290
|
+
(0, _terminal.terminal)(`\n^+Running ^cAuthSession create${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
290
291
|
try {
|
|
291
292
|
let traceId = undefined;
|
|
292
293
|
if (trace) {
|
|
@@ -300,19 +301,19 @@ async function runCreateWithRetries({
|
|
|
300
301
|
traceId,
|
|
301
302
|
...rest
|
|
302
303
|
});
|
|
303
|
-
(0, _terminal.terminal)(`^+^
|
|
304
|
+
(0, _terminal.terminal)(`^+^gAuthSession create succeeded^:\n`);
|
|
304
305
|
break;
|
|
305
306
|
} catch (error) {
|
|
306
|
-
if (error instanceof
|
|
307
|
+
if (error instanceof _runtimeInterface.RunAutomationError) {
|
|
307
308
|
(0, _helpers.logAutomationError)(error);
|
|
308
309
|
} else {
|
|
309
310
|
throw error;
|
|
310
311
|
}
|
|
311
|
-
(0, _terminal.terminal)(`^+^
|
|
312
|
+
(0, _terminal.terminal)(`^+^yAuthSession create failed^:\n`);
|
|
312
313
|
}
|
|
313
314
|
}
|
|
314
315
|
if (!newAuthSessionInstance) {
|
|
315
|
-
throw new _helpers.CLIError(`Failed to create
|
|
316
|
+
throw new _helpers.CLIError(`Failed to create AuthSession after ${retries} retries. Check errors above for more details.`);
|
|
316
317
|
}
|
|
317
318
|
await (0, _helpers.storeAuthSessionInstance)({
|
|
318
319
|
state: newAuthSessionInstance,
|
|
@@ -336,7 +337,7 @@ async function executeRecordAuthSessionCLI({
|
|
|
336
337
|
finishUrl
|
|
337
338
|
}) {
|
|
338
339
|
id = id ?? generateAuthSessionId();
|
|
339
|
-
(0, _terminal.terminal)(`^+Recording
|
|
340
|
+
(0, _terminal.terminal)(`^+Recording AuthSession with id ^c${id}^:\n`);
|
|
340
341
|
let authSession;
|
|
341
342
|
try {
|
|
342
343
|
authSession = await recordAuthSession({
|
|
@@ -347,7 +348,7 @@ async function executeRecordAuthSessionCLI({
|
|
|
347
348
|
});
|
|
348
349
|
} catch (error) {
|
|
349
350
|
if (error instanceof _helpers.CLIError) {
|
|
350
|
-
throw new _helpers.CLIError(`Failed to record
|
|
351
|
+
throw new _helpers.CLIError(`Failed to record AuthSession: ${error.message}`);
|
|
351
352
|
}
|
|
352
353
|
throw error;
|
|
353
354
|
}
|
|
@@ -375,7 +376,7 @@ async function executeRecordAuthSessionCLI({
|
|
|
375
376
|
trace,
|
|
376
377
|
keepBrowserOpen
|
|
377
378
|
});
|
|
378
|
-
(0, _terminal.terminal)(`^+^
|
|
379
|
+
(0, _terminal.terminal)(`^+^gAuthSession ^c${id}^ ^+^grecorded successfully^:\n`);
|
|
379
380
|
}
|
|
380
381
|
async function recordAuthSession({
|
|
381
382
|
startUrl,
|
|
@@ -400,17 +401,17 @@ async function recordAuthSession({
|
|
|
400
401
|
const timeoutTimestamp = Date.now() + timeout;
|
|
401
402
|
while (true) {
|
|
402
403
|
if (Date.now() > timeoutTimestamp) {
|
|
403
|
-
throw new _helpers.CLIError("Timeout waiting for finish URL");
|
|
404
|
+
throw new _helpers.CLIError("AuthSession recording failed - Timeout waiting for finish URL");
|
|
404
405
|
}
|
|
405
406
|
if (context.pages().length === 0) {
|
|
406
|
-
throw new _helpers.CLIError("Browser was closed before reaching the finish URL");
|
|
407
|
+
throw new _helpers.CLIError("AuthSession recording failed - Browser was closed before reaching the finish URL");
|
|
407
408
|
}
|
|
408
409
|
if (context.pages()[0].url().startsWith(finishUrl)) {
|
|
409
410
|
break;
|
|
410
411
|
}
|
|
411
412
|
await (0, _promises.setTimeout)(1000);
|
|
412
413
|
}
|
|
413
|
-
(0, _terminal.terminal)(`^+Finish URL reached, capturing
|
|
414
|
+
(0, _terminal.terminal)(`^+Finish URL reached, capturing AuthSession...^:\n`);
|
|
414
415
|
await page.waitForLoadState("load");
|
|
415
416
|
const authSession = await (0, _contextStorageStateHelpers.getStorageState)(context);
|
|
416
417
|
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)({
|