@salesforce/core 6.7.6 → 6.7.7-qa.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/lib/config/authInfoConfig.js +1 -1
- package/lib/config/config.d.ts +4 -4
- package/lib/config/config.js +6 -5
- package/lib/config/configAggregator.d.ts +2 -2
- package/lib/config/configAggregator.js +7 -2
- package/lib/config/configFile.d.ts +2 -2
- package/lib/config/configFile.js +6 -2
- package/lib/config/configStore.d.ts +4 -4
- package/lib/config/configStore.js +17 -14
- package/lib/config/lwwMap.js +12 -19
- package/lib/config/lwwRegister.js +1 -0
- package/lib/config/orgUsersConfig.d.ts +2 -2
- package/lib/config/sandboxOrgConfig.d.ts +2 -2
- package/lib/crypto/crypto.d.ts +2 -2
- package/lib/crypto/crypto.js +3 -1
- package/lib/crypto/keyChainImpl.d.ts +6 -6
- package/lib/crypto/keyChainImpl.js +2 -0
- package/lib/crypto/secureBuffer.js +3 -4
- package/lib/deviceOauthService.d.ts +5 -5
- package/lib/deviceOauthService.js +8 -6
- package/lib/global.js +22 -22
- package/lib/index.d.ts +1 -1
- package/lib/lifecycleEvents.js +5 -2
- package/lib/logger/logger.d.ts +4 -4
- package/lib/logger/logger.js +31 -29
- package/lib/logger/memoryLogger.js +1 -1
- package/lib/messageTransformer.d.ts +1 -1
- package/lib/messageTransformer.js +17 -37
- package/lib/messages.js +41 -30
- package/lib/org/authInfo.d.ts +5 -5
- package/lib/org/authInfo.js +65 -67
- package/lib/org/authRemover.js +7 -2
- package/lib/org/connection.d.ts +8 -8
- package/lib/org/connection.js +33 -22
- package/lib/org/org.d.ts +10 -10
- package/lib/org/org.js +30 -23
- package/lib/org/permissionSetAssignment.d.ts +2 -2
- package/lib/org/permissionSetAssignment.js +2 -0
- package/lib/org/scratchOrgCreate.d.ts +4 -4
- package/lib/org/scratchOrgFeatureDeprecation.d.ts +2 -2
- package/lib/org/scratchOrgFeatureDeprecation.js +1 -0
- package/lib/org/scratchOrgInfoApi.d.ts +1 -1
- package/lib/org/scratchOrgInfoApi.js +4 -5
- package/lib/org/scratchOrgInfoGenerator.d.ts +4 -4
- package/lib/org/scratchOrgInfoGenerator.js +13 -15
- package/lib/org/scratchOrgLifecycleEvents.d.ts +2 -2
- package/lib/org/scratchOrgSettingsGenerator.d.ts +8 -8
- package/lib/org/scratchOrgSettingsGenerator.js +9 -2
- package/lib/org/scratchOrgTypes.d.ts +4 -4
- package/lib/org/user.d.ts +6 -6
- package/lib/org/user.js +24 -16
- package/lib/schema/validator.js +4 -0
- package/lib/sfError.d.ts +20 -6
- package/lib/sfError.js +48 -37
- package/lib/sfProject.d.ts +3 -0
- package/lib/sfProject.js +25 -15
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +0 -35
- package/lib/stateAggregator/accessors/aliasAccessor.js +4 -68
- package/lib/stateAggregator/accessors/orgAccessor.js +5 -10
- package/lib/stateAggregator/stateAggregator.js +4 -1
- package/lib/status/myDomainResolver.d.ts +2 -2
- package/lib/status/myDomainResolver.js +3 -1
- package/lib/status/pollingClient.d.ts +2 -2
- package/lib/status/pollingClient.js +5 -0
- package/lib/status/streamingClient.d.ts +4 -4
- package/lib/status/streamingClient.js +16 -4
- package/lib/status/types.d.ts +6 -6
- package/lib/testSetup.d.ts +8 -8
- package/lib/testSetup.js +75 -29
- package/lib/util/cache.js +21 -35
- package/lib/util/directoryWriter.js +1 -0
- package/lib/util/getJwtAudienceUrl.d.ts +1 -1
- package/lib/util/sfdc.js +1 -1
- package/lib/util/sfdcUrl.js +7 -6
- package/lib/util/structuredWriter.d.ts +2 -2
- package/lib/util/zipWriter.js +4 -1
- package/lib/webOAuthServer.d.ts +4 -4
- package/lib/webOAuthServer.js +20 -9
- package/package.json +20 -5
- package/lib/util/checkLightningDomain.d.ts +0 -2
- package/lib/util/checkLightningDomain.js +0 -30
|
@@ -17,6 +17,7 @@ const configFile_1 = require("./configFile");
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
class AuthInfoConfig extends configFile_1.ConfigFile {
|
|
20
|
+
static encryptedKeys = [/token/i, /password/i, /secret/i];
|
|
20
21
|
/**
|
|
21
22
|
* Gets the config options for a given org ID.
|
|
22
23
|
*
|
|
@@ -31,5 +32,4 @@ class AuthInfoConfig extends configFile_1.ConfigFile {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
exports.AuthInfoConfig = AuthInfoConfig;
|
|
34
|
-
AuthInfoConfig.encryptedKeys = [/token/i, /password/i, /secret/i];
|
|
35
35
|
//# sourceMappingURL=authInfoConfig.js.map
|
package/lib/config/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ConfigContents, ConfigValue, Key } from './configStackTypes';
|
|
|
5
5
|
/**
|
|
6
6
|
* Interface for meta information about config properties
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ConfigPropertyMeta = {
|
|
9
9
|
/**
|
|
10
10
|
* The config property name.
|
|
11
11
|
*/
|
|
@@ -35,11 +35,11 @@ export interface ConfigPropertyMeta {
|
|
|
35
35
|
* Is only used if deprecated is set to true.
|
|
36
36
|
*/
|
|
37
37
|
newKey?: string;
|
|
38
|
-
}
|
|
38
|
+
};
|
|
39
39
|
/**
|
|
40
40
|
* Config property input validation
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type ConfigPropertyMetaInput = {
|
|
43
43
|
/**
|
|
44
44
|
* Tests if the input value is valid and returns true if the input data is valid.
|
|
45
45
|
*
|
|
@@ -50,7 +50,7 @@ export interface ConfigPropertyMetaInput {
|
|
|
50
50
|
* The message to return in the error if the validation fails.
|
|
51
51
|
*/
|
|
52
52
|
failedMessage: string | ((value: ConfigValue) => string);
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
export declare enum SfConfigProperties {
|
|
55
55
|
/**
|
|
56
56
|
* Disables telemetry reporting
|
package/lib/config/config.js
CHANGED
|
@@ -251,6 +251,12 @@ exports.SfProperty = {};
|
|
|
251
251
|
* https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_config_values.htm
|
|
252
252
|
*/
|
|
253
253
|
class Config extends configFile_1.ConfigFile {
|
|
254
|
+
static allowedProperties = [
|
|
255
|
+
...exports.SFDX_ALLOWED_PROPERTIES,
|
|
256
|
+
...exports.SF_ALLOWED_PROPERTIES,
|
|
257
|
+
...orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES,
|
|
258
|
+
];
|
|
259
|
+
sfdxPath;
|
|
254
260
|
constructor(options) {
|
|
255
261
|
super({
|
|
256
262
|
...{ isGlobal: false },
|
|
@@ -496,11 +502,6 @@ class Config extends configFile_1.ConfigFile {
|
|
|
496
502
|
}
|
|
497
503
|
}
|
|
498
504
|
exports.Config = Config;
|
|
499
|
-
Config.allowedProperties = [
|
|
500
|
-
...exports.SFDX_ALLOWED_PROPERTIES,
|
|
501
|
-
...exports.SF_ALLOWED_PROPERTIES,
|
|
502
|
-
...orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES,
|
|
503
|
-
];
|
|
504
505
|
/**
|
|
505
506
|
* convert from "new" to "old" config names
|
|
506
507
|
* - For example, `target-org` will be renamed to `defaultusername`.
|
|
@@ -4,7 +4,7 @@ import { Config, ConfigPropertyMeta } from './config';
|
|
|
4
4
|
/**
|
|
5
5
|
* Information about a config property.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type ConfigInfo = {
|
|
8
8
|
/**
|
|
9
9
|
* key The config key.
|
|
10
10
|
*/
|
|
@@ -37,7 +37,7 @@ export interface ConfigInfo {
|
|
|
37
37
|
* True if the config property is deprecated.
|
|
38
38
|
*/
|
|
39
39
|
deprecated?: boolean;
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
/**
|
|
42
42
|
* Aggregate global and local project config files, as well as environment variables for
|
|
43
43
|
* `config.json`. The resolution happens in the following bottom-up order:
|
|
@@ -31,6 +31,13 @@ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
34
|
+
static instance;
|
|
35
|
+
static encrypted = true;
|
|
36
|
+
// Initialized in loadProperties
|
|
37
|
+
allowedProperties;
|
|
38
|
+
localConfig;
|
|
39
|
+
globalConfig;
|
|
40
|
+
envVars = {};
|
|
34
41
|
/**
|
|
35
42
|
* **Do not directly construct instances of this class -- use {@link ConfigAggregator.create} instead.**
|
|
36
43
|
*
|
|
@@ -38,7 +45,6 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
38
45
|
*/
|
|
39
46
|
constructor(options) {
|
|
40
47
|
super(options ?? {});
|
|
41
|
-
this.envVars = {};
|
|
42
48
|
// Don't throw an project error with the aggregator, since it should resolve to global if
|
|
43
49
|
// there is no project.
|
|
44
50
|
try {
|
|
@@ -347,5 +353,4 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
347
353
|
}
|
|
348
354
|
}
|
|
349
355
|
exports.ConfigAggregator = ConfigAggregator;
|
|
350
|
-
ConfigAggregator.encrypted = true;
|
|
351
356
|
//# sourceMappingURL=configAggregator.js.map
|
|
@@ -169,7 +169,7 @@ export declare namespace ConfigFile {
|
|
|
169
169
|
/**
|
|
170
170
|
* The interface for Config options.
|
|
171
171
|
*/
|
|
172
|
-
|
|
172
|
+
type Options = {
|
|
173
173
|
/**
|
|
174
174
|
* The root folder where the config file is stored.
|
|
175
175
|
*/
|
|
@@ -198,5 +198,5 @@ export declare namespace ConfigFile {
|
|
|
198
198
|
* Indicates if init should throw if the corresponding config file is not found.
|
|
199
199
|
*/
|
|
200
200
|
throwOnNotFound?: boolean;
|
|
201
|
-
}
|
|
201
|
+
} & BaseConfigStore.Options;
|
|
202
202
|
}
|
package/lib/config/configFile.js
CHANGED
|
@@ -62,6 +62,12 @@ const lwwMap_1 = require("./lwwMap");
|
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
64
|
class ConfigFile extends configStore_1.BaseConfigStore {
|
|
65
|
+
// whether file contents have been read
|
|
66
|
+
hasRead = false;
|
|
67
|
+
// Initialized in init
|
|
68
|
+
logger;
|
|
69
|
+
// Initialized in create
|
|
70
|
+
path;
|
|
65
71
|
/**
|
|
66
72
|
* Create an instance of a config file without reading the file. Call `read` or `readSync`
|
|
67
73
|
* after creating the ConfigFile OR instantiate with {@link ConfigFile.create} instead.
|
|
@@ -71,8 +77,6 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
71
77
|
*/
|
|
72
78
|
constructor(options) {
|
|
73
79
|
super(options);
|
|
74
|
-
// whether file contents have been read
|
|
75
|
-
this.hasRead = false;
|
|
76
80
|
this.logger = logger_1.Logger.childFromRoot(this.constructor.name);
|
|
77
81
|
const statics = this.constructor;
|
|
78
82
|
let defaultOptions = {};
|
|
@@ -6,7 +6,7 @@ import { ConfigContents, ConfigEntry, ConfigValue, Key } from './configStackType
|
|
|
6
6
|
/**
|
|
7
7
|
* An interface for a config object with a persistent store.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type ConfigStore<P extends ConfigContents = ConfigContents> = {
|
|
10
10
|
entries(): ConfigEntry[];
|
|
11
11
|
get<K extends Key<P>>(key: K, decrypt: boolean): P[K];
|
|
12
12
|
get<T extends ConfigValue>(key: string, decrypt: boolean): T;
|
|
@@ -23,7 +23,7 @@ export interface ConfigStore<P extends ConfigContents = ConfigContents> {
|
|
|
23
23
|
values(): ConfigValue[];
|
|
24
24
|
forEach(actionFn: (key: string, value: ConfigValue) => void): void;
|
|
25
25
|
getContents(): P;
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
/**
|
|
28
28
|
* An abstract class that implements all the config management functions but
|
|
29
29
|
* none of the storage functions.
|
|
@@ -207,7 +207,7 @@ export declare namespace BaseConfigStore {
|
|
|
207
207
|
/**
|
|
208
208
|
* Options for the config store.
|
|
209
209
|
*/
|
|
210
|
-
|
|
210
|
+
type Options = {
|
|
211
211
|
/**
|
|
212
212
|
* Keys to encrypt.
|
|
213
213
|
*
|
|
@@ -217,5 +217,5 @@ export declare namespace BaseConfigStore {
|
|
|
217
217
|
* defining a new class.
|
|
218
218
|
*/
|
|
219
219
|
encryptedKeys?: Array<string | RegExp>;
|
|
220
|
-
}
|
|
220
|
+
};
|
|
221
221
|
}
|
|
@@ -21,6 +21,13 @@ const lwwMap_1 = require("./lwwMap");
|
|
|
21
21
|
* **Note:** To see the interface, look in typescripts autocomplete help or the npm package's ConfigStore.d.ts file.
|
|
22
22
|
*/
|
|
23
23
|
class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
24
|
+
// If encryptedKeys is an array of RegExps, they should not contain the /g (global) or /y (sticky) flags to avoid stateful issues.
|
|
25
|
+
static encryptedKeys = [];
|
|
26
|
+
options;
|
|
27
|
+
crypto;
|
|
28
|
+
// Initialized in setContents
|
|
29
|
+
contents = new lwwMap_1.LWWMap();
|
|
30
|
+
statics = this.constructor;
|
|
24
31
|
/**
|
|
25
32
|
* Constructor.
|
|
26
33
|
*
|
|
@@ -29,9 +36,6 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
29
36
|
*/
|
|
30
37
|
constructor(options) {
|
|
31
38
|
super(options);
|
|
32
|
-
// Initialized in setContents
|
|
33
|
-
this.contents = new lwwMap_1.LWWMap();
|
|
34
|
-
this.statics = this.constructor;
|
|
35
39
|
this.options = options ?? {};
|
|
36
40
|
this.setContents(this.initialContents());
|
|
37
41
|
}
|
|
@@ -86,20 +90,21 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
86
90
|
* @param value The value.
|
|
87
91
|
*/
|
|
88
92
|
set(key, value) {
|
|
93
|
+
let resolvedValue = value;
|
|
89
94
|
if (this.hasEncryption()) {
|
|
90
|
-
if ((0, ts_types_2.isJsonMap)(
|
|
91
|
-
|
|
95
|
+
if ((0, ts_types_2.isJsonMap)(resolvedValue)) {
|
|
96
|
+
resolvedValue = this.recursiveEncrypt(resolvedValue, key);
|
|
92
97
|
}
|
|
93
98
|
else if (this.isCryptoKey(key)) {
|
|
94
|
-
|
|
99
|
+
resolvedValue = this.encrypt(resolvedValue);
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
// set(key, undefined) means unset
|
|
98
|
-
if (
|
|
103
|
+
if (resolvedValue === undefined) {
|
|
99
104
|
this.unset(key);
|
|
100
105
|
}
|
|
101
106
|
else {
|
|
102
|
-
this.contents.set(key,
|
|
107
|
+
this.contents.set(key, resolvedValue);
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
110
|
/**
|
|
@@ -210,10 +215,8 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
210
215
|
* @param contents The contents.
|
|
211
216
|
*/
|
|
212
217
|
setContents(contents = {}) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
(0, ts_types_1.entriesOf)(contents).map(([key, value]) => {
|
|
218
|
+
const maybeEncryptedContents = this.hasEncryption() ? this.recursiveEncrypt(contents) : contents;
|
|
219
|
+
(0, ts_types_1.entriesOf)(maybeEncryptedContents).map(([key, value]) => {
|
|
217
220
|
this.contents.set(key, value);
|
|
218
221
|
});
|
|
219
222
|
}
|
|
@@ -341,11 +344,11 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
346
|
else if (this.isCryptoKey(key)) {
|
|
347
|
+
// I think this side effect is intentional
|
|
348
|
+
// eslint-disable-next-line no-param-reassign
|
|
344
349
|
data[key] = method(value);
|
|
345
350
|
}
|
|
346
351
|
}
|
|
347
352
|
}
|
|
348
353
|
exports.BaseConfigStore = BaseConfigStore;
|
|
349
|
-
// If encryptedKeys is an array of RegExps, they should not contain the /g (global) or /y (sticky) flags to avoid stateful issues.
|
|
350
|
-
BaseConfigStore.encryptedKeys = [];
|
|
351
354
|
//# sourceMappingURL=configStore.js.map
|
package/lib/config/lwwMap.js
CHANGED
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
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
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _LWWMap_data;
|
|
14
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
9
|
exports.LWWMap = exports.stateFromContents = exports.SYMBOL_FOR_DELETED = void 0;
|
|
16
10
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
@@ -31,21 +25,21 @@ const stateFromContents = (contents, timestamp) => Object.fromEntries((0, ts_typ
|
|
|
31
25
|
);
|
|
32
26
|
exports.stateFromContents = stateFromContents;
|
|
33
27
|
class LWWMap {
|
|
28
|
+
/** map of key to LWWRegister. Used for managing conflicts */
|
|
29
|
+
#data = new Map();
|
|
34
30
|
constructor(state) {
|
|
35
|
-
/** map of key to LWWRegister. Used for managing conflicts */
|
|
36
|
-
_LWWMap_data.set(this, new Map());
|
|
37
31
|
// create a new register for each key in the initial state
|
|
38
32
|
for (const [key, register] of (0, ts_types_1.entriesOf)(state ?? {})) {
|
|
39
|
-
|
|
33
|
+
this.#data.set(key, new lwwRegister_1.LWWRegister(register));
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
get value() {
|
|
43
|
-
return Object.fromEntries(Array.from(
|
|
37
|
+
return Object.fromEntries(Array.from(this.#data.entries())
|
|
44
38
|
.filter(([, register]) => register.value !== exports.SYMBOL_FOR_DELETED)
|
|
45
39
|
.map(([key, register]) => [key, register.value]));
|
|
46
40
|
}
|
|
47
41
|
get state() {
|
|
48
|
-
return Object.fromEntries(Array.from(
|
|
42
|
+
return Object.fromEntries(Array.from(this.#data.entries()).map(([key, register]) => [key, register.state]));
|
|
49
43
|
}
|
|
50
44
|
// Merge top-level properties of the incoming state with the current state.
|
|
51
45
|
// The value with the latest timestamp wins.
|
|
@@ -53,44 +47,43 @@ class LWWMap {
|
|
|
53
47
|
// properties that are in the incoming state but not the current state might have been deleted.
|
|
54
48
|
// recursively merge each key's register with the incoming state for that key
|
|
55
49
|
for (const [key, remote] of (0, ts_types_1.entriesOf)(state)) {
|
|
56
|
-
const local =
|
|
50
|
+
const local = this.#data.get(key);
|
|
57
51
|
// if the register already exists, merge it with the incoming state
|
|
58
52
|
if (local)
|
|
59
53
|
local.merge(remote);
|
|
60
54
|
// otherwise, instantiate a new `LWWRegister` with the incoming state
|
|
61
55
|
else
|
|
62
|
-
|
|
56
|
+
this.#data.set(key, new lwwRegister_1.LWWRegister(remote));
|
|
63
57
|
}
|
|
64
58
|
return this.state;
|
|
65
59
|
}
|
|
66
60
|
set(key, value) {
|
|
67
61
|
// get the register at the given key
|
|
68
|
-
const register =
|
|
62
|
+
const register = this.#data.get(key);
|
|
69
63
|
// if the register already exists, set the value
|
|
70
64
|
if (register)
|
|
71
65
|
register.set(value);
|
|
72
66
|
// otherwise, instantiate a new `LWWRegister` with the value
|
|
73
67
|
else
|
|
74
|
-
|
|
68
|
+
this.#data.set(key, new lwwRegister_1.LWWRegister({ timestamp: (0, time_1.nowBigInt)(), value }));
|
|
75
69
|
}
|
|
76
70
|
get(key) {
|
|
77
71
|
// map loses the typing
|
|
78
|
-
const value =
|
|
72
|
+
const value = this.#data.get(key)?.value;
|
|
79
73
|
if (value === exports.SYMBOL_FOR_DELETED)
|
|
80
74
|
return undefined;
|
|
81
75
|
return value;
|
|
82
76
|
}
|
|
83
77
|
delete(key) {
|
|
84
|
-
|
|
78
|
+
this.#data.set(key, new lwwRegister_1.LWWRegister({
|
|
85
79
|
timestamp: (0, time_1.nowBigInt)(),
|
|
86
80
|
value: exports.SYMBOL_FOR_DELETED,
|
|
87
81
|
}));
|
|
88
82
|
}
|
|
89
83
|
has(key) {
|
|
90
84
|
// if a register doesn't exist or its value is null, the map doesn't contain the key
|
|
91
|
-
return
|
|
85
|
+
return this.#data.has(key) && this.#data.get(key)?.value !== exports.SYMBOL_FOR_DELETED;
|
|
92
86
|
}
|
|
93
87
|
}
|
|
94
88
|
exports.LWWMap = LWWMap;
|
|
95
|
-
_LWWMap_data = new WeakMap();
|
|
96
89
|
//# sourceMappingURL=lwwMap.js.map
|
|
@@ -25,11 +25,11 @@ export declare namespace OrgUsersConfig {
|
|
|
25
25
|
/**
|
|
26
26
|
* The config file options.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
type Options = {
|
|
29
29
|
/**
|
|
30
30
|
* The org id associated with this user.
|
|
31
31
|
*/
|
|
32
32
|
orgId: string;
|
|
33
|
-
}
|
|
33
|
+
} & ConfigFile.Options;
|
|
34
34
|
}
|
|
35
35
|
export {};
|
|
@@ -22,12 +22,12 @@ export declare namespace SandboxOrgConfig {
|
|
|
22
22
|
/**
|
|
23
23
|
* The config file options.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
type Options = {
|
|
26
26
|
/**
|
|
27
27
|
* The org id associated with this sandbox.
|
|
28
28
|
*/
|
|
29
29
|
orgId: string;
|
|
30
|
-
}
|
|
30
|
+
} & ConfigFile.Options;
|
|
31
31
|
enum Fields {
|
|
32
32
|
/**
|
|
33
33
|
* The username of the user who created the sandbox.
|
package/lib/crypto/crypto.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
2
|
import { KeyChain } from './keyChainImpl';
|
|
3
|
-
|
|
3
|
+
type CryptoOptions = {
|
|
4
4
|
keychain?: KeyChain;
|
|
5
5
|
platform?: string;
|
|
6
6
|
retryStatus?: string;
|
|
7
7
|
noResetOnClose?: boolean;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
/**
|
|
10
10
|
* Class for managing encrypting and decrypting private auth information.
|
|
11
11
|
*/
|
package/lib/crypto/crypto.js
CHANGED
|
@@ -182,6 +182,9 @@ const keychainPromises = {
|
|
|
182
182
|
* Class for managing encrypting and decrypting private auth information.
|
|
183
183
|
*/
|
|
184
184
|
class Crypto extends kit_1.AsyncOptionalCreatable {
|
|
185
|
+
key = new secureBuffer_1.SecureBuffer();
|
|
186
|
+
options;
|
|
187
|
+
noResetOnClose;
|
|
185
188
|
/**
|
|
186
189
|
* Constructor
|
|
187
190
|
* **Do not directly construct instances of this class -- use {@link Crypto.create} instead.**
|
|
@@ -191,7 +194,6 @@ class Crypto extends kit_1.AsyncOptionalCreatable {
|
|
|
191
194
|
*/
|
|
192
195
|
constructor(options) {
|
|
193
196
|
super(options);
|
|
194
|
-
this.key = new secureBuffer_1.SecureBuffer();
|
|
195
197
|
this.options = options ?? {};
|
|
196
198
|
}
|
|
197
199
|
// @ts-expect-error only for test access
|
|
@@ -8,7 +8,7 @@ export type FsIfc = Pick<typeof nodeFs, 'statSync'>;
|
|
|
8
8
|
/**
|
|
9
9
|
* Basic keychain interface.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type PasswordStore = {
|
|
12
12
|
/**
|
|
13
13
|
* Gets a password
|
|
14
14
|
*
|
|
@@ -24,7 +24,7 @@ export interface PasswordStore {
|
|
|
24
24
|
* @param fn function callback for password.
|
|
25
25
|
*/
|
|
26
26
|
setPassword(opts: ProgramOpts, fn: (error: Nullable<Error>, contents?: SecretContents) => void): Promise<void>;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
/**
|
|
29
29
|
* @private
|
|
30
30
|
*/
|
|
@@ -58,12 +58,12 @@ export declare class KeychainAccess implements PasswordStore {
|
|
|
58
58
|
*/
|
|
59
59
|
setPassword(opts: ProgramOpts, fn: (error: Nullable<Error>, contents?: SecretContents) => void): Promise<void>;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
type ProgramOpts = {
|
|
62
62
|
account: string;
|
|
63
63
|
service: string;
|
|
64
64
|
password?: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
65
|
+
};
|
|
66
|
+
type OsImpl = {
|
|
67
67
|
getProgram(): string;
|
|
68
68
|
getProgramOptions(opts: ProgramOpts): string[];
|
|
69
69
|
getCommandFunc(opts: ProgramOpts, fn: (program: string, opts: string[]) => childProcess.ChildProcess): childProcess.ChildProcess;
|
|
@@ -71,7 +71,7 @@ interface OsImpl {
|
|
|
71
71
|
setProgramOptions(opts: ProgramOpts): string[];
|
|
72
72
|
setCommandFunc(opts: ProgramOpts, fn: (program: string, opts: string[]) => childProcess.ChildProcess): childProcess.ChildProcess;
|
|
73
73
|
onSetCommandClose(code: number, stdout: string, stderr: string, opts: ProgramOpts, fn: (err: Nullable<Error>) => void): Promise<void>;
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
declare enum SecretField {
|
|
76
76
|
SERVICE = "service",
|
|
77
77
|
ACCOUNT = "account",
|
|
@@ -49,10 +49,9 @@ const cipherSize = 32;
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
class SecureBuffer {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
52
|
+
key = crypto.randomBytes(cipherSize);
|
|
53
|
+
iv = crypto.randomBytes(16);
|
|
54
|
+
secret;
|
|
56
55
|
/**
|
|
57
56
|
* Invokes a callback with a decrypted version of the buffer.
|
|
58
57
|
*
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AsyncCreatable } from '@salesforce/kit';
|
|
2
|
-
import { OAuth2Config } from 'jsforce';
|
|
2
|
+
import { OAuth2Config } from '@jsforce/jsforce-node';
|
|
3
3
|
import { JsonMap, Nullable } from '@salesforce/ts-types';
|
|
4
4
|
import { AuthInfo } from './org/authInfo';
|
|
5
|
-
export
|
|
5
|
+
export type DeviceCodeResponse = {
|
|
6
6
|
device_code: string;
|
|
7
7
|
interval: number;
|
|
8
8
|
user_code: string;
|
|
9
9
|
verification_uri: string;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
} & JsonMap;
|
|
11
|
+
export type DeviceCodePollingResponse = {
|
|
12
12
|
access_token: string;
|
|
13
13
|
refresh_token: string;
|
|
14
14
|
signature: string;
|
|
@@ -17,7 +17,7 @@ export interface DeviceCodePollingResponse extends JsonMap {
|
|
|
17
17
|
id: string;
|
|
18
18
|
token_type: string;
|
|
19
19
|
issued_at: string;
|
|
20
|
-
}
|
|
20
|
+
} & JsonMap;
|
|
21
21
|
/**
|
|
22
22
|
* Handles device based login flows
|
|
23
23
|
*
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.DeviceOauthService = void 0;
|
|
15
|
-
const transport_1 = __importDefault(require("jsforce/lib/transport"));
|
|
15
|
+
const transport_1 = __importDefault(require("@jsforce/jsforce-node/lib/transport"));
|
|
16
16
|
const kit_1 = require("@salesforce/kit");
|
|
17
17
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
18
18
|
const form_data_1 = __importDefault(require("form-data"));
|
|
@@ -59,9 +59,15 @@ async function makeRequest(options) {
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
62
|
+
static RESPONSE_TYPE = 'device_code';
|
|
63
|
+
static GRANT_TYPE = 'device';
|
|
64
|
+
static SCOPE = 'refresh_token web api';
|
|
65
|
+
static POLLING_COUNT_MAX = 100;
|
|
66
|
+
logger;
|
|
67
|
+
options;
|
|
68
|
+
pollingCount = 0;
|
|
62
69
|
constructor(options) {
|
|
63
70
|
super(options);
|
|
64
|
-
this.pollingCount = 0;
|
|
65
71
|
this.options = options;
|
|
66
72
|
if (!this.options.clientId)
|
|
67
73
|
this.options.clientId = authInfo_1.DEFAULT_CONNECTED_APP_INFO.clientId;
|
|
@@ -192,8 +198,4 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
|
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
200
|
exports.DeviceOauthService = DeviceOauthService;
|
|
195
|
-
DeviceOauthService.RESPONSE_TYPE = 'device_code';
|
|
196
|
-
DeviceOauthService.GRANT_TYPE = 'device';
|
|
197
|
-
DeviceOauthService.SCOPE = 'refresh_token web api';
|
|
198
|
-
DeviceOauthService.POLLING_COUNT_MAX = 100;
|
|
199
201
|
//# sourceMappingURL=deviceOauthService.js.map
|
package/lib/global.js
CHANGED
|
@@ -52,6 +52,24 @@ var Mode;
|
|
|
52
52
|
* Global constants, methods, and configuration.
|
|
53
53
|
*/
|
|
54
54
|
class Global {
|
|
55
|
+
/**
|
|
56
|
+
* Enable interoperability between `.sfdx` and `.sf`.
|
|
57
|
+
*
|
|
58
|
+
* When @salesforce/core@v2 is deprecated and no longer used, this can be removed.
|
|
59
|
+
*/
|
|
60
|
+
static SFDX_INTEROPERABILITY = kit_1.env.getBoolean('SF_SFDX_INTEROPERABILITY', true);
|
|
61
|
+
/**
|
|
62
|
+
* The global folder in which sfdx state is stored.
|
|
63
|
+
*/
|
|
64
|
+
static SFDX_STATE_FOLDER = '.sfdx';
|
|
65
|
+
/**
|
|
66
|
+
* The global folder in which sf state is stored.
|
|
67
|
+
*/
|
|
68
|
+
static SF_STATE_FOLDER = '.sf';
|
|
69
|
+
/**
|
|
70
|
+
* The preferred global folder in which state is stored.
|
|
71
|
+
*/
|
|
72
|
+
static STATE_FOLDER = Global.SFDX_STATE_FOLDER;
|
|
55
73
|
/**
|
|
56
74
|
* The full system path to the global sfdx state folder.
|
|
57
75
|
*
|
|
@@ -94,37 +112,19 @@ class Global {
|
|
|
94
112
|
* @param dirPath The directory path to be created within {@link Global.SFDX_DIR}.
|
|
95
113
|
*/
|
|
96
114
|
static async createDir(dirPath) {
|
|
97
|
-
|
|
115
|
+
const resolvedPath = dirPath ? path.join(Global.SFDX_DIR, dirPath) : Global.SFDX_DIR;
|
|
98
116
|
try {
|
|
99
117
|
if (process.platform === 'win32') {
|
|
100
|
-
await fs.promises.mkdir(
|
|
118
|
+
await fs.promises.mkdir(resolvedPath, { recursive: true });
|
|
101
119
|
}
|
|
102
120
|
else {
|
|
103
|
-
await fs.promises.mkdir(
|
|
121
|
+
await fs.promises.mkdir(resolvedPath, { recursive: true, mode: 0o700 });
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
catch (error) {
|
|
107
|
-
throw new sfError_1.SfError(`Failed to create directory or set permissions for: ${
|
|
125
|
+
throw new sfError_1.SfError(`Failed to create directory or set permissions for: ${resolvedPath}`);
|
|
108
126
|
}
|
|
109
127
|
}
|
|
110
128
|
}
|
|
111
129
|
exports.Global = Global;
|
|
112
|
-
/**
|
|
113
|
-
* Enable interoperability between `.sfdx` and `.sf`.
|
|
114
|
-
*
|
|
115
|
-
* When @salesforce/core@v2 is deprecated and no longer used, this can be removed.
|
|
116
|
-
*/
|
|
117
|
-
Global.SFDX_INTEROPERABILITY = kit_1.env.getBoolean('SF_SFDX_INTEROPERABILITY', true);
|
|
118
|
-
/**
|
|
119
|
-
* The global folder in which sfdx state is stored.
|
|
120
|
-
*/
|
|
121
|
-
Global.SFDX_STATE_FOLDER = '.sfdx';
|
|
122
|
-
/**
|
|
123
|
-
* The global folder in which sf state is stored.
|
|
124
|
-
*/
|
|
125
|
-
Global.SF_STATE_FOLDER = '.sf';
|
|
126
|
-
/**
|
|
127
|
-
* The preferred global folder in which state is stored.
|
|
128
|
-
*/
|
|
129
|
-
Global.STATE_FOLDER = Global.SFDX_STATE_FOLDER;
|
|
130
130
|
//# sourceMappingURL=global.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { OAuth2Config } from 'jsforce';
|
|
1
|
+
export { OAuth2Config } from '@jsforce/jsforce-node';
|
|
2
2
|
export { ConfigFile } from './config/configFile';
|
|
3
3
|
export { TTLConfig } from './config/ttlConfig';
|
|
4
4
|
export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from './config/envVars';
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -58,6 +58,11 @@ const logger_1 = require("./logger/logger");
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
class Lifecycle {
|
|
61
|
+
listeners;
|
|
62
|
+
uniqueListeners;
|
|
63
|
+
static telemetryEventName = 'telemetry';
|
|
64
|
+
static warningEventName = 'warning';
|
|
65
|
+
logger;
|
|
61
66
|
constructor(listeners = {}, uniqueListeners = new Map()) {
|
|
62
67
|
this.listeners = listeners;
|
|
63
68
|
this.uniqueListeners = uniqueListeners;
|
|
@@ -227,6 +232,4 @@ class Lifecycle {
|
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
234
|
exports.Lifecycle = Lifecycle;
|
|
230
|
-
Lifecycle.telemetryEventName = 'telemetry';
|
|
231
|
-
Lifecycle.warningEventName = 'warning';
|
|
232
235
|
//# sourceMappingURL=lifecycleEvents.js.map
|