@salesforce/core 6.7.6 → 6.7.7-qa.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.
Files changed (57) hide show
  1. package/lib/config/authInfoConfig.js +1 -1
  2. package/lib/config/config.js +6 -5
  3. package/lib/config/configAggregator.js +7 -2
  4. package/lib/config/configFile.js +6 -2
  5. package/lib/config/configStore.js +17 -14
  6. package/lib/config/lwwMap.js +12 -19
  7. package/lib/config/lwwRegister.js +1 -0
  8. package/lib/crypto/crypto.js +3 -1
  9. package/lib/crypto/keyChainImpl.js +2 -0
  10. package/lib/crypto/secureBuffer.js +3 -4
  11. package/lib/deviceOauthService.d.ts +1 -1
  12. package/lib/deviceOauthService.js +8 -6
  13. package/lib/global.js +22 -22
  14. package/lib/index.d.ts +1 -1
  15. package/lib/lifecycleEvents.js +5 -2
  16. package/lib/logger/logger.js +31 -29
  17. package/lib/logger/memoryLogger.js +1 -1
  18. package/lib/messages.js +41 -30
  19. package/lib/org/authInfo.d.ts +1 -1
  20. package/lib/org/authInfo.js +65 -67
  21. package/lib/org/authRemover.js +7 -2
  22. package/lib/org/connection.d.ts +4 -4
  23. package/lib/org/connection.js +33 -22
  24. package/lib/org/org.js +30 -23
  25. package/lib/org/permissionSetAssignment.js +2 -0
  26. package/lib/org/scratchOrgFeatureDeprecation.js +1 -0
  27. package/lib/org/scratchOrgInfoApi.d.ts +1 -1
  28. package/lib/org/scratchOrgInfoApi.js +4 -5
  29. package/lib/org/scratchOrgInfoGenerator.d.ts +2 -2
  30. package/lib/org/scratchOrgInfoGenerator.js +13 -15
  31. package/lib/org/scratchOrgSettingsGenerator.d.ts +4 -4
  32. package/lib/org/scratchOrgSettingsGenerator.js +9 -2
  33. package/lib/org/user.js +24 -16
  34. package/lib/schema/validator.js +4 -0
  35. package/lib/sfError.d.ts +20 -6
  36. package/lib/sfError.js +48 -37
  37. package/lib/sfProject.d.ts +3 -0
  38. package/lib/sfProject.js +25 -15
  39. package/lib/stateAggregator/accessors/aliasAccessor.d.ts +0 -35
  40. package/lib/stateAggregator/accessors/aliasAccessor.js +4 -68
  41. package/lib/stateAggregator/accessors/orgAccessor.js +5 -10
  42. package/lib/stateAggregator/stateAggregator.js +4 -1
  43. package/lib/status/myDomainResolver.js +3 -1
  44. package/lib/status/pollingClient.js +5 -0
  45. package/lib/status/streamingClient.js +16 -4
  46. package/lib/testSetup.d.ts +2 -2
  47. package/lib/testSetup.js +75 -29
  48. package/lib/util/cache.js +21 -35
  49. package/lib/util/directoryWriter.js +1 -0
  50. package/lib/util/getJwtAudienceUrl.d.ts +1 -1
  51. package/lib/util/sfdc.js +1 -1
  52. package/lib/util/sfdcUrl.js +7 -6
  53. package/lib/util/zipWriter.js +4 -1
  54. package/lib/webOAuthServer.js +20 -9
  55. package/package.json +62 -4
  56. package/lib/util/checkLightningDomain.d.ts +0 -2
  57. package/lib/util/checkLightningDomain.js +0 -30
@@ -37,7 +37,7 @@ const node_querystring_1 = require("node:querystring");
37
37
  const node_url_1 = require("node:url");
38
38
  const node_net_1 = require("node:net");
39
39
  const node_events_1 = require("node:events");
40
- const jsforce_1 = require("jsforce");
40
+ const jsforce_node_1 = require("@jsforce/jsforce-node");
41
41
  const kit_1 = require("@salesforce/kit");
42
42
  const ts_types_1 = require("@salesforce/ts-types");
43
43
  const logger_1 = require("./logger/logger");
@@ -66,9 +66,15 @@ const iconPaths = ['/favicon.ico', '/apple-touch-icon-precomposed.png'];
66
66
  * ```
67
67
  */
68
68
  class WebOAuthServer extends kit_1.AsyncCreatable {
69
+ static DEFAULT_PORT = 1717;
70
+ authUrl;
71
+ logger;
72
+ webServer;
73
+ oauth2;
74
+ oauthConfig;
75
+ oauthError = new Error('Oauth Error');
69
76
  constructor(options) {
70
77
  super(options);
71
- this.oauthError = new Error('Oauth Error');
72
78
  this.oauthConfig = options.oauthConfig;
73
79
  }
74
80
  /**
@@ -159,7 +165,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
159
165
  if (this.oauthConfig.useVerifier !== false)
160
166
  this.oauthConfig.useVerifier = true;
161
167
  this.webServer = await WebServer.create({ port });
162
- this.oauth2 = new jsforce_1.OAuth2(this.oauthConfig);
168
+ this.oauth2 = new jsforce_node_1.OAuth2(this.oauthConfig);
163
169
  this.authUrl = authInfo_1.AuthInfo.getAuthorizationUrl(this.oauthConfig, this.oauth2);
164
170
  }
165
171
  /**
@@ -178,6 +184,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
178
184
  this.logger.debug(`processing request for uri: ${url.pathname}`);
179
185
  if (request.method === 'GET') {
180
186
  if (url.pathname?.startsWith('/OauthRedirect') && url.query) {
187
+ // eslint-disable-next-line no-param-reassign
181
188
  request.query = (0, node_querystring_1.parse)(url.query);
182
189
  if (request.query.error) {
183
190
  const errorName = typeof request.query.error_description === 'string'
@@ -285,17 +292,19 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
285
292
  }
286
293
  }
287
294
  exports.WebOAuthServer = WebOAuthServer;
288
- WebOAuthServer.DEFAULT_PORT = 1717;
289
295
  /**
290
296
  * Handles the actions specific to the http server
291
297
  */
292
298
  class WebServer extends kit_1.AsyncCreatable {
299
+ static DEFAULT_CLIENT_SOCKET_TIMEOUT = 20_000;
300
+ server;
301
+ port = WebOAuthServer.DEFAULT_PORT;
302
+ host = 'localhost';
303
+ logger;
304
+ sockets = [];
305
+ redirectStatus = new node_events_1.EventEmitter();
293
306
  constructor(options) {
294
307
  super(options);
295
- this.port = WebOAuthServer.DEFAULT_PORT;
296
- this.host = 'localhost';
297
- this.sockets = [];
298
- this.redirectStatus = new node_events_1.EventEmitter();
299
308
  if (options.port)
300
309
  this.port = options.port;
301
310
  if (options.host)
@@ -346,7 +355,9 @@ class WebServer extends kit_1.AsyncCreatable {
346
355
  * @param response the response to write the error to.
347
356
  */
348
357
  sendError(status, message, response) {
358
+ // eslint-disable-next-line no-param-reassign
349
359
  response.statusMessage = message;
360
+ // eslint-disable-next-line no-param-reassign
350
361
  response.statusCode = status;
351
362
  response.end();
352
363
  }
@@ -407,6 +418,7 @@ class WebServer extends kit_1.AsyncCreatable {
407
418
  // We don't validate the origin here because:
408
419
  // 1. The default login URL (login.salesforce.com) will not match after a redirect or if user choose a custom domain in login.
409
420
  // 2. There's no fixed list of auth URLs we could check against.
421
+ // eslint-disable-next-line no-param-reassign
410
422
  response.statusCode = 204; // No Content response
411
423
  response.setHeader('Access-Control-Allow-Methods', 'GET');
412
424
  response.setHeader('Access-Control-Request-Headers', 'GET');
@@ -478,5 +490,4 @@ class WebServer extends kit_1.AsyncCreatable {
478
490
  }
479
491
  }
480
492
  exports.WebServer = WebServer;
481
- WebServer.DEFAULT_CLIENT_SOCKET_TIMEOUT = 20_000;
482
493
  //# sourceMappingURL=webOAuthServer.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.7.6",
3
+ "version": "6.7.7-qa.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",
@@ -8,6 +8,62 @@
8
8
  "engines": {
9
9
  "node": ">=18.0.0"
10
10
  },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/index.d.ts",
14
+ "require": "./lib/index.js",
15
+ "import": "./lib/index.js",
16
+ "default": "./lib/index.js"
17
+ },
18
+ "./testSetup": {
19
+ "types": "./lib/testSetup.d.ts",
20
+ "require": "./lib/testSetup.js",
21
+ "import": "./lib/testSetup.js",
22
+ "default": "./lib/testSetup.js"
23
+ },
24
+ "./messages": {
25
+ "types": "./lib/messages.d.ts",
26
+ "require": "./lib/messages.js",
27
+ "import": "./lib/messages.js",
28
+ "default": "./lib/messages.js"
29
+ },
30
+ "./sfError": {
31
+ "types": "./lib/sfError.d.ts",
32
+ "require": "./lib/sfError.js",
33
+ "import": "./lib/sfError.js",
34
+ "default": "./lib/sfError.js"
35
+ },
36
+ "./lifecycle": {
37
+ "types": "./lib/lifecycleEvents.d.ts",
38
+ "require": "./lib/lifecycleEvents.js",
39
+ "import": "./lib/lifecycleEvents.js",
40
+ "default": "./lib/lifecycleEvents.js"
41
+ },
42
+ "./logger": {
43
+ "types": "./lib/logger/logger.d.ts",
44
+ "require": "./lib/logger/logger.js",
45
+ "import": "./lib/logger/logger.js",
46
+ "default": "./lib/logger/logger.js"
47
+ },
48
+ "./configAggregator": {
49
+ "types": "./lib/config/configAggregator.d.ts",
50
+ "require": "./lib/config/configAggregator.js",
51
+ "import": "./lib/config/configAggregator.js",
52
+ "default": "./lib/config/configAggregator.js"
53
+ },
54
+ "./project": {
55
+ "types": "./lib/sfProject.d.ts",
56
+ "require": "./lib/sfProject.js",
57
+ "import": "./lib/sfProject.js",
58
+ "default": "./lib/sfProject.js"
59
+ },
60
+ "./messageTransformer": {
61
+ "types": "./lib/messageTransformer.d.ts",
62
+ "require": "./lib/messageTransformer.js",
63
+ "import": "./lib/messageTransformer.js",
64
+ "default": "./lib/messageTransformer.js"
65
+ }
66
+ },
11
67
  "scripts": {
12
68
  "build": "wireit",
13
69
  "clean": "sf-clean",
@@ -18,7 +74,6 @@
18
74
  "link-check": "wireit",
19
75
  "lint": "wireit",
20
76
  "lint-fix": "yarn sf-lint --fix",
21
- "postcompile": "tsc -p typedocExamples",
22
77
  "prepack": "sf-prepack",
23
78
  "prepare": "sf-install",
24
79
  "test": "wireit",
@@ -39,6 +94,7 @@
39
94
  "messageTransformer/messageTransformer.ts"
40
95
  ],
41
96
  "dependencies": {
97
+ "@jsforce/jsforce-node": "^3.0.0-next.3",
42
98
  "@salesforce/kit": "^3.1.0",
43
99
  "@salesforce/schemas": "^1.7.0",
44
100
  "@salesforce/ts-types": "^2.0.9",
@@ -47,7 +103,6 @@
47
103
  "faye": "^1.4.0",
48
104
  "form-data": "^4.0.0",
49
105
  "js2xmlparser": "^4.0.1",
50
- "jsforce": "^2.0.0-beta.29",
51
106
  "jsonwebtoken": "9.0.2",
52
107
  "jszip": "3.10.1",
53
108
  "pino": "^8.19.0",
@@ -69,7 +124,7 @@
69
124
  "chai-string": "^1.5.0",
70
125
  "ts-node": "^10.9.2",
71
126
  "ts-patch": "^3.1.1",
72
- "typescript": "^5.4.3"
127
+ "typescript": "^5.4.4"
73
128
  },
74
129
  "repository": {
75
130
  "type": "git",
@@ -160,6 +215,9 @@
160
215
  "./!(CHANGELOG).md"
161
216
  ],
162
217
  "output": []
218
+ },
219
+ "compile-typedoc": {
220
+ "command": "tsc -p typedocExamples"
163
221
  }
164
222
  }
165
223
  }
@@ -1,2 +0,0 @@
1
- /** @deprecated. Use sfdcUrl.checkLightningdomain */
2
- export default function checkLightningDomain(url: string): Promise<boolean>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (c) 2021, salesforce.com, inc.
5
- * All rights reserved.
6
- * Licensed under the BSD 3-Clause license.
7
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
- */
9
- const node_url_1 = require("node:url");
10
- const kit_1 = require("@salesforce/kit");
11
- const myDomainResolver_1 = require("../status/myDomainResolver");
12
- const sfdcUrl_1 = require("./sfdcUrl");
13
- /** @deprecated. Use sfdcUrl.checkLightningdomain */
14
- async function checkLightningDomain(url) {
15
- const domain = `https://${/https?:\/\/([^.]*)/.exec(url)?.slice(1, 2).pop()}.lightning.force.com`;
16
- const quantity = new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240) ?? 0;
17
- const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
18
- if (new sfdcUrl_1.SfdcUrl(url).isInternalUrl() || timeout.seconds === 0) {
19
- return true;
20
- }
21
- const resolver = await myDomainResolver_1.MyDomainResolver.create({
22
- url: new node_url_1.URL(domain),
23
- timeout,
24
- frequency: new kit_1.Duration(1, kit_1.Duration.Unit.SECONDS),
25
- });
26
- await resolver.resolve();
27
- return true;
28
- }
29
- exports.default = checkLightningDomain;
30
- //# sourceMappingURL=checkLightningDomain.js.map