dataverse-utils 2.7.9 → 2.8.0
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/lib/deploy.js +15 -9
- package/package.json +1 -1
package/lib/deploy.js
CHANGED
|
@@ -35,16 +35,22 @@ async function deploy(type, files) {
|
|
|
35
35
|
}
|
|
36
36
|
const creds = JSON.parse(credsFile).connection;
|
|
37
37
|
let token = null;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// Check if token is available in environment
|
|
39
|
+
if (process.env.ACCESSTOKEN) {
|
|
40
|
+
token = { accessToken: process.env.ACCESSTOKEN };
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
else {
|
|
43
|
+
try {
|
|
44
|
+
token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
(0, auth_1.onTokenFailure)(creds.server, error.message);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (token == null || token.accessToken == null) {
|
|
51
|
+
(0, auth_1.onTokenFailure)(creds.server);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
const apiConfig = new node_1.WebApiConfig('8.2', token.accessToken, creds.server);
|
|
50
56
|
switch (type) {
|