Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hubspot/local-dev-lib

Package Overview
Dependencies
Maintainers
0
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/local-dev-lib - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

config/getAccountIdentifier.d.ts

3

api/hubdb.d.ts
import { AxiosPromise } from 'axios';
import { QueryParams } from '../types/Http';
import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table } from '../types/Hubdb';
import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table, FetchTablesResponse } from '../types/Hubdb';
export declare function fetchTables(accountId: number): AxiosPromise<FetchTablesResponse>;
export declare function fetchTable(accountId: number, tableId: string): AxiosPromise<Table>;

@@ -5,0 +6,0 @@ export declare function createTable(accountId: number, schema: Schema): AxiosPromise<Table>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteRows = exports.fetchRows = exports.createRows = exports.deleteTable = exports.publishTable = exports.updateTable = exports.createTable = exports.fetchTable = void 0;
exports.deleteRows = exports.fetchRows = exports.createRows = exports.deleteTable = exports.publishTable = exports.updateTable = exports.createTable = exports.fetchTable = exports.fetchTables = void 0;
const http_1 = require("../http");
const HUBDB_API_PATH = 'cms/v3/hubdb';
function fetchTables(accountId) {
return http_1.http.get(accountId, {
url: `${HUBDB_API_PATH}/tables`,
});
}
exports.fetchTables = fetchTables;
function fetchTable(accountId, tableId) {

@@ -7,0 +13,0 @@ return http_1.http.get(accountId, {

@@ -23,12 +23,13 @@ import { CLIConfig_NEW, Environment } from '../types/Config';

getResolvedDefaultAccountForCWD(nameOrId: string | number): CLIAccount_NEW | null;
getConfigAccountIndex(accountId: number): number;
getAccountIndex(accountId: number): number;
getConfigForAccount(accountId?: number): CLIAccount_NEW | null;
getConfigAccounts(): Array<CLIAccount_NEW> | null;
isAccountInConfig(nameOrId: string | number): boolean;
getAndLoadConfigIfNeeded(options?: CLIOptions): CLIConfig_NEW;
getEnv(nameOrId?: string | number): Environment;
getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
getAccountType(accountType?: AccountType | null, sandboxAccountType?: string | null): AccountType;
/**
* @throws {Error}
*/
updateAccount(updatedAccountFields: Partial<FlatAccountFields_NEW>, writeUpdate?: boolean): FlatAccountFields_NEW | null;
addOrUpdateAccount(updatedAccountFields: Partial<FlatAccountFields_NEW>, writeUpdate?: boolean): FlatAccountFields_NEW | null;
/**

@@ -35,0 +36,0 @@ * @throws {Error}

@@ -119,3 +119,3 @@ "use strict";

if (accountConfig.name) {
if (accountNamesMap[accountConfig.name]) {
if (accountNamesMap[accountConfig.name.toLowerCase()]) {
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.validate.duplicateAccountNames`, {

@@ -135,3 +135,3 @@ accountName: accountConfig.name,

if (!accountConfig.accountType) {
this.updateAccount({
this.addOrUpdateAccount({
...accountConfig,

@@ -199,3 +199,3 @@ accountId: accountConfig.accountId,

}
getConfigAccountIndex(accountId) {
getAccountIndex(accountId) {
return this.config

@@ -207,8 +207,19 @@ ? this.config.accounts.findIndex(account => account.accountId === accountId)

if (this.config) {
this.config.accounts.find(account => account.accountId === accountId) ||
null;
return (this.config.accounts.find(account => account.accountId === accountId) ||
null);
}
return null;
}
getConfigAccounts() {
if (this.config) {
return this.config.accounts || null;
}
return null;
}
isAccountInConfig(nameOrId) {
if (typeof nameOrId === 'string') {
return (!!this.config &&
this.config.accounts &&
!!this.getAccountId(nameOrId.toLowerCase()));
}
return (!!this.config && this.config.accounts && !!this.getAccountId(nameOrId));

@@ -253,3 +264,3 @@ }

*/
updateAccount(updatedAccountFields, writeUpdate = true) {
addOrUpdateAccount(updatedAccountFields, writeUpdate = true) {
const { accountId, accountType, apiKey, authType, clientId, clientSecret, defaultMode, env, name, parentAccountId, personalAccessKey, sandboxAccountType, scopes, tokenInfo, } = updatedAccountFields;

@@ -263,4 +274,7 @@ if (!accountId) {

}
// Check whether the account is already listed in the config.yml file.
const currentAccountConfig = this.getAccount(accountId);
// For accounts that are already in the config.yml file, sets the auth property.
let auth = (currentAccountConfig && currentAccountConfig.auth) || {};
// For accounts not already in the config.yml file, sets the auth property.
if (clientId || clientSecret || scopes || tokenInfo) {

@@ -288,2 +302,3 @@ auth = {

const updatedDefaultMode = defaultMode && defaultMode.toLowerCase();
const updatedAccountType = accountType || (currentAccountConfig && currentAccountConfig.accountType);
safelyApplyUpdates('name', name);

@@ -304,5 +319,8 @@ safelyApplyUpdates('env', updatedEnv);

safelyApplyUpdates('sandboxAccountType', sandboxAccountType);
safelyApplyUpdates('accountType', this.getAccountType(accountType, sandboxAccountType));
safelyApplyUpdates('accountType', this.getAccountType(updatedAccountType, sandboxAccountType));
safelyApplyUpdates('parentAccountId', parentAccountId);
const completedAccountConfig = nextAccountConfig;
if (!Object.hasOwn(this.config, 'accounts')) {
this.config.accounts = [];
}
if (currentAccountConfig) {

@@ -312,14 +330,16 @@ logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.updating`, {

}));
const index = this.getConfigAccountIndex(accountId);
this.config.accounts[index] = completedAccountConfig;
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.addingConfigEntry`, {
accountId,
}));
if (this.config.accounts) {
const index = this.getAccountIndex(accountId);
if (index < 0) {
this.config.accounts.push(completedAccountConfig);
}
else {
this.config.accounts = [completedAccountConfig];
this.config.accounts[index] = completedAccountConfig;
}
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.addingConfigEntry`, {
accountId,
}));
}
else {
this.config.accounts.push(completedAccountConfig);
}
if (writeUpdate) {

@@ -362,3 +382,8 @@ this.write();

if (accountId) {
this.updateAccount({ accountId, name: newName, env: this.getEnv() });
this.addOrUpdateAccount({
accountId,
name: newName,
env: this.getEnv(),
accountType: accountConfigToRename.accountType,
});
}

@@ -387,3 +412,3 @@ if (accountConfigToRename.name === this.getDefaultAccount()) {

logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.removeAccountFromConfig.deleting`, { accountId }));
const index = this.getConfigAccountIndex(accountId);
const index = this.getAccountIndex(accountId);
this.config.accounts.splice(index, 1);

@@ -390,0 +415,0 @@ if (this.getDefaultAccount() === accountConfig.name) {

import * as config_DEPRECATED from './config_DEPRECATED';
import { CLIConfig } from '../types/Config';
import { CLIConfig_NEW, CLIConfig } from '../types/Config';
import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
import { AccountType, CLIAccount, FlatAccountFields } from '../types/Accounts';
import { AccountType, CLIAccount, CLIAccount_NEW, CLIAccount_DEPRECATED, FlatAccountFields } from '../types/Accounts';
import { Mode } from '../types/Files';
export declare function loadConfig(path: string, options?: CLIOptions): CLIConfig | null;

@@ -11,7 +12,8 @@ export declare function getAndLoadConfigIfNeeded(options?: CLIOptions): Partial<CLIConfig> | null;

path?: string;
}, useRootConfig?: boolean): void;
}, useHiddenConfig?: boolean): void;
export declare function deleteEmptyConfigFile(): void;
export declare function getConfig(): CLIConfig | null;
export declare function writeConfig(options?: WriteConfigOptions): void;
export declare function getConfigPath(path?: string): string | null;
export declare function getConfigPath(path?: string, useHiddenConfig?: boolean): string | null;
export declare function configFileExists(useHiddenConfig?: boolean): boolean;
export declare function getAccountConfig(accountId?: number): CLIAccount | null;

@@ -32,4 +34,5 @@ export declare function accountNameExistsInConfig(name: string): boolean;

export declare function getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
export declare const getConfigAccounts: typeof config_DEPRECATED.getConfigAccounts;
export declare const getConfigDefaultAccount: typeof config_DEPRECATED.getConfigDefaultAccount;
export declare function getDefaultAccount(): string | number | null | undefined;
export declare function getAccounts(): Array<CLIAccount_NEW> | Array<CLIAccount_DEPRECATED> | null | undefined;
export declare function updateDefaultMode(mode: Mode): void | CLIConfig_NEW | null;
export declare const getConfigAccountId: typeof config_DEPRECATED.getConfigAccountId;

@@ -41,2 +44,1 @@ export declare const getOrderedAccount: typeof config_DEPRECATED.getOrderedAccount;

export declare const findConfig: typeof config_DEPRECATED.findConfig;
export declare const updateDefaultMode: typeof config_DEPRECATED.updateDefaultMode;

@@ -26,7 +26,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.updateDefaultMode = exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.getConfigDefaultAccount = exports.getConfigAccounts = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.updateDefaultMode = exports.getAccounts = exports.getDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
const config_DEPRECATED = __importStar(require("./config_DEPRECATED"));
const CLIConfiguration_1 = require("./CLIConfiguration");
const configFile_1 = require("./configFile");
const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
const getAccountIdentifier_1 = require("./getAccountIdentifier");
// Use new config if it exists

@@ -62,4 +62,4 @@ function loadConfig(path, options = {}) {

exports.loadConfigFromEnvironment = loadConfigFromEnvironment;
function createEmptyConfigFile(options = {}, useRootConfig = false) {
if (useRootConfig) {
function createEmptyConfigFile(options = {}, useHiddenConfig = false) {
if (useHiddenConfig) {
CLIConfiguration_1.CLIConfiguration.write({ accounts: [] });

@@ -98,4 +98,4 @@ }

exports.writeConfig = writeConfig;
function getConfigPath(path) {
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
function getConfigPath(path, useHiddenConfig = false) {
if (useHiddenConfig || CLIConfiguration_1.CLIConfiguration.isActive()) {
return (0, configFile_1.getConfigFilePath)();

@@ -106,2 +106,8 @@ }

exports.getConfigPath = getConfigPath;
function configFileExists(useHiddenConfig) {
return useHiddenConfig
? (0, configFile_1.configFileExists)()
: Boolean(config_DEPRECATED.getConfigPath());
}
exports.configFileExists = configFileExists;
function getAccountConfig(accountId) {

@@ -124,3 +130,3 @@ if (CLIConfiguration_1.CLIConfiguration.isActive()) {

if (CLIConfiguration_1.CLIConfiguration.isActive()) {
return CLIConfiguration_1.CLIConfiguration.updateAccount({
return CLIConfiguration_1.CLIConfiguration.addOrUpdateAccount({
...configOptions,

@@ -232,5 +238,24 @@ accountId: accountIdentifier,

exports.getAccountType = getAccountType;
// These functions are either not supported or have breaking changes with the new config setup
exports.getConfigAccounts = config_DEPRECATED.getConfigAccounts;
exports.getConfigDefaultAccount = config_DEPRECATED.getConfigDefaultAccount;
function getDefaultAccount() {
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
return CLIConfiguration_1.CLIConfiguration.getDefaultAccount();
}
return config_DEPRECATED.getConfigDefaultAccount();
}
exports.getDefaultAccount = getDefaultAccount;
function getAccounts() {
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
return CLIConfiguration_1.CLIConfiguration.getConfigAccounts();
}
return config_DEPRECATED.getConfigAccounts();
}
exports.getAccounts = getAccounts;
function updateDefaultMode(mode) {
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
return CLIConfiguration_1.CLIConfiguration.updateDefaultMode(mode);
}
return config_DEPRECATED.updateDefaultMode(mode);
}
exports.updateDefaultMode = updateDefaultMode;
// These functions are not supported with the new config setup
exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;

@@ -242,2 +267,1 @@ exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;

exports.findConfig = config_DEPRECATED.findConfig;
exports.updateDefaultMode = config_DEPRECATED.updateDefaultMode;
export declare const DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = "hubspot.config.yml";
export declare const HUBSPOT_CONFIGURATION_FOLDER = ".hubspot";
export declare const HUBSPOT_CONFIGURATION_FOLDER = ".hubspot-cli";
export declare const HUBSPOT_CONFIGURATION_FILE = "config.yml";

@@ -4,0 +4,0 @@ export declare const MIN_HTTP_TIMEOUT = 3000;

@@ -6,3 +6,3 @@ "use strict";

exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = 'hubspot.config.yml';
exports.HUBSPOT_CONFIGURATION_FOLDER = '.hubspot';
exports.HUBSPOT_CONFIGURATION_FOLDER = '.hubspot-cli';
exports.HUBSPOT_CONFIGURATION_FILE = 'config.yml';

@@ -9,0 +9,0 @@ exports.MIN_HTTP_TIMEOUT = 3000;

@@ -109,3 +109,3 @@ "use strict";

}) {
const { moduleLabel, contentTypes, global, reactType: isReactModule, } = moduleDefinition;
const { moduleLabel, contentTypes, global, reactType: isReactModule, availableForNewContent, } = moduleDefinition;
const moduleMetaData = {

@@ -122,3 +122,3 @@ label: moduleLabel,

tags: [],
is_available_for_new_content: false,
is_available_for_new_content: availableForNewContent,
};

@@ -125,0 +125,0 @@ const folderName = name.endsWith('.module') ? name : `${name}.module`;

@@ -7,3 +7,3 @@ "use strict";

const logger_1 = require("./logger");
const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
const config_1 = require("../config");

@@ -10,0 +10,0 @@ const lang_1 = require("../utils/lang");

@@ -16,2 +16,3 @@ "use strict";

const logger_1 = require("./logger");
const CLIConfiguration_1 = require("../config/CLIConfiguration");
const lang_1 = require("../utils/lang");

@@ -145,3 +146,3 @@ const errors_1 = require("../errors");

}
const updatedConfig = (0, config_1.updateAccountConfig)({
const updatedAccount = (0, config_1.updateAccountConfig)({
accountId: portalId,

@@ -156,8 +157,10 @@ accountType,

});
(0, config_1.writeConfig)();
if (!CLIConfiguration_1.CLIConfiguration.isActive()) {
(0, config_1.writeConfig)();
}
if (makeDefault && name) {
(0, config_1.updateDefaultAccount)(name);
}
return updatedConfig;
return updatedAccount;
}
exports.updateConfigWithAccessToken = updateConfigWithAccessToken;
import { RequestPortsData } from '../types/PortManager';
export declare const BASE_URL: string;
export declare function isPortManagerServerRunning(): Promise<boolean>;
export declare function startPortManagerServer(): Promise<void>;

@@ -4,0 +5,0 @@ export declare function stopPortManagerServer(): Promise<void>;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.portManagerHasActiveServers = exports.deleteServerInstance = exports.requestPorts = exports.stopPortManagerServer = exports.startPortManagerServer = exports.BASE_URL = void 0;
exports.portManagerHasActiveServers = exports.deleteServerInstance = exports.requestPorts = exports.stopPortManagerServer = exports.startPortManagerServer = exports.isPortManagerServerRunning = exports.BASE_URL = void 0;
const axios_1 = __importDefault(require("axios"));

@@ -17,2 +17,3 @@ const PortManagerServer_1 = require("../utils/PortManagerServer");

}
exports.isPortManagerServerRunning = isPortManagerServerRunning;
async function startPortManagerServer() {

@@ -19,0 +20,0 @@ const isRunning = await isPortManagerServerRunning();

@@ -12,3 +12,3 @@ "use strict";

const logger_1 = require("../lib/logger");
const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
const auth_1 = require("../constants/auth");

@@ -15,0 +15,0 @@ const lang_1 = require("../utils/lang");

{
"name": "@hubspot/local-dev-lib",
"version": "2.0.1",
"version": "2.1.0",
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",

@@ -56,2 +56,3 @@ "main": "lib/index.js",

"./http/*": "./http/*.js",
"./config/getAccountIdentifier": "./config/getAccountIdentifier.js",
"./config": "./config/index.js",

@@ -58,0 +59,0 @@ "./constants/*": "./constants/*.js",

@@ -101,1 +101,10 @@ export type Schema = {

};
export type FetchTablesResponse = {
total: number;
results: Array<Table>;
paging?: {
next: {
after: string | null;
};
} | null;
};

@@ -15,2 +15,3 @@ export type PathInput = {

global: boolean;
availableForNewContent: boolean;
};
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