dataverse-utils 3.0.7 → 4.0.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/auth.js CHANGED
@@ -28,11 +28,11 @@ const onTokenFailure = async (url, error) => {
28
28
  }
29
29
  };
30
30
  exports.onTokenFailure = onTokenFailure;
31
- const getAccessToken = async (tenant, url) => {
31
+ const getAccessToken = async (authEndpoint, url) => {
32
32
  const config = {
33
33
  auth: {
34
34
  clientId: clientId,
35
- authority: `https://login.microsoftonline.com/${tenant}/`
35
+ authority: authEndpoint
36
36
  },
37
37
  cache: {
38
38
  cachePlugin: (0, cachePlugin_1.cachePlugin)(url)
package/lib/deploy.js CHANGED
@@ -34,6 +34,10 @@ async function deploy(type, files) {
34
34
  return;
35
35
  }
36
36
  const creds = JSON.parse(credsFile).connection;
37
+ if (!creds.authEndpoint) {
38
+ logger_1.logger.error(('authEndpoint not found in dataverse.config.json. if you recently updated the package, please update the config file and replace tenant with authEndpoint with full authorization URL.'));
39
+ return;
40
+ }
37
41
  let token = null;
38
42
  // Check if token is available in environment
39
43
  if (process.env.ACCESSTOKEN) {
@@ -41,7 +45,7 @@ async function deploy(type, files) {
41
45
  }
42
46
  else {
43
47
  try {
44
- token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
48
+ token = await (0, auth_1.getAccessToken)(creds.authEndpoint, creds.server);
45
49
  }
46
50
  catch (error) {
47
51
  (0, auth_1.onTokenFailure)(creds.server, error.message);
package/lib/generate.js CHANGED
@@ -26,9 +26,13 @@ async function generate(table) {
26
26
  return;
27
27
  }
28
28
  const creds = JSON.parse(credsFile).connection;
29
+ if (!creds.authEndpoint) {
30
+ logger_1.logger.error(('authEndpoint not found in dataverse.config.json. if you recently updated the package, please update the config file and replace tenant with authEndpoint with full authorization URL.'));
31
+ return;
32
+ }
29
33
  let token = null;
30
34
  try {
31
- token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
35
+ token = await (0, auth_1.getAccessToken)(creds.authEndpoint, creds.server);
32
36
  }
33
37
  catch (error) {
34
38
  (0, auth_1.onTokenFailure)(creds.server, error.message);
@@ -21,7 +21,7 @@ async function deployPluginPackage(config, apiConfig, solution) {
21
21
  if (!config.pluginpackageid) {
22
22
  config.pluginpackageid = await retrievePackage(config.prefix, config.name, apiConfig);
23
23
  }
24
- if (config.pluginpackageid !== '') {
24
+ if (config.pluginpackageid) {
25
25
  try {
26
26
  await updatePackage(config, content, apiConfig);
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataverse-utils",
3
- "version": "3.0.7",
3
+ "version": "4.0.0",
4
4
  "license": "MIT",
5
5
  "description": "Utilities for interacting with Dataverse environments",
6
6
  "main": "lib/index.js",