@salesforce/core 8.18.7 → 8.19.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/lib/config/config.js +7 -30
- package/lib/config/configFile.d.ts +1 -1
- package/lib/config/configFile.js +18 -41
- package/lib/crypto/crypto.js +1 -3
- package/lib/crypto/keyChainImpl.d.ts +2 -2
- package/lib/crypto/keyChainImpl.js +10 -11
- package/lib/deviceOauthService.js +2 -2
- package/lib/fs/fs.d.ts +6 -0
- package/lib/fs/fs.js +79 -0
- package/lib/fs/types.d.ts +31 -0
- package/lib/fs/types.js +3 -0
- package/lib/global.js +5 -5
- package/lib/index.d.ts +4 -1
- package/lib/index.js +4 -1
- package/lib/lifecycleEvents.js +0 -3
- package/lib/logger/cleanup.js +3 -26
- package/lib/logger/logger.d.ts +1 -1
- package/lib/logger/logger.js +1 -1
- package/lib/messages.js +2 -1
- package/lib/org/authInfo.js +6 -6
- package/lib/org/connection.d.ts +1 -1
- package/lib/org/connection.js +5 -3
- package/lib/org/org.js +18 -20
- package/lib/org/permissionSetAssignment.js +4 -8
- package/lib/org/scratchOrgCreate.js +1 -1
- package/lib/org/scratchOrgInfoApi.js +2 -2
- package/lib/org/scratchOrgInfoGenerator.js +3 -3
- package/lib/org/scratchOrgSettingsGenerator.js +1 -1
- package/lib/org/user.js +4 -3
- package/lib/schema/validator.js +5 -5
- package/lib/sfProject.js +2 -25
- package/lib/stateAggregator/accessors/aliasAccessor.js +14 -7
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +2 -2
- package/lib/stateAggregator/accessors/orgAccessor.js +3 -3
- package/lib/status/myDomainResolver.d.ts +0 -2
- package/lib/status/myDomainResolver.js +0 -12
- package/lib/status/streamingClient.d.ts +2 -2
- package/lib/status/streamingClient.js +11 -11
- package/lib/testSetup.js +3 -3
- package/lib/util/directoryWriter.js +7 -7
- package/lib/util/fileLocking.d.ts +3 -1
- package/lib/util/fileLocking.js +19 -31
- package/lib/util/findUppercaseKeys.js +2 -2
- package/lib/util/internal.js +3 -26
- package/lib/util/lockRetryOptions.d.ts +1 -2
- package/lib/util/lockRetryOptions.js +2 -5
- package/lib/util/sfdcUrl.js +3 -2
- package/lib/util/time.js +2 -2
- package/lib/webOAuthServer.js +7 -7
- package/package.json +4 -2
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.StreamingClient = exports.CometClient = void 0;
|
|
13
13
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
14
14
|
const node_url_1 = require("node:url");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const kit_1 = require("@salesforce/kit");
|
|
16
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
17
17
|
const faye_1 = __importDefault(require("faye"));
|
|
18
18
|
const logger_1 = require("../logger/logger");
|
|
19
19
|
const sfError_1 = require("../sfError");
|
|
@@ -96,7 +96,7 @@ function validateTimeout(newTime, existingTime) {
|
|
|
96
96
|
* });
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
|
-
class StreamingClient extends
|
|
99
|
+
class StreamingClient extends kit_1.AsyncOptionalCreatable {
|
|
100
100
|
targetUrl;
|
|
101
101
|
options;
|
|
102
102
|
logger;
|
|
@@ -109,8 +109,8 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
|
|
|
109
109
|
*/
|
|
110
110
|
constructor(options) {
|
|
111
111
|
super(options);
|
|
112
|
-
this.options = (0,
|
|
113
|
-
const instanceUrl = (0,
|
|
112
|
+
this.options = (0, ts_types_1.ensure)(options);
|
|
113
|
+
const instanceUrl = (0, ts_types_1.ensure)(this.options.org.getConnection().getAuthInfoFields().instanceUrl);
|
|
114
114
|
/**
|
|
115
115
|
* The salesforce network infrastructure issues a cookie called sfdx-stream if it sees /cometd in the url.
|
|
116
116
|
* Without this cookie request response streams will experience intermittent client session failures.
|
|
@@ -174,7 +174,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
|
|
|
174
174
|
const replayFromMap = {};
|
|
175
175
|
replayFromMap[this.options.channel] = replayId;
|
|
176
176
|
// add "ext : { "replay" : { CHANNEL : REPLAY_VALUE }}" to subscribe message
|
|
177
|
-
(0,
|
|
177
|
+
(0, kit_1.set)(message, 'ext.replay', replayFromMap);
|
|
178
178
|
}
|
|
179
179
|
callback(message);
|
|
180
180
|
},
|
|
@@ -273,7 +273,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
|
|
|
273
273
|
if (message &&
|
|
274
274
|
message.channel === '/meta/handshake' &&
|
|
275
275
|
message.error &&
|
|
276
|
-
(0,
|
|
276
|
+
(0, ts_types_1.ensureString)(message.error).includes('400::API version in the URI is mandatory')) {
|
|
277
277
|
throw messages.createError('handshakeApiVersionError', [this.options.apiVersion]);
|
|
278
278
|
}
|
|
279
279
|
cb(message);
|
|
@@ -333,8 +333,8 @@ exports.StreamingClient = StreamingClient;
|
|
|
333
333
|
class DefaultOptions {
|
|
334
334
|
static SFDX_ENABLE_FAYE_COOKIES_ALLOW_ALL_PATHS = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
|
|
335
335
|
static SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING';
|
|
336
|
-
static DEFAULT_SUBSCRIBE_TIMEOUT =
|
|
337
|
-
static DEFAULT_HANDSHAKE_TIMEOUT =
|
|
336
|
+
static DEFAULT_SUBSCRIBE_TIMEOUT = kit_1.Duration.minutes(3);
|
|
337
|
+
static DEFAULT_HANDSHAKE_TIMEOUT = kit_1.Duration.seconds(30);
|
|
338
338
|
apiVersion;
|
|
339
339
|
org;
|
|
340
340
|
streamProcessor;
|
|
@@ -352,7 +352,7 @@ exports.StreamingClient = StreamingClient;
|
|
|
352
352
|
* @param envDep
|
|
353
353
|
* @see {@link StatusResult}
|
|
354
354
|
*/
|
|
355
|
-
constructor(org, channel, streamProcessor, envDep =
|
|
355
|
+
constructor(org, channel, streamProcessor, envDep = kit_1.env) {
|
|
356
356
|
if (envDep) {
|
|
357
357
|
const logger = logger_1.Logger.childFromRoot('StreamingClient');
|
|
358
358
|
logger.warn('envDep is deprecated');
|
|
@@ -387,7 +387,7 @@ exports.StreamingClient = StreamingClient;
|
|
|
387
387
|
faye_1.default.logger = {};
|
|
388
388
|
['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
|
|
389
389
|
// @ts-ignore
|
|
390
|
-
(0,
|
|
390
|
+
(0, kit_1.set)(faye_1.default.logger, element, logLine);
|
|
391
391
|
});
|
|
392
392
|
},
|
|
393
393
|
};
|
package/lib/testSetup.js
CHANGED
|
@@ -38,11 +38,11 @@ exports.shouldThrowSync = shouldThrowSync;
|
|
|
38
38
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
39
39
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
40
40
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
41
|
-
const fs = __importStar(require("node:fs"));
|
|
42
41
|
const node_events_1 = require("node:events");
|
|
43
42
|
const node_os_1 = require("node:os");
|
|
44
43
|
const node_path_1 = require("node:path");
|
|
45
44
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
45
|
+
const fs_1 = require("./fs/fs");
|
|
46
46
|
const configAggregator_1 = require("./config/configAggregator");
|
|
47
47
|
const configFile_1 = require("./config/configFile");
|
|
48
48
|
const connection_1 = require("./org/connection");
|
|
@@ -303,8 +303,8 @@ class TestContext {
|
|
|
303
303
|
stubAliases(aliases, group = aliasAccessorEntireFile.DEFAULT_GROUP) {
|
|
304
304
|
// we don't really "stub" these since they don't use configFile.
|
|
305
305
|
// write the fileContents to location
|
|
306
|
-
fs.mkdirSync((0, node_path_1.dirname)(getAliasFileLocation()), { recursive: true });
|
|
307
|
-
fs.writeFileSync(getAliasFileLocation(), JSON.stringify({ [group]: aliases }));
|
|
306
|
+
fs_1.fs.mkdirSync((0, node_path_1.dirname)(getAliasFileLocation()), { recursive: true });
|
|
307
|
+
fs_1.fs.writeFileSync(getAliasFileLocation(), JSON.stringify({ [group]: aliases }));
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
310
|
* Stub contents in the config file.
|
|
@@ -31,20 +31,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.DirectoryWriter = void 0;
|
|
33
33
|
const node_stream_1 = require("node:stream");
|
|
34
|
-
const fs = __importStar(require("node:fs"));
|
|
35
34
|
const os = __importStar(require("node:os"));
|
|
36
35
|
const path = __importStar(require("node:path"));
|
|
37
36
|
const node_util_1 = require("node:util");
|
|
37
|
+
const fs_1 = require("../fs/fs");
|
|
38
38
|
const pipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
|
|
39
39
|
class DirectoryWriter {
|
|
40
40
|
rootDestination;
|
|
41
41
|
constructor(rootDestination) {
|
|
42
42
|
this.rootDestination = rootDestination;
|
|
43
43
|
if (!this.rootDestination) {
|
|
44
|
-
this.rootDestination = fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);
|
|
44
|
+
this.rootDestination = fs_1.fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
fs.mkdirSync(this.rootDestination, { recursive: true });
|
|
47
|
+
fs_1.fs.mkdirSync(this.rootDestination, { recursive: true });
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -54,16 +54,16 @@ class DirectoryWriter {
|
|
|
54
54
|
async addToStore(contents, targetPath) {
|
|
55
55
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
56
|
const destPath = path.join(this.rootDestination, targetPath);
|
|
57
|
-
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
57
|
+
fs_1.fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
58
58
|
if (contents instanceof node_stream_1.Readable) {
|
|
59
|
-
const writeStream = fs.createWriteStream(destPath);
|
|
59
|
+
const writeStream = fs_1.fs.createWriteStream(destPath);
|
|
60
60
|
await pipeline(contents, writeStream);
|
|
61
61
|
}
|
|
62
62
|
else if (typeof contents === 'string') {
|
|
63
|
-
fs.writeFileSync(destPath, contents);
|
|
63
|
+
fs_1.fs.writeFileSync(destPath, contents);
|
|
64
64
|
}
|
|
65
65
|
else if (contents instanceof Buffer) {
|
|
66
|
-
fs.writeFileSync(destPath, contents);
|
|
66
|
+
fs_1.fs.writeFileSync(destPath, contents);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type LockInitResponse = {
|
|
1
|
+
export type LockInitResponse = {
|
|
2
2
|
writeAndUnlock: (data: string) => Promise<void>;
|
|
3
3
|
unlock: () => Promise<void>;
|
|
4
4
|
};
|
|
@@ -6,6 +6,8 @@ type LockInitSyncResponse = {
|
|
|
6
6
|
writeAndUnlock: (data: string) => void;
|
|
7
7
|
unlock: () => void;
|
|
8
8
|
};
|
|
9
|
+
export declare const noop: () => void;
|
|
10
|
+
export declare const asyncNoop: () => Promise<void>;
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
11
13
|
*This method exists as a separate function so it can be used by ConfigFile OR outside of ConfigFile.
|
package/lib/util/fileLocking.js
CHANGED
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.pollUntilUnlockSync = exports.pollUntilUnlock = exports.lockInitSync = exports.lockInit = void 0;
|
|
3
|
+
exports.pollUntilUnlockSync = exports.pollUntilUnlock = exports.lockInitSync = exports.lockInit = exports.asyncNoop = exports.noop = void 0;
|
|
27
4
|
/*
|
|
28
5
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
29
6
|
* All rights reserved.
|
|
30
7
|
* Licensed under the BSD 3-Clause license.
|
|
31
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
32
9
|
*/
|
|
33
|
-
const fs = __importStar(require("node:fs"));
|
|
34
10
|
const node_path_1 = require("node:path");
|
|
35
11
|
const proper_lockfile_1 = require("proper-lockfile");
|
|
36
12
|
const kit_1 = require("@salesforce/kit");
|
|
37
13
|
const ts_retry_promise_1 = require("ts-retry-promise");
|
|
14
|
+
const fs_1 = require("../fs/fs");
|
|
38
15
|
const sfError_1 = require("../sfError");
|
|
39
16
|
const logger_1 = require("../logger/logger");
|
|
17
|
+
const global_1 = require("../global");
|
|
40
18
|
const lockRetryOptions_1 = require("./lockRetryOptions");
|
|
19
|
+
const noop = () => { };
|
|
20
|
+
exports.noop = noop;
|
|
21
|
+
const asyncNoop = async () => { };
|
|
22
|
+
exports.asyncNoop = asyncNoop;
|
|
41
23
|
/**
|
|
42
24
|
*
|
|
43
25
|
*This method exists as a separate function so it can be used by ConfigFile OR outside of ConfigFile.
|
|
@@ -50,17 +32,17 @@ const lockRetryOptions_1 = require("./lockRetryOptions");
|
|
|
50
32
|
const lockInit = async (filePath) => {
|
|
51
33
|
// make sure we can write to the directory
|
|
52
34
|
try {
|
|
53
|
-
await fs.promises.mkdir((0, node_path_1.dirname)(filePath), { recursive: true });
|
|
35
|
+
await fs_1.fs.promises.mkdir((0, node_path_1.dirname)(filePath), { recursive: true });
|
|
54
36
|
}
|
|
55
37
|
catch (err) {
|
|
56
38
|
throw sfError_1.SfError.wrap(err);
|
|
57
39
|
}
|
|
58
|
-
const unlock = await (0, proper_lockfile_1.lock)(filePath, { ...lockRetryOptions_1.lockRetryOptions, realpath: false, fs });
|
|
40
|
+
const unlock = global_1.Global.isWeb ? exports.asyncNoop : await (0, proper_lockfile_1.lock)(filePath, { ...lockRetryOptions_1.lockRetryOptions, realpath: false, fs: fs_1.fs });
|
|
59
41
|
return {
|
|
60
42
|
writeAndUnlock: async (data) => {
|
|
61
43
|
(await logger_1.Logger.child('fileLocking.writeAndUnlock')).debug(`Writing to file: ${filePath}`);
|
|
62
44
|
try {
|
|
63
|
-
await fs.promises.writeFile(filePath, data);
|
|
45
|
+
await fs_1.fs.promises.writeFile(filePath, data);
|
|
64
46
|
}
|
|
65
47
|
finally {
|
|
66
48
|
await unlock();
|
|
@@ -77,18 +59,18 @@ exports.lockInit = lockInit;
|
|
|
77
59
|
const lockInitSync = (filePath) => {
|
|
78
60
|
// make sure we can write to the directory
|
|
79
61
|
try {
|
|
80
|
-
fs.mkdirSync((0, node_path_1.dirname)(filePath), { recursive: true });
|
|
62
|
+
fs_1.fs.mkdirSync((0, node_path_1.dirname)(filePath), { recursive: true });
|
|
81
63
|
}
|
|
82
64
|
catch (err) {
|
|
83
65
|
throw sfError_1.SfError.wrap(err);
|
|
84
66
|
}
|
|
85
|
-
const unlock = (0, proper_lockfile_1.lockSync)(filePath, { ...lockRetryOptions_1.lockOptions, realpath: false, fs });
|
|
67
|
+
const unlock = global_1.Global.isWeb ? exports.noop : (0, proper_lockfile_1.lockSync)(filePath, { ...lockRetryOptions_1.lockOptions, realpath: false, fs: fs_1.fs });
|
|
86
68
|
return {
|
|
87
69
|
writeAndUnlock: (data) => {
|
|
88
70
|
const logger = logger_1.Logger.childFromRoot('fileLocking.writeAndUnlock');
|
|
89
71
|
logger.debug(`Writing to file: ${filePath}`);
|
|
90
72
|
try {
|
|
91
|
-
fs.writeFileSync(filePath, data);
|
|
73
|
+
fs_1.fs.writeFileSync(filePath, data);
|
|
92
74
|
}
|
|
93
75
|
finally {
|
|
94
76
|
unlock();
|
|
@@ -104,6 +86,9 @@ exports.lockInitSync = lockInitSync;
|
|
|
104
86
|
* @param filePath file path to check
|
|
105
87
|
*/
|
|
106
88
|
const pollUntilUnlock = async (filePath) => {
|
|
89
|
+
if (global_1.Global.isWeb) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
107
92
|
try {
|
|
108
93
|
await (0, ts_retry_promise_1.retryDecorator)(proper_lockfile_1.check, {
|
|
109
94
|
timeout: kit_1.Duration.minutes(1).milliseconds,
|
|
@@ -119,6 +104,9 @@ const pollUntilUnlock = async (filePath) => {
|
|
|
119
104
|
};
|
|
120
105
|
exports.pollUntilUnlock = pollUntilUnlock;
|
|
121
106
|
const pollUntilUnlockSync = (filePath) => {
|
|
107
|
+
if (global_1.Global.isWeb) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
122
110
|
// Set a counter to ensure that the while loop does not run indefinitely
|
|
123
111
|
let counter = 0;
|
|
124
112
|
let locked = true;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ensureNoUppercaseKeys = void 0;
|
|
10
|
-
const
|
|
10
|
+
const node_assert_1 = require("node:assert");
|
|
11
11
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
12
|
const messages_1 = require("../messages");
|
|
13
13
|
;
|
|
@@ -16,7 +16,7 @@ const coreMessages = new messages_1.Messages('@salesforce/core', 'core', new Map
|
|
|
16
16
|
const ensureNoUppercaseKeys = (path) => (allowList = []) => (data) => {
|
|
17
17
|
const keys = getKeys(data, allowList);
|
|
18
18
|
const upperCaseKeys = keys.filter((key) => /^[A-Z]/.test(key)).join(', ');
|
|
19
|
-
|
|
19
|
+
node_assert_1.strict.strictEqual(upperCaseKeys.length, 0, coreMessages.getMessage('invalidJsonCasing', [upperCaseKeys, path]));
|
|
20
20
|
return keys;
|
|
21
21
|
};
|
|
22
22
|
exports.ensureNoUppercaseKeys = ensureNoUppercaseKeys;
|
package/lib/util/internal.js
CHANGED
|
@@ -5,35 +5,12 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
9
|
exports.traverse = exports.SFDX_PROJECT_JSON = void 0;
|
|
33
10
|
exports.resolveProjectPath = resolveProjectPath;
|
|
34
11
|
exports.resolveProjectPathSync = resolveProjectPathSync;
|
|
35
|
-
const fs = __importStar(require("node:fs"));
|
|
36
12
|
const node_path_1 = require("node:path");
|
|
13
|
+
const fs_1 = require("../fs/fs");
|
|
37
14
|
const messages_1 = require("../messages");
|
|
38
15
|
;
|
|
39
16
|
const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
|
|
@@ -99,7 +76,7 @@ exports.traverse = {
|
|
|
99
76
|
forFile: async (dir, file) => {
|
|
100
77
|
let foundProjectDir;
|
|
101
78
|
try {
|
|
102
|
-
fs.statSync((0, node_path_1.join)(dir, file));
|
|
79
|
+
fs_1.fs.statSync((0, node_path_1.join)(dir, file));
|
|
103
80
|
foundProjectDir = dir;
|
|
104
81
|
}
|
|
105
82
|
catch (err) {
|
|
@@ -124,7 +101,7 @@ exports.traverse = {
|
|
|
124
101
|
forFileSync: (dir, file) => {
|
|
125
102
|
let foundProjectDir;
|
|
126
103
|
try {
|
|
127
|
-
fs.statSync((0, node_path_1.join)(dir, file));
|
|
104
|
+
fs_1.fs.statSync((0, node_path_1.join)(dir, file));
|
|
128
105
|
foundProjectDir = dir;
|
|
129
106
|
}
|
|
130
107
|
catch (err) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
1
|
export declare const lockOptions: {
|
|
3
2
|
stale: number;
|
|
4
3
|
};
|
|
@@ -8,6 +7,6 @@ export declare const lockRetryOptions: {
|
|
|
8
7
|
maxTimeout: number;
|
|
9
8
|
factor: number;
|
|
10
9
|
};
|
|
11
|
-
fs:
|
|
10
|
+
fs: import("../fs/types").VirtualFs;
|
|
12
11
|
stale: number;
|
|
13
12
|
};
|
|
@@ -5,17 +5,14 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
9
|
exports.lockRetryOptions = exports.lockOptions = void 0;
|
|
13
10
|
// docs: https://github.com/moxystudio/node-proper-lockfile
|
|
14
|
-
const
|
|
11
|
+
const fs_1 = require("../fs/fs");
|
|
15
12
|
exports.lockOptions = { stale: 10_000 };
|
|
16
13
|
exports.lockRetryOptions = {
|
|
17
14
|
...exports.lockOptions,
|
|
18
15
|
retries: { retries: 10, maxTimeout: 1000, factor: 2 },
|
|
19
|
-
fs:
|
|
16
|
+
fs: fs_1.fs, // lockfile supports injectable fs, which is needed for browser use
|
|
20
17
|
};
|
|
21
18
|
//# sourceMappingURL=lockRetryOptions.js.map
|
package/lib/util/sfdcUrl.js
CHANGED
|
@@ -152,9 +152,10 @@ class SfdcUrl extends node_url_1.URL {
|
|
|
152
152
|
return this.origin.replace('.my.sfcrmproducts.cn', '.lightning.sfcrmapps.cn');
|
|
153
153
|
}
|
|
154
154
|
// all non-mil domains
|
|
155
|
-
|
|
155
|
+
const domain = (0, ts_types_1.ensureString)((0, ts_types_1.ensureArray)(/https?:\/\/([^.]*)/.exec(this.origin))
|
|
156
156
|
.slice(1, 2)
|
|
157
|
-
.
|
|
157
|
+
.at(-1));
|
|
158
|
+
return `https://${domain}.lightning.force.com`;
|
|
158
159
|
}
|
|
159
160
|
/**
|
|
160
161
|
* Tests whether this url has the lightning domain extension
|
package/lib/util/time.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nowBigInt = void 0;
|
|
4
2
|
/*
|
|
5
3
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
6
4
|
* All rights reserved.
|
|
7
5
|
* Licensed under the BSD 3-Clause license.
|
|
8
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
7
|
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.nowBigInt = void 0;
|
|
10
10
|
/** using globalThis.performance instead importing from node:perf_hooks so it works in browser */
|
|
11
11
|
const nowBigInt = () => BigInt((globalThis.performance.now() + globalThis.performance.timeOrigin) * 1_000_000);
|
|
12
12
|
exports.nowBigInt = nowBigInt;
|
package/lib/webOAuthServer.js
CHANGED
|
@@ -139,7 +139,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
|
|
|
139
139
|
});
|
|
140
140
|
const decryptedCopy = userAuthInfo.getFields(true);
|
|
141
141
|
if (decryptedCopy.clientApps && this.clientApp in decryptedCopy.clientApps) {
|
|
142
|
-
throw new sfError_1.SfError(`The username ${this.username} is already linked to a client app named "${this.clientApp}". Please authenticate again with a different client app name.`);
|
|
142
|
+
throw new sfError_1.SfError(`The username ${this.username ?? '<undefined>'} is already linked to a client app named "${this.clientApp}". Please authenticate again with a different client app name.`);
|
|
143
143
|
}
|
|
144
144
|
await userAuthInfo.save({
|
|
145
145
|
clientApps: {
|
|
@@ -228,7 +228,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
|
|
|
228
228
|
this.webServer.server.on('request', async (request, response) => {
|
|
229
229
|
if (request.url) {
|
|
230
230
|
const url = (0, node_url_1.parse)(request.url);
|
|
231
|
-
this.logger.debug(`processing request for uri: ${url.pathname}`);
|
|
231
|
+
this.logger.debug(`processing request for uri: ${url.pathname ?? 'null'}`);
|
|
232
232
|
if (request.method === 'GET') {
|
|
233
233
|
if (url.pathname?.startsWith('/OauthRedirect') && url.query) {
|
|
234
234
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -257,7 +257,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
|
|
|
257
257
|
this.webServer.reportError(this.oauthError, response);
|
|
258
258
|
}
|
|
259
259
|
else if (iconPaths.includes(url.pathname ?? '')) {
|
|
260
|
-
this.logger.debug(`Ignoring request for icon path: ${url.pathname}`);
|
|
260
|
+
this.logger.debug(`Ignoring request for icon path: ${url.pathname ?? 'null'}`);
|
|
261
261
|
}
|
|
262
262
|
else {
|
|
263
263
|
this.webServer.sendError(404, 'Resource not found', response);
|
|
@@ -309,10 +309,10 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
|
|
|
309
309
|
this.logger.debug('Expected an auth code but could not find one.');
|
|
310
310
|
throw messages.createError('missingAuthCode');
|
|
311
311
|
}
|
|
312
|
-
this.logger.debug(`oauthConfig.loginUrl: ${this.oauthConfig.loginUrl}`);
|
|
313
|
-
this.logger.debug(`oauthConfig.clientId: ${this.oauthConfig.clientId}`);
|
|
314
|
-
this.logger.debug(`oauthConfig.redirectUri: ${this.oauthConfig.redirectUri}`);
|
|
315
|
-
this.logger.debug(`oauthConfig.useVerifier: ${this.oauthConfig.useVerifier}`);
|
|
312
|
+
this.logger.debug(`oauthConfig.loginUrl: ${this.oauthConfig.loginUrl ?? '<undefined>'}`);
|
|
313
|
+
this.logger.debug(`oauthConfig.clientId: ${this.oauthConfig.clientId ?? '<undefined>'}`);
|
|
314
|
+
this.logger.debug(`oauthConfig.redirectUri: ${this.oauthConfig.redirectUri ?? '<undefined>'}`);
|
|
315
|
+
this.logger.debug(`oauthConfig.useVerifier: ${this.oauthConfig.useVerifier ?? '<undefined>'}`);
|
|
316
316
|
return authCode;
|
|
317
317
|
}
|
|
318
318
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"./config": "./lib/config/config.js",
|
|
14
14
|
"./configAggregator": "./lib/config/configAggregator.js",
|
|
15
15
|
"./envVars": "./lib/config/envVars.js",
|
|
16
|
+
"./fs": "./lib/fs/fs.js",
|
|
16
17
|
"./lifecycle": "./lib/lifecycleEvents.js",
|
|
17
18
|
"./logger": "./lib/logger/logger.js",
|
|
18
19
|
"./messages": "./lib/messages.js",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"@jsforce/jsforce-node": "^3.10.0",
|
|
57
58
|
"@salesforce/kit": "^3.2.2",
|
|
58
59
|
"@salesforce/schemas": "^1.9.1",
|
|
59
|
-
"@salesforce/ts-types": "^2.0.
|
|
60
|
+
"@salesforce/ts-types": "^2.0.11",
|
|
60
61
|
"ajv": "^8.17.1",
|
|
61
62
|
"change-case": "^4.1.2",
|
|
62
63
|
"fast-levenshtein": "^3.0.0",
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"js2xmlparser": "^4.0.1",
|
|
66
67
|
"jsonwebtoken": "9.0.2",
|
|
67
68
|
"jszip": "3.10.1",
|
|
69
|
+
"memfs": "^4.30.1",
|
|
68
70
|
"pino": "^9.7.0",
|
|
69
71
|
"pino-abstract-transport": "^1.2.0",
|
|
70
72
|
"pino-pretty": "^11.3.0",
|