@intuned/runtime-dev 1.0.6-cli-auth.0.1.0-test → 1.0.6-cli-auth.0.1.1-test
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.
|
@@ -20,7 +20,7 @@ _commander.program.description("Check an auth session, if it is still valid or n
|
|
|
20
20
|
}
|
|
21
21
|
const checkApiExists = await (0, _utils.ensureAuthApi)("check");
|
|
22
22
|
if (!checkApiExists) {
|
|
23
|
-
throw new Error("Auth check
|
|
23
|
+
throw new Error("Auth check API not implemented, please create it in the auth sessions specified directory");
|
|
24
24
|
}
|
|
25
25
|
const {
|
|
26
26
|
authSessionInstanceStoragePath
|
|
@@ -30,7 +30,7 @@ _commander.program.description("Create an auth session").argument("[auth-session
|
|
|
30
30
|
} else {
|
|
31
31
|
const createApiExists = await (0, _utils.ensureAuthApi)("create");
|
|
32
32
|
if (!createApiExists) {
|
|
33
|
-
throw new Error("Auth session
|
|
33
|
+
throw new Error("Auth session create API not implemented, please create it in the auth sessions specified directory");
|
|
34
34
|
}
|
|
35
35
|
const authSessionInput = (await (0, _utils2.loadParameters)(options === null || options === void 0 ? void 0 : options.input)) ?? {};
|
|
36
36
|
const session = await (0, _utils.runCreateApi)(authSessionInput);
|
|
@@ -54,9 +54,9 @@ async function ensureRecorderURLs() {
|
|
|
54
54
|
throw new Error("Auth session recorder URLs are not configured, please configure them in Intuned.json");
|
|
55
55
|
}
|
|
56
56
|
async function ensureAuthApi(operation) {
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
return await fs.exists(
|
|
57
|
+
const authApiFile = `${_constants.AUTH_SESSIONS_FOLDER_NAME}/${operation}.ts`;
|
|
58
|
+
const authApiFilePath = _path.default.join(process.cwd(), authApiFile);
|
|
59
|
+
return await fs.exists(authApiFilePath);
|
|
60
60
|
}
|
|
61
61
|
async function runCreateApi(authSessionInput) {
|
|
62
62
|
try {
|
|
@@ -101,7 +101,6 @@ async function runCreateApiViaCLI(authSessionInput) {
|
|
|
101
101
|
retrieveSession: true,
|
|
102
102
|
importFunction: _tsNodeImport.tsNodeImport
|
|
103
103
|
});
|
|
104
|
-
let session;
|
|
105
104
|
let nextGeneratorParam = undefined;
|
|
106
105
|
while (true) {
|
|
107
106
|
const {
|
|
@@ -116,8 +115,7 @@ async function runCreateApiViaCLI(authSessionInput) {
|
|
|
116
115
|
console.error(value.error);
|
|
117
116
|
throw new Error("Error while running create");
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
break;
|
|
118
|
+
return value.value.session;
|
|
121
119
|
}
|
|
122
120
|
if (value.action === "request_more_info" && value.requestType == "multiple_choice") {
|
|
123
121
|
nextGeneratorParam = await (0, _promptly.prompt)(value.messageToUser + `, choices: ${value.choices}`, {
|
|
@@ -132,7 +130,6 @@ async function runCreateApiViaCLI(authSessionInput) {
|
|
|
132
130
|
nextGeneratorParam = await (0, _promptly.prompt)(value.messageToUser, {});
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
|
-
return session;
|
|
136
133
|
}
|
|
137
134
|
async function runCheckApiViaCLI(authSessionPath) {
|
|
138
135
|
const runApiResult = await (0, _runApi.runApi)({
|