@hubspot/local-dev-lib 5.3.2 → 5.3.3
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/state.js +7 -9
- package/constants/config.d.ts +1 -0
- package/constants/config.js +1 -0
- package/lib/logger.d.ts +1 -0
- package/lib/logger.js +14 -4
- package/package.json +1 -1
- package/types/Config.d.ts +3 -2
- package/types/Config.js +1 -1
package/config/state.js
CHANGED
|
@@ -7,6 +7,7 @@ import { STATE_FLAGS } from '../constants/config.js';
|
|
|
7
7
|
const i18nKey = 'config.state';
|
|
8
8
|
const DEFAULT_STATE = {
|
|
9
9
|
[STATE_FLAGS.MCP_TOTAL_TOOL_CALLS]: 0,
|
|
10
|
+
[STATE_FLAGS.USAGE_TRACKING_MESSAGE_LAST_SHOW_VERSION]: undefined,
|
|
10
11
|
};
|
|
11
12
|
function ensureCLIDirectory() {
|
|
12
13
|
try {
|
|
@@ -21,19 +22,16 @@ function ensureCLIDirectory() {
|
|
|
21
22
|
}));
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function parseState(parsed) {
|
|
25
26
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
26
27
|
return structuredClone(DEFAULT_STATE);
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
+
const record = parsed;
|
|
29
30
|
const result = structuredClone(DEFAULT_STATE);
|
|
30
|
-
for (const key
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
typeof state[typedKey] === typeof DEFAULT_STATE[typedKey]) {
|
|
34
|
-
result[typedKey] = state[typedKey];
|
|
31
|
+
for (const key of Object.keys(DEFAULT_STATE)) {
|
|
32
|
+
if (key in record && record[key] !== undefined) {
|
|
33
|
+
Object.assign(result, { [key]: record[key] });
|
|
35
34
|
}
|
|
36
|
-
// keys not in parsed file remain as DEFAULT values
|
|
37
35
|
}
|
|
38
36
|
return result;
|
|
39
37
|
}
|
|
@@ -48,7 +46,7 @@ function getCurrentState() {
|
|
|
48
46
|
return structuredClone(DEFAULT_STATE);
|
|
49
47
|
}
|
|
50
48
|
const parsed = JSON.parse(data);
|
|
51
|
-
return
|
|
49
|
+
return parseState(parsed);
|
|
52
50
|
}
|
|
53
51
|
catch (error) {
|
|
54
52
|
logger.debug(i18n(`${i18nKey}.getCurrentState.errors.errorReading`, {
|
package/constants/config.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export declare const HUBSPOT_ACCOUNT_TYPE_STRINGS: {
|
|
|
56
56
|
};
|
|
57
57
|
export declare const STATE_FLAGS: {
|
|
58
58
|
readonly MCP_TOTAL_TOOL_CALLS: "mcpTotalToolCalls";
|
|
59
|
+
readonly USAGE_TRACKING_MESSAGE_LAST_SHOW_VERSION: "usageTrackingMessageLastShowVersion";
|
|
59
60
|
};
|
|
60
61
|
export declare const CONFIG_FLAGS: {
|
|
61
62
|
readonly DEFAULT_CMS_PUBLISH_MODE: "defaultCmsPublishMode";
|
package/constants/config.js
CHANGED
|
@@ -59,6 +59,7 @@ export const HUBSPOT_ACCOUNT_TYPE_STRINGS = {
|
|
|
59
59
|
};
|
|
60
60
|
export const STATE_FLAGS = {
|
|
61
61
|
MCP_TOTAL_TOOL_CALLS: 'mcpTotalToolCalls',
|
|
62
|
+
USAGE_TRACKING_MESSAGE_LAST_SHOW_VERSION: 'usageTrackingMessageLastShowVersion',
|
|
62
63
|
};
|
|
63
64
|
export const CONFIG_FLAGS = {
|
|
64
65
|
DEFAULT_CMS_PUBLISH_MODE: 'defaultCmsPublishMode',
|
package/lib/logger.d.ts
CHANGED
package/lib/logger.js
CHANGED
|
@@ -13,7 +13,14 @@ const UNICODE_LABELS = {
|
|
|
13
13
|
warning: '⚠ WARNING',
|
|
14
14
|
error: '✖ ERROR',
|
|
15
15
|
info: 'ℹ INFO',
|
|
16
|
-
debug: 'DEBUG',
|
|
16
|
+
debug: '⚙ DEBUG',
|
|
17
|
+
};
|
|
18
|
+
const UNICODE_SYMBOLS = {
|
|
19
|
+
success: '✔',
|
|
20
|
+
warning: '⚠',
|
|
21
|
+
error: '✖',
|
|
22
|
+
info: 'ℹ',
|
|
23
|
+
debug: '⚙',
|
|
17
24
|
};
|
|
18
25
|
const ASCII_LABELS = {
|
|
19
26
|
success: '[SUCCESS]',
|
|
@@ -25,14 +32,17 @@ const ASCII_LABELS = {
|
|
|
25
32
|
export function getLabels() {
|
|
26
33
|
return isUnicodeSupported() ? UNICODE_LABELS : ASCII_LABELS;
|
|
27
34
|
}
|
|
35
|
+
export function getSymbols() {
|
|
36
|
+
return isUnicodeSupported() ? UNICODE_SYMBOLS : ASCII_LABELS;
|
|
37
|
+
}
|
|
28
38
|
/**
|
|
29
39
|
* Chalk styles for logger strings.
|
|
30
40
|
*/
|
|
31
41
|
export const Styles = {
|
|
32
|
-
debug: chalk.reset.
|
|
42
|
+
debug: chalk.reset.grey,
|
|
33
43
|
log: chalk.reset.white,
|
|
34
44
|
success: chalk.reset.green,
|
|
35
|
-
info: chalk.reset.
|
|
45
|
+
info: chalk.reset.blue,
|
|
36
46
|
warn: chalk.reset.yellow,
|
|
37
47
|
error: chalk.reset.red,
|
|
38
48
|
};
|
|
@@ -66,7 +76,7 @@ export class Logger {
|
|
|
66
76
|
}
|
|
67
77
|
debug(...args) {
|
|
68
78
|
const labels = getLabels();
|
|
69
|
-
console.debug(...stylize(labels.debug, Styles.
|
|
79
|
+
console.debug(...stylize(labels.debug, Styles.debug, args));
|
|
70
80
|
}
|
|
71
81
|
group(...args) {
|
|
72
82
|
console.group(...args);
|
package/package.json
CHANGED
package/types/Config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONFIG_FLAGS, HUBSPOT_CONFIG_ERROR_TYPES, HUBSPOT_CONFIG_OPERATIONS } from '../constants/config.js';
|
|
1
|
+
import { CONFIG_FLAGS, HUBSPOT_CONFIG_ERROR_TYPES, HUBSPOT_CONFIG_OPERATIONS, STATE_FLAGS } from '../constants/config.js';
|
|
2
2
|
import { DeprecatedHubSpotConfigAccountFields, Environment, HubSpotConfigAccount } from './Accounts.js';
|
|
3
3
|
import { CmsPublishMode } from './Files.js';
|
|
4
4
|
import { ValueOf } from './Utils.js';
|
|
@@ -28,7 +28,8 @@ export type GitInclusionResult = {
|
|
|
28
28
|
};
|
|
29
29
|
export type ConfigFlag = ValueOf<typeof CONFIG_FLAGS>;
|
|
30
30
|
export type HubSpotState = {
|
|
31
|
-
|
|
31
|
+
[STATE_FLAGS.MCP_TOTAL_TOOL_CALLS]: number;
|
|
32
|
+
[STATE_FLAGS.USAGE_TRACKING_MESSAGE_LAST_SHOW_VERSION]?: string;
|
|
32
33
|
};
|
|
33
34
|
export type HubSpotConfigErrorType = ValueOf<typeof HUBSPOT_CONFIG_ERROR_TYPES>;
|
|
34
35
|
export type HubSpotConfigOperation = ValueOf<typeof HUBSPOT_CONFIG_OPERATIONS>;
|
package/types/Config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { STATE_FLAGS, } from '../constants/config.js';
|