@embeddable.com/sdk-core 3.8.0-next.0 → 3.8.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.js CHANGED
@@ -20,7 +20,7 @@ var require$$2$1 = require('fs');
20
20
  var path$1 = require('path');
21
21
  var axios = require('axios');
22
22
  var archiver = require('archiver');
23
- var http = require('node:http');
23
+ var prompts = require('@inquirer/prompts');
24
24
  var ws = require('ws');
25
25
  var chokidar = require('chokidar');
26
26
  var promises = require('fs/promises');
@@ -52,7 +52,6 @@ var YAML__namespace = /*#__PURE__*/_interopNamespaceDefault(YAML);
52
52
  var url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
53
53
  var path__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(path$1);
54
54
  var archiver__namespace = /*#__PURE__*/_interopNamespaceDefault(archiver);
55
- var http__namespace = /*#__PURE__*/_interopNamespaceDefault(http);
56
55
  var chokidar__namespace = /*#__PURE__*/_interopNamespaceDefault(chokidar);
57
56
 
58
57
  var findFiles = async (initialSrcDir, regex) => {
@@ -505,8 +504,8 @@ async function addComponentTagName(filePath, bundleHash) {
505
504
  ]);
506
505
  }
507
506
  async function runStencil(ctx) {
508
- var _a, _b;
509
- const logger = ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.logger) || node.createNodeLogger();
507
+ var _a, _b, _c;
508
+ const logger = ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.logger) || node.createNodeLogger({ process });
510
509
  const sys = ((_b = ctx.dev) === null || _b === void 0 ? void 0 : _b.sys) || node.createNodeSys({ process });
511
510
  const devMode = !!ctx.dev;
512
511
  const isWindows = process.platform === "win32";
@@ -516,54 +515,24 @@ async function runStencil(ctx) {
516
515
  sys,
517
516
  config: {
518
517
  devMode,
519
- enableCache: true,
520
518
  maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
521
519
  rootDir: ctx.client.buildDir,
522
520
  configPath: path__namespace.resolve(ctx.client.buildDir, "stencil.config.ts"),
523
521
  tsconfig: path__namespace.resolve(ctx.client.buildDir, "tsconfig.json"),
524
522
  namespace: "embeddable-wrapper",
525
523
  srcDir: path__namespace.resolve(ctx.client.buildDir, "component"),
526
- sourceMap: !devMode,
527
- minifyJs: !devMode,
528
- minifyCss: !devMode,
529
524
  outputTargets: [
530
525
  {
531
526
  type: "dist",
532
527
  },
533
528
  ],
534
- watchDirs: [
535
- path__namespace.resolve(ctx.client.buildDir, ctx["sdk-react"].outputOptions.buildName),
536
- ],
537
529
  },
538
530
  });
539
531
  const compiler$1 = await compiler.createCompiler(validated.config);
540
- const buildResults = await compiler$1.build();
541
- if (devMode) {
542
- // Handle process exit to clean up resources
543
- const cleanUp = async () => {
544
- await compiler$1.destroy();
545
- process.exit(0);
546
- };
547
- process.on("SIGINT", cleanUp);
548
- process.on("SIGTERM", cleanUp);
549
- }
550
- else {
551
- if (buildResults.hasError) {
552
- console.error("Stencil build error:", buildResults.diagnostics);
553
- throw new Error("Stencil build error");
554
- }
555
- else {
556
- await handleStencilBuildOutput(ctx);
557
- }
558
- await compiler$1.destroy();
559
- }
560
- process.chdir(ctx.client.rootDir);
561
- }
562
- async function handleStencilBuildOutput(ctx) {
563
- var _a;
532
+ await compiler$1.build();
564
533
  const entryFilePath = path__namespace.resolve(ctx.client.stencilBuild, "embeddable-wrapper.esm.js");
565
534
  let fileName = "embeddable-wrapper.esm.js";
566
- if (!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
535
+ if (!((_c = ctx.dev) === null || _c === void 0 ? void 0 : _c.watch)) {
567
536
  const entryFileContent = await fs__namespace.readFile(entryFilePath, "utf8");
568
537
  const fileHash = getContentHash(entryFileContent);
569
538
  fileName = `embeddable-wrapper.esm-${fileHash}.js`;
@@ -571,6 +540,8 @@ async function handleStencilBuildOutput(ctx) {
571
540
  await addComponentTagName(entryFilePath, ctx.client.bundleHash);
572
541
  }
573
542
  await fs__namespace.rename(entryFilePath, path__namespace.resolve(ctx.client.stencilBuild, fileName));
543
+ await compiler$1.destroy();
544
+ process.chdir(ctx.client.rootDir);
574
545
  }
575
546
  async function generateSourceMap(ctx, pluginName) {
576
547
  const componentBuildDir = path__namespace.resolve(ctx.client.buildDir, ctx[pluginName].outputOptions.buildName);
@@ -596,10 +567,9 @@ const CREDENTIALS_DIR = path__namespace.resolve(os__namespace.homedir(), ".embed
596
567
  const CREDENTIALS_FILE = path__namespace.resolve(CREDENTIALS_DIR, "credentials");
597
568
 
598
569
  const oraP$3 = import('ora');
599
- let ora$2;
600
570
  const checkNodeVersion = async () => {
601
- ora$2 = (await oraP$3).default;
602
- const spinner = ora$2("Checking node version...");
571
+ const ora = (await oraP$3).default;
572
+ const spinner = ora("Checking node version...").start();
603
573
  const [major, minor] = process.versions.node.split(".").map(Number);
604
574
  const packageJson = await Promise.resolve().then(function () { return _package$1; });
605
575
  const { engines: { node }, } = packageJson;
@@ -608,13 +578,11 @@ const checkNodeVersion = async () => {
608
578
  .map((v) => v.replace(/[^\d]/g, ""))
609
579
  .map(Number);
610
580
  if (major < minMajor || (major === minMajor && minor < minMinor)) {
611
- spinner.fail({
612
- text: `Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`,
613
- color: "red",
614
- });
581
+ spinner.fail(`Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`);
615
582
  process.exit(1);
616
583
  }
617
584
  else {
585
+ spinner.stop();
618
586
  return true;
619
587
  }
620
588
  };
@@ -5187,7 +5155,7 @@ function getAugmentedNamespace(n) {
5187
5155
  }
5188
5156
 
5189
5157
  var name$1 = "rollbar";
5190
- var version$1 = "2.26.2";
5158
+ var version$1 = "2.26.4";
5191
5159
  var repository$1 = {
5192
5160
  type: "git",
5193
5161
  url: "http://github.com/rollbar/rollbar.js"
@@ -5214,37 +5182,35 @@ var dependencies$1 = {
5214
5182
  "source-map": "^0.5.7"
5215
5183
  };
5216
5184
  var devDependencies$1 = {
5217
- "babel-core": "^6.26.3",
5185
+ "@babel/core": "^7.22.11",
5218
5186
  "babel-eslint": "^10.0.3",
5219
5187
  "babel-loader": "^8.0.4",
5220
5188
  bluebird: "^3.3.5",
5221
- "browserstack-api": "0.0.5",
5222
5189
  chai: "^4.2.0",
5223
5190
  chalk: "^1.1.1",
5191
+ "coverage-istanbul-loader": "^3.0.5",
5224
5192
  eslint: "^6.8.0",
5225
5193
  "eslint-loader": "^3.0.3",
5226
- express: "^4.16.4",
5194
+ express: "^4.18.2",
5227
5195
  glob: "^5.0.14",
5228
5196
  grunt: "^1.1.0",
5229
5197
  "grunt-bumpup": "^0.6.3",
5230
5198
  "grunt-cli": "^1.3.2",
5231
- "grunt-contrib-concat": "~0.3.0",
5199
+ "grunt-contrib-concat": "^2.1.0",
5232
5200
  "grunt-contrib-connect": "^2.1.0",
5233
- "grunt-contrib-copy": "~0.5.0",
5234
- "grunt-contrib-jshint": "^2.1.0",
5201
+ "grunt-contrib-copy": "^1.0.0",
5202
+ "grunt-contrib-jshint": "^3.2.0",
5235
5203
  "grunt-contrib-uglify": "^4.0.0",
5236
5204
  "grunt-contrib-watch": "^1.1.0",
5237
- "grunt-karma": "^3.0.2",
5205
+ "grunt-karma": "^4.0.2",
5238
5206
  "grunt-parallel": "^0.5.1",
5239
5207
  "grunt-text-replace": "^0.4.0",
5240
5208
  "grunt-vows": "^0.4.2",
5241
- "grunt-webpack": "^3.1.3",
5242
- "istanbul-instrumenter-loader": "^3.0.1",
5209
+ "grunt-webpack": "^5.0.0",
5243
5210
  jade: "~0.27.7",
5244
5211
  "jasmine-core": "^2.3.4",
5245
5212
  "jquery-mockjax": "^2.5.0",
5246
- karma: "^5.0.4",
5247
- "karma-browserstack-launcher": "^1.5.1",
5213
+ karma: "^6.4.2",
5248
5214
  "karma-chai": "^0.1.0",
5249
5215
  "karma-chrome-launcher": "^2.2.0",
5250
5216
  "karma-expect": "^1.1.0",
@@ -5257,12 +5223,12 @@ var devDependencies$1 = {
5257
5223
  "karma-safari-launcher": "^0.1.1",
5258
5224
  "karma-sinon": "^1.0.4",
5259
5225
  "karma-sourcemap-loader": "^0.3.5",
5260
- "karma-webpack": "^4.0.2",
5261
- mocha: "^7.1.2",
5226
+ "karma-webpack": "^5.0.0",
5227
+ mocha: "^10.2.0",
5262
5228
  natives: "^1.1.6",
5263
5229
  nock: "^11.9.1",
5264
5230
  "node-libs-browser": "^0.5.2",
5265
- request: "^2.88.0",
5231
+ prettier: "^3.2.5",
5266
5232
  requirejs: "^2.1.20",
5267
5233
  "script-loader": "0.6.1",
5268
5234
  sinon: "^8.1.1",
@@ -5270,7 +5236,7 @@ var devDependencies$1 = {
5270
5236
  "strict-loader": "^1.2.0",
5271
5237
  "time-grunt": "^1.0.0",
5272
5238
  vows: "^0.8.3",
5273
- webpack: "^4.46.0"
5239
+ webpack: "^5.88.2"
5274
5240
  };
5275
5241
  var optionalDependencies = {
5276
5242
  decache: "^3.0.5"
@@ -5378,32 +5344,41 @@ function requireMerge () {
5378
5344
  var toStr = Object.prototype.toString;
5379
5345
 
5380
5346
  var isPlainObject = function isPlainObject(obj) {
5381
- if (!obj || toStr.call(obj) !== '[object Object]') {
5382
- return false;
5383
- }
5347
+ if (!obj || toStr.call(obj) !== '[object Object]') {
5348
+ return false;
5349
+ }
5384
5350
 
5385
- var hasOwnConstructor = hasOwn.call(obj, 'constructor');
5386
- var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
5387
- // Not own constructor property must be Object
5388
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
5389
- return false;
5390
- }
5351
+ var hasOwnConstructor = hasOwn.call(obj, 'constructor');
5352
+ var hasIsPrototypeOf =
5353
+ obj.constructor &&
5354
+ obj.constructor.prototype &&
5355
+ hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
5356
+ // Not own constructor property must be Object
5357
+ if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
5358
+ return false;
5359
+ }
5391
5360
 
5392
- // Own properties are enumerated firstly, so to speed up,
5393
- // if last one is own, then all properties are own.
5394
- var key;
5395
- for (key in obj) {/**/}
5361
+ // Own properties are enumerated firstly, so to speed up,
5362
+ // if last one is own, then all properties are own.
5363
+ var key;
5364
+ for (key in obj) {
5365
+ /**/
5366
+ }
5396
5367
 
5397
- return typeof key === 'undefined' || hasOwn.call(obj, key);
5368
+ return typeof key === 'undefined' || hasOwn.call(obj, key);
5398
5369
  };
5399
5370
 
5400
5371
  function merge() {
5401
- var i, src, copy, clone, name,
5402
- result = {},
5403
- current = null,
5404
- length = arguments.length;
5405
-
5406
- for (i=0; i < length; i++) {
5372
+ var i,
5373
+ src,
5374
+ copy,
5375
+ clone,
5376
+ name,
5377
+ result = {},
5378
+ current = null,
5379
+ length = arguments.length;
5380
+
5381
+ for (i = 0; i < length; i++) {
5407
5382
  current = arguments[i];
5408
5383
  if (current == null) {
5409
5384
  continue;
@@ -5445,14 +5420,15 @@ function requireUtility () {
5445
5420
 
5446
5421
  if (isDefined(JSON)) {
5447
5422
  // If polyfill is provided, prefer it over existing non-native shims.
5448
- if(polyfillJSON) {
5423
+ if (polyfillJSON) {
5449
5424
  if (isNativeFunction(JSON.stringify)) {
5450
5425
  RollbarJSON.stringify = JSON.stringify;
5451
5426
  }
5452
5427
  if (isNativeFunction(JSON.parse)) {
5453
5428
  RollbarJSON.parse = JSON.parse;
5454
5429
  }
5455
- } else { // else accept any interface that is present.
5430
+ } else {
5431
+ // else accept any interface that is present.
5456
5432
  if (isFunction(JSON.stringify)) {
5457
5433
  RollbarJSON.stringify = JSON.stringify;
5458
5434
  }
@@ -5502,7 +5478,10 @@ function requireUtility () {
5502
5478
  if (x instanceof Error) {
5503
5479
  return 'error';
5504
5480
  }
5505
- return ({}).toString.call(x).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
5481
+ return {}.toString
5482
+ .call(x)
5483
+ .match(/\s([a-zA-Z]+)/)[1]
5484
+ .toLowerCase();
5506
5485
  }
5507
5486
 
5508
5487
  /* isFunction - a convenience function for checking if a value is a function
@@ -5521,7 +5500,8 @@ function requireUtility () {
5521
5500
  */
5522
5501
  function isNativeFunction(f) {
5523
5502
  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
5524
- var funcMatchString = Function.prototype.toString.call(Object.prototype.hasOwnProperty)
5503
+ var funcMatchString = Function.prototype.toString
5504
+ .call(Object.prototype.hasOwnProperty)
5525
5505
  .replace(reRegExpChar, '\\$&')
5526
5506
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?');
5527
5507
  var reIsNative = RegExp('^' + funcMatchString + '$');
@@ -5532,7 +5512,7 @@ function requireUtility () {
5532
5512
  *
5533
5513
  * @param value - any value
5534
5514
  * @returns true is value is an object function is an object)
5535
- */
5515
+ */
5536
5516
  function isObject(value) {
5537
5517
  var type = typeof value;
5538
5518
  return value != null && (type == 'object' || type == 'function');
@@ -5542,9 +5522,9 @@ function requireUtility () {
5542
5522
  *
5543
5523
  * @param value - any value
5544
5524
  * @returns true if value is a string
5545
- */
5525
+ */
5546
5526
  function isString(value) {
5547
- return typeof value === 'string' || value instanceof String
5527
+ return typeof value === 'string' || value instanceof String;
5548
5528
  }
5549
5529
 
5550
5530
  /**
@@ -5553,7 +5533,7 @@ function requireUtility () {
5553
5533
  * @param {*} n - any value
5554
5534
  * @returns true if value is a finite number
5555
5535
  */
5556
- function isFiniteNumber(n) {
5536
+ function isFiniteNumber(n) {
5557
5537
  return Number.isFinite(n);
5558
5538
  }
5559
5539
 
@@ -5576,7 +5556,7 @@ function requireUtility () {
5576
5556
  */
5577
5557
  function isIterable(i) {
5578
5558
  var type = typeName(i);
5579
- return (type === 'object' || type === 'array');
5559
+ return type === 'object' || type === 'array';
5580
5560
  }
5581
5561
 
5582
5562
  /*
@@ -5606,11 +5586,14 @@ function requireUtility () {
5606
5586
  // from http://stackoverflow.com/a/8809472/1138191
5607
5587
  function uuid4() {
5608
5588
  var d = now();
5609
- var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
5610
- var r = (d + Math.random() * 16) % 16 | 0;
5611
- d = Math.floor(d / 16);
5612
- return (c === 'x' ? r : (r & 0x7 | 0x8)).toString(16);
5613
- });
5589
+ var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
5590
+ /[xy]/g,
5591
+ function (c) {
5592
+ var r = (d + Math.random() * 16) % 16 | 0;
5593
+ d = Math.floor(d / 16);
5594
+ return (c === 'x' ? r : (r & 0x7) | 0x8).toString(16);
5595
+ },
5596
+ );
5614
5597
  return uuid;
5615
5598
  }
5616
5599
 
@@ -5619,7 +5602,7 @@ function requireUtility () {
5619
5602
  info: 1,
5620
5603
  warning: 2,
5621
5604
  error: 3,
5622
- critical: 4
5605
+ critical: 4,
5623
5606
  };
5624
5607
 
5625
5608
  function sanitizeUrl(url) {
@@ -5653,16 +5636,18 @@ function requireUtility () {
5653
5636
  'directory',
5654
5637
  'file',
5655
5638
  'query',
5656
- 'anchor'
5639
+ 'anchor',
5657
5640
  ],
5658
5641
  q: {
5659
5642
  name: 'queryKey',
5660
- parser: /(?:^|&)([^&=]*)=?([^&]*)/g
5643
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g,
5661
5644
  },
5662
5645
  parser: {
5663
- strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
5664
- loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
5665
- }
5646
+ strict:
5647
+ /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
5648
+ loose:
5649
+ /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
5650
+ },
5666
5651
  };
5667
5652
 
5668
5653
  function parseUri(str) {
@@ -5707,11 +5692,11 @@ function requireUtility () {
5707
5692
  var p;
5708
5693
  if (qs !== -1 && (h === -1 || h > qs)) {
5709
5694
  p = options.path;
5710
- options.path = p.substring(0,qs) + query + '&' + p.substring(qs+1);
5695
+ options.path = p.substring(0, qs) + query + '&' + p.substring(qs + 1);
5711
5696
  } else {
5712
5697
  if (h !== -1) {
5713
5698
  p = options.path;
5714
- options.path = p.substring(0,h) + query + p.substring(h);
5699
+ options.path = p.substring(0, h) + query + p.substring(h);
5715
5700
  } else {
5716
5701
  options.path = options.path + query;
5717
5702
  }
@@ -5757,7 +5742,7 @@ function requireUtility () {
5757
5742
  error = jsonError;
5758
5743
  }
5759
5744
  }
5760
- return {error: error, value: value};
5745
+ return { error: error, value: value };
5761
5746
  }
5762
5747
 
5763
5748
  function maxByteSize(string) {
@@ -5775,11 +5760,14 @@ function requireUtility () {
5775
5760
 
5776
5761
  for (var i = 0; i < length; i++) {
5777
5762
  var code = string.charCodeAt(i);
5778
- if (code < 128) { // up to 7 bits
5763
+ if (code < 128) {
5764
+ // up to 7 bits
5779
5765
  count = count + 1;
5780
- } else if (code < 2048) { // up to 11 bits
5766
+ } else if (code < 2048) {
5767
+ // up to 11 bits
5781
5768
  count = count + 2;
5782
- } else if (code < 65536) { // up to 16 bits
5769
+ } else if (code < 65536) {
5770
+ // up to 16 bits
5783
5771
  count = count + 3;
5784
5772
  }
5785
5773
  }
@@ -5794,7 +5782,7 @@ function requireUtility () {
5794
5782
  } catch (e) {
5795
5783
  error = e;
5796
5784
  }
5797
- return {error: error, value: value};
5785
+ return { error: error, value: value };
5798
5786
  }
5799
5787
 
5800
5788
  function makeUnhandledStackInfo(
@@ -5805,28 +5793,36 @@ function requireUtility () {
5805
5793
  error,
5806
5794
  mode,
5807
5795
  backupMessage,
5808
- errorParser
5796
+ errorParser,
5809
5797
  ) {
5810
5798
  var location = {
5811
5799
  url: url || '',
5812
5800
  line: lineno,
5813
- column: colno
5801
+ column: colno,
5814
5802
  };
5815
5803
  location.func = errorParser.guessFunctionName(location.url, location.line);
5816
5804
  location.context = errorParser.gatherContext(location.url, location.line);
5817
- var href = typeof document !== 'undefined' && document && document.location && document.location.href;
5818
- var useragent = typeof window !== 'undefined' && window && window.navigator && window.navigator.userAgent;
5805
+ var href =
5806
+ typeof document !== 'undefined' &&
5807
+ document &&
5808
+ document.location &&
5809
+ document.location.href;
5810
+ var useragent =
5811
+ typeof window !== 'undefined' &&
5812
+ window &&
5813
+ window.navigator &&
5814
+ window.navigator.userAgent;
5819
5815
  return {
5820
- 'mode': mode,
5821
- 'message': error ? String(error) : (message || backupMessage),
5822
- 'url': href,
5823
- 'stack': [location],
5824
- 'useragent': useragent
5816
+ mode: mode,
5817
+ message: error ? String(error) : message || backupMessage,
5818
+ url: href,
5819
+ stack: [location],
5820
+ useragent: useragent,
5825
5821
  };
5826
5822
  }
5827
5823
 
5828
5824
  function wrapCallback(logger, f) {
5829
- return function(err, resp) {
5825
+ return function (err, resp) {
5830
5826
  try {
5831
5827
  f(err, resp);
5832
5828
  } catch (e) {
@@ -5839,7 +5835,10 @@ function requireUtility () {
5839
5835
  var seen = [obj];
5840
5836
 
5841
5837
  function clone(obj, seen) {
5842
- var value, name, newSeen, result = {};
5838
+ var value,
5839
+ name,
5840
+ newSeen,
5841
+ result = {};
5843
5842
 
5844
5843
  try {
5845
5844
  for (name in obj) {
@@ -5882,7 +5881,7 @@ function requireUtility () {
5882
5881
  case 'undefined':
5883
5882
  break;
5884
5883
  case 'string':
5885
- message ? extraArgs.push(arg) : message = arg;
5884
+ message ? extraArgs.push(arg) : (message = arg);
5886
5885
  break;
5887
5886
  case 'function':
5888
5887
  callback = wrapCallback(logger, arg);
@@ -5893,12 +5892,15 @@ function requireUtility () {
5893
5892
  case 'error':
5894
5893
  case 'domexception':
5895
5894
  case 'exception': // Firefox Exception type
5896
- err ? extraArgs.push(arg) : err = arg;
5895
+ err ? extraArgs.push(arg) : (err = arg);
5897
5896
  break;
5898
5897
  case 'object':
5899
5898
  case 'array':
5900
- if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
5901
- err ? extraArgs.push(arg) : err = arg;
5899
+ if (
5900
+ arg instanceof Error ||
5901
+ (typeof DOMException !== 'undefined' && arg instanceof DOMException)
5902
+ ) {
5903
+ err ? extraArgs.push(arg) : (err = arg);
5902
5904
  break;
5903
5905
  }
5904
5906
  if (requestKeys && typ === 'object' && !request) {
@@ -5912,11 +5914,14 @@ function requireUtility () {
5912
5914
  break;
5913
5915
  }
5914
5916
  }
5915
- custom ? extraArgs.push(arg) : custom = arg;
5917
+ custom ? extraArgs.push(arg) : (custom = arg);
5916
5918
  break;
5917
5919
  default:
5918
- if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
5919
- err ? extraArgs.push(arg) : err = arg;
5920
+ if (
5921
+ arg instanceof Error ||
5922
+ (typeof DOMException !== 'undefined' && arg instanceof DOMException)
5923
+ ) {
5924
+ err ? extraArgs.push(arg) : (err = arg);
5920
5925
  break;
5921
5926
  }
5922
5927
  extraArgs.push(arg);
@@ -5939,7 +5944,7 @@ function requireUtility () {
5939
5944
  callback: callback,
5940
5945
  notifier: notifier,
5941
5946
  diagnostic: diagnostic,
5942
- uuid: uuid4()
5947
+ uuid: uuid4(),
5943
5948
  };
5944
5949
 
5945
5950
  setCustomItemKeys(item, custom);
@@ -5987,7 +5992,14 @@ function requireUtility () {
5987
5992
  }
5988
5993
  }
5989
5994
 
5990
- var TELEMETRY_TYPES = ['log', 'network', 'dom', 'navigation', 'error', 'manual'];
5995
+ var TELEMETRY_TYPES = [
5996
+ 'log',
5997
+ 'network',
5998
+ 'dom',
5999
+ 'navigation',
6000
+ 'error',
6001
+ 'manual',
6002
+ ];
5991
6003
  var TELEMETRY_LEVELS = ['critical', 'error', 'warning', 'info', 'debug'];
5992
6004
 
5993
6005
  function arrayIncludes(arr, val) {
@@ -6024,7 +6036,7 @@ function requireUtility () {
6024
6036
  var event = {
6025
6037
  type: type || 'manual',
6026
6038
  metadata: metadata || {},
6027
- level: level
6039
+ level: level,
6028
6040
  };
6029
6041
 
6030
6042
  return event;
@@ -6074,7 +6086,7 @@ function requireUtility () {
6074
6086
  temp[keys[i]] = temp[keys[i]] || {};
6075
6087
  temp = temp[keys[i]];
6076
6088
  }
6077
- temp[keys[len-1]] = value;
6089
+ temp[keys[len - 1]] = value;
6078
6090
  obj[keys[0]] = replacement;
6079
6091
  } catch (e) {
6080
6092
  return;
@@ -6165,12 +6177,12 @@ function requireUtility () {
6165
6177
  }
6166
6178
 
6167
6179
  function updateDeprecatedOptions(options, logger) {
6168
- if(options.hostWhiteList && !options.hostSafeList) {
6180
+ if (options.hostWhiteList && !options.hostSafeList) {
6169
6181
  options.hostSafeList = options.hostWhiteList;
6170
6182
  options.hostWhiteList = undefined;
6171
6183
  logger && logger.log('hostWhiteList is deprecated. Use hostSafeList.');
6172
6184
  }
6173
- if(options.hostBlackList && !options.hostBlockList) {
6185
+ if (options.hostBlackList && !options.hostBlockList) {
6174
6186
  options.hostBlockList = options.hostBlackList;
6175
6187
  options.hostBlackList = undefined;
6176
6188
  logger && logger.log('hostBlackList is deprecated. Use hostBlockList.');
@@ -6210,7 +6222,7 @@ function requireUtility () {
6210
6222
  stringify: stringify,
6211
6223
  maxByteSize: maxByteSize,
6212
6224
  typeName: typeName,
6213
- uuid4: uuid4
6225
+ uuid4: uuid4,
6214
6226
  };
6215
6227
  return utility;
6216
6228
  }
@@ -6240,7 +6252,7 @@ function requireRateLimiter () {
6240
6252
  RateLimiter.globalSettings = {
6241
6253
  startTime: _.now(),
6242
6254
  maxItems: undefined,
6243
- itemsPerMinute: undefined
6255
+ itemsPerMinute: undefined,
6244
6256
  };
6245
6257
 
6246
6258
  /*
@@ -6251,7 +6263,7 @@ function requireRateLimiter () {
6251
6263
  * maxItems: the maximum items
6252
6264
  * itemsPerMinute: the max number of items to send in a given minute
6253
6265
  */
6254
- RateLimiter.prototype.configureGlobal = function(options) {
6266
+ RateLimiter.prototype.configureGlobal = function (options) {
6255
6267
  if (options.startTime !== undefined) {
6256
6268
  RateLimiter.globalSettings.startTime = options.startTime;
6257
6269
  }
@@ -6278,7 +6290,7 @@ function requireRateLimiter () {
6278
6290
  * means this item put us over the global rate limit and the payload should be sent to Rollbar in
6279
6291
  * place of the passed in item.
6280
6292
  */
6281
- RateLimiter.prototype.shouldSend = function(item, now) {
6293
+ RateLimiter.prototype.shouldSend = function (item, now) {
6282
6294
  now = now || _.now();
6283
6295
  var elapsedTime = now - this.startTime;
6284
6296
  if (elapsedTime < 0 || elapsedTime >= 60000) {
@@ -6290,20 +6302,39 @@ function requireRateLimiter () {
6290
6302
  var globalRateLimitPerMin = RateLimiter.globalSettings.itemsPerMinute;
6291
6303
 
6292
6304
  if (checkRate(item, globalRateLimit, this.counter)) {
6293
- return shouldSendValue(this.platform, this.platformOptions, globalRateLimit + ' max items reached', false);
6305
+ return shouldSendValue(
6306
+ this.platform,
6307
+ this.platformOptions,
6308
+ globalRateLimit + ' max items reached',
6309
+ false,
6310
+ );
6294
6311
  } else if (checkRate(item, globalRateLimitPerMin, this.perMinCounter)) {
6295
- return shouldSendValue(this.platform, this.platformOptions, globalRateLimitPerMin + ' items per minute reached', false);
6312
+ return shouldSendValue(
6313
+ this.platform,
6314
+ this.platformOptions,
6315
+ globalRateLimitPerMin + ' items per minute reached',
6316
+ false,
6317
+ );
6296
6318
  }
6297
6319
  this.counter++;
6298
6320
  this.perMinCounter++;
6299
6321
 
6300
6322
  var shouldSend = !checkRate(item, globalRateLimit, this.counter);
6301
6323
  var perMinute = shouldSend;
6302
- shouldSend = shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
6303
- return shouldSendValue(this.platform, this.platformOptions, null, shouldSend, globalRateLimit, globalRateLimitPerMin, perMinute);
6324
+ shouldSend =
6325
+ shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
6326
+ return shouldSendValue(
6327
+ this.platform,
6328
+ this.platformOptions,
6329
+ null,
6330
+ shouldSend,
6331
+ globalRateLimit,
6332
+ globalRateLimitPerMin,
6333
+ perMinute,
6334
+ );
6304
6335
  };
6305
6336
 
6306
- RateLimiter.prototype.setPlatformOptions = function(platform, options) {
6337
+ RateLimiter.prototype.setPlatformOptions = function (platform, options) {
6307
6338
  this.platform = platform;
6308
6339
  this.platformOptions = options;
6309
6340
  };
@@ -6314,19 +6345,40 @@ function requireRateLimiter () {
6314
6345
  return !item.ignoreRateLimit && limit >= 1 && counter > limit;
6315
6346
  }
6316
6347
 
6317
- function shouldSendValue(platform, options, error, shouldSend, globalRateLimit, limitPerMin, perMinute) {
6348
+ function shouldSendValue(
6349
+ platform,
6350
+ options,
6351
+ error,
6352
+ shouldSend,
6353
+ globalRateLimit,
6354
+ limitPerMin,
6355
+ perMinute,
6356
+ ) {
6318
6357
  var payload = null;
6319
6358
  if (error) {
6320
6359
  error = new Error(error);
6321
6360
  }
6322
6361
  if (!error && !shouldSend) {
6323
- payload = rateLimitPayload(platform, options, globalRateLimit, limitPerMin, perMinute);
6362
+ payload = rateLimitPayload(
6363
+ platform,
6364
+ options,
6365
+ globalRateLimit,
6366
+ limitPerMin,
6367
+ perMinute,
6368
+ );
6324
6369
  }
6325
- return {error: error, shouldSend: shouldSend, payload: payload};
6370
+ return { error: error, shouldSend: shouldSend, payload: payload };
6326
6371
  }
6327
6372
 
6328
- function rateLimitPayload(platform, options, globalRateLimit, limitPerMin, perMinute) {
6329
- var environment = options.environment || (options.payload && options.payload.environment);
6373
+ function rateLimitPayload(
6374
+ platform,
6375
+ options,
6376
+ globalRateLimit,
6377
+ limitPerMin,
6378
+ perMinute,
6379
+ ) {
6380
+ var environment =
6381
+ options.environment || (options.payload && options.payload.environment);
6330
6382
  var msg;
6331
6383
  if (perMinute) {
6332
6384
  msg = 'item per minute limit reached, ignoring errors until timeout';
@@ -6339,15 +6391,16 @@ function requireRateLimiter () {
6339
6391
  body: msg,
6340
6392
  extra: {
6341
6393
  maxItems: globalRateLimit,
6342
- itemsPerMinute: limitPerMin
6343
- }
6344
- }
6394
+ itemsPerMinute: limitPerMin,
6395
+ },
6396
+ },
6345
6397
  },
6346
6398
  language: 'javascript',
6347
6399
  environment: environment,
6348
6400
  notifier: {
6349
- version: (options.notifier && options.notifier.version) || options.version
6350
- }
6401
+ version:
6402
+ (options.notifier && options.notifier.version) || options.version,
6403
+ },
6351
6404
  };
6352
6405
  if (platform === 'browser') {
6353
6406
  item.platform = 'browser';
@@ -6407,7 +6460,7 @@ function requireQueue () {
6407
6460
  *
6408
6461
  * @param options
6409
6462
  */
6410
- Queue.prototype.configure = function(options) {
6463
+ Queue.prototype.configure = function (options) {
6411
6464
  this.api && this.api.configure(options);
6412
6465
  var oldOptions = this.options;
6413
6466
  this.options = _.merge(oldOptions, options);
@@ -6423,18 +6476,18 @@ function requireQueue () {
6423
6476
  * Returning {err: Error} means do not add the item to the queue, and the given error explains why
6424
6477
  * Returning {err: undefined} is equivalent to returning true but don't do that
6425
6478
  */
6426
- Queue.prototype.addPredicate = function(predicate) {
6479
+ Queue.prototype.addPredicate = function (predicate) {
6427
6480
  if (_.isFunction(predicate)) {
6428
6481
  this.predicates.push(predicate);
6429
6482
  }
6430
6483
  return this;
6431
6484
  };
6432
6485
 
6433
- Queue.prototype.addPendingItem = function(item) {
6486
+ Queue.prototype.addPendingItem = function (item) {
6434
6487
  this.pendingItems.push(item);
6435
6488
  };
6436
6489
 
6437
- Queue.prototype.removePendingItem = function(item) {
6490
+ Queue.prototype.removePendingItem = function (item) {
6438
6491
  var idx = this.pendingItems.indexOf(item);
6439
6492
  if (idx !== -1) {
6440
6493
  this.pendingItems.splice(idx, 1);
@@ -6451,9 +6504,16 @@ function requireQueue () {
6451
6504
  * to be an error condition, but nonetheless did not send the item to the API.
6452
6505
  * @param originalError - The original error before any transformations that is to be logged if any
6453
6506
  */
6454
- Queue.prototype.addItem = function(item, callback, originalError, originalItem) {
6507
+ Queue.prototype.addItem = function (
6508
+ item,
6509
+ callback,
6510
+ originalError,
6511
+ originalItem,
6512
+ ) {
6455
6513
  if (!callback || !_.isFunction(callback)) {
6456
- callback = function() { return; };
6514
+ callback = function () {
6515
+ return;
6516
+ };
6457
6517
  }
6458
6518
  var predicateResult = this._applyPredicates(item);
6459
6519
  if (predicateResult.stop) {
@@ -6469,10 +6529,13 @@ function requireQueue () {
6469
6529
  }
6470
6530
  this.pendingRequests.push(item);
6471
6531
  try {
6472
- this._makeApiRequest(item, function(err, resp) {
6473
- this._dequeuePendingRequest(item);
6474
- callback(err, resp);
6475
- }.bind(this));
6532
+ this._makeApiRequest(
6533
+ item,
6534
+ function (err, resp) {
6535
+ this._dequeuePendingRequest(item);
6536
+ callback(err, resp);
6537
+ }.bind(this),
6538
+ );
6476
6539
  } catch (e) {
6477
6540
  this._dequeuePendingRequest(item);
6478
6541
  callback(e);
@@ -6485,7 +6548,7 @@ function requireQueue () {
6485
6548
  *
6486
6549
  * @param callback - function() called when all pending items have been sent
6487
6550
  */
6488
- Queue.prototype.wait = function(callback) {
6551
+ Queue.prototype.wait = function (callback) {
6489
6552
  if (!_.isFunction(callback)) {
6490
6553
  return;
6491
6554
  }
@@ -6496,9 +6559,12 @@ function requireQueue () {
6496
6559
  if (this.waitIntervalID) {
6497
6560
  this.waitIntervalID = clearInterval(this.waitIntervalID);
6498
6561
  }
6499
- this.waitIntervalID = setInterval(function() {
6500
- this._maybeCallWait();
6501
- }.bind(this), 500);
6562
+ this.waitIntervalID = setInterval(
6563
+ function () {
6564
+ this._maybeCallWait();
6565
+ }.bind(this),
6566
+ 500,
6567
+ );
6502
6568
  };
6503
6569
 
6504
6570
  /* _applyPredicates - Sequentially applies the predicates that have been added to the queue to the
@@ -6508,15 +6574,15 @@ function requireQueue () {
6508
6574
  * @returns {stop: bool, err: (Error|null)} - stop being true means do not add item to the queue,
6509
6575
  * the error value should be passed up to a callbak if we are stopping.
6510
6576
  */
6511
- Queue.prototype._applyPredicates = function(item) {
6577
+ Queue.prototype._applyPredicates = function (item) {
6512
6578
  var p = null;
6513
6579
  for (var i = 0, len = this.predicates.length; i < len; i++) {
6514
6580
  p = this.predicates[i](item, this.options);
6515
6581
  if (!p || p.err !== undefined) {
6516
- return {stop: true, err: p.err};
6582
+ return { stop: true, err: p.err };
6517
6583
  }
6518
6584
  }
6519
- return {stop: false, err: null};
6585
+ return { stop: false, err: null };
6520
6586
  };
6521
6587
 
6522
6588
  /*
@@ -6526,16 +6592,19 @@ function requireQueue () {
6526
6592
  * @param item - an item ready to send to the backend
6527
6593
  * @param callback - function(err, response)
6528
6594
  */
6529
- Queue.prototype._makeApiRequest = function(item, callback) {
6595
+ Queue.prototype._makeApiRequest = function (item, callback) {
6530
6596
  var rateLimitResponse = this.rateLimiter.shouldSend(item);
6531
6597
  if (rateLimitResponse.shouldSend) {
6532
- this.api.postItem(item, function(err, resp) {
6533
- if (err) {
6534
- this._maybeRetry(err, item, callback);
6535
- } else {
6536
- callback(err, resp);
6537
- }
6538
- }.bind(this));
6598
+ this.api.postItem(
6599
+ item,
6600
+ function (err, resp) {
6601
+ if (err) {
6602
+ this._maybeRetry(err, item, callback);
6603
+ } else {
6604
+ callback(err, resp);
6605
+ }
6606
+ }.bind(this),
6607
+ );
6539
6608
  } else if (rateLimitResponse.error) {
6540
6609
  callback(rateLimitResponse.error);
6541
6610
  } else {
@@ -6544,7 +6613,16 @@ function requireQueue () {
6544
6613
  };
6545
6614
 
6546
6615
  // These are errors basically mean there is no internet connection
6547
- var RETRIABLE_ERRORS = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN'];
6616
+ var RETRIABLE_ERRORS = [
6617
+ 'ECONNRESET',
6618
+ 'ENOTFOUND',
6619
+ 'ESOCKETTIMEDOUT',
6620
+ 'ETIMEDOUT',
6621
+ 'ECONNREFUSED',
6622
+ 'EHOSTUNREACH',
6623
+ 'EPIPE',
6624
+ 'EAI_AGAIN',
6625
+ ];
6548
6626
 
6549
6627
  /*
6550
6628
  * _maybeRetry - Given the error returned by the API, decide if we should retry or just callback
@@ -6554,7 +6632,7 @@ function requireQueue () {
6554
6632
  * @param item - the item that was trying to be sent when this error occured
6555
6633
  * @param callback - function(err, response)
6556
6634
  */
6557
- Queue.prototype._maybeRetry = function(err, item, callback) {
6635
+ Queue.prototype._maybeRetry = function (err, item, callback) {
6558
6636
  var shouldRetry = false;
6559
6637
  if (this.options.retryInterval) {
6560
6638
  for (var i = 0, len = RETRIABLE_ERRORS.length; i < len; i++) {
@@ -6584,16 +6662,19 @@ function requireQueue () {
6584
6662
  * @param item - an item that failed to send due to an error we deem retriable
6585
6663
  * @param callback - function(err, response)
6586
6664
  */
6587
- Queue.prototype._retryApiRequest = function(item, callback) {
6588
- this.retryQueue.push({item: item, callback: callback});
6665
+ Queue.prototype._retryApiRequest = function (item, callback) {
6666
+ this.retryQueue.push({ item: item, callback: callback });
6589
6667
 
6590
6668
  if (!this.retryHandle) {
6591
- this.retryHandle = setInterval(function() {
6592
- while (this.retryQueue.length) {
6593
- var retryObject = this.retryQueue.shift();
6594
- this._makeApiRequest(retryObject.item, retryObject.callback);
6595
- }
6596
- }.bind(this), this.options.retryInterval);
6669
+ this.retryHandle = setInterval(
6670
+ function () {
6671
+ while (this.retryQueue.length) {
6672
+ var retryObject = this.retryQueue.shift();
6673
+ this._makeApiRequest(retryObject.item, retryObject.callback);
6674
+ }
6675
+ }.bind(this),
6676
+ this.options.retryInterval,
6677
+ );
6597
6678
  }
6598
6679
  };
6599
6680
 
@@ -6605,7 +6686,7 @@ function requireQueue () {
6605
6686
  *
6606
6687
  * @param item - the item previously added to the pending request queue
6607
6688
  */
6608
- Queue.prototype._dequeuePendingRequest = function(item) {
6689
+ Queue.prototype._dequeuePendingRequest = function (item) {
6609
6690
  var idx = this.pendingRequests.indexOf(item);
6610
6691
  if (idx !== -1) {
6611
6692
  this.pendingRequests.splice(idx, 1);
@@ -6613,7 +6694,7 @@ function requireQueue () {
6613
6694
  }
6614
6695
  };
6615
6696
 
6616
- Queue.prototype._maybeLog = function(data, originalError) {
6697
+ Queue.prototype._maybeLog = function (data, originalError) {
6617
6698
  if (this.logger && this.options.verbose) {
6618
6699
  var message = originalError;
6619
6700
  message = message || _.get(data, 'body.trace.exception.message');
@@ -6629,8 +6710,12 @@ function requireQueue () {
6629
6710
  }
6630
6711
  };
6631
6712
 
6632
- Queue.prototype._maybeCallWait = function() {
6633
- if (_.isFunction(this.waitCallback) && this.pendingItems.length === 0 && this.pendingRequests.length === 0) {
6713
+ Queue.prototype._maybeCallWait = function () {
6714
+ if (
6715
+ _.isFunction(this.waitCallback) &&
6716
+ this.pendingItems.length === 0 &&
6717
+ this.pendingRequests.length === 0
6718
+ ) {
6634
6719
  if (this.waitIntervalID) {
6635
6720
  this.waitIntervalID = clearInterval(this.waitIntervalID);
6636
6721
  }
@@ -6674,7 +6759,7 @@ function requireNotifier () {
6674
6759
  * @param options - an object which gets merged with the current options set on this notifier
6675
6760
  * @returns this
6676
6761
  */
6677
- Notifier.prototype.configure = function(options) {
6762
+ Notifier.prototype.configure = function (options) {
6678
6763
  this.queue && this.queue.configure(options);
6679
6764
  var oldOptions = this.options;
6680
6765
  this.options = _.merge(oldOptions, options);
@@ -6692,7 +6777,7 @@ function requireNotifier () {
6692
6777
  * with an error to terminate the processing. The item should be the updated item after this
6693
6778
  * transform is finished modifying it.
6694
6779
  */
6695
- Notifier.prototype.addTransform = function(transform) {
6780
+ Notifier.prototype.addTransform = function (transform) {
6696
6781
  if (_.isFunction(transform)) {
6697
6782
  this.transforms.push(transform);
6698
6783
  }
@@ -6712,9 +6797,9 @@ function requireNotifier () {
6712
6797
  * transform stage if an error occurs inside a transform, or in response to the communication with
6713
6798
  * the backend. The second argument will be the response from the backend in case of success.
6714
6799
  */
6715
- Notifier.prototype.log = function(item, callback) {
6800
+ Notifier.prototype.log = function (item, callback) {
6716
6801
  if (!callback || !_.isFunction(callback)) {
6717
- callback = function() {};
6802
+ callback = function () {};
6718
6803
  }
6719
6804
 
6720
6805
  if (!this.options.enabled) {
@@ -6723,13 +6808,16 @@ function requireNotifier () {
6723
6808
 
6724
6809
  this.queue.addPendingItem(item);
6725
6810
  var originalError = item.err;
6726
- this._applyTransforms(item, function(err, i) {
6727
- if (err) {
6728
- this.queue.removePendingItem(item);
6729
- return callback(err, null);
6730
- }
6731
- this.queue.addItem(i, callback, originalError, item);
6732
- }.bind(this));
6811
+ this._applyTransforms(
6812
+ item,
6813
+ function (err, i) {
6814
+ if (err) {
6815
+ this.queue.removePendingItem(item);
6816
+ return callback(err, null);
6817
+ }
6818
+ this.queue.addItem(i, callback, originalError, item);
6819
+ }.bind(this),
6820
+ );
6733
6821
  };
6734
6822
 
6735
6823
  /* Internal */
@@ -6743,13 +6831,13 @@ function requireNotifier () {
6743
6831
  * error and a null item in the case of a transform failure, or a null error and non-null item after
6744
6832
  * all transforms have been applied.
6745
6833
  */
6746
- Notifier.prototype._applyTransforms = function(item, callback) {
6834
+ Notifier.prototype._applyTransforms = function (item, callback) {
6747
6835
  var transformIndex = -1;
6748
6836
  var transformsLength = this.transforms.length;
6749
6837
  var transforms = this.transforms;
6750
6838
  var options = this.options;
6751
6839
 
6752
- var cb = function(err, i) {
6840
+ var cb = function (err, i) {
6753
6841
  if (err) {
6754
6842
  callback(err, null);
6755
6843
  return;
@@ -6818,7 +6906,7 @@ function requireRollbar$1 () {
6818
6906
 
6819
6907
  var defaultOptions = {
6820
6908
  maxItems: 0,
6821
- itemsPerMinute: 60
6909
+ itemsPerMinute: 60,
6822
6910
  };
6823
6911
 
6824
6912
  Rollbar.rateLimiter = new RateLimiter(defaultOptions);
@@ -6933,7 +7021,8 @@ function requireRollbar$1 () {
6933
7021
  this._addTracingInfo(item);
6934
7022
  item.level = item.level || defaultLevel;
6935
7023
  this.telemeter && this.telemeter._captureRollbarItem(item);
6936
- item.telemetryEvents = (this.telemeter && this.telemeter.copyEvents()) || [];
7024
+ item.telemetryEvents =
7025
+ (this.telemeter && this.telemeter.copyEvents()) || [];
6937
7026
  this.notifier.log(item, callback);
6938
7027
  } catch (e) {
6939
7028
  if (callback) {
@@ -6971,8 +7060,14 @@ function requireRollbar$1 () {
6971
7060
  span.setTag('rollbar.error_uuid', item.uuid);
6972
7061
  span.setTag('rollbar.has_error', true);
6973
7062
  span.setTag('error', true);
6974
- span.setTag('rollbar.item_url', `https://rollbar.com/item/uuid/?uuid=${item.uuid}`);
6975
- span.setTag('rollbar.occurrence_url', `https://rollbar.com/occurrence/uuid/?uuid=${item.uuid}`);
7063
+ span.setTag(
7064
+ 'rollbar.item_url',
7065
+ `https://rollbar.com/item/uuid/?uuid=${item.uuid}`,
7066
+ );
7067
+ span.setTag(
7068
+ 'rollbar.occurrence_url',
7069
+ `https://rollbar.com/occurrence/uuid/?uuid=${item.uuid}`,
7070
+ );
6976
7071
 
6977
7072
  // add span ID & trace ID to occurrence
6978
7073
  var opentracingSpanId = span.context().toSpanId();
@@ -6984,7 +7079,7 @@ function requireRollbar$1 () {
6984
7079
  } else {
6985
7080
  item.custom = {
6986
7081
  opentracing_span_id: opentracingSpanId,
6987
- opentracing_trace_id: opentracingTraceId
7082
+ opentracing_trace_id: opentracingTraceId,
6988
7083
  };
6989
7084
  }
6990
7085
  }
@@ -7040,12 +7135,14 @@ function requireRollbar$1 () {
7040
7135
 
7041
7136
  var spanContext = span.context();
7042
7137
 
7043
- if (!spanContext
7044
- || !spanContext.toSpanId
7045
- || !spanContext.toTraceId
7046
- || typeof spanContext.toSpanId !== 'function'
7047
- || typeof spanContext.toTraceId !== 'function') {
7048
- return false
7138
+ if (
7139
+ !spanContext ||
7140
+ !spanContext.toSpanId ||
7141
+ !spanContext.toTraceId ||
7142
+ typeof spanContext.toSpanId !== 'function' ||
7143
+ typeof spanContext.toTraceId !== 'function'
7144
+ ) {
7145
+ return false;
7049
7146
  }
7050
7147
 
7051
7148
  return true;
@@ -7067,7 +7164,7 @@ function requireApiUtility () {
7067
7164
  if (!_.isType(data.context, 'string')) {
7068
7165
  var contextResult = _.stringify(data.context, jsonBackup);
7069
7166
  if (contextResult.error) {
7070
- data.context = 'Error: could not serialize \'context\'';
7167
+ data.context = "Error: could not serialize 'context'";
7071
7168
  } else {
7072
7169
  data.context = contextResult.value || '';
7073
7170
  }
@@ -7077,7 +7174,7 @@ function requireApiUtility () {
7077
7174
  }
7078
7175
  return {
7079
7176
  access_token: accessToken,
7080
- data: data
7177
+ data: data,
7081
7178
  };
7082
7179
  }
7083
7180
 
@@ -7107,12 +7204,14 @@ function requireApiUtility () {
7107
7204
  path: path,
7108
7205
  search: search,
7109
7206
  proxy: proxy,
7110
- transport: transport
7207
+ transport: transport,
7111
7208
  };
7112
7209
  }
7113
7210
 
7114
7211
  function detectTransport(options) {
7115
- var gWindow = ((typeof window != 'undefined') && window) || ((typeof self != 'undefined') && self);
7212
+ var gWindow =
7213
+ (typeof window != 'undefined' && window) ||
7214
+ (typeof self != 'undefined' && self);
7116
7215
  var transport = options.defaultTransport || 'xhr';
7117
7216
  if (typeof gWindow.fetch === 'undefined') transport = 'xhr';
7118
7217
  if (typeof gWindow.XMLHttpRequest === 'undefined') transport = 'fetch';
@@ -7121,7 +7220,9 @@ function requireApiUtility () {
7121
7220
 
7122
7221
  function transportOptions(transport, method) {
7123
7222
  var protocol = transport.protocol || 'https:';
7124
- var port = transport.port || (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined);
7223
+ var port =
7224
+ transport.port ||
7225
+ (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined);
7125
7226
  var hostname = transport.hostname;
7126
7227
  var path = transport.path;
7127
7228
  var timeout = transport.timeout;
@@ -7142,7 +7243,7 @@ function requireApiUtility () {
7142
7243
  path: path,
7143
7244
  port: port,
7144
7245
  method: method,
7145
- transport: transportAPI
7246
+ transport: transportAPI,
7146
7247
  };
7147
7248
  }
7148
7249
 
@@ -7163,7 +7264,7 @@ function requireApiUtility () {
7163
7264
  buildPayload: buildPayload,
7164
7265
  getTransportFromOptions: getTransportFromOptions,
7165
7266
  transportOptions: transportOptions,
7166
- appendPathToPath: appendPathToPath
7267
+ appendPathToPath: appendPathToPath,
7167
7268
  };
7168
7269
  return apiUtility;
7169
7270
  }
@@ -7183,7 +7284,7 @@ function requireApi () {
7183
7284
  search: null,
7184
7285
  version: '1',
7185
7286
  protocol: 'https:',
7186
- port: 443
7287
+ port: 443,
7187
7288
  };
7188
7289
 
7189
7290
  /**
@@ -7220,13 +7321,16 @@ function requireApi () {
7220
7321
  * @param data
7221
7322
  * @param callback
7222
7323
  */
7223
- Api.prototype.postItem = function(data, callback) {
7224
- var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
7324
+ Api.prototype.postItem = function (data, callback) {
7325
+ var transportOptions = helpers.transportOptions(
7326
+ this.transportOptions,
7327
+ 'POST',
7328
+ );
7225
7329
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
7226
7330
  var self = this;
7227
7331
 
7228
7332
  // ensure the network request is scheduled after the current tick.
7229
- setTimeout(function() {
7333
+ setTimeout(function () {
7230
7334
  self.transport.post(self.accessToken, transportOptions, payload, callback);
7231
7335
  }, 0);
7232
7336
  };
@@ -7236,7 +7340,7 @@ function requireApi () {
7236
7340
  * @param data
7237
7341
  * @param callback
7238
7342
  */
7239
- Api.prototype.buildJsonPayload = function(data, callback) {
7343
+ Api.prototype.buildJsonPayload = function (data, callback) {
7240
7344
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
7241
7345
 
7242
7346
  var stringifyResult;
@@ -7261,12 +7365,20 @@ function requireApi () {
7261
7365
  * @param jsonPayload
7262
7366
  * @param callback
7263
7367
  */
7264
- Api.prototype.postJsonPayload = function(jsonPayload, callback) {
7265
- var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
7266
- this.transport.postJsonPayload(this.accessToken, transportOptions, jsonPayload, callback);
7368
+ Api.prototype.postJsonPayload = function (jsonPayload, callback) {
7369
+ var transportOptions = helpers.transportOptions(
7370
+ this.transportOptions,
7371
+ 'POST',
7372
+ );
7373
+ this.transport.postJsonPayload(
7374
+ this.accessToken,
7375
+ transportOptions,
7376
+ jsonPayload,
7377
+ callback,
7378
+ );
7267
7379
  };
7268
7380
 
7269
- Api.prototype.configure = function(options) {
7381
+ Api.prototype.configure = function (options) {
7270
7382
  var oldOptions = this.oldOptions;
7271
7383
  this.options = _.merge(oldOptions, options);
7272
7384
  this.transportOptions = _getTransport(this.options, this.url);
@@ -7295,20 +7407,20 @@ function requireLogger () {
7295
7407
 
7296
7408
  var logger = {
7297
7409
  /* eslint-disable no-console */
7298
- log: function() {
7410
+ log: function () {
7299
7411
  if (verbose) {
7300
7412
  console.log.apply(console, arguments);
7301
7413
  }
7302
7414
  },
7303
- error: function() {
7415
+ error: function () {
7304
7416
  if (verbose) {
7305
7417
  console.error.apply(console, arguments);
7306
7418
  }
7307
7419
  },
7308
7420
  /* eslint-enable no-console */
7309
- setVerbose: function(val) {
7421
+ setVerbose: function (val) {
7310
7422
  verbose = val;
7311
- }
7423
+ },
7312
7424
  };
7313
7425
 
7314
7426
  logger_1 = logger;
@@ -7331,7 +7443,7 @@ function requireTraverse () {
7331
7443
  var seenIndex;
7332
7444
 
7333
7445
  // Best might be to use Map here with `obj` as the keys, but we want to support IE < 11.
7334
- seen = seen || { obj: [], mapped: []};
7446
+ seen = seen || { obj: [], mapped: [] };
7335
7447
 
7336
7448
  if (isObj) {
7337
7449
  seenIndex = seen.obj.indexOf(obj);
@@ -7399,7 +7511,7 @@ function requireTruncation () {
7399
7511
  }
7400
7512
 
7401
7513
  function truncateFrames(payload, jsonBackup, range) {
7402
- range = (typeof range === 'undefined') ? 30 : range;
7514
+ range = typeof range === 'undefined' ? 30 : range;
7403
7515
  var body = payload.data.body;
7404
7516
  var frames;
7405
7517
  if (body.trace_chain) {
@@ -7446,7 +7558,10 @@ function requireTruncation () {
7446
7558
  function truncateTraceData(traceData) {
7447
7559
  if (traceData.exception) {
7448
7560
  delete traceData.exception.description;
7449
- traceData.exception.message = maybeTruncateValue(255, traceData.exception.message);
7561
+ traceData.exception.message = maybeTruncateValue(
7562
+ 255,
7563
+ traceData.exception.message,
7564
+ );
7450
7565
  }
7451
7566
  traceData.frames = selectFrames(traceData.frames, 1);
7452
7567
  return traceData;
@@ -7470,14 +7585,14 @@ function requireTruncation () {
7470
7585
  }
7471
7586
 
7472
7587
  function truncate(payload, jsonBackup, maxSize) {
7473
- maxSize = (typeof maxSize === 'undefined') ? (512 * 1024) : maxSize;
7588
+ maxSize = typeof maxSize === 'undefined' ? 512 * 1024 : maxSize;
7474
7589
  var strategies = [
7475
7590
  raw,
7476
7591
  truncateFrames,
7477
7592
  truncateStrings.bind(null, 1024),
7478
7593
  truncateStrings.bind(null, 512),
7479
7594
  truncateStrings.bind(null, 256),
7480
- minBody
7595
+ minBody,
7481
7596
  ];
7482
7597
  var strategy, results, result;
7483
7598
 
@@ -7499,7 +7614,7 @@ function requireTruncation () {
7499
7614
  raw: raw,
7500
7615
  truncateFrames: truncateFrames,
7501
7616
  truncateStrings: truncateStrings,
7502
- maybeTruncateValue: maybeTruncateValue
7617
+ maybeTruncateValue: maybeTruncateValue,
7503
7618
  };
7504
7619
  return truncation;
7505
7620
  }
@@ -7579,10 +7694,16 @@ function requireTransport () {
7579
7694
  this.rateLimitExpires = 0;
7580
7695
  }
7581
7696
 
7582
- Transport.prototype.get = function(accessToken, options, params, callback, transportFactory) {
7697
+ Transport.prototype.get = function (
7698
+ accessToken,
7699
+ options,
7700
+ params,
7701
+ callback,
7702
+ transportFactory,
7703
+ ) {
7583
7704
  var t;
7584
7705
  if (!callback || !_.isFunction(callback)) {
7585
- callback = function() {};
7706
+ callback = function () {};
7586
7707
  }
7587
7708
  options = options || {};
7588
7709
  _.addParamsAndAccessTokenToPath(accessToken, options, params);
@@ -7593,22 +7714,33 @@ function requireTransport () {
7593
7714
  t = _transport(options);
7594
7715
  }
7595
7716
  if (!t) {
7596
- logger.error('Unknown transport based on given protocol: ' + options.protocol);
7717
+ logger.error(
7718
+ 'Unknown transport based on given protocol: ' + options.protocol,
7719
+ );
7597
7720
  return callback(new Error('Unknown transport'));
7598
7721
  }
7599
- var req = t.request(options, function(resp) {
7600
- this.handleResponse(resp, callback);
7601
- }.bind(this));
7602
- req.on('error', function(err) {
7722
+ var req = t.request(
7723
+ options,
7724
+ function (resp) {
7725
+ this.handleResponse(resp, callback);
7726
+ }.bind(this),
7727
+ );
7728
+ req.on('error', function (err) {
7603
7729
  callback(err);
7604
7730
  });
7605
7731
  req.end();
7606
7732
  };
7607
7733
 
7608
- Transport.prototype.post = function(accessToken, options, payload, callback, transportFactory) {
7734
+ Transport.prototype.post = function (
7735
+ accessToken,
7736
+ options,
7737
+ payload,
7738
+ callback,
7739
+ transportFactory,
7740
+ ) {
7609
7741
  var t;
7610
7742
  if (!callback || !_.isFunction(callback)) {
7611
- callback = function() {};
7743
+ callback = function () {};
7612
7744
  }
7613
7745
  if (_currentTime() < this.rateLimitExpires) {
7614
7746
  return callback(new Error('Exceeded rate limit'));
@@ -7630,13 +7762,18 @@ function requireTransport () {
7630
7762
  t = _transport(options);
7631
7763
  }
7632
7764
  if (!t) {
7633
- logger.error('Unknown transport based on given protocol: ' + options.protocol);
7765
+ logger.error(
7766
+ 'Unknown transport based on given protocol: ' + options.protocol,
7767
+ );
7634
7768
  return callback(new Error('Unknown transport'));
7635
7769
  }
7636
- var req = t.request(options, function(resp) {
7637
- this.handleResponse(resp, _wrapPostCallback(callback));
7638
- }.bind(this));
7639
- req.on('error', function(err) {
7770
+ var req = t.request(
7771
+ options,
7772
+ function (resp) {
7773
+ this.handleResponse(resp, _wrapPostCallback(callback));
7774
+ }.bind(this),
7775
+ );
7776
+ req.on('error', function (err) {
7640
7777
  callback(err);
7641
7778
  });
7642
7779
  if (writeData) {
@@ -7645,28 +7782,31 @@ function requireTransport () {
7645
7782
  req.end();
7646
7783
  };
7647
7784
 
7648
- Transport.prototype.updateRateLimit = function(resp) {
7785
+ Transport.prototype.updateRateLimit = function (resp) {
7649
7786
  var remaining = parseInt(resp.headers['x-rate-limit-remaining'] || 0);
7650
- var remainingSeconds = Math.min(MAX_RATE_LIMIT_INTERVAL, resp.headers['x-rate-limit-remaining-seconds'] || 0);
7787
+ var remainingSeconds = Math.min(
7788
+ MAX_RATE_LIMIT_INTERVAL,
7789
+ resp.headers['x-rate-limit-remaining-seconds'] || 0,
7790
+ );
7651
7791
  var currentTime = _currentTime();
7652
7792
 
7653
- if ((resp.statusCode === 429) && (remaining === 0)) {
7793
+ if (resp.statusCode === 429 && remaining === 0) {
7654
7794
  this.rateLimitExpires = currentTime + remainingSeconds;
7655
7795
  } else {
7656
7796
  this.rateLimitExpires = currentTime;
7657
7797
  }
7658
7798
  };
7659
7799
 
7660
- Transport.prototype.handleResponse = function(resp, callback) {
7800
+ Transport.prototype.handleResponse = function (resp, callback) {
7661
7801
  this.updateRateLimit(resp);
7662
7802
 
7663
7803
  var respData = [];
7664
7804
  resp.setEncoding('utf8');
7665
- resp.on('data', function(chunk) {
7805
+ resp.on('data', function (chunk) {
7666
7806
  respData.push(chunk);
7667
7807
  });
7668
7808
 
7669
- resp.on('end', function() {
7809
+ resp.on('end', function () {
7670
7810
  respData = respData.join('');
7671
7811
  _parseApiResponse(respData, callback);
7672
7812
  });
@@ -7689,7 +7829,7 @@ function requireTransport () {
7689
7829
  }
7690
7830
 
7691
7831
  function _transport(options) {
7692
- return {'http:': http, 'https:': https}[options.protocol];
7832
+ return { 'http:': http, 'https:': https }[options.protocol];
7693
7833
  }
7694
7834
 
7695
7835
  function _parseApiResponse(data, callback) {
@@ -7702,27 +7842,32 @@ function requireTransport () {
7702
7842
 
7703
7843
  if (data.err) {
7704
7844
  logger.error('Received error: ' + data.message);
7705
- return callback(new Error('Api error: ' + (data.message || 'Unknown error')));
7845
+ return callback(
7846
+ new Error('Api error: ' + (data.message || 'Unknown error')),
7847
+ );
7706
7848
  }
7707
7849
 
7708
7850
  callback(null, data);
7709
7851
  }
7710
7852
 
7711
7853
  function _wrapPostCallback(callback) {
7712
- return function(err, data) {
7854
+ return function (err, data) {
7713
7855
  if (err) {
7714
7856
  return callback(err);
7715
7857
  }
7716
7858
  if (data.result && data.result.uuid) {
7717
- logger.log([
7859
+ logger.log(
7860
+ [
7718
7861
  'Successful api response.',
7719
- ' Link: https://rollbar.com/occurrence/uuid/?uuid=' + data.result.uuid
7720
- ].join(''));
7862
+ ' Link: https://rollbar.com/occurrence/uuid/?uuid=' +
7863
+ data.result.uuid,
7864
+ ].join(''),
7865
+ );
7721
7866
  } else {
7722
7867
  logger.log('Successful api response');
7723
7868
  }
7724
7869
  callback(null, data.result);
7725
- }
7870
+ };
7726
7871
  }
7727
7872
 
7728
7873
  function _currentTime() {
@@ -7750,7 +7895,7 @@ function requireTelemetry$1 () {
7750
7895
  this.maxQueueSize = Math.max(0, Math.min(maxTelemetryEvents, MAX_EVENTS));
7751
7896
  }
7752
7897
 
7753
- Telemeter.prototype.configure = function(options) {
7898
+ Telemeter.prototype.configure = function (options) {
7754
7899
  var oldOptions = this.options;
7755
7900
  this.options = _.merge(oldOptions, options);
7756
7901
  var maxTelemetryEvents = this.options.maxTelemetryEvents || MAX_EVENTS;
@@ -7763,7 +7908,7 @@ function requireTelemetry$1 () {
7763
7908
  this.queue.splice(0, deleteCount);
7764
7909
  };
7765
7910
 
7766
- Telemeter.prototype.copyEvents = function() {
7911
+ Telemeter.prototype.copyEvents = function () {
7767
7912
  var events = Array.prototype.slice.call(this.queue, 0);
7768
7913
  if (_.isFunction(this.options.filterTelemetry)) {
7769
7914
  try {
@@ -7780,20 +7925,29 @@ function requireTelemetry$1 () {
7780
7925
  return events;
7781
7926
  };
7782
7927
 
7783
- Telemeter.prototype.capture = function(type, metadata, level, rollbarUUID, timestamp) {
7928
+ Telemeter.prototype.capture = function (
7929
+ type,
7930
+ metadata,
7931
+ level,
7932
+ rollbarUUID,
7933
+ timestamp,
7934
+ ) {
7784
7935
  var e = {
7785
7936
  level: getLevel(type, level),
7786
7937
  type: type,
7787
7938
  timestamp_ms: timestamp || _.now(),
7788
7939
  body: metadata,
7789
- source: 'client'
7940
+ source: 'client',
7790
7941
  };
7791
7942
  if (rollbarUUID) {
7792
7943
  e.uuid = rollbarUUID;
7793
7944
  }
7794
7945
 
7795
7946
  try {
7796
- if (_.isFunction(this.options.filterTelemetry) && this.options.filterTelemetry(e)) {
7947
+ if (
7948
+ _.isFunction(this.options.filterTelemetry) &&
7949
+ this.options.filterTelemetry(e)
7950
+ ) {
7797
7951
  return false;
7798
7952
  }
7799
7953
  } catch (exc) {
@@ -7804,13 +7958,23 @@ function requireTelemetry$1 () {
7804
7958
  return e;
7805
7959
  };
7806
7960
 
7807
- Telemeter.prototype.captureEvent = function(type, metadata, level, rollbarUUID) {
7961
+ Telemeter.prototype.captureEvent = function (
7962
+ type,
7963
+ metadata,
7964
+ level,
7965
+ rollbarUUID,
7966
+ ) {
7808
7967
  return this.capture(type, metadata, level, rollbarUUID);
7809
7968
  };
7810
7969
 
7811
- Telemeter.prototype.captureError = function(err, level, rollbarUUID, timestamp) {
7970
+ Telemeter.prototype.captureError = function (
7971
+ err,
7972
+ level,
7973
+ rollbarUUID,
7974
+ timestamp,
7975
+ ) {
7812
7976
  var metadata = {
7813
- message: err.message || String(err)
7977
+ message: err.message || String(err),
7814
7978
  };
7815
7979
  if (err.stack) {
7816
7980
  metadata.stack = err.stack;
@@ -7818,13 +7982,29 @@ function requireTelemetry$1 () {
7818
7982
  return this.capture('error', metadata, level, rollbarUUID, timestamp);
7819
7983
  };
7820
7984
 
7821
- Telemeter.prototype.captureLog = function(message, level, rollbarUUID, timestamp) {
7822
- return this.capture('log', {
7823
- message: message
7824
- }, level, rollbarUUID, timestamp);
7985
+ Telemeter.prototype.captureLog = function (
7986
+ message,
7987
+ level,
7988
+ rollbarUUID,
7989
+ timestamp,
7990
+ ) {
7991
+ return this.capture(
7992
+ 'log',
7993
+ {
7994
+ message: message,
7995
+ },
7996
+ level,
7997
+ rollbarUUID,
7998
+ timestamp,
7999
+ );
7825
8000
  };
7826
8001
 
7827
- Telemeter.prototype.captureNetwork = function(metadata, subtype, rollbarUUID, requestData) {
8002
+ Telemeter.prototype.captureNetwork = function (
8003
+ metadata,
8004
+ subtype,
8005
+ rollbarUUID,
8006
+ requestData,
8007
+ ) {
7828
8008
  subtype = subtype || 'xhr';
7829
8009
  metadata.subtype = metadata.subtype || subtype;
7830
8010
  if (requestData) {
@@ -7834,7 +8014,7 @@ function requireTelemetry$1 () {
7834
8014
  return this.capture('network', metadata, level, rollbarUUID);
7835
8015
  };
7836
8016
 
7837
- Telemeter.prototype.levelFromStatus = function(statusCode) {
8017
+ Telemeter.prototype.levelFromStatus = function (statusCode) {
7838
8018
  if (statusCode >= 200 && statusCode < 400) {
7839
8019
  return 'info';
7840
8020
  }
@@ -7844,10 +8024,16 @@ function requireTelemetry$1 () {
7844
8024
  return 'info';
7845
8025
  };
7846
8026
 
7847
- Telemeter.prototype.captureDom = function(subtype, element, value, checked, rollbarUUID) {
8027
+ Telemeter.prototype.captureDom = function (
8028
+ subtype,
8029
+ element,
8030
+ value,
8031
+ checked,
8032
+ rollbarUUID,
8033
+ ) {
7848
8034
  var metadata = {
7849
8035
  subtype: subtype,
7850
- element: element
8036
+ element: element,
7851
8037
  };
7852
8038
  if (value !== undefined) {
7853
8039
  metadata.value = value;
@@ -7858,31 +8044,48 @@ function requireTelemetry$1 () {
7858
8044
  return this.capture('dom', metadata, 'info', rollbarUUID);
7859
8045
  };
7860
8046
 
7861
- Telemeter.prototype.captureNavigation = function(from, to, rollbarUUID) {
7862
- return this.capture('navigation', {from: from, to: to}, 'info', rollbarUUID);
8047
+ Telemeter.prototype.captureNavigation = function (from, to, rollbarUUID) {
8048
+ return this.capture(
8049
+ 'navigation',
8050
+ { from: from, to: to },
8051
+ 'info',
8052
+ rollbarUUID,
8053
+ );
7863
8054
  };
7864
8055
 
7865
- Telemeter.prototype.captureDomContentLoaded = function(ts) {
7866
- return this.capture('navigation', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime());
8056
+ Telemeter.prototype.captureDomContentLoaded = function (ts) {
8057
+ return this.capture(
8058
+ 'navigation',
8059
+ { subtype: 'DOMContentLoaded' },
8060
+ 'info',
8061
+ undefined,
8062
+ ts && ts.getTime(),
8063
+ );
7867
8064
  /**
7868
8065
  * If we decide to make this a dom event instead, then use the line below:
7869
8066
  return this.capture('dom', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime());
7870
8067
  */
7871
8068
  };
7872
- Telemeter.prototype.captureLoad = function(ts) {
7873
- return this.capture('navigation', {subtype: 'load'}, 'info', undefined, ts && ts.getTime());
8069
+ Telemeter.prototype.captureLoad = function (ts) {
8070
+ return this.capture(
8071
+ 'navigation',
8072
+ { subtype: 'load' },
8073
+ 'info',
8074
+ undefined,
8075
+ ts && ts.getTime(),
8076
+ );
7874
8077
  /**
7875
8078
  * If we decide to make this a dom event instead, then use the line below:
7876
8079
  return this.capture('dom', {subtype: 'load'}, 'info', undefined, ts && ts.getTime());
7877
8080
  */
7878
8081
  };
7879
8082
 
7880
- Telemeter.prototype.captureConnectivityChange = function(type, rollbarUUID) {
7881
- return this.captureNetwork({change: type}, 'connectivity', rollbarUUID);
8083
+ Telemeter.prototype.captureConnectivityChange = function (type, rollbarUUID) {
8084
+ return this.captureNetwork({ change: type }, 'connectivity', rollbarUUID);
7882
8085
  };
7883
8086
 
7884
8087
  // Only intended to be used internally by the notifier
7885
- Telemeter.prototype._captureRollbarItem = function(item) {
8088
+ Telemeter.prototype._captureRollbarItem = function (item) {
7886
8089
  if (!this.options.includeItemsInTelemetry) {
7887
8090
  return;
7888
8091
  }
@@ -7893,11 +8096,17 @@ function requireTelemetry$1 () {
7893
8096
  return this.captureLog(item.message, item.level, item.uuid, item.timestamp);
7894
8097
  }
7895
8098
  if (item.custom) {
7896
- return this.capture('log', item.custom, item.level, item.uuid, item.timestamp);
8099
+ return this.capture(
8100
+ 'log',
8101
+ item.custom,
8102
+ item.level,
8103
+ item.uuid,
8104
+ item.timestamp,
8105
+ );
7897
8106
  }
7898
8107
  };
7899
8108
 
7900
- Telemeter.prototype.push = function(e) {
8109
+ Telemeter.prototype.push = function (e) {
7901
8110
  this.queue.push(e);
7902
8111
  if (this.queue.length > this.maxQueueSize) {
7903
8112
  this.queue.shift();
@@ -7910,7 +8119,7 @@ function requireTelemetry$1 () {
7910
8119
  }
7911
8120
  var defaultLevel = {
7912
8121
  error: 'error',
7913
- manual: 'info'
8122
+ manual: 'info',
7914
8123
  };
7915
8124
  return defaultLevel[type] || 'info';
7916
8125
  }
@@ -7919,13 +8128,30 @@ function requireTelemetry$1 () {
7919
8128
  return telemetry$1;
7920
8129
  }
7921
8130
 
8131
+ var replace_1;
8132
+ var hasRequiredReplace;
8133
+
8134
+ function requireReplace () {
8135
+ if (hasRequiredReplace) return replace_1;
8136
+ hasRequiredReplace = 1;
8137
+ function replace(obj, name, replacement, replacements, type) {
8138
+ var orig = obj[name];
8139
+ obj[name] = replacement(orig);
8140
+ if (replacements) {
8141
+ replacements[type].push([obj, name, orig]);
8142
+ }
8143
+ }
8144
+
8145
+ replace_1 = replace;
8146
+ return replace_1;
8147
+ }
8148
+
7922
8149
  var urlHelpers;
7923
8150
  var hasRequiredUrlHelpers;
7924
8151
 
7925
8152
  function requireUrlHelpers () {
7926
8153
  if (hasRequiredUrlHelpers) return urlHelpers;
7927
8154
  hasRequiredUrlHelpers = 1;
7928
- var url = require$$0$1;
7929
8155
  var { URL } = require$$0$1;
7930
8156
  var merge = requireMerge();
7931
8157
 
@@ -7939,8 +8165,7 @@ function requireUrlHelpers () {
7939
8165
  if (typeof input === 'string') {
7940
8166
  const urlStr = input;
7941
8167
  input = urlToHttpOptions(new URL(urlStr));
7942
- } else if (input && input[url.searchParamsSymbol] &&
7943
- input[url.searchParamsSymbol][url.searchParamsSymbol]) {
8168
+ } else if (input && input instanceof URL) {
7944
8169
  // url.URL instance
7945
8170
  input = urlToHttpOptions(input);
7946
8171
  } else {
@@ -7955,7 +8180,7 @@ function requireUrlHelpers () {
7955
8180
  } else {
7956
8181
  options = merge(input || {}, options);
7957
8182
  }
7958
- return {options: options, cb: cb};
8183
+ return { options: options, cb: cb };
7959
8184
  }
7960
8185
 
7961
8186
  // This function replicates the relevant logic in node/lib/url.js as closely
@@ -7967,15 +8192,15 @@ function requireUrlHelpers () {
7967
8192
  function urlToHttpOptions(url) {
7968
8193
  const options = {
7969
8194
  protocol: url.protocol,
7970
- hostname: typeof url.hostname === 'string' &&
7971
- url.hostname.startsWith('[') ?
7972
- url.hostname.slice(1, -1) :
7973
- url.hostname,
8195
+ hostname:
8196
+ typeof url.hostname === 'string' && url.hostname.startsWith('[')
8197
+ ? url.hostname.slice(1, -1)
8198
+ : url.hostname,
7974
8199
  hash: url.hash,
7975
8200
  search: url.search,
7976
8201
  pathname: url.pathname,
7977
8202
  path: `${url.pathname || ''}${url.search || ''}`,
7978
- href: url.href
8203
+ href: url.href,
7979
8204
  };
7980
8205
  if (url.port !== '') {
7981
8206
  options.port = Number(url.port);
@@ -8003,7 +8228,7 @@ function requireUrlHelpers () {
8003
8228
 
8004
8229
  urlHelpers = {
8005
8230
  mergeOptions,
8006
- constructUrl
8231
+ constructUrl,
8007
8232
  };
8008
8233
  return urlHelpers;
8009
8234
  }
@@ -8017,13 +8242,14 @@ function requireTelemetry () {
8017
8242
  var http = require$$3;
8018
8243
  var https = require$$4;
8019
8244
  var _ = requireUtility();
8245
+ var replace = requireReplace();
8020
8246
  var urlHelpers = requireUrlHelpers();
8021
8247
 
8022
8248
  var defaults = {
8023
8249
  network: true,
8024
8250
  networkResponseHeaders: false,
8025
8251
  networkRequestHeaders: false,
8026
- log: true
8252
+ log: true,
8027
8253
  };
8028
8254
 
8029
8255
  function Instrumenter(options, telemeter, rollbar) {
@@ -8042,11 +8268,11 @@ function requireTelemetry () {
8042
8268
  this.diagnostic = rollbar.client.notifier.diagnostic;
8043
8269
  this.replacements = {
8044
8270
  network: [],
8045
- log: []
8271
+ log: [],
8046
8272
  };
8047
8273
  }
8048
8274
 
8049
- Instrumenter.prototype.configure = function(options) {
8275
+ Instrumenter.prototype.configure = function (options) {
8050
8276
  this.options = _.merge(this.options, options);
8051
8277
  var autoInstrument = options.autoInstrument;
8052
8278
  var oldSettings = _.merge(this.autoInstrument);
@@ -8061,10 +8287,14 @@ function requireTelemetry () {
8061
8287
  this.instrument(oldSettings);
8062
8288
  };
8063
8289
 
8064
- Instrumenter.prototype.instrument = function(oldSettings) {
8290
+ Instrumenter.prototype.instrument = function (oldSettings) {
8065
8291
  if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) {
8066
8292
  this.instrumentNetwork();
8067
- } else if (!this.autoInstrument.network && oldSettings && oldSettings.network) {
8293
+ } else if (
8294
+ !this.autoInstrument.network &&
8295
+ oldSettings &&
8296
+ oldSettings.network
8297
+ ) {
8068
8298
  this.deinstrumentNetwork();
8069
8299
  }
8070
8300
 
@@ -8075,20 +8305,32 @@ function requireTelemetry () {
8075
8305
  }
8076
8306
  };
8077
8307
 
8078
- Instrumenter.prototype.deinstrumentNetwork = function() {
8308
+ Instrumenter.prototype.deinstrumentNetwork = function () {
8079
8309
  restore(this.replacements, 'network');
8080
8310
  };
8081
8311
 
8082
- Instrumenter.prototype.instrumentNetwork = function() {
8083
- replace(http, 'request', networkRequestWrapper.bind(this), this.replacements, 'network');
8084
- replace(https, 'request', networkRequestWrapper.bind(this), this.replacements, 'network');
8312
+ Instrumenter.prototype.instrumentNetwork = function () {
8313
+ replace(
8314
+ http,
8315
+ 'request',
8316
+ networkRequestWrapper.bind(this),
8317
+ this.replacements,
8318
+ 'network',
8319
+ );
8320
+ replace(
8321
+ https,
8322
+ 'request',
8323
+ networkRequestWrapper.bind(this),
8324
+ this.replacements,
8325
+ 'network',
8326
+ );
8085
8327
  };
8086
8328
 
8087
8329
  function networkRequestWrapper(orig) {
8088
8330
  var telemeter = this.telemeter;
8089
8331
  var self = this;
8090
8332
 
8091
- return function(url, options, cb) {
8333
+ return function (url, options, cb) {
8092
8334
  var mergedOptions = urlHelpers.mergeOptions(url, options, cb);
8093
8335
 
8094
8336
  var metadata = {
@@ -8096,7 +8338,7 @@ function requireTelemetry () {
8096
8338
  url: urlHelpers.constructUrl(mergedOptions.options),
8097
8339
  status_code: null,
8098
8340
  start_time_ms: _.now(),
8099
- end_time_ms: null
8341
+ end_time_ms: null,
8100
8342
  };
8101
8343
 
8102
8344
  if (self.autoInstrument.networkRequestHeaders) {
@@ -8106,20 +8348,24 @@ function requireTelemetry () {
8106
8348
 
8107
8349
  // Call the original method with the original arguments and wrapped callback.
8108
8350
  var wrappedArgs = Array.from(arguments);
8109
- var wrappedCallback = responseCallbackWrapper(self.autoInstrument, metadata, mergedOptions.cb);
8351
+ var wrappedCallback = responseCallbackWrapper(
8352
+ self.autoInstrument,
8353
+ metadata,
8354
+ mergedOptions.cb,
8355
+ );
8110
8356
  if (mergedOptions.cb) {
8111
8357
  wrappedArgs.pop();
8112
8358
  }
8113
8359
  wrappedArgs.push(wrappedCallback);
8114
8360
  var req = orig.apply(https, wrappedArgs);
8115
8361
 
8116
- req.on('error', err => {
8362
+ req.on('error', (err) => {
8117
8363
  metadata.status_code = 0;
8118
- metadata.error = [err.name, err.message].join(': ') ;
8364
+ metadata.error = [err.name, err.message].join(': ');
8119
8365
  });
8120
8366
 
8121
8367
  return req;
8122
- }
8368
+ };
8123
8369
  }
8124
8370
 
8125
8371
  function responseCallbackWrapper(options, metadata, callback) {
@@ -8134,51 +8380,53 @@ function requireTelemetry () {
8134
8380
  if (callback) {
8135
8381
  return callback.apply(undefined, arguments);
8136
8382
  }
8137
- }
8383
+ };
8138
8384
  }
8139
8385
 
8140
- Instrumenter.prototype.captureNetwork = function(metadata, subtype, rollbarUUID) {
8386
+ Instrumenter.prototype.captureNetwork = function (
8387
+ metadata,
8388
+ subtype,
8389
+ rollbarUUID,
8390
+ ) {
8141
8391
  return this.telemeter.captureNetwork(metadata, subtype, rollbarUUID);
8142
8392
  };
8143
8393
 
8144
- Instrumenter.prototype.deinstrumentConsole = function() {
8394
+ Instrumenter.prototype.deinstrumentConsole = function () {
8145
8395
  restore(this.replacements, 'log');
8146
8396
  };
8147
8397
 
8148
- Instrumenter.prototype.instrumentConsole = function() {
8398
+ Instrumenter.prototype.instrumentConsole = function () {
8149
8399
  var telemeter = this.telemeter;
8150
8400
 
8151
8401
  var stdout = process.stdout;
8152
- replace(stdout, 'write', function(orig) {
8153
- return function(string) {
8154
- telemeter.captureLog(string, 'info');
8155
- return orig.apply(stdout, arguments);
8156
- }
8157
- }, this.replacements, 'log');
8402
+ replace(
8403
+ stdout,
8404
+ 'write',
8405
+ function (orig) {
8406
+ return function (string) {
8407
+ telemeter.captureLog(string, 'info');
8408
+ return orig.apply(stdout, arguments);
8409
+ };
8410
+ },
8411
+ this.replacements,
8412
+ 'log',
8413
+ );
8158
8414
 
8159
8415
  var stderr = process.stderr;
8160
- replace(stderr, 'write', function(orig) {
8161
- return function(string) {
8162
- telemeter.captureLog(string, 'error');
8163
- return orig.apply(stderr, arguments);
8164
- }
8165
- }, this.replacements, 'log');
8416
+ replace(
8417
+ stderr,
8418
+ 'write',
8419
+ function (orig) {
8420
+ return function (string) {
8421
+ telemeter.captureLog(string, 'error');
8422
+ return orig.apply(stderr, arguments);
8423
+ };
8424
+ },
8425
+ this.replacements,
8426
+ 'log',
8427
+ );
8166
8428
  };
8167
8429
 
8168
- // TODO: These helpers are duplicated in src/browser/telemetry.js,
8169
- // and may be candidates for extraction into a shared module.
8170
- // It is recommended that before doing so, the author should allow
8171
- // for more telemetry types to be implemented for the Node target
8172
- // to ensure that the implementations of these helpers don't diverge.
8173
- // If they do diverge, there's little point in the shared module.
8174
- function replace(obj, name, replacement, replacements, type) {
8175
- var orig = obj[name];
8176
- obj[name] = replacement(orig);
8177
- if (replacements) {
8178
- replacements[type].push([obj, name, orig]);
8179
- }
8180
- }
8181
-
8182
8430
  function restore(replacements, type) {
8183
8431
  var b;
8184
8432
  while (replacements[type].length) {
@@ -8261,19 +8509,19 @@ function wrap(defer) {
8261
8509
  return (fn, ...args) => defer(() => fn(...args));
8262
8510
  }
8263
8511
 
8264
- var _defer;
8512
+ var _defer$1;
8265
8513
 
8266
8514
  if (hasQueueMicrotask) {
8267
- _defer = queueMicrotask;
8515
+ _defer$1 = queueMicrotask;
8268
8516
  } else if (hasSetImmediate) {
8269
- _defer = setImmediate;
8517
+ _defer$1 = setImmediate;
8270
8518
  } else if (hasNextTick) {
8271
- _defer = process.nextTick;
8519
+ _defer$1 = process.nextTick;
8272
8520
  } else {
8273
- _defer = fallback;
8521
+ _defer$1 = fallback;
8274
8522
  }
8275
8523
 
8276
- var setImmediate$1 = wrap(_defer);
8524
+ var setImmediate$1 = wrap(_defer$1);
8277
8525
 
8278
8526
  /**
8279
8527
  * Take a sync function and make it async, passing its return value to a
@@ -8360,7 +8608,7 @@ function handlePromise(promise, callback) {
8360
8608
  return promise.then(value => {
8361
8609
  invokeCallback(callback, null, value);
8362
8610
  }, err => {
8363
- invokeCallback(callback, err && err.message ? err : new Error(err));
8611
+ invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
8364
8612
  });
8365
8613
  }
8366
8614
 
@@ -8391,7 +8639,8 @@ function wrapAsync(asyncFn) {
8391
8639
 
8392
8640
  // conditionally promisify a function.
8393
8641
  // only return a promise if a callback is omitted
8394
- function awaitify (asyncFn, arity = asyncFn.length) {
8642
+ function awaitify (asyncFn, arity) {
8643
+ if (!arity) arity = asyncFn.length;
8395
8644
  if (!arity) throw new Error('arity is undefined')
8396
8645
  function awaitable (...args) {
8397
8646
  if (typeof args[arity - 1] === 'function') {
@@ -8410,7 +8659,7 @@ function awaitify (asyncFn, arity = asyncFn.length) {
8410
8659
  return awaitable
8411
8660
  }
8412
8661
 
8413
- function applyEach (eachfn) {
8662
+ function applyEach$1 (eachfn) {
8414
8663
  return function applyEach(fns, ...callArgs) {
8415
8664
  const go = awaitify(function (callback) {
8416
8665
  var that = this;
@@ -8577,7 +8826,7 @@ function asyncEachOfLimit(generator, limit, iteratee, callback) {
8577
8826
  replenish();
8578
8827
  }
8579
8828
 
8580
- var eachOfLimit = (limit) => {
8829
+ var eachOfLimit$2 = (limit) => {
8581
8830
  return (obj, iteratee, callback) => {
8582
8831
  callback = once(callback);
8583
8832
  if (limit <= 0) {
@@ -8660,11 +8909,11 @@ var eachOfLimit = (limit) => {
8660
8909
  * `iteratee` functions have finished, or an error occurs. Invoked with (err).
8661
8910
  * @returns {Promise} a promise, if a callback is omitted
8662
8911
  */
8663
- function eachOfLimit$1(coll, limit, iteratee, callback) {
8664
- return eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);
8912
+ function eachOfLimit(coll, limit, iteratee, callback) {
8913
+ return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
8665
8914
  }
8666
8915
 
8667
- var eachOfLimit$2 = awaitify(eachOfLimit$1, 4);
8916
+ var eachOfLimit$1 = awaitify(eachOfLimit, 4);
8668
8917
 
8669
8918
  // eachOf implementation optimized for array-likes
8670
8919
  function eachOfArrayLike(coll, iteratee, callback) {
@@ -8696,7 +8945,7 @@ function eachOfArrayLike(coll, iteratee, callback) {
8696
8945
 
8697
8946
  // a generic version of eachOf which can handle array, object, and iterator cases.
8698
8947
  function eachOfGeneric (coll, iteratee, callback) {
8699
- return eachOfLimit$2(coll, Infinity, iteratee, callback);
8948
+ return eachOfLimit$1(coll, Infinity, iteratee, callback);
8700
8949
  }
8701
8950
 
8702
8951
  /**
@@ -8976,7 +9225,7 @@ var map$1 = awaitify(map, 3);
8976
9225
  * callback
8977
9226
  * );
8978
9227
  */
8979
- var applyEach$1 = applyEach(map$1);
9228
+ var applyEach = applyEach$1(map$1);
8980
9229
 
8981
9230
  /**
8982
9231
  * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
@@ -8997,7 +9246,7 @@ var applyEach$1 = applyEach(map$1);
8997
9246
  * @returns {Promise} a promise, if a callback is omitted
8998
9247
  */
8999
9248
  function eachOfSeries(coll, iteratee, callback) {
9000
- return eachOfLimit$2(coll, 1, iteratee, callback)
9249
+ return eachOfLimit$1(coll, 1, iteratee, callback)
9001
9250
  }
9002
9251
  var eachOfSeries$1 = awaitify(eachOfSeries, 3);
9003
9252
 
@@ -9044,7 +9293,7 @@ var mapSeries$1 = awaitify(mapSeries, 3);
9044
9293
  * appling the `args` to the list of functions. It takes no args, other than
9045
9294
  * a callback.
9046
9295
  */
9047
- var applyEachSeries = applyEach(mapSeries$1);
9296
+ var applyEachSeries = applyEach$1(mapSeries$1);
9048
9297
 
9049
9298
  const PROMISE_SYMBOL = Symbol('promiseCallback');
9050
9299
 
@@ -9380,8 +9629,8 @@ function auto(tasks, concurrency, callback) {
9380
9629
  return callback[PROMISE_SYMBOL]
9381
9630
  }
9382
9631
 
9383
- var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
9384
- var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
9632
+ var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
9633
+ var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
9385
9634
  var FN_ARG_SPLIT = /,/;
9386
9635
  var FN_ARG = /(=.+)?(\s*)$/;
9387
9636
 
@@ -9642,7 +9891,7 @@ function setInitial(dll, node) {
9642
9891
  dll.head = dll.tail = node;
9643
9892
  }
9644
9893
 
9645
- function queue(worker, concurrency, payload) {
9894
+ function queue$1(worker, concurrency, payload) {
9646
9895
  if (concurrency == null) {
9647
9896
  concurrency = 1;
9648
9897
  }
@@ -9699,12 +9948,11 @@ function queue(worker, concurrency, payload) {
9699
9948
  res(args);
9700
9949
  }
9701
9950
 
9702
- var item = {
9951
+ var item = q._createTaskItem(
9703
9952
  data,
9704
- callback: rejectOnError ?
9705
- promiseCallback :
9953
+ rejectOnError ? promiseCallback :
9706
9954
  (callback || promiseCallback)
9707
- };
9955
+ );
9708
9956
 
9709
9957
  if (insertAtFront) {
9710
9958
  q._tasks.unshift(item);
@@ -9786,6 +10034,12 @@ function queue(worker, concurrency, payload) {
9786
10034
  var isProcessing = false;
9787
10035
  var q = {
9788
10036
  _tasks: new DLL(),
10037
+ _createTaskItem (data, callback) {
10038
+ return {
10039
+ data,
10040
+ callback
10041
+ };
10042
+ },
9789
10043
  *[Symbol.iterator] () {
9790
10044
  yield* q._tasks[Symbol.iterator]();
9791
10045
  },
@@ -9955,8 +10209,8 @@ function queue(worker, concurrency, payload) {
9955
10209
  * await cargo.push({name: 'baz'});
9956
10210
  * console.log('finished processing baz');
9957
10211
  */
9958
- function cargo(worker, payload) {
9959
- return queue(worker, 1, payload);
10212
+ function cargo$1(worker, payload) {
10213
+ return queue$1(worker, 1, payload);
9960
10214
  }
9961
10215
 
9962
10216
  /**
@@ -10013,8 +10267,8 @@ function cargo(worker, payload) {
10013
10267
  * console.log('finished processing boo');
10014
10268
  * });
10015
10269
  */
10016
- function cargo$1(worker, concurrency, payload) {
10017
- return queue(worker, concurrency, payload);
10270
+ function cargo(worker, concurrency, payload) {
10271
+ return queue$1(worker, concurrency, payload);
10018
10272
  }
10019
10273
 
10020
10274
  /**
@@ -10270,7 +10524,7 @@ function compose(...args) {
10270
10524
  * @returns {Promise} a promise, if no callback is passed
10271
10525
  */
10272
10526
  function mapLimit (coll, limit, iteratee, callback) {
10273
- return _asyncMap(eachOfLimit(limit), coll, iteratee, callback)
10527
+ return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback)
10274
10528
  }
10275
10529
  var mapLimit$1 = awaitify(mapLimit, 4);
10276
10530
 
@@ -10480,7 +10734,7 @@ var concatSeries$1 = awaitify(concatSeries, 3);
10480
10734
  * //...
10481
10735
  * }, callback);
10482
10736
  */
10483
- function constant(...args) {
10737
+ function constant$1(...args) {
10484
10738
  return function (...ignoredArgs/*, callback*/) {
10485
10739
  var callback = ignoredArgs.pop();
10486
10740
  return callback(null, ...args);
@@ -10535,7 +10789,7 @@ function _createTester(check, getResult) {
10535
10789
  * Result will be the first item in the array that passes the truth test
10536
10790
  * (iteratee) or the value `undefined` if none passed. Invoked with
10537
10791
  * (err, result).
10538
- * @returns A Promise, if no callback is passed
10792
+ * @returns {Promise} a promise, if a callback is omitted
10539
10793
  * @example
10540
10794
  *
10541
10795
  * // dir1 is a directory that contains file1.txt, file2.txt
@@ -10607,10 +10861,10 @@ var detect$1 = awaitify(detect, 3);
10607
10861
  * Result will be the first item in the array that passes the truth test
10608
10862
  * (iteratee) or the value `undefined` if none passed. Invoked with
10609
10863
  * (err, result).
10610
- * @returns a Promise if no callback is passed
10864
+ * @returns {Promise} a promise, if a callback is omitted
10611
10865
  */
10612
10866
  function detectLimit(coll, limit, iteratee, callback) {
10613
- return _createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback)
10867
+ return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback)
10614
10868
  }
10615
10869
  var detectLimit$1 = awaitify(detectLimit, 4);
10616
10870
 
@@ -10633,10 +10887,10 @@ var detectLimit$1 = awaitify(detectLimit, 4);
10633
10887
  * Result will be the first item in the array that passes the truth test
10634
10888
  * (iteratee) or the value `undefined` if none passed. Invoked with
10635
10889
  * (err, result).
10636
- * @returns a Promise if no callback is passed
10890
+ * @returns {Promise} a promise, if a callback is omitted
10637
10891
  */
10638
10892
  function detectSeries(coll, iteratee, callback) {
10639
- return _createTester(bool => bool, (res, item) => item)(eachOfLimit(1), coll, iteratee, callback)
10893
+ return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback)
10640
10894
  }
10641
10895
 
10642
10896
  var detectSeries$1 = awaitify(detectSeries, 3);
@@ -10869,11 +11123,11 @@ function _withoutIndex(iteratee) {
10869
11123
  * }
10870
11124
  *
10871
11125
  */
10872
- function eachLimit(coll, iteratee, callback) {
11126
+ function eachLimit$2(coll, iteratee, callback) {
10873
11127
  return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
10874
11128
  }
10875
11129
 
10876
- var each = awaitify(eachLimit, 3);
11130
+ var each = awaitify(eachLimit$2, 3);
10877
11131
 
10878
11132
  /**
10879
11133
  * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
@@ -10896,10 +11150,10 @@ var each = awaitify(eachLimit, 3);
10896
11150
  * `iteratee` functions have finished, or an error occurs. Invoked with (err).
10897
11151
  * @returns {Promise} a promise, if a callback is omitted
10898
11152
  */
10899
- function eachLimit$1(coll, limit, iteratee, callback) {
10900
- return eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
11153
+ function eachLimit(coll, limit, iteratee, callback) {
11154
+ return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
10901
11155
  }
10902
- var eachLimit$2 = awaitify(eachLimit$1, 4);
11156
+ var eachLimit$1 = awaitify(eachLimit, 4);
10903
11157
 
10904
11158
  /**
10905
11159
  * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
@@ -10925,7 +11179,7 @@ var eachLimit$2 = awaitify(eachLimit$1, 4);
10925
11179
  * @returns {Promise} a promise, if a callback is omitted
10926
11180
  */
10927
11181
  function eachSeries(coll, iteratee, callback) {
10928
- return eachLimit$2(coll, 1, iteratee, callback)
11182
+ return eachLimit$1(coll, 1, iteratee, callback)
10929
11183
  }
10930
11184
  var eachSeries$1 = awaitify(eachSeries, 3);
10931
11185
 
@@ -11102,7 +11356,7 @@ var every$1 = awaitify(every, 3);
11102
11356
  * @returns {Promise} a promise, if no callback provided
11103
11357
  */
11104
11358
  function everyLimit(coll, limit, iteratee, callback) {
11105
- return _createTester(bool => !bool, res => !res)(eachOfLimit(limit), coll, iteratee, callback)
11359
+ return _createTester(bool => !bool, res => !res)(eachOfLimit$2(limit), coll, iteratee, callback)
11106
11360
  }
11107
11361
  var everyLimit$1 = awaitify(everyLimit, 4);
11108
11362
 
@@ -11265,7 +11519,7 @@ var filter$1 = awaitify(filter, 3);
11265
11519
  * @returns {Promise} a promise, if no callback provided
11266
11520
  */
11267
11521
  function filterLimit (coll, limit, iteratee, callback) {
11268
- return _filter(eachOfLimit(limit), coll, iteratee, callback)
11522
+ return _filter(eachOfLimit$2(limit), coll, iteratee, callback)
11269
11523
  }
11270
11524
  var filterLimit$1 = awaitify(filterLimit, 4);
11271
11525
 
@@ -11560,7 +11814,7 @@ function mapValuesLimit(obj, limit, iteratee, callback) {
11560
11814
  callback = once(callback);
11561
11815
  var newObj = {};
11562
11816
  var _iteratee = wrapAsync(iteratee);
11563
- return eachOfLimit(limit)(obj, (val, key, next) => {
11817
+ return eachOfLimit$2(limit)(obj, (val, key, next) => {
11564
11818
  _iteratee(val, key, (err, result) => {
11565
11819
  if (err) return next(err);
11566
11820
  newObj[key] = result;
@@ -11837,17 +12091,17 @@ function memoize(fn, hasher = v => v) {
11837
12091
  * // a, b, and c equal 1, 2, and 3
11838
12092
  * }, 1, 2, 3);
11839
12093
  */
11840
- var _defer$1;
12094
+ var _defer;
11841
12095
 
11842
12096
  if (hasNextTick) {
11843
- _defer$1 = process.nextTick;
12097
+ _defer = process.nextTick;
11844
12098
  } else if (hasSetImmediate) {
11845
- _defer$1 = setImmediate;
12099
+ _defer = setImmediate;
11846
12100
  } else {
11847
- _defer$1 = fallback;
12101
+ _defer = fallback;
11848
12102
  }
11849
12103
 
11850
- var nextTick = wrap(_defer$1);
12104
+ var nextTick = wrap(_defer);
11851
12105
 
11852
12106
  var _parallel = awaitify((eachfn, tasks, callback) => {
11853
12107
  var results = isArrayLike(tasks) ? [] : {};
@@ -12047,7 +12301,7 @@ function parallel(tasks, callback) {
12047
12301
  * @returns {Promise} a promise, if a callback is not passed
12048
12302
  */
12049
12303
  function parallelLimit(tasks, limit, callback) {
12050
- return _parallel(eachOfLimit(limit), tasks, callback);
12304
+ return _parallel(eachOfLimit$2(limit), tasks, callback);
12051
12305
  }
12052
12306
 
12053
12307
  /**
@@ -12192,9 +12446,9 @@ function parallelLimit(tasks, limit, callback) {
12192
12446
  * console.log('finished processing bar');
12193
12447
  * });
12194
12448
  */
12195
- function queue$1 (worker, concurrency) {
12449
+ function queue (worker, concurrency) {
12196
12450
  var _worker = wrapAsync(worker);
12197
- return queue((items, cb) => {
12451
+ return queue$1((items, cb) => {
12198
12452
  _worker(items[0], cb);
12199
12453
  }, concurrency, 1);
12200
12454
  }
@@ -12331,54 +12585,51 @@ function smaller(x, y) {
12331
12585
  * @param {number} concurrency - An `integer` for determining how many `worker`
12332
12586
  * functions should be run in parallel. If omitted, the concurrency defaults to
12333
12587
  * `1`. If the concurrency is `0`, an error is thrown.
12334
- * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two
12588
+ * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are three
12335
12589
  * differences between `queue` and `priorityQueue` objects:
12336
12590
  * * `push(task, priority, [callback])` - `priority` should be a number. If an
12337
12591
  * array of `tasks` is given, all tasks will be assigned the same priority.
12338
- * * The `unshift` method was removed.
12592
+ * * `pushAsync(task, priority, [callback])` - the same as `priorityQueue.push`,
12593
+ * except this returns a promise that rejects if an error occurs.
12594
+ * * The `unshift` and `unshiftAsync` methods were removed.
12339
12595
  */
12340
12596
  function priorityQueue(worker, concurrency) {
12341
12597
  // Start with a normal queue
12342
- var q = queue$1(worker, concurrency);
12343
- var processingScheduled = false;
12598
+ var q = queue(worker, concurrency);
12599
+
12600
+ var {
12601
+ push,
12602
+ pushAsync
12603
+ } = q;
12344
12604
 
12345
12605
  q._tasks = new Heap();
12606
+ q._createTaskItem = ({data, priority}, callback) => {
12607
+ return {
12608
+ data,
12609
+ priority,
12610
+ callback
12611
+ };
12612
+ };
12346
12613
 
12347
- // Override push to accept second parameter representing priority
12348
- q.push = function(data, priority = 0, callback = () => {}) {
12349
- if (typeof callback !== 'function') {
12350
- throw new Error('task callback must be a function');
12351
- }
12352
- q.started = true;
12353
- if (!Array.isArray(data)) {
12354
- data = [data];
12614
+ function createDataItems(tasks, priority) {
12615
+ if (!Array.isArray(tasks)) {
12616
+ return {data: tasks, priority};
12355
12617
  }
12356
- if (data.length === 0 && q.idle()) {
12357
- // call drain immediately if there are no tasks
12358
- return setImmediate$1(() => q.drain());
12359
- }
12360
-
12361
- for (var i = 0, l = data.length; i < l; i++) {
12362
- var item = {
12363
- data: data[i],
12364
- priority,
12365
- callback
12366
- };
12618
+ return tasks.map(data => { return {data, priority}; });
12619
+ }
12367
12620
 
12368
- q._tasks.push(item);
12369
- }
12621
+ // Override push to accept second parameter representing priority
12622
+ q.push = function(data, priority = 0, callback) {
12623
+ return push(createDataItems(data, priority), callback);
12624
+ };
12370
12625
 
12371
- if (!processingScheduled) {
12372
- processingScheduled = true;
12373
- setImmediate$1(() => {
12374
- processingScheduled = false;
12375
- q.process();
12376
- });
12377
- }
12626
+ q.pushAsync = function(data, priority = 0, callback) {
12627
+ return pushAsync(createDataItems(data, priority), callback);
12378
12628
  };
12379
12629
 
12380
- // Remove unshift function
12630
+ // Remove unshift functions
12381
12631
  delete q.unshift;
12632
+ delete q.unshiftAsync;
12382
12633
 
12383
12634
  return q;
12384
12635
  }
@@ -12399,7 +12650,7 @@ function priorityQueue(worker, concurrency) {
12399
12650
  * @param {Function} callback - A callback to run once any of the functions have
12400
12651
  * completed. This function gets an error or result from the first function that
12401
12652
  * completed. Invoked with (err, result).
12402
- * @returns undefined
12653
+ * @returns {Promise} a promise, if a callback is omitted
12403
12654
  * @example
12404
12655
  *
12405
12656
  * async.race([
@@ -12599,7 +12850,7 @@ function reflectAll(tasks) {
12599
12850
  return results;
12600
12851
  }
12601
12852
 
12602
- function reject(eachfn, arr, _iteratee, callback) {
12853
+ function reject$2(eachfn, arr, _iteratee, callback) {
12603
12854
  const iteratee = wrapAsync(_iteratee);
12604
12855
  return _filter(eachfn, arr, (value, cb) => {
12605
12856
  iteratee(value, (err, v) => {
@@ -12670,10 +12921,10 @@ function reject(eachfn, arr, _iteratee, callback) {
12670
12921
  * }
12671
12922
  *
12672
12923
  */
12673
- function reject$1 (coll, iteratee, callback) {
12674
- return reject(eachOf$1, coll, iteratee, callback)
12924
+ function reject (coll, iteratee, callback) {
12925
+ return reject$2(eachOf$1, coll, iteratee, callback)
12675
12926
  }
12676
- var reject$2 = awaitify(reject$1, 3);
12927
+ var reject$1 = awaitify(reject, 3);
12677
12928
 
12678
12929
  /**
12679
12930
  * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
@@ -12696,7 +12947,7 @@ var reject$2 = awaitify(reject$1, 3);
12696
12947
  * @returns {Promise} a promise, if no callback is passed
12697
12948
  */
12698
12949
  function rejectLimit (coll, limit, iteratee, callback) {
12699
- return reject(eachOfLimit(limit), coll, iteratee, callback)
12950
+ return reject$2(eachOfLimit$2(limit), coll, iteratee, callback)
12700
12951
  }
12701
12952
  var rejectLimit$1 = awaitify(rejectLimit, 4);
12702
12953
 
@@ -12719,11 +12970,11 @@ var rejectLimit$1 = awaitify(rejectLimit, 4);
12719
12970
  * @returns {Promise} a promise, if no callback is passed
12720
12971
  */
12721
12972
  function rejectSeries (coll, iteratee, callback) {
12722
- return reject(eachOfSeries$1, coll, iteratee, callback)
12973
+ return reject$2(eachOfSeries$1, coll, iteratee, callback)
12723
12974
  }
12724
12975
  var rejectSeries$1 = awaitify(rejectSeries, 3);
12725
12976
 
12726
- function constant$1(value) {
12977
+ function constant(value) {
12727
12978
  return function () {
12728
12979
  return value;
12729
12980
  }
@@ -12820,7 +13071,7 @@ const DEFAULT_INTERVAL = 0;
12820
13071
  function retry(opts, task, callback) {
12821
13072
  var options = {
12822
13073
  times: DEFAULT_TIMES,
12823
- intervalFunc: constant$1(DEFAULT_INTERVAL)
13074
+ intervalFunc: constant(DEFAULT_INTERVAL)
12824
13075
  };
12825
13076
 
12826
13077
  if (arguments.length < 3 && typeof opts === 'function') {
@@ -12861,7 +13112,7 @@ function parseTimes(acc, t) {
12861
13112
 
12862
13113
  acc.intervalFunc = typeof t.interval === 'function' ?
12863
13114
  t.interval :
12864
- constant$1(+t.interval || DEFAULT_INTERVAL);
13115
+ constant(+t.interval || DEFAULT_INTERVAL);
12865
13116
 
12866
13117
  acc.errorFilter = t.errorFilter;
12867
13118
  } else if (typeof t === 'number' || typeof t === 'string') {
@@ -13220,7 +13471,7 @@ var some$1 = awaitify(some, 3);
13220
13471
  * @returns {Promise} a promise, if no callback provided
13221
13472
  */
13222
13473
  function someLimit(coll, limit, iteratee, callback) {
13223
- return _createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback)
13474
+ return _createTester(Boolean, res => res)(eachOfLimit$2(limit), coll, iteratee, callback)
13224
13475
  }
13225
13476
  var someLimit$1 = awaitify(someLimit, 4);
13226
13477
 
@@ -13814,7 +14065,7 @@ function unmemoize(fn) {
13814
14065
  * @method
13815
14066
  * @category Control Flow
13816
14067
  * @param {AsyncFunction} test - asynchronous truth test to perform before each
13817
- * execution of `iteratee`. Invoked with ().
14068
+ * execution of `iteratee`. Invoked with (callback).
13818
14069
  * @param {AsyncFunction} iteratee - An async function which is called each time
13819
14070
  * `test` passes. Invoked with (callback).
13820
14071
  * @param {Function} [callback] - A callback which is called after the test
@@ -13924,7 +14175,7 @@ function until(test, iteratee, callback) {
13924
14175
  * @param {Function} [callback] - An optional callback to run once all the
13925
14176
  * functions have completed. This will be passed the results of the last task's
13926
14177
  * callback. Invoked with (err, [results]).
13927
- * @returns undefined
14178
+ * @returns {Promise} a promise, if a callback is omitted
13928
14179
  * @example
13929
14180
  *
13930
14181
  * async.waterfall([
@@ -14026,20 +14277,21 @@ var waterfall$1 = awaitify(waterfall);
14026
14277
  * @static
14027
14278
  */
14028
14279
 
14280
+
14029
14281
  var index = {
14030
14282
  apply,
14031
- applyEach: applyEach$1,
14283
+ applyEach,
14032
14284
  applyEachSeries,
14033
14285
  asyncify,
14034
14286
  auto,
14035
14287
  autoInject,
14036
- cargo,
14037
- cargoQueue: cargo$1,
14288
+ cargo: cargo$1,
14289
+ cargoQueue: cargo,
14038
14290
  compose,
14039
14291
  concat: concat$1,
14040
14292
  concatLimit: concatLimit$1,
14041
14293
  concatSeries: concatSeries$1,
14042
- constant,
14294
+ constant: constant$1,
14043
14295
  detect: detect$1,
14044
14296
  detectLimit: detectLimit$1,
14045
14297
  detectSeries: detectSeries$1,
@@ -14047,9 +14299,9 @@ var index = {
14047
14299
  doUntil,
14048
14300
  doWhilst: doWhilst$1,
14049
14301
  each,
14050
- eachLimit: eachLimit$2,
14302
+ eachLimit: eachLimit$1,
14051
14303
  eachOf: eachOf$1,
14052
- eachOfLimit: eachOfLimit$2,
14304
+ eachOfLimit: eachOfLimit$1,
14053
14305
  eachOfSeries: eachOfSeries$1,
14054
14306
  eachSeries: eachSeries$1,
14055
14307
  ensureAsync,
@@ -14075,13 +14327,13 @@ var index = {
14075
14327
  parallel,
14076
14328
  parallelLimit,
14077
14329
  priorityQueue,
14078
- queue: queue$1,
14330
+ queue,
14079
14331
  race: race$1,
14080
14332
  reduce: reduce$1,
14081
14333
  reduceRight,
14082
14334
  reflect,
14083
14335
  reflectAll,
14084
- reject: reject$2,
14336
+ reject: reject$1,
14085
14337
  rejectLimit: rejectLimit$1,
14086
14338
  rejectSeries: rejectSeries$1,
14087
14339
  retry,
@@ -14119,10 +14371,10 @@ var index = {
14119
14371
  flatMapSeries: concatSeries$1,
14120
14372
  forEach: each,
14121
14373
  forEachSeries: eachSeries$1,
14122
- forEachLimit: eachLimit$2,
14374
+ forEachLimit: eachLimit$1,
14123
14375
  forEachOf: eachOf$1,
14124
14376
  forEachOfSeries: eachOfSeries$1,
14125
- forEachOfLimit: eachOfLimit$2,
14377
+ forEachOfLimit: eachOfLimit$1,
14126
14378
  inject: reduce$1,
14127
14379
  foldl: reduce$1,
14128
14380
  foldr: reduceRight,
@@ -14143,18 +14395,18 @@ var async = /*#__PURE__*/Object.freeze({
14143
14395
  anyLimit: someLimit$1,
14144
14396
  anySeries: someSeries$1,
14145
14397
  apply: apply,
14146
- applyEach: applyEach$1,
14398
+ applyEach: applyEach,
14147
14399
  applyEachSeries: applyEachSeries,
14148
14400
  asyncify: asyncify,
14149
14401
  auto: auto,
14150
14402
  autoInject: autoInject,
14151
- cargo: cargo,
14152
- cargoQueue: cargo$1,
14403
+ cargo: cargo$1,
14404
+ cargoQueue: cargo,
14153
14405
  compose: compose,
14154
14406
  concat: concat$1,
14155
14407
  concatLimit: concatLimit$1,
14156
14408
  concatSeries: concatSeries$1,
14157
- constant: constant,
14409
+ constant: constant$1,
14158
14410
  default: index,
14159
14411
  detect: detect$1,
14160
14412
  detectLimit: detectLimit$1,
@@ -14165,9 +14417,9 @@ var async = /*#__PURE__*/Object.freeze({
14165
14417
  doWhilst: doWhilst$1,
14166
14418
  during: whilst$1,
14167
14419
  each: each,
14168
- eachLimit: eachLimit$2,
14420
+ eachLimit: eachLimit$1,
14169
14421
  eachOf: eachOf$1,
14170
- eachOfLimit: eachOfLimit$2,
14422
+ eachOfLimit: eachOfLimit$1,
14171
14423
  eachOfSeries: eachOfSeries$1,
14172
14424
  eachSeries: eachSeries$1,
14173
14425
  ensureAsync: ensureAsync,
@@ -14186,9 +14438,9 @@ var async = /*#__PURE__*/Object.freeze({
14186
14438
  foldl: reduce$1,
14187
14439
  foldr: reduceRight,
14188
14440
  forEach: each,
14189
- forEachLimit: eachLimit$2,
14441
+ forEachLimit: eachLimit$1,
14190
14442
  forEachOf: eachOf$1,
14191
- forEachOfLimit: eachOfLimit$2,
14443
+ forEachOfLimit: eachOfLimit$1,
14192
14444
  forEachOfSeries: eachOfSeries$1,
14193
14445
  forEachSeries: eachSeries$1,
14194
14446
  forever: forever$1,
@@ -14208,13 +14460,13 @@ var async = /*#__PURE__*/Object.freeze({
14208
14460
  parallel: parallel,
14209
14461
  parallelLimit: parallelLimit,
14210
14462
  priorityQueue: priorityQueue,
14211
- queue: queue$1,
14463
+ queue: queue,
14212
14464
  race: race$1,
14213
14465
  reduce: reduce$1,
14214
14466
  reduceRight: reduceRight,
14215
14467
  reflect: reflect,
14216
14468
  reflectAll: reflectAll,
14217
- reject: reject$2,
14469
+ reject: reject$1,
14218
14470
  rejectLimit: rejectLimit$1,
14219
14471
  rejectSeries: rejectSeries$1,
14220
14472
  retry: retry,
@@ -17633,10 +17885,10 @@ function requireStackTrace () {
17633
17885
  path = path.trim();
17634
17886
  if (/^file:/.test(path)) {
17635
17887
  // existsSync/readFileSync can't handle file protocol, but once stripped, it works
17636
- path = path.replace(/file:\/\/\/(\w:)?/, function(_protocol, drive) {
17637
- return drive ?
17638
- '' : // file:///C:/dir/file -> C:/dir/file
17639
- '/'; // file:///root-dir/file -> /root-dir/file
17888
+ path = path.replace(/file:\/\/\/(\w:)?/, function (_protocol, drive) {
17889
+ return drive
17890
+ ? '' // file:///C:/dir/file -> C:/dir/file
17891
+ : '/'; // file:///root-dir/file -> /root-dir/file
17640
17892
  });
17641
17893
  }
17642
17894
  if (path in fileContentsCache) {
@@ -17652,7 +17904,7 @@ function requireStackTrace () {
17652
17904
  /* ignore any errors */
17653
17905
  }
17654
17906
 
17655
- return fileContentsCache[path] = contents;
17907
+ return (fileContentsCache[path] = contents);
17656
17908
  }
17657
17909
 
17658
17910
  // Support URLs relative to a directory, but be careful about a protocol prefix
@@ -17666,7 +17918,10 @@ function requireStackTrace () {
17666
17918
  if (protocol && /^\/\w\:/.test(startPath)) {
17667
17919
  // handle file:///C:/ paths
17668
17920
  protocol += '/';
17669
- return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/');
17921
+ return (
17922
+ protocol +
17923
+ path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/')
17924
+ );
17670
17925
  }
17671
17926
  return protocol + path.resolve(dir.slice(protocol.length), url);
17672
17927
  }
@@ -17676,7 +17931,8 @@ function requireStackTrace () {
17676
17931
 
17677
17932
  // Get the URL of the source map
17678
17933
  fileData = retrieveFile(source);
17679
- var re = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg;
17934
+ var re =
17935
+ /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;
17680
17936
  // Keep executing the search to find the *last* sourceMappingURL to avoid
17681
17937
  // picking up sourceMappingURLs from comments, strings, etc.
17682
17938
  var lastMatch, match;
@@ -17712,7 +17968,7 @@ function requireStackTrace () {
17712
17968
 
17713
17969
  return {
17714
17970
  url: sourceMappingURL,
17715
- map: sourceMapData
17971
+ map: sourceMapData,
17716
17972
  };
17717
17973
  }
17718
17974
 
@@ -17724,7 +17980,10 @@ function requireStackTrace () {
17724
17980
  // The sourceContentFor lookup needs the original source url as found in the
17725
17981
  // map file. However the client lookup in sourcesContentCache will use
17726
17982
  // a rewritten form of the url, hence originalSource and newSource.
17727
- sourcesContentCache[newSource] = sourceMap.map.sourceContentFor(originalSource, true);
17983
+ sourcesContentCache[newSource] = sourceMap.map.sourceContentFor(
17984
+ originalSource,
17985
+ true,
17986
+ );
17728
17987
  }
17729
17988
 
17730
17989
  stackTrace.mapSourcePosition = function mapSourcePosition(position, diagnostic) {
@@ -17735,14 +17994,15 @@ function requireStackTrace () {
17735
17994
  if (urlAndMap) {
17736
17995
  sourceMap = sourceMapCache[position.source] = {
17737
17996
  url: urlAndMap.url,
17738
- map: new SourceMapConsumer(urlAndMap.map)
17997
+ map: new SourceMapConsumer(urlAndMap.map),
17739
17998
  };
17740
- diagnostic.node_source_maps.source_mapping_urls[position.source] = urlAndMap.url;
17999
+ diagnostic.node_source_maps.source_mapping_urls[position.source] =
18000
+ urlAndMap.url;
17741
18001
 
17742
18002
  // Load all sources stored inline with the source map into the file cache
17743
18003
  // to pretend like they are already loaded. They may not exist on disk.
17744
18004
  if (sourceMap.map.sourcesContent) {
17745
- sourceMap.map.sources.forEach(function(source, i) {
18005
+ sourceMap.map.sources.forEach(function (source, i) {
17746
18006
  var contents = sourceMap.map.sourcesContent[i];
17747
18007
  if (contents) {
17748
18008
  var url = supportRelativeURL(sourceMap.url, source);
@@ -17753,14 +18013,19 @@ function requireStackTrace () {
17753
18013
  } else {
17754
18014
  sourceMap = sourceMapCache[position.source] = {
17755
18015
  url: null,
17756
- map: null
18016
+ map: null,
17757
18017
  };
17758
- diagnostic.node_source_maps.source_mapping_urls[position.source] = 'not found';
18018
+ diagnostic.node_source_maps.source_mapping_urls[position.source] =
18019
+ 'not found';
17759
18020
  }
17760
18021
  }
17761
18022
 
17762
18023
  // Resolve the source URL relative to the URL of the source map
17763
- if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === 'function') {
18024
+ if (
18025
+ sourceMap &&
18026
+ sourceMap.map &&
18027
+ typeof sourceMap.map.originalPositionFor === 'function'
18028
+ ) {
17764
18029
  var originalPosition = sourceMap.map.originalPositionFor(position);
17765
18030
 
17766
18031
  // Only return the original position if a matching line was found. If no
@@ -17771,7 +18036,9 @@ function requireStackTrace () {
17771
18036
  if (originalPosition.source !== null) {
17772
18037
  var originalSource = originalPosition.source;
17773
18038
  originalPosition.source = supportRelativeURL(
17774
- sourceMap.url, originalPosition.source);
18039
+ sourceMap.url,
18040
+ originalPosition.source,
18041
+ );
17775
18042
  cacheSourceContent(sourceMap, originalSource, originalPosition.source);
17776
18043
  return originalPosition;
17777
18044
  }
@@ -17807,19 +18074,16 @@ function requireParser () {
17807
18074
  var jadeTracePattern = /^\s*at .+ \(.+ (at[^)]+\))\)$/;
17808
18075
  var jadeFramePattern = /^\s*(>?) [0-9]+\|(\s*.+)$/m;
17809
18076
 
17810
-
17811
- var cache = new lru({max: 100});
18077
+ var cache = new lru({ max: 100 });
17812
18078
  var pendingReads = {};
17813
18079
 
17814
18080
  exports.cache = cache;
17815
18081
  exports.pendingReads = pendingReads;
17816
18082
 
17817
-
17818
18083
  /*
17819
18084
  * Internal
17820
18085
  */
17821
18086
 
17822
-
17823
18087
  function getMultipleErrors(errors) {
17824
18088
  var errArray, key;
17825
18089
 
@@ -17845,10 +18109,19 @@ function requireParser () {
17845
18109
  return errArray;
17846
18110
  }
17847
18111
 
17848
-
17849
18112
  function parseJadeDebugFrame(body) {
17850
- var lines, lineNumSep, filename, lineno, numLines, msg, i,
17851
- contextLine, preContext, postContext, line, jadeMatch;
18113
+ var lines,
18114
+ lineNumSep,
18115
+ filename,
18116
+ lineno,
18117
+ numLines,
18118
+ msg,
18119
+ i,
18120
+ contextLine,
18121
+ preContext,
18122
+ postContext,
18123
+ line,
18124
+ jadeMatch;
17852
18125
 
17853
18126
  // Given a Jade exception body, return a frame object
17854
18127
  lines = body.split('\n');
@@ -17883,7 +18156,10 @@ function requireParser () {
17883
18156
  }
17884
18157
 
17885
18158
  preContext = preContext.slice(0, Math.min(preContext.length, linesOfContext));
17886
- postContext = postContext.slice(0, Math.min(postContext.length, linesOfContext));
18159
+ postContext = postContext.slice(
18160
+ 0,
18161
+ Math.min(postContext.length, linesOfContext),
18162
+ );
17887
18163
 
17888
18164
  return {
17889
18165
  frame: {
@@ -17893,29 +18169,32 @@ function requireParser () {
17893
18169
  code: contextLine,
17894
18170
  context: {
17895
18171
  pre: preContext,
17896
- post: postContext
17897
- }
18172
+ post: postContext,
18173
+ },
17898
18174
  },
17899
- message: msg
18175
+ message: msg,
17900
18176
  };
17901
18177
  }
17902
18178
 
17903
-
17904
18179
  function extractContextLines(frame, fileLines) {
17905
18180
  frame.code = fileLines[frame.lineno - 1];
17906
18181
  frame.context = {
17907
- pre: fileLines.slice(Math.max(0, frame.lineno - (linesOfContext + 1)), frame.lineno - 1),
17908
- post: fileLines.slice(frame.lineno, frame.lineno + linesOfContext)
18182
+ pre: fileLines.slice(
18183
+ Math.max(0, frame.lineno - (linesOfContext + 1)),
18184
+ frame.lineno - 1,
18185
+ ),
18186
+ post: fileLines.slice(frame.lineno, frame.lineno + linesOfContext),
17909
18187
  };
17910
18188
  }
17911
18189
 
17912
18190
  function mapPosition(position, diagnostic) {
17913
- return stackTrace.mapSourcePosition({
18191
+ return stackTrace.mapSourcePosition(
18192
+ {
17914
18193
  source: position.source,
17915
18194
  line: position.line,
17916
- column: position.column
18195
+ column: position.column,
17917
18196
  },
17918
- diagnostic
18197
+ diagnostic,
17919
18198
  );
17920
18199
  }
17921
18200
 
@@ -17937,7 +18216,7 @@ function requireParser () {
17937
18216
  var runtimePosition = {
17938
18217
  source: data[1],
17939
18218
  line: Math.floor(data[2]),
17940
- column: Math.floor(data[3]) - 1
18219
+ column: Math.floor(data[3]) - 1,
17941
18220
  };
17942
18221
  if (this.useSourceMaps) {
17943
18222
  position = mapPosition(runtimePosition, this.diagnostic);
@@ -17950,7 +18229,7 @@ function requireParser () {
17950
18229
  filename: position.source,
17951
18230
  lineno: position.line,
17952
18231
  colno: position.column,
17953
- runtimePosition: runtimePosition // Used to match frames for locals
18232
+ runtimePosition: runtimePosition, // Used to match frames for locals
17954
18233
  };
17955
18234
 
17956
18235
  // For coffeescript, lineno and colno refer to the .coffee positions
@@ -17966,7 +18245,6 @@ function requireParser () {
17966
18245
  callback(null, frame);
17967
18246
  }
17968
18247
 
17969
-
17970
18248
  function shouldReadFrameFile(frameFilename, callback) {
17971
18249
  var isValidFilename, isCached, isPending;
17972
18250
 
@@ -17977,7 +18255,6 @@ function requireParser () {
17977
18255
  callback(null, isValidFilename && !isCached && !isPending);
17978
18256
  }
17979
18257
 
17980
-
17981
18258
  function readFileLines(filename, callback) {
17982
18259
  try {
17983
18260
  fs.readFile(filename, function (err, fileData) {
@@ -18003,7 +18280,6 @@ function requireParser () {
18003
18280
  });
18004
18281
  }
18005
18282
 
18006
-
18007
18283
  function gatherContexts(frames, callback) {
18008
18284
  var frameFilenames = [];
18009
18285
 
@@ -18073,7 +18349,6 @@ function requireParser () {
18073
18349
  });
18074
18350
  });
18075
18351
  });
18076
-
18077
18352
  });
18078
18353
  }
18079
18354
 
@@ -18081,7 +18356,6 @@ function requireParser () {
18081
18356
  * Public API
18082
18357
  */
18083
18358
 
18084
-
18085
18359
  exports.parseException = function (exc, options, item, callback) {
18086
18360
  var multipleErrs = getMultipleErrors(exc.errors);
18087
18361
 
@@ -18092,13 +18366,13 @@ function requireParser () {
18092
18366
  logger.error('could not parse exception, err: ' + err);
18093
18367
  return callback(err);
18094
18368
  }
18095
- message = String(exc.message || '<no message>') ;
18369
+ message = String(exc.message || '<no message>');
18096
18370
  clss = String(exc.name || '<unknown>');
18097
18371
 
18098
18372
  ret = {
18099
18373
  class: clss,
18100
18374
  message: message,
18101
- frames: stack
18375
+ frames: stack,
18102
18376
  };
18103
18377
 
18104
18378
  if (multipleErrs && multipleErrs.length) {
@@ -18106,7 +18380,7 @@ function requireParser () {
18106
18380
  ret = {
18107
18381
  class: clss,
18108
18382
  message: String(firstErr.message || '<no message>'),
18109
- frames: stack
18383
+ frames: stack,
18110
18384
  };
18111
18385
  }
18112
18386
 
@@ -18118,25 +18392,30 @@ function requireParser () {
18118
18392
  }
18119
18393
 
18120
18394
  if (item.localsMap) {
18121
- item.notifier.locals.mergeLocals(item.localsMap, stack, exc.stack, function (err) {
18122
- if (err) {
18123
- logger.error('could not parse locals, err: ' + err);
18395
+ item.notifier.locals.mergeLocals(
18396
+ item.localsMap,
18397
+ stack,
18398
+ exc.stack,
18399
+ function (err) {
18400
+ if (err) {
18401
+ logger.error('could not parse locals, err: ' + err);
18124
18402
 
18125
- // Don't reject the occurrence, record the error instead.
18126
- item.diagnostic['error parsing locals'] = err;
18127
- }
18403
+ // Don't reject the occurrence, record the error instead.
18404
+ item.diagnostic['error parsing locals'] = err;
18405
+ }
18128
18406
 
18129
- return callback(null, ret);
18130
- });
18407
+ return callback(null, ret);
18408
+ },
18409
+ );
18131
18410
  } else {
18132
18411
  return callback(null, ret);
18133
18412
  }
18134
18413
  });
18135
18414
  };
18136
18415
 
18137
-
18138
18416
  exports.parseStack = function (stack, options, item, callback) {
18139
- var lines, _stack = stack;
18417
+ var lines,
18418
+ _stack = stack;
18140
18419
 
18141
18420
  // Some JS frameworks (e.g. Meteor) might bury the stack property
18142
18421
  while (typeof _stack === 'object') {
@@ -18152,16 +18431,29 @@ function requireParser () {
18152
18431
  }
18153
18432
 
18154
18433
  // Parse out all of the frame and filename info
18155
- async.map(lines, parseFrameLine.bind({ useSourceMaps: options.nodeSourceMaps, diagnostic: item.diagnostic }), function (err, frames) {
18156
- if (err) {
18157
- return callback(err);
18158
- }
18159
- frames.reverse();
18160
- async.filter(frames, function (frame, callback) { callback(null, !!frame); }, function (err, results) {
18161
- if (err) return callback(err);
18162
- gatherContexts(results, callback);
18163
- });
18164
- });
18434
+ async.map(
18435
+ lines,
18436
+ parseFrameLine.bind({
18437
+ useSourceMaps: options.nodeSourceMaps,
18438
+ diagnostic: item.diagnostic,
18439
+ }),
18440
+ function (err, frames) {
18441
+ if (err) {
18442
+ return callback(err);
18443
+ }
18444
+ frames.reverse();
18445
+ async.filter(
18446
+ frames,
18447
+ function (frame, callback) {
18448
+ callback(null, !!frame);
18449
+ },
18450
+ function (err, results) {
18451
+ if (err) return callback(err);
18452
+ gatherContexts(results, callback);
18453
+ },
18454
+ );
18455
+ },
18456
+ );
18165
18457
  };
18166
18458
  } (parser));
18167
18459
  return parser;
@@ -18459,7 +18751,6 @@ function requireScrub () {
18459
18751
  return ret;
18460
18752
  }
18461
18753
 
18462
-
18463
18754
  function _getScrubQueryParamRegexs(scrubFields) {
18464
18755
  var ret = [];
18465
18756
  var pat;
@@ -18488,7 +18779,8 @@ function requireTransforms$1 () {
18488
18779
  var scrub = requireScrub();
18489
18780
 
18490
18781
  function baseData(item, options, callback) {
18491
- var environment = (options.payload && options.payload.environment) || options.environment;
18782
+ var environment =
18783
+ (options.payload && options.payload.environment) || options.environment;
18492
18784
  var data = {
18493
18785
  timestamp: Math.round(item.timestamp / 1000),
18494
18786
  environment: item.environment || environment,
@@ -18497,7 +18789,7 @@ function requireTransforms$1 () {
18497
18789
  framework: item.framework || options.framework,
18498
18790
  uuid: item.uuid,
18499
18791
  notifier: JSON.parse(JSON.stringify(options.notifier)),
18500
- custom: item.custom
18792
+ custom: item.custom,
18501
18793
  };
18502
18794
 
18503
18795
  if (options.codeVersion) {
@@ -18516,7 +18808,7 @@ function requireTransforms$1 () {
18516
18808
  data.server = {
18517
18809
  host: options.host,
18518
18810
  argv: process.argv.concat(),
18519
- pid: process.pid
18811
+ pid: process.pid,
18520
18812
  };
18521
18813
 
18522
18814
  if (options.branch) {
@@ -18535,7 +18827,7 @@ function requireTransforms$1 () {
18535
18827
  item.data.body = item.data.body || {};
18536
18828
  var message = item.message || 'Item sent with null or missing arguments.';
18537
18829
  item.data.body.message = {
18538
- body: message
18830
+ body: message,
18539
18831
  };
18540
18832
  callback(null, item);
18541
18833
  }
@@ -18575,9 +18867,13 @@ function requireTransforms$1 () {
18575
18867
  _.addErrorContext(item, errors);
18576
18868
  }
18577
18869
 
18578
- var cb = function(e) {
18870
+ var cb = function (e) {
18579
18871
  if (e) {
18580
- item.message = item.err.message || item.err.description || item.message || String(item.err);
18872
+ item.message =
18873
+ item.err.message ||
18874
+ item.err.description ||
18875
+ item.message ||
18876
+ String(item.err);
18581
18877
  item.diagnostic.buildTraceData = e.message;
18582
18878
  delete item.stackInfo;
18583
18879
  }
@@ -18611,11 +18907,13 @@ function requireTransforms$1 () {
18611
18907
 
18612
18908
  if (req.route) {
18613
18909
  routePath = req.route.path;
18614
- item.data.context = baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18910
+ item.data.context =
18911
+ baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18615
18912
  } else {
18616
18913
  try {
18617
18914
  routePath = req.app._router.matchRequest(req).path;
18618
- item.data.context = baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18915
+ item.data.context =
18916
+ baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18619
18917
  } catch (ignore) {
18620
18918
  // Ignored
18621
18919
  }
@@ -18633,7 +18931,7 @@ function requireTransforms$1 () {
18633
18931
  }
18634
18932
  item.data.person = person;
18635
18933
  } else if (req.user) {
18636
- item.data.person = {id: req.user.id};
18934
+ item.data.person = { id: req.user.id };
18637
18935
  if (req.user.username && captureUsername) {
18638
18936
  item.data.person.username = req.user.username;
18639
18937
  }
@@ -18645,7 +18943,7 @@ function requireTransforms$1 () {
18645
18943
  if (_.isFunction(userId)) {
18646
18944
  userId = userId();
18647
18945
  }
18648
- item.data.person = {id: userId};
18946
+ item.data.person = { id: userId };
18649
18947
  }
18650
18948
 
18651
18949
  callback(null, item);
@@ -18664,7 +18962,7 @@ function requireTransforms$1 () {
18664
18962
  functionName: c.functionName,
18665
18963
  functionVersion: c.functionVersion,
18666
18964
  arn: c.invokedFunctionArn,
18667
- requestId: c.awsRequestId
18965
+ requestId: c.awsRequestId,
18668
18966
  };
18669
18967
 
18670
18968
  item.data = item.data || {};
@@ -18688,7 +18986,9 @@ function requireTransforms$1 () {
18688
18986
  }
18689
18987
 
18690
18988
  function parseRequestBody(req, options) {
18691
- if (!req || !options.scrubRequestBody) { return }
18989
+ if (!req || !options.scrubRequestBody) {
18990
+ return;
18991
+ }
18692
18992
 
18693
18993
  try {
18694
18994
  if (_.isString(req.body) && _isJsonContentType(req)) {
@@ -18701,7 +19001,9 @@ function requireTransforms$1 () {
18701
19001
  }
18702
19002
 
18703
19003
  function serializeRequestBody(req, options) {
18704
- if (!req || !options.scrubRequestBody) { return }
19004
+ if (!req || !options.scrubRequestBody) {
19005
+ return;
19006
+ }
18705
19007
 
18706
19008
  try {
18707
19009
  if (_.isObject(req.body) && _isJsonContentType(req)) {
@@ -18716,11 +19018,15 @@ function requireTransforms$1 () {
18716
19018
  /** Helpers **/
18717
19019
 
18718
19020
  function _isJsonContentType(req) {
18719
- return req.headers && req.headers['content-type'] && req.headers['content-type'].includes('json');
19021
+ return (
19022
+ req.headers &&
19023
+ req.headers['content-type'] &&
19024
+ req.headers['content-type'].includes('json')
19025
+ );
18720
19026
  }
18721
19027
 
18722
19028
  function _buildTraceData(chain, options, item) {
18723
- return function(ex, cb) {
19029
+ return function (ex, cb) {
18724
19030
  parser.parseException(ex, options, item, function (err, errData) {
18725
19031
  if (err) {
18726
19032
  return cb(err);
@@ -18730,8 +19036,8 @@ function requireTransforms$1 () {
18730
19036
  frames: errData.frames,
18731
19037
  exception: {
18732
19038
  class: errData['class'],
18733
- message: errData.message
18734
- }
19039
+ message: errData.message,
19040
+ },
18735
19041
  });
18736
19042
 
18737
19043
  return cb(null);
@@ -18750,7 +19056,8 @@ function requireTransforms$1 () {
18750
19056
  function _buildRequestData(req) {
18751
19057
  var headers = req.headers || {};
18752
19058
  var host = headers.host || '<no host>';
18753
- var proto = req.protocol || ((req.socket && req.socket.encrypted) ? 'https' : 'http' );
19059
+ var proto =
19060
+ req.protocol || (req.socket && req.socket.encrypted ? 'https' : 'http');
18754
19061
  var parsedUrl;
18755
19062
  var baseUrl = req.baseUrl || '';
18756
19063
  if (_.isType(req.url, 'string')) {
@@ -18766,7 +19073,7 @@ function requireTransforms$1 () {
18766
19073
  url: reqUrl,
18767
19074
  user_ip: _extractIp(req),
18768
19075
  headers: headers,
18769
- method: req.method
19076
+ method: req.method,
18770
19077
  };
18771
19078
  if (parsedUrl.search && parsedUrl.search.length > 0) {
18772
19079
  data.GET = parsedUrl.query;
@@ -18797,7 +19104,7 @@ function requireTransforms$1 () {
18797
19104
  addErrorData: addErrorData,
18798
19105
  addRequestData: addRequestData,
18799
19106
  addLambdaData: addLambdaData,
18800
- scrubPayload: scrubPayload
19107
+ scrubPayload: scrubPayload,
18801
19108
  };
18802
19109
  return transforms$1;
18803
19110
  }
@@ -18852,19 +19159,19 @@ function requireTransforms () {
18852
19159
  }
18853
19160
  if (trace) {
18854
19161
  if (!(trace.exception && trace.exception.description)) {
18855
- _.set(item, tracePath+'.exception.description', item.message);
19162
+ _.set(item, tracePath + '.exception.description', item.message);
18856
19163
  callback(null, item);
18857
19164
  return;
18858
19165
  }
18859
- var extra = _.get(item, tracePath+'.extra') || {};
18860
- var newExtra = _.merge(extra, {message: item.message});
18861
- _.set(item, tracePath+'.extra', newExtra);
19166
+ var extra = _.get(item, tracePath + '.extra') || {};
19167
+ var newExtra = _.merge(extra, { message: item.message });
19168
+ _.set(item, tracePath + '.extra', newExtra);
18862
19169
  }
18863
19170
  callback(null, item);
18864
19171
  }
18865
19172
 
18866
19173
  function userTransform(logger) {
18867
- return function(item, options, callback) {
19174
+ return function (item, options, callback) {
18868
19175
  var newItem = _.merge(item);
18869
19176
  var response = null;
18870
19177
  try {
@@ -18873,23 +19180,29 @@ function requireTransforms () {
18873
19180
  }
18874
19181
  } catch (e) {
18875
19182
  options.transform = null;
18876
- logger.error('Error while calling custom transform() function. Removing custom transform().', e);
19183
+ logger.error(
19184
+ 'Error while calling custom transform() function. Removing custom transform().',
19185
+ e,
19186
+ );
18877
19187
  callback(null, item);
18878
19188
  return;
18879
19189
  }
18880
- if(_.isPromise(response)) {
18881
- response.then(function (promisedItem) {
18882
- if(promisedItem) {
18883
- newItem.data = promisedItem;
18884
- }
18885
- callback(null, newItem);
18886
- }, function (error) {
18887
- callback(error, item);
18888
- });
19190
+ if (_.isPromise(response)) {
19191
+ response.then(
19192
+ function (promisedItem) {
19193
+ if (promisedItem) {
19194
+ newItem.data = promisedItem;
19195
+ }
19196
+ callback(null, newItem);
19197
+ },
19198
+ function (error) {
19199
+ callback(error, item);
19200
+ },
19201
+ );
18889
19202
  } else {
18890
19203
  callback(null, newItem);
18891
19204
  }
18892
- }
19205
+ };
18893
19206
  }
18894
19207
 
18895
19208
  function addConfigToPayload(item, options, callback) {
@@ -18904,7 +19217,7 @@ function requireTransforms () {
18904
19217
  }
18905
19218
 
18906
19219
  function addFunctionOption(options, name) {
18907
- if(_.isFunction(options[name])) {
19220
+ if (_.isFunction(options[name])) {
18908
19221
  options[name] = options[name].toString();
18909
19222
  }
18910
19223
  }
@@ -18923,7 +19236,10 @@ function requireTransforms () {
18923
19236
  }
18924
19237
 
18925
19238
  function addDiagnosticKeys(item, options, callback) {
18926
- var diagnostic = _.merge(item.notifier.client.notifier.diagnostic, item.diagnostic);
19239
+ var diagnostic = _.merge(
19240
+ item.notifier.client.notifier.diagnostic,
19241
+ item.diagnostic,
19242
+ );
18927
19243
 
18928
19244
  if (_.get(item, 'err._isAnonymous')) {
18929
19245
  diagnostic.is_anonymous = true;
@@ -18942,14 +19258,17 @@ function requireTransforms () {
18942
19258
  filename: item.err.fileName,
18943
19259
  line: item.err.lineNumber,
18944
19260
  column: item.err.columnNumber,
18945
- stack: item.err.stack
19261
+ stack: item.err.stack,
18946
19262
  };
18947
19263
  } catch (e) {
18948
19264
  diagnostic.raw_error = { failed: String(e) };
18949
19265
  }
18950
19266
  }
18951
19267
 
18952
- item.data.notifier.diagnostic = _.merge(item.data.notifier.diagnostic, diagnostic);
19268
+ item.data.notifier.diagnostic = _.merge(
19269
+ item.data.notifier.diagnostic,
19270
+ diagnostic,
19271
+ );
18953
19272
  callback(null, item);
18954
19273
  }
18955
19274
 
@@ -18961,7 +19280,7 @@ function requireTransforms () {
18961
19280
  userTransform: userTransform,
18962
19281
  addConfigToPayload: addConfigToPayload,
18963
19282
  addConfiguredOptions: addConfiguredOptions,
18964
- addDiagnosticKeys: addDiagnosticKeys
19283
+ addDiagnosticKeys: addDiagnosticKeys,
18965
19284
  };
18966
19285
  return transforms;
18967
19286
  }
@@ -18987,7 +19306,7 @@ function requirePredicates () {
18987
19306
  }
18988
19307
 
18989
19308
  function userCheckIgnore(logger) {
18990
- return function(item, settings) {
19309
+ return function (item, settings) {
18991
19310
  var isUncaught = !!item._isUncaught;
18992
19311
  delete item._isUncaught;
18993
19312
  var args = item._originalArgs;
@@ -19001,7 +19320,10 @@ function requirePredicates () {
19001
19320
  logger.error('Error while calling onSendCallback, removing', e);
19002
19321
  }
19003
19322
  try {
19004
- if (_.isFunction(settings.checkIgnore) && settings.checkIgnore(isUncaught, args, item)) {
19323
+ if (
19324
+ _.isFunction(settings.checkIgnore) &&
19325
+ settings.checkIgnore(isUncaught, args, item)
19326
+ ) {
19005
19327
  return false;
19006
19328
  }
19007
19329
  } catch (e) {
@@ -19009,27 +19331,31 @@ function requirePredicates () {
19009
19331
  logger.error('Error while calling custom checkIgnore(), removing', e);
19010
19332
  }
19011
19333
  return true;
19012
- }
19334
+ };
19013
19335
  }
19014
19336
 
19015
19337
  function urlIsNotBlockListed(logger) {
19016
- return function(item, settings) {
19338
+ return function (item, settings) {
19017
19339
  return !urlIsOnAList(item, settings, 'blocklist', logger);
19018
- }
19340
+ };
19019
19341
  }
19020
19342
 
19021
19343
  function urlIsSafeListed(logger) {
19022
- return function(item, settings) {
19344
+ return function (item, settings) {
19023
19345
  return urlIsOnAList(item, settings, 'safelist', logger);
19024
- }
19346
+ };
19025
19347
  }
19026
19348
 
19027
19349
  function matchFrames(trace, list, block) {
19028
- if (!trace) { return !block }
19350
+ if (!trace) {
19351
+ return !block;
19352
+ }
19029
19353
 
19030
19354
  var frames = trace.frames;
19031
19355
 
19032
- if (!frames || frames.length === 0) { return !block; }
19356
+ if (!frames || frames.length === 0) {
19357
+ return !block;
19358
+ }
19033
19359
 
19034
19360
  var frame, filename, url, urlRegex;
19035
19361
  var listLength = list.length;
@@ -19038,7 +19364,9 @@ function requirePredicates () {
19038
19364
  frame = frames[i];
19039
19365
  filename = frame.filename;
19040
19366
 
19041
- if (!_.isType(filename, 'string')) { return !block; }
19367
+ if (!_.isType(filename, 'string')) {
19368
+ return !block;
19369
+ }
19042
19370
 
19043
19371
  for (var j = 0; j < listLength; j++) {
19044
19372
  url = list[j];
@@ -19075,27 +19403,35 @@ function requirePredicates () {
19075
19403
 
19076
19404
  var tracesLength = traces.length;
19077
19405
  for (var i = 0; i < tracesLength; i++) {
19078
- if(matchFrames(traces[i], list, block)) {
19406
+ if (matchFrames(traces[i], list, block)) {
19079
19407
  return true;
19080
19408
  }
19081
19409
  }
19082
- } catch (e)
19083
- /* istanbul ignore next */
19084
- {
19410
+ } catch (
19411
+ e
19412
+ /* istanbul ignore next */
19413
+ ) {
19085
19414
  if (block) {
19086
19415
  settings.hostBlockList = null;
19087
19416
  } else {
19088
19417
  settings.hostSafeList = null;
19089
19418
  }
19090
19419
  var listName = block ? 'hostBlockList' : 'hostSafeList';
19091
- logger.error('Error while reading your configuration\'s ' + listName + ' option. Removing custom ' + listName + '.', e);
19420
+ logger.error(
19421
+ "Error while reading your configuration's " +
19422
+ listName +
19423
+ ' option. Removing custom ' +
19424
+ listName +
19425
+ '.',
19426
+ e,
19427
+ );
19092
19428
  return !block;
19093
19429
  }
19094
19430
  return false;
19095
19431
  }
19096
19432
 
19097
19433
  function messageIsIgnored(logger) {
19098
- return function(item, settings) {
19434
+ return function (item, settings) {
19099
19435
  var i, j, ignoredMessages, len, messageIsIgnored, rIgnoredMessage, messages;
19100
19436
 
19101
19437
  try {
@@ -19108,7 +19444,7 @@ function requirePredicates () {
19108
19444
 
19109
19445
  messages = messagesFromItem(item);
19110
19446
 
19111
- if (messages.length === 0){
19447
+ if (messages.length === 0) {
19112
19448
  return true;
19113
19449
  }
19114
19450
 
@@ -19124,15 +19460,18 @@ function requirePredicates () {
19124
19460
  }
19125
19461
  }
19126
19462
  }
19127
- } catch(e)
19128
- /* istanbul ignore next */
19129
- {
19463
+ } catch (
19464
+ e
19465
+ /* istanbul ignore next */
19466
+ ) {
19130
19467
  settings.ignoredMessages = null;
19131
- logger.error('Error while reading your configuration\'s ignoredMessages option. Removing custom ignoredMessages.');
19468
+ logger.error(
19469
+ "Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.",
19470
+ );
19132
19471
  }
19133
19472
 
19134
19473
  return true;
19135
- }
19474
+ };
19136
19475
  }
19137
19476
 
19138
19477
  function messagesFromItem(item) {
@@ -19163,7 +19502,7 @@ function requirePredicates () {
19163
19502
  userCheckIgnore: userCheckIgnore,
19164
19503
  urlIsNotBlockListed: urlIsNotBlockListed,
19165
19504
  urlIsSafeListed: urlIsSafeListed,
19166
- messageIsIgnored: messageIsIgnored
19505
+ messageIsIgnored: messageIsIgnored,
19167
19506
  };
19168
19507
  return predicates;
19169
19508
  }
@@ -19982,8 +20321,13 @@ function requireRollbar () {
19982
20321
  var transport = new Transport();
19983
20322
  var api = new API(this.options, transport, urllib, truncation, jsonBackup);
19984
20323
  var telemeter = new Telemeter(this.options);
19985
- this.client = client || new Client(this.options, api, logger, telemeter, 'server');
19986
- this.instrumenter = new Instrumenter(this.options, this.client.telemeter, this);
20324
+ this.client =
20325
+ client || new Client(this.options, api, logger, telemeter, 'server');
20326
+ this.instrumenter = new Instrumenter(
20327
+ this.options,
20328
+ this.client.telemeter,
20329
+ this,
20330
+ );
19987
20331
  this.instrumenter.instrument();
19988
20332
  if (this.options.locals) {
19989
20333
  this.locals = initLocals(this.options.locals, logger);
@@ -19997,7 +20341,9 @@ function requireRollbar () {
19997
20341
  function initLocals(localsOptions, logger) {
19998
20342
  // Capturing stack local variables is only supported in Node 10 and higher.
19999
20343
  var nodeMajorVersion = process.versions.node.split('.')[0];
20000
- if (nodeMajorVersion < 10) { return null; }
20344
+ if (nodeMajorVersion < 10) {
20345
+ return null;
20346
+ }
20001
20347
 
20002
20348
  var Locals;
20003
20349
  if (typeof localsOptions === 'function') {
@@ -20007,7 +20353,9 @@ function requireRollbar () {
20007
20353
  Locals = localsOptions.module;
20008
20354
  delete localsOptions.module;
20009
20355
  } else {
20010
- logger.error('options.locals or options.locals.module must be a Locals module');
20356
+ logger.error(
20357
+ 'options.locals or options.locals.module must be a Locals module',
20358
+ );
20011
20359
  return null;
20012
20360
  }
20013
20361
  return new Locals(localsOptions, logger);
@@ -20052,7 +20400,11 @@ function requireRollbar () {
20052
20400
  payload = { payload: payloadData };
20053
20401
  }
20054
20402
  this.options = _.handleOptions(oldOptions, options, payload, logger);
20055
- this.options._configuredOptions = _.handleOptions(oldOptions._configuredOptions, options, payload);
20403
+ this.options._configuredOptions = _.handleOptions(
20404
+ oldOptions._configuredOptions,
20405
+ options,
20406
+ payload,
20407
+ );
20056
20408
  // On the server we want to ignore any maxItems setting
20057
20409
  delete this.options.maxItems;
20058
20410
  logger.setVerbose(this.options.verbose);
@@ -20147,7 +20499,6 @@ function requireRollbar () {
20147
20499
  }
20148
20500
  };
20149
20501
 
20150
-
20151
20502
  Rollbar.prototype.warning = function () {
20152
20503
  var item = this._createItem(arguments);
20153
20504
  var uuid = item.uuid;
@@ -20163,7 +20514,6 @@ function requireRollbar () {
20163
20514
  }
20164
20515
  };
20165
20516
 
20166
-
20167
20517
  Rollbar.prototype.error = function () {
20168
20518
  var item = this._createItem(arguments);
20169
20519
  var uuid = item.uuid;
@@ -20228,7 +20578,7 @@ function requireRollbar () {
20228
20578
  };
20229
20579
  Rollbar.wait = function (callback) {
20230
20580
  if (_instance) {
20231
- return _instance.wait(callback)
20581
+ return _instance.wait(callback);
20232
20582
  } else {
20233
20583
  var maybeCallback = _getFirstFunction(arguments);
20234
20584
  handleUninitialized(maybeCallback);
@@ -20255,7 +20605,7 @@ function requireRollbar () {
20255
20605
  };
20256
20606
  Rollbar.errorHandler = function () {
20257
20607
  if (_instance) {
20258
- return _instance.errorHandler()
20608
+ return _instance.errorHandler();
20259
20609
  } else {
20260
20610
  handleUninitialized();
20261
20611
  }
@@ -20283,8 +20633,15 @@ function requireRollbar () {
20283
20633
  return new Promise(function (resolve, reject) {
20284
20634
  self.lambdaContext = context;
20285
20635
  if (shouldReportTimeouts) {
20286
- var timeoutCb = (timeoutHandler || _timeoutHandler).bind(null, event, context);
20287
- self.lambdaTimeoutHandle = setTimeout(timeoutCb, context.getRemainingTimeInMillis() - 1000);
20636
+ var timeoutCb = (timeoutHandler || _timeoutHandler).bind(
20637
+ null,
20638
+ event,
20639
+ context,
20640
+ );
20641
+ self.lambdaTimeoutHandle = setTimeout(
20642
+ timeoutCb,
20643
+ context.getRemainingTimeInMillis() - 1000,
20644
+ );
20288
20645
  }
20289
20646
  handler(event, context)
20290
20647
  .then(function (resp) {
@@ -20317,8 +20674,16 @@ function requireRollbar () {
20317
20674
  return function (event, context, callback) {
20318
20675
  self.lambdaContext = context;
20319
20676
  if (shouldReportTimeouts) {
20320
- var timeoutCb = (timeoutHandler || _timeoutHandler).bind(null, event, context, callback);
20321
- self.lambdaTimeoutHandle = setTimeout(timeoutCb, context.getRemainingTimeInMillis() - 1000);
20677
+ var timeoutCb = (timeoutHandler || _timeoutHandler).bind(
20678
+ null,
20679
+ event,
20680
+ context,
20681
+ callback,
20682
+ );
20683
+ self.lambdaTimeoutHandle = setTimeout(
20684
+ timeoutCb,
20685
+ context.getRemainingTimeInMillis() - 1000,
20686
+ );
20322
20687
  }
20323
20688
  try {
20324
20689
  handler(event, context, function (err, resp) {
@@ -20398,19 +20763,33 @@ function requireRollbar () {
20398
20763
  }
20399
20764
  };
20400
20765
 
20401
- Rollbar.prototype.reportMessageWithPayloadData = function (message, payloadData, request, callback) {
20766
+ Rollbar.prototype.reportMessageWithPayloadData = function (
20767
+ message,
20768
+ payloadData,
20769
+ request,
20770
+ callback,
20771
+ ) {
20402
20772
  logger.log('reportMessageWithPayloadData is deprecated');
20403
20773
  return this.error(message, request, payloadData, callback);
20404
20774
  };
20405
- Rollbar.reportMessageWithPayloadData = function (message, payloadData, request, callback) {
20775
+ Rollbar.reportMessageWithPayloadData = function (
20776
+ message,
20777
+ payloadData,
20778
+ request,
20779
+ callback,
20780
+ ) {
20406
20781
  if (_instance) {
20407
- return _instance.reportMessageWithPayloadData(message, payloadData, request, callback);
20782
+ return _instance.reportMessageWithPayloadData(
20783
+ message,
20784
+ payloadData,
20785
+ request,
20786
+ callback,
20787
+ );
20408
20788
  } else {
20409
20789
  handleUninitialized(callback);
20410
20790
  }
20411
20791
  };
20412
20792
 
20413
-
20414
20793
  Rollbar.prototype.handleError = function (err, request, callback) {
20415
20794
  logger.log('handleError is deprecated');
20416
20795
  return this.error(err, request, callback);
@@ -20423,14 +20802,28 @@ function requireRollbar () {
20423
20802
  }
20424
20803
  };
20425
20804
 
20426
-
20427
- Rollbar.prototype.handleErrorWithPayloadData = function (err, payloadData, request, callback) {
20805
+ Rollbar.prototype.handleErrorWithPayloadData = function (
20806
+ err,
20807
+ payloadData,
20808
+ request,
20809
+ callback,
20810
+ ) {
20428
20811
  logger.log('handleErrorWithPayloadData is deprecated');
20429
20812
  return this.error(err, request, payloadData, callback);
20430
20813
  };
20431
- Rollbar.handleErrorWithPayloadData = function (err, payloadData, request, callback) {
20814
+ Rollbar.handleErrorWithPayloadData = function (
20815
+ err,
20816
+ payloadData,
20817
+ request,
20818
+ callback,
20819
+ ) {
20432
20820
  if (_instance) {
20433
- return _instance.handleErrorWithPayloadData(err, payloadData, request, callback);
20821
+ return _instance.handleErrorWithPayloadData(
20822
+ err,
20823
+ payloadData,
20824
+ request,
20825
+ callback,
20826
+ );
20434
20827
  } else {
20435
20828
  handleUninitialized(callback);
20436
20829
  }
@@ -20456,7 +20849,10 @@ function requireRollbar () {
20456
20849
  }
20457
20850
  };
20458
20851
 
20459
- Rollbar.handleUncaughtExceptionsAndRejections = function (accessToken, options) {
20852
+ Rollbar.handleUncaughtExceptionsAndRejections = function (
20853
+ accessToken,
20854
+ options,
20855
+ ) {
20460
20856
  if (_instance) {
20461
20857
  options = options || {};
20462
20858
  options.accessToken = accessToken;
@@ -20519,7 +20915,10 @@ function requireRollbar () {
20519
20915
  if (this.options.captureUncaught || this.options.handleUncaughtExceptions) {
20520
20916
  this.handleUncaughtExceptions();
20521
20917
  }
20522
- if (this.options.captureUnhandledRejections || this.options.handleUnhandledRejections) {
20918
+ if (
20919
+ this.options.captureUnhandledRejections ||
20920
+ this.options.handleUnhandledRejections
20921
+ ) {
20523
20922
  this.handleUnhandledRejections();
20524
20923
  }
20525
20924
  };
@@ -20528,40 +20927,58 @@ function requireRollbar () {
20528
20927
  var exitOnUncaught = !!this.options.exitOnUncaughtException;
20529
20928
  delete this.options.exitOnUncaughtException;
20530
20929
 
20531
- addOrReplaceRollbarHandler('uncaughtException', function (err) {
20532
- if (!this.options.captureUncaught && !this.options.handleUncaughtExceptions) {
20533
- return;
20534
- }
20930
+ addOrReplaceRollbarHandler(
20931
+ 'uncaughtException',
20932
+ function (err) {
20933
+ if (
20934
+ !this.options.captureUncaught &&
20935
+ !this.options.handleUncaughtExceptions
20936
+ ) {
20937
+ return;
20938
+ }
20535
20939
 
20536
- this._uncaughtError(err, function (err) {
20537
- if (err) {
20538
- logger.error('Encountered error while handling an uncaught exception.');
20539
- logger.error(err);
20940
+ this._uncaughtError(err, function (err) {
20941
+ if (err) {
20942
+ logger.error(
20943
+ 'Encountered error while handling an uncaught exception.',
20944
+ );
20945
+ logger.error(err);
20946
+ }
20947
+ });
20948
+ if (exitOnUncaught) {
20949
+ setImmediate(
20950
+ function () {
20951
+ this.wait(function () {
20952
+ process.exit(1);
20953
+ });
20954
+ }.bind(this),
20955
+ );
20540
20956
  }
20541
- });
20542
- if (exitOnUncaught) {
20543
- setImmediate(function () {
20544
- this.wait(function () {
20545
- process.exit(1);
20546
- });
20547
- }.bind(this));
20548
- }
20549
- }.bind(this));
20957
+ }.bind(this),
20958
+ );
20550
20959
  };
20551
20960
 
20552
20961
  Rollbar.prototype.handleUnhandledRejections = function () {
20553
- addOrReplaceRollbarHandler('unhandledRejection', function (reason) {
20554
- if (!this.options.captureUnhandledRejections && !this.options.handleUnhandledRejections) {
20555
- return;
20556
- }
20557
-
20558
- this._uncaughtError(reason, function (err) {
20559
- if (err) {
20560
- logger.error('Encountered error while handling an uncaught exception.');
20561
- logger.error(err);
20962
+ addOrReplaceRollbarHandler(
20963
+ 'unhandledRejection',
20964
+ function (reason) {
20965
+ if (
20966
+ !this.options.captureUnhandledRejections &&
20967
+ !this.options.handleUnhandledRejections
20968
+ ) {
20969
+ return;
20562
20970
  }
20563
- });
20564
- }.bind(this));
20971
+
20972
+ this._uncaughtError(reason, function (err) {
20973
+ if (err) {
20974
+ logger.error(
20975
+ 'Encountered error while handling an uncaught exception.',
20976
+ );
20977
+ logger.error(err);
20978
+ }
20979
+ });
20980
+ }.bind(this),
20981
+ );
20565
20982
  };
20566
20983
 
20567
20984
  function addOrReplaceRollbarHandler(event, action) {
@@ -20600,7 +21017,7 @@ function requireRollbar () {
20600
21017
  showReportedMessageTraces: false,
20601
21018
  notifier: {
20602
21019
  name: 'node_rollbar',
20603
- version: packageJson.version
21020
+ version: packageJson.version,
20604
21021
  },
20605
21022
  scrubHeaders: packageJson.defaults.server.scrubHeaders,
20606
21023
  scrubFields: packageJson.defaults.server.scrubFields,
@@ -20617,7 +21034,7 @@ function requireRollbar () {
20617
21034
  captureLambdaTimeouts: true,
20618
21035
  ignoreDuplicateErrors: true,
20619
21036
  scrubRequestBody: true,
20620
- autoInstrument: false
21037
+ autoInstrument: false,
20621
21038
  };
20622
21039
 
20623
21040
  rollbar = Rollbar;
@@ -20884,8 +21301,56 @@ async function resolveFiles() {
20884
21301
  }
20885
21302
  }
20886
21303
 
21304
+ async function getWorkspaces(ctx, token, workspaceSpinner) {
21305
+ var _a, _b;
21306
+ try {
21307
+ const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
21308
+ headers: {
21309
+ Authorization: `Bearer ${token}`,
21310
+ },
21311
+ });
21312
+ return (_a = response.data) === null || _a === void 0 ? void 0 : _a.filter((w) => !w.devWorkspace);
21313
+ }
21314
+ catch (e) {
21315
+ if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
21316
+ workspaceSpinner.fail('Unauthorized. Please login using "embeddable login" command.');
21317
+ }
21318
+ else {
21319
+ workspaceSpinner.fail("Failed to fetch workspaces");
21320
+ }
21321
+ process.exit(1);
21322
+ }
21323
+ }
21324
+ async function selectWorkspace(ora, ctx, token) {
21325
+ const workspaceSpinner = ora({
21326
+ text: `Fetching workspaces using ${ctx.pushBaseUrl}...`,
21327
+ color: "green",
21328
+ discardStdin: false,
21329
+ }).start();
21330
+ const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
21331
+ let selectedWorkspace;
21332
+ if (availableWorkspaces.length === 0) {
21333
+ workspaceSpinner.fail("No workspaces found");
21334
+ process.exit(1);
21335
+ }
21336
+ workspaceSpinner.info(`Found ${availableWorkspaces.length} workspace(s)`);
21337
+ if (availableWorkspaces.length === 1) {
21338
+ selectedWorkspace = availableWorkspaces[0];
21339
+ }
21340
+ else {
21341
+ selectedWorkspace = await prompts.select({
21342
+ message: "Select workspace to push changes",
21343
+ choices: availableWorkspaces.map((workspace) => ({
21344
+ name: `${workspace.name} (${workspace.workspaceId})`,
21345
+ value: workspace,
21346
+ })),
21347
+ });
21348
+ }
21349
+ workspaceSpinner.succeed(`Workspace: ${selectedWorkspace.name} (${selectedWorkspace.workspaceId})`);
21350
+ return selectedWorkspace;
21351
+ }
21352
+
20887
21353
  const oraP$1 = import('ora');
20888
- const inquirerSelect = import('@inquirer/select');
20889
21354
  // grab .cube.yml|js and .sc.yml|js files
20890
21355
  const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
20891
21356
  // grab all files in self-serve-customization folder
@@ -20914,7 +21379,7 @@ var push = async () => {
20914
21379
  spinnerPushing = ora$1()
20915
21380
  .start()
20916
21381
  .info("No API Key provided. Standard login will be used.");
20917
- const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
21382
+ const { workspaceId, name: workspaceName } = await selectWorkspace(ora$1, config, token);
20918
21383
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
20919
21384
  await buildArchive(config);
20920
21385
  spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
@@ -20953,35 +21418,6 @@ async function pushByApiKey(config, spinner) {
20953
21418
  message,
20954
21419
  });
20955
21420
  }
20956
- async function selectWorkspace(ctx, token) {
20957
- const workspaceSpinner = ora$1({
20958
- text: `Fetching workspaces using ${ctx.pushBaseUrl}...`,
20959
- color: "green",
20960
- discardStdin: false,
20961
- }).start();
20962
- const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
20963
- let selectedWorkspace;
20964
- if (availableWorkspaces.length === 0) {
20965
- workspaceSpinner.fail("No workspaces found");
20966
- process.exit(1);
20967
- }
20968
- workspaceSpinner.info(`Found ${availableWorkspaces.length} workspace(s)`);
20969
- if (availableWorkspaces.length === 1) {
20970
- selectedWorkspace = availableWorkspaces[0];
20971
- }
20972
- else {
20973
- const select = (await inquirerSelect).default;
20974
- selectedWorkspace = await select({
20975
- message: "Select workspace to push changes",
20976
- choices: availableWorkspaces.map((workspace) => ({
20977
- name: `${workspace.name} (${workspace.workspaceId})`,
20978
- value: workspace,
20979
- })),
20980
- });
20981
- }
20982
- workspaceSpinner.succeed(`Workspace: ${selectedWorkspace.name} (${selectedWorkspace.workspaceId})`);
20983
- return selectedWorkspace;
20984
- }
20985
21421
  async function verify(ctx) {
20986
21422
  try {
20987
21423
  await fs__namespace.access(ctx.client.buildDir);
@@ -21071,26 +21507,6 @@ async function uploadFile(formData, url, token) {
21071
21507
  maxBodyLength: Infinity,
21072
21508
  });
21073
21509
  }
21074
- async function getWorkspaces(ctx, token, workspaceSpinner) {
21075
- var _a;
21076
- try {
21077
- const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
21078
- headers: {
21079
- Authorization: `Bearer ${token}`,
21080
- },
21081
- });
21082
- return (_a = response.data) === null || _a === void 0 ? void 0 : _a.filter((w) => !w.devWorkspace);
21083
- }
21084
- catch (e) {
21085
- if (e.response.status === 401) {
21086
- workspaceSpinner.fail('Unauthorized. Please login using "embeddable login" command.');
21087
- }
21088
- else {
21089
- workspaceSpinner.fail("Failed to fetch workspaces");
21090
- }
21091
- process.exit(1);
21092
- }
21093
- }
21094
21510
 
21095
21511
  const minimist = require("minimist");
21096
21512
  const oraP = import('ora');
@@ -21118,21 +21534,14 @@ const addToGitingore = async () => {
21118
21534
  // ignore
21119
21535
  }
21120
21536
  };
21121
- const chokidarWatchOptions = {
21122
- ignoreInitial: true,
21123
- usePolling: false, // Ensure polling is disabled
21124
- awaitWriteFinish: {
21125
- stabilityThreshold: 200,
21126
- pollInterval: 100,
21127
- },
21128
- };
21129
21537
  var dev = async () => {
21130
- var _a;
21538
+ var _a, _b;
21131
21539
  checkNodeVersion();
21132
21540
  addToGitingore();
21541
+ const http = require("http");
21133
21542
  ora = (await oraP).default;
21134
21543
  process.on("warning", (e) => console.warn(e.stack));
21135
- const logger = node.createNodeLogger();
21544
+ const logger = node.createNodeLogger({ process });
21136
21545
  const sys = node.createNodeSys({ process });
21137
21546
  const defaultConfig = await provideConfig();
21138
21547
  const buildDir = path__namespace$1.resolve(defaultConfig.client.rootDir, BUILD_DEV_DIR);
@@ -21158,14 +21567,14 @@ var dev = async () => {
21158
21567
  const serveSelfeServe = serveStatic(config.client.selfServeCustomizationDir);
21159
21568
  const workspacePreparation = ora("Preparing workspace...").start();
21160
21569
  try {
21161
- previewWorkspace = await getPreviewWorkspace(config);
21570
+ previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
21162
21571
  }
21163
21572
  catch (e) {
21164
- workspacePreparation.fail((_a = e.response.data) === null || _a === void 0 ? void 0 : _a.errorMessage);
21573
+ workspacePreparation.fail(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorMessage) || "Unknown error: " + e.message);
21165
21574
  process.exit(1);
21166
21575
  }
21167
21576
  workspacePreparation.succeed("Workspace is ready");
21168
- const server = http__namespace.createServer((request, res) => {
21577
+ const server = http.createServer((request, res) => {
21169
21578
  var _a, _b;
21170
21579
  res.setHeader("Access-Control-Allow-Origin", "*");
21171
21580
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
@@ -21263,7 +21672,9 @@ const onBundleBuildEnd = async (ctx) => {
21263
21672
  }
21264
21673
  };
21265
21674
  const dataModelAndSecurityContextWatcher = (ctx) => {
21266
- const fsWatcher = chokidar__namespace.watch([path__namespace$1.resolve(ctx.client.modelsSrc, "**/*.{cube,sc}.{yaml,yml,js}")], chokidarWatchOptions);
21675
+ const fsWatcher = chokidar__namespace.watch([path__namespace$1.resolve(ctx.client.modelsSrc, "**/*.{cube,sc}.{yaml,yml,js}")], {
21676
+ ignoreInitial: true,
21677
+ });
21267
21678
  fsWatcher.on("all", async () => {
21268
21679
  await sendDataModelsAndSecurityContextsChanges(ctx);
21269
21680
  });
@@ -21273,7 +21684,9 @@ const customSelfServeWatcher = (ctx) => {
21273
21684
  const fsWatcher = chokidar__namespace.watch([
21274
21685
  path__namespace$1.resolve(ctx.client.selfServeCustomizationDir, "style.css"),
21275
21686
  path__namespace$1.resolve(ctx.client.selfServeCustomizationDir, "*.svg"),
21276
- ], chokidarWatchOptions);
21687
+ ], {
21688
+ ignoreInitial: true,
21689
+ });
21277
21690
  fsWatcher.on("all", async () => {
21278
21691
  sendMessage("customSelfServeUpdateSuccess");
21279
21692
  });
@@ -21317,10 +21730,16 @@ const onClose = async (server, sys, watchers, config) => {
21317
21730
  await sys.destroy();
21318
21731
  process.exit(0);
21319
21732
  };
21320
- const getPreviewWorkspace = async (ctx) => {
21733
+ const getPreviewWorkspace = async (startedOra, ctx) => {
21321
21734
  const token = await getToken();
21322
21735
  const params = minimist(process.argv.slice(2));
21323
- const primaryWorkspace = params.w || params.workspace;
21736
+ let primaryWorkspace = params.w || params.workspace;
21737
+ if (!primaryWorkspace) {
21738
+ startedOra.stop(); // Stop current Ora, otherwise the last option will get hidden by it.
21739
+ const { workspaceId } = await selectWorkspace(ora, ctx, token);
21740
+ primaryWorkspace = workspaceId;
21741
+ startedOra.start();
21742
+ }
21324
21743
  try {
21325
21744
  const response = await axios.get(`${ctx.pushBaseUrl}/workspace/dev-workspace`, {
21326
21745
  params: { primaryWorkspace },
@@ -21334,7 +21753,7 @@ const getPreviewWorkspace = async (ctx) => {
21334
21753
  if (e.response.status === 401) {
21335
21754
  // login and retry
21336
21755
  await login();
21337
- return await getPreviewWorkspace(ctx);
21756
+ return await getPreviewWorkspace(startedOra, ctx);
21338
21757
  }
21339
21758
  else {
21340
21759
  throw e;
@@ -21395,7 +21814,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
21395
21814
  };
21396
21815
 
21397
21816
  var name = "@embeddable.com/sdk-core";
21398
- var version = "3.8.0-next.0";
21817
+ var version = "3.8.0";
21399
21818
  var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
21400
21819
  var keywords = [
21401
21820
  "embeddable",
@@ -21429,14 +21848,14 @@ var bin = {
21429
21848
  embeddable: "bin/embeddable"
21430
21849
  };
21431
21850
  var engines = {
21432
- node: ">=18.0.0"
21851
+ node: ">=20.0.0"
21433
21852
  };
21434
21853
  var license = "MIT";
21435
21854
  var dependencies = {
21436
21855
  "@embeddable.com/sdk-utils": "*",
21437
- "@inquirer/select": "^1.3.0",
21438
- "@stencil/core": "^4.18.2",
21439
- "@swc-node/register": "^1.10.9",
21856
+ "@inquirer/prompts": "^7.0.0",
21857
+ "@stencil/core": "^4.22.0",
21858
+ "@swc-node/register": "^1.9.0",
21440
21859
  archiver: "^5.3.1",
21441
21860
  axios: "^1.7.2",
21442
21861
  chokidar: "^3.6.0",
@@ -21447,7 +21866,7 @@ var dependencies = {
21447
21866
  ora: "^8.0.1",
21448
21867
  "serve-static": "^1.15.0",
21449
21868
  sorcery: "^0.11.0",
21450
- vite: "^5.3.2",
21869
+ vite: "^5.4.8",
21451
21870
  ws: "^8.17.0",
21452
21871
  yaml: "^2.3.3"
21453
21872
  };