@hubspot/cms-lib
Advanced tools
Comparing version 2.0.1 to 2.0.2-beta.0
@@ -1,2 +0,2 @@ | ||
const { HubSpotAuthError } = require('@hubspot/api-auth-lib/Errors'); | ||
const { HubSpotAuthError } = require('./lib/models/Errors'); | ||
const { logger } = require('./logger'); | ||
@@ -3,0 +3,0 @@ |
@@ -100,2 +100,6 @@ const request = require('request'); | ||
const patchRequest = async (portalId, options) => { | ||
return requestPN.patch(await withAuth(portalId, options)); | ||
}; | ||
const deleteRequest = async (portalId, options) => { | ||
@@ -156,3 +160,4 @@ return requestPN.del(await withAuth(portalId, options)); | ||
put: putRequest, | ||
patch: patchRequest, | ||
delete: deleteRequest, | ||
}; |
@@ -375,2 +375,3 @@ const fs = require('fs-extra'); | ||
const portalId = getPortalId(nameOrId); | ||
if (portalId) { | ||
@@ -392,2 +393,5 @@ const portalConfig = getPortalConfig(portalId); | ||
/* | ||
* Returns a portalId from the config if it exists, else returns null | ||
*/ | ||
const getPortalId = nameOrId => { | ||
@@ -394,0 +398,0 @@ const config = getAndLoadConfigIfNeeded(); |
31
oauth.js
@@ -1,9 +0,5 @@ | ||
const OAuth2Manager = require('@hubspot/api-auth-lib/OAuth2Manager'); | ||
const { | ||
updatePortalConfig, | ||
writeConfig, | ||
getPortalConfig, | ||
} = require('./lib/config'); | ||
const OAuth2Manager = require('./lib/models/OAuth2Manager'); | ||
const { updatePortalConfig, writeConfig } = require('./lib/config'); | ||
const { logger, logErrorInstance } = require('./logger'); | ||
const { AUTH_METHODS, ENVIRONMENTS } = require('./lib/constants'); | ||
const { AUTH_METHODS } = require('./lib/constants'); | ||
@@ -42,13 +38,2 @@ const oauthManagers = new Map(); | ||
const setupOauth = (portalId, portalConfig) => { | ||
const config = getPortalConfig(portalId) || {}; | ||
return new OAuth2Manager( | ||
{ | ||
...portalConfig, | ||
environment: portalConfig.env || config.env || ENVIRONMENTS.PROD, | ||
}, | ||
logger | ||
); | ||
}; | ||
const addOauthToPortalConfig = (portalId, oauth) => { | ||
@@ -69,13 +54,5 @@ logger.log('Updating configuration'); | ||
const authenticateWithOauth = async configData => { | ||
const portalId = parseInt(configData.portalId, 10); | ||
const oauth = setupOauth(portalId, configData); | ||
logger.log('Authorizing'); | ||
await oauth.authorize(); | ||
addOauthToPortalConfig(portalId, oauth); | ||
}; | ||
module.exports = { | ||
getOauthManager, | ||
authenticateWithOauth, | ||
addOauthToPortalConfig, | ||
}; |
{ | ||
"name": "@hubspot/cms-lib", | ||
"version": "2.0.1", | ||
"version": "2.0.2-beta.0", | ||
"description": "Library for working with the HubSpot CMS", | ||
@@ -22,2 +22,3 @@ "license": "Apache-2.0", | ||
"moment": "^2.24.0", | ||
"open": "^7.0.3", | ||
"p-queue": "^6.0.2", | ||
@@ -35,3 +36,3 @@ "prettier": "^1.19.1", | ||
}, | ||
"gitHead": "08757060ff63ac0a9cf6362f4cb035eca9a46930" | ||
"gitHead": "24034a03b99779398a995a28155663641d5a2d4c" | ||
} |
@@ -97,2 +97,4 @@ const path = require('path'); | ||
const getAbsoluteFilePath = _path => path.resolve(getCwd(), _path); | ||
module.exports = { | ||
@@ -103,2 +105,3 @@ convertToUnixPath, | ||
getAllowedExtensions, | ||
getAbsoluteFilePath, | ||
getCwd, | ||
@@ -105,0 +108,0 @@ getExt, |
const moment = require('moment'); | ||
const { HubSpotAuthError } = require('@hubspot/api-auth-lib/Errors'); | ||
const { HubSpotAuthError } = require('./lib/models/Errors'); | ||
const { | ||
@@ -5,0 +4,0 @@ getEnv, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220688
78
7229
16
2
30
+ Addedopen@^7.0.3
+ Addedis-docker@2.2.1(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addedopen@7.4.2(transitive)