@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.
@@ -1,4 +1,3 @@
1
- /// <reference types="sfdx-faye" />
2
1
  /// <reference types="node" />
3
2
  import { EventEmitter } from 'events';
4
3
  import * as sinonType from 'sinon';
@@ -391,7 +390,9 @@ export declare class MockTestOrgData {
391
390
  refreshToken: string;
392
391
  userId: string;
393
392
  redirectUri: string;
394
- constructor(id?: string);
393
+ constructor(id?: string, options?: {
394
+ username: string;
395
+ });
395
396
  createDevHubUsername(username: string): void;
396
397
  makeDevHub(): void;
397
398
  createUser(user: string): MockTestOrgData;
package/lib/testSetup.js CHANGED
@@ -66,7 +66,7 @@ function defaultFakeConnectionRequest() {
66
66
  * ```
67
67
  * @param sinon
68
68
  */
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
70
70
  const instantiateContext = (sinon) => {
71
71
  if (!sinon) {
72
72
  try {
@@ -413,7 +413,7 @@ class StreamingMockCometClient extends streamingClient_1.CometClient {
413
413
  * @param {StreamingMockCometSubscriptionOptions} options Extends the StreamingClient options.
414
414
  */
415
415
  constructor(options) {
416
- super(options.url);
416
+ super();
417
417
  this.options = options;
418
418
  if (!this.options.messagePlaylist) {
419
419
  this.options.messagePlaylist = [{ id: this.options.id }];
@@ -475,11 +475,11 @@ exports.StreamingMockCometClient = StreamingMockCometClient;
475
475
  * Mock class for OrgData.
476
476
  */
477
477
  class MockTestOrgData {
478
- constructor(id = uniqid()) {
478
+ constructor(id = uniqid(), options) {
479
479
  this.testId = id;
480
480
  this.userId = `user_id_${this.testId}`;
481
481
  this.orgId = `${this.testId}`;
482
- this.username = `admin_${this.testId}@gb.org`;
482
+ this.username = (options === null || options === void 0 ? void 0 : options.username) || `admin_${this.testId}@gb.org`;
483
483
  this.loginUrl = `http://login.${this.testId}.salesforce.com`;
484
484
  this.instanceUrl = `http://instance.${this.testId}.salesforce.com`;
485
485
  this.clientId = `${this.testId}/client_id`;
@@ -36,9 +36,10 @@ export declare class SfdcUrl extends URL {
36
36
  * @returns {boolean} true if this is a local machine
37
37
  */
38
38
  isLocalUrl(): boolean;
39
+ toLightningDomain(): string;
39
40
  /**
40
41
  * Tests whether this url has the lightning domain extension
41
- * This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again untill timeout
42
+ * This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
42
43
  * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
43
44
  *
44
45
  * @returns {Promise<true | never>} The resolved ip address or never
@@ -12,12 +12,13 @@ const kit_1 = require("@salesforce/kit");
12
12
  const ts_types_1 = require("@salesforce/ts-types");
13
13
  const myDomainResolver_1 = require("../status/myDomainResolver");
14
14
  const logger_1 = require("../logger");
15
+ const lifecycleEvents_1 = require("../lifecycleEvents");
15
16
  class SfdcUrl extends url_1.URL {
16
17
  constructor(input, base) {
17
18
  super(input.toString(), base);
18
19
  if (this.protocol !== 'https:' && !SfdcUrl.cache.has(this.origin)) {
19
20
  SfdcUrl.cache.add(this.origin);
20
- process.emitWarning('Using insecure protocol: ' + this.protocol + ' on url: ' + this.origin);
21
+ void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`Using insecure protocol: ${this.protocol} on url: ${this.origin}`);
21
22
  }
22
23
  }
23
24
  static isValidUrl(input) {
@@ -105,25 +106,31 @@ class SfdcUrl extends url_1.URL {
105
106
  const LOCAL_PARTS = ['localhost.sfdcdev.', '.internal.'];
106
107
  return LOCAL_PARTS.some((part) => this.origin.includes(part));
107
108
  }
109
+ toLightningDomain() {
110
+ if (this.origin.endsWith('.my.salesforce.mil')) {
111
+ return this.origin.replace('.my.salesforce.mil', '.lightning.crmforce.mil');
112
+ }
113
+ // all non-mil domains
114
+ return `https://${ts_types_1.ensureArray(/https?:\/\/([^.]*)/.exec(this.origin))
115
+ .slice(1, 2)
116
+ .pop()}.lightning.force.com`;
117
+ }
108
118
  /**
109
119
  * Tests whether this url has the lightning domain extension
110
- * This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again untill timeout
120
+ * This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
111
121
  * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
112
122
  *
113
123
  * @returns {Promise<true | never>} The resolved ip address or never
114
124
  * @throws {@link SfdxError} If can't resolve DNS.
115
125
  */
116
126
  async checkLightningDomain() {
117
- const domain = `https://${ts_types_1.ensureArray(/https?:\/\/([^.]*)/.exec(this.origin))
118
- .slice(1, 2)
119
- .pop()}.lightning.force.com`;
120
127
  const quantity = ts_types_1.ensureNumber(new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240));
121
128
  const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
122
129
  if (this.isInternalUrl() || timeout.seconds === 0) {
123
130
  return true;
124
131
  }
125
132
  const resolver = await myDomainResolver_1.MyDomainResolver.create({
126
- url: new url_1.URL(domain),
133
+ url: new url_1.URL(this.toLightningDomain()),
127
134
  timeout,
128
135
  frequency: new kit_1.Duration(1, kit_1.Duration.Unit.SECONDS),
129
136
  });
@@ -155,6 +162,7 @@ class SfdcUrl extends url_1.URL {
155
162
  */
156
163
  isSandboxUrl(createdOrgInstance) {
157
164
  return ((createdOrgInstance && /^cs|s$/gi.test(createdOrgInstance)) ||
165
+ this.origin.endsWith('sandbox.my.salesforce.mil') ||
158
166
  /sandbox\.my\.salesforce\.com/gi.test(this.origin) || // enhanced domains >= 230
159
167
  /(cs[0-9]+(\.my|)\.salesforce\.com)/gi.test(this.origin) || // my domains on CS instance OR CS instance without my domain
160
168
  /([a-z]{3}[0-9]+s\.sfdc-.+\.salesforce\.com)/gi.test(this.origin) || // falcon sandbox ex: usa2s.sfdc-whatever.salesforce.com
@@ -12,9 +12,9 @@
12
12
  "OrgDataNotAvailableErrorAction2": "Use `sfdx force:config:set` to update the defaultusername.",
13
13
  "OrgDataNotAvailableErrorAction3": "Use `sfdx force:org:create` to create a new org.",
14
14
  "OrgDataNotAvailableErrorAction4": "Use `sfdx force:auth` to authenticate an existing org.",
15
- "NamedOrgNotFound": "No AuthInfo found for name %s",
16
- "NoAliasesFound": "Nothing to set",
17
- "InvalidFormat": "Setting aliases must be in the format <key>=<value> but found: [%s]",
15
+ "NamedOrgNotFound": "No authorization information found for %s %s.",
16
+ "NoAliasesFound": "Nothing to set.",
17
+ "InvalidFormat": "Setting aliases must be in the format <key>=<value> but found: [%s].",
18
18
  "NoAuthInfoFound": "No authorization information can be found.",
19
19
  "InvalidJsonCasing": "All JSON input must have heads down camelcase keys. E.g., { sfdcLoginUrl: \"https://login.salesforce.com\" }\nFound \"%s\" at %s"
20
20
  }
package/messages/core.md CHANGED
@@ -41,7 +41,7 @@ An attempt to refresh the authentication token failed with a 'Data Not Found Err
41
41
 
42
42
  # namedOrgNotFound
43
43
 
44
- No AuthInfo found for name %s.
44
+ No authorization information found for %s.
45
45
 
46
46
  # noAliasesFound
47
47
 
package/messages/org.md CHANGED
@@ -5,3 +5,39 @@ The provided dev hub username %s is not a valid dev hub.
5
5
  # noUsernameFound
6
6
 
7
7
  No username found.
8
+
9
+ # noDevHubFound
10
+
11
+ Unable to associate this scratch org with a DevHub.
12
+
13
+ # deleteOrgHubError
14
+
15
+ The Dev Hub org cannot be deleted.
16
+
17
+ # insufficientAccessToDelete
18
+
19
+ You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin.
20
+
21
+ # scratchOrgNotFound
22
+
23
+ Attempting to delete an expired or deleted org
24
+
25
+ # sandboxDeleteFailed
26
+
27
+ The sandbox org deletion failed with a result of %s.
28
+
29
+ # sandboxNotFound
30
+
31
+ We can't find a SandboxProcess for the sandbox org %s.
32
+
33
+ # sandboxInfoCreateFailed
34
+
35
+ The sandbox org creation failed with a result of %s.
36
+
37
+ # missingAuthUsername
38
+
39
+ The sandbox %s does not have an authorized username.
40
+
41
+ # orgPollingTimeout
42
+
43
+ Sandbox status is %s; timed out waiting for completion.
package/package.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
+ "types": "lib/exported.d.ts",
6
7
  "license": "BSD-3-Clause",
7
8
  "scripts": {
8
9
  "build": "sf-build",
9
10
  "ci-docs": "yarn sf-ci-docs",
10
11
  "clean": "sf-clean",
11
- "clean-all": "-clean all",
12
+ "clean-all": "sf-clean all",
12
13
  "compile": "sf-compile",
13
14
  "docs": "sf-docs",
14
15
  "format": "sf-format",
15
16
  "lint": "sf-lint",
16
17
  "lint-fix": "yarn sf-lint --fix",
17
18
  "postcompile": "tsc -p test && tsc -p typedocExamples",
18
- "prepack": "sf-build",
19
+ "prepack": "sf-prepack",
20
+ "prepare": "sf-install",
19
21
  "pretest": "sf-compile-test",
20
22
  "test": "sf-test"
21
23
  },
@@ -31,13 +33,6 @@
31
33
  "messages",
32
34
  "!lib/**/*.map"
33
35
  ],
34
- "husky": {
35
- "hooks": {
36
- "commit-msg": "sf-husky-commit-msg",
37
- "pre-commit": "sf-husky-pre-commit",
38
- "pre-push": "sf-husky-pre-push"
39
- }
40
- },
41
36
  "dependencies": {
42
37
  "@salesforce/bunyan": "^2.0.0",
43
38
  "@salesforce/kit": "^1.5.8",
@@ -46,29 +41,27 @@
46
41
  "@types/graceful-fs": "^4.1.5",
47
42
  "@types/jsforce": "^1.9.29",
48
43
  "@types/mkdirp": "^1.0.1",
49
- "@types/sfdx-faye": "^1.0.0",
44
+ "@types/semver": "^7.3.9",
50
45
  "change-case": "^4.1.2",
51
46
  "debug": "^3.1.0",
47
+ "faye": "^1.4.0",
52
48
  "form-data": "^4.0.0",
53
49
  "graceful-fs": "^4.2.4",
54
50
  "jsen": "0.6.6",
55
51
  "jsforce": "2.0.0-beta.7",
56
52
  "jsonwebtoken": "8.5.0",
57
53
  "mkdirp": "1.0.4",
58
- "sfdx-faye": "^1.0.9",
59
54
  "ts-retry-promise": "^0.6.0"
60
55
  },
61
56
  "devDependencies": {
62
- "@salesforce/dev-config": "^2.0.0",
63
- "@salesforce/dev-scripts": "^0.9.18",
57
+ "@salesforce/dev-config": "^2.1.2",
58
+ "@salesforce/dev-scripts": "^1.0.2",
64
59
  "@salesforce/prettier-config": "^0.0.2",
65
60
  "@salesforce/ts-sinon": "^1.3.15",
66
61
  "@types/debug": "0.0.30",
67
62
  "@types/jsen": "0.0.19",
68
63
  "@types/jsonwebtoken": "8.3.2",
69
- "@types/sfdx-faye": "^1.0.0",
70
64
  "@types/shelljs": "0.7.8",
71
- "@types/sinon": "^9.0.8",
72
65
  "@typescript-eslint/eslint-plugin": "^4.2.0",
73
66
  "@typescript-eslint/parser": "4.26.0",
74
67
  "chai": "^4.2.0",
@@ -76,23 +69,22 @@
76
69
  "eslint": "^6.8.0",
77
70
  "eslint-config-prettier": "^6.11.0",
78
71
  "eslint-config-salesforce": "^0.1.6",
79
- "eslint-config-salesforce-license": "^0.1.0",
72
+ "eslint-config-salesforce-license": "^0.1.6",
80
73
  "eslint-config-salesforce-typescript": "^0.2.7",
81
74
  "eslint-plugin-header": "^3.0.0",
82
75
  "eslint-plugin-import": "^2.20.2",
83
76
  "eslint-plugin-jsdoc": "^27.0.3",
84
77
  "eslint-plugin-prettier": "^3.1.3",
85
- "husky": "^4.2.5",
86
- "mocha": "^7.2.0",
78
+ "husky": "^7.0.4",
79
+ "mocha": "^8.4.0",
87
80
  "nyc": "^15.1.0",
88
81
  "prettier": "^2.0.5",
89
- "pretty-quick": "^2.0.1",
82
+ "pretty-quick": "^3.1.0",
90
83
  "shelljs": "0.8.1",
91
- "sinon": "^9.0.2",
92
- "ts-node": "^8.10.2",
84
+ "sinon": "10.0.0",
85
+ "ts-node": "^10.0.0",
93
86
  "typescript": "^4.1.3"
94
87
  },
95
- "types": "lib/exported.d.ts",
96
88
  "repository": {
97
89
  "type": "git",
98
90
  "url": "https://github.com/forcedotcom/sfdx-core.git"