@hubspot/local-dev-lib 3.21.2 → 4.0.0-beta.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/config/configUtils.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateConfig = exports.getOrderedConfig = exports.getOrderedAccount = void 0;
|
|
4
|
-
const logger_1 = require("../lib/logger");
|
|
5
|
-
const auth_1 = require("../constants/auth");
|
|
6
|
-
const lang_1 = require("../utils/lang");
|
|
7
|
-
const i18nKey = 'config.configUtils';
|
|
8
|
-
function getOrderedAccount(unorderedAccount) {
|
|
9
|
-
const { name, accountId, env, authType, ...rest } = unorderedAccount;
|
|
10
|
-
return {
|
|
11
|
-
name,
|
|
12
|
-
accountId,
|
|
13
|
-
env,
|
|
14
|
-
authType,
|
|
15
|
-
...rest,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.getOrderedAccount = getOrderedAccount;
|
|
19
|
-
function getOrderedConfig(unorderedConfig) {
|
|
20
|
-
const { defaultAccount, defaultCmsPublishMode, httpTimeout, allowUsageTracking, accounts, ...rest } = unorderedConfig;
|
|
21
|
-
return {
|
|
22
|
-
...(defaultAccount && { defaultAccount }),
|
|
23
|
-
defaultCmsPublishMode,
|
|
24
|
-
httpTimeout,
|
|
25
|
-
allowUsageTracking,
|
|
26
|
-
...rest,
|
|
27
|
-
accounts: accounts?.map(getOrderedAccount) || [],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.getOrderedConfig = getOrderedConfig;
|
|
31
|
-
function generatePersonalAccessKeyAccountConfig({ accountId, personalAccessKey, env, }) {
|
|
32
|
-
return {
|
|
33
|
-
authType: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
34
|
-
accountId,
|
|
35
|
-
personalAccessKey,
|
|
36
|
-
env,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function generateOauthAccountConfig({ accountId, clientId, clientSecret, refreshToken, scopes, env, }) {
|
|
40
|
-
return {
|
|
41
|
-
authType: auth_1.OAUTH_AUTH_METHOD.value,
|
|
42
|
-
accountId,
|
|
43
|
-
auth: {
|
|
44
|
-
clientId,
|
|
45
|
-
clientSecret,
|
|
46
|
-
scopes,
|
|
47
|
-
tokenInfo: {
|
|
48
|
-
refreshToken,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
env,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function generateApiKeyAccountConfig({ accountId, apiKey, env, }) {
|
|
55
|
-
return {
|
|
56
|
-
authType: auth_1.API_KEY_AUTH_METHOD.value,
|
|
57
|
-
accountId,
|
|
58
|
-
apiKey,
|
|
59
|
-
env,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function generateConfig(type, options) {
|
|
63
|
-
if (!options) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const config = { accounts: [] };
|
|
67
|
-
let configAccount;
|
|
68
|
-
switch (type) {
|
|
69
|
-
case auth_1.API_KEY_AUTH_METHOD.value:
|
|
70
|
-
configAccount = generateApiKeyAccountConfig(options);
|
|
71
|
-
break;
|
|
72
|
-
case auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value:
|
|
73
|
-
configAccount = generatePersonalAccessKeyAccountConfig(options);
|
|
74
|
-
break;
|
|
75
|
-
case auth_1.OAUTH_AUTH_METHOD.value:
|
|
76
|
-
configAccount = generateOauthAccountConfig(options);
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.unknownType`, { type }));
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
if (configAccount) {
|
|
83
|
-
config.accounts?.push(configAccount);
|
|
84
|
-
}
|
|
85
|
-
return config;
|
|
86
|
-
}
|
|
87
|
-
exports.generateConfig = generateConfig;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { CLIConfig_DEPRECATED, Environment } from '../types/Config';
|
|
2
|
-
import { AccountType, CLIAccount_DEPRECATED, FlatAccountFields_DEPRECATED, UpdateAccountConfigOptions } from '../types/Accounts';
|
|
3
|
-
import { CmsPublishMode } from '../types/Files';
|
|
4
|
-
import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
|
|
5
|
-
export declare const getConfig: () => CLIConfig_DEPRECATED | null;
|
|
6
|
-
export declare function setConfig(updatedConfig?: CLIConfig_DEPRECATED): CLIConfig_DEPRECATED | null;
|
|
7
|
-
export declare function getConfigAccounts(config?: CLIConfig_DEPRECATED): Array<CLIAccount_DEPRECATED> | undefined;
|
|
8
|
-
export declare function getConfigDefaultAccount(config?: CLIConfig_DEPRECATED): string | number | undefined;
|
|
9
|
-
export declare function getConfigAccountId(account: CLIAccount_DEPRECATED): number | undefined;
|
|
10
|
-
export declare function setConfigPath(path: string | null): string | null;
|
|
11
|
-
export declare function getConfigPath(path?: string | null): string | null;
|
|
12
|
-
export declare function validateConfig(): boolean;
|
|
13
|
-
export declare function accountNameExistsInConfig(name: string): boolean;
|
|
14
|
-
export declare function getOrderedAccount(unorderedAccount: CLIAccount_DEPRECATED): CLIAccount_DEPRECATED;
|
|
15
|
-
export declare function getOrderedConfig(unorderedConfig: CLIConfig_DEPRECATED): {
|
|
16
|
-
portals: CLIAccount_DEPRECATED[];
|
|
17
|
-
allowAutoUpdates?: boolean | undefined;
|
|
18
|
-
defaultMode?: CmsPublishMode | undefined;
|
|
19
|
-
env?: Environment | undefined;
|
|
20
|
-
httpUseLocalhost?: boolean | undefined;
|
|
21
|
-
autoOpenBrowser?: boolean | undefined;
|
|
22
|
-
flags?: string[] | undefined;
|
|
23
|
-
defaultCmsPublishMode: CmsPublishMode | undefined;
|
|
24
|
-
httpTimeout: number | undefined;
|
|
25
|
-
allowUsageTracking: boolean | undefined;
|
|
26
|
-
defaultPortal?: string | number | undefined;
|
|
27
|
-
};
|
|
28
|
-
export declare function writeConfig(options?: WriteConfigOptions): void;
|
|
29
|
-
export declare function loadConfig(path?: string, options?: CLIOptions): CLIConfig_DEPRECATED | null;
|
|
30
|
-
export declare function isTrackingAllowed(): boolean;
|
|
31
|
-
export declare function getAndLoadConfigIfNeeded(options?: {}): Partial<CLIConfig_DEPRECATED>;
|
|
32
|
-
export declare function findConfig(directory: string): string | null;
|
|
33
|
-
export declare function getEnv(nameOrId?: string | number): Environment;
|
|
34
|
-
export declare function getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
|
|
35
|
-
export declare function getAccountConfig(accountId: number | undefined): CLIAccount_DEPRECATED | undefined;
|
|
36
|
-
export declare function getAccountId(nameOrId?: string | number): number | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* @throws {Error}
|
|
39
|
-
*/
|
|
40
|
-
export declare function removeSandboxAccountFromConfig(nameOrId: string | number): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* @throws {Error}
|
|
43
|
-
*/
|
|
44
|
-
export declare function updateAccountConfig(configOptions: UpdateAccountConfigOptions): FlatAccountFields_DEPRECATED;
|
|
45
|
-
/**
|
|
46
|
-
* @throws {Error}
|
|
47
|
-
*/
|
|
48
|
-
export declare function updateDefaultAccount(defaultAccount: string | number): void;
|
|
49
|
-
/**
|
|
50
|
-
* @throws {Error}
|
|
51
|
-
*/
|
|
52
|
-
export declare function updateDefaultCmsPublishMode(defaultCmsPublishMode: CmsPublishMode): void;
|
|
53
|
-
/**
|
|
54
|
-
* @throws {Error}
|
|
55
|
-
*/
|
|
56
|
-
export declare function updateHttpTimeout(timeout: string): void;
|
|
57
|
-
/**
|
|
58
|
-
* @throws {Error}
|
|
59
|
-
*/
|
|
60
|
-
export declare function updateAllowAutoUpdates(enabled: boolean): void;
|
|
61
|
-
/**
|
|
62
|
-
* @throws {Error}
|
|
63
|
-
*/
|
|
64
|
-
export declare function updateAllowUsageTracking(isEnabled: boolean): void;
|
|
65
|
-
export declare function updateAutoOpenBrowser(isEnabled: boolean): void;
|
|
66
|
-
/**
|
|
67
|
-
* @throws {Error}
|
|
68
|
-
*/
|
|
69
|
-
export declare function renameAccount(currentName: string, newName: string): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* @throws {Error}
|
|
72
|
-
*/
|
|
73
|
-
export declare function deleteAccount(accountName: string): Promise<void>;
|
|
74
|
-
export declare function createEmptyConfigFile({ path }?: {
|
|
75
|
-
path?: string;
|
|
76
|
-
}): void;
|
|
77
|
-
export declare function deleteEmptyConfigFile(): void;
|
|
78
|
-
export declare function deleteConfigFile(): void;
|
|
79
|
-
export declare function loadConfigFromEnvironment({ useEnv, }?: {
|
|
80
|
-
useEnv?: boolean;
|
|
81
|
-
}): {
|
|
82
|
-
portals: Array<CLIAccount_DEPRECATED>;
|
|
83
|
-
} | undefined;
|
|
84
|
-
export declare function isConfigFlagEnabled(flag: keyof CLIConfig_DEPRECATED, defaultValue?: boolean): boolean;
|
|
85
|
-
export declare function hasLocalStateFlag(flag: string): boolean;
|
|
86
|
-
export declare function addLocalStateFlag(flag: string): void;
|
|
87
|
-
export declare function removeLocalStateFlag(flag: string): void;
|