@hubspot/local-dev-lib 0.4.3-experimental.0 → 0.5.0-experimental.1
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 +27 -44
- package/config/index.js +300 -275
- package/config/migrate.d.ts +11 -16
- package/config/migrate.js +79 -161
- package/config/state.d.ts +3 -3
- package/config/state.js +12 -28
- package/config/utils.d.ts +74 -0
- package/config/utils.js +327 -0
- package/constants/config.d.ts +37 -0
- package/constants/config.js +38 -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 +83 -65
- 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 +39 -30
- package/lib/trackUsage.js +6 -3
- package/models/HubSpotConfigError.d.ts +6 -0
- package/models/HubSpotConfigError.js +29 -0
- package/models/OAuth2Manager.d.ts +3 -4
- package/models/OAuth2Manager.js +20 -29
- package/package.json +2 -2
- package/types/Accounts.d.ts +20 -109
- package/types/Config.d.ts +14 -27
- 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/migrate.d.ts
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function configFileExists(useHiddenConfig?: boolean, configPath?: string): boolean;
|
|
6
|
-
export declare function getConfigPath(configPath?: string, useHiddenConfig?: boolean): string | null;
|
|
7
|
-
export declare function migrateConfig(deprecatedConfig: CLIConfig_DEPRECATED | null): void;
|
|
8
|
-
type ConflictValue = boolean | string | number | CmsPublishMode | Environment;
|
|
1
|
+
import { HubSpotConfig } from '../types/Config';
|
|
2
|
+
import { ValueOf } from '../types/Utils';
|
|
3
|
+
export declare function getConfigAtPath(path: string): HubSpotConfig;
|
|
4
|
+
export declare function migrateConfigAtPath(path: string): void;
|
|
9
5
|
export type ConflictProperty = {
|
|
10
|
-
property: keyof
|
|
11
|
-
oldValue:
|
|
12
|
-
newValue:
|
|
6
|
+
property: keyof HubSpotConfig;
|
|
7
|
+
oldValue: ValueOf<HubSpotConfig>;
|
|
8
|
+
newValue: ValueOf<Required<HubSpotConfig>>;
|
|
13
9
|
};
|
|
14
|
-
export declare function mergeConfigProperties(
|
|
15
|
-
|
|
10
|
+
export declare function mergeConfigProperties(toConfig: HubSpotConfig, fromConfig: HubSpotConfig, force?: boolean): {
|
|
11
|
+
configWithMergedProperties: HubSpotConfig;
|
|
16
12
|
conflicts: Array<ConflictProperty>;
|
|
17
13
|
};
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
14
|
+
export declare function mergeConfigAccounts(toConfig: HubSpotConfig, fromConfig: HubSpotConfig): {
|
|
15
|
+
configWithMergedAccounts: HubSpotConfig;
|
|
20
16
|
skippedAccountIds: Array<string | number>;
|
|
21
17
|
};
|
|
22
|
-
export {};
|
package/config/migrate.js
CHANGED
|
@@ -1,186 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
30
|
-
const
|
|
31
|
-
const CLIConfiguration_1 = require("./CLIConfiguration");
|
|
6
|
+
exports.mergeConfigAccounts = exports.mergeConfigProperties = exports.migrateConfigAtPath = exports.getConfigAtPath = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
32
8
|
const index_1 = require("./index");
|
|
33
|
-
const configFile_1 = require("./configFile");
|
|
34
9
|
const config_1 = require("../constants/config");
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
function getDeprecatedConfig(configPath) {
|
|
40
|
-
return config_DEPRECATED.loadConfig(configPath);
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function getConfigAtPath(path) {
|
|
12
|
+
const configFileSource = (0, utils_1.readConfigFile)(path);
|
|
13
|
+
return (0, utils_1.parseConfig)(configFileSource, path);
|
|
41
14
|
}
|
|
42
|
-
exports.
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
exports.getGlobalConfig = getGlobalConfig;
|
|
50
|
-
function configFileExists(useHiddenConfig = false, configPath) {
|
|
51
|
-
return useHiddenConfig
|
|
52
|
-
? (0, configFile_1.configFileExists)()
|
|
53
|
-
: Boolean(config_DEPRECATED.getConfigPath(configPath));
|
|
54
|
-
}
|
|
55
|
-
exports.configFileExists = configFileExists;
|
|
56
|
-
function getConfigPath(configPath, useHiddenConfig = false) {
|
|
57
|
-
if (useHiddenConfig) {
|
|
58
|
-
return (0, configFile_1.getConfigFilePath)();
|
|
59
|
-
}
|
|
60
|
-
return config_DEPRECATED.getConfigPath(configPath);
|
|
15
|
+
exports.getConfigAtPath = getConfigAtPath;
|
|
16
|
+
function migrateConfigAtPath(path) {
|
|
17
|
+
(0, index_1.createEmptyConfigFile)(true);
|
|
18
|
+
const configToMigrate = getConfigAtPath(path);
|
|
19
|
+
(0, utils_1.writeConfigFile)(configToMigrate, (0, utils_1.getGlobalConfigFilePath)());
|
|
20
|
+
fs_1.default.unlinkSync(path);
|
|
61
21
|
}
|
|
62
|
-
exports.
|
|
63
|
-
function
|
|
64
|
-
const updatedConfigJson = JSON.stringify(updatedConfig);
|
|
65
|
-
if (isMigrating) {
|
|
66
|
-
(0, index_1.createEmptyConfigFile)({}, true);
|
|
67
|
-
}
|
|
68
|
-
(0, index_1.loadConfig)('');
|
|
69
|
-
try {
|
|
70
|
-
(0, index_1.writeConfig)({ source: updatedConfigJson });
|
|
71
|
-
const oldConfigPath = config_DEPRECATED.getConfigPath();
|
|
72
|
-
if (oldConfigPath) {
|
|
73
|
-
const dir = path_1.default.dirname(oldConfigPath);
|
|
74
|
-
const newConfigPath = path_1.default.join(dir, config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME);
|
|
75
|
-
fs_1.default.renameSync(oldConfigPath, newConfigPath);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
(0, index_1.deleteEmptyConfigFile)();
|
|
80
|
-
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.writeConfig`, { configPath: config_1.GLOBAL_CONFIG_PATH }), { cause: error });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function migrateConfig(deprecatedConfig) {
|
|
84
|
-
if (!deprecatedConfig) {
|
|
85
|
-
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noDeprecatedConfig`));
|
|
86
|
-
}
|
|
87
|
-
const { defaultPortal, portals, ...rest } = deprecatedConfig;
|
|
88
|
-
const updatedConfig = {
|
|
89
|
-
...rest,
|
|
90
|
-
defaultAccount: defaultPortal,
|
|
91
|
-
accounts: portals
|
|
92
|
-
.filter(({ portalId }) => portalId !== undefined)
|
|
93
|
-
.map(({ portalId, ...rest }) => ({
|
|
94
|
-
...rest,
|
|
95
|
-
accountId: portalId,
|
|
96
|
-
})),
|
|
97
|
-
};
|
|
98
|
-
writeGlobalConfigFile(updatedConfig, true);
|
|
99
|
-
}
|
|
100
|
-
exports.migrateConfig = migrateConfig;
|
|
101
|
-
function mergeConfigProperties(globalConfig, deprecatedConfig, force) {
|
|
102
|
-
const propertiesToCheck = [
|
|
103
|
-
config_1.DEFAULT_CMS_PUBLISH_MODE,
|
|
104
|
-
config_1.HTTP_TIMEOUT,
|
|
105
|
-
config_1.ENV,
|
|
106
|
-
config_1.HTTP_USE_LOCALHOST,
|
|
107
|
-
config_1.ALLOW_USAGE_TRACKING,
|
|
108
|
-
config_1.AUTO_OPEN_BROWSER,
|
|
109
|
-
config_1.ALLOW_AUTO_UPDATES,
|
|
110
|
-
];
|
|
22
|
+
exports.migrateConfigAtPath = migrateConfigAtPath;
|
|
23
|
+
function mergeConfigProperties(toConfig, fromConfig, force) {
|
|
111
24
|
const conflicts = [];
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
25
|
+
if (force) {
|
|
26
|
+
toConfig.defaultCmsPublishMode = fromConfig.defaultCmsPublishMode;
|
|
27
|
+
toConfig.httpTimeout = fromConfig.httpTimeout;
|
|
28
|
+
toConfig.env = fromConfig.env;
|
|
29
|
+
toConfig.httpUseLocalhost = fromConfig.httpUseLocalhost;
|
|
30
|
+
toConfig.allowUsageTracking = fromConfig.allowUsageTracking;
|
|
31
|
+
toConfig.autoOpenBrowser = fromConfig.autoOpenBrowser;
|
|
32
|
+
toConfig.allowAutoUpdates = fromConfig.allowAutoUpdates;
|
|
33
|
+
toConfig.defaultAccount = fromConfig.defaultAccount;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
toConfig.defaultCmsPublishMode ||= fromConfig.defaultCmsPublishMode;
|
|
37
|
+
toConfig.httpTimeout ||= fromConfig.httpTimeout;
|
|
38
|
+
toConfig.env ||= fromConfig.env;
|
|
39
|
+
toConfig.httpUseLocalhost =
|
|
40
|
+
toConfig.httpUseLocalhost === undefined
|
|
41
|
+
? fromConfig.httpUseLocalhost
|
|
42
|
+
: toConfig.httpUseLocalhost;
|
|
43
|
+
toConfig.allowUsageTracking =
|
|
44
|
+
toConfig.allowUsageTracking === undefined
|
|
45
|
+
? fromConfig.allowUsageTracking
|
|
46
|
+
: toConfig.allowUsageTracking;
|
|
47
|
+
toConfig.autoOpenBrowser =
|
|
48
|
+
toConfig.autoOpenBrowser === undefined
|
|
49
|
+
? fromConfig.autoOpenBrowser
|
|
50
|
+
: toConfig.autoOpenBrowser;
|
|
51
|
+
toConfig.allowAutoUpdates =
|
|
52
|
+
toConfig.allowAutoUpdates === undefined
|
|
53
|
+
? fromConfig.allowAutoUpdates
|
|
54
|
+
: toConfig.allowAutoUpdates;
|
|
55
|
+
toConfig.defaultAccount ||= fromConfig.defaultAccount;
|
|
56
|
+
const propertiesToCheck = [
|
|
57
|
+
config_1.DEFAULT_CMS_PUBLISH_MODE,
|
|
58
|
+
config_1.HTTP_TIMEOUT,
|
|
59
|
+
config_1.ENV,
|
|
60
|
+
config_1.HTTP_USE_LOCALHOST,
|
|
61
|
+
config_1.ALLOW_USAGE_TRACKING,
|
|
62
|
+
config_1.AUTO_OPEN_BROWSER,
|
|
63
|
+
config_1.ALLOW_AUTO_UPDATES,
|
|
64
|
+
config_1.DEFAULT_ACCOUNT,
|
|
65
|
+
];
|
|
66
|
+
propertiesToCheck.forEach(prop => {
|
|
67
|
+
if (toConfig[prop] !== undefined && toConfig[prop] !== fromConfig[prop]) {
|
|
121
68
|
conflicts.push({
|
|
122
69
|
property: prop,
|
|
123
|
-
oldValue:
|
|
124
|
-
newValue:
|
|
70
|
+
oldValue: fromConfig[prop],
|
|
71
|
+
newValue: toConfig[prop],
|
|
125
72
|
});
|
|
126
73
|
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
if (globalConfig.flags || deprecatedConfig.flags) {
|
|
130
|
-
globalConfig.flags = Array.from(new Set([
|
|
131
|
-
...(globalConfig.flags || []),
|
|
132
|
-
...(deprecatedConfig.flags || []),
|
|
133
|
-
]));
|
|
134
|
-
}
|
|
135
|
-
if (config_1.DEFAULT_ACCOUNT in globalConfig &&
|
|
136
|
-
config_1.DEFAULT_PORTAL in deprecatedConfig &&
|
|
137
|
-
globalConfig.defaultAccount !== deprecatedConfig.defaultPortal) {
|
|
138
|
-
if (force) {
|
|
139
|
-
globalConfig.defaultAccount = deprecatedConfig.defaultPortal;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
conflicts.push({
|
|
143
|
-
property: config_1.DEFAULT_ACCOUNT,
|
|
144
|
-
oldValue: deprecatedConfig.defaultPortal,
|
|
145
|
-
newValue: globalConfig.defaultAccount,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
74
|
+
});
|
|
148
75
|
}
|
|
149
|
-
|
|
150
|
-
|
|
76
|
+
// Merge flags
|
|
77
|
+
if (toConfig.flags || fromConfig.flags) {
|
|
78
|
+
toConfig.flags = Array.from(new Set([...(toConfig.flags || []), ...(fromConfig.flags || [])]));
|
|
151
79
|
}
|
|
152
|
-
return {
|
|
80
|
+
return { configWithMergedProperties: toConfig, conflicts };
|
|
153
81
|
}
|
|
154
82
|
exports.mergeConfigProperties = mergeConfigProperties;
|
|
155
|
-
function
|
|
156
|
-
|
|
83
|
+
function buildConfigWithMergedAccounts(toConfig, fromConfig) {
|
|
84
|
+
const existingAccountIds = toConfig.accounts.map(({ accountId }) => accountId);
|
|
157
85
|
const skippedAccountIds = [];
|
|
158
|
-
|
|
159
|
-
existingAccountIds
|
|
160
|
-
|
|
161
|
-
.filter(portal => {
|
|
162
|
-
const isExisting = existingAccountIds.includes(portal.portalId);
|
|
163
|
-
if (isExisting) {
|
|
164
|
-
skippedAccountIds.push(portal.portalId);
|
|
165
|
-
}
|
|
166
|
-
return !isExisting;
|
|
167
|
-
})
|
|
168
|
-
.map(({ portalId, ...rest }) => ({
|
|
169
|
-
...rest,
|
|
170
|
-
accountId: portalId,
|
|
171
|
-
}));
|
|
172
|
-
if (newAccounts.length > 0) {
|
|
173
|
-
globalConfig.accounts.push(...newAccounts);
|
|
86
|
+
fromConfig.accounts.forEach(account => {
|
|
87
|
+
if (existingAccountIds.includes(account.accountId)) {
|
|
88
|
+
skippedAccountIds.push(account.accountId);
|
|
174
89
|
}
|
|
175
|
-
|
|
90
|
+
else {
|
|
91
|
+
toConfig.accounts.push(account);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
176
94
|
return {
|
|
177
|
-
|
|
95
|
+
configWithMergedAccounts: toConfig,
|
|
178
96
|
skippedAccountIds,
|
|
179
97
|
};
|
|
180
98
|
}
|
|
181
|
-
function
|
|
182
|
-
const {
|
|
183
|
-
|
|
184
|
-
return {
|
|
99
|
+
function mergeConfigAccounts(toConfig, fromConfig) {
|
|
100
|
+
const { configWithMergedAccounts, skippedAccountIds } = buildConfigWithMergedAccounts(toConfig, fromConfig);
|
|
101
|
+
(0, utils_1.writeConfigFile)(configWithMergedAccounts, (0, utils_1.getGlobalConfigFilePath)());
|
|
102
|
+
return { configWithMergedAccounts, skippedAccountIds };
|
|
185
103
|
}
|
|
186
|
-
exports.
|
|
104
|
+
exports.mergeConfigAccounts = mergeConfigAccounts;
|
package/config/state.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getStateValue<K extends keyof
|
|
3
|
-
export declare function setStateValue<K extends keyof
|
|
1
|
+
import { CLIState } from '../types/Config';
|
|
2
|
+
export declare function getStateValue<K extends keyof CLIState>(key: K): CLIState[K];
|
|
3
|
+
export declare function setStateValue<K extends keyof CLIState>(key: K, value: CLIState[K]): void;
|
package/config/state.js
CHANGED
|
@@ -46,41 +46,19 @@ function ensureCLIDirectory() {
|
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function sanitizeAndMerge(parsed) {
|
|
50
|
-
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
51
|
-
return structuredClone(DEFAULT_STATE);
|
|
52
|
-
}
|
|
53
|
-
const state = parsed;
|
|
54
|
-
const result = structuredClone(DEFAULT_STATE);
|
|
55
|
-
for (const key in DEFAULT_STATE) {
|
|
56
|
-
const typedKey = key;
|
|
57
|
-
if (key in state &&
|
|
58
|
-
typeof state[typedKey] === typeof DEFAULT_STATE[typedKey]) {
|
|
59
|
-
result[typedKey] = state[typedKey];
|
|
60
|
-
}
|
|
61
|
-
// keys not in parsed file remain as DEFAULT values
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
49
|
function getCurrentState() {
|
|
66
50
|
try {
|
|
67
|
-
if (
|
|
68
|
-
|
|
51
|
+
if (fs.existsSync(config_1.STATE_FILE_PATH)) {
|
|
52
|
+
const data = fs.readFileSync(config_1.STATE_FILE_PATH, 'utf-8');
|
|
53
|
+
return JSON.parse(data);
|
|
69
54
|
}
|
|
70
|
-
const data = fs.readFileSync(config_1.STATE_FILE_PATH, 'utf-8');
|
|
71
|
-
if (!data?.trim()) {
|
|
72
|
-
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.getCurrentState.debug.emptyStateFile`));
|
|
73
|
-
return structuredClone(DEFAULT_STATE);
|
|
74
|
-
}
|
|
75
|
-
const parsed = JSON.parse(data);
|
|
76
|
-
return sanitizeAndMerge(parsed);
|
|
77
55
|
}
|
|
78
56
|
catch (error) {
|
|
79
|
-
|
|
57
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.getCurrentState.errors.errorReading`, {
|
|
80
58
|
error: error instanceof Error ? error.message : String(error),
|
|
81
59
|
}));
|
|
82
|
-
return structuredClone(DEFAULT_STATE);
|
|
83
60
|
}
|
|
61
|
+
return DEFAULT_STATE;
|
|
84
62
|
}
|
|
85
63
|
function getStateValue(key) {
|
|
86
64
|
ensureCLIDirectory();
|
|
@@ -90,7 +68,13 @@ function getStateValue(key) {
|
|
|
90
68
|
exports.getStateValue = getStateValue;
|
|
91
69
|
function setStateValue(key, value) {
|
|
92
70
|
ensureCLIDirectory();
|
|
93
|
-
|
|
71
|
+
let currentState = DEFAULT_STATE;
|
|
72
|
+
try {
|
|
73
|
+
currentState = getCurrentState();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger_1.logger.debug(error);
|
|
77
|
+
}
|
|
94
78
|
const newState = { ...currentState, [key]: value };
|
|
95
79
|
try {
|
|
96
80
|
fs.writeFileSync(config_1.STATE_FILE_PATH, JSON.stringify(newState, null, 2), 'utf-8');
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ACCOUNT_IDENTIFIERS } from '../constants/config';
|
|
2
|
+
import { HubSpotConfig, DeprecatedHubSpotConfigFields } from '../types/Config';
|
|
3
|
+
import { HubSpotConfigAccount, AccountType, TokenInfo } from '../types/Accounts';
|
|
4
|
+
import { ValueOf } from '../types/Utils';
|
|
5
|
+
export declare function getGlobalConfigFilePath(): string;
|
|
6
|
+
export declare function getLocalConfigFilePath(): string | null;
|
|
7
|
+
export declare function getLocalConfigDefaultFilePath(): string;
|
|
8
|
+
export declare function getConfigPathEnvironmentVariables(): {
|
|
9
|
+
useEnvironmentConfig: boolean;
|
|
10
|
+
configFilePathFromEnvironment: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function readConfigFile(configPath: string): string;
|
|
13
|
+
export declare function removeUndefinedFieldsFromConfigAccount<T extends HubSpotConfigAccount | Partial<HubSpotConfigAccount> = HubSpotConfigAccount>(account: T): T;
|
|
14
|
+
export declare function formatConfigForWrite(config: HubSpotConfig): {
|
|
15
|
+
accounts: ({
|
|
16
|
+
personalAccessKey: string;
|
|
17
|
+
auth: {
|
|
18
|
+
tokenInfo: TokenInfo;
|
|
19
|
+
};
|
|
20
|
+
accountType?: AccountType | undefined;
|
|
21
|
+
defaultCmsPublishMode?: import("../types/Files").CmsPublishMode | undefined;
|
|
22
|
+
parentAccountId?: number | undefined;
|
|
23
|
+
name: string;
|
|
24
|
+
accountId: number;
|
|
25
|
+
env: import("../types/Config").Environment;
|
|
26
|
+
authType: "apikey" | "oauth2" | "personalaccesskey";
|
|
27
|
+
} | {
|
|
28
|
+
auth: {
|
|
29
|
+
clientId: string;
|
|
30
|
+
clientSecret: string;
|
|
31
|
+
scopes: string[];
|
|
32
|
+
tokenInfo: TokenInfo;
|
|
33
|
+
};
|
|
34
|
+
accountType?: AccountType | undefined;
|
|
35
|
+
defaultCmsPublishMode?: import("../types/Files").CmsPublishMode | undefined;
|
|
36
|
+
parentAccountId?: number | undefined;
|
|
37
|
+
name: string;
|
|
38
|
+
accountId: number;
|
|
39
|
+
env: import("../types/Config").Environment;
|
|
40
|
+
authType: "apikey" | "oauth2" | "personalaccesskey";
|
|
41
|
+
} | {
|
|
42
|
+
apiKey: string;
|
|
43
|
+
accountType?: AccountType | undefined;
|
|
44
|
+
defaultCmsPublishMode?: import("../types/Files").CmsPublishMode | undefined;
|
|
45
|
+
parentAccountId?: number | undefined;
|
|
46
|
+
name: string;
|
|
47
|
+
accountId: number;
|
|
48
|
+
env: import("../types/Config").Environment;
|
|
49
|
+
authType: "apikey" | "oauth2" | "personalaccesskey";
|
|
50
|
+
})[];
|
|
51
|
+
allowAutoUpdates?: boolean | undefined;
|
|
52
|
+
defaultMode?: import("../types/Files").CmsPublishMode | undefined;
|
|
53
|
+
env?: import("../types/Config").Environment | undefined;
|
|
54
|
+
httpUseLocalhost?: boolean | undefined;
|
|
55
|
+
autoOpenBrowser?: boolean | undefined;
|
|
56
|
+
useCustomObjectHubfile?: boolean | undefined;
|
|
57
|
+
flags?: string[] | undefined;
|
|
58
|
+
defaultCmsPublishMode: import("../types/Files").CmsPublishMode | undefined;
|
|
59
|
+
httpTimeout: number | undefined;
|
|
60
|
+
allowUsageTracking: boolean | undefined;
|
|
61
|
+
defaultAccount?: number | undefined;
|
|
62
|
+
};
|
|
63
|
+
export declare function writeConfigFile(config: HubSpotConfig, configPath: string): void;
|
|
64
|
+
export declare function normalizeParsedConfig(parsedConfig: HubSpotConfig & DeprecatedHubSpotConfigFields): HubSpotConfig;
|
|
65
|
+
export declare function parseConfig(configSource: string, configPath: string): HubSpotConfig;
|
|
66
|
+
export declare function buildConfigFromEnvironment(): HubSpotConfig;
|
|
67
|
+
export declare function getAccountIdentifierAndType(accountIdentifier: string | number): {
|
|
68
|
+
identifier: string | number;
|
|
69
|
+
identifierType: ValueOf<typeof ACCOUNT_IDENTIFIERS>;
|
|
70
|
+
};
|
|
71
|
+
export declare function getConfigAccountByIdentifier(accounts: Array<HubSpotConfigAccount>, identifierFieldName: ValueOf<typeof ACCOUNT_IDENTIFIERS>, identifier: string | number): HubSpotConfigAccount | undefined;
|
|
72
|
+
export declare function getConfigAccountByInferredIdentifier(accounts: Array<HubSpotConfigAccount>, accountIdentifier: string | number): HubSpotConfigAccount | undefined;
|
|
73
|
+
export declare function getConfigAccountIndexById(accounts: Array<HubSpotConfigAccount>, id: number): number;
|
|
74
|
+
export declare function isConfigAccountValid(account: Partial<HubSpotConfigAccount>): boolean;
|