@intuned/runtime-dev 1.3.8-deploy.7 → 1.3.8-deploy.8
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.
|
@@ -15,16 +15,17 @@ var _save = require("./save");
|
|
|
15
15
|
var _constants2 = require("../../../common/constants");
|
|
16
16
|
var _path = _interopRequireDefault(require("path"));
|
|
17
17
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
18
|
+
var _prompts = _interopRequireDefault(require("prompts"));
|
|
18
19
|
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); }
|
|
19
20
|
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; }
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
async function runDeployProject(projectName, auth) {
|
|
22
23
|
const result = await (0, _save.runSaveProject)(projectName, auth);
|
|
23
24
|
const shouldPromptFirstRunExperience = result?.state === "UNPUBLISHED";
|
|
24
|
-
let
|
|
25
|
+
let firstRunInfo = undefined;
|
|
25
26
|
const settings = await (0, _helpers.loadIntunedJson)();
|
|
26
27
|
if (shouldPromptFirstRunExperience) {
|
|
27
|
-
|
|
28
|
+
firstRunInfo = await promptFirstRunExperience(settings);
|
|
28
29
|
}
|
|
29
30
|
const {
|
|
30
31
|
workspaceId,
|
|
@@ -40,7 +41,7 @@ async function runDeployProject(projectName, auth) {
|
|
|
40
41
|
headers,
|
|
41
42
|
method: "POST",
|
|
42
43
|
body: JSON.stringify({
|
|
43
|
-
|
|
44
|
+
firstRunInfo
|
|
44
45
|
})
|
|
45
46
|
});
|
|
46
47
|
if (!response.ok) {
|
|
@@ -165,12 +166,12 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
165
166
|
};
|
|
166
167
|
};
|
|
167
168
|
{}
|
|
168
|
-
async function
|
|
169
|
+
async function promptFirstRunExperience(settings) {
|
|
169
170
|
let testAuthSessionInput = undefined;
|
|
170
171
|
const shouldPromptForTestAuthSession = settings.authSessions.enabled && settings.authSessions.type === "API";
|
|
171
172
|
let shouldPromptForDefaultJob = true;
|
|
172
173
|
if (shouldPromptForTestAuthSession) {
|
|
173
|
-
testAuthSessionInput = await
|
|
174
|
+
testAuthSessionInput = await promptFirstRunExperienceTestAuthSessionParameters({
|
|
174
175
|
shouldPromptForDefaultJob
|
|
175
176
|
});
|
|
176
177
|
if (!testAuthSessionInput) {
|
|
@@ -179,12 +180,12 @@ async function handleFirstRunExperience(settings) {
|
|
|
179
180
|
}
|
|
180
181
|
return {
|
|
181
182
|
testAuthSessionInput,
|
|
182
|
-
defaultJobInput: shouldPromptForDefaultJob ? await
|
|
183
|
+
defaultJobInput: shouldPromptForDefaultJob ? await promptFirstRunExperienceDefaultJobParameters({
|
|
183
184
|
defaultJobInput: settings["metadata"].defaultJobInput
|
|
184
185
|
}) : undefined
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
|
-
async function
|
|
188
|
+
async function promptFirstRunExperienceTestAuthSessionParameters({
|
|
188
189
|
shouldPromptForDefaultJob
|
|
189
190
|
}) {
|
|
190
191
|
const authSessionsDirectoryPath = _path.default.join(process.cwd(), _constants2.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
|
|
@@ -194,33 +195,33 @@ async function getFirstRunExperienceTestAuthSessionParameters({
|
|
|
194
195
|
metadata
|
|
195
196
|
} = await (0, _helpers.loadAuthSessionInstance)(authSessionId);
|
|
196
197
|
if (metadata.authSessionInput) {
|
|
197
|
-
const message = shouldPromptForDefaultJob ?
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (
|
|
198
|
+
const message = shouldPromptForDefaultJob ? `Create a test auth session using ${authSessionId} parameters? (required for creating default job)` : `Create a test auth session using ${authSessionId} parameters?`;
|
|
199
|
+
const {
|
|
200
|
+
value
|
|
201
|
+
} = await (0, _prompts.default)({
|
|
202
|
+
type: "confirm",
|
|
203
|
+
name: "value",
|
|
204
|
+
message,
|
|
205
|
+
initial: true
|
|
206
|
+
});
|
|
207
|
+
if (value) {
|
|
207
208
|
return metadata.authSessionInput;
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
async function
|
|
213
|
+
async function promptFirstRunExperienceDefaultJobParameters({
|
|
213
214
|
defaultJobInput
|
|
214
215
|
}) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (
|
|
216
|
+
const {
|
|
217
|
+
value
|
|
218
|
+
} = await (0, _prompts.default)({
|
|
219
|
+
type: "confirm",
|
|
220
|
+
name: "value",
|
|
221
|
+
message: `Create a default job with sample parameters?`,
|
|
222
|
+
initial: true
|
|
223
|
+
});
|
|
224
|
+
if (value) {
|
|
224
225
|
return defaultJobInput;
|
|
225
226
|
}
|
|
226
227
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.8-deploy.
|
|
3
|
+
"version": "1.3.8-deploy.8",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"portfinder": "^1.0.37",
|
|
84
84
|
"prettier": "2.8.0",
|
|
85
85
|
"promptly": "3.2.0",
|
|
86
|
+
"prompts": "^2.4.2",
|
|
86
87
|
"rollup": "3.26.2",
|
|
87
88
|
"smol-toml": "^1.4.2",
|
|
88
89
|
"source-map": "0.7.4",
|
|
@@ -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",
|