New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hubspot/cli

Package Overview
Dependencies
Maintainers
21
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/cli - npm Package Compare versions

Comparing version 4.1.7-beta.2 to 4.1.7

82

commands/sandbox/delete.js

@@ -21,2 +21,3 @@ const {

removeSandboxAccountFromConfig,
updateDefaultAccount,
} = require('@hubspot/cli-lib/lib/config');

@@ -42,3 +43,3 @@ const {

const { account } = options;
const { account, force } = options;
const config = getConfig();

@@ -48,4 +49,17 @@

if (!account) {
accountPrompt = await deleteSandboxPrompt(config);
if (!force) {
accountPrompt = await deleteSandboxPrompt(config);
} else {
// Account is required, throw error if force flag is present and no account is specified
logger.log('');
logger.error(i18n(`${i18nKey}.failure.noAccount`));
process.exit(EXIT_CODES.ERROR);
}
if (!accountPrompt) {
logger.log('');
logger.error(i18n(`${i18nKey}.failure.noSandboxAccounts`));
process.exit(EXIT_CODES.ERROR);
}
}
const sandboxAccountId = getAccountId({

@@ -60,2 +74,6 @@ account: account || accountPrompt.account,

const baseUrl = getHubSpotWebsiteOrigin(
getEnv(sandboxAccountId) === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD
);
let parentAccountId;

@@ -66,3 +84,3 @@ for (const portal of config.portals) {

parentAccountId = portal.parentAccountId;
} else {
} else if (!force) {
const parentAccountPrompt = await deleteSandboxPrompt(config, true);

@@ -72,2 +90,5 @@ parentAccountId = getAccountId({

});
} else {
logger.error(i18n(`${i18nKey}.failure.noParentAccount`));
process.exit(EXIT_CODES.ERROR);
}

@@ -77,13 +98,11 @@ }

const url = `${baseUrl}/sandboxes/${parentAccountId}`;
const command = `hs auth ${
getEnv(sandboxAccountId) === 'qa' ? '--qa' : ''
} --account=${parentAccountId}`;
if (!getAccountId({ account: parentAccountId })) {
const baseUrl = getHubSpotWebsiteOrigin(
getEnv(sandboxAccountId) === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD
);
const url = `${baseUrl}/sandboxes/${parentAccountId}`;
const command = `hs auth ${
getEnv(sandboxAccountId) === 'qa' ? '--qa' : ''
} --account=${parentAccountId}`;
logger.log('');
logger.error(
i18n(`${i18nKey}.noParentPortalAvailable`, {
i18n(`${i18nKey}.failure.noParentPortalAvailable`, {
parentAccountId,

@@ -113,13 +132,15 @@ url,

try {
const { confirmSandboxDeletePrompt: confirmed } = await promptUser([
{
name: 'confirmSandboxDeletePrompt',
type: 'confirm',
message: i18n(`${i18nKey}.confirm`, {
account: account || accountPrompt.account,
}),
},
]);
if (!confirmed) {
process.exit(EXIT_CODES.SUCCESS);
if (!force) {
const { confirmSandboxDeletePrompt: confirmed } = await promptUser([
{
name: 'confirmSandboxDeletePrompt',
type: 'confirm',
message: i18n(`${i18nKey}.confirm`, {
account: account || accountPrompt.account,
}),
},
]);
if (!confirmed) {
process.exit(EXIT_CODES.SUCCESS);
}
}

@@ -144,4 +165,7 @@

);
if (promptDefaultAccount) {
if (promptDefaultAccount && !force) {
await selectAndSetAsDefaultAccountPrompt(getConfig());
} else {
// If force is specified, skip prompt and set the parent account id as the default account
updateDefaultAccount(parentAccountId);
}

@@ -168,3 +192,3 @@ process.exit(EXIT_CODES.SUCCESS);

logger.warn(
i18n(`${i18nKey}.objectNotFound`, {
i18n(`${i18nKey}.failure.objectNotFound`, {
account: account || accountPrompt.account,

@@ -178,4 +202,7 @@ })

);
if (promptDefaultAccount) {
if (promptDefaultAccount && !force) {
await selectAndSetAsDefaultAccountPrompt(getConfig());
} else {
// If force is specified, skip prompt and set the parent account id as the default account
updateDefaultAccount(parentAccountId);
}

@@ -195,2 +222,7 @@ process.exit(EXIT_CODES.SUCCESS);

});
yargs.option('f', {
type: 'boolean',
alias: 'force',
describe: i18n(`${i18nKey}.examples.force`),
});

@@ -197,0 +229,0 @@ yargs.example([

@@ -52,2 +52,3 @@ const { updateDefaultAccount } = require('@hubspot/cli-lib/lib/config');

selectAccountFromConfig,
mapAccountChoices,
};

@@ -18,2 +18,14 @@ const { promptUser } = require('./promptUtils');

const mapNonSandboxAccountChoices = portals =>
portals
.filter(
p => p.sandboxAccountType === null || p.sandboxAccountType === undefined
)
.map(p => {
return {
name: `${p.name} (${p.portalId})`,
value: p.name || p.portalId,
};
});
const createSandboxPrompt = () => {

@@ -36,2 +48,8 @@ return promptUser([

const deleteSandboxPrompt = (config, promptParentAccount = false) => {
const choices = promptParentAccount
? mapNonSandboxAccountChoices(config.portals)
: mapSandboxAccountChoices(config.portals);
if (!choices.length) {
return undefined;
}
return promptUser([

@@ -48,3 +66,3 @@ {

pageSize: 20,
choices: mapSandboxAccountChoices(config.portals),
choices,
default: config.defaultPortal,

@@ -51,0 +69,0 @@ },

{
"name": "@hubspot/cli",
"version": "4.1.7-beta.2",
"version": "4.1.7",
"description": "CLI for working with HubSpot",

@@ -11,4 +11,4 @@ "license": "Apache-2.0",

"dependencies": {
"@hubspot/cli-lib": "4.1.7-beta.2",
"@hubspot/serverless-dev-runtime": "4.1.7-beta.2",
"@hubspot/cli-lib": "4.1.7",
"@hubspot/serverless-dev-runtime": "4.1.7",
"archiver": "^5.3.0",

@@ -42,3 +42,3 @@ "chalk": "^4.1.2",

},
"gitHead": "ce9f106f0da7a39fbf14ff0ead2d5d750adee428"
"gitHead": "ef2292568ec8308feb0c5841e4d3dd25a64d1050"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc