@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.esm.js CHANGED
@@ -22,7 +22,7 @@ import * as path$1 from 'path';
22
22
  import path__default$1, { basename } from 'path';
23
23
  import axios from 'axios';
24
24
  import * as archiver from 'archiver';
25
- import * as http from 'node:http';
25
+ import { select } from '@inquirer/prompts';
26
26
  import { WebSocketServer } from 'ws';
27
27
  import * as chokidar from 'chokidar';
28
28
  import { stat } from 'fs/promises';
@@ -477,8 +477,8 @@ async function addComponentTagName(filePath, bundleHash) {
477
477
  ]);
478
478
  }
479
479
  async function runStencil(ctx) {
480
- var _a, _b;
481
- const logger = ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.logger) || createNodeLogger();
480
+ var _a, _b, _c;
481
+ const logger = ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.logger) || createNodeLogger({ process });
482
482
  const sys = ((_b = ctx.dev) === null || _b === void 0 ? void 0 : _b.sys) || createNodeSys({ process });
483
483
  const devMode = !!ctx.dev;
484
484
  const isWindows = process.platform === "win32";
@@ -488,54 +488,24 @@ async function runStencil(ctx) {
488
488
  sys,
489
489
  config: {
490
490
  devMode,
491
- enableCache: true,
492
491
  maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
493
492
  rootDir: ctx.client.buildDir,
494
493
  configPath: path.resolve(ctx.client.buildDir, "stencil.config.ts"),
495
494
  tsconfig: path.resolve(ctx.client.buildDir, "tsconfig.json"),
496
495
  namespace: "embeddable-wrapper",
497
496
  srcDir: path.resolve(ctx.client.buildDir, "component"),
498
- sourceMap: !devMode,
499
- minifyJs: !devMode,
500
- minifyCss: !devMode,
501
497
  outputTargets: [
502
498
  {
503
499
  type: "dist",
504
500
  },
505
501
  ],
506
- watchDirs: [
507
- path.resolve(ctx.client.buildDir, ctx["sdk-react"].outputOptions.buildName),
508
- ],
509
502
  },
510
503
  });
511
504
  const compiler = await createCompiler(validated.config);
512
- const buildResults = await compiler.build();
513
- if (devMode) {
514
- // Handle process exit to clean up resources
515
- const cleanUp = async () => {
516
- await compiler.destroy();
517
- process.exit(0);
518
- };
519
- process.on("SIGINT", cleanUp);
520
- process.on("SIGTERM", cleanUp);
521
- }
522
- else {
523
- if (buildResults.hasError) {
524
- console.error("Stencil build error:", buildResults.diagnostics);
525
- throw new Error("Stencil build error");
526
- }
527
- else {
528
- await handleStencilBuildOutput(ctx);
529
- }
530
- await compiler.destroy();
531
- }
532
- process.chdir(ctx.client.rootDir);
533
- }
534
- async function handleStencilBuildOutput(ctx) {
535
- var _a;
505
+ await compiler.build();
536
506
  const entryFilePath = path.resolve(ctx.client.stencilBuild, "embeddable-wrapper.esm.js");
537
507
  let fileName = "embeddable-wrapper.esm.js";
538
- if (!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
508
+ if (!((_c = ctx.dev) === null || _c === void 0 ? void 0 : _c.watch)) {
539
509
  const entryFileContent = await fs.readFile(entryFilePath, "utf8");
540
510
  const fileHash = getContentHash(entryFileContent);
541
511
  fileName = `embeddable-wrapper.esm-${fileHash}.js`;
@@ -543,6 +513,8 @@ async function handleStencilBuildOutput(ctx) {
543
513
  await addComponentTagName(entryFilePath, ctx.client.bundleHash);
544
514
  }
545
515
  await fs.rename(entryFilePath, path.resolve(ctx.client.stencilBuild, fileName));
516
+ await compiler.destroy();
517
+ process.chdir(ctx.client.rootDir);
546
518
  }
547
519
  async function generateSourceMap(ctx, pluginName) {
548
520
  const componentBuildDir = path.resolve(ctx.client.buildDir, ctx[pluginName].outputOptions.buildName);
@@ -568,10 +540,9 @@ const CREDENTIALS_DIR = path.resolve(os.homedir(), ".embeddable");
568
540
  const CREDENTIALS_FILE = path.resolve(CREDENTIALS_DIR, "credentials");
569
541
 
570
542
  const oraP$3 = import('ora');
571
- let ora$2;
572
543
  const checkNodeVersion = async () => {
573
- ora$2 = (await oraP$3).default;
574
- const spinner = ora$2("Checking node version...");
544
+ const ora = (await oraP$3).default;
545
+ const spinner = ora("Checking node version...").start();
575
546
  const [major, minor] = process.versions.node.split(".").map(Number);
576
547
  const packageJson = await Promise.resolve().then(function () { return _package$1; });
577
548
  const { engines: { node }, } = packageJson;
@@ -580,13 +551,11 @@ const checkNodeVersion = async () => {
580
551
  .map((v) => v.replace(/[^\d]/g, ""))
581
552
  .map(Number);
582
553
  if (major < minMajor || (major === minMajor && minor < minMinor)) {
583
- spinner.fail({
584
- text: `Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`,
585
- color: "red",
586
- });
554
+ spinner.fail(`Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`);
587
555
  process.exit(1);
588
556
  }
589
557
  else {
558
+ spinner.stop();
590
559
  return true;
591
560
  }
592
561
  };
@@ -5159,7 +5128,7 @@ function getAugmentedNamespace(n) {
5159
5128
  }
5160
5129
 
5161
5130
  var name$1 = "rollbar";
5162
- var version$1 = "2.26.2";
5131
+ var version$1 = "2.26.4";
5163
5132
  var repository$1 = {
5164
5133
  type: "git",
5165
5134
  url: "http://github.com/rollbar/rollbar.js"
@@ -5186,37 +5155,35 @@ var dependencies$1 = {
5186
5155
  "source-map": "^0.5.7"
5187
5156
  };
5188
5157
  var devDependencies$1 = {
5189
- "babel-core": "^6.26.3",
5158
+ "@babel/core": "^7.22.11",
5190
5159
  "babel-eslint": "^10.0.3",
5191
5160
  "babel-loader": "^8.0.4",
5192
5161
  bluebird: "^3.3.5",
5193
- "browserstack-api": "0.0.5",
5194
5162
  chai: "^4.2.0",
5195
5163
  chalk: "^1.1.1",
5164
+ "coverage-istanbul-loader": "^3.0.5",
5196
5165
  eslint: "^6.8.0",
5197
5166
  "eslint-loader": "^3.0.3",
5198
- express: "^4.16.4",
5167
+ express: "^4.18.2",
5199
5168
  glob: "^5.0.14",
5200
5169
  grunt: "^1.1.0",
5201
5170
  "grunt-bumpup": "^0.6.3",
5202
5171
  "grunt-cli": "^1.3.2",
5203
- "grunt-contrib-concat": "~0.3.0",
5172
+ "grunt-contrib-concat": "^2.1.0",
5204
5173
  "grunt-contrib-connect": "^2.1.0",
5205
- "grunt-contrib-copy": "~0.5.0",
5206
- "grunt-contrib-jshint": "^2.1.0",
5174
+ "grunt-contrib-copy": "^1.0.0",
5175
+ "grunt-contrib-jshint": "^3.2.0",
5207
5176
  "grunt-contrib-uglify": "^4.0.0",
5208
5177
  "grunt-contrib-watch": "^1.1.0",
5209
- "grunt-karma": "^3.0.2",
5178
+ "grunt-karma": "^4.0.2",
5210
5179
  "grunt-parallel": "^0.5.1",
5211
5180
  "grunt-text-replace": "^0.4.0",
5212
5181
  "grunt-vows": "^0.4.2",
5213
- "grunt-webpack": "^3.1.3",
5214
- "istanbul-instrumenter-loader": "^3.0.1",
5182
+ "grunt-webpack": "^5.0.0",
5215
5183
  jade: "~0.27.7",
5216
5184
  "jasmine-core": "^2.3.4",
5217
5185
  "jquery-mockjax": "^2.5.0",
5218
- karma: "^5.0.4",
5219
- "karma-browserstack-launcher": "^1.5.1",
5186
+ karma: "^6.4.2",
5220
5187
  "karma-chai": "^0.1.0",
5221
5188
  "karma-chrome-launcher": "^2.2.0",
5222
5189
  "karma-expect": "^1.1.0",
@@ -5229,12 +5196,12 @@ var devDependencies$1 = {
5229
5196
  "karma-safari-launcher": "^0.1.1",
5230
5197
  "karma-sinon": "^1.0.4",
5231
5198
  "karma-sourcemap-loader": "^0.3.5",
5232
- "karma-webpack": "^4.0.2",
5233
- mocha: "^7.1.2",
5199
+ "karma-webpack": "^5.0.0",
5200
+ mocha: "^10.2.0",
5234
5201
  natives: "^1.1.6",
5235
5202
  nock: "^11.9.1",
5236
5203
  "node-libs-browser": "^0.5.2",
5237
- request: "^2.88.0",
5204
+ prettier: "^3.2.5",
5238
5205
  requirejs: "^2.1.20",
5239
5206
  "script-loader": "0.6.1",
5240
5207
  sinon: "^8.1.1",
@@ -5242,7 +5209,7 @@ var devDependencies$1 = {
5242
5209
  "strict-loader": "^1.2.0",
5243
5210
  "time-grunt": "^1.0.0",
5244
5211
  vows: "^0.8.3",
5245
- webpack: "^4.46.0"
5212
+ webpack: "^5.88.2"
5246
5213
  };
5247
5214
  var optionalDependencies = {
5248
5215
  decache: "^3.0.5"
@@ -5350,32 +5317,41 @@ function requireMerge () {
5350
5317
  var toStr = Object.prototype.toString;
5351
5318
 
5352
5319
  var isPlainObject = function isPlainObject(obj) {
5353
- if (!obj || toStr.call(obj) !== '[object Object]') {
5354
- return false;
5355
- }
5320
+ if (!obj || toStr.call(obj) !== '[object Object]') {
5321
+ return false;
5322
+ }
5356
5323
 
5357
- var hasOwnConstructor = hasOwn.call(obj, 'constructor');
5358
- var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
5359
- // Not own constructor property must be Object
5360
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
5361
- return false;
5362
- }
5324
+ var hasOwnConstructor = hasOwn.call(obj, 'constructor');
5325
+ var hasIsPrototypeOf =
5326
+ obj.constructor &&
5327
+ obj.constructor.prototype &&
5328
+ hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
5329
+ // Not own constructor property must be Object
5330
+ if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
5331
+ return false;
5332
+ }
5363
5333
 
5364
- // Own properties are enumerated firstly, so to speed up,
5365
- // if last one is own, then all properties are own.
5366
- var key;
5367
- for (key in obj) {/**/}
5334
+ // Own properties are enumerated firstly, so to speed up,
5335
+ // if last one is own, then all properties are own.
5336
+ var key;
5337
+ for (key in obj) {
5338
+ /**/
5339
+ }
5368
5340
 
5369
- return typeof key === 'undefined' || hasOwn.call(obj, key);
5341
+ return typeof key === 'undefined' || hasOwn.call(obj, key);
5370
5342
  };
5371
5343
 
5372
5344
  function merge() {
5373
- var i, src, copy, clone, name,
5374
- result = {},
5375
- current = null,
5376
- length = arguments.length;
5377
-
5378
- for (i=0; i < length; i++) {
5345
+ var i,
5346
+ src,
5347
+ copy,
5348
+ clone,
5349
+ name,
5350
+ result = {},
5351
+ current = null,
5352
+ length = arguments.length;
5353
+
5354
+ for (i = 0; i < length; i++) {
5379
5355
  current = arguments[i];
5380
5356
  if (current == null) {
5381
5357
  continue;
@@ -5417,14 +5393,15 @@ function requireUtility () {
5417
5393
 
5418
5394
  if (isDefined(JSON)) {
5419
5395
  // If polyfill is provided, prefer it over existing non-native shims.
5420
- if(polyfillJSON) {
5396
+ if (polyfillJSON) {
5421
5397
  if (isNativeFunction(JSON.stringify)) {
5422
5398
  RollbarJSON.stringify = JSON.stringify;
5423
5399
  }
5424
5400
  if (isNativeFunction(JSON.parse)) {
5425
5401
  RollbarJSON.parse = JSON.parse;
5426
5402
  }
5427
- } else { // else accept any interface that is present.
5403
+ } else {
5404
+ // else accept any interface that is present.
5428
5405
  if (isFunction(JSON.stringify)) {
5429
5406
  RollbarJSON.stringify = JSON.stringify;
5430
5407
  }
@@ -5474,7 +5451,10 @@ function requireUtility () {
5474
5451
  if (x instanceof Error) {
5475
5452
  return 'error';
5476
5453
  }
5477
- return ({}).toString.call(x).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
5454
+ return {}.toString
5455
+ .call(x)
5456
+ .match(/\s([a-zA-Z]+)/)[1]
5457
+ .toLowerCase();
5478
5458
  }
5479
5459
 
5480
5460
  /* isFunction - a convenience function for checking if a value is a function
@@ -5493,7 +5473,8 @@ function requireUtility () {
5493
5473
  */
5494
5474
  function isNativeFunction(f) {
5495
5475
  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
5496
- var funcMatchString = Function.prototype.toString.call(Object.prototype.hasOwnProperty)
5476
+ var funcMatchString = Function.prototype.toString
5477
+ .call(Object.prototype.hasOwnProperty)
5497
5478
  .replace(reRegExpChar, '\\$&')
5498
5479
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?');
5499
5480
  var reIsNative = RegExp('^' + funcMatchString + '$');
@@ -5504,7 +5485,7 @@ function requireUtility () {
5504
5485
  *
5505
5486
  * @param value - any value
5506
5487
  * @returns true is value is an object function is an object)
5507
- */
5488
+ */
5508
5489
  function isObject(value) {
5509
5490
  var type = typeof value;
5510
5491
  return value != null && (type == 'object' || type == 'function');
@@ -5514,9 +5495,9 @@ function requireUtility () {
5514
5495
  *
5515
5496
  * @param value - any value
5516
5497
  * @returns true if value is a string
5517
- */
5498
+ */
5518
5499
  function isString(value) {
5519
- return typeof value === 'string' || value instanceof String
5500
+ return typeof value === 'string' || value instanceof String;
5520
5501
  }
5521
5502
 
5522
5503
  /**
@@ -5525,7 +5506,7 @@ function requireUtility () {
5525
5506
  * @param {*} n - any value
5526
5507
  * @returns true if value is a finite number
5527
5508
  */
5528
- function isFiniteNumber(n) {
5509
+ function isFiniteNumber(n) {
5529
5510
  return Number.isFinite(n);
5530
5511
  }
5531
5512
 
@@ -5548,7 +5529,7 @@ function requireUtility () {
5548
5529
  */
5549
5530
  function isIterable(i) {
5550
5531
  var type = typeName(i);
5551
- return (type === 'object' || type === 'array');
5532
+ return type === 'object' || type === 'array';
5552
5533
  }
5553
5534
 
5554
5535
  /*
@@ -5578,11 +5559,14 @@ function requireUtility () {
5578
5559
  // from http://stackoverflow.com/a/8809472/1138191
5579
5560
  function uuid4() {
5580
5561
  var d = now();
5581
- var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
5582
- var r = (d + Math.random() * 16) % 16 | 0;
5583
- d = Math.floor(d / 16);
5584
- return (c === 'x' ? r : (r & 0x7 | 0x8)).toString(16);
5585
- });
5562
+ var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
5563
+ /[xy]/g,
5564
+ function (c) {
5565
+ var r = (d + Math.random() * 16) % 16 | 0;
5566
+ d = Math.floor(d / 16);
5567
+ return (c === 'x' ? r : (r & 0x7) | 0x8).toString(16);
5568
+ },
5569
+ );
5586
5570
  return uuid;
5587
5571
  }
5588
5572
 
@@ -5591,7 +5575,7 @@ function requireUtility () {
5591
5575
  info: 1,
5592
5576
  warning: 2,
5593
5577
  error: 3,
5594
- critical: 4
5578
+ critical: 4,
5595
5579
  };
5596
5580
 
5597
5581
  function sanitizeUrl(url) {
@@ -5625,16 +5609,18 @@ function requireUtility () {
5625
5609
  'directory',
5626
5610
  'file',
5627
5611
  'query',
5628
- 'anchor'
5612
+ 'anchor',
5629
5613
  ],
5630
5614
  q: {
5631
5615
  name: 'queryKey',
5632
- parser: /(?:^|&)([^&=]*)=?([^&]*)/g
5616
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g,
5633
5617
  },
5634
5618
  parser: {
5635
- strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
5636
- loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
5637
- }
5619
+ strict:
5620
+ /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
5621
+ loose:
5622
+ /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
5623
+ },
5638
5624
  };
5639
5625
 
5640
5626
  function parseUri(str) {
@@ -5679,11 +5665,11 @@ function requireUtility () {
5679
5665
  var p;
5680
5666
  if (qs !== -1 && (h === -1 || h > qs)) {
5681
5667
  p = options.path;
5682
- options.path = p.substring(0,qs) + query + '&' + p.substring(qs+1);
5668
+ options.path = p.substring(0, qs) + query + '&' + p.substring(qs + 1);
5683
5669
  } else {
5684
5670
  if (h !== -1) {
5685
5671
  p = options.path;
5686
- options.path = p.substring(0,h) + query + p.substring(h);
5672
+ options.path = p.substring(0, h) + query + p.substring(h);
5687
5673
  } else {
5688
5674
  options.path = options.path + query;
5689
5675
  }
@@ -5729,7 +5715,7 @@ function requireUtility () {
5729
5715
  error = jsonError;
5730
5716
  }
5731
5717
  }
5732
- return {error: error, value: value};
5718
+ return { error: error, value: value };
5733
5719
  }
5734
5720
 
5735
5721
  function maxByteSize(string) {
@@ -5747,11 +5733,14 @@ function requireUtility () {
5747
5733
 
5748
5734
  for (var i = 0; i < length; i++) {
5749
5735
  var code = string.charCodeAt(i);
5750
- if (code < 128) { // up to 7 bits
5736
+ if (code < 128) {
5737
+ // up to 7 bits
5751
5738
  count = count + 1;
5752
- } else if (code < 2048) { // up to 11 bits
5739
+ } else if (code < 2048) {
5740
+ // up to 11 bits
5753
5741
  count = count + 2;
5754
- } else if (code < 65536) { // up to 16 bits
5742
+ } else if (code < 65536) {
5743
+ // up to 16 bits
5755
5744
  count = count + 3;
5756
5745
  }
5757
5746
  }
@@ -5766,7 +5755,7 @@ function requireUtility () {
5766
5755
  } catch (e) {
5767
5756
  error = e;
5768
5757
  }
5769
- return {error: error, value: value};
5758
+ return { error: error, value: value };
5770
5759
  }
5771
5760
 
5772
5761
  function makeUnhandledStackInfo(
@@ -5777,28 +5766,36 @@ function requireUtility () {
5777
5766
  error,
5778
5767
  mode,
5779
5768
  backupMessage,
5780
- errorParser
5769
+ errorParser,
5781
5770
  ) {
5782
5771
  var location = {
5783
5772
  url: url || '',
5784
5773
  line: lineno,
5785
- column: colno
5774
+ column: colno,
5786
5775
  };
5787
5776
  location.func = errorParser.guessFunctionName(location.url, location.line);
5788
5777
  location.context = errorParser.gatherContext(location.url, location.line);
5789
- var href = typeof document !== 'undefined' && document && document.location && document.location.href;
5790
- var useragent = typeof window !== 'undefined' && window && window.navigator && window.navigator.userAgent;
5778
+ var href =
5779
+ typeof document !== 'undefined' &&
5780
+ document &&
5781
+ document.location &&
5782
+ document.location.href;
5783
+ var useragent =
5784
+ typeof window !== 'undefined' &&
5785
+ window &&
5786
+ window.navigator &&
5787
+ window.navigator.userAgent;
5791
5788
  return {
5792
- 'mode': mode,
5793
- 'message': error ? String(error) : (message || backupMessage),
5794
- 'url': href,
5795
- 'stack': [location],
5796
- 'useragent': useragent
5789
+ mode: mode,
5790
+ message: error ? String(error) : message || backupMessage,
5791
+ url: href,
5792
+ stack: [location],
5793
+ useragent: useragent,
5797
5794
  };
5798
5795
  }
5799
5796
 
5800
5797
  function wrapCallback(logger, f) {
5801
- return function(err, resp) {
5798
+ return function (err, resp) {
5802
5799
  try {
5803
5800
  f(err, resp);
5804
5801
  } catch (e) {
@@ -5811,7 +5808,10 @@ function requireUtility () {
5811
5808
  var seen = [obj];
5812
5809
 
5813
5810
  function clone(obj, seen) {
5814
- var value, name, newSeen, result = {};
5811
+ var value,
5812
+ name,
5813
+ newSeen,
5814
+ result = {};
5815
5815
 
5816
5816
  try {
5817
5817
  for (name in obj) {
@@ -5854,7 +5854,7 @@ function requireUtility () {
5854
5854
  case 'undefined':
5855
5855
  break;
5856
5856
  case 'string':
5857
- message ? extraArgs.push(arg) : message = arg;
5857
+ message ? extraArgs.push(arg) : (message = arg);
5858
5858
  break;
5859
5859
  case 'function':
5860
5860
  callback = wrapCallback(logger, arg);
@@ -5865,12 +5865,15 @@ function requireUtility () {
5865
5865
  case 'error':
5866
5866
  case 'domexception':
5867
5867
  case 'exception': // Firefox Exception type
5868
- err ? extraArgs.push(arg) : err = arg;
5868
+ err ? extraArgs.push(arg) : (err = arg);
5869
5869
  break;
5870
5870
  case 'object':
5871
5871
  case 'array':
5872
- if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
5873
- err ? extraArgs.push(arg) : err = arg;
5872
+ if (
5873
+ arg instanceof Error ||
5874
+ (typeof DOMException !== 'undefined' && arg instanceof DOMException)
5875
+ ) {
5876
+ err ? extraArgs.push(arg) : (err = arg);
5874
5877
  break;
5875
5878
  }
5876
5879
  if (requestKeys && typ === 'object' && !request) {
@@ -5884,11 +5887,14 @@ function requireUtility () {
5884
5887
  break;
5885
5888
  }
5886
5889
  }
5887
- custom ? extraArgs.push(arg) : custom = arg;
5890
+ custom ? extraArgs.push(arg) : (custom = arg);
5888
5891
  break;
5889
5892
  default:
5890
- if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
5891
- err ? extraArgs.push(arg) : err = arg;
5893
+ if (
5894
+ arg instanceof Error ||
5895
+ (typeof DOMException !== 'undefined' && arg instanceof DOMException)
5896
+ ) {
5897
+ err ? extraArgs.push(arg) : (err = arg);
5892
5898
  break;
5893
5899
  }
5894
5900
  extraArgs.push(arg);
@@ -5911,7 +5917,7 @@ function requireUtility () {
5911
5917
  callback: callback,
5912
5918
  notifier: notifier,
5913
5919
  diagnostic: diagnostic,
5914
- uuid: uuid4()
5920
+ uuid: uuid4(),
5915
5921
  };
5916
5922
 
5917
5923
  setCustomItemKeys(item, custom);
@@ -5959,7 +5965,14 @@ function requireUtility () {
5959
5965
  }
5960
5966
  }
5961
5967
 
5962
- var TELEMETRY_TYPES = ['log', 'network', 'dom', 'navigation', 'error', 'manual'];
5968
+ var TELEMETRY_TYPES = [
5969
+ 'log',
5970
+ 'network',
5971
+ 'dom',
5972
+ 'navigation',
5973
+ 'error',
5974
+ 'manual',
5975
+ ];
5963
5976
  var TELEMETRY_LEVELS = ['critical', 'error', 'warning', 'info', 'debug'];
5964
5977
 
5965
5978
  function arrayIncludes(arr, val) {
@@ -5996,7 +6009,7 @@ function requireUtility () {
5996
6009
  var event = {
5997
6010
  type: type || 'manual',
5998
6011
  metadata: metadata || {},
5999
- level: level
6012
+ level: level,
6000
6013
  };
6001
6014
 
6002
6015
  return event;
@@ -6046,7 +6059,7 @@ function requireUtility () {
6046
6059
  temp[keys[i]] = temp[keys[i]] || {};
6047
6060
  temp = temp[keys[i]];
6048
6061
  }
6049
- temp[keys[len-1]] = value;
6062
+ temp[keys[len - 1]] = value;
6050
6063
  obj[keys[0]] = replacement;
6051
6064
  } catch (e) {
6052
6065
  return;
@@ -6137,12 +6150,12 @@ function requireUtility () {
6137
6150
  }
6138
6151
 
6139
6152
  function updateDeprecatedOptions(options, logger) {
6140
- if(options.hostWhiteList && !options.hostSafeList) {
6153
+ if (options.hostWhiteList && !options.hostSafeList) {
6141
6154
  options.hostSafeList = options.hostWhiteList;
6142
6155
  options.hostWhiteList = undefined;
6143
6156
  logger && logger.log('hostWhiteList is deprecated. Use hostSafeList.');
6144
6157
  }
6145
- if(options.hostBlackList && !options.hostBlockList) {
6158
+ if (options.hostBlackList && !options.hostBlockList) {
6146
6159
  options.hostBlockList = options.hostBlackList;
6147
6160
  options.hostBlackList = undefined;
6148
6161
  logger && logger.log('hostBlackList is deprecated. Use hostBlockList.');
@@ -6182,7 +6195,7 @@ function requireUtility () {
6182
6195
  stringify: stringify,
6183
6196
  maxByteSize: maxByteSize,
6184
6197
  typeName: typeName,
6185
- uuid4: uuid4
6198
+ uuid4: uuid4,
6186
6199
  };
6187
6200
  return utility;
6188
6201
  }
@@ -6212,7 +6225,7 @@ function requireRateLimiter () {
6212
6225
  RateLimiter.globalSettings = {
6213
6226
  startTime: _.now(),
6214
6227
  maxItems: undefined,
6215
- itemsPerMinute: undefined
6228
+ itemsPerMinute: undefined,
6216
6229
  };
6217
6230
 
6218
6231
  /*
@@ -6223,7 +6236,7 @@ function requireRateLimiter () {
6223
6236
  * maxItems: the maximum items
6224
6237
  * itemsPerMinute: the max number of items to send in a given minute
6225
6238
  */
6226
- RateLimiter.prototype.configureGlobal = function(options) {
6239
+ RateLimiter.prototype.configureGlobal = function (options) {
6227
6240
  if (options.startTime !== undefined) {
6228
6241
  RateLimiter.globalSettings.startTime = options.startTime;
6229
6242
  }
@@ -6250,7 +6263,7 @@ function requireRateLimiter () {
6250
6263
  * means this item put us over the global rate limit and the payload should be sent to Rollbar in
6251
6264
  * place of the passed in item.
6252
6265
  */
6253
- RateLimiter.prototype.shouldSend = function(item, now) {
6266
+ RateLimiter.prototype.shouldSend = function (item, now) {
6254
6267
  now = now || _.now();
6255
6268
  var elapsedTime = now - this.startTime;
6256
6269
  if (elapsedTime < 0 || elapsedTime >= 60000) {
@@ -6262,20 +6275,39 @@ function requireRateLimiter () {
6262
6275
  var globalRateLimitPerMin = RateLimiter.globalSettings.itemsPerMinute;
6263
6276
 
6264
6277
  if (checkRate(item, globalRateLimit, this.counter)) {
6265
- return shouldSendValue(this.platform, this.platformOptions, globalRateLimit + ' max items reached', false);
6278
+ return shouldSendValue(
6279
+ this.platform,
6280
+ this.platformOptions,
6281
+ globalRateLimit + ' max items reached',
6282
+ false,
6283
+ );
6266
6284
  } else if (checkRate(item, globalRateLimitPerMin, this.perMinCounter)) {
6267
- return shouldSendValue(this.platform, this.platformOptions, globalRateLimitPerMin + ' items per minute reached', false);
6285
+ return shouldSendValue(
6286
+ this.platform,
6287
+ this.platformOptions,
6288
+ globalRateLimitPerMin + ' items per minute reached',
6289
+ false,
6290
+ );
6268
6291
  }
6269
6292
  this.counter++;
6270
6293
  this.perMinCounter++;
6271
6294
 
6272
6295
  var shouldSend = !checkRate(item, globalRateLimit, this.counter);
6273
6296
  var perMinute = shouldSend;
6274
- shouldSend = shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
6275
- return shouldSendValue(this.platform, this.platformOptions, null, shouldSend, globalRateLimit, globalRateLimitPerMin, perMinute);
6297
+ shouldSend =
6298
+ shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
6299
+ return shouldSendValue(
6300
+ this.platform,
6301
+ this.platformOptions,
6302
+ null,
6303
+ shouldSend,
6304
+ globalRateLimit,
6305
+ globalRateLimitPerMin,
6306
+ perMinute,
6307
+ );
6276
6308
  };
6277
6309
 
6278
- RateLimiter.prototype.setPlatformOptions = function(platform, options) {
6310
+ RateLimiter.prototype.setPlatformOptions = function (platform, options) {
6279
6311
  this.platform = platform;
6280
6312
  this.platformOptions = options;
6281
6313
  };
@@ -6286,19 +6318,40 @@ function requireRateLimiter () {
6286
6318
  return !item.ignoreRateLimit && limit >= 1 && counter > limit;
6287
6319
  }
6288
6320
 
6289
- function shouldSendValue(platform, options, error, shouldSend, globalRateLimit, limitPerMin, perMinute) {
6321
+ function shouldSendValue(
6322
+ platform,
6323
+ options,
6324
+ error,
6325
+ shouldSend,
6326
+ globalRateLimit,
6327
+ limitPerMin,
6328
+ perMinute,
6329
+ ) {
6290
6330
  var payload = null;
6291
6331
  if (error) {
6292
6332
  error = new Error(error);
6293
6333
  }
6294
6334
  if (!error && !shouldSend) {
6295
- payload = rateLimitPayload(platform, options, globalRateLimit, limitPerMin, perMinute);
6335
+ payload = rateLimitPayload(
6336
+ platform,
6337
+ options,
6338
+ globalRateLimit,
6339
+ limitPerMin,
6340
+ perMinute,
6341
+ );
6296
6342
  }
6297
- return {error: error, shouldSend: shouldSend, payload: payload};
6343
+ return { error: error, shouldSend: shouldSend, payload: payload };
6298
6344
  }
6299
6345
 
6300
- function rateLimitPayload(platform, options, globalRateLimit, limitPerMin, perMinute) {
6301
- var environment = options.environment || (options.payload && options.payload.environment);
6346
+ function rateLimitPayload(
6347
+ platform,
6348
+ options,
6349
+ globalRateLimit,
6350
+ limitPerMin,
6351
+ perMinute,
6352
+ ) {
6353
+ var environment =
6354
+ options.environment || (options.payload && options.payload.environment);
6302
6355
  var msg;
6303
6356
  if (perMinute) {
6304
6357
  msg = 'item per minute limit reached, ignoring errors until timeout';
@@ -6311,15 +6364,16 @@ function requireRateLimiter () {
6311
6364
  body: msg,
6312
6365
  extra: {
6313
6366
  maxItems: globalRateLimit,
6314
- itemsPerMinute: limitPerMin
6315
- }
6316
- }
6367
+ itemsPerMinute: limitPerMin,
6368
+ },
6369
+ },
6317
6370
  },
6318
6371
  language: 'javascript',
6319
6372
  environment: environment,
6320
6373
  notifier: {
6321
- version: (options.notifier && options.notifier.version) || options.version
6322
- }
6374
+ version:
6375
+ (options.notifier && options.notifier.version) || options.version,
6376
+ },
6323
6377
  };
6324
6378
  if (platform === 'browser') {
6325
6379
  item.platform = 'browser';
@@ -6379,7 +6433,7 @@ function requireQueue () {
6379
6433
  *
6380
6434
  * @param options
6381
6435
  */
6382
- Queue.prototype.configure = function(options) {
6436
+ Queue.prototype.configure = function (options) {
6383
6437
  this.api && this.api.configure(options);
6384
6438
  var oldOptions = this.options;
6385
6439
  this.options = _.merge(oldOptions, options);
@@ -6395,18 +6449,18 @@ function requireQueue () {
6395
6449
  * Returning {err: Error} means do not add the item to the queue, and the given error explains why
6396
6450
  * Returning {err: undefined} is equivalent to returning true but don't do that
6397
6451
  */
6398
- Queue.prototype.addPredicate = function(predicate) {
6452
+ Queue.prototype.addPredicate = function (predicate) {
6399
6453
  if (_.isFunction(predicate)) {
6400
6454
  this.predicates.push(predicate);
6401
6455
  }
6402
6456
  return this;
6403
6457
  };
6404
6458
 
6405
- Queue.prototype.addPendingItem = function(item) {
6459
+ Queue.prototype.addPendingItem = function (item) {
6406
6460
  this.pendingItems.push(item);
6407
6461
  };
6408
6462
 
6409
- Queue.prototype.removePendingItem = function(item) {
6463
+ Queue.prototype.removePendingItem = function (item) {
6410
6464
  var idx = this.pendingItems.indexOf(item);
6411
6465
  if (idx !== -1) {
6412
6466
  this.pendingItems.splice(idx, 1);
@@ -6423,9 +6477,16 @@ function requireQueue () {
6423
6477
  * to be an error condition, but nonetheless did not send the item to the API.
6424
6478
  * @param originalError - The original error before any transformations that is to be logged if any
6425
6479
  */
6426
- Queue.prototype.addItem = function(item, callback, originalError, originalItem) {
6480
+ Queue.prototype.addItem = function (
6481
+ item,
6482
+ callback,
6483
+ originalError,
6484
+ originalItem,
6485
+ ) {
6427
6486
  if (!callback || !_.isFunction(callback)) {
6428
- callback = function() { return; };
6487
+ callback = function () {
6488
+ return;
6489
+ };
6429
6490
  }
6430
6491
  var predicateResult = this._applyPredicates(item);
6431
6492
  if (predicateResult.stop) {
@@ -6441,10 +6502,13 @@ function requireQueue () {
6441
6502
  }
6442
6503
  this.pendingRequests.push(item);
6443
6504
  try {
6444
- this._makeApiRequest(item, function(err, resp) {
6445
- this._dequeuePendingRequest(item);
6446
- callback(err, resp);
6447
- }.bind(this));
6505
+ this._makeApiRequest(
6506
+ item,
6507
+ function (err, resp) {
6508
+ this._dequeuePendingRequest(item);
6509
+ callback(err, resp);
6510
+ }.bind(this),
6511
+ );
6448
6512
  } catch (e) {
6449
6513
  this._dequeuePendingRequest(item);
6450
6514
  callback(e);
@@ -6457,7 +6521,7 @@ function requireQueue () {
6457
6521
  *
6458
6522
  * @param callback - function() called when all pending items have been sent
6459
6523
  */
6460
- Queue.prototype.wait = function(callback) {
6524
+ Queue.prototype.wait = function (callback) {
6461
6525
  if (!_.isFunction(callback)) {
6462
6526
  return;
6463
6527
  }
@@ -6468,9 +6532,12 @@ function requireQueue () {
6468
6532
  if (this.waitIntervalID) {
6469
6533
  this.waitIntervalID = clearInterval(this.waitIntervalID);
6470
6534
  }
6471
- this.waitIntervalID = setInterval(function() {
6472
- this._maybeCallWait();
6473
- }.bind(this), 500);
6535
+ this.waitIntervalID = setInterval(
6536
+ function () {
6537
+ this._maybeCallWait();
6538
+ }.bind(this),
6539
+ 500,
6540
+ );
6474
6541
  };
6475
6542
 
6476
6543
  /* _applyPredicates - Sequentially applies the predicates that have been added to the queue to the
@@ -6480,15 +6547,15 @@ function requireQueue () {
6480
6547
  * @returns {stop: bool, err: (Error|null)} - stop being true means do not add item to the queue,
6481
6548
  * the error value should be passed up to a callbak if we are stopping.
6482
6549
  */
6483
- Queue.prototype._applyPredicates = function(item) {
6550
+ Queue.prototype._applyPredicates = function (item) {
6484
6551
  var p = null;
6485
6552
  for (var i = 0, len = this.predicates.length; i < len; i++) {
6486
6553
  p = this.predicates[i](item, this.options);
6487
6554
  if (!p || p.err !== undefined) {
6488
- return {stop: true, err: p.err};
6555
+ return { stop: true, err: p.err };
6489
6556
  }
6490
6557
  }
6491
- return {stop: false, err: null};
6558
+ return { stop: false, err: null };
6492
6559
  };
6493
6560
 
6494
6561
  /*
@@ -6498,16 +6565,19 @@ function requireQueue () {
6498
6565
  * @param item - an item ready to send to the backend
6499
6566
  * @param callback - function(err, response)
6500
6567
  */
6501
- Queue.prototype._makeApiRequest = function(item, callback) {
6568
+ Queue.prototype._makeApiRequest = function (item, callback) {
6502
6569
  var rateLimitResponse = this.rateLimiter.shouldSend(item);
6503
6570
  if (rateLimitResponse.shouldSend) {
6504
- this.api.postItem(item, function(err, resp) {
6505
- if (err) {
6506
- this._maybeRetry(err, item, callback);
6507
- } else {
6508
- callback(err, resp);
6509
- }
6510
- }.bind(this));
6571
+ this.api.postItem(
6572
+ item,
6573
+ function (err, resp) {
6574
+ if (err) {
6575
+ this._maybeRetry(err, item, callback);
6576
+ } else {
6577
+ callback(err, resp);
6578
+ }
6579
+ }.bind(this),
6580
+ );
6511
6581
  } else if (rateLimitResponse.error) {
6512
6582
  callback(rateLimitResponse.error);
6513
6583
  } else {
@@ -6516,7 +6586,16 @@ function requireQueue () {
6516
6586
  };
6517
6587
 
6518
6588
  // These are errors basically mean there is no internet connection
6519
- var RETRIABLE_ERRORS = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN'];
6589
+ var RETRIABLE_ERRORS = [
6590
+ 'ECONNRESET',
6591
+ 'ENOTFOUND',
6592
+ 'ESOCKETTIMEDOUT',
6593
+ 'ETIMEDOUT',
6594
+ 'ECONNREFUSED',
6595
+ 'EHOSTUNREACH',
6596
+ 'EPIPE',
6597
+ 'EAI_AGAIN',
6598
+ ];
6520
6599
 
6521
6600
  /*
6522
6601
  * _maybeRetry - Given the error returned by the API, decide if we should retry or just callback
@@ -6526,7 +6605,7 @@ function requireQueue () {
6526
6605
  * @param item - the item that was trying to be sent when this error occured
6527
6606
  * @param callback - function(err, response)
6528
6607
  */
6529
- Queue.prototype._maybeRetry = function(err, item, callback) {
6608
+ Queue.prototype._maybeRetry = function (err, item, callback) {
6530
6609
  var shouldRetry = false;
6531
6610
  if (this.options.retryInterval) {
6532
6611
  for (var i = 0, len = RETRIABLE_ERRORS.length; i < len; i++) {
@@ -6556,16 +6635,19 @@ function requireQueue () {
6556
6635
  * @param item - an item that failed to send due to an error we deem retriable
6557
6636
  * @param callback - function(err, response)
6558
6637
  */
6559
- Queue.prototype._retryApiRequest = function(item, callback) {
6560
- this.retryQueue.push({item: item, callback: callback});
6638
+ Queue.prototype._retryApiRequest = function (item, callback) {
6639
+ this.retryQueue.push({ item: item, callback: callback });
6561
6640
 
6562
6641
  if (!this.retryHandle) {
6563
- this.retryHandle = setInterval(function() {
6564
- while (this.retryQueue.length) {
6565
- var retryObject = this.retryQueue.shift();
6566
- this._makeApiRequest(retryObject.item, retryObject.callback);
6567
- }
6568
- }.bind(this), this.options.retryInterval);
6642
+ this.retryHandle = setInterval(
6643
+ function () {
6644
+ while (this.retryQueue.length) {
6645
+ var retryObject = this.retryQueue.shift();
6646
+ this._makeApiRequest(retryObject.item, retryObject.callback);
6647
+ }
6648
+ }.bind(this),
6649
+ this.options.retryInterval,
6650
+ );
6569
6651
  }
6570
6652
  };
6571
6653
 
@@ -6577,7 +6659,7 @@ function requireQueue () {
6577
6659
  *
6578
6660
  * @param item - the item previously added to the pending request queue
6579
6661
  */
6580
- Queue.prototype._dequeuePendingRequest = function(item) {
6662
+ Queue.prototype._dequeuePendingRequest = function (item) {
6581
6663
  var idx = this.pendingRequests.indexOf(item);
6582
6664
  if (idx !== -1) {
6583
6665
  this.pendingRequests.splice(idx, 1);
@@ -6585,7 +6667,7 @@ function requireQueue () {
6585
6667
  }
6586
6668
  };
6587
6669
 
6588
- Queue.prototype._maybeLog = function(data, originalError) {
6670
+ Queue.prototype._maybeLog = function (data, originalError) {
6589
6671
  if (this.logger && this.options.verbose) {
6590
6672
  var message = originalError;
6591
6673
  message = message || _.get(data, 'body.trace.exception.message');
@@ -6601,8 +6683,12 @@ function requireQueue () {
6601
6683
  }
6602
6684
  };
6603
6685
 
6604
- Queue.prototype._maybeCallWait = function() {
6605
- if (_.isFunction(this.waitCallback) && this.pendingItems.length === 0 && this.pendingRequests.length === 0) {
6686
+ Queue.prototype._maybeCallWait = function () {
6687
+ if (
6688
+ _.isFunction(this.waitCallback) &&
6689
+ this.pendingItems.length === 0 &&
6690
+ this.pendingRequests.length === 0
6691
+ ) {
6606
6692
  if (this.waitIntervalID) {
6607
6693
  this.waitIntervalID = clearInterval(this.waitIntervalID);
6608
6694
  }
@@ -6646,7 +6732,7 @@ function requireNotifier () {
6646
6732
  * @param options - an object which gets merged with the current options set on this notifier
6647
6733
  * @returns this
6648
6734
  */
6649
- Notifier.prototype.configure = function(options) {
6735
+ Notifier.prototype.configure = function (options) {
6650
6736
  this.queue && this.queue.configure(options);
6651
6737
  var oldOptions = this.options;
6652
6738
  this.options = _.merge(oldOptions, options);
@@ -6664,7 +6750,7 @@ function requireNotifier () {
6664
6750
  * with an error to terminate the processing. The item should be the updated item after this
6665
6751
  * transform is finished modifying it.
6666
6752
  */
6667
- Notifier.prototype.addTransform = function(transform) {
6753
+ Notifier.prototype.addTransform = function (transform) {
6668
6754
  if (_.isFunction(transform)) {
6669
6755
  this.transforms.push(transform);
6670
6756
  }
@@ -6684,9 +6770,9 @@ function requireNotifier () {
6684
6770
  * transform stage if an error occurs inside a transform, or in response to the communication with
6685
6771
  * the backend. The second argument will be the response from the backend in case of success.
6686
6772
  */
6687
- Notifier.prototype.log = function(item, callback) {
6773
+ Notifier.prototype.log = function (item, callback) {
6688
6774
  if (!callback || !_.isFunction(callback)) {
6689
- callback = function() {};
6775
+ callback = function () {};
6690
6776
  }
6691
6777
 
6692
6778
  if (!this.options.enabled) {
@@ -6695,13 +6781,16 @@ function requireNotifier () {
6695
6781
 
6696
6782
  this.queue.addPendingItem(item);
6697
6783
  var originalError = item.err;
6698
- this._applyTransforms(item, function(err, i) {
6699
- if (err) {
6700
- this.queue.removePendingItem(item);
6701
- return callback(err, null);
6702
- }
6703
- this.queue.addItem(i, callback, originalError, item);
6704
- }.bind(this));
6784
+ this._applyTransforms(
6785
+ item,
6786
+ function (err, i) {
6787
+ if (err) {
6788
+ this.queue.removePendingItem(item);
6789
+ return callback(err, null);
6790
+ }
6791
+ this.queue.addItem(i, callback, originalError, item);
6792
+ }.bind(this),
6793
+ );
6705
6794
  };
6706
6795
 
6707
6796
  /* Internal */
@@ -6715,13 +6804,13 @@ function requireNotifier () {
6715
6804
  * error and a null item in the case of a transform failure, or a null error and non-null item after
6716
6805
  * all transforms have been applied.
6717
6806
  */
6718
- Notifier.prototype._applyTransforms = function(item, callback) {
6807
+ Notifier.prototype._applyTransforms = function (item, callback) {
6719
6808
  var transformIndex = -1;
6720
6809
  var transformsLength = this.transforms.length;
6721
6810
  var transforms = this.transforms;
6722
6811
  var options = this.options;
6723
6812
 
6724
- var cb = function(err, i) {
6813
+ var cb = function (err, i) {
6725
6814
  if (err) {
6726
6815
  callback(err, null);
6727
6816
  return;
@@ -6790,7 +6879,7 @@ function requireRollbar$1 () {
6790
6879
 
6791
6880
  var defaultOptions = {
6792
6881
  maxItems: 0,
6793
- itemsPerMinute: 60
6882
+ itemsPerMinute: 60,
6794
6883
  };
6795
6884
 
6796
6885
  Rollbar.rateLimiter = new RateLimiter(defaultOptions);
@@ -6905,7 +6994,8 @@ function requireRollbar$1 () {
6905
6994
  this._addTracingInfo(item);
6906
6995
  item.level = item.level || defaultLevel;
6907
6996
  this.telemeter && this.telemeter._captureRollbarItem(item);
6908
- item.telemetryEvents = (this.telemeter && this.telemeter.copyEvents()) || [];
6997
+ item.telemetryEvents =
6998
+ (this.telemeter && this.telemeter.copyEvents()) || [];
6909
6999
  this.notifier.log(item, callback);
6910
7000
  } catch (e) {
6911
7001
  if (callback) {
@@ -6943,8 +7033,14 @@ function requireRollbar$1 () {
6943
7033
  span.setTag('rollbar.error_uuid', item.uuid);
6944
7034
  span.setTag('rollbar.has_error', true);
6945
7035
  span.setTag('error', true);
6946
- span.setTag('rollbar.item_url', `https://rollbar.com/item/uuid/?uuid=${item.uuid}`);
6947
- span.setTag('rollbar.occurrence_url', `https://rollbar.com/occurrence/uuid/?uuid=${item.uuid}`);
7036
+ span.setTag(
7037
+ 'rollbar.item_url',
7038
+ `https://rollbar.com/item/uuid/?uuid=${item.uuid}`,
7039
+ );
7040
+ span.setTag(
7041
+ 'rollbar.occurrence_url',
7042
+ `https://rollbar.com/occurrence/uuid/?uuid=${item.uuid}`,
7043
+ );
6948
7044
 
6949
7045
  // add span ID & trace ID to occurrence
6950
7046
  var opentracingSpanId = span.context().toSpanId();
@@ -6956,7 +7052,7 @@ function requireRollbar$1 () {
6956
7052
  } else {
6957
7053
  item.custom = {
6958
7054
  opentracing_span_id: opentracingSpanId,
6959
- opentracing_trace_id: opentracingTraceId
7055
+ opentracing_trace_id: opentracingTraceId,
6960
7056
  };
6961
7057
  }
6962
7058
  }
@@ -7012,12 +7108,14 @@ function requireRollbar$1 () {
7012
7108
 
7013
7109
  var spanContext = span.context();
7014
7110
 
7015
- if (!spanContext
7016
- || !spanContext.toSpanId
7017
- || !spanContext.toTraceId
7018
- || typeof spanContext.toSpanId !== 'function'
7019
- || typeof spanContext.toTraceId !== 'function') {
7020
- return false
7111
+ if (
7112
+ !spanContext ||
7113
+ !spanContext.toSpanId ||
7114
+ !spanContext.toTraceId ||
7115
+ typeof spanContext.toSpanId !== 'function' ||
7116
+ typeof spanContext.toTraceId !== 'function'
7117
+ ) {
7118
+ return false;
7021
7119
  }
7022
7120
 
7023
7121
  return true;
@@ -7039,7 +7137,7 @@ function requireApiUtility () {
7039
7137
  if (!_.isType(data.context, 'string')) {
7040
7138
  var contextResult = _.stringify(data.context, jsonBackup);
7041
7139
  if (contextResult.error) {
7042
- data.context = 'Error: could not serialize \'context\'';
7140
+ data.context = "Error: could not serialize 'context'";
7043
7141
  } else {
7044
7142
  data.context = contextResult.value || '';
7045
7143
  }
@@ -7049,7 +7147,7 @@ function requireApiUtility () {
7049
7147
  }
7050
7148
  return {
7051
7149
  access_token: accessToken,
7052
- data: data
7150
+ data: data,
7053
7151
  };
7054
7152
  }
7055
7153
 
@@ -7079,12 +7177,14 @@ function requireApiUtility () {
7079
7177
  path: path,
7080
7178
  search: search,
7081
7179
  proxy: proxy,
7082
- transport: transport
7180
+ transport: transport,
7083
7181
  };
7084
7182
  }
7085
7183
 
7086
7184
  function detectTransport(options) {
7087
- var gWindow = ((typeof window != 'undefined') && window) || ((typeof self != 'undefined') && self);
7185
+ var gWindow =
7186
+ (typeof window != 'undefined' && window) ||
7187
+ (typeof self != 'undefined' && self);
7088
7188
  var transport = options.defaultTransport || 'xhr';
7089
7189
  if (typeof gWindow.fetch === 'undefined') transport = 'xhr';
7090
7190
  if (typeof gWindow.XMLHttpRequest === 'undefined') transport = 'fetch';
@@ -7093,7 +7193,9 @@ function requireApiUtility () {
7093
7193
 
7094
7194
  function transportOptions(transport, method) {
7095
7195
  var protocol = transport.protocol || 'https:';
7096
- var port = transport.port || (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined);
7196
+ var port =
7197
+ transport.port ||
7198
+ (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined);
7097
7199
  var hostname = transport.hostname;
7098
7200
  var path = transport.path;
7099
7201
  var timeout = transport.timeout;
@@ -7114,7 +7216,7 @@ function requireApiUtility () {
7114
7216
  path: path,
7115
7217
  port: port,
7116
7218
  method: method,
7117
- transport: transportAPI
7219
+ transport: transportAPI,
7118
7220
  };
7119
7221
  }
7120
7222
 
@@ -7135,7 +7237,7 @@ function requireApiUtility () {
7135
7237
  buildPayload: buildPayload,
7136
7238
  getTransportFromOptions: getTransportFromOptions,
7137
7239
  transportOptions: transportOptions,
7138
- appendPathToPath: appendPathToPath
7240
+ appendPathToPath: appendPathToPath,
7139
7241
  };
7140
7242
  return apiUtility;
7141
7243
  }
@@ -7155,7 +7257,7 @@ function requireApi () {
7155
7257
  search: null,
7156
7258
  version: '1',
7157
7259
  protocol: 'https:',
7158
- port: 443
7260
+ port: 443,
7159
7261
  };
7160
7262
 
7161
7263
  /**
@@ -7192,13 +7294,16 @@ function requireApi () {
7192
7294
  * @param data
7193
7295
  * @param callback
7194
7296
  */
7195
- Api.prototype.postItem = function(data, callback) {
7196
- var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
7297
+ Api.prototype.postItem = function (data, callback) {
7298
+ var transportOptions = helpers.transportOptions(
7299
+ this.transportOptions,
7300
+ 'POST',
7301
+ );
7197
7302
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
7198
7303
  var self = this;
7199
7304
 
7200
7305
  // ensure the network request is scheduled after the current tick.
7201
- setTimeout(function() {
7306
+ setTimeout(function () {
7202
7307
  self.transport.post(self.accessToken, transportOptions, payload, callback);
7203
7308
  }, 0);
7204
7309
  };
@@ -7208,7 +7313,7 @@ function requireApi () {
7208
7313
  * @param data
7209
7314
  * @param callback
7210
7315
  */
7211
- Api.prototype.buildJsonPayload = function(data, callback) {
7316
+ Api.prototype.buildJsonPayload = function (data, callback) {
7212
7317
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
7213
7318
 
7214
7319
  var stringifyResult;
@@ -7233,12 +7338,20 @@ function requireApi () {
7233
7338
  * @param jsonPayload
7234
7339
  * @param callback
7235
7340
  */
7236
- Api.prototype.postJsonPayload = function(jsonPayload, callback) {
7237
- var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
7238
- this.transport.postJsonPayload(this.accessToken, transportOptions, jsonPayload, callback);
7341
+ Api.prototype.postJsonPayload = function (jsonPayload, callback) {
7342
+ var transportOptions = helpers.transportOptions(
7343
+ this.transportOptions,
7344
+ 'POST',
7345
+ );
7346
+ this.transport.postJsonPayload(
7347
+ this.accessToken,
7348
+ transportOptions,
7349
+ jsonPayload,
7350
+ callback,
7351
+ );
7239
7352
  };
7240
7353
 
7241
- Api.prototype.configure = function(options) {
7354
+ Api.prototype.configure = function (options) {
7242
7355
  var oldOptions = this.oldOptions;
7243
7356
  this.options = _.merge(oldOptions, options);
7244
7357
  this.transportOptions = _getTransport(this.options, this.url);
@@ -7267,20 +7380,20 @@ function requireLogger () {
7267
7380
 
7268
7381
  var logger = {
7269
7382
  /* eslint-disable no-console */
7270
- log: function() {
7383
+ log: function () {
7271
7384
  if (verbose) {
7272
7385
  console.log.apply(console, arguments);
7273
7386
  }
7274
7387
  },
7275
- error: function() {
7388
+ error: function () {
7276
7389
  if (verbose) {
7277
7390
  console.error.apply(console, arguments);
7278
7391
  }
7279
7392
  },
7280
7393
  /* eslint-enable no-console */
7281
- setVerbose: function(val) {
7394
+ setVerbose: function (val) {
7282
7395
  verbose = val;
7283
- }
7396
+ },
7284
7397
  };
7285
7398
 
7286
7399
  logger_1 = logger;
@@ -7303,7 +7416,7 @@ function requireTraverse () {
7303
7416
  var seenIndex;
7304
7417
 
7305
7418
  // Best might be to use Map here with `obj` as the keys, but we want to support IE < 11.
7306
- seen = seen || { obj: [], mapped: []};
7419
+ seen = seen || { obj: [], mapped: [] };
7307
7420
 
7308
7421
  if (isObj) {
7309
7422
  seenIndex = seen.obj.indexOf(obj);
@@ -7371,7 +7484,7 @@ function requireTruncation () {
7371
7484
  }
7372
7485
 
7373
7486
  function truncateFrames(payload, jsonBackup, range) {
7374
- range = (typeof range === 'undefined') ? 30 : range;
7487
+ range = typeof range === 'undefined' ? 30 : range;
7375
7488
  var body = payload.data.body;
7376
7489
  var frames;
7377
7490
  if (body.trace_chain) {
@@ -7418,7 +7531,10 @@ function requireTruncation () {
7418
7531
  function truncateTraceData(traceData) {
7419
7532
  if (traceData.exception) {
7420
7533
  delete traceData.exception.description;
7421
- traceData.exception.message = maybeTruncateValue(255, traceData.exception.message);
7534
+ traceData.exception.message = maybeTruncateValue(
7535
+ 255,
7536
+ traceData.exception.message,
7537
+ );
7422
7538
  }
7423
7539
  traceData.frames = selectFrames(traceData.frames, 1);
7424
7540
  return traceData;
@@ -7442,14 +7558,14 @@ function requireTruncation () {
7442
7558
  }
7443
7559
 
7444
7560
  function truncate(payload, jsonBackup, maxSize) {
7445
- maxSize = (typeof maxSize === 'undefined') ? (512 * 1024) : maxSize;
7561
+ maxSize = typeof maxSize === 'undefined' ? 512 * 1024 : maxSize;
7446
7562
  var strategies = [
7447
7563
  raw,
7448
7564
  truncateFrames,
7449
7565
  truncateStrings.bind(null, 1024),
7450
7566
  truncateStrings.bind(null, 512),
7451
7567
  truncateStrings.bind(null, 256),
7452
- minBody
7568
+ minBody,
7453
7569
  ];
7454
7570
  var strategy, results, result;
7455
7571
 
@@ -7471,7 +7587,7 @@ function requireTruncation () {
7471
7587
  raw: raw,
7472
7588
  truncateFrames: truncateFrames,
7473
7589
  truncateStrings: truncateStrings,
7474
- maybeTruncateValue: maybeTruncateValue
7590
+ maybeTruncateValue: maybeTruncateValue,
7475
7591
  };
7476
7592
  return truncation;
7477
7593
  }
@@ -7551,10 +7667,16 @@ function requireTransport () {
7551
7667
  this.rateLimitExpires = 0;
7552
7668
  }
7553
7669
 
7554
- Transport.prototype.get = function(accessToken, options, params, callback, transportFactory) {
7670
+ Transport.prototype.get = function (
7671
+ accessToken,
7672
+ options,
7673
+ params,
7674
+ callback,
7675
+ transportFactory,
7676
+ ) {
7555
7677
  var t;
7556
7678
  if (!callback || !_.isFunction(callback)) {
7557
- callback = function() {};
7679
+ callback = function () {};
7558
7680
  }
7559
7681
  options = options || {};
7560
7682
  _.addParamsAndAccessTokenToPath(accessToken, options, params);
@@ -7565,22 +7687,33 @@ function requireTransport () {
7565
7687
  t = _transport(options);
7566
7688
  }
7567
7689
  if (!t) {
7568
- logger.error('Unknown transport based on given protocol: ' + options.protocol);
7690
+ logger.error(
7691
+ 'Unknown transport based on given protocol: ' + options.protocol,
7692
+ );
7569
7693
  return callback(new Error('Unknown transport'));
7570
7694
  }
7571
- var req = t.request(options, function(resp) {
7572
- this.handleResponse(resp, callback);
7573
- }.bind(this));
7574
- req.on('error', function(err) {
7695
+ var req = t.request(
7696
+ options,
7697
+ function (resp) {
7698
+ this.handleResponse(resp, callback);
7699
+ }.bind(this),
7700
+ );
7701
+ req.on('error', function (err) {
7575
7702
  callback(err);
7576
7703
  });
7577
7704
  req.end();
7578
7705
  };
7579
7706
 
7580
- Transport.prototype.post = function(accessToken, options, payload, callback, transportFactory) {
7707
+ Transport.prototype.post = function (
7708
+ accessToken,
7709
+ options,
7710
+ payload,
7711
+ callback,
7712
+ transportFactory,
7713
+ ) {
7581
7714
  var t;
7582
7715
  if (!callback || !_.isFunction(callback)) {
7583
- callback = function() {};
7716
+ callback = function () {};
7584
7717
  }
7585
7718
  if (_currentTime() < this.rateLimitExpires) {
7586
7719
  return callback(new Error('Exceeded rate limit'));
@@ -7602,13 +7735,18 @@ function requireTransport () {
7602
7735
  t = _transport(options);
7603
7736
  }
7604
7737
  if (!t) {
7605
- logger.error('Unknown transport based on given protocol: ' + options.protocol);
7738
+ logger.error(
7739
+ 'Unknown transport based on given protocol: ' + options.protocol,
7740
+ );
7606
7741
  return callback(new Error('Unknown transport'));
7607
7742
  }
7608
- var req = t.request(options, function(resp) {
7609
- this.handleResponse(resp, _wrapPostCallback(callback));
7610
- }.bind(this));
7611
- req.on('error', function(err) {
7743
+ var req = t.request(
7744
+ options,
7745
+ function (resp) {
7746
+ this.handleResponse(resp, _wrapPostCallback(callback));
7747
+ }.bind(this),
7748
+ );
7749
+ req.on('error', function (err) {
7612
7750
  callback(err);
7613
7751
  });
7614
7752
  if (writeData) {
@@ -7617,28 +7755,31 @@ function requireTransport () {
7617
7755
  req.end();
7618
7756
  };
7619
7757
 
7620
- Transport.prototype.updateRateLimit = function(resp) {
7758
+ Transport.prototype.updateRateLimit = function (resp) {
7621
7759
  var remaining = parseInt(resp.headers['x-rate-limit-remaining'] || 0);
7622
- var remainingSeconds = Math.min(MAX_RATE_LIMIT_INTERVAL, resp.headers['x-rate-limit-remaining-seconds'] || 0);
7760
+ var remainingSeconds = Math.min(
7761
+ MAX_RATE_LIMIT_INTERVAL,
7762
+ resp.headers['x-rate-limit-remaining-seconds'] || 0,
7763
+ );
7623
7764
  var currentTime = _currentTime();
7624
7765
 
7625
- if ((resp.statusCode === 429) && (remaining === 0)) {
7766
+ if (resp.statusCode === 429 && remaining === 0) {
7626
7767
  this.rateLimitExpires = currentTime + remainingSeconds;
7627
7768
  } else {
7628
7769
  this.rateLimitExpires = currentTime;
7629
7770
  }
7630
7771
  };
7631
7772
 
7632
- Transport.prototype.handleResponse = function(resp, callback) {
7773
+ Transport.prototype.handleResponse = function (resp, callback) {
7633
7774
  this.updateRateLimit(resp);
7634
7775
 
7635
7776
  var respData = [];
7636
7777
  resp.setEncoding('utf8');
7637
- resp.on('data', function(chunk) {
7778
+ resp.on('data', function (chunk) {
7638
7779
  respData.push(chunk);
7639
7780
  });
7640
7781
 
7641
- resp.on('end', function() {
7782
+ resp.on('end', function () {
7642
7783
  respData = respData.join('');
7643
7784
  _parseApiResponse(respData, callback);
7644
7785
  });
@@ -7661,7 +7802,7 @@ function requireTransport () {
7661
7802
  }
7662
7803
 
7663
7804
  function _transport(options) {
7664
- return {'http:': http, 'https:': https}[options.protocol];
7805
+ return { 'http:': http, 'https:': https }[options.protocol];
7665
7806
  }
7666
7807
 
7667
7808
  function _parseApiResponse(data, callback) {
@@ -7674,27 +7815,32 @@ function requireTransport () {
7674
7815
 
7675
7816
  if (data.err) {
7676
7817
  logger.error('Received error: ' + data.message);
7677
- return callback(new Error('Api error: ' + (data.message || 'Unknown error')));
7818
+ return callback(
7819
+ new Error('Api error: ' + (data.message || 'Unknown error')),
7820
+ );
7678
7821
  }
7679
7822
 
7680
7823
  callback(null, data);
7681
7824
  }
7682
7825
 
7683
7826
  function _wrapPostCallback(callback) {
7684
- return function(err, data) {
7827
+ return function (err, data) {
7685
7828
  if (err) {
7686
7829
  return callback(err);
7687
7830
  }
7688
7831
  if (data.result && data.result.uuid) {
7689
- logger.log([
7832
+ logger.log(
7833
+ [
7690
7834
  'Successful api response.',
7691
- ' Link: https://rollbar.com/occurrence/uuid/?uuid=' + data.result.uuid
7692
- ].join(''));
7835
+ ' Link: https://rollbar.com/occurrence/uuid/?uuid=' +
7836
+ data.result.uuid,
7837
+ ].join(''),
7838
+ );
7693
7839
  } else {
7694
7840
  logger.log('Successful api response');
7695
7841
  }
7696
7842
  callback(null, data.result);
7697
- }
7843
+ };
7698
7844
  }
7699
7845
 
7700
7846
  function _currentTime() {
@@ -7722,7 +7868,7 @@ function requireTelemetry$1 () {
7722
7868
  this.maxQueueSize = Math.max(0, Math.min(maxTelemetryEvents, MAX_EVENTS));
7723
7869
  }
7724
7870
 
7725
- Telemeter.prototype.configure = function(options) {
7871
+ Telemeter.prototype.configure = function (options) {
7726
7872
  var oldOptions = this.options;
7727
7873
  this.options = _.merge(oldOptions, options);
7728
7874
  var maxTelemetryEvents = this.options.maxTelemetryEvents || MAX_EVENTS;
@@ -7735,7 +7881,7 @@ function requireTelemetry$1 () {
7735
7881
  this.queue.splice(0, deleteCount);
7736
7882
  };
7737
7883
 
7738
- Telemeter.prototype.copyEvents = function() {
7884
+ Telemeter.prototype.copyEvents = function () {
7739
7885
  var events = Array.prototype.slice.call(this.queue, 0);
7740
7886
  if (_.isFunction(this.options.filterTelemetry)) {
7741
7887
  try {
@@ -7752,20 +7898,29 @@ function requireTelemetry$1 () {
7752
7898
  return events;
7753
7899
  };
7754
7900
 
7755
- Telemeter.prototype.capture = function(type, metadata, level, rollbarUUID, timestamp) {
7901
+ Telemeter.prototype.capture = function (
7902
+ type,
7903
+ metadata,
7904
+ level,
7905
+ rollbarUUID,
7906
+ timestamp,
7907
+ ) {
7756
7908
  var e = {
7757
7909
  level: getLevel(type, level),
7758
7910
  type: type,
7759
7911
  timestamp_ms: timestamp || _.now(),
7760
7912
  body: metadata,
7761
- source: 'client'
7913
+ source: 'client',
7762
7914
  };
7763
7915
  if (rollbarUUID) {
7764
7916
  e.uuid = rollbarUUID;
7765
7917
  }
7766
7918
 
7767
7919
  try {
7768
- if (_.isFunction(this.options.filterTelemetry) && this.options.filterTelemetry(e)) {
7920
+ if (
7921
+ _.isFunction(this.options.filterTelemetry) &&
7922
+ this.options.filterTelemetry(e)
7923
+ ) {
7769
7924
  return false;
7770
7925
  }
7771
7926
  } catch (exc) {
@@ -7776,13 +7931,23 @@ function requireTelemetry$1 () {
7776
7931
  return e;
7777
7932
  };
7778
7933
 
7779
- Telemeter.prototype.captureEvent = function(type, metadata, level, rollbarUUID) {
7934
+ Telemeter.prototype.captureEvent = function (
7935
+ type,
7936
+ metadata,
7937
+ level,
7938
+ rollbarUUID,
7939
+ ) {
7780
7940
  return this.capture(type, metadata, level, rollbarUUID);
7781
7941
  };
7782
7942
 
7783
- Telemeter.prototype.captureError = function(err, level, rollbarUUID, timestamp) {
7943
+ Telemeter.prototype.captureError = function (
7944
+ err,
7945
+ level,
7946
+ rollbarUUID,
7947
+ timestamp,
7948
+ ) {
7784
7949
  var metadata = {
7785
- message: err.message || String(err)
7950
+ message: err.message || String(err),
7786
7951
  };
7787
7952
  if (err.stack) {
7788
7953
  metadata.stack = err.stack;
@@ -7790,13 +7955,29 @@ function requireTelemetry$1 () {
7790
7955
  return this.capture('error', metadata, level, rollbarUUID, timestamp);
7791
7956
  };
7792
7957
 
7793
- Telemeter.prototype.captureLog = function(message, level, rollbarUUID, timestamp) {
7794
- return this.capture('log', {
7795
- message: message
7796
- }, level, rollbarUUID, timestamp);
7958
+ Telemeter.prototype.captureLog = function (
7959
+ message,
7960
+ level,
7961
+ rollbarUUID,
7962
+ timestamp,
7963
+ ) {
7964
+ return this.capture(
7965
+ 'log',
7966
+ {
7967
+ message: message,
7968
+ },
7969
+ level,
7970
+ rollbarUUID,
7971
+ timestamp,
7972
+ );
7797
7973
  };
7798
7974
 
7799
- Telemeter.prototype.captureNetwork = function(metadata, subtype, rollbarUUID, requestData) {
7975
+ Telemeter.prototype.captureNetwork = function (
7976
+ metadata,
7977
+ subtype,
7978
+ rollbarUUID,
7979
+ requestData,
7980
+ ) {
7800
7981
  subtype = subtype || 'xhr';
7801
7982
  metadata.subtype = metadata.subtype || subtype;
7802
7983
  if (requestData) {
@@ -7806,7 +7987,7 @@ function requireTelemetry$1 () {
7806
7987
  return this.capture('network', metadata, level, rollbarUUID);
7807
7988
  };
7808
7989
 
7809
- Telemeter.prototype.levelFromStatus = function(statusCode) {
7990
+ Telemeter.prototype.levelFromStatus = function (statusCode) {
7810
7991
  if (statusCode >= 200 && statusCode < 400) {
7811
7992
  return 'info';
7812
7993
  }
@@ -7816,10 +7997,16 @@ function requireTelemetry$1 () {
7816
7997
  return 'info';
7817
7998
  };
7818
7999
 
7819
- Telemeter.prototype.captureDom = function(subtype, element, value, checked, rollbarUUID) {
8000
+ Telemeter.prototype.captureDom = function (
8001
+ subtype,
8002
+ element,
8003
+ value,
8004
+ checked,
8005
+ rollbarUUID,
8006
+ ) {
7820
8007
  var metadata = {
7821
8008
  subtype: subtype,
7822
- element: element
8009
+ element: element,
7823
8010
  };
7824
8011
  if (value !== undefined) {
7825
8012
  metadata.value = value;
@@ -7830,31 +8017,48 @@ function requireTelemetry$1 () {
7830
8017
  return this.capture('dom', metadata, 'info', rollbarUUID);
7831
8018
  };
7832
8019
 
7833
- Telemeter.prototype.captureNavigation = function(from, to, rollbarUUID) {
7834
- return this.capture('navigation', {from: from, to: to}, 'info', rollbarUUID);
8020
+ Telemeter.prototype.captureNavigation = function (from, to, rollbarUUID) {
8021
+ return this.capture(
8022
+ 'navigation',
8023
+ { from: from, to: to },
8024
+ 'info',
8025
+ rollbarUUID,
8026
+ );
7835
8027
  };
7836
8028
 
7837
- Telemeter.prototype.captureDomContentLoaded = function(ts) {
7838
- return this.capture('navigation', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime());
8029
+ Telemeter.prototype.captureDomContentLoaded = function (ts) {
8030
+ return this.capture(
8031
+ 'navigation',
8032
+ { subtype: 'DOMContentLoaded' },
8033
+ 'info',
8034
+ undefined,
8035
+ ts && ts.getTime(),
8036
+ );
7839
8037
  /**
7840
8038
  * If we decide to make this a dom event instead, then use the line below:
7841
8039
  return this.capture('dom', {subtype: 'DOMContentLoaded'}, 'info', undefined, ts && ts.getTime());
7842
8040
  */
7843
8041
  };
7844
- Telemeter.prototype.captureLoad = function(ts) {
7845
- return this.capture('navigation', {subtype: 'load'}, 'info', undefined, ts && ts.getTime());
8042
+ Telemeter.prototype.captureLoad = function (ts) {
8043
+ return this.capture(
8044
+ 'navigation',
8045
+ { subtype: 'load' },
8046
+ 'info',
8047
+ undefined,
8048
+ ts && ts.getTime(),
8049
+ );
7846
8050
  /**
7847
8051
  * If we decide to make this a dom event instead, then use the line below:
7848
8052
  return this.capture('dom', {subtype: 'load'}, 'info', undefined, ts && ts.getTime());
7849
8053
  */
7850
8054
  };
7851
8055
 
7852
- Telemeter.prototype.captureConnectivityChange = function(type, rollbarUUID) {
7853
- return this.captureNetwork({change: type}, 'connectivity', rollbarUUID);
8056
+ Telemeter.prototype.captureConnectivityChange = function (type, rollbarUUID) {
8057
+ return this.captureNetwork({ change: type }, 'connectivity', rollbarUUID);
7854
8058
  };
7855
8059
 
7856
8060
  // Only intended to be used internally by the notifier
7857
- Telemeter.prototype._captureRollbarItem = function(item) {
8061
+ Telemeter.prototype._captureRollbarItem = function (item) {
7858
8062
  if (!this.options.includeItemsInTelemetry) {
7859
8063
  return;
7860
8064
  }
@@ -7865,11 +8069,17 @@ function requireTelemetry$1 () {
7865
8069
  return this.captureLog(item.message, item.level, item.uuid, item.timestamp);
7866
8070
  }
7867
8071
  if (item.custom) {
7868
- return this.capture('log', item.custom, item.level, item.uuid, item.timestamp);
8072
+ return this.capture(
8073
+ 'log',
8074
+ item.custom,
8075
+ item.level,
8076
+ item.uuid,
8077
+ item.timestamp,
8078
+ );
7869
8079
  }
7870
8080
  };
7871
8081
 
7872
- Telemeter.prototype.push = function(e) {
8082
+ Telemeter.prototype.push = function (e) {
7873
8083
  this.queue.push(e);
7874
8084
  if (this.queue.length > this.maxQueueSize) {
7875
8085
  this.queue.shift();
@@ -7882,7 +8092,7 @@ function requireTelemetry$1 () {
7882
8092
  }
7883
8093
  var defaultLevel = {
7884
8094
  error: 'error',
7885
- manual: 'info'
8095
+ manual: 'info',
7886
8096
  };
7887
8097
  return defaultLevel[type] || 'info';
7888
8098
  }
@@ -7891,13 +8101,30 @@ function requireTelemetry$1 () {
7891
8101
  return telemetry$1;
7892
8102
  }
7893
8103
 
8104
+ var replace_1;
8105
+ var hasRequiredReplace;
8106
+
8107
+ function requireReplace () {
8108
+ if (hasRequiredReplace) return replace_1;
8109
+ hasRequiredReplace = 1;
8110
+ function replace(obj, name, replacement, replacements, type) {
8111
+ var orig = obj[name];
8112
+ obj[name] = replacement(orig);
8113
+ if (replacements) {
8114
+ replacements[type].push([obj, name, orig]);
8115
+ }
8116
+ }
8117
+
8118
+ replace_1 = replace;
8119
+ return replace_1;
8120
+ }
8121
+
7894
8122
  var urlHelpers;
7895
8123
  var hasRequiredUrlHelpers;
7896
8124
 
7897
8125
  function requireUrlHelpers () {
7898
8126
  if (hasRequiredUrlHelpers) return urlHelpers;
7899
8127
  hasRequiredUrlHelpers = 1;
7900
- var url = require$$0$1;
7901
8128
  var { URL } = require$$0$1;
7902
8129
  var merge = requireMerge();
7903
8130
 
@@ -7911,8 +8138,7 @@ function requireUrlHelpers () {
7911
8138
  if (typeof input === 'string') {
7912
8139
  const urlStr = input;
7913
8140
  input = urlToHttpOptions(new URL(urlStr));
7914
- } else if (input && input[url.searchParamsSymbol] &&
7915
- input[url.searchParamsSymbol][url.searchParamsSymbol]) {
8141
+ } else if (input && input instanceof URL) {
7916
8142
  // url.URL instance
7917
8143
  input = urlToHttpOptions(input);
7918
8144
  } else {
@@ -7927,7 +8153,7 @@ function requireUrlHelpers () {
7927
8153
  } else {
7928
8154
  options = merge(input || {}, options);
7929
8155
  }
7930
- return {options: options, cb: cb};
8156
+ return { options: options, cb: cb };
7931
8157
  }
7932
8158
 
7933
8159
  // This function replicates the relevant logic in node/lib/url.js as closely
@@ -7939,15 +8165,15 @@ function requireUrlHelpers () {
7939
8165
  function urlToHttpOptions(url) {
7940
8166
  const options = {
7941
8167
  protocol: url.protocol,
7942
- hostname: typeof url.hostname === 'string' &&
7943
- url.hostname.startsWith('[') ?
7944
- url.hostname.slice(1, -1) :
7945
- url.hostname,
8168
+ hostname:
8169
+ typeof url.hostname === 'string' && url.hostname.startsWith('[')
8170
+ ? url.hostname.slice(1, -1)
8171
+ : url.hostname,
7946
8172
  hash: url.hash,
7947
8173
  search: url.search,
7948
8174
  pathname: url.pathname,
7949
8175
  path: `${url.pathname || ''}${url.search || ''}`,
7950
- href: url.href
8176
+ href: url.href,
7951
8177
  };
7952
8178
  if (url.port !== '') {
7953
8179
  options.port = Number(url.port);
@@ -7975,7 +8201,7 @@ function requireUrlHelpers () {
7975
8201
 
7976
8202
  urlHelpers = {
7977
8203
  mergeOptions,
7978
- constructUrl
8204
+ constructUrl,
7979
8205
  };
7980
8206
  return urlHelpers;
7981
8207
  }
@@ -7989,13 +8215,14 @@ function requireTelemetry () {
7989
8215
  var http = require$$3;
7990
8216
  var https = require$$4;
7991
8217
  var _ = requireUtility();
8218
+ var replace = requireReplace();
7992
8219
  var urlHelpers = requireUrlHelpers();
7993
8220
 
7994
8221
  var defaults = {
7995
8222
  network: true,
7996
8223
  networkResponseHeaders: false,
7997
8224
  networkRequestHeaders: false,
7998
- log: true
8225
+ log: true,
7999
8226
  };
8000
8227
 
8001
8228
  function Instrumenter(options, telemeter, rollbar) {
@@ -8014,11 +8241,11 @@ function requireTelemetry () {
8014
8241
  this.diagnostic = rollbar.client.notifier.diagnostic;
8015
8242
  this.replacements = {
8016
8243
  network: [],
8017
- log: []
8244
+ log: [],
8018
8245
  };
8019
8246
  }
8020
8247
 
8021
- Instrumenter.prototype.configure = function(options) {
8248
+ Instrumenter.prototype.configure = function (options) {
8022
8249
  this.options = _.merge(this.options, options);
8023
8250
  var autoInstrument = options.autoInstrument;
8024
8251
  var oldSettings = _.merge(this.autoInstrument);
@@ -8033,10 +8260,14 @@ function requireTelemetry () {
8033
8260
  this.instrument(oldSettings);
8034
8261
  };
8035
8262
 
8036
- Instrumenter.prototype.instrument = function(oldSettings) {
8263
+ Instrumenter.prototype.instrument = function (oldSettings) {
8037
8264
  if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) {
8038
8265
  this.instrumentNetwork();
8039
- } else if (!this.autoInstrument.network && oldSettings && oldSettings.network) {
8266
+ } else if (
8267
+ !this.autoInstrument.network &&
8268
+ oldSettings &&
8269
+ oldSettings.network
8270
+ ) {
8040
8271
  this.deinstrumentNetwork();
8041
8272
  }
8042
8273
 
@@ -8047,20 +8278,32 @@ function requireTelemetry () {
8047
8278
  }
8048
8279
  };
8049
8280
 
8050
- Instrumenter.prototype.deinstrumentNetwork = function() {
8281
+ Instrumenter.prototype.deinstrumentNetwork = function () {
8051
8282
  restore(this.replacements, 'network');
8052
8283
  };
8053
8284
 
8054
- Instrumenter.prototype.instrumentNetwork = function() {
8055
- replace(http, 'request', networkRequestWrapper.bind(this), this.replacements, 'network');
8056
- replace(https, 'request', networkRequestWrapper.bind(this), this.replacements, 'network');
8285
+ Instrumenter.prototype.instrumentNetwork = function () {
8286
+ replace(
8287
+ http,
8288
+ 'request',
8289
+ networkRequestWrapper.bind(this),
8290
+ this.replacements,
8291
+ 'network',
8292
+ );
8293
+ replace(
8294
+ https,
8295
+ 'request',
8296
+ networkRequestWrapper.bind(this),
8297
+ this.replacements,
8298
+ 'network',
8299
+ );
8057
8300
  };
8058
8301
 
8059
8302
  function networkRequestWrapper(orig) {
8060
8303
  var telemeter = this.telemeter;
8061
8304
  var self = this;
8062
8305
 
8063
- return function(url, options, cb) {
8306
+ return function (url, options, cb) {
8064
8307
  var mergedOptions = urlHelpers.mergeOptions(url, options, cb);
8065
8308
 
8066
8309
  var metadata = {
@@ -8068,7 +8311,7 @@ function requireTelemetry () {
8068
8311
  url: urlHelpers.constructUrl(mergedOptions.options),
8069
8312
  status_code: null,
8070
8313
  start_time_ms: _.now(),
8071
- end_time_ms: null
8314
+ end_time_ms: null,
8072
8315
  };
8073
8316
 
8074
8317
  if (self.autoInstrument.networkRequestHeaders) {
@@ -8078,20 +8321,24 @@ function requireTelemetry () {
8078
8321
 
8079
8322
  // Call the original method with the original arguments and wrapped callback.
8080
8323
  var wrappedArgs = Array.from(arguments);
8081
- var wrappedCallback = responseCallbackWrapper(self.autoInstrument, metadata, mergedOptions.cb);
8324
+ var wrappedCallback = responseCallbackWrapper(
8325
+ self.autoInstrument,
8326
+ metadata,
8327
+ mergedOptions.cb,
8328
+ );
8082
8329
  if (mergedOptions.cb) {
8083
8330
  wrappedArgs.pop();
8084
8331
  }
8085
8332
  wrappedArgs.push(wrappedCallback);
8086
8333
  var req = orig.apply(https, wrappedArgs);
8087
8334
 
8088
- req.on('error', err => {
8335
+ req.on('error', (err) => {
8089
8336
  metadata.status_code = 0;
8090
- metadata.error = [err.name, err.message].join(': ') ;
8337
+ metadata.error = [err.name, err.message].join(': ');
8091
8338
  });
8092
8339
 
8093
8340
  return req;
8094
- }
8341
+ };
8095
8342
  }
8096
8343
 
8097
8344
  function responseCallbackWrapper(options, metadata, callback) {
@@ -8106,51 +8353,53 @@ function requireTelemetry () {
8106
8353
  if (callback) {
8107
8354
  return callback.apply(undefined, arguments);
8108
8355
  }
8109
- }
8356
+ };
8110
8357
  }
8111
8358
 
8112
- Instrumenter.prototype.captureNetwork = function(metadata, subtype, rollbarUUID) {
8359
+ Instrumenter.prototype.captureNetwork = function (
8360
+ metadata,
8361
+ subtype,
8362
+ rollbarUUID,
8363
+ ) {
8113
8364
  return this.telemeter.captureNetwork(metadata, subtype, rollbarUUID);
8114
8365
  };
8115
8366
 
8116
- Instrumenter.prototype.deinstrumentConsole = function() {
8367
+ Instrumenter.prototype.deinstrumentConsole = function () {
8117
8368
  restore(this.replacements, 'log');
8118
8369
  };
8119
8370
 
8120
- Instrumenter.prototype.instrumentConsole = function() {
8371
+ Instrumenter.prototype.instrumentConsole = function () {
8121
8372
  var telemeter = this.telemeter;
8122
8373
 
8123
8374
  var stdout = process.stdout;
8124
- replace(stdout, 'write', function(orig) {
8125
- return function(string) {
8126
- telemeter.captureLog(string, 'info');
8127
- return orig.apply(stdout, arguments);
8128
- }
8129
- }, this.replacements, 'log');
8375
+ replace(
8376
+ stdout,
8377
+ 'write',
8378
+ function (orig) {
8379
+ return function (string) {
8380
+ telemeter.captureLog(string, 'info');
8381
+ return orig.apply(stdout, arguments);
8382
+ };
8383
+ },
8384
+ this.replacements,
8385
+ 'log',
8386
+ );
8130
8387
 
8131
8388
  var stderr = process.stderr;
8132
- replace(stderr, 'write', function(orig) {
8133
- return function(string) {
8134
- telemeter.captureLog(string, 'error');
8135
- return orig.apply(stderr, arguments);
8136
- }
8137
- }, this.replacements, 'log');
8389
+ replace(
8390
+ stderr,
8391
+ 'write',
8392
+ function (orig) {
8393
+ return function (string) {
8394
+ telemeter.captureLog(string, 'error');
8395
+ return orig.apply(stderr, arguments);
8396
+ };
8397
+ },
8398
+ this.replacements,
8399
+ 'log',
8400
+ );
8138
8401
  };
8139
8402
 
8140
- // TODO: These helpers are duplicated in src/browser/telemetry.js,
8141
- // and may be candidates for extraction into a shared module.
8142
- // It is recommended that before doing so, the author should allow
8143
- // for more telemetry types to be implemented for the Node target
8144
- // to ensure that the implementations of these helpers don't diverge.
8145
- // If they do diverge, there's little point in the shared module.
8146
- function replace(obj, name, replacement, replacements, type) {
8147
- var orig = obj[name];
8148
- obj[name] = replacement(orig);
8149
- if (replacements) {
8150
- replacements[type].push([obj, name, orig]);
8151
- }
8152
- }
8153
-
8154
8403
  function restore(replacements, type) {
8155
8404
  var b;
8156
8405
  while (replacements[type].length) {
@@ -8233,19 +8482,19 @@ function wrap(defer) {
8233
8482
  return (fn, ...args) => defer(() => fn(...args));
8234
8483
  }
8235
8484
 
8236
- var _defer;
8485
+ var _defer$1;
8237
8486
 
8238
8487
  if (hasQueueMicrotask) {
8239
- _defer = queueMicrotask;
8488
+ _defer$1 = queueMicrotask;
8240
8489
  } else if (hasSetImmediate) {
8241
- _defer = setImmediate;
8490
+ _defer$1 = setImmediate;
8242
8491
  } else if (hasNextTick) {
8243
- _defer = process.nextTick;
8492
+ _defer$1 = process.nextTick;
8244
8493
  } else {
8245
- _defer = fallback;
8494
+ _defer$1 = fallback;
8246
8495
  }
8247
8496
 
8248
- var setImmediate$1 = wrap(_defer);
8497
+ var setImmediate$1 = wrap(_defer$1);
8249
8498
 
8250
8499
  /**
8251
8500
  * Take a sync function and make it async, passing its return value to a
@@ -8332,7 +8581,7 @@ function handlePromise(promise, callback) {
8332
8581
  return promise.then(value => {
8333
8582
  invokeCallback(callback, null, value);
8334
8583
  }, err => {
8335
- invokeCallback(callback, err && err.message ? err : new Error(err));
8584
+ invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
8336
8585
  });
8337
8586
  }
8338
8587
 
@@ -8363,7 +8612,8 @@ function wrapAsync(asyncFn) {
8363
8612
 
8364
8613
  // conditionally promisify a function.
8365
8614
  // only return a promise if a callback is omitted
8366
- function awaitify (asyncFn, arity = asyncFn.length) {
8615
+ function awaitify (asyncFn, arity) {
8616
+ if (!arity) arity = asyncFn.length;
8367
8617
  if (!arity) throw new Error('arity is undefined')
8368
8618
  function awaitable (...args) {
8369
8619
  if (typeof args[arity - 1] === 'function') {
@@ -8382,7 +8632,7 @@ function awaitify (asyncFn, arity = asyncFn.length) {
8382
8632
  return awaitable
8383
8633
  }
8384
8634
 
8385
- function applyEach (eachfn) {
8635
+ function applyEach$1 (eachfn) {
8386
8636
  return function applyEach(fns, ...callArgs) {
8387
8637
  const go = awaitify(function (callback) {
8388
8638
  var that = this;
@@ -8549,7 +8799,7 @@ function asyncEachOfLimit(generator, limit, iteratee, callback) {
8549
8799
  replenish();
8550
8800
  }
8551
8801
 
8552
- var eachOfLimit = (limit) => {
8802
+ var eachOfLimit$2 = (limit) => {
8553
8803
  return (obj, iteratee, callback) => {
8554
8804
  callback = once(callback);
8555
8805
  if (limit <= 0) {
@@ -8632,11 +8882,11 @@ var eachOfLimit = (limit) => {
8632
8882
  * `iteratee` functions have finished, or an error occurs. Invoked with (err).
8633
8883
  * @returns {Promise} a promise, if a callback is omitted
8634
8884
  */
8635
- function eachOfLimit$1(coll, limit, iteratee, callback) {
8636
- return eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);
8885
+ function eachOfLimit(coll, limit, iteratee, callback) {
8886
+ return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
8637
8887
  }
8638
8888
 
8639
- var eachOfLimit$2 = awaitify(eachOfLimit$1, 4);
8889
+ var eachOfLimit$1 = awaitify(eachOfLimit, 4);
8640
8890
 
8641
8891
  // eachOf implementation optimized for array-likes
8642
8892
  function eachOfArrayLike(coll, iteratee, callback) {
@@ -8668,7 +8918,7 @@ function eachOfArrayLike(coll, iteratee, callback) {
8668
8918
 
8669
8919
  // a generic version of eachOf which can handle array, object, and iterator cases.
8670
8920
  function eachOfGeneric (coll, iteratee, callback) {
8671
- return eachOfLimit$2(coll, Infinity, iteratee, callback);
8921
+ return eachOfLimit$1(coll, Infinity, iteratee, callback);
8672
8922
  }
8673
8923
 
8674
8924
  /**
@@ -8948,7 +9198,7 @@ var map$1 = awaitify(map, 3);
8948
9198
  * callback
8949
9199
  * );
8950
9200
  */
8951
- var applyEach$1 = applyEach(map$1);
9201
+ var applyEach = applyEach$1(map$1);
8952
9202
 
8953
9203
  /**
8954
9204
  * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
@@ -8969,7 +9219,7 @@ var applyEach$1 = applyEach(map$1);
8969
9219
  * @returns {Promise} a promise, if a callback is omitted
8970
9220
  */
8971
9221
  function eachOfSeries(coll, iteratee, callback) {
8972
- return eachOfLimit$2(coll, 1, iteratee, callback)
9222
+ return eachOfLimit$1(coll, 1, iteratee, callback)
8973
9223
  }
8974
9224
  var eachOfSeries$1 = awaitify(eachOfSeries, 3);
8975
9225
 
@@ -9016,7 +9266,7 @@ var mapSeries$1 = awaitify(mapSeries, 3);
9016
9266
  * appling the `args` to the list of functions. It takes no args, other than
9017
9267
  * a callback.
9018
9268
  */
9019
- var applyEachSeries = applyEach(mapSeries$1);
9269
+ var applyEachSeries = applyEach$1(mapSeries$1);
9020
9270
 
9021
9271
  const PROMISE_SYMBOL = Symbol('promiseCallback');
9022
9272
 
@@ -9352,8 +9602,8 @@ function auto(tasks, concurrency, callback) {
9352
9602
  return callback[PROMISE_SYMBOL]
9353
9603
  }
9354
9604
 
9355
- var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
9356
- var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
9605
+ var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
9606
+ var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
9357
9607
  var FN_ARG_SPLIT = /,/;
9358
9608
  var FN_ARG = /(=.+)?(\s*)$/;
9359
9609
 
@@ -9614,7 +9864,7 @@ function setInitial(dll, node) {
9614
9864
  dll.head = dll.tail = node;
9615
9865
  }
9616
9866
 
9617
- function queue(worker, concurrency, payload) {
9867
+ function queue$1(worker, concurrency, payload) {
9618
9868
  if (concurrency == null) {
9619
9869
  concurrency = 1;
9620
9870
  }
@@ -9671,12 +9921,11 @@ function queue(worker, concurrency, payload) {
9671
9921
  res(args);
9672
9922
  }
9673
9923
 
9674
- var item = {
9924
+ var item = q._createTaskItem(
9675
9925
  data,
9676
- callback: rejectOnError ?
9677
- promiseCallback :
9926
+ rejectOnError ? promiseCallback :
9678
9927
  (callback || promiseCallback)
9679
- };
9928
+ );
9680
9929
 
9681
9930
  if (insertAtFront) {
9682
9931
  q._tasks.unshift(item);
@@ -9758,6 +10007,12 @@ function queue(worker, concurrency, payload) {
9758
10007
  var isProcessing = false;
9759
10008
  var q = {
9760
10009
  _tasks: new DLL(),
10010
+ _createTaskItem (data, callback) {
10011
+ return {
10012
+ data,
10013
+ callback
10014
+ };
10015
+ },
9761
10016
  *[Symbol.iterator] () {
9762
10017
  yield* q._tasks[Symbol.iterator]();
9763
10018
  },
@@ -9927,8 +10182,8 @@ function queue(worker, concurrency, payload) {
9927
10182
  * await cargo.push({name: 'baz'});
9928
10183
  * console.log('finished processing baz');
9929
10184
  */
9930
- function cargo(worker, payload) {
9931
- return queue(worker, 1, payload);
10185
+ function cargo$1(worker, payload) {
10186
+ return queue$1(worker, 1, payload);
9932
10187
  }
9933
10188
 
9934
10189
  /**
@@ -9985,8 +10240,8 @@ function cargo(worker, payload) {
9985
10240
  * console.log('finished processing boo');
9986
10241
  * });
9987
10242
  */
9988
- function cargo$1(worker, concurrency, payload) {
9989
- return queue(worker, concurrency, payload);
10243
+ function cargo(worker, concurrency, payload) {
10244
+ return queue$1(worker, concurrency, payload);
9990
10245
  }
9991
10246
 
9992
10247
  /**
@@ -10242,7 +10497,7 @@ function compose(...args) {
10242
10497
  * @returns {Promise} a promise, if no callback is passed
10243
10498
  */
10244
10499
  function mapLimit (coll, limit, iteratee, callback) {
10245
- return _asyncMap(eachOfLimit(limit), coll, iteratee, callback)
10500
+ return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback)
10246
10501
  }
10247
10502
  var mapLimit$1 = awaitify(mapLimit, 4);
10248
10503
 
@@ -10452,7 +10707,7 @@ var concatSeries$1 = awaitify(concatSeries, 3);
10452
10707
  * //...
10453
10708
  * }, callback);
10454
10709
  */
10455
- function constant(...args) {
10710
+ function constant$1(...args) {
10456
10711
  return function (...ignoredArgs/*, callback*/) {
10457
10712
  var callback = ignoredArgs.pop();
10458
10713
  return callback(null, ...args);
@@ -10507,7 +10762,7 @@ function _createTester(check, getResult) {
10507
10762
  * Result will be the first item in the array that passes the truth test
10508
10763
  * (iteratee) or the value `undefined` if none passed. Invoked with
10509
10764
  * (err, result).
10510
- * @returns A Promise, if no callback is passed
10765
+ * @returns {Promise} a promise, if a callback is omitted
10511
10766
  * @example
10512
10767
  *
10513
10768
  * // dir1 is a directory that contains file1.txt, file2.txt
@@ -10579,10 +10834,10 @@ var detect$1 = awaitify(detect, 3);
10579
10834
  * Result will be the first item in the array that passes the truth test
10580
10835
  * (iteratee) or the value `undefined` if none passed. Invoked with
10581
10836
  * (err, result).
10582
- * @returns a Promise if no callback is passed
10837
+ * @returns {Promise} a promise, if a callback is omitted
10583
10838
  */
10584
10839
  function detectLimit(coll, limit, iteratee, callback) {
10585
- return _createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback)
10840
+ return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback)
10586
10841
  }
10587
10842
  var detectLimit$1 = awaitify(detectLimit, 4);
10588
10843
 
@@ -10605,10 +10860,10 @@ var detectLimit$1 = awaitify(detectLimit, 4);
10605
10860
  * Result will be the first item in the array that passes the truth test
10606
10861
  * (iteratee) or the value `undefined` if none passed. Invoked with
10607
10862
  * (err, result).
10608
- * @returns a Promise if no callback is passed
10863
+ * @returns {Promise} a promise, if a callback is omitted
10609
10864
  */
10610
10865
  function detectSeries(coll, iteratee, callback) {
10611
- return _createTester(bool => bool, (res, item) => item)(eachOfLimit(1), coll, iteratee, callback)
10866
+ return _createTester(bool => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback)
10612
10867
  }
10613
10868
 
10614
10869
  var detectSeries$1 = awaitify(detectSeries, 3);
@@ -10841,11 +11096,11 @@ function _withoutIndex(iteratee) {
10841
11096
  * }
10842
11097
  *
10843
11098
  */
10844
- function eachLimit(coll, iteratee, callback) {
11099
+ function eachLimit$2(coll, iteratee, callback) {
10845
11100
  return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
10846
11101
  }
10847
11102
 
10848
- var each = awaitify(eachLimit, 3);
11103
+ var each = awaitify(eachLimit$2, 3);
10849
11104
 
10850
11105
  /**
10851
11106
  * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
@@ -10868,10 +11123,10 @@ var each = awaitify(eachLimit, 3);
10868
11123
  * `iteratee` functions have finished, or an error occurs. Invoked with (err).
10869
11124
  * @returns {Promise} a promise, if a callback is omitted
10870
11125
  */
10871
- function eachLimit$1(coll, limit, iteratee, callback) {
10872
- return eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
11126
+ function eachLimit(coll, limit, iteratee, callback) {
11127
+ return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
10873
11128
  }
10874
- var eachLimit$2 = awaitify(eachLimit$1, 4);
11129
+ var eachLimit$1 = awaitify(eachLimit, 4);
10875
11130
 
10876
11131
  /**
10877
11132
  * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
@@ -10897,7 +11152,7 @@ var eachLimit$2 = awaitify(eachLimit$1, 4);
10897
11152
  * @returns {Promise} a promise, if a callback is omitted
10898
11153
  */
10899
11154
  function eachSeries(coll, iteratee, callback) {
10900
- return eachLimit$2(coll, 1, iteratee, callback)
11155
+ return eachLimit$1(coll, 1, iteratee, callback)
10901
11156
  }
10902
11157
  var eachSeries$1 = awaitify(eachSeries, 3);
10903
11158
 
@@ -11074,7 +11329,7 @@ var every$1 = awaitify(every, 3);
11074
11329
  * @returns {Promise} a promise, if no callback provided
11075
11330
  */
11076
11331
  function everyLimit(coll, limit, iteratee, callback) {
11077
- return _createTester(bool => !bool, res => !res)(eachOfLimit(limit), coll, iteratee, callback)
11332
+ return _createTester(bool => !bool, res => !res)(eachOfLimit$2(limit), coll, iteratee, callback)
11078
11333
  }
11079
11334
  var everyLimit$1 = awaitify(everyLimit, 4);
11080
11335
 
@@ -11237,7 +11492,7 @@ var filter$1 = awaitify(filter, 3);
11237
11492
  * @returns {Promise} a promise, if no callback provided
11238
11493
  */
11239
11494
  function filterLimit (coll, limit, iteratee, callback) {
11240
- return _filter(eachOfLimit(limit), coll, iteratee, callback)
11495
+ return _filter(eachOfLimit$2(limit), coll, iteratee, callback)
11241
11496
  }
11242
11497
  var filterLimit$1 = awaitify(filterLimit, 4);
11243
11498
 
@@ -11532,7 +11787,7 @@ function mapValuesLimit(obj, limit, iteratee, callback) {
11532
11787
  callback = once(callback);
11533
11788
  var newObj = {};
11534
11789
  var _iteratee = wrapAsync(iteratee);
11535
- return eachOfLimit(limit)(obj, (val, key, next) => {
11790
+ return eachOfLimit$2(limit)(obj, (val, key, next) => {
11536
11791
  _iteratee(val, key, (err, result) => {
11537
11792
  if (err) return next(err);
11538
11793
  newObj[key] = result;
@@ -11809,17 +12064,17 @@ function memoize(fn, hasher = v => v) {
11809
12064
  * // a, b, and c equal 1, 2, and 3
11810
12065
  * }, 1, 2, 3);
11811
12066
  */
11812
- var _defer$1;
12067
+ var _defer;
11813
12068
 
11814
12069
  if (hasNextTick) {
11815
- _defer$1 = process.nextTick;
12070
+ _defer = process.nextTick;
11816
12071
  } else if (hasSetImmediate) {
11817
- _defer$1 = setImmediate;
12072
+ _defer = setImmediate;
11818
12073
  } else {
11819
- _defer$1 = fallback;
12074
+ _defer = fallback;
11820
12075
  }
11821
12076
 
11822
- var nextTick = wrap(_defer$1);
12077
+ var nextTick = wrap(_defer);
11823
12078
 
11824
12079
  var _parallel = awaitify((eachfn, tasks, callback) => {
11825
12080
  var results = isArrayLike(tasks) ? [] : {};
@@ -12019,7 +12274,7 @@ function parallel(tasks, callback) {
12019
12274
  * @returns {Promise} a promise, if a callback is not passed
12020
12275
  */
12021
12276
  function parallelLimit(tasks, limit, callback) {
12022
- return _parallel(eachOfLimit(limit), tasks, callback);
12277
+ return _parallel(eachOfLimit$2(limit), tasks, callback);
12023
12278
  }
12024
12279
 
12025
12280
  /**
@@ -12164,9 +12419,9 @@ function parallelLimit(tasks, limit, callback) {
12164
12419
  * console.log('finished processing bar');
12165
12420
  * });
12166
12421
  */
12167
- function queue$1 (worker, concurrency) {
12422
+ function queue (worker, concurrency) {
12168
12423
  var _worker = wrapAsync(worker);
12169
- return queue((items, cb) => {
12424
+ return queue$1((items, cb) => {
12170
12425
  _worker(items[0], cb);
12171
12426
  }, concurrency, 1);
12172
12427
  }
@@ -12303,54 +12558,51 @@ function smaller(x, y) {
12303
12558
  * @param {number} concurrency - An `integer` for determining how many `worker`
12304
12559
  * functions should be run in parallel. If omitted, the concurrency defaults to
12305
12560
  * `1`. If the concurrency is `0`, an error is thrown.
12306
- * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two
12561
+ * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are three
12307
12562
  * differences between `queue` and `priorityQueue` objects:
12308
12563
  * * `push(task, priority, [callback])` - `priority` should be a number. If an
12309
12564
  * array of `tasks` is given, all tasks will be assigned the same priority.
12310
- * * The `unshift` method was removed.
12565
+ * * `pushAsync(task, priority, [callback])` - the same as `priorityQueue.push`,
12566
+ * except this returns a promise that rejects if an error occurs.
12567
+ * * The `unshift` and `unshiftAsync` methods were removed.
12311
12568
  */
12312
12569
  function priorityQueue(worker, concurrency) {
12313
12570
  // Start with a normal queue
12314
- var q = queue$1(worker, concurrency);
12315
- var processingScheduled = false;
12571
+ var q = queue(worker, concurrency);
12572
+
12573
+ var {
12574
+ push,
12575
+ pushAsync
12576
+ } = q;
12316
12577
 
12317
12578
  q._tasks = new Heap();
12579
+ q._createTaskItem = ({data, priority}, callback) => {
12580
+ return {
12581
+ data,
12582
+ priority,
12583
+ callback
12584
+ };
12585
+ };
12318
12586
 
12319
- // Override push to accept second parameter representing priority
12320
- q.push = function(data, priority = 0, callback = () => {}) {
12321
- if (typeof callback !== 'function') {
12322
- throw new Error('task callback must be a function');
12587
+ function createDataItems(tasks, priority) {
12588
+ if (!Array.isArray(tasks)) {
12589
+ return {data: tasks, priority};
12323
12590
  }
12324
- q.started = true;
12325
- if (!Array.isArray(data)) {
12326
- data = [data];
12327
- }
12328
- if (data.length === 0 && q.idle()) {
12329
- // call drain immediately if there are no tasks
12330
- return setImmediate$1(() => q.drain());
12331
- }
12332
-
12333
- for (var i = 0, l = data.length; i < l; i++) {
12334
- var item = {
12335
- data: data[i],
12336
- priority,
12337
- callback
12338
- };
12591
+ return tasks.map(data => { return {data, priority}; });
12592
+ }
12339
12593
 
12340
- q._tasks.push(item);
12341
- }
12594
+ // Override push to accept second parameter representing priority
12595
+ q.push = function(data, priority = 0, callback) {
12596
+ return push(createDataItems(data, priority), callback);
12597
+ };
12342
12598
 
12343
- if (!processingScheduled) {
12344
- processingScheduled = true;
12345
- setImmediate$1(() => {
12346
- processingScheduled = false;
12347
- q.process();
12348
- });
12349
- }
12599
+ q.pushAsync = function(data, priority = 0, callback) {
12600
+ return pushAsync(createDataItems(data, priority), callback);
12350
12601
  };
12351
12602
 
12352
- // Remove unshift function
12603
+ // Remove unshift functions
12353
12604
  delete q.unshift;
12605
+ delete q.unshiftAsync;
12354
12606
 
12355
12607
  return q;
12356
12608
  }
@@ -12371,7 +12623,7 @@ function priorityQueue(worker, concurrency) {
12371
12623
  * @param {Function} callback - A callback to run once any of the functions have
12372
12624
  * completed. This function gets an error or result from the first function that
12373
12625
  * completed. Invoked with (err, result).
12374
- * @returns undefined
12626
+ * @returns {Promise} a promise, if a callback is omitted
12375
12627
  * @example
12376
12628
  *
12377
12629
  * async.race([
@@ -12571,7 +12823,7 @@ function reflectAll(tasks) {
12571
12823
  return results;
12572
12824
  }
12573
12825
 
12574
- function reject(eachfn, arr, _iteratee, callback) {
12826
+ function reject$2(eachfn, arr, _iteratee, callback) {
12575
12827
  const iteratee = wrapAsync(_iteratee);
12576
12828
  return _filter(eachfn, arr, (value, cb) => {
12577
12829
  iteratee(value, (err, v) => {
@@ -12642,10 +12894,10 @@ function reject(eachfn, arr, _iteratee, callback) {
12642
12894
  * }
12643
12895
  *
12644
12896
  */
12645
- function reject$1 (coll, iteratee, callback) {
12646
- return reject(eachOf$1, coll, iteratee, callback)
12897
+ function reject (coll, iteratee, callback) {
12898
+ return reject$2(eachOf$1, coll, iteratee, callback)
12647
12899
  }
12648
- var reject$2 = awaitify(reject$1, 3);
12900
+ var reject$1 = awaitify(reject, 3);
12649
12901
 
12650
12902
  /**
12651
12903
  * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
@@ -12668,7 +12920,7 @@ var reject$2 = awaitify(reject$1, 3);
12668
12920
  * @returns {Promise} a promise, if no callback is passed
12669
12921
  */
12670
12922
  function rejectLimit (coll, limit, iteratee, callback) {
12671
- return reject(eachOfLimit(limit), coll, iteratee, callback)
12923
+ return reject$2(eachOfLimit$2(limit), coll, iteratee, callback)
12672
12924
  }
12673
12925
  var rejectLimit$1 = awaitify(rejectLimit, 4);
12674
12926
 
@@ -12691,11 +12943,11 @@ var rejectLimit$1 = awaitify(rejectLimit, 4);
12691
12943
  * @returns {Promise} a promise, if no callback is passed
12692
12944
  */
12693
12945
  function rejectSeries (coll, iteratee, callback) {
12694
- return reject(eachOfSeries$1, coll, iteratee, callback)
12946
+ return reject$2(eachOfSeries$1, coll, iteratee, callback)
12695
12947
  }
12696
12948
  var rejectSeries$1 = awaitify(rejectSeries, 3);
12697
12949
 
12698
- function constant$1(value) {
12950
+ function constant(value) {
12699
12951
  return function () {
12700
12952
  return value;
12701
12953
  }
@@ -12792,7 +13044,7 @@ const DEFAULT_INTERVAL = 0;
12792
13044
  function retry(opts, task, callback) {
12793
13045
  var options = {
12794
13046
  times: DEFAULT_TIMES,
12795
- intervalFunc: constant$1(DEFAULT_INTERVAL)
13047
+ intervalFunc: constant(DEFAULT_INTERVAL)
12796
13048
  };
12797
13049
 
12798
13050
  if (arguments.length < 3 && typeof opts === 'function') {
@@ -12833,7 +13085,7 @@ function parseTimes(acc, t) {
12833
13085
 
12834
13086
  acc.intervalFunc = typeof t.interval === 'function' ?
12835
13087
  t.interval :
12836
- constant$1(+t.interval || DEFAULT_INTERVAL);
13088
+ constant(+t.interval || DEFAULT_INTERVAL);
12837
13089
 
12838
13090
  acc.errorFilter = t.errorFilter;
12839
13091
  } else if (typeof t === 'number' || typeof t === 'string') {
@@ -13192,7 +13444,7 @@ var some$1 = awaitify(some, 3);
13192
13444
  * @returns {Promise} a promise, if no callback provided
13193
13445
  */
13194
13446
  function someLimit(coll, limit, iteratee, callback) {
13195
- return _createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback)
13447
+ return _createTester(Boolean, res => res)(eachOfLimit$2(limit), coll, iteratee, callback)
13196
13448
  }
13197
13449
  var someLimit$1 = awaitify(someLimit, 4);
13198
13450
 
@@ -13786,7 +14038,7 @@ function unmemoize(fn) {
13786
14038
  * @method
13787
14039
  * @category Control Flow
13788
14040
  * @param {AsyncFunction} test - asynchronous truth test to perform before each
13789
- * execution of `iteratee`. Invoked with ().
14041
+ * execution of `iteratee`. Invoked with (callback).
13790
14042
  * @param {AsyncFunction} iteratee - An async function which is called each time
13791
14043
  * `test` passes. Invoked with (callback).
13792
14044
  * @param {Function} [callback] - A callback which is called after the test
@@ -13896,7 +14148,7 @@ function until(test, iteratee, callback) {
13896
14148
  * @param {Function} [callback] - An optional callback to run once all the
13897
14149
  * functions have completed. This will be passed the results of the last task's
13898
14150
  * callback. Invoked with (err, [results]).
13899
- * @returns undefined
14151
+ * @returns {Promise} a promise, if a callback is omitted
13900
14152
  * @example
13901
14153
  *
13902
14154
  * async.waterfall([
@@ -13998,20 +14250,21 @@ var waterfall$1 = awaitify(waterfall);
13998
14250
  * @static
13999
14251
  */
14000
14252
 
14253
+
14001
14254
  var index = {
14002
14255
  apply,
14003
- applyEach: applyEach$1,
14256
+ applyEach,
14004
14257
  applyEachSeries,
14005
14258
  asyncify,
14006
14259
  auto,
14007
14260
  autoInject,
14008
- cargo,
14009
- cargoQueue: cargo$1,
14261
+ cargo: cargo$1,
14262
+ cargoQueue: cargo,
14010
14263
  compose,
14011
14264
  concat: concat$1,
14012
14265
  concatLimit: concatLimit$1,
14013
14266
  concatSeries: concatSeries$1,
14014
- constant,
14267
+ constant: constant$1,
14015
14268
  detect: detect$1,
14016
14269
  detectLimit: detectLimit$1,
14017
14270
  detectSeries: detectSeries$1,
@@ -14019,9 +14272,9 @@ var index = {
14019
14272
  doUntil,
14020
14273
  doWhilst: doWhilst$1,
14021
14274
  each,
14022
- eachLimit: eachLimit$2,
14275
+ eachLimit: eachLimit$1,
14023
14276
  eachOf: eachOf$1,
14024
- eachOfLimit: eachOfLimit$2,
14277
+ eachOfLimit: eachOfLimit$1,
14025
14278
  eachOfSeries: eachOfSeries$1,
14026
14279
  eachSeries: eachSeries$1,
14027
14280
  ensureAsync,
@@ -14047,13 +14300,13 @@ var index = {
14047
14300
  parallel,
14048
14301
  parallelLimit,
14049
14302
  priorityQueue,
14050
- queue: queue$1,
14303
+ queue,
14051
14304
  race: race$1,
14052
14305
  reduce: reduce$1,
14053
14306
  reduceRight,
14054
14307
  reflect,
14055
14308
  reflectAll,
14056
- reject: reject$2,
14309
+ reject: reject$1,
14057
14310
  rejectLimit: rejectLimit$1,
14058
14311
  rejectSeries: rejectSeries$1,
14059
14312
  retry,
@@ -14091,10 +14344,10 @@ var index = {
14091
14344
  flatMapSeries: concatSeries$1,
14092
14345
  forEach: each,
14093
14346
  forEachSeries: eachSeries$1,
14094
- forEachLimit: eachLimit$2,
14347
+ forEachLimit: eachLimit$1,
14095
14348
  forEachOf: eachOf$1,
14096
14349
  forEachOfSeries: eachOfSeries$1,
14097
- forEachOfLimit: eachOfLimit$2,
14350
+ forEachOfLimit: eachOfLimit$1,
14098
14351
  inject: reduce$1,
14099
14352
  foldl: reduce$1,
14100
14353
  foldr: reduceRight,
@@ -14115,18 +14368,18 @@ var async = /*#__PURE__*/Object.freeze({
14115
14368
  anyLimit: someLimit$1,
14116
14369
  anySeries: someSeries$1,
14117
14370
  apply: apply,
14118
- applyEach: applyEach$1,
14371
+ applyEach: applyEach,
14119
14372
  applyEachSeries: applyEachSeries,
14120
14373
  asyncify: asyncify,
14121
14374
  auto: auto,
14122
14375
  autoInject: autoInject,
14123
- cargo: cargo,
14124
- cargoQueue: cargo$1,
14376
+ cargo: cargo$1,
14377
+ cargoQueue: cargo,
14125
14378
  compose: compose,
14126
14379
  concat: concat$1,
14127
14380
  concatLimit: concatLimit$1,
14128
14381
  concatSeries: concatSeries$1,
14129
- constant: constant,
14382
+ constant: constant$1,
14130
14383
  default: index,
14131
14384
  detect: detect$1,
14132
14385
  detectLimit: detectLimit$1,
@@ -14137,9 +14390,9 @@ var async = /*#__PURE__*/Object.freeze({
14137
14390
  doWhilst: doWhilst$1,
14138
14391
  during: whilst$1,
14139
14392
  each: each,
14140
- eachLimit: eachLimit$2,
14393
+ eachLimit: eachLimit$1,
14141
14394
  eachOf: eachOf$1,
14142
- eachOfLimit: eachOfLimit$2,
14395
+ eachOfLimit: eachOfLimit$1,
14143
14396
  eachOfSeries: eachOfSeries$1,
14144
14397
  eachSeries: eachSeries$1,
14145
14398
  ensureAsync: ensureAsync,
@@ -14158,9 +14411,9 @@ var async = /*#__PURE__*/Object.freeze({
14158
14411
  foldl: reduce$1,
14159
14412
  foldr: reduceRight,
14160
14413
  forEach: each,
14161
- forEachLimit: eachLimit$2,
14414
+ forEachLimit: eachLimit$1,
14162
14415
  forEachOf: eachOf$1,
14163
- forEachOfLimit: eachOfLimit$2,
14416
+ forEachOfLimit: eachOfLimit$1,
14164
14417
  forEachOfSeries: eachOfSeries$1,
14165
14418
  forEachSeries: eachSeries$1,
14166
14419
  forever: forever$1,
@@ -14180,13 +14433,13 @@ var async = /*#__PURE__*/Object.freeze({
14180
14433
  parallel: parallel,
14181
14434
  parallelLimit: parallelLimit,
14182
14435
  priorityQueue: priorityQueue,
14183
- queue: queue$1,
14436
+ queue: queue,
14184
14437
  race: race$1,
14185
14438
  reduce: reduce$1,
14186
14439
  reduceRight: reduceRight,
14187
14440
  reflect: reflect,
14188
14441
  reflectAll: reflectAll,
14189
- reject: reject$2,
14442
+ reject: reject$1,
14190
14443
  rejectLimit: rejectLimit$1,
14191
14444
  rejectSeries: rejectSeries$1,
14192
14445
  retry: retry,
@@ -17605,10 +17858,10 @@ function requireStackTrace () {
17605
17858
  path = path.trim();
17606
17859
  if (/^file:/.test(path)) {
17607
17860
  // existsSync/readFileSync can't handle file protocol, but once stripped, it works
17608
- path = path.replace(/file:\/\/\/(\w:)?/, function(_protocol, drive) {
17609
- return drive ?
17610
- '' : // file:///C:/dir/file -> C:/dir/file
17611
- '/'; // file:///root-dir/file -> /root-dir/file
17861
+ path = path.replace(/file:\/\/\/(\w:)?/, function (_protocol, drive) {
17862
+ return drive
17863
+ ? '' // file:///C:/dir/file -> C:/dir/file
17864
+ : '/'; // file:///root-dir/file -> /root-dir/file
17612
17865
  });
17613
17866
  }
17614
17867
  if (path in fileContentsCache) {
@@ -17624,7 +17877,7 @@ function requireStackTrace () {
17624
17877
  /* ignore any errors */
17625
17878
  }
17626
17879
 
17627
- return fileContentsCache[path] = contents;
17880
+ return (fileContentsCache[path] = contents);
17628
17881
  }
17629
17882
 
17630
17883
  // Support URLs relative to a directory, but be careful about a protocol prefix
@@ -17638,7 +17891,10 @@ function requireStackTrace () {
17638
17891
  if (protocol && /^\/\w\:/.test(startPath)) {
17639
17892
  // handle file:///C:/ paths
17640
17893
  protocol += '/';
17641
- return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/');
17894
+ return (
17895
+ protocol +
17896
+ path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/')
17897
+ );
17642
17898
  }
17643
17899
  return protocol + path.resolve(dir.slice(protocol.length), url);
17644
17900
  }
@@ -17648,7 +17904,8 @@ function requireStackTrace () {
17648
17904
 
17649
17905
  // Get the URL of the source map
17650
17906
  fileData = retrieveFile(source);
17651
- var re = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg;
17907
+ var re =
17908
+ /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;
17652
17909
  // Keep executing the search to find the *last* sourceMappingURL to avoid
17653
17910
  // picking up sourceMappingURLs from comments, strings, etc.
17654
17911
  var lastMatch, match;
@@ -17684,7 +17941,7 @@ function requireStackTrace () {
17684
17941
 
17685
17942
  return {
17686
17943
  url: sourceMappingURL,
17687
- map: sourceMapData
17944
+ map: sourceMapData,
17688
17945
  };
17689
17946
  }
17690
17947
 
@@ -17696,7 +17953,10 @@ function requireStackTrace () {
17696
17953
  // The sourceContentFor lookup needs the original source url as found in the
17697
17954
  // map file. However the client lookup in sourcesContentCache will use
17698
17955
  // a rewritten form of the url, hence originalSource and newSource.
17699
- sourcesContentCache[newSource] = sourceMap.map.sourceContentFor(originalSource, true);
17956
+ sourcesContentCache[newSource] = sourceMap.map.sourceContentFor(
17957
+ originalSource,
17958
+ true,
17959
+ );
17700
17960
  }
17701
17961
 
17702
17962
  stackTrace.mapSourcePosition = function mapSourcePosition(position, diagnostic) {
@@ -17707,14 +17967,15 @@ function requireStackTrace () {
17707
17967
  if (urlAndMap) {
17708
17968
  sourceMap = sourceMapCache[position.source] = {
17709
17969
  url: urlAndMap.url,
17710
- map: new SourceMapConsumer(urlAndMap.map)
17970
+ map: new SourceMapConsumer(urlAndMap.map),
17711
17971
  };
17712
- diagnostic.node_source_maps.source_mapping_urls[position.source] = urlAndMap.url;
17972
+ diagnostic.node_source_maps.source_mapping_urls[position.source] =
17973
+ urlAndMap.url;
17713
17974
 
17714
17975
  // Load all sources stored inline with the source map into the file cache
17715
17976
  // to pretend like they are already loaded. They may not exist on disk.
17716
17977
  if (sourceMap.map.sourcesContent) {
17717
- sourceMap.map.sources.forEach(function(source, i) {
17978
+ sourceMap.map.sources.forEach(function (source, i) {
17718
17979
  var contents = sourceMap.map.sourcesContent[i];
17719
17980
  if (contents) {
17720
17981
  var url = supportRelativeURL(sourceMap.url, source);
@@ -17725,14 +17986,19 @@ function requireStackTrace () {
17725
17986
  } else {
17726
17987
  sourceMap = sourceMapCache[position.source] = {
17727
17988
  url: null,
17728
- map: null
17989
+ map: null,
17729
17990
  };
17730
- diagnostic.node_source_maps.source_mapping_urls[position.source] = 'not found';
17991
+ diagnostic.node_source_maps.source_mapping_urls[position.source] =
17992
+ 'not found';
17731
17993
  }
17732
17994
  }
17733
17995
 
17734
17996
  // Resolve the source URL relative to the URL of the source map
17735
- if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === 'function') {
17997
+ if (
17998
+ sourceMap &&
17999
+ sourceMap.map &&
18000
+ typeof sourceMap.map.originalPositionFor === 'function'
18001
+ ) {
17736
18002
  var originalPosition = sourceMap.map.originalPositionFor(position);
17737
18003
 
17738
18004
  // Only return the original position if a matching line was found. If no
@@ -17743,7 +18009,9 @@ function requireStackTrace () {
17743
18009
  if (originalPosition.source !== null) {
17744
18010
  var originalSource = originalPosition.source;
17745
18011
  originalPosition.source = supportRelativeURL(
17746
- sourceMap.url, originalPosition.source);
18012
+ sourceMap.url,
18013
+ originalPosition.source,
18014
+ );
17747
18015
  cacheSourceContent(sourceMap, originalSource, originalPosition.source);
17748
18016
  return originalPosition;
17749
18017
  }
@@ -17779,19 +18047,16 @@ function requireParser () {
17779
18047
  var jadeTracePattern = /^\s*at .+ \(.+ (at[^)]+\))\)$/;
17780
18048
  var jadeFramePattern = /^\s*(>?) [0-9]+\|(\s*.+)$/m;
17781
18049
 
17782
-
17783
- var cache = new lru({max: 100});
18050
+ var cache = new lru({ max: 100 });
17784
18051
  var pendingReads = {};
17785
18052
 
17786
18053
  exports.cache = cache;
17787
18054
  exports.pendingReads = pendingReads;
17788
18055
 
17789
-
17790
18056
  /*
17791
18057
  * Internal
17792
18058
  */
17793
18059
 
17794
-
17795
18060
  function getMultipleErrors(errors) {
17796
18061
  var errArray, key;
17797
18062
 
@@ -17817,10 +18082,19 @@ function requireParser () {
17817
18082
  return errArray;
17818
18083
  }
17819
18084
 
17820
-
17821
18085
  function parseJadeDebugFrame(body) {
17822
- var lines, lineNumSep, filename, lineno, numLines, msg, i,
17823
- contextLine, preContext, postContext, line, jadeMatch;
18086
+ var lines,
18087
+ lineNumSep,
18088
+ filename,
18089
+ lineno,
18090
+ numLines,
18091
+ msg,
18092
+ i,
18093
+ contextLine,
18094
+ preContext,
18095
+ postContext,
18096
+ line,
18097
+ jadeMatch;
17824
18098
 
17825
18099
  // Given a Jade exception body, return a frame object
17826
18100
  lines = body.split('\n');
@@ -17855,7 +18129,10 @@ function requireParser () {
17855
18129
  }
17856
18130
 
17857
18131
  preContext = preContext.slice(0, Math.min(preContext.length, linesOfContext));
17858
- postContext = postContext.slice(0, Math.min(postContext.length, linesOfContext));
18132
+ postContext = postContext.slice(
18133
+ 0,
18134
+ Math.min(postContext.length, linesOfContext),
18135
+ );
17859
18136
 
17860
18137
  return {
17861
18138
  frame: {
@@ -17865,29 +18142,32 @@ function requireParser () {
17865
18142
  code: contextLine,
17866
18143
  context: {
17867
18144
  pre: preContext,
17868
- post: postContext
17869
- }
18145
+ post: postContext,
18146
+ },
17870
18147
  },
17871
- message: msg
18148
+ message: msg,
17872
18149
  };
17873
18150
  }
17874
18151
 
17875
-
17876
18152
  function extractContextLines(frame, fileLines) {
17877
18153
  frame.code = fileLines[frame.lineno - 1];
17878
18154
  frame.context = {
17879
- pre: fileLines.slice(Math.max(0, frame.lineno - (linesOfContext + 1)), frame.lineno - 1),
17880
- post: fileLines.slice(frame.lineno, frame.lineno + linesOfContext)
18155
+ pre: fileLines.slice(
18156
+ Math.max(0, frame.lineno - (linesOfContext + 1)),
18157
+ frame.lineno - 1,
18158
+ ),
18159
+ post: fileLines.slice(frame.lineno, frame.lineno + linesOfContext),
17881
18160
  };
17882
18161
  }
17883
18162
 
17884
18163
  function mapPosition(position, diagnostic) {
17885
- return stackTrace.mapSourcePosition({
18164
+ return stackTrace.mapSourcePosition(
18165
+ {
17886
18166
  source: position.source,
17887
18167
  line: position.line,
17888
- column: position.column
18168
+ column: position.column,
17889
18169
  },
17890
- diagnostic
18170
+ diagnostic,
17891
18171
  );
17892
18172
  }
17893
18173
 
@@ -17909,7 +18189,7 @@ function requireParser () {
17909
18189
  var runtimePosition = {
17910
18190
  source: data[1],
17911
18191
  line: Math.floor(data[2]),
17912
- column: Math.floor(data[3]) - 1
18192
+ column: Math.floor(data[3]) - 1,
17913
18193
  };
17914
18194
  if (this.useSourceMaps) {
17915
18195
  position = mapPosition(runtimePosition, this.diagnostic);
@@ -17922,7 +18202,7 @@ function requireParser () {
17922
18202
  filename: position.source,
17923
18203
  lineno: position.line,
17924
18204
  colno: position.column,
17925
- runtimePosition: runtimePosition // Used to match frames for locals
18205
+ runtimePosition: runtimePosition, // Used to match frames for locals
17926
18206
  };
17927
18207
 
17928
18208
  // For coffeescript, lineno and colno refer to the .coffee positions
@@ -17938,7 +18218,6 @@ function requireParser () {
17938
18218
  callback(null, frame);
17939
18219
  }
17940
18220
 
17941
-
17942
18221
  function shouldReadFrameFile(frameFilename, callback) {
17943
18222
  var isValidFilename, isCached, isPending;
17944
18223
 
@@ -17949,7 +18228,6 @@ function requireParser () {
17949
18228
  callback(null, isValidFilename && !isCached && !isPending);
17950
18229
  }
17951
18230
 
17952
-
17953
18231
  function readFileLines(filename, callback) {
17954
18232
  try {
17955
18233
  fs.readFile(filename, function (err, fileData) {
@@ -17975,7 +18253,6 @@ function requireParser () {
17975
18253
  });
17976
18254
  }
17977
18255
 
17978
-
17979
18256
  function gatherContexts(frames, callback) {
17980
18257
  var frameFilenames = [];
17981
18258
 
@@ -18045,7 +18322,6 @@ function requireParser () {
18045
18322
  });
18046
18323
  });
18047
18324
  });
18048
-
18049
18325
  });
18050
18326
  }
18051
18327
 
@@ -18053,7 +18329,6 @@ function requireParser () {
18053
18329
  * Public API
18054
18330
  */
18055
18331
 
18056
-
18057
18332
  exports.parseException = function (exc, options, item, callback) {
18058
18333
  var multipleErrs = getMultipleErrors(exc.errors);
18059
18334
 
@@ -18064,13 +18339,13 @@ function requireParser () {
18064
18339
  logger.error('could not parse exception, err: ' + err);
18065
18340
  return callback(err);
18066
18341
  }
18067
- message = String(exc.message || '<no message>') ;
18342
+ message = String(exc.message || '<no message>');
18068
18343
  clss = String(exc.name || '<unknown>');
18069
18344
 
18070
18345
  ret = {
18071
18346
  class: clss,
18072
18347
  message: message,
18073
- frames: stack
18348
+ frames: stack,
18074
18349
  };
18075
18350
 
18076
18351
  if (multipleErrs && multipleErrs.length) {
@@ -18078,7 +18353,7 @@ function requireParser () {
18078
18353
  ret = {
18079
18354
  class: clss,
18080
18355
  message: String(firstErr.message || '<no message>'),
18081
- frames: stack
18356
+ frames: stack,
18082
18357
  };
18083
18358
  }
18084
18359
 
@@ -18090,25 +18365,30 @@ function requireParser () {
18090
18365
  }
18091
18366
 
18092
18367
  if (item.localsMap) {
18093
- item.notifier.locals.mergeLocals(item.localsMap, stack, exc.stack, function (err) {
18094
- if (err) {
18095
- logger.error('could not parse locals, err: ' + err);
18368
+ item.notifier.locals.mergeLocals(
18369
+ item.localsMap,
18370
+ stack,
18371
+ exc.stack,
18372
+ function (err) {
18373
+ if (err) {
18374
+ logger.error('could not parse locals, err: ' + err);
18096
18375
 
18097
- // Don't reject the occurrence, record the error instead.
18098
- item.diagnostic['error parsing locals'] = err;
18099
- }
18376
+ // Don't reject the occurrence, record the error instead.
18377
+ item.diagnostic['error parsing locals'] = err;
18378
+ }
18100
18379
 
18101
- return callback(null, ret);
18102
- });
18380
+ return callback(null, ret);
18381
+ },
18382
+ );
18103
18383
  } else {
18104
18384
  return callback(null, ret);
18105
18385
  }
18106
18386
  });
18107
18387
  };
18108
18388
 
18109
-
18110
18389
  exports.parseStack = function (stack, options, item, callback) {
18111
- var lines, _stack = stack;
18390
+ var lines,
18391
+ _stack = stack;
18112
18392
 
18113
18393
  // Some JS frameworks (e.g. Meteor) might bury the stack property
18114
18394
  while (typeof _stack === 'object') {
@@ -18124,16 +18404,29 @@ function requireParser () {
18124
18404
  }
18125
18405
 
18126
18406
  // Parse out all of the frame and filename info
18127
- async.map(lines, parseFrameLine.bind({ useSourceMaps: options.nodeSourceMaps, diagnostic: item.diagnostic }), function (err, frames) {
18128
- if (err) {
18129
- return callback(err);
18130
- }
18131
- frames.reverse();
18132
- async.filter(frames, function (frame, callback) { callback(null, !!frame); }, function (err, results) {
18133
- if (err) return callback(err);
18134
- gatherContexts(results, callback);
18135
- });
18136
- });
18407
+ async.map(
18408
+ lines,
18409
+ parseFrameLine.bind({
18410
+ useSourceMaps: options.nodeSourceMaps,
18411
+ diagnostic: item.diagnostic,
18412
+ }),
18413
+ function (err, frames) {
18414
+ if (err) {
18415
+ return callback(err);
18416
+ }
18417
+ frames.reverse();
18418
+ async.filter(
18419
+ frames,
18420
+ function (frame, callback) {
18421
+ callback(null, !!frame);
18422
+ },
18423
+ function (err, results) {
18424
+ if (err) return callback(err);
18425
+ gatherContexts(results, callback);
18426
+ },
18427
+ );
18428
+ },
18429
+ );
18137
18430
  };
18138
18431
  } (parser));
18139
18432
  return parser;
@@ -18431,7 +18724,6 @@ function requireScrub () {
18431
18724
  return ret;
18432
18725
  }
18433
18726
 
18434
-
18435
18727
  function _getScrubQueryParamRegexs(scrubFields) {
18436
18728
  var ret = [];
18437
18729
  var pat;
@@ -18460,7 +18752,8 @@ function requireTransforms$1 () {
18460
18752
  var scrub = requireScrub();
18461
18753
 
18462
18754
  function baseData(item, options, callback) {
18463
- var environment = (options.payload && options.payload.environment) || options.environment;
18755
+ var environment =
18756
+ (options.payload && options.payload.environment) || options.environment;
18464
18757
  var data = {
18465
18758
  timestamp: Math.round(item.timestamp / 1000),
18466
18759
  environment: item.environment || environment,
@@ -18469,7 +18762,7 @@ function requireTransforms$1 () {
18469
18762
  framework: item.framework || options.framework,
18470
18763
  uuid: item.uuid,
18471
18764
  notifier: JSON.parse(JSON.stringify(options.notifier)),
18472
- custom: item.custom
18765
+ custom: item.custom,
18473
18766
  };
18474
18767
 
18475
18768
  if (options.codeVersion) {
@@ -18488,7 +18781,7 @@ function requireTransforms$1 () {
18488
18781
  data.server = {
18489
18782
  host: options.host,
18490
18783
  argv: process.argv.concat(),
18491
- pid: process.pid
18784
+ pid: process.pid,
18492
18785
  };
18493
18786
 
18494
18787
  if (options.branch) {
@@ -18507,7 +18800,7 @@ function requireTransforms$1 () {
18507
18800
  item.data.body = item.data.body || {};
18508
18801
  var message = item.message || 'Item sent with null or missing arguments.';
18509
18802
  item.data.body.message = {
18510
- body: message
18803
+ body: message,
18511
18804
  };
18512
18805
  callback(null, item);
18513
18806
  }
@@ -18547,9 +18840,13 @@ function requireTransforms$1 () {
18547
18840
  _.addErrorContext(item, errors);
18548
18841
  }
18549
18842
 
18550
- var cb = function(e) {
18843
+ var cb = function (e) {
18551
18844
  if (e) {
18552
- item.message = item.err.message || item.err.description || item.message || String(item.err);
18845
+ item.message =
18846
+ item.err.message ||
18847
+ item.err.description ||
18848
+ item.message ||
18849
+ String(item.err);
18553
18850
  item.diagnostic.buildTraceData = e.message;
18554
18851
  delete item.stackInfo;
18555
18852
  }
@@ -18583,11 +18880,13 @@ function requireTransforms$1 () {
18583
18880
 
18584
18881
  if (req.route) {
18585
18882
  routePath = req.route.path;
18586
- item.data.context = baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18883
+ item.data.context =
18884
+ baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18587
18885
  } else {
18588
18886
  try {
18589
18887
  routePath = req.app._router.matchRequest(req).path;
18590
- item.data.context = baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18888
+ item.data.context =
18889
+ baseUrl && baseUrl.length ? baseUrl + routePath : routePath;
18591
18890
  } catch (ignore) {
18592
18891
  // Ignored
18593
18892
  }
@@ -18605,7 +18904,7 @@ function requireTransforms$1 () {
18605
18904
  }
18606
18905
  item.data.person = person;
18607
18906
  } else if (req.user) {
18608
- item.data.person = {id: req.user.id};
18907
+ item.data.person = { id: req.user.id };
18609
18908
  if (req.user.username && captureUsername) {
18610
18909
  item.data.person.username = req.user.username;
18611
18910
  }
@@ -18617,7 +18916,7 @@ function requireTransforms$1 () {
18617
18916
  if (_.isFunction(userId)) {
18618
18917
  userId = userId();
18619
18918
  }
18620
- item.data.person = {id: userId};
18919
+ item.data.person = { id: userId };
18621
18920
  }
18622
18921
 
18623
18922
  callback(null, item);
@@ -18636,7 +18935,7 @@ function requireTransforms$1 () {
18636
18935
  functionName: c.functionName,
18637
18936
  functionVersion: c.functionVersion,
18638
18937
  arn: c.invokedFunctionArn,
18639
- requestId: c.awsRequestId
18938
+ requestId: c.awsRequestId,
18640
18939
  };
18641
18940
 
18642
18941
  item.data = item.data || {};
@@ -18660,7 +18959,9 @@ function requireTransforms$1 () {
18660
18959
  }
18661
18960
 
18662
18961
  function parseRequestBody(req, options) {
18663
- if (!req || !options.scrubRequestBody) { return }
18962
+ if (!req || !options.scrubRequestBody) {
18963
+ return;
18964
+ }
18664
18965
 
18665
18966
  try {
18666
18967
  if (_.isString(req.body) && _isJsonContentType(req)) {
@@ -18673,7 +18974,9 @@ function requireTransforms$1 () {
18673
18974
  }
18674
18975
 
18675
18976
  function serializeRequestBody(req, options) {
18676
- if (!req || !options.scrubRequestBody) { return }
18977
+ if (!req || !options.scrubRequestBody) {
18978
+ return;
18979
+ }
18677
18980
 
18678
18981
  try {
18679
18982
  if (_.isObject(req.body) && _isJsonContentType(req)) {
@@ -18688,11 +18991,15 @@ function requireTransforms$1 () {
18688
18991
  /** Helpers **/
18689
18992
 
18690
18993
  function _isJsonContentType(req) {
18691
- return req.headers && req.headers['content-type'] && req.headers['content-type'].includes('json');
18994
+ return (
18995
+ req.headers &&
18996
+ req.headers['content-type'] &&
18997
+ req.headers['content-type'].includes('json')
18998
+ );
18692
18999
  }
18693
19000
 
18694
19001
  function _buildTraceData(chain, options, item) {
18695
- return function(ex, cb) {
19002
+ return function (ex, cb) {
18696
19003
  parser.parseException(ex, options, item, function (err, errData) {
18697
19004
  if (err) {
18698
19005
  return cb(err);
@@ -18702,8 +19009,8 @@ function requireTransforms$1 () {
18702
19009
  frames: errData.frames,
18703
19010
  exception: {
18704
19011
  class: errData['class'],
18705
- message: errData.message
18706
- }
19012
+ message: errData.message,
19013
+ },
18707
19014
  });
18708
19015
 
18709
19016
  return cb(null);
@@ -18722,7 +19029,8 @@ function requireTransforms$1 () {
18722
19029
  function _buildRequestData(req) {
18723
19030
  var headers = req.headers || {};
18724
19031
  var host = headers.host || '<no host>';
18725
- var proto = req.protocol || ((req.socket && req.socket.encrypted) ? 'https' : 'http' );
19032
+ var proto =
19033
+ req.protocol || (req.socket && req.socket.encrypted ? 'https' : 'http');
18726
19034
  var parsedUrl;
18727
19035
  var baseUrl = req.baseUrl || '';
18728
19036
  if (_.isType(req.url, 'string')) {
@@ -18738,7 +19046,7 @@ function requireTransforms$1 () {
18738
19046
  url: reqUrl,
18739
19047
  user_ip: _extractIp(req),
18740
19048
  headers: headers,
18741
- method: req.method
19049
+ method: req.method,
18742
19050
  };
18743
19051
  if (parsedUrl.search && parsedUrl.search.length > 0) {
18744
19052
  data.GET = parsedUrl.query;
@@ -18769,7 +19077,7 @@ function requireTransforms$1 () {
18769
19077
  addErrorData: addErrorData,
18770
19078
  addRequestData: addRequestData,
18771
19079
  addLambdaData: addLambdaData,
18772
- scrubPayload: scrubPayload
19080
+ scrubPayload: scrubPayload,
18773
19081
  };
18774
19082
  return transforms$1;
18775
19083
  }
@@ -18824,19 +19132,19 @@ function requireTransforms () {
18824
19132
  }
18825
19133
  if (trace) {
18826
19134
  if (!(trace.exception && trace.exception.description)) {
18827
- _.set(item, tracePath+'.exception.description', item.message);
19135
+ _.set(item, tracePath + '.exception.description', item.message);
18828
19136
  callback(null, item);
18829
19137
  return;
18830
19138
  }
18831
- var extra = _.get(item, tracePath+'.extra') || {};
18832
- var newExtra = _.merge(extra, {message: item.message});
18833
- _.set(item, tracePath+'.extra', newExtra);
19139
+ var extra = _.get(item, tracePath + '.extra') || {};
19140
+ var newExtra = _.merge(extra, { message: item.message });
19141
+ _.set(item, tracePath + '.extra', newExtra);
18834
19142
  }
18835
19143
  callback(null, item);
18836
19144
  }
18837
19145
 
18838
19146
  function userTransform(logger) {
18839
- return function(item, options, callback) {
19147
+ return function (item, options, callback) {
18840
19148
  var newItem = _.merge(item);
18841
19149
  var response = null;
18842
19150
  try {
@@ -18845,23 +19153,29 @@ function requireTransforms () {
18845
19153
  }
18846
19154
  } catch (e) {
18847
19155
  options.transform = null;
18848
- logger.error('Error while calling custom transform() function. Removing custom transform().', e);
19156
+ logger.error(
19157
+ 'Error while calling custom transform() function. Removing custom transform().',
19158
+ e,
19159
+ );
18849
19160
  callback(null, item);
18850
19161
  return;
18851
19162
  }
18852
- if(_.isPromise(response)) {
18853
- response.then(function (promisedItem) {
18854
- if(promisedItem) {
18855
- newItem.data = promisedItem;
18856
- }
18857
- callback(null, newItem);
18858
- }, function (error) {
18859
- callback(error, item);
18860
- });
19163
+ if (_.isPromise(response)) {
19164
+ response.then(
19165
+ function (promisedItem) {
19166
+ if (promisedItem) {
19167
+ newItem.data = promisedItem;
19168
+ }
19169
+ callback(null, newItem);
19170
+ },
19171
+ function (error) {
19172
+ callback(error, item);
19173
+ },
19174
+ );
18861
19175
  } else {
18862
19176
  callback(null, newItem);
18863
19177
  }
18864
- }
19178
+ };
18865
19179
  }
18866
19180
 
18867
19181
  function addConfigToPayload(item, options, callback) {
@@ -18876,7 +19190,7 @@ function requireTransforms () {
18876
19190
  }
18877
19191
 
18878
19192
  function addFunctionOption(options, name) {
18879
- if(_.isFunction(options[name])) {
19193
+ if (_.isFunction(options[name])) {
18880
19194
  options[name] = options[name].toString();
18881
19195
  }
18882
19196
  }
@@ -18895,7 +19209,10 @@ function requireTransforms () {
18895
19209
  }
18896
19210
 
18897
19211
  function addDiagnosticKeys(item, options, callback) {
18898
- var diagnostic = _.merge(item.notifier.client.notifier.diagnostic, item.diagnostic);
19212
+ var diagnostic = _.merge(
19213
+ item.notifier.client.notifier.diagnostic,
19214
+ item.diagnostic,
19215
+ );
18899
19216
 
18900
19217
  if (_.get(item, 'err._isAnonymous')) {
18901
19218
  diagnostic.is_anonymous = true;
@@ -18914,14 +19231,17 @@ function requireTransforms () {
18914
19231
  filename: item.err.fileName,
18915
19232
  line: item.err.lineNumber,
18916
19233
  column: item.err.columnNumber,
18917
- stack: item.err.stack
19234
+ stack: item.err.stack,
18918
19235
  };
18919
19236
  } catch (e) {
18920
19237
  diagnostic.raw_error = { failed: String(e) };
18921
19238
  }
18922
19239
  }
18923
19240
 
18924
- item.data.notifier.diagnostic = _.merge(item.data.notifier.diagnostic, diagnostic);
19241
+ item.data.notifier.diagnostic = _.merge(
19242
+ item.data.notifier.diagnostic,
19243
+ diagnostic,
19244
+ );
18925
19245
  callback(null, item);
18926
19246
  }
18927
19247
 
@@ -18933,7 +19253,7 @@ function requireTransforms () {
18933
19253
  userTransform: userTransform,
18934
19254
  addConfigToPayload: addConfigToPayload,
18935
19255
  addConfiguredOptions: addConfiguredOptions,
18936
- addDiagnosticKeys: addDiagnosticKeys
19256
+ addDiagnosticKeys: addDiagnosticKeys,
18937
19257
  };
18938
19258
  return transforms;
18939
19259
  }
@@ -18959,7 +19279,7 @@ function requirePredicates () {
18959
19279
  }
18960
19280
 
18961
19281
  function userCheckIgnore(logger) {
18962
- return function(item, settings) {
19282
+ return function (item, settings) {
18963
19283
  var isUncaught = !!item._isUncaught;
18964
19284
  delete item._isUncaught;
18965
19285
  var args = item._originalArgs;
@@ -18973,7 +19293,10 @@ function requirePredicates () {
18973
19293
  logger.error('Error while calling onSendCallback, removing', e);
18974
19294
  }
18975
19295
  try {
18976
- if (_.isFunction(settings.checkIgnore) && settings.checkIgnore(isUncaught, args, item)) {
19296
+ if (
19297
+ _.isFunction(settings.checkIgnore) &&
19298
+ settings.checkIgnore(isUncaught, args, item)
19299
+ ) {
18977
19300
  return false;
18978
19301
  }
18979
19302
  } catch (e) {
@@ -18981,27 +19304,31 @@ function requirePredicates () {
18981
19304
  logger.error('Error while calling custom checkIgnore(), removing', e);
18982
19305
  }
18983
19306
  return true;
18984
- }
19307
+ };
18985
19308
  }
18986
19309
 
18987
19310
  function urlIsNotBlockListed(logger) {
18988
- return function(item, settings) {
19311
+ return function (item, settings) {
18989
19312
  return !urlIsOnAList(item, settings, 'blocklist', logger);
18990
- }
19313
+ };
18991
19314
  }
18992
19315
 
18993
19316
  function urlIsSafeListed(logger) {
18994
- return function(item, settings) {
19317
+ return function (item, settings) {
18995
19318
  return urlIsOnAList(item, settings, 'safelist', logger);
18996
- }
19319
+ };
18997
19320
  }
18998
19321
 
18999
19322
  function matchFrames(trace, list, block) {
19000
- if (!trace) { return !block }
19323
+ if (!trace) {
19324
+ return !block;
19325
+ }
19001
19326
 
19002
19327
  var frames = trace.frames;
19003
19328
 
19004
- if (!frames || frames.length === 0) { return !block; }
19329
+ if (!frames || frames.length === 0) {
19330
+ return !block;
19331
+ }
19005
19332
 
19006
19333
  var frame, filename, url, urlRegex;
19007
19334
  var listLength = list.length;
@@ -19010,7 +19337,9 @@ function requirePredicates () {
19010
19337
  frame = frames[i];
19011
19338
  filename = frame.filename;
19012
19339
 
19013
- if (!_.isType(filename, 'string')) { return !block; }
19340
+ if (!_.isType(filename, 'string')) {
19341
+ return !block;
19342
+ }
19014
19343
 
19015
19344
  for (var j = 0; j < listLength; j++) {
19016
19345
  url = list[j];
@@ -19047,27 +19376,35 @@ function requirePredicates () {
19047
19376
 
19048
19377
  var tracesLength = traces.length;
19049
19378
  for (var i = 0; i < tracesLength; i++) {
19050
- if(matchFrames(traces[i], list, block)) {
19379
+ if (matchFrames(traces[i], list, block)) {
19051
19380
  return true;
19052
19381
  }
19053
19382
  }
19054
- } catch (e)
19055
- /* istanbul ignore next */
19056
- {
19383
+ } catch (
19384
+ e
19385
+ /* istanbul ignore next */
19386
+ ) {
19057
19387
  if (block) {
19058
19388
  settings.hostBlockList = null;
19059
19389
  } else {
19060
19390
  settings.hostSafeList = null;
19061
19391
  }
19062
19392
  var listName = block ? 'hostBlockList' : 'hostSafeList';
19063
- logger.error('Error while reading your configuration\'s ' + listName + ' option. Removing custom ' + listName + '.', e);
19393
+ logger.error(
19394
+ "Error while reading your configuration's " +
19395
+ listName +
19396
+ ' option. Removing custom ' +
19397
+ listName +
19398
+ '.',
19399
+ e,
19400
+ );
19064
19401
  return !block;
19065
19402
  }
19066
19403
  return false;
19067
19404
  }
19068
19405
 
19069
19406
  function messageIsIgnored(logger) {
19070
- return function(item, settings) {
19407
+ return function (item, settings) {
19071
19408
  var i, j, ignoredMessages, len, messageIsIgnored, rIgnoredMessage, messages;
19072
19409
 
19073
19410
  try {
@@ -19080,7 +19417,7 @@ function requirePredicates () {
19080
19417
 
19081
19418
  messages = messagesFromItem(item);
19082
19419
 
19083
- if (messages.length === 0){
19420
+ if (messages.length === 0) {
19084
19421
  return true;
19085
19422
  }
19086
19423
 
@@ -19096,15 +19433,18 @@ function requirePredicates () {
19096
19433
  }
19097
19434
  }
19098
19435
  }
19099
- } catch(e)
19100
- /* istanbul ignore next */
19101
- {
19436
+ } catch (
19437
+ e
19438
+ /* istanbul ignore next */
19439
+ ) {
19102
19440
  settings.ignoredMessages = null;
19103
- logger.error('Error while reading your configuration\'s ignoredMessages option. Removing custom ignoredMessages.');
19441
+ logger.error(
19442
+ "Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.",
19443
+ );
19104
19444
  }
19105
19445
 
19106
19446
  return true;
19107
- }
19447
+ };
19108
19448
  }
19109
19449
 
19110
19450
  function messagesFromItem(item) {
@@ -19135,7 +19475,7 @@ function requirePredicates () {
19135
19475
  userCheckIgnore: userCheckIgnore,
19136
19476
  urlIsNotBlockListed: urlIsNotBlockListed,
19137
19477
  urlIsSafeListed: urlIsSafeListed,
19138
- messageIsIgnored: messageIsIgnored
19478
+ messageIsIgnored: messageIsIgnored,
19139
19479
  };
19140
19480
  return predicates;
19141
19481
  }
@@ -19954,8 +20294,13 @@ function requireRollbar () {
19954
20294
  var transport = new Transport();
19955
20295
  var api = new API(this.options, transport, urllib, truncation, jsonBackup);
19956
20296
  var telemeter = new Telemeter(this.options);
19957
- this.client = client || new Client(this.options, api, logger, telemeter, 'server');
19958
- this.instrumenter = new Instrumenter(this.options, this.client.telemeter, this);
20297
+ this.client =
20298
+ client || new Client(this.options, api, logger, telemeter, 'server');
20299
+ this.instrumenter = new Instrumenter(
20300
+ this.options,
20301
+ this.client.telemeter,
20302
+ this,
20303
+ );
19959
20304
  this.instrumenter.instrument();
19960
20305
  if (this.options.locals) {
19961
20306
  this.locals = initLocals(this.options.locals, logger);
@@ -19969,7 +20314,9 @@ function requireRollbar () {
19969
20314
  function initLocals(localsOptions, logger) {
19970
20315
  // Capturing stack local variables is only supported in Node 10 and higher.
19971
20316
  var nodeMajorVersion = process.versions.node.split('.')[0];
19972
- if (nodeMajorVersion < 10) { return null; }
20317
+ if (nodeMajorVersion < 10) {
20318
+ return null;
20319
+ }
19973
20320
 
19974
20321
  var Locals;
19975
20322
  if (typeof localsOptions === 'function') {
@@ -19979,7 +20326,9 @@ function requireRollbar () {
19979
20326
  Locals = localsOptions.module;
19980
20327
  delete localsOptions.module;
19981
20328
  } else {
19982
- logger.error('options.locals or options.locals.module must be a Locals module');
20329
+ logger.error(
20330
+ 'options.locals or options.locals.module must be a Locals module',
20331
+ );
19983
20332
  return null;
19984
20333
  }
19985
20334
  return new Locals(localsOptions, logger);
@@ -20024,7 +20373,11 @@ function requireRollbar () {
20024
20373
  payload = { payload: payloadData };
20025
20374
  }
20026
20375
  this.options = _.handleOptions(oldOptions, options, payload, logger);
20027
- this.options._configuredOptions = _.handleOptions(oldOptions._configuredOptions, options, payload);
20376
+ this.options._configuredOptions = _.handleOptions(
20377
+ oldOptions._configuredOptions,
20378
+ options,
20379
+ payload,
20380
+ );
20028
20381
  // On the server we want to ignore any maxItems setting
20029
20382
  delete this.options.maxItems;
20030
20383
  logger.setVerbose(this.options.verbose);
@@ -20119,7 +20472,6 @@ function requireRollbar () {
20119
20472
  }
20120
20473
  };
20121
20474
 
20122
-
20123
20475
  Rollbar.prototype.warning = function () {
20124
20476
  var item = this._createItem(arguments);
20125
20477
  var uuid = item.uuid;
@@ -20135,7 +20487,6 @@ function requireRollbar () {
20135
20487
  }
20136
20488
  };
20137
20489
 
20138
-
20139
20490
  Rollbar.prototype.error = function () {
20140
20491
  var item = this._createItem(arguments);
20141
20492
  var uuid = item.uuid;
@@ -20200,7 +20551,7 @@ function requireRollbar () {
20200
20551
  };
20201
20552
  Rollbar.wait = function (callback) {
20202
20553
  if (_instance) {
20203
- return _instance.wait(callback)
20554
+ return _instance.wait(callback);
20204
20555
  } else {
20205
20556
  var maybeCallback = _getFirstFunction(arguments);
20206
20557
  handleUninitialized(maybeCallback);
@@ -20227,7 +20578,7 @@ function requireRollbar () {
20227
20578
  };
20228
20579
  Rollbar.errorHandler = function () {
20229
20580
  if (_instance) {
20230
- return _instance.errorHandler()
20581
+ return _instance.errorHandler();
20231
20582
  } else {
20232
20583
  handleUninitialized();
20233
20584
  }
@@ -20255,8 +20606,15 @@ function requireRollbar () {
20255
20606
  return new Promise(function (resolve, reject) {
20256
20607
  self.lambdaContext = context;
20257
20608
  if (shouldReportTimeouts) {
20258
- var timeoutCb = (timeoutHandler || _timeoutHandler).bind(null, event, context);
20259
- self.lambdaTimeoutHandle = setTimeout(timeoutCb, context.getRemainingTimeInMillis() - 1000);
20609
+ var timeoutCb = (timeoutHandler || _timeoutHandler).bind(
20610
+ null,
20611
+ event,
20612
+ context,
20613
+ );
20614
+ self.lambdaTimeoutHandle = setTimeout(
20615
+ timeoutCb,
20616
+ context.getRemainingTimeInMillis() - 1000,
20617
+ );
20260
20618
  }
20261
20619
  handler(event, context)
20262
20620
  .then(function (resp) {
@@ -20289,8 +20647,16 @@ function requireRollbar () {
20289
20647
  return function (event, context, callback) {
20290
20648
  self.lambdaContext = context;
20291
20649
  if (shouldReportTimeouts) {
20292
- var timeoutCb = (timeoutHandler || _timeoutHandler).bind(null, event, context, callback);
20293
- self.lambdaTimeoutHandle = setTimeout(timeoutCb, context.getRemainingTimeInMillis() - 1000);
20650
+ var timeoutCb = (timeoutHandler || _timeoutHandler).bind(
20651
+ null,
20652
+ event,
20653
+ context,
20654
+ callback,
20655
+ );
20656
+ self.lambdaTimeoutHandle = setTimeout(
20657
+ timeoutCb,
20658
+ context.getRemainingTimeInMillis() - 1000,
20659
+ );
20294
20660
  }
20295
20661
  try {
20296
20662
  handler(event, context, function (err, resp) {
@@ -20370,19 +20736,33 @@ function requireRollbar () {
20370
20736
  }
20371
20737
  };
20372
20738
 
20373
- Rollbar.prototype.reportMessageWithPayloadData = function (message, payloadData, request, callback) {
20739
+ Rollbar.prototype.reportMessageWithPayloadData = function (
20740
+ message,
20741
+ payloadData,
20742
+ request,
20743
+ callback,
20744
+ ) {
20374
20745
  logger.log('reportMessageWithPayloadData is deprecated');
20375
20746
  return this.error(message, request, payloadData, callback);
20376
20747
  };
20377
- Rollbar.reportMessageWithPayloadData = function (message, payloadData, request, callback) {
20748
+ Rollbar.reportMessageWithPayloadData = function (
20749
+ message,
20750
+ payloadData,
20751
+ request,
20752
+ callback,
20753
+ ) {
20378
20754
  if (_instance) {
20379
- return _instance.reportMessageWithPayloadData(message, payloadData, request, callback);
20755
+ return _instance.reportMessageWithPayloadData(
20756
+ message,
20757
+ payloadData,
20758
+ request,
20759
+ callback,
20760
+ );
20380
20761
  } else {
20381
20762
  handleUninitialized(callback);
20382
20763
  }
20383
20764
  };
20384
20765
 
20385
-
20386
20766
  Rollbar.prototype.handleError = function (err, request, callback) {
20387
20767
  logger.log('handleError is deprecated');
20388
20768
  return this.error(err, request, callback);
@@ -20395,14 +20775,28 @@ function requireRollbar () {
20395
20775
  }
20396
20776
  };
20397
20777
 
20398
-
20399
- Rollbar.prototype.handleErrorWithPayloadData = function (err, payloadData, request, callback) {
20778
+ Rollbar.prototype.handleErrorWithPayloadData = function (
20779
+ err,
20780
+ payloadData,
20781
+ request,
20782
+ callback,
20783
+ ) {
20400
20784
  logger.log('handleErrorWithPayloadData is deprecated');
20401
20785
  return this.error(err, request, payloadData, callback);
20402
20786
  };
20403
- Rollbar.handleErrorWithPayloadData = function (err, payloadData, request, callback) {
20787
+ Rollbar.handleErrorWithPayloadData = function (
20788
+ err,
20789
+ payloadData,
20790
+ request,
20791
+ callback,
20792
+ ) {
20404
20793
  if (_instance) {
20405
- return _instance.handleErrorWithPayloadData(err, payloadData, request, callback);
20794
+ return _instance.handleErrorWithPayloadData(
20795
+ err,
20796
+ payloadData,
20797
+ request,
20798
+ callback,
20799
+ );
20406
20800
  } else {
20407
20801
  handleUninitialized(callback);
20408
20802
  }
@@ -20428,7 +20822,10 @@ function requireRollbar () {
20428
20822
  }
20429
20823
  };
20430
20824
 
20431
- Rollbar.handleUncaughtExceptionsAndRejections = function (accessToken, options) {
20825
+ Rollbar.handleUncaughtExceptionsAndRejections = function (
20826
+ accessToken,
20827
+ options,
20828
+ ) {
20432
20829
  if (_instance) {
20433
20830
  options = options || {};
20434
20831
  options.accessToken = accessToken;
@@ -20491,7 +20888,10 @@ function requireRollbar () {
20491
20888
  if (this.options.captureUncaught || this.options.handleUncaughtExceptions) {
20492
20889
  this.handleUncaughtExceptions();
20493
20890
  }
20494
- if (this.options.captureUnhandledRejections || this.options.handleUnhandledRejections) {
20891
+ if (
20892
+ this.options.captureUnhandledRejections ||
20893
+ this.options.handleUnhandledRejections
20894
+ ) {
20495
20895
  this.handleUnhandledRejections();
20496
20896
  }
20497
20897
  };
@@ -20500,40 +20900,58 @@ function requireRollbar () {
20500
20900
  var exitOnUncaught = !!this.options.exitOnUncaughtException;
20501
20901
  delete this.options.exitOnUncaughtException;
20502
20902
 
20503
- addOrReplaceRollbarHandler('uncaughtException', function (err) {
20504
- if (!this.options.captureUncaught && !this.options.handleUncaughtExceptions) {
20505
- return;
20506
- }
20903
+ addOrReplaceRollbarHandler(
20904
+ 'uncaughtException',
20905
+ function (err) {
20906
+ if (
20907
+ !this.options.captureUncaught &&
20908
+ !this.options.handleUncaughtExceptions
20909
+ ) {
20910
+ return;
20911
+ }
20507
20912
 
20508
- this._uncaughtError(err, function (err) {
20509
- if (err) {
20510
- logger.error('Encountered error while handling an uncaught exception.');
20511
- logger.error(err);
20913
+ this._uncaughtError(err, function (err) {
20914
+ if (err) {
20915
+ logger.error(
20916
+ 'Encountered error while handling an uncaught exception.',
20917
+ );
20918
+ logger.error(err);
20919
+ }
20920
+ });
20921
+ if (exitOnUncaught) {
20922
+ setImmediate(
20923
+ function () {
20924
+ this.wait(function () {
20925
+ process.exit(1);
20926
+ });
20927
+ }.bind(this),
20928
+ );
20512
20929
  }
20513
- });
20514
- if (exitOnUncaught) {
20515
- setImmediate(function () {
20516
- this.wait(function () {
20517
- process.exit(1);
20518
- });
20519
- }.bind(this));
20520
- }
20521
- }.bind(this));
20930
+ }.bind(this),
20931
+ );
20522
20932
  };
20523
20933
 
20524
20934
  Rollbar.prototype.handleUnhandledRejections = function () {
20525
- addOrReplaceRollbarHandler('unhandledRejection', function (reason) {
20526
- if (!this.options.captureUnhandledRejections && !this.options.handleUnhandledRejections) {
20527
- return;
20528
- }
20529
-
20530
- this._uncaughtError(reason, function (err) {
20531
- if (err) {
20532
- logger.error('Encountered error while handling an uncaught exception.');
20533
- logger.error(err);
20935
+ addOrReplaceRollbarHandler(
20936
+ 'unhandledRejection',
20937
+ function (reason) {
20938
+ if (
20939
+ !this.options.captureUnhandledRejections &&
20940
+ !this.options.handleUnhandledRejections
20941
+ ) {
20942
+ return;
20534
20943
  }
20535
- });
20536
- }.bind(this));
20944
+
20945
+ this._uncaughtError(reason, function (err) {
20946
+ if (err) {
20947
+ logger.error(
20948
+ 'Encountered error while handling an uncaught exception.',
20949
+ );
20950
+ logger.error(err);
20951
+ }
20952
+ });
20953
+ }.bind(this),
20954
+ );
20537
20955
  };
20538
20956
 
20539
20957
  function addOrReplaceRollbarHandler(event, action) {
@@ -20572,7 +20990,7 @@ function requireRollbar () {
20572
20990
  showReportedMessageTraces: false,
20573
20991
  notifier: {
20574
20992
  name: 'node_rollbar',
20575
- version: packageJson.version
20993
+ version: packageJson.version,
20576
20994
  },
20577
20995
  scrubHeaders: packageJson.defaults.server.scrubHeaders,
20578
20996
  scrubFields: packageJson.defaults.server.scrubFields,
@@ -20589,7 +21007,7 @@ function requireRollbar () {
20589
21007
  captureLambdaTimeouts: true,
20590
21008
  ignoreDuplicateErrors: true,
20591
21009
  scrubRequestBody: true,
20592
- autoInstrument: false
21010
+ autoInstrument: false,
20593
21011
  };
20594
21012
 
20595
21013
  rollbar = Rollbar;
@@ -20856,8 +21274,56 @@ async function resolveFiles() {
20856
21274
  }
20857
21275
  }
20858
21276
 
21277
+ async function getWorkspaces(ctx, token, workspaceSpinner) {
21278
+ var _a, _b;
21279
+ try {
21280
+ const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
21281
+ headers: {
21282
+ Authorization: `Bearer ${token}`,
21283
+ },
21284
+ });
21285
+ return (_a = response.data) === null || _a === void 0 ? void 0 : _a.filter((w) => !w.devWorkspace);
21286
+ }
21287
+ catch (e) {
21288
+ if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
21289
+ workspaceSpinner.fail('Unauthorized. Please login using "embeddable login" command.');
21290
+ }
21291
+ else {
21292
+ workspaceSpinner.fail("Failed to fetch workspaces");
21293
+ }
21294
+ process.exit(1);
21295
+ }
21296
+ }
21297
+ async function selectWorkspace(ora, ctx, token) {
21298
+ const workspaceSpinner = ora({
21299
+ text: `Fetching workspaces using ${ctx.pushBaseUrl}...`,
21300
+ color: "green",
21301
+ discardStdin: false,
21302
+ }).start();
21303
+ const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
21304
+ let selectedWorkspace;
21305
+ if (availableWorkspaces.length === 0) {
21306
+ workspaceSpinner.fail("No workspaces found");
21307
+ process.exit(1);
21308
+ }
21309
+ workspaceSpinner.info(`Found ${availableWorkspaces.length} workspace(s)`);
21310
+ if (availableWorkspaces.length === 1) {
21311
+ selectedWorkspace = availableWorkspaces[0];
21312
+ }
21313
+ else {
21314
+ selectedWorkspace = await select({
21315
+ message: "Select workspace to push changes",
21316
+ choices: availableWorkspaces.map((workspace) => ({
21317
+ name: `${workspace.name} (${workspace.workspaceId})`,
21318
+ value: workspace,
21319
+ })),
21320
+ });
21321
+ }
21322
+ workspaceSpinner.succeed(`Workspace: ${selectedWorkspace.name} (${selectedWorkspace.workspaceId})`);
21323
+ return selectedWorkspace;
21324
+ }
21325
+
20859
21326
  const oraP$1 = import('ora');
20860
- const inquirerSelect = import('@inquirer/select');
20861
21327
  // grab .cube.yml|js and .sc.yml|js files
20862
21328
  const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
20863
21329
  // grab all files in self-serve-customization folder
@@ -20886,7 +21352,7 @@ var push = async () => {
20886
21352
  spinnerPushing = ora$1()
20887
21353
  .start()
20888
21354
  .info("No API Key provided. Standard login will be used.");
20889
- const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
21355
+ const { workspaceId, name: workspaceName } = await selectWorkspace(ora$1, config, token);
20890
21356
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
20891
21357
  await buildArchive(config);
20892
21358
  spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
@@ -20925,35 +21391,6 @@ async function pushByApiKey(config, spinner) {
20925
21391
  message,
20926
21392
  });
20927
21393
  }
20928
- async function selectWorkspace(ctx, token) {
20929
- const workspaceSpinner = ora$1({
20930
- text: `Fetching workspaces using ${ctx.pushBaseUrl}...`,
20931
- color: "green",
20932
- discardStdin: false,
20933
- }).start();
20934
- const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
20935
- let selectedWorkspace;
20936
- if (availableWorkspaces.length === 0) {
20937
- workspaceSpinner.fail("No workspaces found");
20938
- process.exit(1);
20939
- }
20940
- workspaceSpinner.info(`Found ${availableWorkspaces.length} workspace(s)`);
20941
- if (availableWorkspaces.length === 1) {
20942
- selectedWorkspace = availableWorkspaces[0];
20943
- }
20944
- else {
20945
- const select = (await inquirerSelect).default;
20946
- selectedWorkspace = await select({
20947
- message: "Select workspace to push changes",
20948
- choices: availableWorkspaces.map((workspace) => ({
20949
- name: `${workspace.name} (${workspace.workspaceId})`,
20950
- value: workspace,
20951
- })),
20952
- });
20953
- }
20954
- workspaceSpinner.succeed(`Workspace: ${selectedWorkspace.name} (${selectedWorkspace.workspaceId})`);
20955
- return selectedWorkspace;
20956
- }
20957
21394
  async function verify(ctx) {
20958
21395
  try {
20959
21396
  await fs.access(ctx.client.buildDir);
@@ -21043,26 +21480,6 @@ async function uploadFile(formData, url, token) {
21043
21480
  maxBodyLength: Infinity,
21044
21481
  });
21045
21482
  }
21046
- async function getWorkspaces(ctx, token, workspaceSpinner) {
21047
- var _a;
21048
- try {
21049
- const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
21050
- headers: {
21051
- Authorization: `Bearer ${token}`,
21052
- },
21053
- });
21054
- return (_a = response.data) === null || _a === void 0 ? void 0 : _a.filter((w) => !w.devWorkspace);
21055
- }
21056
- catch (e) {
21057
- if (e.response.status === 401) {
21058
- workspaceSpinner.fail('Unauthorized. Please login using "embeddable login" command.');
21059
- }
21060
- else {
21061
- workspaceSpinner.fail("Failed to fetch workspaces");
21062
- }
21063
- process.exit(1);
21064
- }
21065
- }
21066
21483
 
21067
21484
  const minimist = require("minimist");
21068
21485
  const oraP = import('ora');
@@ -21090,21 +21507,14 @@ const addToGitingore = async () => {
21090
21507
  // ignore
21091
21508
  }
21092
21509
  };
21093
- const chokidarWatchOptions = {
21094
- ignoreInitial: true,
21095
- usePolling: false, // Ensure polling is disabled
21096
- awaitWriteFinish: {
21097
- stabilityThreshold: 200,
21098
- pollInterval: 100,
21099
- },
21100
- };
21101
21510
  var dev = async () => {
21102
- var _a;
21511
+ var _a, _b;
21103
21512
  checkNodeVersion();
21104
21513
  addToGitingore();
21514
+ const http = require("http");
21105
21515
  ora = (await oraP).default;
21106
21516
  process.on("warning", (e) => console.warn(e.stack));
21107
- const logger = createNodeLogger();
21517
+ const logger = createNodeLogger({ process });
21108
21518
  const sys = createNodeSys({ process });
21109
21519
  const defaultConfig = await provideConfig();
21110
21520
  const buildDir = path$1.resolve(defaultConfig.client.rootDir, BUILD_DEV_DIR);
@@ -21130,10 +21540,10 @@ var dev = async () => {
21130
21540
  const serveSelfeServe = serveStatic(config.client.selfServeCustomizationDir);
21131
21541
  const workspacePreparation = ora("Preparing workspace...").start();
21132
21542
  try {
21133
- previewWorkspace = await getPreviewWorkspace(config);
21543
+ previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
21134
21544
  }
21135
21545
  catch (e) {
21136
- workspacePreparation.fail((_a = e.response.data) === null || _a === void 0 ? void 0 : _a.errorMessage);
21546
+ 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);
21137
21547
  process.exit(1);
21138
21548
  }
21139
21549
  workspacePreparation.succeed("Workspace is ready");
@@ -21235,7 +21645,9 @@ const onBundleBuildEnd = async (ctx) => {
21235
21645
  }
21236
21646
  };
21237
21647
  const dataModelAndSecurityContextWatcher = (ctx) => {
21238
- const fsWatcher = chokidar.watch([path$1.resolve(ctx.client.modelsSrc, "**/*.{cube,sc}.{yaml,yml,js}")], chokidarWatchOptions);
21648
+ const fsWatcher = chokidar.watch([path$1.resolve(ctx.client.modelsSrc, "**/*.{cube,sc}.{yaml,yml,js}")], {
21649
+ ignoreInitial: true,
21650
+ });
21239
21651
  fsWatcher.on("all", async () => {
21240
21652
  await sendDataModelsAndSecurityContextsChanges(ctx);
21241
21653
  });
@@ -21245,7 +21657,9 @@ const customSelfServeWatcher = (ctx) => {
21245
21657
  const fsWatcher = chokidar.watch([
21246
21658
  path$1.resolve(ctx.client.selfServeCustomizationDir, "style.css"),
21247
21659
  path$1.resolve(ctx.client.selfServeCustomizationDir, "*.svg"),
21248
- ], chokidarWatchOptions);
21660
+ ], {
21661
+ ignoreInitial: true,
21662
+ });
21249
21663
  fsWatcher.on("all", async () => {
21250
21664
  sendMessage("customSelfServeUpdateSuccess");
21251
21665
  });
@@ -21289,10 +21703,16 @@ const onClose = async (server, sys, watchers, config) => {
21289
21703
  await sys.destroy();
21290
21704
  process.exit(0);
21291
21705
  };
21292
- const getPreviewWorkspace = async (ctx) => {
21706
+ const getPreviewWorkspace = async (startedOra, ctx) => {
21293
21707
  const token = await getToken();
21294
21708
  const params = minimist(process.argv.slice(2));
21295
- const primaryWorkspace = params.w || params.workspace;
21709
+ let primaryWorkspace = params.w || params.workspace;
21710
+ if (!primaryWorkspace) {
21711
+ startedOra.stop(); // Stop current Ora, otherwise the last option will get hidden by it.
21712
+ const { workspaceId } = await selectWorkspace(ora, ctx, token);
21713
+ primaryWorkspace = workspaceId;
21714
+ startedOra.start();
21715
+ }
21296
21716
  try {
21297
21717
  const response = await axios.get(`${ctx.pushBaseUrl}/workspace/dev-workspace`, {
21298
21718
  params: { primaryWorkspace },
@@ -21306,7 +21726,7 @@ const getPreviewWorkspace = async (ctx) => {
21306
21726
  if (e.response.status === 401) {
21307
21727
  // login and retry
21308
21728
  await login();
21309
- return await getPreviewWorkspace(ctx);
21729
+ return await getPreviewWorkspace(startedOra, ctx);
21310
21730
  }
21311
21731
  else {
21312
21732
  throw e;
@@ -21367,7 +21787,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
21367
21787
  };
21368
21788
 
21369
21789
  var name = "@embeddable.com/sdk-core";
21370
- var version = "3.8.0-next.0";
21790
+ var version = "3.8.0";
21371
21791
  var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
21372
21792
  var keywords = [
21373
21793
  "embeddable",
@@ -21401,14 +21821,14 @@ var bin = {
21401
21821
  embeddable: "bin/embeddable"
21402
21822
  };
21403
21823
  var engines = {
21404
- node: ">=18.0.0"
21824
+ node: ">=20.0.0"
21405
21825
  };
21406
21826
  var license = "MIT";
21407
21827
  var dependencies = {
21408
21828
  "@embeddable.com/sdk-utils": "*",
21409
- "@inquirer/select": "^1.3.0",
21410
- "@stencil/core": "^4.18.2",
21411
- "@swc-node/register": "^1.10.9",
21829
+ "@inquirer/prompts": "^7.0.0",
21830
+ "@stencil/core": "^4.22.0",
21831
+ "@swc-node/register": "^1.9.0",
21412
21832
  archiver: "^5.3.1",
21413
21833
  axios: "^1.7.2",
21414
21834
  chokidar: "^3.6.0",
@@ -21419,7 +21839,7 @@ var dependencies = {
21419
21839
  ora: "^8.0.1",
21420
21840
  "serve-static": "^1.15.0",
21421
21841
  sorcery: "^0.11.0",
21422
- vite: "^5.3.2",
21842
+ vite: "^5.4.8",
21423
21843
  ws: "^8.17.0",
21424
21844
  yaml: "^2.3.3"
21425
21845
  };