@hubspot/local-dev-lib 0.2.1-experimental.1 → 0.2.2-experimental.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/api/github.d.ts +0 -1
- package/api/projects.d.ts +0 -1
- package/config/CLIConfiguration.d.ts +65 -0
- package/config/CLIConfiguration.js +509 -0
- package/config/configFile.d.ts +21 -0
- package/config/configFile.js +100 -0
- package/config/configUtils.d.ts +5 -0
- package/config/configUtils.js +87 -0
- package/config/config_DEPRECATED.d.ts +76 -0
- package/config/config_DEPRECATED.js +693 -0
- package/config/environment.d.ts +2 -0
- package/config/environment.js +60 -0
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +41 -25
- package/config/index.js +236 -248
- package/config/migrate.d.ts +20 -0
- package/config/migrate.js +150 -0
- package/constants/config.d.ts +7 -24
- package/constants/config.js +13 -25
- package/constants/environments.d.ts +11 -0
- package/constants/environments.js +12 -1
- package/http/getAxiosConfig.js +1 -7
- package/http/index.js +19 -23
- package/lang/en.json +81 -67
- package/lib/archive.d.ts +0 -1
- package/lib/cms/themes.js +1 -3
- package/lib/environment.d.ts +1 -1
- package/lib/github.d.ts +0 -1
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +16 -8
- package/lib/personalAccessKey.d.ts +2 -2
- package/lib/personalAccessKey.js +30 -39
- package/lib/trackUsage.js +3 -6
- package/models/OAuth2Manager.d.ts +4 -3
- package/models/OAuth2Manager.js +29 -20
- package/package.json +4 -3
- package/types/Accounts.d.ts +109 -20
- package/types/Config.d.ts +24 -11
- package/types/Http.d.ts +0 -1
- package/utils/accounts.d.ts +4 -0
- package/utils/accounts.js +28 -0
- package/config/defaultAccountOverride.d.ts +0 -2
- package/config/defaultAccountOverride.js +0 -57
- package/config/utils.d.ts +0 -70
- package/config/utils.js +0 -328
package/config/index.js
CHANGED
|
@@ -1,284 +1,272 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.getDefaultAccountOverrideFilePath = exports.getCWDAccountOverride = exports.updateDefaultCmsPublishMode = exports.getConfigAccounts = exports.getConfigDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
|
|
27
|
+
const config_DEPRECATED = __importStar(require("./config_DEPRECATED"));
|
|
28
|
+
const CLIConfiguration_1 = require("./CLIConfiguration");
|
|
29
|
+
const configFile_1 = require("./configFile");
|
|
30
|
+
const getAccountIdentifier_1 = require("./getAccountIdentifier");
|
|
31
|
+
// Use new config if it exists
|
|
32
|
+
function loadConfig(path, options = {}) {
|
|
33
|
+
// Attempt to load the root config
|
|
34
|
+
if ((0, configFile_1.configFileExists)()) {
|
|
35
|
+
return CLIConfiguration_1.CLIConfiguration.init(options);
|
|
36
|
+
}
|
|
37
|
+
return config_DEPRECATED.loadConfig(path, options);
|
|
16
38
|
}
|
|
17
|
-
exports.
|
|
18
|
-
function
|
|
19
|
-
|
|
39
|
+
exports.loadConfig = loadConfig;
|
|
40
|
+
function getAndLoadConfigIfNeeded(options) {
|
|
41
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
42
|
+
return CLIConfiguration_1.CLIConfiguration.config;
|
|
43
|
+
}
|
|
44
|
+
return config_DEPRECATED.getAndLoadConfigIfNeeded(options);
|
|
20
45
|
}
|
|
21
|
-
exports.
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return globalConfigFilePath;
|
|
46
|
+
exports.getAndLoadConfigIfNeeded = getAndLoadConfigIfNeeded;
|
|
47
|
+
function validateConfig() {
|
|
48
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
49
|
+
return CLIConfiguration_1.CLIConfiguration.validate();
|
|
26
50
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
return config_DEPRECATED.validateConfig();
|
|
52
|
+
}
|
|
53
|
+
exports.validateConfig = validateConfig;
|
|
54
|
+
function loadConfigFromEnvironment() {
|
|
55
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
56
|
+
return CLIConfiguration_1.CLIConfiguration.useEnvConfig;
|
|
30
57
|
}
|
|
31
|
-
return
|
|
58
|
+
return Boolean(config_DEPRECATED.loadConfigFromEnvironment());
|
|
32
59
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
60
|
+
exports.loadConfigFromEnvironment = loadConfigFromEnvironment;
|
|
61
|
+
function createEmptyConfigFile(options = {}, useHiddenConfig = false) {
|
|
62
|
+
if (useHiddenConfig) {
|
|
63
|
+
CLIConfiguration_1.CLIConfiguration.write({ accounts: [] });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return config_DEPRECATED.createEmptyConfigFile(options);
|
|
67
|
+
}
|
|
36
68
|
}
|
|
37
|
-
exports.
|
|
69
|
+
exports.createEmptyConfigFile = createEmptyConfigFile;
|
|
70
|
+
function deleteEmptyConfigFile() {
|
|
71
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
72
|
+
return CLIConfiguration_1.CLIConfiguration.delete();
|
|
73
|
+
}
|
|
74
|
+
return config_DEPRECATED.deleteEmptyConfigFile();
|
|
75
|
+
}
|
|
76
|
+
exports.deleteEmptyConfigFile = deleteEmptyConfigFile;
|
|
38
77
|
function getConfig() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const pathToRead = getConfigFilePath();
|
|
44
|
-
logger_1.logger.debug((0, lang_1.i18n)('config.getConfig', { path: pathToRead }));
|
|
45
|
-
const configFileSource = (0, utils_1.readConfigFile)(pathToRead);
|
|
46
|
-
return (0, utils_1.parseConfig)(configFileSource);
|
|
78
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
79
|
+
return CLIConfiguration_1.CLIConfiguration.config;
|
|
80
|
+
}
|
|
81
|
+
return config_DEPRECATED.getConfig();
|
|
47
82
|
}
|
|
48
83
|
exports.getConfig = getConfig;
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (accountIdsMap[account.accountId]) {
|
|
62
|
-
logger_1.logger.debug((0, lang_1.i18n)('config.isConfigValid.duplicateAccountIds', {
|
|
63
|
-
accountId: account.accountId,
|
|
64
|
-
}));
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (account.name) {
|
|
68
|
-
if (accountNamesMap[account.name.toLowerCase()]) {
|
|
69
|
-
logger_1.logger.debug((0, lang_1.i18n)('config.isConfigValid.duplicateAccountNames', {
|
|
70
|
-
accountName: account.name,
|
|
71
|
-
}));
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (/\s+/.test(account.name)) {
|
|
75
|
-
logger_1.logger.debug((0, lang_1.i18n)('config.isConfigValid.invalidAccountName', {
|
|
76
|
-
accountName: account.name,
|
|
77
|
-
}));
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
accountNamesMap[account.name] = true;
|
|
81
|
-
}
|
|
82
|
-
accountIdsMap[account.accountId] = true;
|
|
83
|
-
return true;
|
|
84
|
-
});
|
|
84
|
+
function writeConfig(options = {}) {
|
|
85
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
86
|
+
const config = options.source
|
|
87
|
+
? JSON.parse(options.source)
|
|
88
|
+
: undefined;
|
|
89
|
+
CLIConfiguration_1.CLIConfiguration.write(config);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
config_DEPRECATED.writeConfig(options);
|
|
93
|
+
}
|
|
85
94
|
}
|
|
86
|
-
exports.
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const pathToWrite = configFilePathFromEnvironment || defaultPath;
|
|
93
|
-
(0, utils_1.writeConfigFile)({ accounts: [] }, pathToWrite);
|
|
95
|
+
exports.writeConfig = writeConfig;
|
|
96
|
+
function getConfigPath(path, useHiddenConfig = false) {
|
|
97
|
+
if (useHiddenConfig || CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
98
|
+
return (0, configFile_1.getConfigFilePath)();
|
|
99
|
+
}
|
|
100
|
+
return config_DEPRECATED.getConfigPath(path);
|
|
94
101
|
}
|
|
95
|
-
exports.
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
exports.getConfigPath = getConfigPath;
|
|
103
|
+
function configFileExists(useHiddenConfig, path) {
|
|
104
|
+
return useHiddenConfig
|
|
105
|
+
? (0, configFile_1.configFileExists)()
|
|
106
|
+
: Boolean(config_DEPRECATED.getConfigPath(path));
|
|
99
107
|
}
|
|
100
|
-
exports.
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!account) {
|
|
105
|
-
throw new Error((0, lang_1.i18n)('config.getConfigAccountById.error', { accountId }));
|
|
108
|
+
exports.configFileExists = configFileExists;
|
|
109
|
+
function getAccountConfig(accountId) {
|
|
110
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
111
|
+
return CLIConfiguration_1.CLIConfiguration.getConfigForAccount(accountId);
|
|
106
112
|
}
|
|
107
|
-
return
|
|
113
|
+
return config_DEPRECATED.getAccountConfig(accountId) || null;
|
|
108
114
|
}
|
|
109
|
-
exports.
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
return account;
|
|
115
|
+
exports.getAccountConfig = getAccountConfig;
|
|
116
|
+
function accountNameExistsInConfig(name) {
|
|
117
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
118
|
+
return CLIConfiguration_1.CLIConfiguration.isAccountInConfig(name);
|
|
119
|
+
}
|
|
120
|
+
return config_DEPRECATED.accountNameExistsInConfig(name);
|
|
117
121
|
}
|
|
118
|
-
exports.
|
|
119
|
-
function
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
+
exports.accountNameExistsInConfig = accountNameExistsInConfig;
|
|
123
|
+
function updateAccountConfig(configOptions) {
|
|
124
|
+
const accountIdentifier = (0, getAccountIdentifier_1.getAccountIdentifier)(configOptions);
|
|
125
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
126
|
+
return CLIConfiguration_1.CLIConfiguration.addOrUpdateAccount({
|
|
127
|
+
...configOptions,
|
|
128
|
+
accountId: accountIdentifier,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return config_DEPRECATED.updateAccountConfig({
|
|
132
|
+
...configOptions,
|
|
133
|
+
portalId: accountIdentifier,
|
|
134
|
+
});
|
|
122
135
|
}
|
|
123
|
-
exports.
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
if (!defaultAccountToUse) {
|
|
132
|
-
throw new Error((0, lang_1.i18n)('config.getConfigDefaultAccount.fieldMissingError'));
|
|
133
|
-
}
|
|
134
|
-
const account = (0, utils_1.getConfigAccountByInferredIdentifier)(accounts, defaultAccountToUse);
|
|
135
|
-
if (!account) {
|
|
136
|
-
throw new Error((0, lang_1.i18n)('config.getConfigDefaultAccount.accountMissingError', {
|
|
137
|
-
defaultAccountToUse,
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
return account;
|
|
136
|
+
exports.updateAccountConfig = updateAccountConfig;
|
|
137
|
+
function updateDefaultAccount(nameOrId) {
|
|
138
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
139
|
+
CLIConfiguration_1.CLIConfiguration.updateDefaultAccount(nameOrId);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
config_DEPRECATED.updateDefaultAccount(nameOrId);
|
|
143
|
+
}
|
|
141
144
|
}
|
|
142
|
-
exports.
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
if (!defaultAccountToUse) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const account = (0, utils_1.getConfigAccountByInferredIdentifier)(accounts, defaultAccountToUse);
|
|
154
|
-
return account;
|
|
145
|
+
exports.updateDefaultAccount = updateDefaultAccount;
|
|
146
|
+
async function renameAccount(currentName, newName) {
|
|
147
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
148
|
+
return CLIConfiguration_1.CLIConfiguration.renameAccount(currentName, newName);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return config_DEPRECATED.renameAccount(currentName, newName);
|
|
152
|
+
}
|
|
155
153
|
}
|
|
156
|
-
exports.
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
exports.renameAccount = renameAccount;
|
|
155
|
+
function getAccountId(nameOrId) {
|
|
156
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
157
|
+
return CLIConfiguration_1.CLIConfiguration.getAccountId(nameOrId);
|
|
158
|
+
}
|
|
159
|
+
return config_DEPRECATED.getAccountId(nameOrId) || null;
|
|
160
160
|
}
|
|
161
|
-
exports.
|
|
162
|
-
function
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return account.env;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const defaultAccount = getConfigDefaultAccount();
|
|
171
|
-
return defaultAccount.env;
|
|
161
|
+
exports.getAccountId = getAccountId;
|
|
162
|
+
function removeSandboxAccountFromConfig(nameOrId) {
|
|
163
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
164
|
+
return CLIConfiguration_1.CLIConfiguration.removeAccountFromConfig(nameOrId);
|
|
165
|
+
}
|
|
166
|
+
return config_DEPRECATED.removeSandboxAccountFromConfig(nameOrId);
|
|
172
167
|
}
|
|
173
|
-
exports.
|
|
174
|
-
function
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
throw new Error((0, lang_1.i18n)('config.addConfigAccount.duplicateAccount', {
|
|
182
|
-
accountId: accountToAdd.accountId,
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
185
|
-
config.accounts.push(accountToAdd);
|
|
186
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
168
|
+
exports.removeSandboxAccountFromConfig = removeSandboxAccountFromConfig;
|
|
169
|
+
async function deleteAccount(accountName) {
|
|
170
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
171
|
+
return CLIConfiguration_1.CLIConfiguration.removeAccountFromConfig(accountName);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return config_DEPRECATED.deleteAccount(accountName);
|
|
175
|
+
}
|
|
187
176
|
}
|
|
188
|
-
exports.
|
|
189
|
-
function
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
throw new Error((0, lang_1.i18n)('config.updateConfigAccount.accountNotFound', {
|
|
197
|
-
accountId: updatedAccount.accountId,
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
config.accounts[accountIndex] = updatedAccount;
|
|
201
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
177
|
+
exports.deleteAccount = deleteAccount;
|
|
178
|
+
function updateHttpTimeout(timeout) {
|
|
179
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
180
|
+
CLIConfiguration_1.CLIConfiguration.updateHttpTimeout(timeout);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
config_DEPRECATED.updateHttpTimeout(timeout);
|
|
184
|
+
}
|
|
202
185
|
}
|
|
203
|
-
exports.
|
|
204
|
-
function
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
config.defaultAccount = account.accountId;
|
|
213
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
186
|
+
exports.updateHttpTimeout = updateHttpTimeout;
|
|
187
|
+
function updateAllowUsageTracking(isEnabled) {
|
|
188
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
189
|
+
CLIConfiguration_1.CLIConfiguration.updateAllowUsageTracking(isEnabled);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
config_DEPRECATED.updateAllowUsageTracking(isEnabled);
|
|
193
|
+
}
|
|
214
194
|
}
|
|
215
|
-
exports.
|
|
216
|
-
function
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
const duplicateAccount = (0, utils_1.getConfigAccountByIdentifier)(config.accounts, config_1.ACCOUNT_IDENTIFIERS.NAME, newName);
|
|
225
|
-
if (duplicateAccount) {
|
|
226
|
-
throw new Error((0, lang_1.i18n)('config.renameConfigAccount.duplicateAccount', {
|
|
227
|
-
newName,
|
|
228
|
-
}));
|
|
229
|
-
}
|
|
230
|
-
account.name = newName;
|
|
231
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
195
|
+
exports.updateAllowUsageTracking = updateAllowUsageTracking;
|
|
196
|
+
function deleteConfigFile() {
|
|
197
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
198
|
+
(0, configFile_1.deleteConfigFile)();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
config_DEPRECATED.deleteConfigFile();
|
|
202
|
+
}
|
|
232
203
|
}
|
|
233
|
-
exports.
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
accountId,
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
config.accounts.splice(index, 1);
|
|
243
|
-
if (config.defaultAccount === accountId) {
|
|
244
|
-
delete config.defaultAccount;
|
|
245
|
-
}
|
|
246
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
204
|
+
exports.deleteConfigFile = deleteConfigFile;
|
|
205
|
+
function isConfigFlagEnabled(flag) {
|
|
206
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
207
|
+
return CLIConfiguration_1.CLIConfiguration.isConfigFlagEnabled(flag);
|
|
208
|
+
}
|
|
209
|
+
return config_DEPRECATED.isConfigFlagEnabled(flag);
|
|
247
210
|
}
|
|
248
|
-
exports.
|
|
249
|
-
function
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}));
|
|
255
|
-
}
|
|
256
|
-
const config = getConfig();
|
|
257
|
-
config.httpTimeout = parsedTimeout;
|
|
258
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
211
|
+
exports.isConfigFlagEnabled = isConfigFlagEnabled;
|
|
212
|
+
function isTrackingAllowed() {
|
|
213
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
214
|
+
return CLIConfiguration_1.CLIConfiguration.isTrackingAllowed();
|
|
215
|
+
}
|
|
216
|
+
return config_DEPRECATED.isTrackingAllowed();
|
|
259
217
|
}
|
|
260
|
-
exports.
|
|
261
|
-
function
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
218
|
+
exports.isTrackingAllowed = isTrackingAllowed;
|
|
219
|
+
function getEnv(nameOrId) {
|
|
220
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
221
|
+
return CLIConfiguration_1.CLIConfiguration.getEnv(nameOrId);
|
|
222
|
+
}
|
|
223
|
+
return config_DEPRECATED.getEnv(nameOrId);
|
|
265
224
|
}
|
|
266
|
-
exports.
|
|
225
|
+
exports.getEnv = getEnv;
|
|
226
|
+
function getAccountType(accountType, sandboxAccountType) {
|
|
227
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
228
|
+
return CLIConfiguration_1.CLIConfiguration.getAccountType(accountType, sandboxAccountType);
|
|
229
|
+
}
|
|
230
|
+
return config_DEPRECATED.getAccountType(accountType, sandboxAccountType);
|
|
231
|
+
}
|
|
232
|
+
exports.getAccountType = getAccountType;
|
|
233
|
+
function getConfigDefaultAccount() {
|
|
234
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
235
|
+
return CLIConfiguration_1.CLIConfiguration.getDefaultAccount();
|
|
236
|
+
}
|
|
237
|
+
return config_DEPRECATED.getConfigDefaultAccount();
|
|
238
|
+
}
|
|
239
|
+
exports.getConfigDefaultAccount = getConfigDefaultAccount;
|
|
240
|
+
function getConfigAccounts() {
|
|
241
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
242
|
+
return CLIConfiguration_1.CLIConfiguration.getConfigAccounts();
|
|
243
|
+
}
|
|
244
|
+
return config_DEPRECATED.getConfigAccounts();
|
|
245
|
+
}
|
|
246
|
+
exports.getConfigAccounts = getConfigAccounts;
|
|
267
247
|
function updateDefaultCmsPublishMode(cmsPublishMode) {
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
throw new Error((0, lang_1.i18n)('config.updateDefaultCmsPublishMode.invalidCmsPublishMode'));
|
|
248
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
249
|
+
return CLIConfiguration_1.CLIConfiguration.updateDefaultCmsPublishMode(cmsPublishMode);
|
|
271
250
|
}
|
|
272
|
-
|
|
273
|
-
config.defaultCmsPublishMode = cmsPublishMode;
|
|
274
|
-
(0, utils_1.writeConfigFile)(config, getConfigFilePath());
|
|
251
|
+
return config_DEPRECATED.updateDefaultCmsPublishMode(cmsPublishMode);
|
|
275
252
|
}
|
|
276
253
|
exports.updateDefaultCmsPublishMode = updateDefaultCmsPublishMode;
|
|
277
|
-
function
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return defaultValue || false;
|
|
254
|
+
function getCWDAccountOverride() {
|
|
255
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
256
|
+
return CLIConfiguration_1.CLIConfiguration.getCWDAccountOverride();
|
|
281
257
|
}
|
|
282
|
-
return Boolean(config[flag]);
|
|
283
258
|
}
|
|
284
|
-
exports.
|
|
259
|
+
exports.getCWDAccountOverride = getCWDAccountOverride;
|
|
260
|
+
function getDefaultAccountOverrideFilePath() {
|
|
261
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
262
|
+
return CLIConfiguration_1.CLIConfiguration.getDefaultAccountOverrideFilePath();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.getDefaultAccountOverrideFilePath = getDefaultAccountOverrideFilePath;
|
|
266
|
+
// These functions are not supported with the new config setup
|
|
267
|
+
exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;
|
|
268
|
+
exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;
|
|
269
|
+
exports.getOrderedConfig = config_DEPRECATED.getOrderedConfig;
|
|
270
|
+
exports.setConfig = config_DEPRECATED.setConfig;
|
|
271
|
+
exports.setConfigPath = config_DEPRECATED.setConfigPath;
|
|
272
|
+
exports.findConfig = config_DEPRECATED.findConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CLIConfig, CLIConfig_DEPRECATED, CLIConfig_NEW, Environment } from '../types/Config';
|
|
2
|
+
import { CmsPublishMode } from '../types/Files';
|
|
3
|
+
export declare function getConfig(useHiddenConfig?: boolean, configPath?: string): Partial<CLIConfig> | null;
|
|
4
|
+
export declare function getConfigPath(configPath?: string, useHiddenConfig?: boolean): string | null;
|
|
5
|
+
export declare function migrateConfig(deprecatedConfig: CLIConfig_DEPRECATED | null): void;
|
|
6
|
+
type ConflictValue = boolean | string | number | CmsPublishMode | Environment;
|
|
7
|
+
export type ConflictProperty = {
|
|
8
|
+
property: keyof CLIConfig_NEW;
|
|
9
|
+
oldValue: ConflictValue;
|
|
10
|
+
newValue: ConflictValue;
|
|
11
|
+
};
|
|
12
|
+
export declare function mergeConfigProperties(globalConfig: CLIConfig_NEW, deprecatedConfig: CLIConfig_DEPRECATED, force?: boolean): {
|
|
13
|
+
initialConfig: CLIConfig_NEW;
|
|
14
|
+
conflicts: Array<ConflictProperty>;
|
|
15
|
+
};
|
|
16
|
+
export declare function mergeExistingConfigs(globalConfig: CLIConfig_NEW, deprecatedConfig: CLIConfig_DEPRECATED): {
|
|
17
|
+
finalConfig: CLIConfig_NEW;
|
|
18
|
+
skippedAccountIds: Array<string | number>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|