@salesforce/core 5.4.0-crdt.1 → 6.1.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/README.md +3 -3
- package/lib/config/authInfoConfig.d.ts +1 -1
- package/lib/config/config.d.ts +6 -29
- package/lib/config/config.js +91 -113
- package/lib/config/configAggregator.js +1 -0
- package/lib/config/configFile.d.ts +3 -1
- package/lib/config/configFile.js +44 -67
- package/lib/config/configStore.d.ts +20 -29
- package/lib/config/configStore.js +50 -53
- package/lib/config/envVars.js +3 -2
- package/lib/config/lwwMap.d.ts +4 -5
- package/lib/config/lwwMap.js +19 -16
- package/lib/config/lwwRegister.d.ts +2 -3
- package/lib/config/lwwRegister.js +6 -7
- package/lib/config/sandboxOrgConfig.js +1 -1
- package/lib/config/sandboxProcessCache.d.ts +1 -1
- package/lib/crypto/crypto.js +4 -3
- package/lib/crypto/keyChain.js +1 -0
- package/lib/crypto/keyChainImpl.d.ts +2 -2
- package/lib/crypto/keyChainImpl.js +9 -8
- package/lib/crypto/secureBuffer.js +1 -1
- package/lib/deviceOauthService.d.ts +1 -1
- package/lib/deviceOauthService.js +8 -6
- package/lib/exported.d.ts +3 -4
- package/lib/exported.js +6 -6
- package/lib/global.js +4 -4
- package/lib/logger/logger.js +6 -5
- package/lib/logger/memoryLogger.d.ts +1 -1
- package/lib/logger/memoryLogger.js +2 -2
- package/lib/logger/transformStream.d.ts +1 -1
- package/lib/logger/transformStream.js +3 -3
- package/lib/messageTransformer.js +2 -2
- package/lib/messages.js +5 -5
- package/lib/org/authInfo.js +11 -10
- package/lib/org/authRemover.d.ts +1 -2
- package/lib/org/authRemover.js +2 -12
- package/lib/org/connection.js +3 -2
- package/lib/org/org.js +9 -8
- package/lib/org/orgConfigProperties.js +3 -2
- package/lib/org/permissionSetAssignment.js +15 -13
- package/lib/org/scratchOrgCreate.js +2 -1
- package/lib/org/scratchOrgErrorCodes.js +1 -0
- package/lib/org/scratchOrgFeatureDeprecation.js +1 -0
- package/lib/org/scratchOrgInfoApi.js +1 -0
- package/lib/org/scratchOrgInfoGenerator.js +3 -2
- package/lib/org/scratchOrgSettingsGenerator.js +3 -3
- package/lib/org/user.js +4 -3
- package/lib/schema/validator.js +2 -2
- package/lib/sfError.d.ts +1 -1
- package/lib/sfProject.d.ts +1 -0
- package/lib/sfProject.js +12 -11
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +1 -2
- package/lib/stateAggregator/accessors/aliasAccessor.js +3 -2
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +2 -2
- package/lib/stateAggregator/accessors/orgAccessor.js +8 -6
- package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +1 -1
- package/lib/stateAggregator/stateAggregator.d.ts +0 -2
- package/lib/stateAggregator/stateAggregator.js +0 -2
- package/lib/status/myDomainResolver.d.ts +1 -1
- package/lib/status/myDomainResolver.js +6 -6
- package/lib/status/pollingClient.js +1 -1
- package/lib/status/streamingClient.js +4 -3
- package/lib/status/types.d.ts +1 -1
- package/lib/status/types.js +2 -2
- package/lib/testSetup.d.ts +3 -7
- package/lib/testSetup.js +47 -39
- package/lib/util/cache.js +14 -14
- package/lib/util/checkLightningDomain.js +2 -2
- package/lib/util/directoryWriter.d.ts +1 -1
- package/lib/util/directoryWriter.js +7 -7
- package/lib/util/fileLocking.d.ts +24 -0
- package/lib/util/fileLocking.js +91 -0
- package/lib/util/findUppercaseKeys.d.ts +2 -0
- package/lib/util/findUppercaseKeys.js +29 -0
- package/lib/util/internal.js +7 -6
- package/lib/util/sfdc.d.ts +0 -18
- package/lib/util/sfdc.js +1 -42
- package/lib/util/sfdcUrl.d.ts +2 -2
- package/lib/util/sfdcUrl.js +9 -8
- package/lib/util/structuredWriter.d.ts +1 -1
- package/lib/util/time.d.ts +1 -0
- package/lib/util/time.js +13 -0
- package/lib/util/uniqid.js +3 -3
- package/lib/util/zipWriter.d.ts +1 -1
- package/lib/util/zipWriter.js +2 -2
- package/lib/webOAuthServer.d.ts +2 -2
- package/lib/webOAuthServer.js +16 -15
- package/package.json +14 -38
- package/lib/config/tokensConfig.d.ts +0 -10
- package/lib/config/tokensConfig.js +0 -29
- package/lib/org/index.d.ts +0 -6
- package/lib/org/index.js +0 -29
- package/lib/schema/printer.d.ts +0 -81
- package/lib/schema/printer.js +0 -263
- package/lib/stateAggregator/accessors/tokenAccessor.d.ts +0 -63
- package/lib/stateAggregator/accessors/tokenAccessor.js +0 -80
- package/lib/stateAggregator/index.d.ts +0 -4
- package/lib/stateAggregator/index.js +0 -27
- package/lib/util/jsonXmlTools.d.ts +0 -14
- package/lib/util/jsonXmlTools.js +0 -39
package/lib/config/configFile.js
CHANGED
|
@@ -7,17 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ConfigFile = void 0;
|
|
10
|
-
const fs = require("fs");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const proper_lockfile_1 = require("proper-lockfile");
|
|
10
|
+
const fs = require("node:fs");
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_os_1 = require("node:os");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
15
14
|
const kit_1 = require("@salesforce/kit");
|
|
16
15
|
const global_1 = require("../global");
|
|
17
16
|
const logger_1 = require("../logger/logger");
|
|
18
17
|
const sfError_1 = require("../sfError");
|
|
19
18
|
const internal_1 = require("../util/internal");
|
|
20
|
-
const
|
|
19
|
+
const fileLocking_1 = require("../util/fileLocking");
|
|
21
20
|
const configStore_1 = require("./configStore");
|
|
22
21
|
const lwwMap_1 = require("./lwwMap");
|
|
23
22
|
/**
|
|
@@ -90,7 +89,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
90
89
|
* @param isGlobal True if the config should be global. False for local.
|
|
91
90
|
*/
|
|
92
91
|
static async resolveRootFolder(isGlobal) {
|
|
93
|
-
return isGlobal ? (0,
|
|
92
|
+
return isGlobal ? (0, node_os_1.homedir)() : (0, internal_1.resolveProjectPath)();
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
95
|
* Helper used to determine what the local and global folder point to. Returns the file path of the root folder.
|
|
@@ -98,7 +97,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
98
97
|
* @param isGlobal True if the config should be global. False for local.
|
|
99
98
|
*/
|
|
100
99
|
static resolveRootFolderSync(isGlobal) {
|
|
101
|
-
return isGlobal ? (0,
|
|
100
|
+
return isGlobal ? (0, node_os_1.homedir)() : (0, internal_1.resolveProjectPathSync)();
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
104
103
|
* Determines if the config file is read/write accessible. Returns `true` if the user has capabilities specified
|
|
@@ -148,7 +147,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
148
147
|
// Only need to read config files once. They are kept up to date
|
|
149
148
|
// internally and updated persistently via write().
|
|
150
149
|
if (!this.hasRead || force) {
|
|
151
|
-
this.logger.
|
|
150
|
+
this.logger.debug(`Reading config file: ${this.getPath()} because ${!this.hasRead ? 'hasRead is false' : 'force parameter is true'}`);
|
|
152
151
|
const obj = (0, kit_1.parseJsonMap)(await fs.promises.readFile(this.getPath(), 'utf8'), this.getPath());
|
|
153
152
|
this.setContentsFromFileContents(obj, (await fs.promises.stat(this.getPath(), { bigint: true })).mtimeNs);
|
|
154
153
|
}
|
|
@@ -161,7 +160,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
161
160
|
this.hasRead = true;
|
|
162
161
|
if (err.code === 'ENOENT') {
|
|
163
162
|
if (!throwOnNotFound) {
|
|
164
|
-
this.setContentsFromFileContents({}
|
|
163
|
+
this.setContentsFromFileContents({});
|
|
165
164
|
return this.getContents();
|
|
166
165
|
}
|
|
167
166
|
}
|
|
@@ -184,7 +183,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
184
183
|
// Only need to read config files once. They are kept up to date
|
|
185
184
|
// internally and updated persistently via write().
|
|
186
185
|
if (!this.hasRead || force) {
|
|
187
|
-
this.logger.
|
|
186
|
+
this.logger.debug(`Reading config file: ${this.getPath()}`);
|
|
188
187
|
const obj = (0, kit_1.parseJsonMap)(fs.readFileSync(this.getPath(), 'utf8'));
|
|
189
188
|
this.setContentsFromFileContents(obj, fs.statSync(this.getPath(), { bigint: true }).mtimeNs);
|
|
190
189
|
}
|
|
@@ -197,7 +196,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
197
196
|
this.hasRead = true;
|
|
198
197
|
if (err.code === 'ENOENT') {
|
|
199
198
|
if (!throwOnNotFound) {
|
|
200
|
-
this.setContentsFromFileContents({}
|
|
199
|
+
this.setContentsFromFileContents({});
|
|
201
200
|
return this.getContents();
|
|
202
201
|
}
|
|
203
202
|
}
|
|
@@ -216,39 +215,18 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
216
215
|
* @param newContents The new contents of the file.
|
|
217
216
|
*/
|
|
218
217
|
async write() {
|
|
219
|
-
|
|
220
|
-
try {
|
|
221
|
-
await fs.promises.mkdir((0, path_1.dirname)(this.getPath()), { recursive: true });
|
|
222
|
-
}
|
|
223
|
-
catch (err) {
|
|
224
|
-
throw sfError_1.SfError.wrap(err);
|
|
225
|
-
}
|
|
226
|
-
let unlockFn;
|
|
218
|
+
const lockResponse = await (0, fileLocking_1.lockInit)(this.getPath());
|
|
227
219
|
// lock the file. Returns an unlock function to call when done.
|
|
228
220
|
try {
|
|
229
|
-
unlockFn = await (0, proper_lockfile_1.lock)(this.getPath(), lockRetryOptions_1.lockRetryOptions);
|
|
230
|
-
// get the file modstamp. Do this after the lock acquisition in case the file is being written to.
|
|
231
221
|
const fileTimestamp = (await fs.promises.stat(this.getPath(), { bigint: true })).mtimeNs;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// merge the new contents into the in-memory LWWMap
|
|
235
|
-
this.contents.merge(stateFromFile);
|
|
222
|
+
const fileContents = (0, kit_1.parseJsonMap)(await fs.promises.readFile(this.getPath(), 'utf8'), this.getPath());
|
|
223
|
+
this.logAndMergeContents(fileTimestamp, fileContents);
|
|
236
224
|
}
|
|
237
225
|
catch (err) {
|
|
238
|
-
|
|
239
|
-
this.logger.debug(`No file found at ${this.getPath()}. Write will create it.`);
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
throw err;
|
|
243
|
-
}
|
|
226
|
+
this.handleWriteError(err);
|
|
244
227
|
}
|
|
245
228
|
// write the merged LWWMap to file
|
|
246
|
-
|
|
247
|
-
await fs.promises.writeFile(this.getPath(), JSON.stringify(this.toObject(), null, 2));
|
|
248
|
-
// unlock the file
|
|
249
|
-
if (typeof unlockFn !== 'undefined') {
|
|
250
|
-
await unlockFn();
|
|
251
|
-
}
|
|
229
|
+
await lockResponse.writeAndUnlock(JSON.stringify(this.getContents(), null, 2));
|
|
252
230
|
return this.getContents();
|
|
253
231
|
}
|
|
254
232
|
/**
|
|
@@ -258,51 +236,31 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
258
236
|
* @param newContents The new contents of the file.
|
|
259
237
|
*/
|
|
260
238
|
writeSync() {
|
|
239
|
+
const lockResponse = (0, fileLocking_1.lockInitSync)(this.getPath());
|
|
261
240
|
try {
|
|
262
|
-
fs.mkdirSync((0, path_1.dirname)(this.getPath()), { recursive: true });
|
|
263
|
-
}
|
|
264
|
-
catch (err) {
|
|
265
|
-
throw sfError_1.SfError.wrap(err);
|
|
266
|
-
}
|
|
267
|
-
let unlockFn;
|
|
268
|
-
try {
|
|
269
|
-
// lock the file. Returns an unlock function to call when done.
|
|
270
|
-
unlockFn = (0, proper_lockfile_1.lockSync)(this.getPath(), lockRetryOptions_1.lockOptions);
|
|
271
241
|
// get the file modstamp. Do this after the lock acquisition in case the file is being written to.
|
|
272
242
|
const fileTimestamp = fs.statSync(this.getPath(), { bigint: true }).mtimeNs;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// merge the new contents into the in-memory LWWMap
|
|
276
|
-
this.contents.merge(stateFromFile);
|
|
243
|
+
const fileContents = (0, kit_1.parseJsonMap)(fs.readFileSync(this.getPath(), 'utf8'), this.getPath());
|
|
244
|
+
this.logAndMergeContents(fileTimestamp, fileContents);
|
|
277
245
|
}
|
|
278
246
|
catch (err) {
|
|
279
|
-
|
|
280
|
-
this.logger.debug(`No file found at ${this.getPath()}. Write will create it.`);
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
throw err;
|
|
284
|
-
}
|
|
247
|
+
this.handleWriteError(err);
|
|
285
248
|
}
|
|
286
249
|
// write the merged LWWMap to file
|
|
287
|
-
|
|
288
|
-
fs.writeFileSync(this.getPath(), JSON.stringify(this.toObject(), null, 2));
|
|
289
|
-
if (typeof unlockFn !== 'undefined') {
|
|
290
|
-
// unlock the file
|
|
291
|
-
unlockFn();
|
|
292
|
-
}
|
|
250
|
+
lockResponse.writeAndUnlock(JSON.stringify(this.getContents(), null, 2));
|
|
293
251
|
return this.getContents();
|
|
294
252
|
}
|
|
295
253
|
/**
|
|
296
254
|
* Check to see if the config file exists. Returns `true` if the config file exists and has access, false otherwise.
|
|
297
255
|
*/
|
|
298
256
|
async exists() {
|
|
299
|
-
return this.access(
|
|
257
|
+
return this.access(node_fs_1.constants.R_OK);
|
|
300
258
|
}
|
|
301
259
|
/**
|
|
302
260
|
* Check to see if the config file exists. Returns `true` if the config file exists and has access, false otherwise.
|
|
303
261
|
*/
|
|
304
262
|
existsSync() {
|
|
305
|
-
return this.accessSync(
|
|
263
|
+
return this.accessSync(node_fs_1.constants.R_OK);
|
|
306
264
|
}
|
|
307
265
|
/**
|
|
308
266
|
* Get the stats of the file. Returns the stats of the file.
|
|
@@ -363,9 +321,9 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
363
321
|
? this.options.rootFolder
|
|
364
322
|
: ConfigFile.resolveRootFolderSync(Boolean(this.options.isGlobal));
|
|
365
323
|
if (this.options.isGlobal === true || this.options.isState === true) {
|
|
366
|
-
configRootFolder = (0,
|
|
324
|
+
configRootFolder = (0, node_path_1.join)(configRootFolder, this.options.stateFolder ?? global_1.Global.SFDX_STATE_FOLDER);
|
|
367
325
|
}
|
|
368
|
-
this.path = (0,
|
|
326
|
+
this.path = (0, node_path_1.join)(configRootFolder, this.options.filePath ? this.options.filePath : '', this.options.filename);
|
|
369
327
|
}
|
|
370
328
|
return this.path;
|
|
371
329
|
}
|
|
@@ -386,6 +344,25 @@ class ConfigFile extends configStore_1.BaseConfigStore {
|
|
|
386
344
|
// Read the file, which also sets the path and throws any errors around project paths.
|
|
387
345
|
await this.read(this.options.throwOnNotFound);
|
|
388
346
|
}
|
|
347
|
+
// method exists to share code between write() and writeSync()
|
|
348
|
+
logAndMergeContents(fileTimestamp, fileContents) {
|
|
349
|
+
this.logger.debug(`Existing file contents on filesystem (timestamp: ${fileTimestamp.toString()}`, fileContents);
|
|
350
|
+
this.logger.debug('Contents in configFile in-memory', this.getContents());
|
|
351
|
+
// read the file contents into a LWWMap using the modstamp
|
|
352
|
+
const stateFromFile = (0, lwwMap_1.stateFromContents)(fileContents, fileTimestamp);
|
|
353
|
+
// merge the new contents into the in-memory LWWMap
|
|
354
|
+
this.contents.merge(stateFromFile);
|
|
355
|
+
this.logger.debug('Result from merge', this.getContents());
|
|
356
|
+
}
|
|
357
|
+
// shared error handling for both write() and writeSync()
|
|
358
|
+
handleWriteError(err) {
|
|
359
|
+
if (err instanceof Error && err.message.includes('ENOENT')) {
|
|
360
|
+
this.logger.debug(`No file found at ${this.getPath()}. Write will create it.`);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
throw err;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
389
366
|
}
|
|
390
367
|
exports.ConfigFile = ConfigFile;
|
|
391
368
|
//# sourceMappingURL=configFile.js.map
|
|
@@ -22,9 +22,7 @@ export interface ConfigStore<P extends ConfigContents = ConfigContents> {
|
|
|
22
22
|
clear(): void;
|
|
23
23
|
values(): ConfigValue[];
|
|
24
24
|
forEach(actionFn: (key: string, value: ConfigValue) => void): void;
|
|
25
|
-
awaitEach(actionFn: (key: string, value: ConfigValue) => Promise<void>): Promise<void>;
|
|
26
25
|
getContents(): P;
|
|
27
|
-
setContents(contents?: P): void;
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* An abstract class that implements all the config management functions but
|
|
@@ -52,7 +50,7 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
52
50
|
/**
|
|
53
51
|
* Returns the value associated to the key, or undefined if there is none.
|
|
54
52
|
*
|
|
55
|
-
* @param key The key
|
|
53
|
+
* @param key The key (object property)
|
|
56
54
|
* @param decrypt If it is an encrypted key, decrypt the value.
|
|
57
55
|
* If the value is an object, a clone will be returned.
|
|
58
56
|
*/
|
|
@@ -81,30 +79,28 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
81
79
|
* @param value The value.
|
|
82
80
|
*/
|
|
83
81
|
set<K extends Key<P>>(key: K, value: P[K]): void;
|
|
84
|
-
set<V = ConfigValue>(key: string, value: V): void;
|
|
85
82
|
/**
|
|
86
83
|
* Updates the value for the key in the config object. If the value is an object, it
|
|
87
84
|
* will be merged with the existing object.
|
|
88
85
|
*
|
|
89
|
-
* @param key The key.
|
|
86
|
+
* @param key The key.
|
|
90
87
|
* @param value The value.
|
|
91
88
|
*/
|
|
92
89
|
update<K extends Key<P>>(key: K, value: Partial<P[K]>): void;
|
|
93
|
-
update<V = ConfigValue>(key: string, value: Partial<V>): void;
|
|
94
90
|
/**
|
|
95
91
|
* Returns `true` if an element in the config object existed and has been removed, or `false` if the element does not
|
|
96
92
|
* exist. {@link BaseConfigStore.has} will return false afterwards.
|
|
97
93
|
*
|
|
98
94
|
* @param key The key
|
|
99
95
|
*/
|
|
100
|
-
unset(key:
|
|
96
|
+
unset<K extends Key<P>>(key: K): boolean;
|
|
101
97
|
/**
|
|
102
98
|
* Returns `true` if all elements in the config object existed and have been removed, or `false` if all the elements
|
|
103
99
|
* do not exist (some may have been removed). {@link BaseConfigStore.has(key)} will return false afterwards.
|
|
104
100
|
*
|
|
105
|
-
* @param keys The keys
|
|
101
|
+
* @param keys The keys
|
|
106
102
|
*/
|
|
107
|
-
unsetAll(keys:
|
|
103
|
+
unsetAll(keys: Array<Key<P>>): boolean;
|
|
108
104
|
/**
|
|
109
105
|
* Removes all key/value pairs from the config object.
|
|
110
106
|
*/
|
|
@@ -123,27 +119,13 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
123
119
|
* @param decrypt: decrypt all data in the config. A clone of the data will be returned.
|
|
124
120
|
*
|
|
125
121
|
*/
|
|
126
|
-
getContents(decrypt?: boolean): P
|
|
127
|
-
/**
|
|
128
|
-
* Sets the entire config contents.
|
|
129
|
-
*
|
|
130
|
-
* @param contents The contents.
|
|
131
|
-
*/
|
|
132
|
-
setContents(contents?: P): void;
|
|
122
|
+
getContents(decrypt?: boolean): Readonly<P>;
|
|
133
123
|
/**
|
|
134
124
|
* Invokes `actionFn` once for each key-value pair present in the config object.
|
|
135
125
|
*
|
|
136
126
|
* @param {function} actionFn The function `(key: string, value: ConfigValue) => void` to be called for each element.
|
|
137
127
|
*/
|
|
138
128
|
forEach(actionFn: (key: string, value: ConfigValue) => void): void;
|
|
139
|
-
/**
|
|
140
|
-
* Asynchronously invokes `actionFn` once for each key-value pair present in the config object.
|
|
141
|
-
*
|
|
142
|
-
* @param {function} actionFn The function `(key: string, value: ConfigValue) => Promise<void>` to be called for
|
|
143
|
-
* each element.
|
|
144
|
-
* @returns {Promise<void>}
|
|
145
|
-
*/
|
|
146
|
-
awaitEach(actionFn: (key: string, value: ConfigValue) => Promise<void>): Promise<void>;
|
|
147
129
|
/**
|
|
148
130
|
* Convert the config object to a JSON object. Returns the config contents.
|
|
149
131
|
* Same as calling {@link ConfigStore.getContents}
|
|
@@ -154,8 +136,19 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
154
136
|
*
|
|
155
137
|
* @param obj The object.
|
|
156
138
|
*/
|
|
157
|
-
setContentsFromObject
|
|
158
|
-
|
|
139
|
+
setContentsFromObject(obj: P): void;
|
|
140
|
+
/**
|
|
141
|
+
* Keep ConfigFile concurrency-friendly.
|
|
142
|
+
* Avoid using this unless you're reading the file for the first time
|
|
143
|
+
* and guaranteed to no be cross-saving existing contents
|
|
144
|
+
* */
|
|
145
|
+
protected setContentsFromFileContents(contents: P, timestamp?: bigint): void;
|
|
146
|
+
/**
|
|
147
|
+
* Sets the entire config contents.
|
|
148
|
+
*
|
|
149
|
+
* @param contents The contents.
|
|
150
|
+
*/
|
|
151
|
+
protected setContents(contents?: P): void;
|
|
159
152
|
protected getEncryptedKeys(): Array<string | RegExp>;
|
|
160
153
|
/**
|
|
161
154
|
* This config file has encrypted keys and it should attempt to encrypt them.
|
|
@@ -163,8 +156,6 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
163
156
|
* @returns Has encrypted keys
|
|
164
157
|
*/
|
|
165
158
|
protected hasEncryption(): boolean;
|
|
166
|
-
protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void;
|
|
167
|
-
protected getMethod(contents: ConfigContents, key: string): Optional<ConfigValue>;
|
|
168
159
|
protected initialContents(): P;
|
|
169
160
|
/**
|
|
170
161
|
* Used to initialize asynchronous components.
|
|
@@ -186,7 +177,7 @@ export declare abstract class BaseConfigStore<T extends BaseConfigStore.Options
|
|
|
186
177
|
*/
|
|
187
178
|
protected isCryptoKey(key: string): string | RegExp | undefined;
|
|
188
179
|
protected encrypt(value: unknown): Optional<string>;
|
|
189
|
-
protected decrypt(value: unknown):
|
|
180
|
+
protected decrypt(value: unknown): string | undefined;
|
|
190
181
|
/**
|
|
191
182
|
* Encrypt all values in a nested JsonMap.
|
|
192
183
|
*
|
|
@@ -12,6 +12,7 @@ const ts_types_1 = require("@salesforce/ts-types");
|
|
|
12
12
|
const ts_types_2 = require("@salesforce/ts-types");
|
|
13
13
|
const crypto_1 = require("../crypto/crypto");
|
|
14
14
|
const sfError_1 = require("../sfError");
|
|
15
|
+
const time_1 = require("../util/time");
|
|
15
16
|
const lwwMap_1 = require("./lwwMap");
|
|
16
17
|
/**
|
|
17
18
|
* An abstract class that implements all the config management functions but
|
|
@@ -41,17 +42,16 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
41
42
|
return (0, ts_types_2.definiteEntriesOf)(this.contents.value ?? {});
|
|
42
43
|
}
|
|
43
44
|
get(key, decrypt = false) {
|
|
44
|
-
const
|
|
45
|
-
let value = this.getMethod(this.contents.value ?? {}, k);
|
|
45
|
+
const rawValue = this.contents.get(key);
|
|
46
46
|
if (this.hasEncryption() && decrypt) {
|
|
47
|
-
if ((0, ts_types_2.isJsonMap)(
|
|
48
|
-
|
|
47
|
+
if ((0, ts_types_2.isJsonMap)(rawValue)) {
|
|
48
|
+
return this.recursiveDecrypt((0, kit_1.cloneJson)(rawValue), key);
|
|
49
49
|
}
|
|
50
|
-
else if (this.isCryptoKey(
|
|
51
|
-
|
|
50
|
+
else if (this.isCryptoKey(key)) {
|
|
51
|
+
return this.decrypt(rawValue);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return rawValue;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Returns the list of keys that contain a value.
|
|
@@ -76,6 +76,13 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
76
76
|
keys() {
|
|
77
77
|
return Object.keys(this.contents.value ?? {});
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Sets the value for the key in the config object. This will override the existing value.
|
|
81
|
+
* To do a partial update, use {@link BaseConfigStore.update}.
|
|
82
|
+
*
|
|
83
|
+
* @param key The key.
|
|
84
|
+
* @param value The value.
|
|
85
|
+
*/
|
|
79
86
|
set(key, value) {
|
|
80
87
|
if (this.hasEncryption()) {
|
|
81
88
|
if ((0, ts_types_2.isJsonMap)(value)) {
|
|
@@ -85,21 +92,30 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
85
92
|
value = this.encrypt(value);
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
|
-
// undefined
|
|
95
|
+
// set(key, undefined) means unset
|
|
89
96
|
if (value === undefined) {
|
|
90
97
|
this.unset(key);
|
|
91
98
|
}
|
|
92
99
|
else {
|
|
93
|
-
// @ts-expect-error TODO: why isn't key guaranteed to be a string
|
|
94
100
|
this.contents.set(key, value);
|
|
95
101
|
}
|
|
96
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Updates the value for the key in the config object. If the value is an object, it
|
|
105
|
+
* will be merged with the existing object.
|
|
106
|
+
*
|
|
107
|
+
* @param key The key.
|
|
108
|
+
* @param value The value.
|
|
109
|
+
*/
|
|
97
110
|
update(key, value) {
|
|
98
111
|
const existingValue = this.get(key, true);
|
|
99
112
|
if ((0, ts_types_1.isPlainObject)(existingValue) && (0, ts_types_1.isPlainObject)(value)) {
|
|
100
|
-
|
|
113
|
+
const mergedValue = Object.assign({}, existingValue, value);
|
|
114
|
+
this.set(key, mergedValue);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.set(key, value);
|
|
101
118
|
}
|
|
102
|
-
this.set(key, value);
|
|
103
119
|
}
|
|
104
120
|
/**
|
|
105
121
|
* Returns `true` if an element in the config object existed and has been removed, or `false` if the element does not
|
|
@@ -118,7 +134,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
118
134
|
* Returns `true` if all elements in the config object existed and have been removed, or `false` if all the elements
|
|
119
135
|
* do not exist (some may have been removed). {@link BaseConfigStore.has(key)} will return false afterwards.
|
|
120
136
|
*
|
|
121
|
-
* @param keys The keys
|
|
137
|
+
* @param keys The keys
|
|
122
138
|
*/
|
|
123
139
|
unsetAll(keys) {
|
|
124
140
|
return keys.map((key) => this.unset(key)).every(Boolean);
|
|
@@ -151,19 +167,6 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
151
167
|
}
|
|
152
168
|
return this.contents?.value ?? {};
|
|
153
169
|
}
|
|
154
|
-
/**
|
|
155
|
-
* Sets the entire config contents.
|
|
156
|
-
*
|
|
157
|
-
* @param contents The contents.
|
|
158
|
-
*/
|
|
159
|
-
setContents(contents = {}) {
|
|
160
|
-
if (this.hasEncryption()) {
|
|
161
|
-
contents = this.recursiveEncrypt(contents);
|
|
162
|
-
}
|
|
163
|
-
(0, ts_types_1.entriesOf)(contents).map(([key, value]) => {
|
|
164
|
-
this.contents.set(key, value);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
170
|
/**
|
|
168
171
|
* Invokes `actionFn` once for each key-value pair present in the config object.
|
|
169
172
|
*
|
|
@@ -172,17 +175,6 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
172
175
|
forEach(actionFn) {
|
|
173
176
|
this.entries().map((entry) => actionFn(entry[0], entry[1]));
|
|
174
177
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Asynchronously invokes `actionFn` once for each key-value pair present in the config object.
|
|
177
|
-
*
|
|
178
|
-
* @param {function} actionFn The function `(key: string, value: ConfigValue) => Promise<void>` to be called for
|
|
179
|
-
* each element.
|
|
180
|
-
* @returns {Promise<void>}
|
|
181
|
-
*/
|
|
182
|
-
async awaitEach(actionFn) {
|
|
183
|
-
const entries = this.entries();
|
|
184
|
-
await Promise.all(entries.map((entry) => actionFn(entry[0], entry[1])));
|
|
185
|
-
}
|
|
186
178
|
/**
|
|
187
179
|
* Convert the config object to a JSON object. Returns the config contents.
|
|
188
180
|
* Same as calling {@link ConfigStore.getContents}
|
|
@@ -201,9 +193,27 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
201
193
|
this.set(key, value);
|
|
202
194
|
});
|
|
203
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Keep ConfigFile concurrency-friendly.
|
|
198
|
+
* Avoid using this unless you're reading the file for the first time
|
|
199
|
+
* and guaranteed to no be cross-saving existing contents
|
|
200
|
+
* */
|
|
204
201
|
setContentsFromFileContents(contents, timestamp) {
|
|
205
|
-
const state = (0, lwwMap_1.stateFromContents)(contents, timestamp,
|
|
206
|
-
this.contents = new lwwMap_1.LWWMap(
|
|
202
|
+
const state = (0, lwwMap_1.stateFromContents)(contents, timestamp ?? (0, time_1.nowBigInt)());
|
|
203
|
+
this.contents = new lwwMap_1.LWWMap(state);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Sets the entire config contents.
|
|
207
|
+
*
|
|
208
|
+
* @param contents The contents.
|
|
209
|
+
*/
|
|
210
|
+
setContents(contents = {}) {
|
|
211
|
+
if (this.hasEncryption()) {
|
|
212
|
+
contents = this.recursiveEncrypt(contents);
|
|
213
|
+
}
|
|
214
|
+
(0, ts_types_1.entriesOf)(contents).map(([key, value]) => {
|
|
215
|
+
this.contents.set(key, value);
|
|
216
|
+
});
|
|
207
217
|
}
|
|
208
218
|
getEncryptedKeys() {
|
|
209
219
|
return [...(this.options?.encryptedKeys ?? []), ...(this.statics?.encryptedKeys ?? [])];
|
|
@@ -216,19 +226,6 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
216
226
|
hasEncryption() {
|
|
217
227
|
return this.getEncryptedKeys().length > 0;
|
|
218
228
|
}
|
|
219
|
-
// Allows extended classes the ability to override the set method. i.e. maybe they want
|
|
220
|
-
// nested object set from kit.
|
|
221
|
-
// eslint-disable-next-line class-methods-use-this
|
|
222
|
-
setMethod(contents, key, value) {
|
|
223
|
-
(0, kit_1.set)(contents, key, value);
|
|
224
|
-
}
|
|
225
|
-
// Allows extended classes the ability to override the get method. i.e. maybe they want
|
|
226
|
-
// nested object get from ts-types.
|
|
227
|
-
// NOTE: Key must stay string to be reliably overwritten.
|
|
228
|
-
// eslint-disable-next-line class-methods-use-this
|
|
229
|
-
getMethod(contents, key) {
|
|
230
|
-
return (0, ts_types_2.get)(contents, key);
|
|
231
|
-
}
|
|
232
229
|
// eslint-disable-next-line class-methods-use-this
|
|
233
230
|
initialContents() {
|
|
234
231
|
return {};
|
|
@@ -291,7 +288,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
291
288
|
if (!this.crypto)
|
|
292
289
|
throw new sfError_1.SfError('crypto is not initialized', 'CryptoNotInitializedError');
|
|
293
290
|
if (!(0, ts_types_2.isString)(value))
|
|
294
|
-
throw new sfError_1.SfError(`can only encrypt strings but found: ${typeof value} : ${
|
|
291
|
+
throw new sfError_1.SfError(`can only encrypt strings but found: ${typeof value} : ${JSON.stringify(value)}`, 'InvalidCryptoValueError');
|
|
295
292
|
return this.crypto.isEncrypted(value) ? value : this.crypto.encrypt(value);
|
|
296
293
|
}
|
|
297
294
|
decrypt(value) {
|
|
@@ -300,7 +297,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
300
297
|
if (!this.crypto)
|
|
301
298
|
throw new sfError_1.SfError('crypto is not initialized', 'CryptoNotInitializedError');
|
|
302
299
|
if (!(0, ts_types_2.isString)(value))
|
|
303
|
-
throw new sfError_1.SfError(`can only encrypt strings but found: ${typeof value} : ${
|
|
300
|
+
throw new sfError_1.SfError(`can only encrypt strings but found: ${typeof value} : ${JSON.stringify(value)}`, 'InvalidCryptoValueError');
|
|
304
301
|
return this.crypto.isEncrypted(value) ? this.crypto.decrypt(value) : value;
|
|
305
302
|
}
|
|
306
303
|
/**
|
package/lib/config/envVars.js
CHANGED
|
@@ -7,11 +7,12 @@ exports.envVars = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.Environ
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
11
|
const change_case_1 = require("change-case");
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const messages_1 = require("../messages");
|
|
14
14
|
const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
15
|
+
;
|
|
15
16
|
const messages = new messages_1.Messages('@salesforce/core', 'envVars', new Map([["forceOpenUrl", "Web page that opens in your browser when you connect to an org. For example, to open Lightning Experience, set to \"lightning\"."], ["forceShowSpinner", "Set to true to show a spinner animation on the command line when running asynchronous CLI commands. Default is false."], ["forceSpinnerDelay", "Speed of the spinner in milliseconds. Default is 60."], ["httpProxy", "HTTP URL and port of the proxy server when using Salesforce CLI behind a corporate firewall or web proxy."], ["httpsProxy", "HTTPS URL and port of the proxy server when using Salesforce CLI behind a corporate firewall or web proxy."], ["nodeExtraCaCerts", "Fully qualified path to your self-signed certificate. Will be installed after you run \"sfdx update\"."], ["nodeTlsRejectUnauthorized", "Set to 0 to allow Node.js to use the self-signed certificate in the certificate chain."], ["sfdxAccessToken", "Specifies an access token when using the auth:accesstoken:store command."], ["sfdxApiVersion", "The API version for a specific project or all projects. Default value is the API version of your Dev Hub. Overrides the apiVersion config value."], ["sfdxAudienceUrl", "URL that overrides the aud (audience) field used for JWT authentication so that it matches the expected value of the authorization server URL for the org you\u2019re logging into."], ["sfdxCodeCoverageRequirement", "Code coverage percentages that are displayed in green when you run force:apex:test:\\* with the --codecoverage parameter."], ["sfdxContentType", "Set to JSON so that all CLI commands output results in JSON format."], ["sfdxDefaultdevhubusername", "Username or alias of your default Dev Hub org. Overrides the defaultdevhubusername configuration value."], ["sfdxDefaultusername", "Username or alias of your default org. Overrides the defaultusername configuration value."], ["sfdxDisableAutoupdate", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfdxAutoupdateDisable", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfdxDisableSourceMemberPolling", "Set to true to disable polling of your org\u2019s SourceMember object when you run the force:source:push|pull commands. Default value is false."], ["sfdxDisableTelemetry", "Set to true to disable Salesforce CLI from collecting usage information, user environment information, and crash reports. Default value is false. Overrides the disableTelemetry configration variable."], ["sfdxDnsTimeout", "Number of seconds that the force:org:\\* commands wait for a response when checking whether an org is connected. Default value is 3."], ["sfdxDomainRetry", "Time, in seconds, that Salesforce CLI waits for the Lightning Experience custom domain to resolve and become available in a scratch org. Default value is 240."], ["sfdxImprovedCodeCoverage", "Set to true to scope Apex test results to the classes entered during a test run when running force:apex:test:\\*."], ["sfdxInstanceUrl", "URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. Overrides the instanceUrl configuration value."], ["sfdxJsonToStdout", "Set to true to send messages resulting from failed Salesforce CLI commands to stdout instead of stderr."], ["sfdxDisableLogFile", "Set to true to disable log file writing"], ["sfdxLogLevel", "Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn."], ["sfdxLogRotationCount", "The default rotation period for logs. Example '1d' will rotate logs daily (at midnight)."], ["sfdxLogRotationPeriod", "The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files."], ["sfdxMaxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration value."], ["sfdxMdapiTempDir", "Directory that contains files (in metadata format) when running certain Salesforce CLI commands, such as force:source:\\*."], ["sfdxNpmRegistry", "URL to a private npm server, where all packages that you publish are private."], ["sfdxPrecompileEnable", "Set to true to enable Apex pre-compile before the tests are run with the force:apex:test:run command. Default is false."], ["sfdxProjectAutoupdateDisableForPackageCreate", "Set to true to disable automatic updates to sfdx-project.json when running force:package:create."], ["sfdxProjectAutoupdateDisableForPackageVersionCreate", "Set to true to disable automatic updates to sfdx-project.json when running force:package:version:create."], ["sfdxRestDeploy", "Set to true to make Salesforce CLI use the Metadata REST API for deployments. By default, the CLI uses SOAP."], ["sfdxSourceMemberPollingTimeout", "Number of seconds you want the force:source:push command to keep polling the SourceMember object before the command times out."], ["sfdxUseGenericUnixKeychain", "(Linux and macOS only) Set to true if you want to use the generic UNIX keychain instead of the Linux libsecret library or macOS keychain."], ["sfdxUseProgressBar", "Set to false to disable the progress bar when running force:mdapi:deploy, force:source:deploy, or force:source:push."], ["sfdxLazyLoadModules", "Set to true to enable lazy loading of sfdx modules"], ["sfdxS3Host", "URL to S3 host"], ["sfdxUpdateInstructions", "Text that describes how to update sfdx"], ["sfdxInstaller", "Boolean indicating that the installer is running"], ["sfdxEnv", "Describes if sfdx is in \"demo\" mode"], ["sfTargetOrg", "Username or alias of your default org. Overrides the target-org configuration variable."], ["sfTargetDevHub", "Username or alias of your default Dev Hub org. Overrides the target-dev-hub configuration variable."], ["sfAccessToken", "Specifies an access token when using a login command that uses access tokens."], ["sfOrgApiVersion", "API version for a specific project or all projects. Default value is the API version of your Dev Hub. Overrides the apiVersion configuration variable."], ["sfAudienceUrl", "URL that overrides the aud (audience) field used for JWT authentication so that it matches the expected value of the authorization server URL for the org you\u2019re logging into."], ["sfCodeCoverageRequirement", "Code coverage percentages that are displayed in green when you run the Apex test CLIcommands with the --code-coverage flag."], ["sfContentType", "Set to JSON so that all CLI commands output results in JSON format."], ["sfDisableAutoupdate", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfAutoupdateDisable", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfDisableSourceMemberPolling", "Set to true to disable polling of your org\u2019s SourceMember object when you run the commands to push and pull source. Default value is false."], ["sfDisableTelemetry", "Set to true to disable Salesforce CLI from collecting usage information, user environment information, and crash reports. Default value is false. Overrides the disableTelemetry configration variable."], ["sfDnsTimeout", "Number of seconds that the env commands wait for a response when checking whether an org is connected. Default value is 3."], ["sfDomainRetry", "Time, in seconds, that Salesforce CLI waits for the Lightning Experience custom domain to resolve and become available in a scratch org. Default value is 240."], ["sfImprovedCodeCoverage", "Set to true to scope Apex test results to the classes entered during a test run when running the Apex test commands."], ["sfOrgInstanceUrl", "URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. Overrides the instanceUrl configuration variable."], ["sfJsonToStdout", "Set to true to send messages resulting from failed Salesforce CLI commands to stdout instead of stderr."], ["sfDisableLogFile", "Set to true to disable log file writing"], ["sfLogLevel", "Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn."], ["sfLogRotationCount", "The default rotation period for logs. Example '1d' will rotate logs daily (at midnight)."], ["sfLogRotationPeriod", "The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files."], ["sfOrgMaxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration variable."], ["sfMdapiTempDir", "Directory that contains files (in metadata format) when running certain Salesforce CLI commands."], ["sfNpmRegistry", "URL to a private npm server, where all packages that you publish are private."], ["sfPrecompileEnable", "Set to true to enable Apex pre-compile before the tests are run with the Apex test run command. Default is false."], ["sfProjectAutoupdateDisableForPackageCreate", "Set to true to disable automatic updates to sfdx-project.json when running the package create command."], ["sfProjectAutoupdateDisableForPackageVersionCreate", "Set to true to disable automatic updates to sfdx-project.json when running the package version create command."], ["sfSourceMemberPollingTimeout", "Number of seconds you want the source push command to keep polling the SourceMember object before the command times out."], ["sfUseGenericUnixKeychain", "(Linux and macOS only) Set to true if you want to use the generic UNIX keychain instead of the Linux libsecret library or macOS keychain."], ["sfUseProgressBar", "Set to false to disable the progress bar when running the metadata deploy command."], ["sfLazyLoadModules", "Set to true to enable lazy loading of sf modules"], ["sfS3Host", "URL to S3 host"], ["sfUpdateInstructions", "Text that describes how to update sf"], ["sfInstaller", "Boolean indicating that the installer is running"], ["sfEnv", "Describes if sf is in \"demo\" mode"], ["deprecatedEnv", "Deprecated environment variable: %s. Please use %s instead."], ["deprecatedEnvDisagreement", "Deprecated environment variable: %s. Please use %s instead.\n\nYour environment has both variables populated, and with different values. The value from %s will be used."]]));
|
|
16
17
|
var EnvironmentVariable;
|
|
17
18
|
(function (EnvironmentVariable) {
|
|
@@ -91,7 +92,7 @@ var EnvironmentVariable;
|
|
|
91
92
|
EnvironmentVariable["SF_UPDATE_INSTRUCTIONS"] = "SF_UPDATE_INSTRUCTIONS";
|
|
92
93
|
EnvironmentVariable["SF_INSTALLER"] = "SF_INSTALLER";
|
|
93
94
|
EnvironmentVariable["SF_ENV"] = "SF_ENV";
|
|
94
|
-
})(EnvironmentVariable
|
|
95
|
+
})(EnvironmentVariable || (exports.EnvironmentVariable = EnvironmentVariable = {}));
|
|
95
96
|
const getMessage = (environmentVariable) => messages.getMessage((0, change_case_1.camelCase)(environmentVariable));
|
|
96
97
|
exports.SUPPORTED_ENV_VARS = {
|
|
97
98
|
[EnvironmentVariable.FORCE_SHOW_SPINNER]: {
|
package/lib/config/lwwMap.d.ts
CHANGED
|
@@ -8,18 +8,17 @@ export type LWWState<P> = {
|
|
|
8
8
|
* @param contents object aligning with ConfigContents
|
|
9
9
|
* @param timestamp a bigInt that sets the timestamp. Defaults to the current time
|
|
10
10
|
* construct a LWWState from an object
|
|
11
|
-
*
|
|
11
|
+
* @param keysToCheckForDeletion if a key is in this array, AND not in the contents, it will be marked as deleted
|
|
12
12
|
* */
|
|
13
|
-
export declare const stateFromContents: <P extends ConfigContents
|
|
13
|
+
export declare const stateFromContents: <P extends ConfigContents>(contents: P, timestamp?: bigint) => LWWState<P>;
|
|
14
14
|
export declare class LWWMap<P extends ConfigContents> {
|
|
15
15
|
#private;
|
|
16
|
-
|
|
17
|
-
constructor(id?: string, state?: LWWState<P>);
|
|
16
|
+
constructor(state?: LWWState<P>);
|
|
18
17
|
get value(): P;
|
|
19
18
|
get state(): LWWState<P>;
|
|
20
19
|
merge(state: LWWState<P>): LWWState<P>;
|
|
21
20
|
set<K extends Key<P>>(key: K, value: P[K]): void;
|
|
22
21
|
get<K extends Key<P>>(key: K): P[K] | undefined;
|
|
23
|
-
delete(key:
|
|
22
|
+
delete<K extends Key<P>>(key: K): void;
|
|
24
23
|
has(key: string): boolean;
|
|
25
24
|
}
|