@salesforce/core 8.2.0 → 8.2.2

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="node" />
2
1
  import { Stats as fsStats } from 'node:fs';
3
2
  import { Logger } from '../logger/logger';
4
3
  import { BaseConfigStore } from './configStore';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Dictionary, Nullable } from '@salesforce/ts-types';
3
2
  import { Env } from '@salesforce/kit';
4
3
  export declare enum EnvironmentVariable {
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import * as childProcess from 'node:child_process';
5
2
  import * as nodeFs from 'node:fs';
6
3
  import { Nullable } from '@salesforce/ts-types';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Optional } from '@salesforce/ts-types';
3
2
  /**
4
3
  * Returns the intended type of the object to return. This is implementation specific.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Writable } from 'node:stream';
3
2
  /**
4
3
  * Used by test setup to keep UT from writing to disk.
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  import { Transform } from 'node:stream';
3
2
  export default function (): Transform;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
3
4
  /*
4
5
  * Copyright (c) 2023, salesforce.com, inc.
5
6
  * All rights reserved.
@@ -36,7 +37,6 @@ function default_1() {
36
37
  enablePipelining: true,
37
38
  });
38
39
  }
39
- exports.default = default_1;
40
40
  /** if the DEBUG= is set, see if that matches the logger name. If not, we don't want to keep going */
41
41
  const debugAllows = (chunk) => {
42
42
  if (!process.env.DEBUG || process.env.DEBUG === '*')
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { AsyncResult, DeployOptions, DeployResultLocator } from '@jsforce/jsforce-node/lib/api/metadata';
3
2
  import { JsonMap, Optional } from '@salesforce/ts-types';
4
3
  import { Connection as JSForceConnection, ConnectionConfig, HttpRequest, QueryOptions, QueryResult, Record, Schema } from '@jsforce/jsforce-node';
package/lib/org/org.js CHANGED
@@ -30,7 +30,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.Org = exports.sandboxIsResumable = exports.SandboxEvents = exports.OrgTypes = void 0;
33
+ exports.Org = exports.SandboxEvents = exports.OrgTypes = void 0;
34
+ exports.sandboxIsResumable = sandboxIsResumable;
34
35
  const node_path_1 = require("node:path");
35
36
  const fs = __importStar(require("node:fs"));
36
37
  const kit_1 = require("@salesforce/kit");
@@ -71,7 +72,6 @@ const resumableSandboxStatus = ['Activating', 'Pending', 'Pending Activation', '
71
72
  function sandboxIsResumable(value) {
72
73
  return resumableSandboxStatus.includes(value);
73
74
  }
74
- exports.sandboxIsResumable = sandboxIsResumable;
75
75
  const sandboxProcessFields = [
76
76
  'Id',
77
77
  'Status',
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as fs from 'node:fs';
3
2
  import { Nullable } from '@salesforce/ts-types';
4
3
  import { AsyncOptionalCreatable } from '@salesforce/kit';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { URL } from 'node:url';
3
2
  import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { AnyFunction, AnyJson, JsonMap } from '@salesforce/ts-types';
4
3
  export type Message = JsonMap;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { SinonSandbox, SinonStatic, SinonStub } from 'sinon';
4
3
  import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
package/lib/testSetup.js CHANGED
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.MockTestSandboxData = exports.MockTestOrgData = exports.StreamingMockCometClient = exports.StreamingMockCometSubscription = exports.StreamingMockSubscriptionCall = exports.shouldThrowSync = exports.shouldThrow = exports.unexpectedResult = exports.restoreContext = exports.stubContext = exports.instantiateContext = exports.TestContext = exports.SecureBuffer = exports.uniqid = void 0;
26
+ exports.MockTestSandboxData = exports.MockTestOrgData = exports.StreamingMockCometClient = exports.StreamingMockCometSubscription = exports.StreamingMockSubscriptionCall = exports.unexpectedResult = exports.restoreContext = exports.stubContext = exports.instantiateContext = exports.TestContext = exports.SecureBuffer = exports.uniqid = void 0;
27
+ exports.shouldThrow = shouldThrow;
28
+ exports.shouldThrowSync = shouldThrowSync;
27
29
  /*
28
30
  * Copyright (c) 2020, salesforce.com, inc.
29
31
  * All rights reserved.
@@ -575,7 +577,6 @@ async function shouldThrow(f, message) {
575
577
  throw exports.unexpectedResult;
576
578
  }
577
579
  }
578
- exports.shouldThrow = shouldThrow;
579
580
  /**
580
581
  * Use for this testing pattern:
581
582
  * ```
@@ -606,7 +607,6 @@ function shouldThrowSync(f, message) {
606
607
  throw exports.unexpectedResult;
607
608
  }
608
609
  }
609
- exports.shouldThrowSync = shouldThrowSync;
610
610
  /**
611
611
  * A helper to determine if a subscription will use callback or errorback.
612
612
  * Enable errback to simulate a subscription failure.
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'node:stream';
4
2
  import { StructuredWriter } from './structuredWriter';
5
3
  export declare class DirectoryWriter implements StructuredWriter {
@@ -6,7 +6,7 @@
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
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getJwtAudienceUrl = void 0;
9
+ exports.getJwtAudienceUrl = getJwtAudienceUrl;
10
10
  const sfdcUrl_1 = require("./sfdcUrl");
11
11
  async function getJwtAudienceUrl(options) {
12
12
  if (options.loginUrl) {
@@ -15,5 +15,4 @@ async function getJwtAudienceUrl(options) {
15
15
  }
16
16
  return sfdcUrl_1.SfdcUrl.PRODUCTION;
17
17
  }
18
- exports.getJwtAudienceUrl = getJwtAudienceUrl;
19
18
  //# sourceMappingURL=getJwtAudienceUrl.js.map
@@ -29,7 +29,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
29
29
  return result;
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.traverse = exports.resolveProjectPathSync = exports.resolveProjectPath = exports.SFDX_PROJECT_JSON = void 0;
32
+ exports.traverse = exports.SFDX_PROJECT_JSON = void 0;
33
+ exports.resolveProjectPath = resolveProjectPath;
34
+ exports.resolveProjectPathSync = resolveProjectPathSync;
33
35
  const fs = __importStar(require("node:fs"));
34
36
  const node_path_1 = require("node:path");
35
37
  const messages_1 = require("../messages");
@@ -61,7 +63,6 @@ async function resolveProjectPath(dir = process.cwd()) {
61
63
  }
62
64
  return projectPath;
63
65
  }
64
- exports.resolveProjectPath = resolveProjectPath;
65
66
  /**
66
67
  * Performs a synchronous upward directory search for an sfdx project file. Returns the absolute path to the project.
67
68
  *
@@ -81,7 +82,6 @@ function resolveProjectPathSync(dir = process.cwd()) {
81
82
  }
82
83
  return projectPath;
83
84
  }
84
- exports.resolveProjectPathSync = resolveProjectPathSync;
85
85
  /**
86
86
  * These methods were moved from the deprecated 'fs' module in v2 and are only used in sfdx-core above
87
87
  *
@@ -6,6 +6,7 @@
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
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = mapKeys;
9
10
  const ts_types_1 = require("@salesforce/ts-types");
10
11
  /**
11
12
  * Use mapKeys to convert object keys to another format using the specified conversion function.
@@ -48,5 +49,4 @@ obj, converter, deep) {
48
49
  return [k, value];
49
50
  }));
50
51
  }
51
- exports.default = mapKeys;
52
52
  //# sourceMappingURL=mapKeys.js.map
package/lib/util/sfdc.js CHANGED
@@ -6,7 +6,8 @@
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
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.matchesAccessToken = exports.sfdxAuthUrlRegex = exports.accessTokenRegex = exports.validatePathDoesNotContainInvalidChars = exports.validateSalesforceId = exports.validateEmail = exports.validateApiVersion = exports.trimTo15 = void 0;
9
+ exports.matchesAccessToken = exports.sfdxAuthUrlRegex = exports.accessTokenRegex = exports.validatePathDoesNotContainInvalidChars = exports.validateSalesforceId = exports.validateEmail = exports.validateApiVersion = void 0;
10
+ exports.trimTo15 = trimTo15;
10
11
  function trimTo15(id) {
11
12
  if (!id) {
12
13
  return undefined;
@@ -16,7 +17,6 @@ function trimTo15(id) {
16
17
  }
17
18
  return id;
18
19
  }
19
- exports.trimTo15 = trimTo15;
20
20
  /**
21
21
  * Tests whether an API version matches the format `i.0`.
22
22
  *
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { URL } from 'node:url';
3
2
  export declare function getLoginAudienceCombos(audienceUrl: string, loginUrl: string): Array<[string, string]>;
4
3
  export declare class SfdcUrl extends URL {
@@ -9,11 +8,12 @@ export declare class SfdcUrl extends URL {
9
8
  static readonly PRODUCTION = "https://login.salesforce.com";
10
9
  private static readonly cache;
11
10
  private logger;
11
+ private envVars;
12
12
  constructor(input: string | URL, base?: string | URL);
13
13
  static isValidUrl(input: string | URL): boolean;
14
14
  /**
15
15
  * Returns the appropriate jwt audience url for this url
16
- * Use SFDX_AUDIENCE_URL env var to override the audience url
16
+ * Use SF_AUDIENCE_URL env var to override the audience url
17
17
  *
18
18
  * @param createdOrgInstance The Salesforce instance the org was created on. e.g. `cs42`
19
19
  * @return {Promise<string>} The audience url
@@ -41,7 +41,7 @@ export declare class SfdcUrl extends URL {
41
41
  /**
42
42
  * Tests whether this url has the lightning domain extension
43
43
  * 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
44
- * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
44
+ * If SF_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
45
45
  *
46
46
  * @returns {Promise<true | never>} The resolved ip address or never
47
47
  * @throws {@link SfError} If can't resolve DNS.
@@ -49,7 +49,7 @@ export declare class SfdcUrl extends URL {
49
49
  checkLightningDomain(): Promise<true>;
50
50
  /**
51
51
  * Method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
52
- * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
52
+ * If SF_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
53
53
  *
54
54
  * @returns the resolved ip address.
55
55
  * @throws {@link SfError} If can't resolve DNS.
@@ -6,13 +6,15 @@
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
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SfdcUrl = exports.getLoginAudienceCombos = void 0;
9
+ exports.SfdcUrl = void 0;
10
+ exports.getLoginAudienceCombos = getLoginAudienceCombos;
10
11
  const node_url_1 = require("node:url");
11
12
  const kit_1 = require("@salesforce/kit");
12
13
  const ts_types_1 = require("@salesforce/ts-types");
13
14
  const myDomainResolver_1 = require("../status/myDomainResolver");
14
15
  const logger_1 = require("../logger/logger");
15
16
  const lifecycleEvents_1 = require("../lifecycleEvents");
17
+ const envVars_1 = require("../config/envVars");
16
18
  function getLoginAudienceCombos(audienceUrl, loginUrl) {
17
19
  const filtered = [
18
20
  [loginUrl, loginUrl],
@@ -36,7 +38,6 @@ function getLoginAudienceCombos(audienceUrl, loginUrl) {
36
38
  }, new Map());
37
39
  return [...reduced.values()];
38
40
  }
39
- exports.getLoginAudienceCombos = getLoginAudienceCombos;
40
41
  class SfdcUrl extends node_url_1.URL {
41
42
  /**
42
43
  * Salesforce URLs
@@ -45,12 +46,14 @@ class SfdcUrl extends node_url_1.URL {
45
46
  static PRODUCTION = 'https://login.salesforce.com';
46
47
  static cache = new Set();
47
48
  logger;
49
+ envVars;
48
50
  constructor(input, base) {
49
51
  super(input.toString(), base);
50
52
  if (this.protocol !== 'https:' && !SfdcUrl.cache.has(this.origin)) {
51
53
  SfdcUrl.cache.add(this.origin);
52
54
  void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`Using insecure protocol: ${this.protocol} on url: ${this.origin}`);
53
55
  }
56
+ this.envVars = new envVars_1.EnvVars();
54
57
  }
55
58
  static isValidUrl(input) {
56
59
  try {
@@ -63,7 +66,7 @@ class SfdcUrl extends node_url_1.URL {
63
66
  }
64
67
  /**
65
68
  * Returns the appropriate jwt audience url for this url
66
- * Use SFDX_AUDIENCE_URL env var to override the audience url
69
+ * Use SF_AUDIENCE_URL env var to override the audience url
67
70
  *
68
71
  * @param createdOrgInstance The Salesforce instance the org was created on. e.g. `cs42`
69
72
  * @return {Promise<string>} The audience url
@@ -71,9 +74,9 @@ class SfdcUrl extends node_url_1.URL {
71
74
  async getJwtAudienceUrl(createdOrgInstance) {
72
75
  this.logger = await logger_1.Logger.child('SfdcUrl');
73
76
  // environment variable is used as an override
74
- const envVarVal = new kit_1.Env().getString('SFDX_AUDIENCE_URL', '');
77
+ const envVarVal = this.envVars.getString('SF_AUDIENCE_URL', '');
75
78
  if (envVarVal) {
76
- this.logger.debug(`Audience URL overridden by env var SFDX_AUDIENCE_URL=${envVarVal}`);
79
+ this.logger.debug(`Audience URL overridden by env var SF_AUDIENCE_URL=${envVarVal}`);
77
80
  return envVarVal;
78
81
  }
79
82
  if (Boolean(createdOrgInstance && /^gs1/gi.test(createdOrgInstance)) ||
@@ -155,13 +158,13 @@ class SfdcUrl extends node_url_1.URL {
155
158
  /**
156
159
  * Tests whether this url has the lightning domain extension
157
160
  * 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
158
- * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
161
+ * If SF_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
159
162
  *
160
163
  * @returns {Promise<true | never>} The resolved ip address or never
161
164
  * @throws {@link SfError} If can't resolve DNS.
162
165
  */
163
166
  async checkLightningDomain() {
164
- const quantity = (0, ts_types_1.ensureNumber)(new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240));
167
+ const quantity = (0, ts_types_1.ensureNumber)(this.envVars.getNumber('SF_DOMAIN_RETRY', 240));
165
168
  const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
166
169
  if (this.isInternalUrl() || timeout.seconds === 0) {
167
170
  return true;
@@ -176,13 +179,13 @@ class SfdcUrl extends node_url_1.URL {
176
179
  }
177
180
  /**
178
181
  * Method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
179
- * If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
182
+ * If SF_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
180
183
  *
181
184
  * @returns the resolved ip address.
182
185
  * @throws {@link SfError} If can't resolve DNS.
183
186
  */
184
187
  async lookup() {
185
- const quantity = (0, ts_types_1.ensureNumber)(new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240));
188
+ const quantity = (0, ts_types_1.ensureNumber)(this.envVars.getNumber('SF_DOMAIN_RETRY', 240));
186
189
  const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
187
190
  const resolver = await myDomainResolver_1.MyDomainResolver.create({
188
191
  url: new node_url_1.URL(this.origin),
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'node:stream';
4
2
  export type StructuredWriter = {
5
3
  addToStore(contents: string | Readable | Buffer, path: string): Promise<void>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.uniqid = void 0;
26
+ exports.uniqid = uniqid;
27
27
  /*
28
28
  * Copyright (c) 2023, salesforce.com, inc.
29
29
  * All rights reserved.
@@ -53,5 +53,4 @@ function uniqid(options) {
53
53
  ? util.format(options.template, uniqueString)
54
54
  : `${options.template}${uniqueString}`;
55
55
  }
56
- exports.uniqid = uniqid;
57
56
  //# sourceMappingURL=uniqid.js.map
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable, Writable } from 'node:stream';
4
2
  import { StructuredWriter } from './structuredWriter';
5
3
  export declare class ZipWriter extends Writable implements StructuredWriter {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as http from 'node:http';
3
2
  import { AsyncCreatable } from '@salesforce/kit';
4
3
  import { AuthInfo } from './org/authInfo';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.2.0",
3
+ "version": "8.2.2",
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",
@@ -52,7 +52,7 @@
52
52
  "messageTransformer/messageTransformer.ts"
53
53
  ],
54
54
  "dependencies": {
55
- "@jsforce/jsforce-node": "^3.2.3",
55
+ "@jsforce/jsforce-node": "^3.2.4",
56
56
  "@salesforce/kit": "^3.1.6",
57
57
  "@salesforce/schemas": "^1.9.0",
58
58
  "@salesforce/ts-types": "^2.0.10",
@@ -81,8 +81,8 @@
81
81
  "@types/semver": "^7.5.8",
82
82
  "benchmark": "^2.1.4",
83
83
  "ts-node": "^10.9.2",
84
- "ts-patch": "^3.2.0",
85
- "typescript": "5.4.5"
84
+ "ts-patch": "^3.2.1",
85
+ "typescript": "^5.5.3"
86
86
  },
87
87
  "repository": {
88
88
  "type": "git",