Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
},
{
"command": "hubspot.config.selectDefaultAccount",
"title": "Hubspot: Select default account"
"title": "HubSpot: Select default account"
},
{
"command": "hubspot.config.setDefaultAccount",
Expand Down Expand Up @@ -558,7 +558,7 @@
]
},
"dependencies": {
"@hubspot/local-dev-lib": "4.0.3",
"@hubspot/local-dev-lib": "5.0.0",
"@hubspot/project-parsing-lib": "0.10.3",
"dayjs": "^1.11.7",
"debounce": "1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion snippets/auto_gen/hubl_functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"body": [
"crm_associations(${1:id}, ${2:association category}, ${3:association definition id}, ${4:query}, ${5:properties}, ${6:formatting})"
],
"description": "Gets a list of associated objects from the HubSpot CRM based on the given object id, association category, and association definition id.Supported object types that can be retrieved are HubSpot built-in objects, portal specific objects, and integrator objects. For security, only portal specific objects and product can be retrieved on any public page. Any other built-in object types (except product) or integrator object types must be hosted on a page which is either password protected or requires a CMS Membership login. Objects are returned as a dict of properties and values.\nParameters:\n- id(id) The id of object instance to retrieve the associations from.\n- association_category(enumeration) The category of the association definition. Possible values are HUBSPOT_DEFINED, USER_DEFINED, and INTEGRATOR_DEFINED.\n- association_definition id(number) The id of the association definition to use. Hubspot-defined association definition ids for the built-in object types can be found here https://legacydocs.hubspot.com/docs/methods/crm-associations/crm-associations-overview or you can use the API endpoint `/crm/v3/associations/{fromObjectType}/{toObjectType}/types` documented at https://developers.hubspot.com/docs/api/crm/associations\n- query(string) Optional. Http Query Language(HQL) query to filter associated objects. The query can be formed with property expressions ANDed together using the & symbol. The supported expression operators are eq (default), neq, lt, lte, gt, gte, is_null, not_null, in, not_in, and contains(contains is only applicable for multi-valued properties). E.g. for an event \"type=sports&date_gt=2020-06-01\". If you want to filter by a property which has any of the given set of values, use `in` filter (e.g. type__in=sports,music). If you want to filter by a multi-select property which has all of the given values, use `contains` filter (e.g type__contains=sports,music). If a query is provided, the function will run the default query `offset=0&limit=10` to fetch the objects.\n- properties(string) Optional. The list of property names that should be retrieved. If list is not provided then the properties defined as required are returned and all the properties will be returned if required properties is not defined. The object instance id is always included in the returned object properties even if it is not explicitly added in the property list.\n- formatting(boolean) Optional. Format values such as dates and currency according to this portal's settings. Pass 'false' for raw strings.",
"description": "Gets a list of associated objects from the HubSpot CRM based on the given object id, association category, and association definition id.Supported object types that can be retrieved are HubSpot built-in objects, portal specific objects, and integrator objects. For security, only portal specific objects and product can be retrieved on any public page. Any other built-in object types (except product) or integrator object types must be hosted on a page which is either password protected or requires a CMS Membership login. Objects are returned as a dict of properties and values.\nParameters:\n- id(id) The id of object instance to retrieve the associations from.\n- association_category(enumeration) The category of the association definition. Possible values are HUBSPOT_DEFINED, USER_DEFINED, and INTEGRATOR_DEFINED.\n- association_definition id(number) The id of the association definition to use. HubSpot-defined association definition ids for the built-in object types can be found here https://legacydocs.hubspot.com/docs/methods/crm-associations/crm-associations-overview or you can use the API endpoint `/crm/v3/associations/{fromObjectType}/{toObjectType}/types` documented at https://developers.hubspot.com/docs/api/crm/associations\n- query(string) Optional. Http Query Language(HQL) query to filter associated objects. The query can be formed with property expressions ANDed together using the & symbol. The supported expression operators are eq (default), neq, lt, lte, gt, gte, is_null, not_null, in, not_in, and contains(contains is only applicable for multi-valued properties). E.g. for an event \"type=sports&date_gt=2020-06-01\". If you want to filter by a property which has any of the given set of values, use `in` filter (e.g. type__in=sports,music). If you want to filter by a multi-select property which has all of the given values, use `contains` filter (e.g type__contains=sports,music). If a query is provided, the function will run the default query `offset=0&limit=10` to fetch the objects.\n- properties(string) Optional. The list of property names that should be retrieved. If list is not provided then the properties defined as required are returned and all the properties will be returned if required properties is not defined. The object instance id is always included in the returned object properties even if it is not explicitly added in the property list.\n- formatting(boolean) Optional. Format values such as dates and currency according to this portal's settings. Pass 'false' for raw strings.",
"prefix": "~crm_associations"
},
"crm_object": {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';

import { updateStatusBarItems } from '../features/statusBar';
import { COMMANDS, EVENTS, TRACKED_EVENTS } from '../lib/constants';
import { getDisplayedHubspotPortalInfo } from '../lib/config';
import { getDisplayedHubSpotPortalInfo } from '../lib/config';
import { portalNameInvalid } from '../lib/config';
import { trackEvent } from '../lib/tracking';
import { showAutoDismissedStatusBarMessage } from '../lib/statusBar';
Expand Down Expand Up @@ -93,7 +93,7 @@ export const registerCommands = (context: ExtensionContext) => {
.showQuickPick(
accounts.map((a: HubSpotConfigAccount) => {
return {
label: getDisplayedHubspotPortalInfo(a),
label: getDisplayedHubSpotPortalInfo(a),
description:
defaultAccount?.accountId === a.accountId ||
defaultAccount?.name === a.name
Expand Down
6 changes: 3 additions & 3 deletions src/events/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getUpdateLintingOnConfigChange,
setLintingEnabledState,
} from '../features/hublLinting';
import { loadHubspotConfigFile } from '../lib/config';
import { loadHubSpotConfigFile } from '../lib/config';

let configFoundAndLoaded = false;
let hubspotConfigWatcher: FSWatcher | null;
Expand All @@ -34,11 +34,11 @@ export const registerEvents = (context: ExtensionContext) => {
async (eventType: 'change' | 'rename') => {
if (eventType === 'change') {
console.log(`${configPath} changed`);
loadHubspotConfigFile(rootPath);
loadHubSpotConfigFile(rootPath);
} else if (eventType === 'rename') {
// 'rename' event is triggers for renames and deletes
console.log(`${configPath} renamed/deleted`);
loadHubspotConfigFile(rootPath);
loadHubSpotConfigFile(rootPath);
hubspotConfigWatcher && hubspotConfigWatcher.close();
hubspotConfigWatcher = null;
console.log(`stopped watching ${configPath}`);
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export const activate = async (context: ExtensionContext) => {
console.log('Activating Extension v', context.extension.packageJSON.version);
const rootPath = getRootPath();

// Set process.cwd() to the project root so local-dev-lib functions
// that read from process.cwd() will use the open project as the working directory
if (rootPath) {
process.chdir(rootPath);
}

// Contribution registration steps
registerCommands(context, rootPath);
registerURIHandler(context);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
getConfigAtPath,
} from '@hubspot/local-dev-lib/config/migrate';

export const getDisplayedHubspotPortalInfo = (
export const getDisplayedHubSpotPortalInfo = (
portalData: HubSpotConfigAccount
) => {
const accountIdentifier = portalData.accountId;
Expand Down Expand Up @@ -44,7 +44,7 @@ export const portalNameInvalid = (
: '';
};

export const loadHubspotConfigFile = (rootPath: string) => {
export const loadHubSpotConfigFile = (rootPath: string) => {
if (!rootPath) {
return;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ export const loadHubspotConfigFile = (rootPath: string) => {
};

export const initializeConfig = (rootPath: string) => {
const configPath = loadHubspotConfigFile(rootPath);
const configPath = loadHubSpotConfigFile(rootPath);

if (configPath) {
console.log(`configPath: ${configPath}`);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const updateHsCliToLatestVersion = async (): Promise<void> => {
).includes('@hubspot/cms-cli');
if (hsLegacyInstalled) {
const selection = await window.showWarningMessage(
'The legacy Hubspot CLI (@hubspot/cms-cli) will be removed to update. Continue?',
'The legacy HubSpot CLI (@hubspot/cms-cli) will be removed to update. Continue?',
...['Okay', 'Cancel']
);
if (!selection || selection === 'Cancel') {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
import { Environment } from '@hubspot/local-dev-lib/types/Config';

import { trackEvent } from './tracking';
import { loadHubspotConfigFile } from './config';
import { loadHubSpotConfigFile } from './config';
import { showAutoDismissedStatusBarMessage } from './statusBar';
import { COMMANDS, EVENTS, TRACKED_EVENTS } from './constants';

Expand Down Expand Up @@ -50,7 +50,7 @@ const handleAuthRequest = async (authParams: URLSearchParams) => {
const { key: personalAccessKey } = JSON.parse(personalAccessKeyResp);
const accountIdentifier = name || portalId;
let rootPath = authParams.get('rootPath') || '';
let configPath = loadHubspotConfigFile(rootPath);
let configPath = loadHubSpotConfigFile(rootPath);

// handle windows paths, which look something like /C:/Some/path
if (/^\/\w:\/.*$/.test(rootPath)) {
Expand Down
7 changes: 3 additions & 4 deletions src/providers/treeData/AccountsTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
import { HubSpotConfig } from '@hubspot/local-dev-lib/types/Config';
import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';

import { getDisplayedHubspotPortalInfo } from '../../lib/config';
import { getDisplayedHubSpotPortalInfo } from '../../lib/config';

const isDefaultAccount = (
account: HubSpotConfigAccount,
Expand Down Expand Up @@ -62,7 +61,7 @@ export class AccountsTreeDataProvider

getTreeItem(account: HubSpotConfigAccount): TreeItem {
const identifiers = getAccountIdentifiers(account);
const name = `${getDisplayedHubspotPortalInfo(account)} ${identifiers}`;
const name = `${getDisplayedHubSpotPortalInfo(account)} ${identifiers}`;
return new AccountTreeDataItem(
name,
account,
Expand Down Expand Up @@ -109,7 +108,7 @@ export class AccountTreeDataItem extends TreeItem {
options.hasAnyQAAccounts ? `Environment: ${portalData.env}\n` : ''
}${
portalData.accountType !== HUBSPOT_ACCOUNT_TYPES.STANDARD
? `Account Type: ${portalData.accountType}`
? `Account Type: ${portalData.accountType}\n`
: ''
}${
portalData.parentAccountId
Expand Down
Loading