@hubspot/local-dev-lib 2.1.0 → 2.1.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.
@@ -20,17 +20,16 @@ declare class _CLIConfiguration {
20
20
  getAccountId(nameOrId?: string | number): number | null;
21
21
  getDefaultAccount(): string | number | null;
22
22
  getResolvedDefaultAccountForCWD(nameOrId: string | number): CLIAccount_NEW | null;
23
- getAccountIndex(accountId: number): number;
23
+ getConfigAccountIndex(accountId: number): number;
24
24
  getConfigForAccount(accountId?: number): CLIAccount_NEW | null;
25
- getConfigAccounts(): Array<CLIAccount_NEW> | null;
26
25
  isAccountInConfig(nameOrId: string | number): boolean;
27
26
  getAndLoadConfigIfNeeded(options?: CLIOptions): CLIConfig_NEW;
28
27
  getEnv(nameOrId?: string | number): Environment;
29
- getAccountType(accountType?: AccountType | null, sandboxAccountType?: string | null): AccountType;
28
+ getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
30
29
  /**
31
30
  * @throws {Error}
32
31
  */
33
- addOrUpdateAccount(updatedAccountFields: Partial<FlatAccountFields_NEW>, writeUpdate?: boolean): FlatAccountFields_NEW | null;
32
+ updateAccount(updatedAccountFields: Partial<FlatAccountFields_NEW>, writeUpdate?: boolean): FlatAccountFields_NEW | null;
34
33
  /**
35
34
  * @throws {Error}
36
35
  */
@@ -116,7 +116,7 @@ class _CLIConfiguration {
116
116
  return false;
117
117
  }
118
118
  if (accountConfig.name) {
119
- if (accountNamesMap[accountConfig.name.toLowerCase()]) {
119
+ if (accountNamesMap[accountConfig.name]) {
120
120
  logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.validate.duplicateAccountNames`, {
121
121
  accountName: accountConfig.name,
122
122
  }));
@@ -131,7 +131,7 @@ class _CLIConfiguration {
131
131
  accountNamesMap[accountConfig.name] = true;
132
132
  }
133
133
  if (!accountConfig.accountType) {
134
- this.addOrUpdateAccount({
134
+ this.updateAccount({
135
135
  ...accountConfig,
136
136
  accountId: accountConfig.accountId,
137
137
  accountType: this.getAccountType(undefined, accountConfig.sandboxAccountType),
@@ -194,30 +194,19 @@ class _CLIConfiguration {
194
194
  getResolvedDefaultAccountForCWD(nameOrId) {
195
195
  return this.getAccount(nameOrId);
196
196
  }
197
- getAccountIndex(accountId) {
197
+ getConfigAccountIndex(accountId) {
198
198
  return this.config
199
199
  ? this.config.accounts.findIndex(account => account.accountId === accountId)
200
200
  : -1;
201
201
  }
202
202
  getConfigForAccount(accountId) {
203
203
  if (this.config) {
204
- return (this.config.accounts.find(account => account.accountId === accountId) ||
205
- null);
206
- }
207
- return null;
208
- }
209
- getConfigAccounts() {
210
- if (this.config) {
211
- return this.config.accounts || null;
204
+ this.config.accounts.find(account => account.accountId === accountId) ||
205
+ null;
212
206
  }
213
207
  return null;
214
208
  }
215
209
  isAccountInConfig(nameOrId) {
216
- if (typeof nameOrId === 'string') {
217
- return (!!this.config &&
218
- this.config.accounts &&
219
- !!this.getAccountId(nameOrId.toLowerCase()));
220
- }
221
210
  return (!!this.config && this.config.accounts && !!this.getAccountId(nameOrId));
222
211
  }
223
212
  getAndLoadConfigIfNeeded(options) {
@@ -257,7 +246,7 @@ class _CLIConfiguration {
257
246
  /**
258
247
  * @throws {Error}
259
248
  */
260
- addOrUpdateAccount(updatedAccountFields, writeUpdate = true) {
249
+ updateAccount(updatedAccountFields, writeUpdate = true) {
261
250
  const { accountId, accountType, apiKey, authType, clientId, clientSecret, defaultMode, env, name, parentAccountId, personalAccessKey, sandboxAccountType, scopes, tokenInfo, } = updatedAccountFields;
262
251
  if (!accountId) {
263
252
  throw new Error((0, lang_1.i18n)(`${i18nKey}.updateAccount.errors.accountIdRequired`));
@@ -266,11 +255,8 @@ class _CLIConfiguration {
266
255
  logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.noConfigToUpdate`));
267
256
  return null;
268
257
  }
269
- // Check whether the account is already listed in the config.yml file.
270
258
  const currentAccountConfig = this.getAccount(accountId);
271
- // For accounts that are already in the config.yml file, sets the auth property.
272
259
  let auth = (currentAccountConfig && currentAccountConfig.auth) || {};
273
- // For accounts not already in the config.yml file, sets the auth property.
274
260
  if (clientId || clientSecret || scopes || tokenInfo) {
275
261
  auth = {
276
262
  ...(currentAccountConfig ? currentAccountConfig.auth : {}),
@@ -293,7 +279,6 @@ class _CLIConfiguration {
293
279
  }
294
280
  const updatedEnv = (0, environment_2.getValidEnv)(env || (currentAccountConfig && currentAccountConfig.env));
295
281
  const updatedDefaultMode = defaultMode && defaultMode.toLowerCase();
296
- const updatedAccountType = accountType || (currentAccountConfig && currentAccountConfig.accountType);
297
282
  safelyApplyUpdates('name', name);
298
283
  safelyApplyUpdates('env', updatedEnv);
299
284
  safelyApplyUpdates('accountId', accountId);
@@ -309,29 +294,24 @@ class _CLIConfiguration {
309
294
  safelyApplyUpdates('personalAccessKey', personalAccessKey);
310
295
  // Deprecating sandboxAccountType in favor of the more generic accountType
311
296
  safelyApplyUpdates('sandboxAccountType', sandboxAccountType);
312
- safelyApplyUpdates('accountType', this.getAccountType(updatedAccountType, sandboxAccountType));
297
+ safelyApplyUpdates('accountType', this.getAccountType(accountType, sandboxAccountType));
313
298
  safelyApplyUpdates('parentAccountId', parentAccountId);
314
299
  const completedAccountConfig = nextAccountConfig;
315
- if (!Object.hasOwn(this.config, 'accounts')) {
316
- this.config.accounts = [];
317
- }
318
300
  if (currentAccountConfig) {
319
301
  logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.updating`, {
320
302
  accountId,
321
303
  }));
322
- const index = this.getAccountIndex(accountId);
323
- if (index < 0) {
304
+ const index = this.getConfigAccountIndex(accountId);
305
+ this.config.accounts[index] = completedAccountConfig;
306
+ logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.addingConfigEntry`, {
307
+ accountId,
308
+ }));
309
+ if (this.config.accounts) {
324
310
  this.config.accounts.push(completedAccountConfig);
325
311
  }
326
312
  else {
327
- this.config.accounts[index] = completedAccountConfig;
313
+ this.config.accounts = [completedAccountConfig];
328
314
  }
329
- logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.updateAccount.addingConfigEntry`, {
330
- accountId,
331
- }));
332
- }
333
- else {
334
- this.config.accounts.push(completedAccountConfig);
335
315
  }
336
316
  if (writeUpdate) {
337
317
  this.write();
@@ -370,12 +350,7 @@ class _CLIConfiguration {
370
350
  }));
371
351
  }
372
352
  if (accountId) {
373
- this.addOrUpdateAccount({
374
- accountId,
375
- name: newName,
376
- env: this.getEnv(),
377
- accountType: accountConfigToRename.accountType,
378
- });
353
+ this.updateAccount({ accountId, name: newName, env: this.getEnv() });
379
354
  }
380
355
  if (accountConfigToRename.name === this.getDefaultAccount()) {
381
356
  this.updateDefaultAccount(newName);
@@ -399,7 +374,7 @@ class _CLIConfiguration {
399
374
  const accountConfig = this.getAccount(accountId);
400
375
  if (accountConfig) {
401
376
  logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.removeAccountFromConfig.deleting`, { accountId }));
402
- const index = this.getAccountIndex(accountId);
377
+ const index = this.getConfigAccountIndex(accountId);
403
378
  this.config.accounts.splice(index, 1);
404
379
  if (this.getDefaultAccount() === accountConfig.name) {
405
380
  removedAccountIsDefault = true;
package/config/index.d.ts CHANGED
@@ -1,20 +1,18 @@
1
1
  import * as config_DEPRECATED from './config_DEPRECATED';
2
- import { CLIConfig_NEW, CLIConfig } from '../types/Config';
2
+ import { CLIConfig } from '../types/Config';
3
3
  import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
4
- import { AccountType, CLIAccount, CLIAccount_NEW, CLIAccount_DEPRECATED, FlatAccountFields } from '../types/Accounts';
5
- import { Mode } from '../types/Files';
4
+ import { AccountType, CLIAccount, FlatAccountFields } from '../types/Accounts';
6
5
  export declare function loadConfig(path: string, options?: CLIOptions): CLIConfig | null;
7
6
  export declare function getAndLoadConfigIfNeeded(options?: CLIOptions): Partial<CLIConfig> | null;
8
7
  export declare function validateConfig(): boolean;
9
8
  export declare function loadConfigFromEnvironment(): boolean;
10
9
  export declare function createEmptyConfigFile(options?: {
11
10
  path?: string;
12
- }, useHiddenConfig?: boolean): void;
11
+ }, useRootConfig?: boolean): void;
13
12
  export declare function deleteEmptyConfigFile(): void;
14
13
  export declare function getConfig(): CLIConfig | null;
15
14
  export declare function writeConfig(options?: WriteConfigOptions): void;
16
- export declare function getConfigPath(path?: string, useHiddenConfig?: boolean): string | null;
17
- export declare function configFileExists(useHiddenConfig?: boolean): boolean;
15
+ export declare function getConfigPath(path?: string): string | null;
18
16
  export declare function getAccountConfig(accountId?: number): CLIAccount | null;
19
17
  export declare function accountNameExistsInConfig(name: string): boolean;
20
18
  export declare function updateAccountConfig(configOptions: Partial<FlatAccountFields>): FlatAccountFields | null;
@@ -30,12 +28,12 @@ export declare function isConfigFlagEnabled(flag: keyof CLIConfig): boolean;
30
28
  export declare function isTrackingAllowed(): boolean;
31
29
  export declare function getEnv(nameOrId?: string | number): import("../types/Config").Environment;
32
30
  export declare function getAccountType(accountType?: AccountType, sandboxAccountType?: string | null): AccountType;
33
- export declare function getDefaultAccount(): string | number | null | undefined;
34
- export declare function getAccounts(): Array<CLIAccount_NEW> | Array<CLIAccount_DEPRECATED> | null | undefined;
35
- export declare function updateDefaultMode(mode: Mode): void | CLIConfig_NEW | null;
31
+ export declare const getConfigAccounts: typeof config_DEPRECATED.getConfigAccounts;
32
+ export declare const getConfigDefaultAccount: typeof config_DEPRECATED.getConfigDefaultAccount;
36
33
  export declare const getConfigAccountId: typeof config_DEPRECATED.getConfigAccountId;
37
34
  export declare const getOrderedAccount: typeof config_DEPRECATED.getOrderedAccount;
38
35
  export declare const getOrderedConfig: typeof config_DEPRECATED.getOrderedConfig;
39
36
  export declare const setConfig: typeof config_DEPRECATED.setConfig;
40
37
  export declare const setConfigPath: typeof config_DEPRECATED.setConfigPath;
41
38
  export declare const findConfig: typeof config_DEPRECATED.findConfig;
39
+ export declare const updateDefaultMode: typeof config_DEPRECATED.updateDefaultMode;
package/config/index.js CHANGED
@@ -23,11 +23,11 @@ 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.updateDefaultMode = exports.getAccounts = exports.getDefaultAccount = 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;
26
+ exports.updateDefaultMode = exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.getConfigDefaultAccount = exports.getConfigAccounts = 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.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");
30
- const getAccountIdentifier_1 = require("./getAccountIdentifier");
30
+ const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
31
31
  // Use new config if it exists
32
32
  function loadConfig(path, options = {}) {
33
33
  // Attempt to load the root config
@@ -58,8 +58,8 @@ function loadConfigFromEnvironment() {
58
58
  return Boolean(config_DEPRECATED.loadConfigFromEnvironment());
59
59
  }
60
60
  exports.loadConfigFromEnvironment = loadConfigFromEnvironment;
61
- function createEmptyConfigFile(options = {}, useHiddenConfig = false) {
62
- if (useHiddenConfig) {
61
+ function createEmptyConfigFile(options = {}, useRootConfig = false) {
62
+ if (useRootConfig) {
63
63
  CLIConfiguration_1.CLIConfiguration.write({ accounts: [] });
64
64
  }
65
65
  else {
@@ -93,19 +93,13 @@ function writeConfig(options = {}) {
93
93
  }
94
94
  }
95
95
  exports.writeConfig = writeConfig;
96
- function getConfigPath(path, useHiddenConfig = false) {
97
- if (useHiddenConfig || CLIConfiguration_1.CLIConfiguration.isActive()) {
96
+ function getConfigPath(path) {
97
+ if (CLIConfiguration_1.CLIConfiguration.isActive()) {
98
98
  return (0, configFile_1.getConfigFilePath)();
99
99
  }
100
100
  return config_DEPRECATED.getConfigPath(path);
101
101
  }
102
102
  exports.getConfigPath = getConfigPath;
103
- function configFileExists(useHiddenConfig) {
104
- return useHiddenConfig
105
- ? (0, configFile_1.configFileExists)()
106
- : Boolean(config_DEPRECATED.getConfigPath());
107
- }
108
- exports.configFileExists = configFileExists;
109
103
  function getAccountConfig(accountId) {
110
104
  if (CLIConfiguration_1.CLIConfiguration.isActive()) {
111
105
  return CLIConfiguration_1.CLIConfiguration.getConfigForAccount(accountId);
@@ -123,7 +117,7 @@ exports.accountNameExistsInConfig = accountNameExistsInConfig;
123
117
  function updateAccountConfig(configOptions) {
124
118
  const accountIdentifier = (0, getAccountIdentifier_1.getAccountIdentifier)(configOptions);
125
119
  if (CLIConfiguration_1.CLIConfiguration.isActive()) {
126
- return CLIConfiguration_1.CLIConfiguration.addOrUpdateAccount({
120
+ return CLIConfiguration_1.CLIConfiguration.updateAccount({
127
121
  ...configOptions,
128
122
  accountId: accountIdentifier,
129
123
  });
@@ -230,31 +224,13 @@ function getAccountType(accountType, sandboxAccountType) {
230
224
  return config_DEPRECATED.getAccountType(accountType, sandboxAccountType);
231
225
  }
232
226
  exports.getAccountType = getAccountType;
233
- function getDefaultAccount() {
234
- if (CLIConfiguration_1.CLIConfiguration.isActive()) {
235
- return CLIConfiguration_1.CLIConfiguration.getDefaultAccount();
236
- }
237
- return config_DEPRECATED.getConfigDefaultAccount();
238
- }
239
- exports.getDefaultAccount = getDefaultAccount;
240
- function getAccounts() {
241
- if (CLIConfiguration_1.CLIConfiguration.isActive()) {
242
- return CLIConfiguration_1.CLIConfiguration.getConfigAccounts();
243
- }
244
- return config_DEPRECATED.getConfigAccounts();
245
- }
246
- exports.getAccounts = getAccounts;
247
- function updateDefaultMode(mode) {
248
- if (CLIConfiguration_1.CLIConfiguration.isActive()) {
249
- return CLIConfiguration_1.CLIConfiguration.updateDefaultMode(mode);
250
- }
251
- return config_DEPRECATED.updateDefaultMode(mode);
252
- }
253
- exports.updateDefaultMode = updateDefaultMode;
254
- // These functions are not supported with the new config setup
227
+ // These functions are either not supported or have breaking changes with the new config setup
228
+ exports.getConfigAccounts = config_DEPRECATED.getConfigAccounts;
229
+ exports.getConfigDefaultAccount = config_DEPRECATED.getConfigDefaultAccount;
255
230
  exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;
256
231
  exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;
257
232
  exports.getOrderedConfig = config_DEPRECATED.getOrderedConfig;
258
233
  exports.setConfig = config_DEPRECATED.setConfig;
259
234
  exports.setConfigPath = config_DEPRECATED.setConfigPath;
260
235
  exports.findConfig = config_DEPRECATED.findConfig;
236
+ exports.updateDefaultMode = config_DEPRECATED.updateDefaultMode;
@@ -1,5 +1,5 @@
1
1
  export declare const DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = "hubspot.config.yml";
2
- export declare const HUBSPOT_CONFIGURATION_FOLDER = ".hubspot-cli";
2
+ export declare const HUBSPOT_CONFIGURATION_FOLDER = ".hubspot";
3
3
  export declare const HUBSPOT_CONFIGURATION_FILE = "config.yml";
4
4
  export declare const MIN_HTTP_TIMEOUT = 3000;
5
5
  export declare const HUBSPOT_ACCOUNT_TYPES: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HUBSPOT_ACCOUNT_TYPE_STRINGS = exports.HUBSPOT_ACCOUNT_TYPES = exports.MIN_HTTP_TIMEOUT = exports.HUBSPOT_CONFIGURATION_FILE = exports.HUBSPOT_CONFIGURATION_FOLDER = exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = void 0;
4
4
  const lang_1 = require("../utils/lang");
5
5
  exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = 'hubspot.config.yml';
6
- exports.HUBSPOT_CONFIGURATION_FOLDER = '.hubspot-cli';
6
+ exports.HUBSPOT_CONFIGURATION_FOLDER = '.hubspot';
7
7
  exports.HUBSPOT_CONFIGURATION_FILE = 'config.yml';
8
8
  exports.MIN_HTTP_TIMEOUT = 3000;
9
9
  exports.HUBSPOT_ACCOUNT_TYPES = {
package/lib/oauth.js CHANGED
@@ -4,7 +4,7 @@ exports.addOauthToAccountConfig = exports.getOauthManager = void 0;
4
4
  const OAuth2Manager_1 = require("../models/OAuth2Manager");
5
5
  const auth_1 = require("../constants/auth");
6
6
  const logger_1 = require("./logger");
7
- const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
7
+ const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
8
8
  const config_1 = require("../config");
9
9
  const lang_1 = require("../utils/lang");
10
10
  const i18nKey = 'lib.oauth';
@@ -13,7 +13,6 @@ const config_1 = require("../config");
13
13
  const config_2 = require("../constants/config");
14
14
  const developerTestAccounts_1 = require("../api/developerTestAccounts");
15
15
  const logger_1 = require("./logger");
16
- const CLIConfiguration_1 = require("../config/CLIConfiguration");
17
16
  const lang_1 = require("../utils/lang");
18
17
  const errors_1 = require("../errors");
19
18
  const i18nKey = 'lib.personalAccessKey';
@@ -142,7 +141,7 @@ async function updateConfigWithAccessToken(token, personalAccessKey, env, name,
142
141
  }
143
142
  logger_1.logger.debug(err);
144
143
  }
145
- const updatedAccount = (0, config_1.updateAccountConfig)({
144
+ const updatedConfig = (0, config_1.updateAccountConfig)({
146
145
  accountId: portalId,
147
146
  accountType,
148
147
  personalAccessKey,
@@ -152,12 +151,10 @@ async function updateConfigWithAccessToken(token, personalAccessKey, env, name,
152
151
  parentAccountId,
153
152
  env: accountEnv,
154
153
  });
155
- if (!CLIConfiguration_1.CLIConfiguration.isActive()) {
156
- (0, config_1.writeConfig)();
157
- }
154
+ (0, config_1.writeConfig)();
158
155
  if (makeDefault && name) {
159
156
  (0, config_1.updateDefaultAccount)(name);
160
157
  }
161
- return updatedAccount;
158
+ return updatedConfig;
162
159
  }
163
160
  exports.updateConfigWithAccessToken = updateConfigWithAccessToken;
@@ -9,7 +9,7 @@ const moment_1 = __importDefault(require("moment"));
9
9
  const urls_1 = require("../lib/urls");
10
10
  const environment_1 = require("../lib/environment");
11
11
  const logger_1 = require("../lib/logger");
12
- const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
12
+ const getAccountIdentifier_1 = require("../utils/getAccountIdentifier");
13
13
  const auth_1 = require("../constants/auth");
14
14
  const lang_1 = require("../utils/lang");
15
15
  const i18nKey = 'models.OAuth2Manager';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -53,7 +53,6 @@
53
53
  "./errors/*": "./errors/*.js",
54
54
  "./http": "./http/index.js",
55
55
  "./http/*": "./http/*.js",
56
- "./config/getAccountIdentifier": "./config/getAccountIdentifier.js",
57
56
  "./config": "./config/index.js",
58
57
  "./constants/*": "./constants/*.js",
59
58
  "./models/*": "./models/*.js",
@@ -1,4 +1,5 @@
1
- import { CLIAccount } from '../types/Accounts';
1
+ import { CLIAccount, GenericAccount } from '../types/Accounts';
2
2
  import { CLIConfig } from '../types/Config';
3
+ export declare function getAccountIdentifier(account?: GenericAccount | null): number | undefined;
3
4
  export declare function getAccounts(config?: CLIConfig | null): Array<CLIAccount>;
4
5
  export declare function getDefaultAccount(config?: CLIConfig | null): string | number | undefined;
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultAccount = exports.getAccounts = void 0;
3
+ exports.getDefaultAccount = exports.getAccounts = exports.getAccountIdentifier = void 0;
4
+ function getAccountIdentifier(account) {
5
+ if (!account) {
6
+ return undefined;
7
+ }
8
+ else if (Object.hasOwn(account, 'portalId')) {
9
+ return account.portalId;
10
+ }
11
+ else if (Object.hasOwn(account, 'accountId')) {
12
+ return account.accountId;
13
+ }
14
+ }
15
+ exports.getAccountIdentifier = getAccountIdentifier;
4
16
  function getAccounts(config) {
5
17
  if (!config) {
6
18
  return [];
@@ -1,2 +0,0 @@
1
- import { GenericAccount } from '../types/Accounts';
2
- export declare function getAccountIdentifier(account?: GenericAccount | null): number | undefined;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountIdentifier = void 0;
4
- function getAccountIdentifier(account) {
5
- if (!account) {
6
- return undefined;
7
- }
8
- else if (Object.hasOwn(account, 'portalId')) {
9
- return account.portalId;
10
- }
11
- else if (Object.hasOwn(account, 'accountId')) {
12
- return account.accountId;
13
- }
14
- }
15
- exports.getAccountIdentifier = getAccountIdentifier;