@hubspot/local-dev-lib 3.21.1-beta.0 → 3.21.1-beta.2
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/config/CLIConfiguration.js +11 -8
- package/config/configUtils.js +2 -2
- package/config/state.js +2 -1
- package/constants/config.d.ts +1 -0
- package/constants/config.js +2 -1
- package/package.json +1 -1
- package/types/Config.d.ts +1 -1
- package/utils/accounts.js +2 -2
|
@@ -46,7 +46,7 @@ class _CLIConfiguration {
|
|
|
46
46
|
const configFromEnv = (0, environment_1.loadConfigFromEnvironment)();
|
|
47
47
|
if (configFromEnv) {
|
|
48
48
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.load.configFromEnv`, {
|
|
49
|
-
accountId: configFromEnv.accounts[0].accountId
|
|
49
|
+
accountId: `${configFromEnv.accounts?.[0].accountId}`,
|
|
50
50
|
}));
|
|
51
51
|
this.useEnvConfig = true;
|
|
52
52
|
this.config = this.handleLegacyCmsPublishMode(configFromEnv);
|
|
@@ -168,11 +168,11 @@ class _CLIConfiguration {
|
|
|
168
168
|
}
|
|
169
169
|
let account = null;
|
|
170
170
|
if (name) {
|
|
171
|
-
account = this.config.accounts
|
|
171
|
+
account = this.config.accounts?.find(a => a.name === name) || null;
|
|
172
172
|
}
|
|
173
173
|
if (accountId && !account) {
|
|
174
174
|
account =
|
|
175
|
-
this.config.accounts
|
|
175
|
+
this.config.accounts?.find(a => accountId === a.accountId) || null;
|
|
176
176
|
}
|
|
177
177
|
return account;
|
|
178
178
|
}
|
|
@@ -230,7 +230,7 @@ class _CLIConfiguration {
|
|
|
230
230
|
return account.name || account.accountId;
|
|
231
231
|
}
|
|
232
232
|
getAccountIndex(accountId) {
|
|
233
|
-
return this.config
|
|
233
|
+
return this.config && Array.isArray(this.config.accounts)
|
|
234
234
|
? this.config.accounts.findIndex(account => account.accountId === accountId)
|
|
235
235
|
: -1;
|
|
236
236
|
}
|
|
@@ -243,10 +243,10 @@ class _CLIConfiguration {
|
|
|
243
243
|
isAccountInConfig(nameOrId) {
|
|
244
244
|
if (typeof nameOrId === 'string') {
|
|
245
245
|
return (!!this.config &&
|
|
246
|
-
this.config.accounts &&
|
|
246
|
+
!!this.config.accounts &&
|
|
247
247
|
!!this.getAccountId(nameOrId.toLowerCase()));
|
|
248
248
|
}
|
|
249
|
-
return (!!this.config && this.config.accounts && !!this.getAccountId(nameOrId));
|
|
249
|
+
return (!!this.config && !!this.config.accounts && !!this.getAccountId(nameOrId));
|
|
250
250
|
}
|
|
251
251
|
getAndLoadConfigIfNeeded(options) {
|
|
252
252
|
if (!this.config) {
|
|
@@ -341,7 +341,7 @@ class _CLIConfiguration {
|
|
|
341
341
|
safelyApplyUpdates('accountType', this.getAccountType(updatedAccountType, sandboxAccountType));
|
|
342
342
|
safelyApplyUpdates('parentAccountId', parentAccountId);
|
|
343
343
|
const completedAccountConfig = nextAccountConfig;
|
|
344
|
-
if (!
|
|
344
|
+
if (!Array.isArray(this.config.accounts)) {
|
|
345
345
|
this.config.accounts = [];
|
|
346
346
|
}
|
|
347
347
|
if (currentAccountConfig) {
|
|
@@ -429,7 +429,10 @@ class _CLIConfiguration {
|
|
|
429
429
|
if (accountConfig) {
|
|
430
430
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.removeAccountFromConfig.deleting`, { accountId }));
|
|
431
431
|
const index = this.getAccountIndex(accountId);
|
|
432
|
-
|
|
432
|
+
if (index === -1) {
|
|
433
|
+
return removedAccountIsDefault;
|
|
434
|
+
}
|
|
435
|
+
this.config.accounts?.splice(index, 1);
|
|
433
436
|
if (this.getDefaultAccount() === accountConfig.name) {
|
|
434
437
|
removedAccountIsDefault = true;
|
|
435
438
|
}
|
package/config/configUtils.js
CHANGED
|
@@ -24,7 +24,7 @@ function getOrderedConfig(unorderedConfig) {
|
|
|
24
24
|
httpTimeout,
|
|
25
25
|
allowUsageTracking,
|
|
26
26
|
...rest,
|
|
27
|
-
accounts: accounts
|
|
27
|
+
accounts: accounts?.map(getOrderedAccount) || [],
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
exports.getOrderedConfig = getOrderedConfig;
|
|
@@ -80,7 +80,7 @@ function generateConfig(type, options) {
|
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
82
|
if (configAccount) {
|
|
83
|
-
config.accounts
|
|
83
|
+
config.accounts?.push(configAccount);
|
|
84
84
|
}
|
|
85
85
|
return config;
|
|
86
86
|
}
|
package/config/state.js
CHANGED
|
@@ -29,9 +29,10 @@ const path = __importStar(require("path"));
|
|
|
29
29
|
const lang_1 = require("../utils/lang");
|
|
30
30
|
const config_1 = require("../constants/config");
|
|
31
31
|
const logger_1 = require("../lib/logger");
|
|
32
|
+
const config_2 = require("../constants/config");
|
|
32
33
|
const i18nKey = 'config.state';
|
|
33
34
|
const DEFAULT_STATE = {
|
|
34
|
-
|
|
35
|
+
[config_2.MCP_TOTAL_TOOL_CALLS_STATE]: 0,
|
|
35
36
|
};
|
|
36
37
|
function ensureCLIDirectory() {
|
|
37
38
|
try {
|
package/constants/config.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const ALLOW_AUTO_UPDATES = "allowAutoUpdates";
|
|
|
18
18
|
export declare const DEFAULT_ACCOUNT = "defaultAccount";
|
|
19
19
|
export declare const DEFAULT_PORTAL = "defaultPortal";
|
|
20
20
|
export declare const MIN_HTTP_TIMEOUT = 3000;
|
|
21
|
+
export declare const MCP_TOTAL_TOOL_CALLS_STATE = "mcpTotalToolCalls";
|
|
21
22
|
export declare const HUBSPOT_ACCOUNT_TYPES: {
|
|
22
23
|
readonly DEVELOPMENT_SANDBOX: "DEVELOPMENT_SANDBOX";
|
|
23
24
|
readonly DEVELOPER_TEST: "DEVELOPER_TEST";
|
package/constants/config.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HUBSPOT_ACCOUNT_TYPE_STRINGS = exports.HUBSPOT_ACCOUNT_TYPES = exports.MIN_HTTP_TIMEOUT = exports.DEFAULT_PORTAL = exports.DEFAULT_ACCOUNT = exports.ALLOW_AUTO_UPDATES = exports.AUTO_OPEN_BROWSER = exports.ALLOW_USAGE_TRACKING = exports.HTTP_USE_LOCALHOST = exports.ENV = exports.HTTP_TIMEOUT = exports.DEFAULT_CMS_PUBLISH_MODE = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID = exports.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME = exports.STATE_FILE_PATH = exports.GLOBAL_CONFIG_PATH = exports.HUBSPOT_STATE_FILE = exports.HUBSPOT_CONFIGURATION_FILE = exports.HUBSPOT_CONFIGURATION_FOLDER = exports.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME = exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = void 0;
|
|
6
|
+
exports.HUBSPOT_ACCOUNT_TYPE_STRINGS = exports.HUBSPOT_ACCOUNT_TYPES = exports.MCP_TOTAL_TOOL_CALLS_STATE = exports.MIN_HTTP_TIMEOUT = exports.DEFAULT_PORTAL = exports.DEFAULT_ACCOUNT = exports.ALLOW_AUTO_UPDATES = exports.AUTO_OPEN_BROWSER = exports.ALLOW_USAGE_TRACKING = exports.HTTP_USE_LOCALHOST = exports.ENV = exports.HTTP_TIMEOUT = exports.DEFAULT_CMS_PUBLISH_MODE = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID = exports.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME = exports.STATE_FILE_PATH = exports.GLOBAL_CONFIG_PATH = exports.HUBSPOT_STATE_FILE = exports.HUBSPOT_CONFIGURATION_FILE = exports.HUBSPOT_CONFIGURATION_FOLDER = exports.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME = exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = void 0;
|
|
7
7
|
const lang_1 = require("../utils/lang");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
@@ -27,6 +27,7 @@ exports.ALLOW_AUTO_UPDATES = 'allowAutoUpdates';
|
|
|
27
27
|
exports.DEFAULT_ACCOUNT = 'defaultAccount';
|
|
28
28
|
exports.DEFAULT_PORTAL = 'defaultPortal';
|
|
29
29
|
exports.MIN_HTTP_TIMEOUT = 3000;
|
|
30
|
+
exports.MCP_TOTAL_TOOL_CALLS_STATE = 'mcpTotalToolCalls';
|
|
30
31
|
exports.HUBSPOT_ACCOUNT_TYPES = {
|
|
31
32
|
DEVELOPMENT_SANDBOX: 'DEVELOPMENT_SANDBOX',
|
|
32
33
|
DEVELOPER_TEST: 'DEVELOPER_TEST',
|
package/package.json
CHANGED
package/types/Config.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CLIAccount_NEW, CLIAccount_DEPRECATED } from './Accounts';
|
|
|
3
3
|
import { CmsPublishMode } from './Files';
|
|
4
4
|
import { ValueOf } from './Utils';
|
|
5
5
|
export interface CLIConfig_NEW {
|
|
6
|
-
accounts
|
|
6
|
+
accounts?: Array<CLIAccount_NEW>;
|
|
7
7
|
allowUsageTracking?: boolean;
|
|
8
8
|
allowAutoUpdates?: boolean;
|
|
9
9
|
defaultAccount?: string | number;
|
package/utils/accounts.js
CHANGED
|
@@ -5,10 +5,10 @@ function getAccounts(config) {
|
|
|
5
5
|
if (!config) {
|
|
6
6
|
return [];
|
|
7
7
|
}
|
|
8
|
-
else if (
|
|
8
|
+
else if ('portals' in config && Array.isArray(config.portals)) {
|
|
9
9
|
return config.portals;
|
|
10
10
|
}
|
|
11
|
-
else if (
|
|
11
|
+
else if ('accounts' in config && Array.isArray(config.accounts)) {
|
|
12
12
|
return config.accounts;
|
|
13
13
|
}
|
|
14
14
|
return [];
|