@auxcode/auxta 0.1.8 → 0.1.9
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/package.json +1 -1
- package/src/AuxTA.ts +11 -3
- package/src/auxta/services/report.service.ts +8 -4
package/package.json
CHANGED
package/src/AuxTA.ts
CHANGED
|
@@ -21,15 +21,23 @@ class AuxTA extends FunctionHelper {
|
|
|
21
21
|
let file;
|
|
22
22
|
try {
|
|
23
23
|
//todo find a better way to load the file
|
|
24
|
-
let currentDir = "
|
|
24
|
+
let currentDir = ""
|
|
25
25
|
while (true) {
|
|
26
26
|
file = path.join(__dirname, currentDir, "auxta.json");
|
|
27
27
|
try {
|
|
28
28
|
fs.accessSync(file, fs.constants.R_OK | fs.constants.W_OK)
|
|
29
29
|
break;
|
|
30
30
|
} catch {
|
|
31
|
+
console.log("Current dir: ", file)
|
|
32
|
+
console.log("Files: ")
|
|
33
|
+
fs.readdir(path.join(__dirname, currentDir), (err, files) => {
|
|
34
|
+
files.forEach(file => {
|
|
35
|
+
console.log("- " + file);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
31
38
|
currentDir += "../"
|
|
32
|
-
if (currentDir.length >=
|
|
39
|
+
if (currentDir.length >= 50) {
|
|
40
|
+
console.log("auxta.json file not found!")
|
|
33
41
|
process.exit(1);
|
|
34
42
|
return;
|
|
35
43
|
}
|
|
@@ -43,7 +51,7 @@ class AuxTA extends FunctionHelper {
|
|
|
43
51
|
}
|
|
44
52
|
this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct);
|
|
45
53
|
} catch (e: any) {
|
|
46
|
-
console.log("Missing or corrupted config:
|
|
54
|
+
console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
|
|
47
55
|
console.log(e);
|
|
48
56
|
process.exit(1);
|
|
49
57
|
}
|
|
@@ -36,16 +36,20 @@ function headers(token: string) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async function auth() {
|
|
39
|
-
|
|
40
|
-
return (await axios.post(
|
|
39
|
+
return axios.post(
|
|
41
40
|
config.auxtaURL + 'login',
|
|
42
41
|
config.auxtaCredentials,
|
|
43
42
|
{
|
|
44
43
|
headers: {
|
|
45
44
|
'Content-Type': 'application/json',
|
|
46
45
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
46
|
+
})
|
|
47
|
+
.then(({data}) => {
|
|
48
|
+
return data.token
|
|
49
|
+
})
|
|
50
|
+
.catch(() => {
|
|
51
|
+
throw new Error("Invalid login credentials")
|
|
52
|
+
});
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
export async function createEmptyReport(body: any): Promise<string> {
|