@salesforce/core 3.25.0 → 3.26.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/CHANGELOG.md +18 -0
- package/lib/config/config.js +7 -0
- package/lib/exported.d.ts +1 -1
- package/lib/exported.js +2 -4
- package/lib/org/orgConfigProperties.js +5 -0
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +3 -86
- package/lib/stateAggregator/accessors/aliasAccessor.js +1 -117
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +1 -16
- package/lib/stateAggregator/accessors/orgAccessor.js +1 -37
- package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +0 -39
- package/lib/stateAggregator/accessors/sandboxAccessor.js +1 -55
- package/lib/stateAggregator/accessors/tokenAccessor.d.ts +12 -18
- package/lib/stateAggregator/accessors/tokenAccessor.js +2 -30
- package/lib/stateAggregator/index.d.ts +3 -6
- package/lib/stateAggregator/index.js +3 -13
- package/lib/testSetup.js +0 -2
- package/messages/config.md +8 -0
- package/package.json +2 -2
- package/lib/stateAggregator/globalInfoConfig.d.ts +0 -41
- package/lib/stateAggregator/globalInfoConfig.js +0 -113
- package/lib/stateAggregator/sfdxDataHandler.d.ts +0 -59
- package/lib/stateAggregator/sfdxDataHandler.js +0 -328
- package/lib/stateAggregator/types.d.ts +0 -72
- package/lib/stateAggregator/types.js +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.26.1](https://github.com/forcedotcom/sfdx-core/compare/v3.26.0...v3.26.1) (2022-08-08)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- update jsforce ([0353330](https://github.com/forcedotcom/sfdx-core/commit/03533307f0ea1f8877027a5619c970e1ae2443ec))
|
|
10
|
+
|
|
11
|
+
## [3.26.0](https://github.com/forcedotcom/sfdx-core/compare/v3.25.1...v3.26.0) (2022-08-04)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- remove GlobalInfo ([57bd0fa](https://github.com/forcedotcom/sfdx-core/commit/57bd0fa50c5fe3cc859ca107fd0a18dc1b871c1f))
|
|
16
|
+
|
|
17
|
+
### [3.25.1](https://github.com/forcedotcom/sfdx-core/compare/v3.25.0...v3.25.1) (2022-08-03)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- add interop between templates config/env var ([eea3d05](https://github.com/forcedotcom/sfdx-core/commit/eea3d055b75ceb61639e06bc53e309a01f70a8e2))
|
|
22
|
+
|
|
5
23
|
## [3.25.0](https://github.com/forcedotcom/sfdx-core/compare/v3.24.5...v3.25.0) (2022-07-29)
|
|
6
24
|
|
|
7
25
|
### Features
|
package/lib/config/config.js
CHANGED
|
@@ -40,6 +40,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
|
|
|
40
40
|
'restDeploy',
|
|
41
41
|
'instanceUrl',
|
|
42
42
|
'disable-telemetry',
|
|
43
|
+
'customOrgMetadataTemplates',
|
|
43
44
|
]);
|
|
44
45
|
const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
|
|
45
46
|
const CONFIG_FILE_NAME = 'config.json';
|
|
@@ -200,6 +201,12 @@ exports.SFDX_ALLOWED_PROPERTIES = [
|
|
|
200
201
|
failedMessage: messages.getMessage('invalidBooleanConfigValue'),
|
|
201
202
|
},
|
|
202
203
|
},
|
|
204
|
+
{
|
|
205
|
+
key: SfdxPropertyKeys.CUSTOM_ORG_METADATA_TEMPLATES,
|
|
206
|
+
newKey: orgConfigProperties_1.OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES,
|
|
207
|
+
deprecated: true,
|
|
208
|
+
description: messages.getMessage(SfdxPropertyKeys.CUSTOM_ORG_METADATA_TEMPLATES),
|
|
209
|
+
},
|
|
203
210
|
{
|
|
204
211
|
key: SfdxPropertyKeys.REST_DEPLOY,
|
|
205
212
|
description: messages.getMessage(SfdxPropertyKeys.REST_DEPLOY),
|
package/lib/exported.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { ConfigFile } from './config/configFile';
|
|
|
3
3
|
export { TTLConfig } from './config/ttlConfig';
|
|
4
4
|
export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from './config/envVars';
|
|
5
5
|
export { ConfigContents, ConfigEntry, ConfigStore, ConfigValue } from './config/configStore';
|
|
6
|
-
export {
|
|
6
|
+
export { SfTokens, StateAggregator } from './stateAggregator';
|
|
7
7
|
export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } from './deviceOauthService';
|
|
8
8
|
export { OrgUsersConfig } from './config/orgUsersConfig';
|
|
9
9
|
export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SfConfigProperties, SFDX_ALLOWED_PROPERTIES, SF_ALLOWED_PROPERTIES, } from './config/config';
|
package/lib/exported.js
CHANGED
|
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.SfdxConfigAggregator = exports.ConfigAggregator = exports.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.StateAggregator = exports.
|
|
20
|
-
exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment =
|
|
19
|
+
exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.SfdxConfigAggregator = exports.ConfigAggregator = exports.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.StateAggregator = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
|
|
20
|
+
exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment = void 0;
|
|
21
21
|
const messages_1 = require("./messages");
|
|
22
22
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
23
23
|
var configFile_1 = require("./config/configFile");
|
|
@@ -30,8 +30,6 @@ Object.defineProperty(exports, "EnvironmentVariable", { enumerable: true, get: f
|
|
|
30
30
|
Object.defineProperty(exports, "SUPPORTED_ENV_VARS", { enumerable: true, get: function () { return envVars_1.SUPPORTED_ENV_VARS; } });
|
|
31
31
|
Object.defineProperty(exports, "EnvVars", { enumerable: true, get: function () { return envVars_1.EnvVars; } });
|
|
32
32
|
var stateAggregator_1 = require("./stateAggregator");
|
|
33
|
-
Object.defineProperty(exports, "GlobalInfo", { enumerable: true, get: function () { return stateAggregator_1.GlobalInfo; } });
|
|
34
|
-
Object.defineProperty(exports, "SfInfoKeys", { enumerable: true, get: function () { return stateAggregator_1.SfInfoKeys; } });
|
|
35
33
|
Object.defineProperty(exports, "StateAggregator", { enumerable: true, get: function () { return stateAggregator_1.StateAggregator; } });
|
|
36
34
|
var deviceOauthService_1 = require("./deviceOauthService");
|
|
37
35
|
Object.defineProperty(exports, "DeviceOauthService", { enumerable: true, get: function () { return deviceOauthService_1.DeviceOauthService; } });
|
|
@@ -27,6 +27,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
|
|
|
27
27
|
'org-max-query-limit',
|
|
28
28
|
'target-dev-hub',
|
|
29
29
|
'target-org',
|
|
30
|
+
'org-custom-metadata-templates',
|
|
30
31
|
]);
|
|
31
32
|
var OrgConfigProperties;
|
|
32
33
|
(function (OrgConfigProperties) {
|
|
@@ -64,6 +65,10 @@ var OrgConfigProperties;
|
|
|
64
65
|
OrgConfigProperties["ORG_ISV_DEBUGGER_URL"] = "org-isv-debugger-url";
|
|
65
66
|
})(OrgConfigProperties = exports.OrgConfigProperties || (exports.OrgConfigProperties = {}));
|
|
66
67
|
exports.ORG_CONFIG_ALLOWED_PROPERTIES = [
|
|
68
|
+
{
|
|
69
|
+
key: OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES,
|
|
70
|
+
description: messages.getMessage(OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES),
|
|
71
|
+
},
|
|
67
72
|
{
|
|
68
73
|
key: OrgConfigProperties.TARGET_ORG,
|
|
69
74
|
description: messages.getMessage(OrgConfigProperties.TARGET_ORG),
|
|
@@ -1,91 +1,8 @@
|
|
|
1
1
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
2
|
import { Nullable } from '@salesforce/ts-types';
|
|
3
|
-
import { ConfigContents } from '../../exported';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare type Aliasable = string | Partial<SfOrg> | Partial<SfToken>;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
export declare class GlobalInfoAliasAccessor {
|
|
11
|
-
private globalInfo;
|
|
12
|
-
constructor(globalInfo: GlobalInfo);
|
|
13
|
-
/**
|
|
14
|
-
* Returns all the aliases for all the values
|
|
15
|
-
*/
|
|
16
|
-
getAll(): SfAliases;
|
|
17
|
-
/**
|
|
18
|
-
* Returns all the aliases for a given entity
|
|
19
|
-
*
|
|
20
|
-
* @param entity the aliasable entity that you want to get the aliases of
|
|
21
|
-
*/
|
|
22
|
-
getAll(entity: Aliasable): string[];
|
|
23
|
-
/**
|
|
24
|
-
* Returns the first alias found for a given entity
|
|
25
|
-
*
|
|
26
|
-
* @param entity the aliasable entity that you want to get the alias of
|
|
27
|
-
*/
|
|
28
|
-
get(entity: Aliasable): Nullable<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the value that corresponds to the given alias if it exists
|
|
31
|
-
*
|
|
32
|
-
* @param alias the alias that corresponds to a value
|
|
33
|
-
*/
|
|
34
|
-
getValue(alias: string): Nullable<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the username that corresponds to the given alias if it exists
|
|
37
|
-
*
|
|
38
|
-
* @param alias the alias that corresponds to a username
|
|
39
|
-
*/
|
|
40
|
-
getUsername(alias: string): Nullable<string>;
|
|
41
|
-
/**
|
|
42
|
-
* If the provided string is an alias, it returns the corresponding value.
|
|
43
|
-
* If the provided string is not an alias, we assume that the provided string
|
|
44
|
-
* is the value and return it.
|
|
45
|
-
*
|
|
46
|
-
* This method is helpful when you don't know if the string you have is a value
|
|
47
|
-
* or an alias.
|
|
48
|
-
*
|
|
49
|
-
* @param valueOrAlias a string that might be a value or might be an alias
|
|
50
|
-
*/
|
|
51
|
-
resolveValue(valueOrAlias: string): string;
|
|
52
|
-
/**
|
|
53
|
-
* If the provided string is an alias, it returns the corresponding username.
|
|
54
|
-
* If the provided string is not an alias, we assume that the provided string
|
|
55
|
-
* is the username and return it.
|
|
56
|
-
*
|
|
57
|
-
* This method is helpful when you don't know if the string you have is a username
|
|
58
|
-
* or an alias.
|
|
59
|
-
*
|
|
60
|
-
* @param usernameOrAlias a string that might be a username or might be an alias
|
|
61
|
-
*/
|
|
62
|
-
resolveUsername(usernameOrAlias: string): string;
|
|
63
|
-
/**
|
|
64
|
-
* Set an alias for the given aliasable entity
|
|
65
|
-
*
|
|
66
|
-
* @param alias the alias you want to set
|
|
67
|
-
* @param entity the aliasable entity that's being aliased
|
|
68
|
-
*/
|
|
69
|
-
set(alias: string, entity: Aliasable): void;
|
|
70
|
-
/**
|
|
71
|
-
* Updates the alias for the given aliasable entity
|
|
72
|
-
*
|
|
73
|
-
* @param alias the alias you want to set
|
|
74
|
-
* @param entity the aliasable entity that's being aliased
|
|
75
|
-
*/
|
|
76
|
-
update(alias: string, entity: Aliasable): void;
|
|
77
|
-
unset(alias: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* This method unsets all the aliases for the given entity.
|
|
80
|
-
*
|
|
81
|
-
* @param entity the aliasable entity for which you want to unset all aliases
|
|
82
|
-
*/
|
|
83
|
-
unsetAll(entity: Aliasable): void;
|
|
84
|
-
/**
|
|
85
|
-
* Returns the username of given aliasable entity
|
|
86
|
-
*/
|
|
87
|
-
private getNameOf;
|
|
88
|
-
}
|
|
3
|
+
import { AuthFields, ConfigContents } from '../../exported';
|
|
4
|
+
import { SfToken } from './tokenAccessor';
|
|
5
|
+
export declare type Aliasable = string | (Partial<AuthFields> & Partial<SfToken>);
|
|
89
6
|
export declare class AliasAccessor extends AsyncOptionalCreatable {
|
|
90
7
|
private config;
|
|
91
8
|
/**
|
|
@@ -6,126 +6,10 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AliasAccessor =
|
|
9
|
+
exports.AliasAccessor = void 0;
|
|
10
10
|
const kit_1 = require("@salesforce/kit");
|
|
11
11
|
const aliasesConfig_1 = require("../../config/aliasesConfig");
|
|
12
12
|
const sfError_1 = require("../../sfError");
|
|
13
|
-
const types_1 = require("../types");
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
class GlobalInfoAliasAccessor {
|
|
18
|
-
constructor(globalInfo) {
|
|
19
|
-
this.globalInfo = globalInfo;
|
|
20
|
-
}
|
|
21
|
-
getAll(entity) {
|
|
22
|
-
const all = this.globalInfo.get(types_1.SfInfoKeys.ALIASES) || {};
|
|
23
|
-
if (entity) {
|
|
24
|
-
const value = this.getNameOf(entity);
|
|
25
|
-
return Object.entries(all)
|
|
26
|
-
.filter((entry) => entry[1] === value)
|
|
27
|
-
.map((entry) => entry[0]);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return all;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Returns the first alias found for a given entity
|
|
35
|
-
*
|
|
36
|
-
* @param entity the aliasable entity that you want to get the alias of
|
|
37
|
-
*/
|
|
38
|
-
get(entity) {
|
|
39
|
-
return this.getAll(entity).find((alias) => alias) ?? null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Returns the value that corresponds to the given alias if it exists
|
|
43
|
-
*
|
|
44
|
-
* @param alias the alias that corresponds to a value
|
|
45
|
-
*/
|
|
46
|
-
getValue(alias) {
|
|
47
|
-
return this.getAll()[alias] ?? null;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Returns the username that corresponds to the given alias if it exists
|
|
51
|
-
*
|
|
52
|
-
* @param alias the alias that corresponds to a username
|
|
53
|
-
*/
|
|
54
|
-
getUsername(alias) {
|
|
55
|
-
return this.getAll()[alias] ?? null;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* If the provided string is an alias, it returns the corresponding value.
|
|
59
|
-
* If the provided string is not an alias, we assume that the provided string
|
|
60
|
-
* is the value and return it.
|
|
61
|
-
*
|
|
62
|
-
* This method is helpful when you don't know if the string you have is a value
|
|
63
|
-
* or an alias.
|
|
64
|
-
*
|
|
65
|
-
* @param valueOrAlias a string that might be a value or might be an alias
|
|
66
|
-
*/
|
|
67
|
-
resolveValue(valueOrAlias) {
|
|
68
|
-
return this.getValue(valueOrAlias) ?? valueOrAlias;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* If the provided string is an alias, it returns the corresponding username.
|
|
72
|
-
* If the provided string is not an alias, we assume that the provided string
|
|
73
|
-
* is the username and return it.
|
|
74
|
-
*
|
|
75
|
-
* This method is helpful when you don't know if the string you have is a username
|
|
76
|
-
* or an alias.
|
|
77
|
-
*
|
|
78
|
-
* @param usernameOrAlias a string that might be a username or might be an alias
|
|
79
|
-
*/
|
|
80
|
-
resolveUsername(usernameOrAlias) {
|
|
81
|
-
return this.getUsername(usernameOrAlias) ?? usernameOrAlias;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Set an alias for the given aliasable entity
|
|
85
|
-
*
|
|
86
|
-
* @param alias the alias you want to set
|
|
87
|
-
* @param entity the aliasable entity that's being aliased
|
|
88
|
-
*/
|
|
89
|
-
set(alias, entity) {
|
|
90
|
-
const value = this.getNameOf(entity);
|
|
91
|
-
this.globalInfo.set(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`, value);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Updates the alias for the given aliasable entity
|
|
95
|
-
*
|
|
96
|
-
* @param alias the alias you want to set
|
|
97
|
-
* @param entity the aliasable entity that's being aliased
|
|
98
|
-
*/
|
|
99
|
-
update(alias, entity) {
|
|
100
|
-
const value = this.getNameOf(entity);
|
|
101
|
-
this.globalInfo.update(`${types_1.SfInfoKeys.ALIASES}["${alias}"]`, value);
|
|
102
|
-
}
|
|
103
|
-
unset(alias) {
|
|
104
|
-
delete this.globalInfo.get(types_1.SfInfoKeys.ALIASES)[alias];
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* This method unsets all the aliases for the given entity.
|
|
108
|
-
*
|
|
109
|
-
* @param entity the aliasable entity for which you want to unset all aliases
|
|
110
|
-
*/
|
|
111
|
-
unsetAll(entity) {
|
|
112
|
-
const aliases = this.getAll(entity);
|
|
113
|
-
aliases.forEach((alias) => this.unset(alias));
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Returns the username of given aliasable entity
|
|
117
|
-
*/
|
|
118
|
-
getNameOf(entity) {
|
|
119
|
-
if (typeof entity === 'string')
|
|
120
|
-
return entity;
|
|
121
|
-
const aliaseeName = entity.username ?? entity.user;
|
|
122
|
-
if (!aliaseeName) {
|
|
123
|
-
throw new sfError_1.SfError(`Invalid aliasee, it must contain a user or username property: ${JSON.stringify(entity)}`);
|
|
124
|
-
}
|
|
125
|
-
return aliaseeName;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.GlobalInfoAliasAccessor = GlobalInfoAliasAccessor;
|
|
129
13
|
class AliasAccessor extends kit_1.AsyncOptionalCreatable {
|
|
130
14
|
getAll(entity) {
|
|
131
15
|
// This will only return aliases under "orgs". This will need to be modified
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import { Nullable
|
|
3
|
+
import { Nullable } from '@salesforce/ts-types';
|
|
4
4
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
5
5
|
import { AuthInfoConfig } from '../../config/authInfoConfig';
|
|
6
|
-
import { GlobalInfo } from '../globalInfoConfig';
|
|
7
|
-
import { SfOrgs, SfOrg } from '../types';
|
|
8
6
|
import { AuthFields } from '../../org';
|
|
9
7
|
import { ConfigFile } from '../../config/configFile';
|
|
10
8
|
import { ConfigContents } from '../../config/configStore';
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
*/
|
|
14
|
-
export declare class GlobalInfoOrgAccessor {
|
|
15
|
-
private globalInfo;
|
|
16
|
-
constructor(globalInfo: GlobalInfo);
|
|
17
|
-
getAll(decrypt?: boolean): SfOrgs;
|
|
18
|
-
get(username: string, decrypt?: boolean): Optional<SfOrg>;
|
|
19
|
-
has(username: string): boolean;
|
|
20
|
-
set(username: string, org: SfOrg): void;
|
|
21
|
-
update(username: string, org: Partial<SfOrg>): void;
|
|
22
|
-
unset(username: string): void;
|
|
23
|
-
}
|
|
24
9
|
export declare abstract class BaseOrgAccessor<T extends ConfigFile, P extends ConfigContents> extends AsyncOptionalCreatable {
|
|
25
10
|
private configs;
|
|
26
11
|
private contents;
|
|
@@ -6,50 +6,14 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.OrgAccessor = exports.BaseOrgAccessor =
|
|
9
|
+
exports.OrgAccessor = exports.BaseOrgAccessor = void 0;
|
|
10
10
|
const fs = require("fs");
|
|
11
11
|
const path = require("path");
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const authInfoConfig_1 = require("../../config/authInfoConfig");
|
|
14
14
|
const global_1 = require("../../global");
|
|
15
|
-
const types_1 = require("../types");
|
|
16
15
|
const logger_1 = require("../../logger");
|
|
17
16
|
const messages_1 = require("../../messages");
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
*/
|
|
21
|
-
class GlobalInfoOrgAccessor {
|
|
22
|
-
constructor(globalInfo) {
|
|
23
|
-
this.globalInfo = globalInfo;
|
|
24
|
-
}
|
|
25
|
-
getAll(decrypt = false) {
|
|
26
|
-
return this.globalInfo.get(types_1.SfInfoKeys.ORGS, decrypt);
|
|
27
|
-
}
|
|
28
|
-
get(username, decrypt = false) {
|
|
29
|
-
const auth = this.globalInfo.get(`${types_1.SfInfoKeys.ORGS}["${username}"]`, decrypt);
|
|
30
|
-
// For legacy, some things wants the username in the returned auth info.
|
|
31
|
-
if (auth && !auth.username)
|
|
32
|
-
auth.username = username;
|
|
33
|
-
return auth;
|
|
34
|
-
}
|
|
35
|
-
has(username) {
|
|
36
|
-
return !!this.getAll()[username];
|
|
37
|
-
}
|
|
38
|
-
set(username, org) {
|
|
39
|
-
// For legacy, and to keep things standard, some things wants the username in auth info.
|
|
40
|
-
org.username ?? (org.username = username);
|
|
41
|
-
this.globalInfo.set(`${types_1.SfInfoKeys.ORGS}["${username}"]`, org);
|
|
42
|
-
}
|
|
43
|
-
update(username, org) {
|
|
44
|
-
// For legacy, and to keep things standard, some things wants the username in auth info.
|
|
45
|
-
org.username ?? (org.username = username);
|
|
46
|
-
this.globalInfo.update(`${types_1.SfInfoKeys.ORGS}["${username}"]`, org);
|
|
47
|
-
}
|
|
48
|
-
unset(username) {
|
|
49
|
-
delete this.globalInfo.get(types_1.SfInfoKeys.ORGS)[username];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.GlobalInfoOrgAccessor = GlobalInfoOrgAccessor;
|
|
53
17
|
function chunk(array, chunkSize) {
|
|
54
18
|
const final = [];
|
|
55
19
|
for (let i = 0, len = array.length; i < len; i += chunkSize)
|
|
@@ -1,45 +1,6 @@
|
|
|
1
|
-
import { Nullable } from '@salesforce/ts-types';
|
|
2
1
|
import { SandboxOrgConfig } from '../../config/sandboxOrgConfig';
|
|
3
2
|
import { SandboxFields } from '../../org';
|
|
4
|
-
import { GlobalInfo } from '../globalInfoConfig';
|
|
5
|
-
import { SfSandbox, SfSandboxes } from '../types';
|
|
6
3
|
import { BaseOrgAccessor } from './orgAccessor';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
export declare class GlobalInfoSandboxAccessor {
|
|
11
|
-
private globalInfo;
|
|
12
|
-
constructor(globalInfo: GlobalInfo);
|
|
13
|
-
/**
|
|
14
|
-
* Returns all the sandboxes (or all the sandboxes for a given prod org)
|
|
15
|
-
*
|
|
16
|
-
* @param entity entity as a string should be a production org username
|
|
17
|
-
* and when entity is a SfSandbox, the prod org entity.prodOrgUsername will
|
|
18
|
-
* used in the filter.
|
|
19
|
-
*/
|
|
20
|
-
getAll(entity?: string | SfSandbox): SfSandboxes;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the SfSandbox config entry that corresponds to the given
|
|
23
|
-
* sandbox org id if it exists
|
|
24
|
-
*
|
|
25
|
-
* @param sandboxOrgId the sandboxOrgId that corresponds to a sandbox
|
|
26
|
-
*/
|
|
27
|
-
get(sandboxOrgId?: string): Nullable<SfSandbox>;
|
|
28
|
-
/**
|
|
29
|
-
* Returns true if the given sandbox org id exists
|
|
30
|
-
*
|
|
31
|
-
* @param sandboxOrgId the sandboxOrgId that corresponds to a sandbox
|
|
32
|
-
*/
|
|
33
|
-
has(sandboxOrgId?: string): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Set an sandboxOrgId for the given sandbox entity
|
|
36
|
-
*
|
|
37
|
-
* @param sandboxOrgId the sandboxOrgId you want to set
|
|
38
|
-
* @param entity the sandbox entity
|
|
39
|
-
*/
|
|
40
|
-
set(sandboxOrgId: string, entity: SfSandbox): void;
|
|
41
|
-
unset(sandboxOrgId: string): void;
|
|
42
|
-
}
|
|
43
4
|
export declare class SandboxAccessor extends BaseOrgAccessor<SandboxOrgConfig, SandboxFields> {
|
|
44
5
|
protected initAuthFile(username: string, throwOnNotFound?: boolean): Promise<SandboxOrgConfig>;
|
|
45
6
|
protected getFileRegex(): RegExp;
|
|
@@ -6,63 +6,9 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.SandboxAccessor =
|
|
9
|
+
exports.SandboxAccessor = void 0;
|
|
10
10
|
const sandboxOrgConfig_1 = require("../../config/sandboxOrgConfig");
|
|
11
|
-
const types_1 = require("../types");
|
|
12
11
|
const orgAccessor_1 = require("./orgAccessor");
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated
|
|
15
|
-
*/
|
|
16
|
-
class GlobalInfoSandboxAccessor {
|
|
17
|
-
constructor(globalInfo) {
|
|
18
|
-
this.globalInfo = globalInfo;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns all the sandboxes (or all the sandboxes for a given prod org)
|
|
22
|
-
*
|
|
23
|
-
* @param entity entity as a string should be a production org username
|
|
24
|
-
* and when entity is a SfSandbox, the prod org entity.prodOrgUsername will
|
|
25
|
-
* used in the filter.
|
|
26
|
-
*/
|
|
27
|
-
getAll(entity) {
|
|
28
|
-
const all = this.globalInfo.get(types_1.SfInfoKeys.SANDBOXES) || {};
|
|
29
|
-
if (!entity) {
|
|
30
|
-
return all;
|
|
31
|
-
}
|
|
32
|
-
const prodOrgUsername = typeof entity === 'string' ? entity : entity.prodOrgUsername;
|
|
33
|
-
return Object.fromEntries(Object.entries(all).filter(([, value]) => value.prodOrgUsername === prodOrgUsername));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Returns the SfSandbox config entry that corresponds to the given
|
|
37
|
-
* sandbox org id if it exists
|
|
38
|
-
*
|
|
39
|
-
* @param sandboxOrgId the sandboxOrgId that corresponds to a sandbox
|
|
40
|
-
*/
|
|
41
|
-
get(sandboxOrgId) {
|
|
42
|
-
return sandboxOrgId ? this.getAll()[sandboxOrgId] ?? null : null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns true if the given sandbox org id exists
|
|
46
|
-
*
|
|
47
|
-
* @param sandboxOrgId the sandboxOrgId that corresponds to a sandbox
|
|
48
|
-
*/
|
|
49
|
-
has(sandboxOrgId) {
|
|
50
|
-
return !!(sandboxOrgId ? this.getAll()[sandboxOrgId] ?? null : null);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Set an sandboxOrgId for the given sandbox entity
|
|
54
|
-
*
|
|
55
|
-
* @param sandboxOrgId the sandboxOrgId you want to set
|
|
56
|
-
* @param entity the sandbox entity
|
|
57
|
-
*/
|
|
58
|
-
set(sandboxOrgId, entity) {
|
|
59
|
-
this.globalInfo.set(`${types_1.SfInfoKeys.SANDBOXES}["${sandboxOrgId}"]`, entity);
|
|
60
|
-
}
|
|
61
|
-
unset(sandboxOrgId) {
|
|
62
|
-
delete this.globalInfo.get(types_1.SfInfoKeys.SANDBOXES)[sandboxOrgId];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.GlobalInfoSandboxAccessor = GlobalInfoSandboxAccessor;
|
|
66
12
|
class SandboxAccessor extends orgAccessor_1.BaseOrgAccessor {
|
|
67
13
|
async initAuthFile(username, throwOnNotFound = false) {
|
|
68
14
|
return sandboxOrgConfig_1.SandboxOrgConfig.create({
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
|
-
import { Optional } from '@salesforce/ts-types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
get(name: string, decrypt?: boolean): Optional<SfToken & Timestamp>;
|
|
13
|
-
has(name: string): boolean;
|
|
14
|
-
set(name: string, token: SfToken): void;
|
|
15
|
-
update(name: string, token: Partial<SfToken>): void;
|
|
16
|
-
unset(name: string): void;
|
|
17
|
-
}
|
|
2
|
+
import { JsonMap, Optional } from '@salesforce/ts-types';
|
|
3
|
+
export declare type SfToken = {
|
|
4
|
+
token: string;
|
|
5
|
+
url: string;
|
|
6
|
+
user?: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
} & JsonMap;
|
|
9
|
+
export declare type SfTokens = {
|
|
10
|
+
[key: string]: SfToken;
|
|
11
|
+
};
|
|
18
12
|
export declare class TokenAccessor extends AsyncOptionalCreatable {
|
|
19
13
|
private config;
|
|
20
14
|
/**
|
|
@@ -29,9 +23,9 @@ export declare class TokenAccessor extends AsyncOptionalCreatable {
|
|
|
29
23
|
*
|
|
30
24
|
* @param name
|
|
31
25
|
* @param decrypt
|
|
32
|
-
* @returns {Optional<SfToken
|
|
26
|
+
* @returns {Optional<SfToken>}
|
|
33
27
|
*/
|
|
34
|
-
get(name: string, decrypt?: boolean): Optional<SfToken
|
|
28
|
+
get(name: string, decrypt?: boolean): Optional<SfToken>;
|
|
35
29
|
/**
|
|
36
30
|
* Return true if a given name has a token associated with it.
|
|
37
31
|
*
|
|
@@ -6,37 +6,9 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TokenAccessor =
|
|
9
|
+
exports.TokenAccessor = void 0;
|
|
10
10
|
const kit_1 = require("@salesforce/kit");
|
|
11
11
|
const tokensConfig_1 = require("../../config/tokensConfig");
|
|
12
|
-
const types_1 = require("../types");
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated
|
|
15
|
-
*/
|
|
16
|
-
class GlobaInfoTokenAccessor {
|
|
17
|
-
constructor(globalInfo) {
|
|
18
|
-
this.globalInfo = globalInfo;
|
|
19
|
-
}
|
|
20
|
-
getAll(decrypt = false) {
|
|
21
|
-
return this.globalInfo.get(types_1.SfInfoKeys.TOKENS, decrypt) || {};
|
|
22
|
-
}
|
|
23
|
-
get(name, decrypt = false) {
|
|
24
|
-
return this.globalInfo.get(`${types_1.SfInfoKeys.TOKENS}["${name}"]`, decrypt);
|
|
25
|
-
}
|
|
26
|
-
has(name) {
|
|
27
|
-
return !!this.getAll()[name];
|
|
28
|
-
}
|
|
29
|
-
set(name, token) {
|
|
30
|
-
this.globalInfo.set(`${types_1.SfInfoKeys.TOKENS}["${name}"]`, token);
|
|
31
|
-
}
|
|
32
|
-
update(name, token) {
|
|
33
|
-
this.globalInfo.update(`${types_1.SfInfoKeys.TOKENS}["${name}"]`, token);
|
|
34
|
-
}
|
|
35
|
-
unset(name) {
|
|
36
|
-
delete this.globalInfo.get(types_1.SfInfoKeys.TOKENS)[name];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.GlobaInfoTokenAccessor = GlobaInfoTokenAccessor;
|
|
40
12
|
class TokenAccessor extends kit_1.AsyncOptionalCreatable {
|
|
41
13
|
/**
|
|
42
14
|
* Return all tokens.
|
|
@@ -52,7 +24,7 @@ class TokenAccessor extends kit_1.AsyncOptionalCreatable {
|
|
|
52
24
|
*
|
|
53
25
|
* @param name
|
|
54
26
|
* @param decrypt
|
|
55
|
-
* @returns {Optional<SfToken
|
|
27
|
+
* @returns {Optional<SfToken>}
|
|
56
28
|
*/
|
|
57
29
|
get(name, decrypt = false) {
|
|
58
30
|
return this.config.get(name, decrypt);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export { GlobalInfoOrgAccessor, OrgAccessor } from './accessors/orgAccessor';
|
|
5
|
-
export { GlobalInfoAliasAccessor, AliasAccessor } from './accessors/aliasAccessor';
|
|
6
|
-
export { GlobaInfoTokenAccessor, TokenAccessor } from './accessors/tokenAccessor';
|
|
1
|
+
export * from './accessors/orgAccessor';
|
|
2
|
+
export * from './accessors/aliasAccessor';
|
|
3
|
+
export * from './accessors/tokenAccessor';
|
|
7
4
|
export * from './stateAggregator';
|
|
@@ -16,18 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
23
|
-
var orgAccessor_1 = require("./accessors/orgAccessor");
|
|
24
|
-
Object.defineProperty(exports, "GlobalInfoOrgAccessor", { enumerable: true, get: function () { return orgAccessor_1.GlobalInfoOrgAccessor; } });
|
|
25
|
-
Object.defineProperty(exports, "OrgAccessor", { enumerable: true, get: function () { return orgAccessor_1.OrgAccessor; } });
|
|
26
|
-
var aliasAccessor_1 = require("./accessors/aliasAccessor");
|
|
27
|
-
Object.defineProperty(exports, "GlobalInfoAliasAccessor", { enumerable: true, get: function () { return aliasAccessor_1.GlobalInfoAliasAccessor; } });
|
|
28
|
-
Object.defineProperty(exports, "AliasAccessor", { enumerable: true, get: function () { return aliasAccessor_1.AliasAccessor; } });
|
|
29
|
-
var tokenAccessor_1 = require("./accessors/tokenAccessor");
|
|
30
|
-
Object.defineProperty(exports, "GlobaInfoTokenAccessor", { enumerable: true, get: function () { return tokenAccessor_1.GlobaInfoTokenAccessor; } });
|
|
31
|
-
Object.defineProperty(exports, "TokenAccessor", { enumerable: true, get: function () { return tokenAccessor_1.TokenAccessor; } });
|
|
19
|
+
__exportStar(require("./accessors/orgAccessor"), exports);
|
|
20
|
+
__exportStar(require("./accessors/aliasAccessor"), exports);
|
|
21
|
+
__exportStar(require("./accessors/tokenAccessor"), exports);
|
|
32
22
|
__exportStar(require("./stateAggregator"), exports);
|
|
33
23
|
//# sourceMappingURL=index.js.map
|
package/lib/testSetup.js
CHANGED
|
@@ -343,8 +343,6 @@ const restoreContext = (testContext) => {
|
|
|
343
343
|
testContext.SANDBOX.restore();
|
|
344
344
|
Object.values(testContext.SANDBOXES).forEach((theSandbox) => theSandbox.restore());
|
|
345
345
|
testContext.configStubs = {};
|
|
346
|
-
// Give each test run a clean GlobalInstance
|
|
347
|
-
stateAggregator_1.GlobalInfo.clearInstance();
|
|
348
346
|
// Give each test run a clean StateAggregator
|
|
349
347
|
stateAggregator_1.StateAggregator.clearInstance();
|
|
350
348
|
};
|
package/messages/config.md
CHANGED
|
@@ -142,3 +142,11 @@ URL of the Salesforce instance hosting your org. Default: https://login.salesfor
|
|
|
142
142
|
# org-instance-url
|
|
143
143
|
|
|
144
144
|
URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com.
|
|
145
|
+
|
|
146
|
+
# customOrgMetadataTemplates
|
|
147
|
+
|
|
148
|
+
A valid repository URL or directory for the custom org metadata templates.
|
|
149
|
+
|
|
150
|
+
# org-custom-metadata-templates
|
|
151
|
+
|
|
152
|
+
A valid repository URL or directory for the custom org metadata templates.
|