@hubspot/local-dev-lib 3.21.2 → 4.0.0
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/defaultAccountOverride.d.ts +2 -0
- package/config/defaultAccountOverride.js +57 -0
- package/config/index.d.ts +30 -44
- package/config/index.js +332 -267
- package/config/migrate.d.ts +12 -16
- package/config/migrate.js +86 -160
- package/config/utils.d.ts +30 -0
- package/config/utils.js +373 -0
- package/constants/config.d.ts +40 -0
- package/constants/config.js +41 -1
- package/constants/environments.d.ts +0 -11
- package/constants/environments.js +1 -12
- package/errors/index.d.ts +2 -0
- package/errors/index.js +6 -1
- package/http/getAxiosConfig.js +7 -1
- package/http/index.js +23 -19
- package/lang/en.json +89 -61
- package/lib/cms/themes.js +3 -1
- package/lib/environment.d.ts +1 -1
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +8 -16
- package/lib/personalAccessKey.d.ts +2 -2
- package/lib/personalAccessKey.js +43 -30
- package/lib/trackUsage.js +6 -3
- package/models/HubSpotConfigError.d.ts +6 -0
- package/models/HubSpotConfigError.js +34 -0
- package/models/OAuth2Manager.d.ts +3 -4
- package/models/OAuth2Manager.js +20 -29
- package/package.json +5 -5
- package/types/Accounts.d.ts +20 -109
- package/types/Config.d.ts +17 -26
- package/config/CLIConfiguration.d.ts +0 -72
- package/config/CLIConfiguration.js +0 -551
- package/config/configFile.d.ts +0 -21
- package/config/configFile.js +0 -100
- package/config/configUtils.d.ts +0 -5
- package/config/configUtils.js +0 -87
- package/config/config_DEPRECATED.d.ts +0 -87
- package/config/config_DEPRECATED.js +0 -738
- package/config/environment.d.ts +0 -2
- package/config/environment.js +0 -60
- package/config/getAccountIdentifier.d.ts +0 -2
- package/config/getAccountIdentifier.js +0 -15
- package/utils/accounts.d.ts +0 -4
- package/utils/accounts.js +0 -28
package/types/Accounts.d.ts
CHANGED
|
@@ -2,45 +2,20 @@ import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
|
|
|
2
2
|
import { CmsPublishMode } from './Files';
|
|
3
3
|
import { Environment } from './Config';
|
|
4
4
|
import { ValueOf } from './Utils';
|
|
5
|
+
import { PERSONAL_ACCESS_KEY_AUTH_METHOD, OAUTH_AUTH_METHOD, API_KEY_AUTH_METHOD } from '../constants/auth';
|
|
5
6
|
export type AuthType = 'personalaccesskey' | 'apikey' | 'oauth2';
|
|
6
|
-
|
|
7
|
-
name
|
|
7
|
+
interface BaseHubSpotConfigAccount {
|
|
8
|
+
name: string;
|
|
8
9
|
accountId: number;
|
|
9
10
|
accountType?: AccountType;
|
|
10
11
|
defaultCmsPublishMode?: CmsPublishMode;
|
|
11
12
|
env: Environment;
|
|
12
|
-
authType
|
|
13
|
-
|
|
14
|
-
tokenInfo?: TokenInfo;
|
|
15
|
-
clientId?: string;
|
|
16
|
-
clientSecret?: string;
|
|
17
|
-
};
|
|
18
|
-
sandboxAccountType?: string | null;
|
|
19
|
-
parentAccountId?: number | null;
|
|
20
|
-
apiKey?: string;
|
|
21
|
-
personalAccessKey?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface CLIAccount_DEPRECATED {
|
|
24
|
-
name?: string;
|
|
25
|
-
portalId?: number;
|
|
26
|
-
defaultCmsPublishMode?: CmsPublishMode;
|
|
27
|
-
env: Environment;
|
|
28
|
-
accountType?: AccountType;
|
|
29
|
-
authType?: AuthType;
|
|
30
|
-
auth?: {
|
|
31
|
-
tokenInfo?: TokenInfo;
|
|
32
|
-
clientId?: string;
|
|
33
|
-
clientSecret?: string;
|
|
34
|
-
};
|
|
35
|
-
sandboxAccountType?: string | null;
|
|
36
|
-
parentAccountId?: number | null;
|
|
37
|
-
apiKey?: string;
|
|
38
|
-
personalAccessKey?: string;
|
|
13
|
+
authType: AuthType;
|
|
14
|
+
parentAccountId?: number;
|
|
39
15
|
}
|
|
40
|
-
export type
|
|
41
|
-
export type GenericAccount = {
|
|
16
|
+
export type DeprecatedHubSpotConfigAccountFields = {
|
|
42
17
|
portalId?: number;
|
|
43
|
-
|
|
18
|
+
sandboxAccountType?: string;
|
|
44
19
|
};
|
|
45
20
|
export type AccountType = ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
46
21
|
export type TokenInfo = {
|
|
@@ -48,60 +23,27 @@ export type TokenInfo = {
|
|
|
48
23
|
expiresAt?: string;
|
|
49
24
|
refreshToken?: string;
|
|
50
25
|
};
|
|
51
|
-
export interface
|
|
52
|
-
authType:
|
|
53
|
-
personalAccessKey: string;
|
|
54
|
-
}
|
|
55
|
-
export interface PersonalAccessKeyAccount_DEPRECATED extends CLIAccount_DEPRECATED {
|
|
56
|
-
authType: 'personalaccesskey';
|
|
26
|
+
export interface PersonalAccessKeyConfigAccount extends BaseHubSpotConfigAccount {
|
|
27
|
+
authType: typeof PERSONAL_ACCESS_KEY_AUTH_METHOD.value;
|
|
57
28
|
personalAccessKey: string;
|
|
58
|
-
}
|
|
59
|
-
export type PersonalAccessKeyAccount = PersonalAccessKeyAccount_NEW | PersonalAccessKeyAccount_DEPRECATED;
|
|
60
|
-
export interface OAuthAccount_NEW extends CLIAccount_NEW {
|
|
61
|
-
authType: 'oauth2';
|
|
62
29
|
auth: {
|
|
63
|
-
|
|
64
|
-
clientSecret?: string;
|
|
65
|
-
scopes?: Array<string>;
|
|
66
|
-
tokenInfo?: TokenInfo;
|
|
30
|
+
tokenInfo: TokenInfo;
|
|
67
31
|
};
|
|
68
32
|
}
|
|
69
|
-
export interface
|
|
70
|
-
authType:
|
|
33
|
+
export interface OAuthConfigAccount extends BaseHubSpotConfigAccount {
|
|
34
|
+
authType: typeof OAUTH_AUTH_METHOD.value;
|
|
71
35
|
auth: {
|
|
72
|
-
clientId
|
|
73
|
-
clientSecret
|
|
74
|
-
scopes
|
|
75
|
-
tokenInfo
|
|
36
|
+
clientId: string;
|
|
37
|
+
clientSecret: string;
|
|
38
|
+
scopes: Array<string>;
|
|
39
|
+
tokenInfo: TokenInfo;
|
|
76
40
|
};
|
|
77
41
|
}
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
authType: 'apikey';
|
|
42
|
+
export interface APIKeyConfigAccount extends BaseHubSpotConfigAccount {
|
|
43
|
+
authType: typeof API_KEY_AUTH_METHOD.value;
|
|
81
44
|
apiKey: string;
|
|
82
45
|
}
|
|
83
|
-
export
|
|
84
|
-
authType: 'apikey';
|
|
85
|
-
apiKey: string;
|
|
86
|
-
}
|
|
87
|
-
export type APIKeyAccount = APIKeyAccount_NEW | APIKeyAccount_DEPRECATED;
|
|
88
|
-
export interface FlatAccountFields_NEW extends CLIAccount_NEW {
|
|
89
|
-
tokenInfo?: TokenInfo;
|
|
90
|
-
clientId?: string;
|
|
91
|
-
clientSecret?: string;
|
|
92
|
-
scopes?: Array<string>;
|
|
93
|
-
apiKey?: string;
|
|
94
|
-
personalAccessKey?: string;
|
|
95
|
-
}
|
|
96
|
-
export interface FlatAccountFields_DEPRECATED extends CLIAccount_DEPRECATED {
|
|
97
|
-
tokenInfo?: TokenInfo;
|
|
98
|
-
clientId?: string;
|
|
99
|
-
clientSecret?: string;
|
|
100
|
-
scopes?: Array<string>;
|
|
101
|
-
apiKey?: string;
|
|
102
|
-
personalAccessKey?: string;
|
|
103
|
-
}
|
|
104
|
-
export type FlatAccountFields = FlatAccountFields_NEW | FlatAccountFields_DEPRECATED;
|
|
46
|
+
export type HubSpotConfigAccount = PersonalAccessKeyConfigAccount | OAuthConfigAccount | APIKeyConfigAccount;
|
|
105
47
|
export type ScopeData = {
|
|
106
48
|
portalScopesInGroup: Array<string>;
|
|
107
49
|
userScopesInGroup: Array<string>;
|
|
@@ -137,27 +79,6 @@ export type EnabledFeaturesResponse = {
|
|
|
137
79
|
[key: string]: boolean;
|
|
138
80
|
};
|
|
139
81
|
};
|
|
140
|
-
export type UpdateAccountConfigOptions = Partial<FlatAccountFields_DEPRECATED> & {
|
|
141
|
-
environment?: Environment;
|
|
142
|
-
};
|
|
143
|
-
export type PersonalAccessKeyOptions = {
|
|
144
|
-
accountId: number;
|
|
145
|
-
personalAccessKey: string;
|
|
146
|
-
env: Environment;
|
|
147
|
-
};
|
|
148
|
-
export type OAuthOptions = {
|
|
149
|
-
accountId: number;
|
|
150
|
-
clientId: string;
|
|
151
|
-
clientSecret: string;
|
|
152
|
-
refreshToken: string;
|
|
153
|
-
scopes: Array<string>;
|
|
154
|
-
env: Environment;
|
|
155
|
-
};
|
|
156
|
-
export type APIKeyOptions = {
|
|
157
|
-
accountId: number;
|
|
158
|
-
apiKey: string;
|
|
159
|
-
env: Environment;
|
|
160
|
-
};
|
|
161
82
|
export type AccessToken = {
|
|
162
83
|
portalId: number;
|
|
163
84
|
accessToken: string;
|
|
@@ -170,17 +91,6 @@ export type AccessToken = {
|
|
|
170
91
|
hubName: string;
|
|
171
92
|
accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
172
93
|
};
|
|
173
|
-
export type OAuth2ManagerAccountConfig = {
|
|
174
|
-
name?: string;
|
|
175
|
-
accountId?: number;
|
|
176
|
-
clientId?: string;
|
|
177
|
-
clientSecret?: string;
|
|
178
|
-
scopes?: Array<string>;
|
|
179
|
-
env?: Environment;
|
|
180
|
-
environment?: Environment;
|
|
181
|
-
tokenInfo?: TokenInfo;
|
|
182
|
-
authType?: 'oauth2';
|
|
183
|
-
};
|
|
184
94
|
export type WriteTokenInfoFunction = (tokenInfo: TokenInfo) => void;
|
|
185
95
|
export type RefreshTokenResponse = {
|
|
186
96
|
refresh_token: string;
|
|
@@ -193,3 +103,4 @@ export type ExchangeProof = {
|
|
|
193
103
|
client_secret?: string;
|
|
194
104
|
refresh_token?: string;
|
|
195
105
|
};
|
|
106
|
+
export {};
|
package/types/Config.d.ts
CHANGED
|
@@ -1,49 +1,40 @@
|
|
|
1
|
+
import { CONFIG_FLAGS, HUBSPOT_CONFIG_ERROR_TYPES, HUBSPOT_CONFIG_OPERATIONS } from '../constants/config';
|
|
1
2
|
import { ENVIRONMENTS } from '../constants/environments';
|
|
2
|
-
import {
|
|
3
|
+
import { DeprecatedHubSpotConfigAccountFields, HubSpotConfigAccount } from './Accounts';
|
|
3
4
|
import { CmsPublishMode } from './Files';
|
|
4
5
|
import { ValueOf } from './Utils';
|
|
5
|
-
export interface
|
|
6
|
-
accounts
|
|
6
|
+
export interface HubSpotConfig {
|
|
7
|
+
accounts: Array<HubSpotConfigAccount>;
|
|
7
8
|
allowUsageTracking?: boolean;
|
|
8
9
|
allowAutoUpdates?: boolean;
|
|
9
|
-
defaultAccount?:
|
|
10
|
+
defaultAccount?: number;
|
|
10
11
|
defaultMode?: CmsPublishMode;
|
|
11
12
|
defaultCmsPublishMode?: CmsPublishMode;
|
|
12
13
|
httpTimeout?: number;
|
|
13
14
|
env?: Environment;
|
|
14
15
|
httpUseLocalhost?: boolean;
|
|
15
16
|
autoOpenBrowser?: boolean;
|
|
17
|
+
useCustomObjectHubfile?: boolean;
|
|
16
18
|
flags?: Array<string>;
|
|
17
19
|
}
|
|
18
|
-
export
|
|
19
|
-
portals
|
|
20
|
-
|
|
21
|
-
allowAutoUpdates?: boolean;
|
|
22
|
-
defaultPortal?: string | number;
|
|
20
|
+
export type DeprecatedHubSpotConfigFields = {
|
|
21
|
+
portals?: Array<HubSpotConfigAccount & DeprecatedHubSpotConfigAccountFields>;
|
|
22
|
+
defaultPortal?: string;
|
|
23
23
|
defaultMode?: CmsPublishMode;
|
|
24
|
-
defaultCmsPublishMode?: CmsPublishMode;
|
|
25
|
-
httpTimeout?: number;
|
|
26
|
-
env?: Environment;
|
|
27
|
-
httpUseLocalhost?: boolean;
|
|
28
|
-
autoOpenBrowser?: boolean;
|
|
29
|
-
flags?: Array<string>;
|
|
30
|
-
}
|
|
31
|
-
export type CLIConfig = CLIConfig_NEW | CLIConfig_DEPRECATED;
|
|
32
|
-
export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
|
|
33
|
-
export type EnvironmentConfigVariables = {
|
|
34
|
-
apiKey?: string;
|
|
35
|
-
clientId?: string;
|
|
36
|
-
clientSecret?: string;
|
|
37
|
-
personalAccessKey?: string;
|
|
38
|
-
accountId?: number;
|
|
39
|
-
refreshToken?: string;
|
|
40
|
-
env?: Environment;
|
|
41
24
|
};
|
|
25
|
+
export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
|
|
42
26
|
export type GitInclusionResult = {
|
|
43
27
|
inGit: boolean;
|
|
44
28
|
configIgnored: boolean;
|
|
45
29
|
gitignoreFiles: Array<string>;
|
|
46
30
|
};
|
|
31
|
+
export type ConfigFlag = ValueOf<typeof CONFIG_FLAGS>;
|
|
47
32
|
export type HubSpotState = {
|
|
48
33
|
mcpTotalToolCalls: number;
|
|
49
34
|
};
|
|
35
|
+
export type HubSpotConfigErrorType = ValueOf<typeof HUBSPOT_CONFIG_ERROR_TYPES>;
|
|
36
|
+
export type HubSpotConfigOperation = ValueOf<typeof HUBSPOT_CONFIG_OPERATIONS>;
|
|
37
|
+
export type HubSpotConfigValidationResult = {
|
|
38
|
+
isValid: boolean;
|
|
39
|
+
errors: Array<string>;
|
|
40
|
+
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { CLIConfig_NEW, Environment } from '../types/Config';
|
|
2
|
-
import { CLIAccount_NEW, FlatAccountFields_NEW, AccountType } from '../types/Accounts';
|
|
3
|
-
import { CLIOptions } from '../types/CLIOptions';
|
|
4
|
-
import { CmsPublishMode } from '../types/Files';
|
|
5
|
-
declare class _CLIConfiguration {
|
|
6
|
-
options: CLIOptions;
|
|
7
|
-
useEnvConfig: boolean;
|
|
8
|
-
config: CLIConfig_NEW | null;
|
|
9
|
-
active: boolean;
|
|
10
|
-
constructor();
|
|
11
|
-
setActive(isActive: boolean): void;
|
|
12
|
-
isActive(): boolean;
|
|
13
|
-
init(options?: CLIOptions): CLIConfig_NEW | null;
|
|
14
|
-
load(): CLIConfig_NEW | null;
|
|
15
|
-
configIsEmpty(): boolean;
|
|
16
|
-
delete(): void;
|
|
17
|
-
write(updatedConfig?: CLIConfig_NEW): CLIConfig_NEW | null;
|
|
18
|
-
validate(): boolean;
|
|
19
|
-
getAccount(nameOrId: string | number | undefined): CLIAccount_NEW | null;
|
|
20
|
-
isConfigFlagEnabled(flag: keyof CLIConfig_NEW, defaultValue?: boolean): boolean;
|
|
21
|
-
getAccountId(nameOrId?: string | number): number | null;
|
|
22
|
-
getDefaultAccount(): string | number | null;
|
|
23
|
-
getDefaultAccountOverrideFilePath(): string | null;
|
|
24
|
-
getCWDAccountOverride(): string | number | null;
|
|
25
|
-
getAccountIndex(accountId: number): number;
|
|
26
|
-
getConfigAccounts(): Array<CLIAccount_NEW> | null;
|
|
27
|
-
isAccountInConfig(nameOrId: string | number): boolean;
|
|
28
|
-
getAndLoadConfigIfNeeded(options?: CLIOptions): CLIConfig_NEW;
|
|
29
|
-
getEnv(nameOrId?: string | number): Environment;
|
|
30
|
-
getAccountType(accountType?: AccountType | null, sandboxAccountType?: string | null): AccountType;
|
|
31
|
-
/**
|
|
32
|
-
* @throws {Error}
|
|
33
|
-
*/
|
|
34
|
-
addOrUpdateAccount(updatedAccountFields: Partial<FlatAccountFields_NEW>, writeUpdate?: boolean): FlatAccountFields_NEW | null;
|
|
35
|
-
/**
|
|
36
|
-
* @throws {Error}
|
|
37
|
-
*/
|
|
38
|
-
updateDefaultAccount(defaultAccount: string | number): CLIConfig_NEW | null;
|
|
39
|
-
/**
|
|
40
|
-
* @throws {Error}
|
|
41
|
-
*/
|
|
42
|
-
renameAccount(currentName: string, newName: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* @throws {Error}
|
|
45
|
-
* TODO: this does not account for the special handling of sandbox account deletes
|
|
46
|
-
*/
|
|
47
|
-
removeAccountFromConfig(nameOrId: string | number): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* @throws {Error}
|
|
50
|
-
*/
|
|
51
|
-
updateDefaultCmsPublishMode(defaultCmsPublishMode: CmsPublishMode): CLIConfig_NEW | null;
|
|
52
|
-
/**
|
|
53
|
-
* @throws {Error}
|
|
54
|
-
*/
|
|
55
|
-
updateHttpTimeout(timeout: string): CLIConfig_NEW | null;
|
|
56
|
-
/**
|
|
57
|
-
* @throws {Error}
|
|
58
|
-
*/
|
|
59
|
-
updateAllowAutoUpdates(enabled: boolean): CLIConfig_NEW | null;
|
|
60
|
-
/**
|
|
61
|
-
* @throws {Error}
|
|
62
|
-
*/
|
|
63
|
-
updateAllowUsageTracking(isEnabled: boolean): CLIConfig_NEW | null;
|
|
64
|
-
updateAutoOpenBrowser(isEnabled: boolean): CLIConfig_NEW | null;
|
|
65
|
-
isTrackingAllowed(): boolean;
|
|
66
|
-
handleLegacyCmsPublishMode(config: CLIConfig_NEW | null): CLIConfig_NEW | null;
|
|
67
|
-
hasLocalStateFlag(flag: string): boolean;
|
|
68
|
-
addLocalStateFlag(flag: string): void;
|
|
69
|
-
removeLocalStateFlag(flag: string): void;
|
|
70
|
-
}
|
|
71
|
-
export declare const CLIConfiguration: _CLIConfiguration;
|
|
72
|
-
export {};
|