@salesforce/core 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -4
- package/LICENSE.txt +1 -1
- package/lib/config/configStore.js +0 -1
- package/lib/exported.d.ts +1 -1
- package/lib/exported.js +4 -2
- package/lib/lifecycleEvents.d.ts +38 -1
- package/lib/lifecycleEvents.js +73 -2
- package/lib/logger.js +1 -0
- package/lib/org/authInfo.d.ts +2 -6
- package/lib/org/authInfo.js +1 -1
- package/lib/org/connection.js +5 -3
- package/lib/org/org.d.ts +121 -9
- package/lib/org/org.js +356 -22
- package/lib/sfdxError.d.ts +1 -1
- package/lib/sfdxError.js +1 -0
- package/lib/status/pollingClient.d.ts +0 -1
- package/lib/status/streamingClient.d.ts +2 -3
- package/lib/status/streamingClient.js +10 -16
- package/lib/status/types.d.ts +89 -0
- package/lib/status/types.js +18 -0
- package/lib/testSetup.d.ts +3 -2
- package/lib/testSetup.js +4 -4
- package/lib/util/sfdcUrl.d.ts +2 -1
- package/lib/util/sfdcUrl.js +14 -6
- package/messages/core.json +3 -3
- package/messages/core.md +1 -1
- package/messages/org.md +36 -0
- package/package.json +15 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [3.7.
|
|
5
|
+
### [3.7.3](https://github.com/forcedotcom/sfdx-core/compare/v3.7.2...v3.7.3) (2021-12-16)
|
|
6
6
|
|
|
7
|
+
### [3.7.2](https://github.com/forcedotcom/sfdx-core/compare/v3.7.1...v3.7.2) (2021-10-28)
|
|
7
8
|
|
|
8
9
|
### Bug Fixes
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
- make @types/sfdx-faye a dependendcy ([683680b](https://github.com/forcedotcom/sfdx-core/commit/683680b8133048f71d25ef4df7aa24d9700dc5e8))
|
|
11
12
|
|
|
12
13
|
### [3.7.1](https://github.com/forcedotcom/sfdx-core/compare/v3.7.0...v3.7.1) (2021-10-28)
|
|
13
14
|
|
|
14
15
|
## [3.7.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
|
|
15
16
|
|
|
16
|
-
|
|
17
17
|
### Features
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
- use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
|
|
20
20
|
|
|
21
21
|
### [3.6.6](https://github.com/forcedotcom/sfdx-core/compare/v3.6.5...v3.6.6) (2021-10-08)
|
|
22
22
|
|
|
@@ -222,6 +222,81 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
222
222
|
- add GlobalInfo config file ([#397](https://github.com/forcedotcom/sfdx-core/issues/397)) ([579998b](https://github.com/forcedotcom/sfdx-core/commit/579998b6ee70dbb9772e65896bbabf6d812aae23))
|
|
223
223
|
- default to reading files from cache ([12b5930](https://github.com/forcedotcom/sfdx-core/commit/12b59301df96395c4edcbfb0816dbddd45af95db))
|
|
224
224
|
|
|
225
|
+
### [2.33.1](https://github.com/forcedotcom/sfdx-core/compare/v2.33.0...v2.33.1) (2021-12-15)
|
|
226
|
+
|
|
227
|
+
### Bug Fixes
|
|
228
|
+
|
|
229
|
+
- faye doesn't use custom stuff passed it ([b1cefc7](https://github.com/forcedotcom/sfdx-core/commit/b1cefc76afde7f0dd56ed72b5539a47c118eef63))
|
|
230
|
+
|
|
231
|
+
## [2.33.0](https://github.com/forcedotcom/sfdx-core/compare/v2.32.0...v2.33.0) (2021-12-14)
|
|
232
|
+
|
|
233
|
+
### Features
|
|
234
|
+
|
|
235
|
+
- sandbox creation ([314dcf1](https://github.com/forcedotcom/sfdx-core/commit/314dcf164d93bd0e3a5f4763a4dfcdde7d0cb14a))
|
|
236
|
+
|
|
237
|
+
## [2.32.0](https://github.com/forcedotcom/sfdx-core/compare/v2.31.1...v2.32.0) (2021-12-14)
|
|
238
|
+
|
|
239
|
+
### Features
|
|
240
|
+
|
|
241
|
+
- switch sfdx-faye with faye ([a0545e5](https://github.com/forcedotcom/sfdx-core/commit/a0545e57d5041c97e499f284afbd7fcb16cf2247))
|
|
242
|
+
|
|
243
|
+
### Bug Fixes
|
|
244
|
+
|
|
245
|
+
- no maxquery warning when records.length is 0 ([758f912](https://github.com/forcedotcom/sfdx-core/commit/758f912a23bd3e9f8d4f854f3e07682dd4d4c4aa))
|
|
246
|
+
|
|
247
|
+
### [2.31.1](https://github.com/forcedotcom/sfdx-core/compare/v2.31.0...v2.31.1) (2021-12-06)
|
|
248
|
+
|
|
249
|
+
## [2.31.0](https://github.com/forcedotcom/sfdx-core/compare/v2.30.1...v2.31.0) (2021-11-30)
|
|
250
|
+
|
|
251
|
+
### Features
|
|
252
|
+
|
|
253
|
+
- bump version of jsforce ([7d89024](https://github.com/forcedotcom/sfdx-core/commit/7d89024f593968c031af22ac817efc26d00fcd54))
|
|
254
|
+
|
|
255
|
+
### [2.30.1](https://github.com/forcedotcom/sfdx-core/compare/v2.30.0...v2.30.1) (2021-11-30)
|
|
256
|
+
|
|
257
|
+
### Bug Fixes
|
|
258
|
+
|
|
259
|
+
- better output for authUrl errors ([f3ec729](https://github.com/forcedotcom/sfdx-core/commit/f3ec7298bdbd3194d3d14bfea09f47f413669376))
|
|
260
|
+
|
|
261
|
+
## [2.30.0](https://github.com/forcedotcom/sfdx-core/compare/v2.29.0...v2.30.0) (2021-11-25)
|
|
262
|
+
|
|
263
|
+
### Features
|
|
264
|
+
|
|
265
|
+
- delete scratch orgs and sandboxes ([#491](https://github.com/forcedotcom/sfdx-core/issues/491)) ([468c348](https://github.com/forcedotcom/sfdx-core/commit/468c348f0ecc69ddeea02927bf7a26ca660a86ca))
|
|
266
|
+
|
|
267
|
+
## [2.29.0](https://github.com/forcedotcom/sfdx-core/compare/v2.28.4...v2.29.0) (2021-11-17)
|
|
268
|
+
|
|
269
|
+
### Features
|
|
270
|
+
|
|
271
|
+
- cleans up old listeners from upgraded instance ([e3f2d69](https://github.com/forcedotcom/sfdx-core/commit/e3f2d69ccd5c096d37addb1b982e19354175f11a))
|
|
272
|
+
- use warnings instead of process in sfdx-core ([c1f7e98](https://github.com/forcedotcom/sfdx-core/commit/c1f7e98f6b19d57da1a2ee0cdf58e449079f0ee7))
|
|
273
|
+
- warning and telemetry events ([80a8039](https://github.com/forcedotcom/sfdx-core/commit/80a8039e2f686d973ddbc24c9a2980fb93928d13))
|
|
274
|
+
- warning and telemetry events ([a04b293](https://github.com/forcedotcom/sfdx-core/commit/a04b29355c8ca6c7e37e071ccc159aff5e5e9ca0))
|
|
275
|
+
|
|
276
|
+
### Bug Fixes
|
|
277
|
+
|
|
278
|
+
- transfer listeners when upgrading the global instance to newer version ([0a40831](https://github.com/forcedotcom/sfdx-core/commit/0a408317c132548771ced0fe196178d2e9c76232))
|
|
279
|
+
|
|
280
|
+
### [2.28.4](https://github.com/forcedotcom/sfdx-core/compare/v2.28.3...v2.28.4) (2021-11-10)
|
|
281
|
+
|
|
282
|
+
### Bug Fixes
|
|
283
|
+
|
|
284
|
+
- bump jsforce types and run unit tests on Windows ([#485](https://github.com/forcedotcom/sfdx-core/issues/485)) ([3952c8f](https://github.com/forcedotcom/sfdx-core/commit/3952c8fe248531a0597477ed12240f611048caba))
|
|
285
|
+
|
|
286
|
+
### [2.28.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
|
|
287
|
+
|
|
288
|
+
### Bug Fixes
|
|
289
|
+
|
|
290
|
+
- fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
|
|
291
|
+
- force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
|
|
292
|
+
- improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
|
|
293
|
+
|
|
294
|
+
### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
|
|
295
|
+
|
|
296
|
+
### Bug Fixes
|
|
297
|
+
|
|
298
|
+
- support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
|
|
299
|
+
|
|
225
300
|
### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
|
|
226
301
|
|
|
227
302
|
### Bug Fixes
|
package/LICENSE.txt
CHANGED
|
@@ -218,7 +218,6 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
|
|
|
218
218
|
}
|
|
219
219
|
// Allows extended classes the ability to override the set method. i.e. maybe they want
|
|
220
220
|
// nested object set from kit.
|
|
221
|
-
// NOTE: Key and value must stay string and value to be reliably overwritten.
|
|
222
221
|
setMethod(contents, key, value) {
|
|
223
222
|
kit_1.set(contents, key, value);
|
|
224
223
|
}
|
package/lib/exported.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { SfdcUrl } from './util/sfdcUrl';
|
|
|
17
17
|
export { getJwtAudienceUrl } from './util/getJwtAudienceUrl';
|
|
18
18
|
export { Fields, FieldValue, LoggerLevel, LoggerLevelValue, LogLine, LoggerOptions, LoggerStream, Logger, } from './logger';
|
|
19
19
|
export { Messages } from './messages';
|
|
20
|
-
export { Org } from './org
|
|
20
|
+
export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, } from './org';
|
|
21
21
|
export { OrgConfigProperties, ORG_CONFIG_ALLOWED_PROPERTIES } from './org/orgConfigProperties';
|
|
22
22
|
export { PackageDir, NamedPackageDir, PackageDirDependency, SfdxProject, SfdxProjectJson } from './sfdxProject';
|
|
23
23
|
export { SchemaPrinter } from './schema/printer';
|
package/lib/exported.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.ConfigAggregator = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.ConfigFile = void 0;
|
|
19
|
+
exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.ConfigAggregator = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.ConfigFile = void 0;
|
|
20
20
|
const messages_1 = require("./messages");
|
|
21
21
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
22
22
|
var configFile_1 = require("./config/configFile");
|
|
@@ -62,8 +62,10 @@ Object.defineProperty(exports, "LoggerLevel", { enumerable: true, get: function
|
|
|
62
62
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
63
63
|
var messages_2 = require("./messages");
|
|
64
64
|
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_2.Messages; } });
|
|
65
|
-
var org_1 = require("./org
|
|
65
|
+
var org_1 = require("./org");
|
|
66
66
|
Object.defineProperty(exports, "Org", { enumerable: true, get: function () { return org_1.Org; } });
|
|
67
|
+
Object.defineProperty(exports, "SandboxEvents", { enumerable: true, get: function () { return org_1.SandboxEvents; } });
|
|
68
|
+
Object.defineProperty(exports, "OrgTypes", { enumerable: true, get: function () { return org_1.OrgTypes; } });
|
|
67
69
|
var orgConfigProperties_1 = require("./org/orgConfigProperties");
|
|
68
70
|
Object.defineProperty(exports, "OrgConfigProperties", { enumerable: true, get: function () { return orgConfigProperties_1.OrgConfigProperties; } });
|
|
69
71
|
Object.defineProperty(exports, "ORG_CONFIG_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES; } });
|
package/lib/lifecycleEvents.d.ts
CHANGED
|
@@ -16,16 +16,29 @@ declare type callback = (data: any) => Promise<void>;
|
|
|
16
16
|
*
|
|
17
17
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
18
18
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
19
|
+
*
|
|
20
|
+
* // if you don't need to await anything
|
|
21
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
19
22
|
* ```
|
|
20
23
|
*/
|
|
21
24
|
export declare class Lifecycle {
|
|
22
|
-
private debug;
|
|
23
25
|
private readonly listeners;
|
|
26
|
+
static readonly telemetryEventName = "telemetry";
|
|
27
|
+
static readonly warningEventName = "warning";
|
|
28
|
+
private debug;
|
|
24
29
|
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* return the package.json version of the sfdx-core library.
|
|
32
|
+
*/
|
|
33
|
+
static staticVersion(): string;
|
|
25
34
|
/**
|
|
26
35
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
27
36
|
*/
|
|
28
37
|
static getInstance(): Lifecycle;
|
|
38
|
+
/**
|
|
39
|
+
* return the package.json version of the sfdx-core library.
|
|
40
|
+
*/
|
|
41
|
+
version(): string;
|
|
29
42
|
/**
|
|
30
43
|
* Remove all listeners for a given event
|
|
31
44
|
*
|
|
@@ -38,6 +51,18 @@ export declare class Lifecycle {
|
|
|
38
51
|
* @param eventName The name of the event to get listeners of
|
|
39
52
|
*/
|
|
40
53
|
getListeners(eventName: string): callback[];
|
|
54
|
+
/**
|
|
55
|
+
* Create a listener for the `telemetry` event
|
|
56
|
+
*
|
|
57
|
+
* @param cb The callback function to run when the event is emitted
|
|
58
|
+
*/
|
|
59
|
+
onTelemetry(cb: (data: Record<string, unknown>) => Promise<void>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Create a listener for the `warning` event
|
|
62
|
+
*
|
|
63
|
+
* @param cb The callback function to run when the event is emitted
|
|
64
|
+
*/
|
|
65
|
+
onWarning(cb: (warning: string) => Promise<void>): void;
|
|
41
66
|
/**
|
|
42
67
|
* Create a new listener for a given event
|
|
43
68
|
*
|
|
@@ -45,6 +70,18 @@ export declare class Lifecycle {
|
|
|
45
70
|
* @param cb The callback function to run when the event is emitted
|
|
46
71
|
*/
|
|
47
72
|
on<T = AnyJson>(eventName: string, cb: (data: T) => Promise<void>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
75
|
+
*
|
|
76
|
+
* @param data The data to emit
|
|
77
|
+
*/
|
|
78
|
+
emitTelemetry(data: AnyJson): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
81
|
+
*
|
|
82
|
+
* @param data The warning (string) to emit
|
|
83
|
+
*/
|
|
84
|
+
emitWarning(warning: string): Promise<void>;
|
|
48
85
|
/**
|
|
49
86
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
50
87
|
*
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Lifecycle = void 0;
|
|
10
10
|
const Debug = require("debug");
|
|
11
|
+
const semver_1 = require("semver");
|
|
12
|
+
// needed for TS to not put everything inside /lib/src
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const pjson = require("../package.json");
|
|
11
15
|
/**
|
|
12
16
|
* An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle
|
|
13
17
|
* events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other
|
|
@@ -24,12 +28,21 @@ const Debug = require("debug");
|
|
|
24
28
|
*
|
|
25
29
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
26
30
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
31
|
+
*
|
|
32
|
+
* // if you don't need to await anything
|
|
33
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
27
34
|
* ```
|
|
28
35
|
*/
|
|
29
36
|
class Lifecycle {
|
|
30
|
-
constructor() {
|
|
37
|
+
constructor(listeners = {}) {
|
|
38
|
+
this.listeners = listeners;
|
|
31
39
|
this.debug = Debug(`sfdx:${this.constructor.name}`);
|
|
32
|
-
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* return the package.json version of the sfdx-core library.
|
|
43
|
+
*/
|
|
44
|
+
static staticVersion() {
|
|
45
|
+
return pjson.version;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
@@ -52,10 +65,29 @@ class Lifecycle {
|
|
|
52
65
|
//
|
|
53
66
|
// Nothing should EVER be removed, even across major versions.
|
|
54
67
|
if (!global.salesforceCoreLifecycle) {
|
|
68
|
+
// it's not been loaded yet (basic singleton pattern)
|
|
55
69
|
global.salesforceCoreLifecycle = new Lifecycle();
|
|
56
70
|
}
|
|
71
|
+
else if (
|
|
72
|
+
// an older version was loaded that should be replaced
|
|
73
|
+
semver_1.compare(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
|
|
74
|
+
const oldInstance = global.salesforceCoreLifecycle;
|
|
75
|
+
// use the newer version and transfer any listeners from the old version
|
|
76
|
+
// object spread keeps them from being references
|
|
77
|
+
global.salesforceCoreLifecycle = new Lifecycle({ ...oldInstance.listeners });
|
|
78
|
+
// clean up any listeners on the old version
|
|
79
|
+
Object.keys(oldInstance.listeners).map((eventName) => {
|
|
80
|
+
oldInstance.removeAllListeners(eventName);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
57
83
|
return global.salesforceCoreLifecycle;
|
|
58
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* return the package.json version of the sfdx-core library.
|
|
87
|
+
*/
|
|
88
|
+
version() {
|
|
89
|
+
return pjson.version;
|
|
90
|
+
}
|
|
59
91
|
/**
|
|
60
92
|
* Remove all listeners for a given event
|
|
61
93
|
*
|
|
@@ -79,6 +111,22 @@ class Lifecycle {
|
|
|
79
111
|
return [];
|
|
80
112
|
}
|
|
81
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a listener for the `telemetry` event
|
|
116
|
+
*
|
|
117
|
+
* @param cb The callback function to run when the event is emitted
|
|
118
|
+
*/
|
|
119
|
+
onTelemetry(cb) {
|
|
120
|
+
this.on(Lifecycle.telemetryEventName, cb);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Create a listener for the `warning` event
|
|
124
|
+
*
|
|
125
|
+
* @param cb The callback function to run when the event is emitted
|
|
126
|
+
*/
|
|
127
|
+
onWarning(cb) {
|
|
128
|
+
this.on(Lifecycle.warningEventName, cb);
|
|
129
|
+
}
|
|
82
130
|
/**
|
|
83
131
|
* Create a new listener for a given event
|
|
84
132
|
*
|
|
@@ -93,6 +141,27 @@ class Lifecycle {
|
|
|
93
141
|
listeners.push(cb);
|
|
94
142
|
this.listeners[eventName] = listeners;
|
|
95
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
146
|
+
*
|
|
147
|
+
* @param data The data to emit
|
|
148
|
+
*/
|
|
149
|
+
async emitTelemetry(data) {
|
|
150
|
+
return this.emit(Lifecycle.telemetryEventName, data);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
154
|
+
*
|
|
155
|
+
* @param data The warning (string) to emit
|
|
156
|
+
*/
|
|
157
|
+
async emitWarning(warning) {
|
|
158
|
+
// if there are no listeners, warnings should go to the node process so they're not lost
|
|
159
|
+
// this also preserves behavior in UT where there's a spy on process.emitWarning
|
|
160
|
+
if (this.getListeners(Lifecycle.warningEventName).length === 0) {
|
|
161
|
+
process.emitWarning(warning);
|
|
162
|
+
}
|
|
163
|
+
return this.emit(Lifecycle.warningEventName, warning);
|
|
164
|
+
}
|
|
96
165
|
/**
|
|
97
166
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
98
167
|
*
|
|
@@ -112,4 +181,6 @@ class Lifecycle {
|
|
|
112
181
|
}
|
|
113
182
|
}
|
|
114
183
|
exports.Lifecycle = Lifecycle;
|
|
184
|
+
Lifecycle.telemetryEventName = 'telemetry';
|
|
185
|
+
Lifecycle.warningEventName = 'warning';
|
|
115
186
|
//# sourceMappingURL=lifecycleEvents.js.map
|
package/lib/logger.js
CHANGED
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -165,12 +165,7 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
165
165
|
* ```
|
|
166
166
|
* @param sfdxAuthUrl
|
|
167
167
|
*/
|
|
168
|
-
static parseSfdxAuthUrl(sfdxAuthUrl: string):
|
|
169
|
-
clientId: string;
|
|
170
|
-
clientSecret: string;
|
|
171
|
-
refreshToken: string;
|
|
172
|
-
loginUrl: string;
|
|
173
|
-
};
|
|
168
|
+
static parseSfdxAuthUrl(sfdxAuthUrl: string): Pick<AuthFields, 'clientId' | 'clientSecret' | 'refreshToken' | 'loginUrl'>;
|
|
174
169
|
/**
|
|
175
170
|
* Get the username.
|
|
176
171
|
*/
|
|
@@ -307,5 +302,6 @@ export declare namespace AuthInfo {
|
|
|
307
302
|
* creation.
|
|
308
303
|
*/
|
|
309
304
|
parentUsername?: string;
|
|
305
|
+
isDevHub?: boolean;
|
|
310
306
|
}
|
|
311
307
|
}
|
package/lib/org/authInfo.js
CHANGED
|
@@ -236,7 +236,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
236
236
|
static parseSfdxAuthUrl(sfdxAuthUrl) {
|
|
237
237
|
const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]*):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/);
|
|
238
238
|
if (!match) {
|
|
239
|
-
throw new sfdxError_1.SfdxError('Invalid
|
|
239
|
+
throw new sfdxError_1.SfdxError('Invalid SFDX auth URL. Must be in the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". Note that the SFDX auth URL uses the "force" protocol, and not "http" or "https". Also note that the "instanceUrl" inside the SFDX auth URL doesn\'t include the protocol ("https://").', 'INVALID_SFDX_AUTH_URL');
|
|
240
240
|
}
|
|
241
241
|
const [, clientId, clientSecret, refreshToken, loginUrl] = match;
|
|
242
242
|
return {
|
package/lib/org/connection.js
CHANGED
|
@@ -20,6 +20,7 @@ const logger_1 = require("../logger");
|
|
|
20
20
|
const sfdxError_1 = require("../sfdxError");
|
|
21
21
|
const sfdc_1 = require("../util/sfdc");
|
|
22
22
|
const messages_1 = require("../messages");
|
|
23
|
+
const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
23
24
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
24
25
|
const messages = messages_1.Messages.load('@salesforce/core', 'connection', [
|
|
25
26
|
'incorrectAPIVersionError',
|
|
@@ -104,7 +105,8 @@ class Connection extends jsforce_1.Connection {
|
|
|
104
105
|
conn.logger.debug(`The apiVersion ${baseOptions.version} was found from ${((_b = options.connectionOptions) === null || _b === void 0 ? void 0 : _b.version) ? 'passed in options' : 'config'}`);
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
|
-
catch (
|
|
108
|
+
catch (err) {
|
|
109
|
+
const e = err;
|
|
108
110
|
if (e.name === exports.DNS_ERROR_NAME) {
|
|
109
111
|
throw e;
|
|
110
112
|
}
|
|
@@ -336,8 +338,8 @@ class Connection extends jsforce_1.Connection {
|
|
|
336
338
|
maxFetch,
|
|
337
339
|
});
|
|
338
340
|
const query = await this.query(soql, options);
|
|
339
|
-
if (query.totalSize > query.records.length) {
|
|
340
|
-
|
|
341
|
+
if (query.records.length && query.totalSize > query.records.length) {
|
|
342
|
+
void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The query result is missing ${query.totalSize - query.records.length} records due to a ${maxFetch} record limit. Increase the number of records returned by setting the config value "maxQueryLimit" or the environment variable "SFDX_MAX_QUERY_LIMIT" to ${query.totalSize} or greater than ${maxFetch}.`);
|
|
341
343
|
}
|
|
342
344
|
return query;
|
|
343
345
|
}
|
package/lib/org/org.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
1
|
+
import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
|
|
2
2
|
import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
|
|
3
3
|
import { ConfigAggregator } from '../config/configAggregator';
|
|
4
4
|
import { OrgUsersConfig } from '../config/orgUsersConfig';
|
|
@@ -12,6 +12,57 @@ export declare type OrganizationInformation = {
|
|
|
12
12
|
TrialExpirationDate: string | null;
|
|
13
13
|
NamespacePrefix: string | null;
|
|
14
14
|
};
|
|
15
|
+
export declare enum OrgTypes {
|
|
16
|
+
Scratch = "scratch",
|
|
17
|
+
Sandbox = "sandbox"
|
|
18
|
+
}
|
|
19
|
+
export interface StatusEvent {
|
|
20
|
+
sandboxProcessObj: SandboxProcessObject;
|
|
21
|
+
interval: number;
|
|
22
|
+
retries: number;
|
|
23
|
+
waitingOnAuth: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ResultEvent {
|
|
26
|
+
sandboxProcessObj: SandboxProcessObject;
|
|
27
|
+
sandboxRes: SandboxUserAuthResponse;
|
|
28
|
+
}
|
|
29
|
+
export interface SandboxUserAuthRequest {
|
|
30
|
+
sandboxName: string;
|
|
31
|
+
clientId: string;
|
|
32
|
+
callbackUrl: string;
|
|
33
|
+
}
|
|
34
|
+
export declare enum SandboxEvents {
|
|
35
|
+
EVENT_STATUS = "status",
|
|
36
|
+
EVENT_ASYNC_RESULT = "asyncResult",
|
|
37
|
+
EVENT_RESULT = "result",
|
|
38
|
+
EVENT_AUTH = "auth"
|
|
39
|
+
}
|
|
40
|
+
export interface SandboxUserAuthResponse {
|
|
41
|
+
authUserName: string;
|
|
42
|
+
authCode: string;
|
|
43
|
+
instanceUrl: string;
|
|
44
|
+
loginUrl: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SandboxProcessObject {
|
|
47
|
+
Id: string;
|
|
48
|
+
Status: string;
|
|
49
|
+
SandboxName: string;
|
|
50
|
+
SandboxInfoId: string;
|
|
51
|
+
LicenseType: string;
|
|
52
|
+
CreatedDate: string;
|
|
53
|
+
SandboxOrganization?: string;
|
|
54
|
+
CopyProgress?: number;
|
|
55
|
+
SourceId?: string;
|
|
56
|
+
Description?: string;
|
|
57
|
+
ApexClassId?: string;
|
|
58
|
+
EndDate?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare type SandboxRequest = {
|
|
61
|
+
SandboxName: string;
|
|
62
|
+
LicenseType?: string;
|
|
63
|
+
SourceId?: string;
|
|
64
|
+
Description?: string;
|
|
65
|
+
};
|
|
15
66
|
/**
|
|
16
67
|
* Provides a way to manage a locally authenticated Org.
|
|
17
68
|
*
|
|
@@ -49,6 +100,17 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
49
100
|
* @ignore
|
|
50
101
|
*/
|
|
51
102
|
constructor(options?: Org.Options);
|
|
103
|
+
/**
|
|
104
|
+
* create a sandbox from a production org
|
|
105
|
+
* 'this' needs to be a production org with sandbox licenses available
|
|
106
|
+
*
|
|
107
|
+
* @param sandboxReq SandboxRequest options to create the sandbox with
|
|
108
|
+
* @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
|
|
109
|
+
*/
|
|
110
|
+
createSandbox(sandboxReq: SandboxRequest, options: {
|
|
111
|
+
wait?: Duration;
|
|
112
|
+
interval?: Duration;
|
|
113
|
+
}): Promise<SandboxProcessObject>;
|
|
52
114
|
/**
|
|
53
115
|
* Clean all data files in the org's data path. Usually <workspace>/.sfdx/orgs/<username>.
|
|
54
116
|
*
|
|
@@ -68,6 +130,11 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
68
130
|
* @param throwWhenRemoveFails Determines if the call should throw an error or fail silently.
|
|
69
131
|
*/
|
|
70
132
|
remove(throwWhenRemoveFails?: boolean): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Check if org is a sandbox org by checking its SandboxOrgConfig.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
isSandbox(): Promise<boolean>;
|
|
71
138
|
/**
|
|
72
139
|
* Check that this org is a scratch org by asking the dev hub if it knows about it.
|
|
73
140
|
*
|
|
@@ -90,6 +157,16 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
90
157
|
* dev hub**. If you need accuracy, use the {@link Org.determineIfDevHubOrg} method.
|
|
91
158
|
*/
|
|
92
159
|
isDevHubOrg(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Will delete 'this' instance remotely and any files locally
|
|
162
|
+
*
|
|
163
|
+
* @param controllingOrg username or Org that 'this.devhub' or 'this.production' refers to. AKA a DevHub for a scratch org, or a Production Org for a sandbox
|
|
164
|
+
*/
|
|
165
|
+
deleteFrom(controllingOrg: string | Org): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Will delete 'this' instance remotely and any files locally
|
|
168
|
+
*/
|
|
169
|
+
delete(): Promise<void>;
|
|
93
170
|
/**
|
|
94
171
|
* Returns `true` if the org is a Dev Hub.
|
|
95
172
|
*
|
|
@@ -117,14 +194,6 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
117
194
|
* using {@link Org.retrieveOrganizationInformation}.
|
|
118
195
|
*/
|
|
119
196
|
determineIfScratch(): Promise<boolean>;
|
|
120
|
-
/**
|
|
121
|
-
* Returns `true` if the org is a sandbox.
|
|
122
|
-
*
|
|
123
|
-
* **Note** This relies on a cached value in the auth file. If that property
|
|
124
|
-
* is not cached, this method will **always return false even if the org is a
|
|
125
|
-
* sandbox**. If you need accuracy, use the {@link Org.determineIfDevHubOrg} method.
|
|
126
|
-
*/
|
|
127
|
-
isSandbox(): boolean;
|
|
128
197
|
/**
|
|
129
198
|
* Returns `true` if the org is a sandbox.
|
|
130
199
|
*
|
|
@@ -229,6 +298,23 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
229
298
|
* **Throws** *{@link SfdxError}{ name: 'NotSupportedError' }* Throws an unsupported error.
|
|
230
299
|
*/
|
|
231
300
|
protected getDefaultOptions(): Org.Options;
|
|
301
|
+
private queryProduction;
|
|
302
|
+
private destorySandbox;
|
|
303
|
+
private destoryScratchOrg;
|
|
304
|
+
/**
|
|
305
|
+
* this method will delete the sandbox org from the production org and clean up any local files
|
|
306
|
+
*
|
|
307
|
+
* @param prodOrg - Production org associated with this sandbox
|
|
308
|
+
* @private
|
|
309
|
+
*/
|
|
310
|
+
private deleteSandbox;
|
|
311
|
+
/**
|
|
312
|
+
* If this Org is a scratch org, calling this method will delete the scratch org from the DevHub and clean up any local files
|
|
313
|
+
*
|
|
314
|
+
* @param devHub - optional DevHub Org of the to-be-deleted scratch org
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
private deleteScratchOrg;
|
|
232
318
|
/**
|
|
233
319
|
* Delete an auth info file from the local file system and any related cache information for
|
|
234
320
|
* this Org. You don't want to call this method directly. Instead consider calling Org.remove()
|
|
@@ -255,6 +341,32 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
255
341
|
* @param throwWhenRemoveFails true if manageDelete should throw or not if the deleted fails.
|
|
256
342
|
*/
|
|
257
343
|
private removeSandboxConfig;
|
|
344
|
+
private writeSandboxAuthFile;
|
|
345
|
+
/**
|
|
346
|
+
* Polls for the new sandbox to be created - and will write the associated auth files
|
|
347
|
+
*
|
|
348
|
+
* @private
|
|
349
|
+
* @param options
|
|
350
|
+
* sandboxProcessObj: The in-progress sandbox signup request
|
|
351
|
+
* retries: the number of retries to poll for every 30s
|
|
352
|
+
* shouldPoll: wait for polling, or just return
|
|
353
|
+
* pollInterval: Duration to sleep between poll events, default 30 seconds
|
|
354
|
+
*/
|
|
355
|
+
private pollStatusAndAuth;
|
|
356
|
+
/**
|
|
357
|
+
* query SandboxProcess via SandboxInfoId
|
|
358
|
+
*
|
|
359
|
+
* @param id SandboxInfoId to query for
|
|
360
|
+
* @private
|
|
361
|
+
*/
|
|
362
|
+
private querySandboxProcess;
|
|
363
|
+
/**
|
|
364
|
+
* determines if the sandbox has successfully been created
|
|
365
|
+
*
|
|
366
|
+
* @param sandboxProcessObj sandbox signup progeress
|
|
367
|
+
* @private
|
|
368
|
+
*/
|
|
369
|
+
private sandboxSignupComplete;
|
|
258
370
|
}
|
|
259
371
|
export declare namespace Org {
|
|
260
372
|
/**
|