slnodejs 6.1.309 → 6.1.315

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.
@@ -34126,7 +34126,7 @@ module.exports={
34126
34126
  "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
34127
34127
  "_shasum": "da37cebd31e79a1367e941b592ed1fbebd58abbb",
34128
34128
  "_spec": "elliptic@^6.5.3",
34129
- "_where": "/var/lib/jenkins/workspace/.OnPremise.Agent.JavaScript_main/browser-agent/node_modules/browserify-sign",
34129
+ "_where": "/var/lib/jenkins/workspace/.OnPremise.Agent.JavaScript_main@3/browser-agent/node_modules/browserify-sign",
34130
34130
  "author": {
34131
34131
  "name": "Fedor Indutny",
34132
34132
  "email": "fedor@indutny.com"
@@ -54206,7 +54206,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54206
54206
  "use strict";
54207
54207
  Object.defineProperty(exports, "__esModule", { value: true });
54208
54208
  exports.SL_AGENT_TYPE = exports.SL_AGENT_VERSION = void 0;
54209
- exports.SL_AGENT_VERSION = '6.1.309';
54209
+ exports.SL_AGENT_VERSION = '6.1.315';
54210
54210
  exports.SL_AGENT_TYPE = 'browser';
54211
54211
  });
54212
54212
 
@@ -54650,16 +54650,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54650
54650
  })(function (require, exports) {
54651
54651
  "use strict";
54652
54652
  Object.defineProperty(exports, "__esModule", { value: true });
54653
- exports.CustomFetchInstrumentation = void 0;
54653
+ exports.CustomFetchInstrumentation = exports.handleAddHeaders = void 0;
54654
54654
  const instrumentation_fetch_1 = require("@opentelemetry/instrumentation-fetch");
54655
54655
  const utils_1 = require("../utils");
54656
+ const setPropagationHeaders = (options, contextPropagationHeaders) => {
54657
+ for (const [key, value] of Object.entries(contextPropagationHeaders)) {
54658
+ if (value) {
54659
+ options.headers.set(key, typeof value === 'string' ? value : String(value));
54660
+ }
54661
+ }
54662
+ };
54663
+ function handleAddHeaders(options) {
54664
+ const origin = window.location.hostname;
54665
+ const url = options.url;
54666
+ const isMatch = url === null || url === void 0 ? void 0 : url.includes(origin);
54667
+ if (!isMatch) {
54668
+ return;
54669
+ }
54670
+ const contextPropagationHeaders = utils_1.constructBaggageHeader();
54671
+ if (options instanceof Request && contextPropagationHeaders) {
54672
+ setPropagationHeaders(options, contextPropagationHeaders);
54673
+ }
54674
+ else if (options.headers instanceof Headers && contextPropagationHeaders) {
54675
+ setPropagationHeaders(options, contextPropagationHeaders);
54676
+ }
54677
+ else if (typeof options.headers === 'object' && options.headers !== null) {
54678
+ for (const [key, value] of Object.entries(contextPropagationHeaders)) {
54679
+ options.headers[key] = value;
54680
+ }
54681
+ }
54682
+ else {
54683
+ const headers = utils_1.constructBaggageHeader();
54684
+ options.headers = Object.assign({}, headers, options.headers || {});
54685
+ }
54686
+ }
54687
+ exports.handleAddHeaders = handleAddHeaders;
54656
54688
  class CustomFetchInstrumentation extends instrumentation_fetch_1.FetchInstrumentation {
54657
54689
  constructor(config) {
54658
54690
  super(config);
54659
- this['_addHeaders'] = (options) => {
54660
- const headers = utils_1.constructBaggageHeader();
54661
- options.headers = Object.assign({}, headers, options.headers || {});
54662
- };
54691
+ this['_addHeaders'] = (options) => handleAddHeaders(options);
54663
54692
  }
54664
54693
  }
54665
54694
  exports.CustomFetchInstrumentation = CustomFetchInstrumentation;
@@ -54685,6 +54714,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54685
54714
  super(config);
54686
54715
  this['_addHeaders'] = (xhr) => {
54687
54716
  var _a;
54717
+ const origin = window.location.hostname;
54718
+ const url = xhr.responseURL;
54719
+ const isMatch = url === null || url === void 0 ? void 0 : url.includes(origin);
54720
+ if (!isMatch) {
54721
+ return;
54722
+ }
54688
54723
  const headers = utils_1.constructBaggageHeader();
54689
54724
  if ((_a = headers === null || headers === void 0 ? void 0 : headers.baggage) === null || _a === void 0 ? void 0 : _a.length)
54690
54725
  xhr.setRequestHeader('baggage', headers.baggage);
@@ -56018,7 +56053,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56018
56053
  throw new Error('\'delete\' not implemented yet');
56019
56054
  }
56020
56055
  get(urlPath, callback, isNotFoundAcceptable = true, async = false) {
56021
- urlPath = this.serverUrl + urlPath;
56056
+ urlPath = `${this.getBaseUrl()}${urlPath}`;
56022
56057
  const onSuccess = (response) => callback(null, response, response.statusCode);
56023
56058
  const onError = (response) => {
56024
56059
  const error = new Error(response.responseText);
@@ -56030,7 +56065,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56030
56065
  throw new Error('\'delete\' not implemented yet');
56031
56066
  }
56032
56067
  post(requestData, urlPath, callback, async = true, contentType) {
56033
- urlPath = `${this.getBaseUrlForPostRequest()}${urlPath}`;
56068
+ urlPath = `${this.getBaseUrl()}${urlPath}`;
56034
56069
  const onSuccess = (response) => callback(null, response, response.statusCode);
56035
56070
  const onError = (response) => {
56036
56071
  const error = new Error(response.responseText);
@@ -56041,7 +56076,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56041
56076
  postMultipart(requestData, urlPath, callback) {
56042
56077
  throw new Error('\'postMultipart\' not implemented yet');
56043
56078
  }
56044
- getBaseUrlForPostRequest() {
56079
+ getBaseUrl() {
56045
56080
  if (this.collectorUrl) {
56046
56081
  return this.collectorUrl;
56047
56082
  }
@@ -59510,7 +59545,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59510
59545
  if (v !== undefined) module.exports = v;
59511
59546
  }
59512
59547
  else if (typeof define === "function" && define.amd) {
59513
- define(["require", "exports", "../constants/sl-env-vars", "../coverage-elements/original-module-loader"], factory);
59548
+ define(["require", "exports", "../constants/sl-env-vars", "../coverage-elements/original-module-loader", "../agent-events/cockpit-notifier"], factory);
59514
59549
  }
59515
59550
  })(function (require, exports) {
59516
59551
  "use strict";
@@ -59518,9 +59553,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59518
59553
  exports.HitsCollector = void 0;
59519
59554
  const sl_env_vars_1 = require("../constants/sl-env-vars");
59520
59555
  const original_module_loader_1 = require("../coverage-elements/original-module-loader");
59556
+ const cockpit_notifier_1 = require("../agent-events/cockpit-notifier");
59521
59557
  const GLOBAL_ISTANBUL_CONTAINER_NAMES = ['__coverage__'];
59522
59558
  class HitsCollector {
59523
59559
  constructor(logger, globalCoverageObject) {
59560
+ this.errors = [];
59524
59561
  this.logger = logger;
59525
59562
  this._globalCoverageObject = globalCoverageObject;
59526
59563
  this.latestCoverageSnapshot = {};
@@ -59667,12 +59704,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59667
59704
  this._latestCoverageSnapshot[istanbulModule].f[funcId] = f[funcId];
59668
59705
  }
59669
59706
  }
59707
+ sendErrors() {
59708
+ if (this.errors.length > 0) {
59709
+ const data = JSON.stringify(this.errors);
59710
+ cockpit_notifier_1.CockpitNotifier.sendGenericMessage(`Errors during hit collection: ${data}`);
59711
+ }
59712
+ }
59670
59713
  }
59671
59714
  exports.HitsCollector = HitsCollector;
59672
59715
  });
59673
59716
 
59674
59717
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
59675
- },{"../constants/sl-env-vars":472,"../coverage-elements/original-module-loader":477}],488:[function(require,module,exports){
59718
+ },{"../agent-events/cockpit-notifier":459,"../constants/sl-env-vars":472,"../coverage-elements/original-module-loader":477}],488:[function(require,module,exports){
59676
59719
  (function (factory) {
59677
59720
  if (typeof module === "object" && typeof module.exports === "object") {
59678
59721
  var v = factory(require, exports);
@@ -59964,6 +60007,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59964
60007
  stop() {
59965
60008
  return __awaiter(this, void 0, void 0, function* () {
59966
60009
  this.sendToServerWatchdog.stop();
60010
+ this.hitsCollector.sendErrors();
59967
60011
  if (!this.shouldSubmitFootprints()) {
59968
60012
  this.isRunning = false;
59969
60013
  return;