@salesforce/core-bundle 8.2.8 → 8.3.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/index.d.ts CHANGED
@@ -6159,6 +6159,13 @@ declare module '@salesforce/core-bundle/util/fileLocking' {
6159
6159
  * See its documentation for details.
6160
6160
  */
6161
6161
  export const lockInitSync: (filePath: string) => LockInitSyncResponse;
6162
+ /**
6163
+ * Poll until the file is unlocked.
6164
+ *
6165
+ * @param filePath file path to check
6166
+ */
6167
+ export const pollUntilUnlock: (filePath: string) => Promise<void>;
6168
+ export const pollUntilUnlockSync: (filePath: string) => void;
6162
6169
  export {};
6163
6170
 
6164
6171
  }
package/lib/index.js CHANGED
@@ -4629,7 +4629,7 @@ var require_package = __commonJS({
4629
4629
  "package.json"(exports2, module2) {
4630
4630
  module2.exports = {
4631
4631
  name: "@salesforce/core-bundle",
4632
- version: "8.2.8",
4632
+ version: "8.3.0",
4633
4633
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
4634
4634
  main: "lib/index",
4635
4635
  types: "lib/index.d.ts",
@@ -4648,6 +4648,7 @@ var require_package = __commonJS({
4648
4648
  lint: "wireit",
4649
4649
  "lint-fix": "yarn sf-lint --fix",
4650
4650
  test: "wireit",
4651
+ "test:nuts": 'mocha "test/**/*.nut.ts" --timeout 500000',
4651
4652
  "test:only": "wireit",
4652
4653
  "test:perf": "ts-node test/perf/logger/main.test.ts"
4653
4654
  },
@@ -4763,7 +4764,7 @@ var require_package = __commonJS({
4763
4764
  output: []
4764
4765
  },
4765
4766
  "test:only": {
4766
- command: 'nyc mocha "test/**/*Test.ts"',
4767
+ command: 'nyc mocha "test/unit/**/*.test.ts"',
4767
4768
  env: {
4768
4769
  FORCE_COLOR: "2"
4769
4770
  },
@@ -12371,6 +12372,360 @@ var require_proper_lockfile = __commonJS({
12371
12372
  }
12372
12373
  });
12373
12374
 
12375
+ // node_modules/ts-retry-promise/dist/timeout.js
12376
+ var require_timeout = __commonJS({
12377
+ "node_modules/ts-retry-promise/dist/timeout.js"(exports2) {
12378
+ "use strict";
12379
+ Object.defineProperty(exports2, "__esModule", { value: true });
12380
+ exports2.timeout = void 0;
12381
+ exports2.timeout = function(millies, f) {
12382
+ if (millies === "INFINITELY") {
12383
+ return f(function() {
12384
+ return false;
12385
+ });
12386
+ }
12387
+ var done = false;
12388
+ var doneF = function() {
12389
+ return done;
12390
+ };
12391
+ return new Promise(function(resolve, reject) {
12392
+ var timeoutRef = setTimeout(function() {
12393
+ done = true;
12394
+ reject(new Error("Timeout after " + millies + "ms"));
12395
+ }, millies);
12396
+ var result = f(doneF);
12397
+ result.then(function(r) {
12398
+ resolve(r);
12399
+ clearTimeout(timeoutRef);
12400
+ }, function(e) {
12401
+ reject(e);
12402
+ clearTimeout(timeoutRef);
12403
+ });
12404
+ });
12405
+ };
12406
+ }
12407
+ });
12408
+
12409
+ // node_modules/ts-retry-promise/dist/retry-promise.js
12410
+ var require_retry_promise = __commonJS({
12411
+ "node_modules/ts-retry-promise/dist/retry-promise.js"(exports2) {
12412
+ "use strict";
12413
+ var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ function() {
12414
+ var extendStatics2 = function(d, b) {
12415
+ extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12416
+ d2.__proto__ = b2;
12417
+ } || function(d2, b2) {
12418
+ for (var p in b2)
12419
+ if (b2.hasOwnProperty(p))
12420
+ d2[p] = b2[p];
12421
+ };
12422
+ return extendStatics2(d, b);
12423
+ };
12424
+ return function(d, b) {
12425
+ extendStatics2(d, b);
12426
+ function __() {
12427
+ this.constructor = d;
12428
+ }
12429
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12430
+ };
12431
+ }();
12432
+ var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
12433
+ function adopt(value) {
12434
+ return value instanceof P ? value : new P(function(resolve) {
12435
+ resolve(value);
12436
+ });
12437
+ }
12438
+ return new (P || (P = Promise))(function(resolve, reject) {
12439
+ function fulfilled(value) {
12440
+ try {
12441
+ step(generator.next(value));
12442
+ } catch (e) {
12443
+ reject(e);
12444
+ }
12445
+ }
12446
+ function rejected(value) {
12447
+ try {
12448
+ step(generator["throw"](value));
12449
+ } catch (e) {
12450
+ reject(e);
12451
+ }
12452
+ }
12453
+ function step(result) {
12454
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
12455
+ }
12456
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12457
+ });
12458
+ };
12459
+ var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
12460
+ var _ = { label: 0, sent: function() {
12461
+ if (t[0] & 1)
12462
+ throw t[1];
12463
+ return t[1];
12464
+ }, trys: [], ops: [] }, f, y, t, g;
12465
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
12466
+ return this;
12467
+ }), g;
12468
+ function verb(n) {
12469
+ return function(v) {
12470
+ return step([n, v]);
12471
+ };
12472
+ }
12473
+ function step(op) {
12474
+ if (f)
12475
+ throw new TypeError("Generator is already executing.");
12476
+ while (_)
12477
+ try {
12478
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
12479
+ return t;
12480
+ if (y = 0, t)
12481
+ op = [op[0] & 2, t.value];
12482
+ switch (op[0]) {
12483
+ case 0:
12484
+ case 1:
12485
+ t = op;
12486
+ break;
12487
+ case 4:
12488
+ _.label++;
12489
+ return { value: op[1], done: false };
12490
+ case 5:
12491
+ _.label++;
12492
+ y = op[1];
12493
+ op = [0];
12494
+ continue;
12495
+ case 7:
12496
+ op = _.ops.pop();
12497
+ _.trys.pop();
12498
+ continue;
12499
+ default:
12500
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
12501
+ _ = 0;
12502
+ continue;
12503
+ }
12504
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
12505
+ _.label = op[1];
12506
+ break;
12507
+ }
12508
+ if (op[0] === 6 && _.label < t[1]) {
12509
+ _.label = t[1];
12510
+ t = op;
12511
+ break;
12512
+ }
12513
+ if (t && _.label < t[2]) {
12514
+ _.label = t[2];
12515
+ _.ops.push(op);
12516
+ break;
12517
+ }
12518
+ if (t[2])
12519
+ _.ops.pop();
12520
+ _.trys.pop();
12521
+ continue;
12522
+ }
12523
+ op = body.call(thisArg, _);
12524
+ } catch (e) {
12525
+ op = [6, e];
12526
+ y = 0;
12527
+ } finally {
12528
+ f = t = 0;
12529
+ }
12530
+ if (op[0] & 5)
12531
+ throw op[1];
12532
+ return { value: op[0] ? op[1] : void 0, done: true };
12533
+ }
12534
+ };
12535
+ Object.defineProperty(exports2, "__esModule", { value: true });
12536
+ exports2.NotRetryableError = exports2.RetryError = exports2.notEmpty = exports2.customizeRetry = exports2.customizeDecorator = exports2.retryDecorator = exports2.retry = exports2.wait = exports2.defaultRetryConfig = void 0;
12537
+ var timeout_1 = require_timeout();
12538
+ var fixedBackoff = function(attempt, delay) {
12539
+ return delay;
12540
+ };
12541
+ var linearBackoff = function(attempt, delay) {
12542
+ return attempt * delay;
12543
+ };
12544
+ var exponentialBackoff = function(attempt, delay) {
12545
+ return Math.pow(delay, attempt);
12546
+ };
12547
+ exports2.defaultRetryConfig = {
12548
+ backoff: "FIXED",
12549
+ delay: 100,
12550
+ logger: function() {
12551
+ return void 0;
12552
+ },
12553
+ maxBackOff: 5 * 60 * 1e3,
12554
+ retries: 10,
12555
+ timeout: 60 * 1e3,
12556
+ until: function() {
12557
+ return true;
12558
+ },
12559
+ retryIf: function() {
12560
+ return true;
12561
+ }
12562
+ };
12563
+ function wait(ms) {
12564
+ return __awaiter2(this, void 0, void 0, function() {
12565
+ return __generator2(this, function(_a) {
12566
+ return [2, new Promise(function(resolve) {
12567
+ return setTimeout(resolve, ms);
12568
+ })];
12569
+ });
12570
+ });
12571
+ }
12572
+ exports2.wait = wait;
12573
+ function retry(f, config) {
12574
+ return __awaiter2(this, void 0, void 0, function() {
12575
+ var effectiveConfig;
12576
+ return __generator2(this, function(_a) {
12577
+ effectiveConfig = Object.assign({}, exports2.defaultRetryConfig, config);
12578
+ return [2, timeout_1.timeout(effectiveConfig.timeout, function(done) {
12579
+ return _retry(f, effectiveConfig, done);
12580
+ })];
12581
+ });
12582
+ });
12583
+ }
12584
+ exports2.retry = retry;
12585
+ function retryDecorator(func, config) {
12586
+ return function() {
12587
+ var args = [];
12588
+ for (var _i = 0; _i < arguments.length; _i++) {
12589
+ args[_i] = arguments[_i];
12590
+ }
12591
+ return retry(function() {
12592
+ return func.apply(void 0, args);
12593
+ }, config);
12594
+ };
12595
+ }
12596
+ exports2.retryDecorator = retryDecorator;
12597
+ function customizeDecorator(customConfig) {
12598
+ return function(args, config) {
12599
+ return retryDecorator(args, Object.assign({}, customConfig, config));
12600
+ };
12601
+ }
12602
+ exports2.customizeDecorator = customizeDecorator;
12603
+ function customizeRetry(customConfig) {
12604
+ return function(f, c) {
12605
+ var customized = Object.assign({}, customConfig, c);
12606
+ return retry(f, customized);
12607
+ };
12608
+ }
12609
+ exports2.customizeRetry = customizeRetry;
12610
+ function _retry(f, config, done) {
12611
+ return __awaiter2(this, void 0, void 0, function() {
12612
+ var lastError, delay, retries, i, result, error_1, millisToWait;
12613
+ return __generator2(this, function(_a) {
12614
+ switch (_a.label) {
12615
+ case 0:
12616
+ switch (config.backoff) {
12617
+ case "EXPONENTIAL":
12618
+ delay = exponentialBackoff;
12619
+ break;
12620
+ case "FIXED":
12621
+ delay = fixedBackoff;
12622
+ break;
12623
+ case "LINEAR":
12624
+ delay = linearBackoff;
12625
+ break;
12626
+ default:
12627
+ delay = config.backoff;
12628
+ }
12629
+ if (config.retries === "INFINITELY") {
12630
+ retries = Number.MAX_SAFE_INTEGER;
12631
+ } else {
12632
+ retries = config.retries;
12633
+ }
12634
+ i = 0;
12635
+ _a.label = 1;
12636
+ case 1:
12637
+ if (!(i <= retries))
12638
+ return [3, 8];
12639
+ _a.label = 2;
12640
+ case 2:
12641
+ _a.trys.push([2, 4, , 5]);
12642
+ return [4, f()];
12643
+ case 3:
12644
+ result = _a.sent();
12645
+ if (config.until(result)) {
12646
+ return [2, result];
12647
+ }
12648
+ config.logger("Until condition not met by " + result);
12649
+ return [3, 5];
12650
+ case 4:
12651
+ error_1 = _a.sent();
12652
+ if (!config.retryIf(error_1)) {
12653
+ throw error_1;
12654
+ }
12655
+ if (error_1.name === NotRetryableError.name) {
12656
+ throw new RetryError("Met not retryable error. Last error: " + error_1, error_1);
12657
+ }
12658
+ lastError = error_1;
12659
+ config.logger("Retry failed: " + error_1.message);
12660
+ return [3, 5];
12661
+ case 5:
12662
+ millisToWait = delay(i + 1, config.delay);
12663
+ return [4, wait(millisToWait > config.maxBackOff ? config.maxBackOff : millisToWait)];
12664
+ case 6:
12665
+ _a.sent();
12666
+ if (done()) {
12667
+ return [3, 8];
12668
+ }
12669
+ _a.label = 7;
12670
+ case 7:
12671
+ i++;
12672
+ return [3, 1];
12673
+ case 8:
12674
+ throw new RetryError("All retries failed. Last error: " + lastError, lastError);
12675
+ }
12676
+ });
12677
+ });
12678
+ }
12679
+ exports2.notEmpty = function(result) {
12680
+ if (Array.isArray(result)) {
12681
+ return result.length > 0;
12682
+ }
12683
+ return result !== null && result !== void 0;
12684
+ };
12685
+ var RetryError = (
12686
+ /** @class */
12687
+ function(_super) {
12688
+ __extends2(RetryError2, _super);
12689
+ function RetryError2(message, lastError) {
12690
+ var _this = _super.call(this, message) || this;
12691
+ _this.lastError = lastError;
12692
+ return _this;
12693
+ }
12694
+ return RetryError2;
12695
+ }(Error)
12696
+ );
12697
+ exports2.RetryError = RetryError;
12698
+ var BaseError = (
12699
+ /** @class */
12700
+ /* @__PURE__ */ function() {
12701
+ function BaseError2(message) {
12702
+ var args = [];
12703
+ for (var _i = 1; _i < arguments.length; _i++) {
12704
+ args[_i - 1] = arguments[_i];
12705
+ }
12706
+ this.message = message;
12707
+ Error.apply(this, args);
12708
+ }
12709
+ return BaseError2;
12710
+ }()
12711
+ );
12712
+ BaseError.prototype = new Error();
12713
+ var NotRetryableError = (
12714
+ /** @class */
12715
+ function(_super) {
12716
+ __extends2(NotRetryableError2, _super);
12717
+ function NotRetryableError2(message) {
12718
+ var _this = _super.call(this, message) || this;
12719
+ Object.defineProperty(_this, "name", { value: _this.constructor.name });
12720
+ return _this;
12721
+ }
12722
+ return NotRetryableError2;
12723
+ }(BaseError)
12724
+ );
12725
+ exports2.NotRetryableError = NotRetryableError;
12726
+ }
12727
+ });
12728
+
12374
12729
  // lib/util/lockRetryOptions.js
12375
12730
  var require_lockRetryOptions = __commonJS({
12376
12731
  "lib/util/lockRetryOptions.js"(exports2) {
@@ -12422,10 +12777,12 @@ var require_fileLocking = __commonJS({
12422
12777
  return result;
12423
12778
  };
12424
12779
  Object.defineProperty(exports2, "__esModule", { value: true });
12425
- exports2.lockInitSync = exports2.lockInit = void 0;
12780
+ exports2.pollUntilUnlockSync = exports2.pollUntilUnlock = exports2.lockInitSync = exports2.lockInit = void 0;
12426
12781
  var fs = __importStar2(require("node:fs"));
12427
12782
  var node_path_1 = require("node:path");
12428
12783
  var proper_lockfile_1 = require_proper_lockfile();
12784
+ var kit_1 = require_lib2();
12785
+ var ts_retry_promise_1 = require_retry_promise();
12429
12786
  var sfError_12 = require_sfError();
12430
12787
  var logger_12 = require_logger();
12431
12788
  var lockRetryOptions_1 = require_lockRetryOptions();
@@ -12489,6 +12846,32 @@ var require_fileLocking = __commonJS({
12489
12846
  };
12490
12847
  };
12491
12848
  exports2.lockInitSync = lockInitSync;
12849
+ var pollUntilUnlock = async (filePath) => {
12850
+ try {
12851
+ await (0, ts_retry_promise_1.retryDecorator)(proper_lockfile_1.check, {
12852
+ timeout: kit_1.Duration.minutes(1).milliseconds,
12853
+ delay: 10,
12854
+ until: (locked) => locked === false,
12855
+ // don't retry errors (typically enoent or access on the lockfile, therefore not locked)
12856
+ retryIf: () => false
12857
+ })(filePath, lockRetryOptions_1.lockRetryOptions);
12858
+ } catch (e) {
12859
+ }
12860
+ };
12861
+ exports2.pollUntilUnlock = pollUntilUnlock;
12862
+ var pollUntilUnlockSync = (filePath) => {
12863
+ let counter = 0;
12864
+ let locked = true;
12865
+ while (locked && counter < 100) {
12866
+ try {
12867
+ locked = (0, proper_lockfile_1.checkSync)(filePath, lockRetryOptions_1.lockOptions);
12868
+ counter++;
12869
+ } catch {
12870
+ locked = false;
12871
+ }
12872
+ }
12873
+ };
12874
+ exports2.pollUntilUnlockSync = pollUntilUnlockSync;
12492
12875
  }
12493
12876
  });
12494
12877
 
@@ -14050,6 +14433,7 @@ var require_configFile = __commonJS({
14050
14433
  try {
14051
14434
  if (!this.hasRead || force) {
14052
14435
  this.logger.debug(`Reading config file: ${this.getPath()} because ${!this.hasRead ? "hasRead is false" : "force parameter is true"}`);
14436
+ await (0, fileLocking_12.pollUntilUnlock)(this.getPath());
14053
14437
  const obj = (0, kit_1.parseJsonMap)(await fs.promises.readFile(this.getPath(), "utf8"), this.getPath());
14054
14438
  this.setContentsFromFileContents(obj, (await fs.promises.stat(this.getPath(), { bigint: true })).mtimeNs);
14055
14439
  }
@@ -14078,6 +14462,7 @@ var require_configFile = __commonJS({
14078
14462
  readSync(throwOnNotFound = false, force = false) {
14079
14463
  try {
14080
14464
  if (!this.hasRead || force) {
14465
+ (0, fileLocking_12.pollUntilUnlockSync)(this.getPath());
14081
14466
  this.logger.debug(`Reading config file: ${this.getPath()}`);
14082
14467
  const obj = (0, kit_1.parseJsonMap)(fs.readFileSync(this.getPath(), "utf8"));
14083
14468
  this.setContentsFromFileContents(obj, fs.statSync(this.getPath(), { bigint: true }).mtimeNs);
@@ -85007,360 +85392,6 @@ var require_jsonwebtoken = __commonJS({
85007
85392
  }
85008
85393
  });
85009
85394
 
85010
- // node_modules/ts-retry-promise/dist/timeout.js
85011
- var require_timeout = __commonJS({
85012
- "node_modules/ts-retry-promise/dist/timeout.js"(exports2) {
85013
- "use strict";
85014
- Object.defineProperty(exports2, "__esModule", { value: true });
85015
- exports2.timeout = void 0;
85016
- exports2.timeout = function(millies, f) {
85017
- if (millies === "INFINITELY") {
85018
- return f(function() {
85019
- return false;
85020
- });
85021
- }
85022
- var done = false;
85023
- var doneF = function() {
85024
- return done;
85025
- };
85026
- return new Promise(function(resolve, reject) {
85027
- var timeoutRef = setTimeout(function() {
85028
- done = true;
85029
- reject(new Error("Timeout after " + millies + "ms"));
85030
- }, millies);
85031
- var result = f(doneF);
85032
- result.then(function(r) {
85033
- resolve(r);
85034
- clearTimeout(timeoutRef);
85035
- }, function(e) {
85036
- reject(e);
85037
- clearTimeout(timeoutRef);
85038
- });
85039
- });
85040
- };
85041
- }
85042
- });
85043
-
85044
- // node_modules/ts-retry-promise/dist/retry-promise.js
85045
- var require_retry_promise = __commonJS({
85046
- "node_modules/ts-retry-promise/dist/retry-promise.js"(exports2) {
85047
- "use strict";
85048
- var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ function() {
85049
- var extendStatics2 = function(d, b) {
85050
- extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
85051
- d2.__proto__ = b2;
85052
- } || function(d2, b2) {
85053
- for (var p in b2)
85054
- if (b2.hasOwnProperty(p))
85055
- d2[p] = b2[p];
85056
- };
85057
- return extendStatics2(d, b);
85058
- };
85059
- return function(d, b) {
85060
- extendStatics2(d, b);
85061
- function __() {
85062
- this.constructor = d;
85063
- }
85064
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
85065
- };
85066
- }();
85067
- var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
85068
- function adopt(value) {
85069
- return value instanceof P ? value : new P(function(resolve) {
85070
- resolve(value);
85071
- });
85072
- }
85073
- return new (P || (P = Promise))(function(resolve, reject) {
85074
- function fulfilled(value) {
85075
- try {
85076
- step(generator.next(value));
85077
- } catch (e) {
85078
- reject(e);
85079
- }
85080
- }
85081
- function rejected(value) {
85082
- try {
85083
- step(generator["throw"](value));
85084
- } catch (e) {
85085
- reject(e);
85086
- }
85087
- }
85088
- function step(result) {
85089
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
85090
- }
85091
- step((generator = generator.apply(thisArg, _arguments || [])).next());
85092
- });
85093
- };
85094
- var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
85095
- var _ = { label: 0, sent: function() {
85096
- if (t[0] & 1)
85097
- throw t[1];
85098
- return t[1];
85099
- }, trys: [], ops: [] }, f, y, t, g;
85100
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
85101
- return this;
85102
- }), g;
85103
- function verb(n) {
85104
- return function(v) {
85105
- return step([n, v]);
85106
- };
85107
- }
85108
- function step(op) {
85109
- if (f)
85110
- throw new TypeError("Generator is already executing.");
85111
- while (_)
85112
- try {
85113
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
85114
- return t;
85115
- if (y = 0, t)
85116
- op = [op[0] & 2, t.value];
85117
- switch (op[0]) {
85118
- case 0:
85119
- case 1:
85120
- t = op;
85121
- break;
85122
- case 4:
85123
- _.label++;
85124
- return { value: op[1], done: false };
85125
- case 5:
85126
- _.label++;
85127
- y = op[1];
85128
- op = [0];
85129
- continue;
85130
- case 7:
85131
- op = _.ops.pop();
85132
- _.trys.pop();
85133
- continue;
85134
- default:
85135
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
85136
- _ = 0;
85137
- continue;
85138
- }
85139
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
85140
- _.label = op[1];
85141
- break;
85142
- }
85143
- if (op[0] === 6 && _.label < t[1]) {
85144
- _.label = t[1];
85145
- t = op;
85146
- break;
85147
- }
85148
- if (t && _.label < t[2]) {
85149
- _.label = t[2];
85150
- _.ops.push(op);
85151
- break;
85152
- }
85153
- if (t[2])
85154
- _.ops.pop();
85155
- _.trys.pop();
85156
- continue;
85157
- }
85158
- op = body.call(thisArg, _);
85159
- } catch (e) {
85160
- op = [6, e];
85161
- y = 0;
85162
- } finally {
85163
- f = t = 0;
85164
- }
85165
- if (op[0] & 5)
85166
- throw op[1];
85167
- return { value: op[0] ? op[1] : void 0, done: true };
85168
- }
85169
- };
85170
- Object.defineProperty(exports2, "__esModule", { value: true });
85171
- exports2.NotRetryableError = exports2.RetryError = exports2.notEmpty = exports2.customizeRetry = exports2.customizeDecorator = exports2.retryDecorator = exports2.retry = exports2.wait = exports2.defaultRetryConfig = void 0;
85172
- var timeout_1 = require_timeout();
85173
- var fixedBackoff = function(attempt, delay) {
85174
- return delay;
85175
- };
85176
- var linearBackoff = function(attempt, delay) {
85177
- return attempt * delay;
85178
- };
85179
- var exponentialBackoff = function(attempt, delay) {
85180
- return Math.pow(delay, attempt);
85181
- };
85182
- exports2.defaultRetryConfig = {
85183
- backoff: "FIXED",
85184
- delay: 100,
85185
- logger: function() {
85186
- return void 0;
85187
- },
85188
- maxBackOff: 5 * 60 * 1e3,
85189
- retries: 10,
85190
- timeout: 60 * 1e3,
85191
- until: function() {
85192
- return true;
85193
- },
85194
- retryIf: function() {
85195
- return true;
85196
- }
85197
- };
85198
- function wait(ms) {
85199
- return __awaiter2(this, void 0, void 0, function() {
85200
- return __generator2(this, function(_a) {
85201
- return [2, new Promise(function(resolve) {
85202
- return setTimeout(resolve, ms);
85203
- })];
85204
- });
85205
- });
85206
- }
85207
- exports2.wait = wait;
85208
- function retry(f, config) {
85209
- return __awaiter2(this, void 0, void 0, function() {
85210
- var effectiveConfig;
85211
- return __generator2(this, function(_a) {
85212
- effectiveConfig = Object.assign({}, exports2.defaultRetryConfig, config);
85213
- return [2, timeout_1.timeout(effectiveConfig.timeout, function(done) {
85214
- return _retry(f, effectiveConfig, done);
85215
- })];
85216
- });
85217
- });
85218
- }
85219
- exports2.retry = retry;
85220
- function retryDecorator(func, config) {
85221
- return function() {
85222
- var args = [];
85223
- for (var _i = 0; _i < arguments.length; _i++) {
85224
- args[_i] = arguments[_i];
85225
- }
85226
- return retry(function() {
85227
- return func.apply(void 0, args);
85228
- }, config);
85229
- };
85230
- }
85231
- exports2.retryDecorator = retryDecorator;
85232
- function customizeDecorator(customConfig) {
85233
- return function(args, config) {
85234
- return retryDecorator(args, Object.assign({}, customConfig, config));
85235
- };
85236
- }
85237
- exports2.customizeDecorator = customizeDecorator;
85238
- function customizeRetry(customConfig) {
85239
- return function(f, c) {
85240
- var customized = Object.assign({}, customConfig, c);
85241
- return retry(f, customized);
85242
- };
85243
- }
85244
- exports2.customizeRetry = customizeRetry;
85245
- function _retry(f, config, done) {
85246
- return __awaiter2(this, void 0, void 0, function() {
85247
- var lastError, delay, retries, i, result, error_1, millisToWait;
85248
- return __generator2(this, function(_a) {
85249
- switch (_a.label) {
85250
- case 0:
85251
- switch (config.backoff) {
85252
- case "EXPONENTIAL":
85253
- delay = exponentialBackoff;
85254
- break;
85255
- case "FIXED":
85256
- delay = fixedBackoff;
85257
- break;
85258
- case "LINEAR":
85259
- delay = linearBackoff;
85260
- break;
85261
- default:
85262
- delay = config.backoff;
85263
- }
85264
- if (config.retries === "INFINITELY") {
85265
- retries = Number.MAX_SAFE_INTEGER;
85266
- } else {
85267
- retries = config.retries;
85268
- }
85269
- i = 0;
85270
- _a.label = 1;
85271
- case 1:
85272
- if (!(i <= retries))
85273
- return [3, 8];
85274
- _a.label = 2;
85275
- case 2:
85276
- _a.trys.push([2, 4, , 5]);
85277
- return [4, f()];
85278
- case 3:
85279
- result = _a.sent();
85280
- if (config.until(result)) {
85281
- return [2, result];
85282
- }
85283
- config.logger("Until condition not met by " + result);
85284
- return [3, 5];
85285
- case 4:
85286
- error_1 = _a.sent();
85287
- if (!config.retryIf(error_1)) {
85288
- throw error_1;
85289
- }
85290
- if (error_1.name === NotRetryableError.name) {
85291
- throw new RetryError("Met not retryable error. Last error: " + error_1, error_1);
85292
- }
85293
- lastError = error_1;
85294
- config.logger("Retry failed: " + error_1.message);
85295
- return [3, 5];
85296
- case 5:
85297
- millisToWait = delay(i + 1, config.delay);
85298
- return [4, wait(millisToWait > config.maxBackOff ? config.maxBackOff : millisToWait)];
85299
- case 6:
85300
- _a.sent();
85301
- if (done()) {
85302
- return [3, 8];
85303
- }
85304
- _a.label = 7;
85305
- case 7:
85306
- i++;
85307
- return [3, 1];
85308
- case 8:
85309
- throw new RetryError("All retries failed. Last error: " + lastError, lastError);
85310
- }
85311
- });
85312
- });
85313
- }
85314
- exports2.notEmpty = function(result) {
85315
- if (Array.isArray(result)) {
85316
- return result.length > 0;
85317
- }
85318
- return result !== null && result !== void 0;
85319
- };
85320
- var RetryError = (
85321
- /** @class */
85322
- function(_super) {
85323
- __extends2(RetryError2, _super);
85324
- function RetryError2(message, lastError) {
85325
- var _this = _super.call(this, message) || this;
85326
- _this.lastError = lastError;
85327
- return _this;
85328
- }
85329
- return RetryError2;
85330
- }(Error)
85331
- );
85332
- exports2.RetryError = RetryError;
85333
- var BaseError = (
85334
- /** @class */
85335
- /* @__PURE__ */ function() {
85336
- function BaseError2(message) {
85337
- var args = [];
85338
- for (var _i = 1; _i < arguments.length; _i++) {
85339
- args[_i - 1] = arguments[_i];
85340
- }
85341
- this.message = message;
85342
- Error.apply(this, args);
85343
- }
85344
- return BaseError2;
85345
- }()
85346
- );
85347
- BaseError.prototype = new Error();
85348
- var NotRetryableError = (
85349
- /** @class */
85350
- function(_super) {
85351
- __extends2(NotRetryableError2, _super);
85352
- function NotRetryableError2(message) {
85353
- var _this = _super.call(this, message) || this;
85354
- Object.defineProperty(_this, "name", { value: _this.constructor.name });
85355
- return _this;
85356
- }
85357
- return NotRetryableError2;
85358
- }(BaseError)
85359
- );
85360
- exports2.NotRetryableError = NotRetryableError;
85361
- }
85362
- });
85363
-
85364
85395
  // lib/status/pollingClient.js
85365
85396
  var require_pollingClient = __commonJS({
85366
85397
  "lib/status/pollingClient.js"(exports2) {
@@ -109124,6 +109155,7 @@ var require_scratchOrgInfoGenerator = __commonJS({
109124
109155
  try {
109125
109156
  const fileData = await node_fs_1.promises.readFile(definitionFile, "utf8");
109126
109157
  const defFileContents = (0, kit_1.parseJson)(fileData);
109158
+ delete defFileContents["$schema"];
109127
109159
  return defFileContents;
109128
109160
  } catch (err) {
109129
109161
  const error = err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.2.8",
3
+ "version": "8.3.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",
@@ -19,6 +19,7 @@
19
19
  "lint": "wireit",
20
20
  "lint-fix": "yarn sf-lint --fix",
21
21
  "test": "wireit",
22
+ "test:nuts": "mocha \"test/**/*.nut.ts\" --timeout 500000",
22
23
  "test:only": "wireit",
23
24
  "test:perf": "ts-node test/perf/logger/main.test.ts"
24
25
  },
@@ -134,7 +135,7 @@
134
135
  "output": []
135
136
  },
136
137
  "test:only": {
137
- "command": "nyc mocha \"test/**/*Test.ts\"",
138
+ "command": "nyc mocha \"test/unit/**/*.test.ts\"",
138
139
  "env": {
139
140
  "FORCE_COLOR": "2"
140
141
  },