@hubspot/local-dev-lib 2.3.0 → 3.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/CLIConfiguration.d.ts +3 -1
- package/config/CLIConfiguration.js +22 -13
- package/config/configUtils.js +2 -2
- package/config/config_DEPRECATED.d.ts +4 -3
- package/config/config_DEPRECATED.js +24 -14
- package/config/index.d.ts +2 -2
- package/config/index.js +5 -5
- package/constants/files.d.ts +2 -2
- package/constants/files.js +3 -3
- package/lang/en.json +2 -2
- package/lib/cms/uploadFolder.d.ts +2 -2
- package/lib/cms/uploadFolder.js +2 -2
- package/lib/cms/watch.d.ts +1 -1
- package/lib/cms/watch.js +6 -6
- package/lib/fileMapper.d.ts +4 -4
- package/lib/fileMapper.js +19 -19
- package/package.json +2 -1
- package/types/Accounts.d.ts +3 -3
- package/types/Config.d.ts +5 -2
- package/types/Files.d.ts +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CLIConfig_NEW, Environment } from '../types/Config';
|
|
2
2
|
import { CLIAccount_NEW, FlatAccountFields_NEW, AccountType } from '../types/Accounts';
|
|
3
3
|
import { CLIOptions } from '../types/CLIOptions';
|
|
4
|
+
import { CmsPublishMode } from '../types/Files';
|
|
4
5
|
declare class _CLIConfiguration {
|
|
5
6
|
options: CLIOptions;
|
|
6
7
|
useEnvConfig: boolean;
|
|
@@ -47,7 +48,7 @@ declare class _CLIConfiguration {
|
|
|
47
48
|
/**
|
|
48
49
|
* @throws {Error}
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
|
+
updateDefaultCmsPublishMode(defaultCmsPublishMode: CmsPublishMode): CLIConfig_NEW | null;
|
|
51
52
|
/**
|
|
52
53
|
* @throws {Error}
|
|
53
54
|
*/
|
|
@@ -57,6 +58,7 @@ declare class _CLIConfiguration {
|
|
|
57
58
|
*/
|
|
58
59
|
updateAllowUsageTracking(isEnabled: boolean): CLIConfig_NEW | null;
|
|
59
60
|
isTrackingAllowed(): boolean;
|
|
61
|
+
handleLegacyCmsPublishMode(config: CLIConfig_NEW | null): CLIConfig_NEW | null;
|
|
60
62
|
}
|
|
61
63
|
export declare const CLIConfiguration: _CLIConfiguration;
|
|
62
64
|
export {};
|
|
@@ -43,7 +43,7 @@ class _CLIConfiguration {
|
|
|
43
43
|
accountId: configFromEnv.accounts[0].accountId,
|
|
44
44
|
}));
|
|
45
45
|
this.useEnvConfig = true;
|
|
46
|
-
this.config = configFromEnv;
|
|
46
|
+
this.config = this.handleLegacyCmsPublishMode(configFromEnv);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
@@ -54,7 +54,7 @@ class _CLIConfiguration {
|
|
|
54
54
|
this.config = { accounts: [] };
|
|
55
55
|
}
|
|
56
56
|
this.useEnvConfig = false;
|
|
57
|
-
this.config = configFromFile;
|
|
57
|
+
this.config = this.handleLegacyCmsPublishMode(configFromFile);
|
|
58
58
|
}
|
|
59
59
|
return this.config;
|
|
60
60
|
}
|
|
@@ -258,7 +258,7 @@ class _CLIConfiguration {
|
|
|
258
258
|
* @throws {Error}
|
|
259
259
|
*/
|
|
260
260
|
addOrUpdateAccount(updatedAccountFields, writeUpdate = true) {
|
|
261
|
-
const { accountId, accountType, apiKey, authType, clientId, clientSecret,
|
|
261
|
+
const { accountId, accountType, apiKey, authType, clientId, clientSecret, defaultCmsPublishMode, env, name, parentAccountId, personalAccessKey, sandboxAccountType, scopes, tokenInfo, } = updatedAccountFields;
|
|
262
262
|
if (!accountId) {
|
|
263
263
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.updateAccount.errors.accountIdRequired`));
|
|
264
264
|
}
|
|
@@ -292,7 +292,8 @@ class _CLIConfiguration {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
const updatedEnv = (0, environment_2.getValidEnv)(env || (currentAccountConfig && currentAccountConfig.env));
|
|
295
|
-
const
|
|
295
|
+
const updatedDefaultCmsPublishMode = defaultCmsPublishMode &&
|
|
296
|
+
defaultCmsPublishMode.toLowerCase();
|
|
296
297
|
const updatedAccountType = accountType || (currentAccountConfig && currentAccountConfig.accountType);
|
|
297
298
|
safelyApplyUpdates('name', name);
|
|
298
299
|
safelyApplyUpdates('env', updatedEnv);
|
|
@@ -302,9 +303,9 @@ class _CLIConfiguration {
|
|
|
302
303
|
if (nextAccountConfig.authType === auth_1.API_KEY_AUTH_METHOD.value) {
|
|
303
304
|
safelyApplyUpdates('apiKey', apiKey);
|
|
304
305
|
}
|
|
305
|
-
if (typeof
|
|
306
|
+
if (typeof updatedDefaultCmsPublishMode !== 'undefined') {
|
|
306
307
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
307
|
-
safelyApplyUpdates('
|
|
308
|
+
safelyApplyUpdates('defaultCmsPublishMode', files_1.CMS_PUBLISH_MODE[updatedDefaultCmsPublishMode]);
|
|
308
309
|
}
|
|
309
310
|
safelyApplyUpdates('personalAccessKey', personalAccessKey);
|
|
310
311
|
// Deprecating sandboxAccountType in favor of the more generic accountType
|
|
@@ -411,18 +412,19 @@ class _CLIConfiguration {
|
|
|
411
412
|
/**
|
|
412
413
|
* @throws {Error}
|
|
413
414
|
*/
|
|
414
|
-
|
|
415
|
+
updateDefaultCmsPublishMode(defaultCmsPublishMode) {
|
|
415
416
|
if (!this.config) {
|
|
416
417
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigLoaded`));
|
|
417
418
|
}
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
419
|
+
const ALL_CMS_PUBLISH_MODES = Object.values(files_1.CMS_PUBLISH_MODE);
|
|
420
|
+
if (!defaultCmsPublishMode ||
|
|
421
|
+
!ALL_CMS_PUBLISH_MODES.find(m => m === defaultCmsPublishMode)) {
|
|
422
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.updateDefaultCmsPublishMode.errors.invalidCmsPublishMode`, {
|
|
423
|
+
defaultCmsPublishMode,
|
|
424
|
+
validCmsPublishModes: (0, text_1.commaSeparatedValues)(ALL_CMS_PUBLISH_MODES),
|
|
423
425
|
}));
|
|
424
426
|
}
|
|
425
|
-
this.config.
|
|
427
|
+
this.config.defaultCmsPublishMode = defaultCmsPublishMode;
|
|
426
428
|
return this.write();
|
|
427
429
|
}
|
|
428
430
|
/**
|
|
@@ -463,5 +465,12 @@ class _CLIConfiguration {
|
|
|
463
465
|
}
|
|
464
466
|
return this.config.allowUsageTracking !== false;
|
|
465
467
|
}
|
|
468
|
+
handleLegacyCmsPublishMode(config) {
|
|
469
|
+
if (config?.defaultMode) {
|
|
470
|
+
config.defaultCmsPublishMode = config.defaultMode;
|
|
471
|
+
delete config.defaultMode;
|
|
472
|
+
}
|
|
473
|
+
return config;
|
|
474
|
+
}
|
|
466
475
|
}
|
|
467
476
|
exports.CLIConfiguration = new _CLIConfiguration();
|
package/config/configUtils.js
CHANGED
|
@@ -17,10 +17,10 @@ function getOrderedAccount(unorderedAccount) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.getOrderedAccount = getOrderedAccount;
|
|
19
19
|
function getOrderedConfig(unorderedConfig) {
|
|
20
|
-
const { defaultAccount,
|
|
20
|
+
const { defaultAccount, defaultCmsPublishMode, httpTimeout, allowUsageTracking, accounts, ...rest } = unorderedConfig;
|
|
21
21
|
return {
|
|
22
22
|
...(defaultAccount && { defaultAccount }),
|
|
23
|
-
|
|
23
|
+
defaultCmsPublishMode,
|
|
24
24
|
httpTimeout,
|
|
25
25
|
allowUsageTracking,
|
|
26
26
|
...rest,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CLIConfig_DEPRECATED, Environment } from '../types/Config';
|
|
2
2
|
import { AccountType, CLIAccount_DEPRECATED, FlatAccountFields_DEPRECATED, UpdateAccountConfigOptions } from '../types/Accounts';
|
|
3
|
-
import {
|
|
3
|
+
import { CmsPublishMode } from '../types/Files';
|
|
4
4
|
import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
|
|
5
5
|
export declare const getConfig: () => CLIConfig_DEPRECATED | null;
|
|
6
6
|
export declare function setConfig(updatedConfig?: CLIConfig_DEPRECATED): CLIConfig_DEPRECATED | null;
|
|
@@ -14,9 +14,10 @@ export declare function accountNameExistsInConfig(name: string): boolean;
|
|
|
14
14
|
export declare function getOrderedAccount(unorderedAccount: CLIAccount_DEPRECATED): CLIAccount_DEPRECATED;
|
|
15
15
|
export declare function getOrderedConfig(unorderedConfig: CLIConfig_DEPRECATED): {
|
|
16
16
|
portals: CLIAccount_DEPRECATED[];
|
|
17
|
+
defaultMode?: CmsPublishMode | undefined;
|
|
17
18
|
env?: Environment | undefined;
|
|
18
19
|
httpUseLocalhost?: boolean | undefined;
|
|
19
|
-
|
|
20
|
+
defaultCmsPublishMode: CmsPublishMode | undefined;
|
|
20
21
|
httpTimeout: number | undefined;
|
|
21
22
|
allowUsageTracking: boolean | undefined;
|
|
22
23
|
defaultPortal?: string | number | undefined;
|
|
@@ -45,7 +46,7 @@ export declare function updateDefaultAccount(defaultAccount: string | number): v
|
|
|
45
46
|
/**
|
|
46
47
|
* @throws {Error}
|
|
47
48
|
*/
|
|
48
|
-
export declare function
|
|
49
|
+
export declare function updateDefaultCmsPublishMode(defaultCmsPublishMode: CmsPublishMode): void;
|
|
49
50
|
/**
|
|
50
51
|
* @throws {Error}
|
|
51
52
|
*/
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isConfigFlagEnabled = exports.loadConfigFromEnvironment = exports.deleteConfigFile = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.deleteAccount = exports.renameAccount = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.
|
|
6
|
+
exports.isConfigFlagEnabled = exports.loadConfigFromEnvironment = exports.deleteConfigFile = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.deleteAccount = exports.renameAccount = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.updateDefaultCmsPublishMode = exports.updateDefaultAccount = exports.updateAccountConfig = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.getAccountConfig = exports.getAccountType = exports.getEnv = exports.findConfig = exports.getAndLoadConfigIfNeeded = exports.isTrackingAllowed = exports.loadConfig = exports.writeConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.accountNameExistsInConfig = exports.validateConfig = exports.getConfigPath = exports.setConfigPath = exports.getConfigAccountId = exports.getConfigDefaultAccount = exports.getConfigAccounts = exports.setConfig = exports.getConfig = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
9
|
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
@@ -16,7 +16,7 @@ const environment_1 = require("../lib/environment");
|
|
|
16
16
|
const logger_1 = require("../lib/logger");
|
|
17
17
|
const git_1 = require("../utils/git");
|
|
18
18
|
const errors_DEPRECATED_1 = require("../errors/errors_DEPRECATED");
|
|
19
|
-
const
|
|
19
|
+
const ALL_CMS_PUBLISH_MODES = Object.values(files_1.CMS_PUBLISH_MODE);
|
|
20
20
|
let _config;
|
|
21
21
|
let _configPath;
|
|
22
22
|
let environmentVariableConfigLoaded = false;
|
|
@@ -139,10 +139,10 @@ function getOrderedAccount(unorderedAccount) {
|
|
|
139
139
|
}
|
|
140
140
|
exports.getOrderedAccount = getOrderedAccount;
|
|
141
141
|
function getOrderedConfig(unorderedConfig) {
|
|
142
|
-
const { defaultPortal,
|
|
142
|
+
const { defaultPortal, defaultCmsPublishMode, httpTimeout, allowUsageTracking, portals, ...rest } = unorderedConfig;
|
|
143
143
|
return {
|
|
144
144
|
...(defaultPortal && { defaultPortal }),
|
|
145
|
-
|
|
145
|
+
defaultCmsPublishMode,
|
|
146
146
|
httpTimeout,
|
|
147
147
|
allowUsageTracking,
|
|
148
148
|
...rest,
|
|
@@ -234,7 +234,7 @@ function loadConfigFromFile(path, options = {}) {
|
|
|
234
234
|
const { parsed, error: parseError } = parseConfig(source);
|
|
235
235
|
if (parseError)
|
|
236
236
|
return;
|
|
237
|
-
setConfig(parsed);
|
|
237
|
+
setConfig(handleLegacyCmsPublishMode(parsed));
|
|
238
238
|
if (!(0, exports.getConfig)()) {
|
|
239
239
|
logger_1.logger.debug('The config file was empty config');
|
|
240
240
|
logger_1.logger.debug('Initializing an empty config');
|
|
@@ -392,7 +392,7 @@ exports.removeSandboxAccountFromConfig = removeSandboxAccountFromConfig;
|
|
|
392
392
|
* @throws {Error}
|
|
393
393
|
*/
|
|
394
394
|
function updateAccountConfig(configOptions) {
|
|
395
|
-
const { accountType, apiKey, authType, clientId, clientSecret,
|
|
395
|
+
const { accountType, apiKey, authType, clientId, clientSecret, defaultCmsPublishMode, environment, name, parentAccountId, personalAccessKey, portalId, sandboxAccountType, scopes, tokenInfo, } = configOptions;
|
|
396
396
|
if (!portalId) {
|
|
397
397
|
throw new Error('A portalId is required to update the config');
|
|
398
398
|
}
|
|
@@ -411,7 +411,7 @@ function updateAccountConfig(configOptions) {
|
|
|
411
411
|
const env = (0, environment_1.getValidEnv)(environment ||
|
|
412
412
|
(configOptions && configOptions.env) ||
|
|
413
413
|
(accountConfig && accountConfig.env));
|
|
414
|
-
const
|
|
414
|
+
const cmsPublishMode = defaultCmsPublishMode?.toLowerCase();
|
|
415
415
|
const nextAccountConfig = {
|
|
416
416
|
...accountConfig,
|
|
417
417
|
name: name || (accountConfig && accountConfig.name),
|
|
@@ -421,7 +421,9 @@ function updateAccountConfig(configOptions) {
|
|
|
421
421
|
auth,
|
|
422
422
|
accountType: getAccountType(accountType, sandboxAccountType),
|
|
423
423
|
apiKey,
|
|
424
|
-
|
|
424
|
+
defaultCmsPublishMode: cmsPublishMode && Object.hasOwn(files_1.CMS_PUBLISH_MODE, cmsPublishMode)
|
|
425
|
+
? cmsPublishMode
|
|
426
|
+
: undefined,
|
|
425
427
|
personalAccessKey,
|
|
426
428
|
sandboxAccountType,
|
|
427
429
|
parentAccountId,
|
|
@@ -461,16 +463,17 @@ exports.updateDefaultAccount = updateDefaultAccount;
|
|
|
461
463
|
/**
|
|
462
464
|
* @throws {Error}
|
|
463
465
|
*/
|
|
464
|
-
function
|
|
465
|
-
if (!
|
|
466
|
-
|
|
466
|
+
function updateDefaultCmsPublishMode(defaultCmsPublishMode) {
|
|
467
|
+
if (!defaultCmsPublishMode ||
|
|
468
|
+
!ALL_CMS_PUBLISH_MODES.find(m => m === defaultCmsPublishMode)) {
|
|
469
|
+
throw new Error(`The mode ${defaultCmsPublishMode} is invalid. Valid values are ${commaSeparatedValues(ALL_CMS_PUBLISH_MODES)}.`);
|
|
467
470
|
}
|
|
468
471
|
const config = getAndLoadConfigIfNeeded();
|
|
469
|
-
config.
|
|
472
|
+
config.defaultCmsPublishMode = defaultCmsPublishMode;
|
|
470
473
|
setDefaultConfigPathIfUnset();
|
|
471
474
|
writeConfig();
|
|
472
475
|
}
|
|
473
|
-
exports.
|
|
476
|
+
exports.updateDefaultCmsPublishMode = updateDefaultCmsPublishMode;
|
|
474
477
|
/**
|
|
475
478
|
* @throws {Error}
|
|
476
479
|
*/
|
|
@@ -666,7 +669,7 @@ function loadEnvironmentVariableConfig(options) {
|
|
|
666
669
|
}
|
|
667
670
|
const { portalId } = getConfigVariablesFromEnv();
|
|
668
671
|
logger_1.logger.debug(`Loaded config from environment variables for account ${portalId}`);
|
|
669
|
-
return setConfig(envConfig);
|
|
672
|
+
return setConfig(handleLegacyCmsPublishMode(envConfig));
|
|
670
673
|
}
|
|
671
674
|
function isConfigFlagEnabled(flag) {
|
|
672
675
|
if (!configFileExists() || configFileIsBlank()) {
|
|
@@ -676,3 +679,10 @@ function isConfigFlagEnabled(flag) {
|
|
|
676
679
|
return Boolean(config[flag] || false);
|
|
677
680
|
}
|
|
678
681
|
exports.isConfigFlagEnabled = isConfigFlagEnabled;
|
|
682
|
+
function handleLegacyCmsPublishMode(config) {
|
|
683
|
+
if (config?.defaultMode) {
|
|
684
|
+
config.defaultCmsPublishMode = config.defaultMode;
|
|
685
|
+
delete config.defaultMode;
|
|
686
|
+
}
|
|
687
|
+
return config;
|
|
688
|
+
}
|
package/config/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as config_DEPRECATED from './config_DEPRECATED';
|
|
|
2
2
|
import { CLIConfig_NEW, CLIConfig } from '../types/Config';
|
|
3
3
|
import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
|
|
4
4
|
import { AccountType, CLIAccount, CLIAccount_NEW, CLIAccount_DEPRECATED, FlatAccountFields } from '../types/Accounts';
|
|
5
|
-
import {
|
|
5
|
+
import { CmsPublishMode } from '../types/Files';
|
|
6
6
|
export declare function loadConfig(path: string, options?: CLIOptions): CLIConfig | null;
|
|
7
7
|
export declare function getAndLoadConfigIfNeeded(options?: CLIOptions): Partial<CLIConfig> | null;
|
|
8
8
|
export declare function validateConfig(): boolean;
|
|
@@ -32,7 +32,7 @@ export declare function getEnv(nameOrId?: string | number): import("../types/Con
|
|
|
32
32
|
export declare function getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
|
|
33
33
|
export declare function getConfigDefaultAccount(): string | number | null | undefined;
|
|
34
34
|
export declare function getConfigAccounts(): Array<CLIAccount_NEW> | Array<CLIAccount_DEPRECATED> | null | undefined;
|
|
35
|
-
export declare function
|
|
35
|
+
export declare function updateDefaultCmsPublishMode(cmsPublishMode: CmsPublishMode): void | CLIConfig_NEW | null;
|
|
36
36
|
export declare const getConfigAccountId: typeof config_DEPRECATED.getConfigAccountId;
|
|
37
37
|
export declare const getOrderedAccount: typeof config_DEPRECATED.getOrderedAccount;
|
|
38
38
|
export declare const getOrderedConfig: typeof config_DEPRECATED.getOrderedConfig;
|
package/config/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.
|
|
26
|
+
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = 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
27
|
const config_DEPRECATED = __importStar(require("./config_DEPRECATED"));
|
|
28
28
|
const CLIConfiguration_1 = require("./CLIConfiguration");
|
|
29
29
|
const configFile_1 = require("./configFile");
|
|
@@ -244,13 +244,13 @@ function getConfigAccounts() {
|
|
|
244
244
|
return config_DEPRECATED.getConfigAccounts();
|
|
245
245
|
}
|
|
246
246
|
exports.getConfigAccounts = getConfigAccounts;
|
|
247
|
-
function
|
|
247
|
+
function updateDefaultCmsPublishMode(cmsPublishMode) {
|
|
248
248
|
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
249
|
-
return CLIConfiguration_1.CLIConfiguration.
|
|
249
|
+
return CLIConfiguration_1.CLIConfiguration.updateDefaultCmsPublishMode(cmsPublishMode);
|
|
250
250
|
}
|
|
251
|
-
return config_DEPRECATED.
|
|
251
|
+
return config_DEPRECATED.updateDefaultCmsPublishMode(cmsPublishMode);
|
|
252
252
|
}
|
|
253
|
-
exports.
|
|
253
|
+
exports.updateDefaultCmsPublishMode = updateDefaultCmsPublishMode;
|
|
254
254
|
// These functions are not supported with the new config setup
|
|
255
255
|
exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;
|
|
256
256
|
exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;
|
package/constants/files.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare const STAT_TYPES: {
|
|
|
3
3
|
readonly SYMBOLIC_LINK: "symlink";
|
|
4
4
|
readonly DIRECTORY: "dir";
|
|
5
5
|
};
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const CMS_PUBLISH_MODE: {
|
|
7
7
|
readonly draft: "draft";
|
|
8
8
|
readonly publish: "publish";
|
|
9
9
|
};
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const DEFAULT_CMS_PUBLISH_MODE: "publish";
|
|
11
11
|
export declare const FILE_UPLOAD_RESULT_TYPES: {
|
|
12
12
|
readonly SUCCESS: "SUCCESS";
|
|
13
13
|
readonly FAILURE: "FAILURE";
|
package/constants/files.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FILE_TYPES = exports.FILE_UPLOAD_RESULT_TYPES = exports.
|
|
3
|
+
exports.FILE_TYPES = exports.FILE_UPLOAD_RESULT_TYPES = exports.DEFAULT_CMS_PUBLISH_MODE = exports.CMS_PUBLISH_MODE = exports.STAT_TYPES = void 0;
|
|
4
4
|
exports.STAT_TYPES = {
|
|
5
5
|
FILE: 'file',
|
|
6
6
|
SYMBOLIC_LINK: 'symlink',
|
|
7
7
|
DIRECTORY: 'dir',
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
9
|
+
exports.CMS_PUBLISH_MODE = {
|
|
10
10
|
draft: 'draft',
|
|
11
11
|
publish: 'publish',
|
|
12
12
|
};
|
|
13
|
-
exports.
|
|
13
|
+
exports.DEFAULT_CMS_PUBLISH_MODE = exports.CMS_PUBLISH_MODE.publish;
|
|
14
14
|
exports.FILE_UPLOAD_RESULT_TYPES = {
|
|
15
15
|
SUCCESS: 'SUCCESS',
|
|
16
16
|
FAILURE: 'FAILURE',
|
package/lang/en.json
CHANGED
|
@@ -274,9 +274,9 @@
|
|
|
274
274
|
"invalidId": "Unable to find account for {{ nameOrId }}."
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
|
-
"
|
|
277
|
+
"updateDefaultCmsPublishMode": {
|
|
278
278
|
"errors": {
|
|
279
|
-
"
|
|
279
|
+
"invalidCmsPublishMode": "The CMS publish mode {{ defaultCmsPublishMode }} is invalid. Valid values are {{ validCmsPublishModes }}."
|
|
280
280
|
}
|
|
281
281
|
},
|
|
282
282
|
"updateHttpTimeout": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldsJs } from './handleFieldsJS';
|
|
2
2
|
import { FileMapperInputOptions } from '../../types/Files';
|
|
3
3
|
import { UploadFolderResults, CommandOptions, FilePathsByType } from '../../types/Files';
|
|
4
|
-
import {
|
|
4
|
+
import { CmsPublishMode } from '../../types/Files';
|
|
5
5
|
export declare function getFilesByType(filePaths: Array<string>, projectDir: string, rootWriteDir: string | null, commandOptions: CommandOptions): Promise<[FilePathsByType, Array<FieldsJs>]>;
|
|
6
|
-
export declare function uploadFolder(accountId: number, src: string, dest: string, fileMapperOptions: FileMapperInputOptions, commandOptions?: CommandOptions, filePaths?: Array<string>,
|
|
6
|
+
export declare function uploadFolder(accountId: number, src: string, dest: string, fileMapperOptions: FileMapperInputOptions, commandOptions?: CommandOptions, filePaths?: Array<string>, cmsPublishMode?: CmsPublishMode | null): Promise<Array<UploadFolderResults>>;
|
|
7
7
|
export declare function hasUploadErrors(results: Array<UploadFolderResults>): boolean;
|
package/lib/cms/uploadFolder.js
CHANGED
|
@@ -106,7 +106,7 @@ const defaultUploadFinalErrorCallback = (accountId, file, destPath, error) => {
|
|
|
106
106
|
payload: file,
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
|
-
async function uploadFolder(accountId, src, dest, fileMapperOptions, commandOptions = {}, filePaths = [],
|
|
109
|
+
async function uploadFolder(accountId, src, dest, fileMapperOptions, commandOptions = {}, filePaths = [], cmsPublishMode = null) {
|
|
110
110
|
const { saveOutput, convertFields, onAttemptCallback, onSuccessCallback, onFirstErrorCallback, onRetryCallback, onFinalErrorCallback, } = commandOptions;
|
|
111
111
|
const _onAttemptCallback = onAttemptCallback || defaultUploadAttemptCallback;
|
|
112
112
|
const _onSuccessCallback = onSuccessCallback || defaultUploadSuccessCallback;
|
|
@@ -117,7 +117,7 @@ async function uploadFolder(accountId, src, dest, fileMapperOptions, commandOpti
|
|
|
117
117
|
? (0, handleFieldsJS_1.createTmpDirSync)('hubspot-temp-fieldsjs-output-')
|
|
118
118
|
: null;
|
|
119
119
|
const regex = new RegExp(`^${(0, escapeRegExp_1.escapeRegExp)(src)}`);
|
|
120
|
-
const apiOptions = (0, fileMapper_1.getFileMapperQueryValues)(
|
|
120
|
+
const apiOptions = (0, fileMapper_1.getFileMapperQueryValues)(cmsPublishMode, fileMapperOptions);
|
|
121
121
|
const failures = [];
|
|
122
122
|
let fieldsJsPaths = [];
|
|
123
123
|
let tmpDirRegex;
|
package/lib/cms/watch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import chokidar from 'chokidar';
|
|
2
2
|
import { WatchOptions, WatchErrorHandler } from '../../types/Files';
|
|
3
3
|
import { UploadFolderResults } from '../../types/Files';
|
|
4
|
-
export declare function watch(accountId: number, src: string, dest: string, {
|
|
4
|
+
export declare function watch(accountId: number, src: string, dest: string, { cmsPublishMode, remove, disableInitial, notify, commandOptions, filePaths, }: WatchOptions, postInitialUploadCallback?: ((result: Array<UploadFolderResults>) => void) | null, onUploadFolderError?: WatchErrorHandler, onQueueAddError?: WatchErrorHandler, onUploadFileError?: (file: string, dest: string, accountId: number) => WatchErrorHandler): chokidar.FSWatcher;
|
package/lib/cms/watch.js
CHANGED
|
@@ -50,7 +50,7 @@ const defaultOnUploadFileError = (file, dest, accountId) => (error) => {
|
|
|
50
50
|
payload: file,
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
-
async function uploadFile(accountId, file, dest, options,
|
|
53
|
+
async function uploadFile(accountId, file, dest, options, cmsPublishMode = null, onUploadFileError = defaultOnUploadFileError) {
|
|
54
54
|
const src = options.src;
|
|
55
55
|
const absoluteSrcPath = path_1.default.resolve((0, path_2.getCwd)(), file);
|
|
56
56
|
const themeJsonPath = (0, themes_1.getThemeJSONPath)(absoluteSrcPath);
|
|
@@ -76,7 +76,7 @@ async function uploadFile(accountId, file, dest, options, mode = null, onUploadF
|
|
|
76
76
|
}
|
|
77
77
|
const fileToUpload = convertFields && fieldsJs?.outputPath ? fieldsJs.outputPath : file;
|
|
78
78
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.uploadAttempt`, { file, dest }));
|
|
79
|
-
const apiOptions = (0, fileMapper_1.getFileMapperQueryValues)(
|
|
79
|
+
const apiOptions = (0, fileMapper_1.getFileMapperQueryValues)(cmsPublishMode, options);
|
|
80
80
|
queue.add(() => {
|
|
81
81
|
return (0, fileMapper_2.upload)(accountId, fileToUpload, dest, apiOptions)
|
|
82
82
|
.then(() => {
|
|
@@ -116,7 +116,7 @@ async function deleteRemoteFile(accountId, filePath, remoteFilePath) {
|
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
function watch(accountId, src, dest, {
|
|
119
|
+
function watch(accountId, src, dest, { cmsPublishMode, remove, disableInitial, notify, commandOptions, filePaths, }, postInitialUploadCallback = null, onUploadFolderError, onQueueAddError, onUploadFileError) {
|
|
120
120
|
const regex = new RegExp(`^${(0, escapeRegExp_1.escapeRegExp)(src)}`);
|
|
121
121
|
if (notify) {
|
|
122
122
|
(0, ignoreRules_1.ignoreFile)(notify);
|
|
@@ -131,7 +131,7 @@ function watch(accountId, src, dest, { mode, remove, disableInitial, notify, com
|
|
|
131
131
|
}
|
|
132
132
|
if (!disableInitial) {
|
|
133
133
|
// Use uploadFolder so that failures of initial upload are retried
|
|
134
|
-
const uploadFolderPromise = (0, uploadFolder_1.uploadFolder)(accountId, src, dest, {}, commandOptions, filePaths,
|
|
134
|
+
const uploadFolderPromise = (0, uploadFolder_1.uploadFolder)(accountId, src, dest, {}, commandOptions, filePaths, cmsPublishMode || null).then(result => {
|
|
135
135
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.folderUploadSuccess`, {
|
|
136
136
|
src,
|
|
137
137
|
dest,
|
|
@@ -153,7 +153,7 @@ function watch(accountId, src, dest, { mode, remove, disableInitial, notify, com
|
|
|
153
153
|
const uploadPromise = uploadFile(accountId, filePath, destPath, {
|
|
154
154
|
src,
|
|
155
155
|
commandOptions,
|
|
156
|
-
},
|
|
156
|
+
}, cmsPublishMode, onUploadFileError);
|
|
157
157
|
(0, notify_1.triggerNotify)(notify, 'Added', filePath, uploadPromise);
|
|
158
158
|
});
|
|
159
159
|
if (remove) {
|
|
@@ -193,7 +193,7 @@ function watch(accountId, src, dest, { mode, remove, disableInitial, notify, com
|
|
|
193
193
|
const uploadPromise = uploadFile(accountId, filePath, destPath, {
|
|
194
194
|
src,
|
|
195
195
|
commandOptions,
|
|
196
|
-
},
|
|
196
|
+
}, cmsPublishMode, onUploadFileError);
|
|
197
197
|
(0, notify_1.triggerNotify)(notify, 'Changed', filePath, uploadPromise);
|
|
198
198
|
});
|
|
199
199
|
return watcher;
|
package/lib/fileMapper.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { FileMapperNode,
|
|
1
|
+
import { FileMapperNode, CmsPublishMode, FileMapperOptions, FileMapperInputOptions, PathTypeData, RecursiveFileMapperCallback } from '../types/Files';
|
|
2
2
|
export declare function isPathToFile(filepath: string): boolean;
|
|
3
3
|
export declare function isPathToModule(filepath: string): boolean;
|
|
4
4
|
export declare function isPathToRoot(filepath: string): boolean;
|
|
5
5
|
export declare function isPathToHubspot(filepath: string): boolean;
|
|
6
|
-
export declare function getFileMapperQueryValues(
|
|
6
|
+
export declare function getFileMapperQueryValues(cmsPublishMode?: CmsPublishMode | null, { staging, assetVersion }?: FileMapperInputOptions): FileMapperOptions;
|
|
7
7
|
export declare function getTypeDataFromPath(src: string): PathTypeData;
|
|
8
8
|
export declare function recurseFolder(node: FileMapperNode, callback: RecursiveFileMapperCallback, filepath?: string, depth?: number): boolean;
|
|
9
9
|
export declare function writeUtimes(accountId: number, filepath: string, node: FileMapperNode): Promise<void>;
|
|
10
|
-
export declare function fetchFolderFromApi(accountId: number, src: string,
|
|
10
|
+
export declare function fetchFolderFromApi(accountId: number, src: string, cmsPublishMode?: CmsPublishMode, options?: FileMapperInputOptions): Promise<FileMapperNode>;
|
|
11
11
|
/**
|
|
12
12
|
* Fetch a file/folder and write to local file system.
|
|
13
13
|
*
|
|
@@ -15,4 +15,4 @@ export declare function fetchFolderFromApi(accountId: number, src: string, mode?
|
|
|
15
15
|
* @param {FileMapperInputArguments} input
|
|
16
16
|
* @returns {Promise}
|
|
17
17
|
*/
|
|
18
|
-
export declare function downloadFileOrFolder(accountId: number, src: string, dest: string,
|
|
18
|
+
export declare function downloadFileOrFolder(accountId: number, src: string, dest: string, cmsPublishMode?: CmsPublishMode, options?: FileMapperInputOptions): Promise<void>;
|
package/lib/fileMapper.js
CHANGED
|
@@ -43,14 +43,14 @@ function isPathToHubspot(filepath) {
|
|
|
43
43
|
return /^(\/|\\)?@hubspot/i.test(filepath.trim());
|
|
44
44
|
}
|
|
45
45
|
exports.isPathToHubspot = isPathToHubspot;
|
|
46
|
-
function useApiBuffer(
|
|
47
|
-
return
|
|
46
|
+
function useApiBuffer(cmsPublishMode) {
|
|
47
|
+
return cmsPublishMode === files_1.CMS_PUBLISH_MODE.draft;
|
|
48
48
|
}
|
|
49
|
-
// Determines API param based on mode
|
|
50
|
-
function getFileMapperQueryValues(
|
|
49
|
+
// Determines API param based on publish mode and options
|
|
50
|
+
function getFileMapperQueryValues(cmsPublishMode, { staging, assetVersion } = {}) {
|
|
51
51
|
return {
|
|
52
52
|
params: {
|
|
53
|
-
buffer: useApiBuffer(
|
|
53
|
+
buffer: useApiBuffer(cmsPublishMode),
|
|
54
54
|
environmentId: staging ? 2 : 1,
|
|
55
55
|
version: assetVersion,
|
|
56
56
|
},
|
|
@@ -141,7 +141,7 @@ async function skipExisting(filepath, overwrite = false) {
|
|
|
141
141
|
}
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
|
-
async function fetchAndWriteFileStream(accountId, srcPath, filepath,
|
|
144
|
+
async function fetchAndWriteFileStream(accountId, srcPath, filepath, cmsPublishMode, options = {}) {
|
|
145
145
|
if (typeof srcPath !== 'string' || !srcPath.trim()) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
@@ -152,12 +152,12 @@ async function fetchAndWriteFileStream(accountId, srcPath, filepath, mode, optio
|
|
|
152
152
|
if (!(0, path_2.isAllowedExtension)(srcPath, Array.from(extensions_1.JSR_ALLOWED_EXTENSIONS))) {
|
|
153
153
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidFileType`, { srcPath }));
|
|
154
154
|
}
|
|
155
|
-
const node = await (0, fileMapper_1.fetchFileStream)(accountId, srcPath, filepath, getFileMapperQueryValues(
|
|
155
|
+
const node = await (0, fileMapper_1.fetchFileStream)(accountId, srcPath, filepath, getFileMapperQueryValues(cmsPublishMode, options));
|
|
156
156
|
await writeUtimes(accountId, filepath, node);
|
|
157
157
|
}
|
|
158
158
|
// Writes an individual file or folder (not recursive). If file source is missing, the
|
|
159
159
|
//file is fetched.
|
|
160
|
-
async function writeFileMapperNode(accountId, filepath, node,
|
|
160
|
+
async function writeFileMapperNode(accountId, filepath, node, cmsPublishMode, options = {}) {
|
|
161
161
|
const localFilepath = (0, path_2.convertToLocalFileSystemPath)(path_1.default.resolve(filepath));
|
|
162
162
|
if (await skipExisting(localFilepath, options.overwrite)) {
|
|
163
163
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.skippedExisting`, {
|
|
@@ -167,7 +167,7 @@ async function writeFileMapperNode(accountId, filepath, node, mode, options = {}
|
|
|
167
167
|
}
|
|
168
168
|
if (!node.folder) {
|
|
169
169
|
try {
|
|
170
|
-
await fetchAndWriteFileStream(accountId, node.path, localFilepath,
|
|
170
|
+
await fetchAndWriteFileStream(accountId, node.path, localFilepath, cmsPublishMode, options);
|
|
171
171
|
return true;
|
|
172
172
|
}
|
|
173
173
|
catch (err) {
|
|
@@ -189,7 +189,7 @@ async function writeFileMapperNode(accountId, filepath, node, mode, options = {}
|
|
|
189
189
|
}
|
|
190
190
|
return true;
|
|
191
191
|
}
|
|
192
|
-
async function downloadFile(accountId, src, destPath,
|
|
192
|
+
async function downloadFile(accountId, src, destPath, cmsPublishMode, options = {}) {
|
|
193
193
|
const { isFile, isHubspot } = getTypeDataFromPath(src);
|
|
194
194
|
if (!isFile) {
|
|
195
195
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidRequest`, { src }));
|
|
@@ -214,7 +214,7 @@ async function downloadFile(accountId, src, destPath, mode, options = {}) {
|
|
|
214
214
|
: path_1.default.resolve(cwd, dest, name);
|
|
215
215
|
}
|
|
216
216
|
const localFsPath = (0, path_2.convertToLocalFileSystemPath)(filepath);
|
|
217
|
-
await fetchAndWriteFileStream(accountId, src, localFsPath,
|
|
217
|
+
await fetchAndWriteFileStream(accountId, src, localFsPath, cmsPublishMode, options);
|
|
218
218
|
await queue.onIdle();
|
|
219
219
|
logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.completedFetch`, {
|
|
220
220
|
src,
|
|
@@ -232,7 +232,7 @@ async function downloadFile(accountId, src, destPath, mode, options = {}) {
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
async function fetchFolderFromApi(accountId, src,
|
|
235
|
+
async function fetchFolderFromApi(accountId, src, cmsPublishMode, options = {}) {
|
|
236
236
|
const { isRoot, isFolder, isHubspot } = getTypeDataFromPath(src);
|
|
237
237
|
if (!isFolder) {
|
|
238
238
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidFetchFolderRequest`, {
|
|
@@ -240,7 +240,7 @@ async function fetchFolderFromApi(accountId, src, mode, options = {}) {
|
|
|
240
240
|
}));
|
|
241
241
|
}
|
|
242
242
|
const srcPath = isRoot ? '@root' : src;
|
|
243
|
-
const queryValues = getFileMapperQueryValues(
|
|
243
|
+
const queryValues = getFileMapperQueryValues(cmsPublishMode, options);
|
|
244
244
|
const { data: node } = isHubspot
|
|
245
245
|
? await (0, fileMapper_1.downloadDefault)(accountId, srcPath, queryValues)
|
|
246
246
|
: await (0, fileMapper_1.download)(accountId, srcPath, queryValues);
|
|
@@ -248,9 +248,9 @@ async function fetchFolderFromApi(accountId, src, mode, options = {}) {
|
|
|
248
248
|
return node;
|
|
249
249
|
}
|
|
250
250
|
exports.fetchFolderFromApi = fetchFolderFromApi;
|
|
251
|
-
async function downloadFolder(accountId, src, destPath,
|
|
251
|
+
async function downloadFolder(accountId, src, destPath, cmsPublishMode, options = {}) {
|
|
252
252
|
try {
|
|
253
|
-
const node = await fetchFolderFromApi(accountId, src,
|
|
253
|
+
const node = await fetchFolderFromApi(accountId, src, cmsPublishMode, options);
|
|
254
254
|
if (!node) {
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
@@ -261,7 +261,7 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
|
|
|
261
261
|
let success = true;
|
|
262
262
|
recurseFolder(node, (childNode, filepath) => {
|
|
263
263
|
queue.add(async () => {
|
|
264
|
-
const succeeded = await writeFileMapperNode(accountId, filepath || '', childNode,
|
|
264
|
+
const succeeded = await writeFileMapperNode(accountId, filepath || '', childNode, cmsPublishMode, options);
|
|
265
265
|
if (succeeded === false) {
|
|
266
266
|
success = false;
|
|
267
267
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchFile`, {
|
|
@@ -302,16 +302,16 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
|
|
|
302
302
|
* @param {FileMapperInputArguments} input
|
|
303
303
|
* @returns {Promise}
|
|
304
304
|
*/
|
|
305
|
-
async function downloadFileOrFolder(accountId, src, dest,
|
|
305
|
+
async function downloadFileOrFolder(accountId, src, dest, cmsPublishMode, options = {}) {
|
|
306
306
|
if (!src) {
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
309
|
const { isFile } = getTypeDataFromPath(src);
|
|
310
310
|
if (isFile) {
|
|
311
|
-
await downloadFile(accountId, src, dest,
|
|
311
|
+
await downloadFile(accountId, src, dest, cmsPublishMode, options);
|
|
312
312
|
}
|
|
313
313
|
else {
|
|
314
|
-
await downloadFolder(accountId, src, dest,
|
|
314
|
+
await downloadFolder(accountId, src, dest, cmsPublishMode, options);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
exports.downloadFileOrFolder = downloadFileOrFolder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/local-dev-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"eslint-plugin-import": "^2.29.1",
|
|
39
39
|
"husky": "^8.0.0",
|
|
40
40
|
"jest": "^29.5.0",
|
|
41
|
+
"open": "^8.4.2",
|
|
41
42
|
"ts-jest": "^29.0.5",
|
|
42
43
|
"ts-node": "^10.9.2",
|
|
43
44
|
"typescript": "^4.9.5",
|
package/types/Accounts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
|
|
2
|
-
import {
|
|
2
|
+
import { CmsPublishMode } from './Files';
|
|
3
3
|
import { Environment } from './Config';
|
|
4
4
|
import { ValueOf } from './Utils';
|
|
5
5
|
export type AuthType = 'personalaccesskey' | 'apikey' | 'oauth2';
|
|
@@ -7,7 +7,7 @@ export interface CLIAccount_NEW {
|
|
|
7
7
|
name?: string;
|
|
8
8
|
accountId: number;
|
|
9
9
|
accountType?: AccountType;
|
|
10
|
-
|
|
10
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
11
11
|
env: Environment;
|
|
12
12
|
authType?: AuthType;
|
|
13
13
|
auth?: {
|
|
@@ -21,7 +21,7 @@ export interface CLIAccount_NEW {
|
|
|
21
21
|
export interface CLIAccount_DEPRECATED {
|
|
22
22
|
name?: string;
|
|
23
23
|
portalId?: number;
|
|
24
|
-
|
|
24
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
25
25
|
env: Environment;
|
|
26
26
|
accountType?: AccountType;
|
|
27
27
|
authType?: AuthType;
|
package/types/Config.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ENVIRONMENTS } from '../constants/environments';
|
|
2
2
|
import { CLIAccount_NEW, CLIAccount_DEPRECATED } from './Accounts';
|
|
3
|
+
import { CmsPublishMode } from './Files';
|
|
3
4
|
import { ValueOf } from './Utils';
|
|
4
5
|
export interface CLIConfig_NEW {
|
|
5
6
|
accounts: Array<CLIAccount_NEW>;
|
|
6
7
|
allowUsageTracking?: boolean;
|
|
7
8
|
defaultAccount?: string | number;
|
|
8
|
-
defaultMode?:
|
|
9
|
+
defaultMode?: CmsPublishMode;
|
|
10
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
9
11
|
httpTimeout?: number;
|
|
10
12
|
env?: Environment;
|
|
11
13
|
httpUseLocalhost?: boolean;
|
|
@@ -14,7 +16,8 @@ export interface CLIConfig_DEPRECATED {
|
|
|
14
16
|
portals: Array<CLIAccount_DEPRECATED>;
|
|
15
17
|
allowUsageTracking?: boolean;
|
|
16
18
|
defaultPortal?: string | number;
|
|
17
|
-
defaultMode?:
|
|
19
|
+
defaultMode?: CmsPublishMode;
|
|
20
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
18
21
|
httpTimeout?: number;
|
|
19
22
|
env?: Environment;
|
|
20
23
|
httpUseLocalhost?: boolean;
|
package/types/Files.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValueOf } from '../types/Utils';
|
|
2
2
|
import { STAT_TYPES, FILE_TYPES, FILE_UPLOAD_RESULT_TYPES } from '../constants/files';
|
|
3
|
-
import {
|
|
3
|
+
import { CMS_PUBLISH_MODE } from '../constants/files';
|
|
4
4
|
import { HttpOptions } from './Http';
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
export type StatType = ValueOf<typeof STAT_TYPES>;
|
|
@@ -18,7 +18,7 @@ export type FileMapperNode = {
|
|
|
18
18
|
folder: boolean;
|
|
19
19
|
children: Array<FileMapperNode>;
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type CmsPublishMode = ValueOf<typeof CMS_PUBLISH_MODE>;
|
|
22
22
|
export type FileMapperOptions = Omit<HttpOptions, 'url'>;
|
|
23
23
|
export type FileMapperInputOptions = {
|
|
24
24
|
staging?: boolean;
|
|
@@ -66,7 +66,7 @@ export type UploadFileOptions = FileMapperInputOptions & {
|
|
|
66
66
|
fieldOptions?: string;
|
|
67
67
|
};
|
|
68
68
|
export type WatchOptions = {
|
|
69
|
-
|
|
69
|
+
cmsPublishMode?: CmsPublishMode;
|
|
70
70
|
remove?: boolean;
|
|
71
71
|
disableInitial?: boolean;
|
|
72
72
|
notify?: string;
|