@symbo.ls/sdk 2.33.41 → 2.34.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.
@@ -1069,6 +1069,9 @@ var PlanService = class extends BaseService {
1069
1069
  }
1070
1070
  });
1071
1071
  }
1072
+ if (Object.hasOwn(planData, "key") && planData.key == null) {
1073
+ throw new Error("Plan key must be a valid string");
1074
+ }
1072
1075
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
1073
1076
  throw new Error(
1074
1077
  "Plan key must contain only lowercase letters, numbers, and hyphens"
@@ -1123,7 +1126,7 @@ var PlanService = class extends BaseService {
1123
1126
  `Pricing option '${key}' must have a non-negative numeric 'amount'`
1124
1127
  );
1125
1128
  }
1126
- if (interval != null && !allowedIntervals.has(interval)) {
1129
+ if (interval !== null && !allowedIntervals.has(interval)) {
1127
1130
  throw new Error(
1128
1131
  `Pricing option '${key}' has invalid interval '${interval}'. Allowed: month, year, week, day or null`
1129
1132
  );
@@ -1135,6 +1138,9 @@ var PlanService = class extends BaseService {
1135
1138
  }
1136
1139
  });
1137
1140
  }
1141
+ if (Object.hasOwn(planData, "key") && planData.key == null) {
1142
+ throw new Error("Plan key must be a valid string");
1143
+ }
1138
1144
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
1139
1145
  throw new Error(
1140
1146
  "Plan key must contain only lowercase letters, numbers, and hyphens"
@@ -1699,20 +1699,29 @@ function getKeyPairs(baggage) {
1699
1699
  });
1700
1700
  }
1701
1701
  function parsePairKeyValue(entry) {
1702
- const valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
1703
- if (valueProps.length <= 0)
1704
- return;
1705
- const keyPairPart = valueProps.shift();
1706
- if (!keyPairPart)
1702
+ if (!entry)
1707
1703
  return;
1704
+ const metadataSeparatorIndex = entry.indexOf(BAGGAGE_PROPERTIES_SEPARATOR);
1705
+ const keyPairPart = metadataSeparatorIndex === -1 ? entry : entry.substring(0, metadataSeparatorIndex);
1708
1706
  const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
1709
1707
  if (separatorIndex <= 0)
1710
1708
  return;
1711
- const key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
1712
- const value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
1709
+ const rawKey = keyPairPart.substring(0, separatorIndex).trim();
1710
+ const rawValue = keyPairPart.substring(separatorIndex + 1).trim();
1711
+ if (!rawKey || !rawValue)
1712
+ return;
1713
+ let key;
1714
+ let value;
1715
+ try {
1716
+ key = decodeURIComponent(rawKey);
1717
+ value = decodeURIComponent(rawValue);
1718
+ } catch {
1719
+ return;
1720
+ }
1713
1721
  let metadata;
1714
- if (valueProps.length > 0) {
1715
- metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
1722
+ if (metadataSeparatorIndex !== -1 && metadataSeparatorIndex < entry.length - 1) {
1723
+ const metadataString = entry.substring(metadataSeparatorIndex + 1);
1724
+ metadata = baggageEntryMetadataFromString(metadataString);
1716
1725
  }
1717
1726
  return { key, value, metadata };
1718
1727
  }
@@ -1912,19 +1921,11 @@ var init_environment = __esm({
1912
1921
  }
1913
1922
  });
1914
1923
 
1915
- // ../../../node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js
1916
- var otperformance;
1917
- var init_performance = __esm({
1918
- "../../../node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js"() {
1919
- otperformance = performance;
1920
- }
1921
- });
1922
-
1923
1924
  // ../../../node_modules/@opentelemetry/core/build/esm/version.js
1924
1925
  var VERSION2;
1925
1926
  var init_version2 = __esm({
1926
1927
  "../../../node_modules/@opentelemetry/core/build/esm/version.js"() {
1927
- VERSION2 = "2.2.0";
1928
+ VERSION2 = "2.5.0";
1928
1929
  }
1929
1930
  });
1930
1931
 
@@ -4037,11 +4038,12 @@ var init_sdk_info = __esm({
4037
4038
  });
4038
4039
 
4039
4040
  // ../../../node_modules/@opentelemetry/core/build/esm/platform/browser/index.js
4041
+ var otperformance;
4040
4042
  var init_browser2 = __esm({
4041
4043
  "../../../node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"() {
4042
4044
  init_environment();
4043
- init_performance();
4044
4045
  init_sdk_info();
4046
+ otperformance = performance;
4045
4047
  }
4046
4048
  });
4047
4049
 
@@ -4052,16 +4054,8 @@ function millisToHrTime(epochMillis) {
4052
4054
  const nanos = Math.round(epochMillis % 1e3 * MILLISECONDS_TO_NANOSECONDS);
4053
4055
  return [seconds, nanos];
4054
4056
  }
4055
- function getTimeOrigin() {
4056
- let timeOrigin = otperformance.timeOrigin;
4057
- if (typeof timeOrigin !== "number") {
4058
- const perf = otperformance;
4059
- timeOrigin = perf.timing && perf.timing.fetchStart;
4060
- }
4061
- return timeOrigin;
4062
- }
4063
4057
  function hrTime(performanceNow) {
4064
- const timeOrigin = millisToHrTime(getTimeOrigin());
4058
+ const timeOrigin = millisToHrTime(otperformance.timeOrigin);
4065
4059
  const now = millisToHrTime(typeof performanceNow === "number" ? performanceNow : otperformance.now());
4066
4060
  return addHrTimes(timeOrigin, now);
4067
4061
  }
@@ -4527,13 +4521,13 @@ var init_callback = __esm({
4527
4521
  "../../../node_modules/@opentelemetry/core/build/esm/utils/callback.js"() {
4528
4522
  init_promise();
4529
4523
  BindOnceFuture = class {
4530
- constructor(_callback, _that) {
4531
- __publicField(this, "_callback");
4532
- __publicField(this, "_that");
4524
+ constructor(callback, that) {
4533
4525
  __publicField(this, "_isCalled", false);
4534
4526
  __publicField(this, "_deferred", new Deferred());
4535
- this._callback = _callback;
4536
- this._that = _that;
4527
+ __publicField(this, "_callback");
4528
+ __publicField(this, "_that");
4529
+ this._callback = callback;
4530
+ this._that = that;
4537
4531
  }
4538
4532
  get isCalled() {
4539
4533
  return this._isCalled;
@@ -9827,11 +9821,11 @@ function sendOverrideEvent(hasSessionOverridesChanged, sessionOverrides = {}, st
9827
9821
  if (!hasSessionOverridesChanged) {
9828
9822
  return;
9829
9823
  }
9830
- const serviceName = sessionOverrides.serviceName;
9824
+ const serviceName2 = sessionOverrides.serviceName;
9831
9825
  const previousServiceName = (_c = (_a2 = storedSessionOverrides.serviceName) !== null && _a2 !== void 0 ? _a2 : (_b = faro.metas.value.app) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : "";
9832
- if (serviceName && serviceName !== previousServiceName) {
9826
+ if (serviceName2 && serviceName2 !== previousServiceName) {
9833
9827
  faro.api.pushEvent(EVENT_OVERRIDES_SERVICE_NAME, {
9834
- serviceName,
9828
+ serviceName: serviceName2,
9835
9829
  previousServiceName
9836
9830
  });
9837
9831
  }
@@ -11761,7 +11755,7 @@ var init_instrumentation6 = __esm({
11761
11755
  });
11762
11756
 
11763
11757
  // ../../../node_modules/@grafana/faro-web-sdk/dist/esm/instrumentations/performance/index.js
11764
- var init_performance2 = __esm({
11758
+ var init_performance = __esm({
11765
11759
  "../../../node_modules/@grafana/faro-web-sdk/dist/esm/instrumentations/performance/index.js"() {
11766
11760
  init_instrumentation6();
11767
11761
  }
@@ -12169,7 +12163,7 @@ var init_instrumentations2 = __esm({
12169
12163
  init_errors();
12170
12164
  init_view();
12171
12165
  init_webVitals();
12172
- init_performance2();
12166
+ init_performance();
12173
12167
  init_userActions();
12174
12168
  init_csp();
12175
12169
  }
@@ -13414,7 +13408,7 @@ var init_globalThis3 = __esm({
13414
13408
 
13415
13409
  // ../../../node_modules/@opentelemetry/instrumentation-fetch/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js
13416
13410
  var otperformance2;
13417
- var init_performance3 = __esm({
13411
+ var init_performance2 = __esm({
13418
13412
  "../../../node_modules/@opentelemetry/instrumentation-fetch/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js"() {
13419
13413
  otperformance2 = performance;
13420
13414
  }
@@ -13425,7 +13419,7 @@ var init_browser6 = __esm({
13425
13419
  "../../../node_modules/@opentelemetry/instrumentation-fetch/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"() {
13426
13420
  init_environment2();
13427
13421
  init_globalThis3();
13428
- init_performance3();
13422
+ init_performance2();
13429
13423
  }
13430
13424
  });
13431
13425
 
@@ -14305,7 +14299,7 @@ var init_environment3 = __esm({
14305
14299
 
14306
14300
  // ../../../node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js
14307
14301
  var otperformance3;
14308
- var init_performance4 = __esm({
14302
+ var init_performance3 = __esm({
14309
14303
  "../../../node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js"() {
14310
14304
  otperformance3 = performance;
14311
14305
  }
@@ -14315,7 +14309,7 @@ var init_performance4 = __esm({
14315
14309
  var init_browser7 = __esm({
14316
14310
  "../../../node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"() {
14317
14311
  init_environment3();
14318
- init_performance4();
14312
+ init_performance3();
14319
14313
  }
14320
14314
  });
14321
14315
 
@@ -15292,19 +15286,21 @@ var init_getDefaultOTELInstrumentations = __esm({
15292
15286
  }
15293
15287
  });
15294
15288
 
15295
- // ../../../node_modules/@opentelemetry/resources/build/esm/platform/browser/default-service-name.js
15289
+ // ../../../node_modules/@opentelemetry/resources/build/esm/default-service-name.js
15296
15290
  function defaultServiceName() {
15297
- return "unknown_service";
15291
+ if (serviceName === void 0) {
15292
+ try {
15293
+ const argv0 = globalThis.process.argv0;
15294
+ serviceName = argv0 ? `unknown_service:${argv0}` : "unknown_service";
15295
+ } catch {
15296
+ serviceName = "unknown_service";
15297
+ }
15298
+ }
15299
+ return serviceName;
15298
15300
  }
15301
+ var serviceName;
15299
15302
  var init_default_service_name = __esm({
15300
- "../../../node_modules/@opentelemetry/resources/build/esm/platform/browser/default-service-name.js"() {
15301
- }
15302
- });
15303
-
15304
- // ../../../node_modules/@opentelemetry/resources/build/esm/platform/browser/index.js
15305
- var init_browser8 = __esm({
15306
- "../../../node_modules/@opentelemetry/resources/build/esm/platform/browser/index.js"() {
15307
- init_default_service_name();
15303
+ "../../../node_modules/@opentelemetry/resources/build/esm/default-service-name.js"() {
15308
15304
  }
15309
15305
  });
15310
15306
 
@@ -15374,7 +15370,7 @@ var init_ResourceImpl = __esm({
15374
15370
  init_esm();
15375
15371
  init_esm3();
15376
15372
  init_esm2();
15377
- init_browser8();
15373
+ init_default_service_name();
15378
15374
  init_utils14();
15379
15375
  ResourceImpl = class _ResourceImpl {
15380
15376
  constructor(resource, options) {
@@ -15511,7 +15507,7 @@ var init_Span = __esm({
15511
15507
  const now = Date.now();
15512
15508
  this._spanContext = opts.spanContext;
15513
15509
  this._performanceStartTime = otperformance.now();
15514
- this._performanceOffset = now - (this._performanceStartTime + getTimeOrigin());
15510
+ this._performanceOffset = now - (this._performanceStartTime + otperformance.timeOrigin);
15515
15511
  this._startTimeProvided = opts.startTime != null;
15516
15512
  this._spanLimits = opts.spanLimits;
15517
15513
  this._attributeValueLengthLimit = this._spanLimits.attributeValueLengthLimit || 0;
@@ -15623,7 +15619,6 @@ var init_Span = __esm({
15623
15619
  diag2.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);
15624
15620
  return;
15625
15621
  }
15626
- this._ended = true;
15627
15622
  this.endTime = this._getTime(endTime);
15628
15623
  this._duration = hrTimeDuration(this.startTime, this.endTime);
15629
15624
  if (this._duration[0] < 0) {
@@ -15634,6 +15629,10 @@ var init_Span = __esm({
15634
15629
  if (this._droppedEventsCount > 0) {
15635
15630
  diag2.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);
15636
15631
  }
15632
+ if (this._spanProcessor.onEnding) {
15633
+ this._spanProcessor.onEnding(this);
15634
+ }
15635
+ this._ended = true;
15637
15636
  this._spanProcessor.onEnd(this);
15638
15637
  }
15639
15638
  _getTime(inp) {
@@ -15846,11 +15845,10 @@ var init_TraceIdRatioBasedSampler = __esm({
15846
15845
  init_esm();
15847
15846
  init_Sampler();
15848
15847
  TraceIdRatioBasedSampler = class {
15849
- constructor(_ratio = 0) {
15848
+ constructor(ratio = 0) {
15850
15849
  __publicField(this, "_ratio");
15851
15850
  __publicField(this, "_upperBound");
15852
- this._ratio = _ratio;
15853
- this._ratio = this._normalize(_ratio);
15851
+ this._ratio = this._normalize(ratio);
15854
15852
  this._upperBound = Math.floor(this._ratio * 4294967295);
15855
15853
  }
15856
15854
  shouldSample(context2, traceId) {
@@ -15996,19 +15994,19 @@ var init_BatchSpanProcessorBase = __esm({
15996
15994
  init_esm();
15997
15995
  init_esm3();
15998
15996
  BatchSpanProcessorBase = class {
15999
- constructor(_exporter, config) {
16000
- __publicField(this, "_exporter");
15997
+ constructor(exporter, config) {
16001
15998
  __publicField(this, "_maxExportBatchSize");
16002
15999
  __publicField(this, "_maxQueueSize");
16003
16000
  __publicField(this, "_scheduledDelayMillis");
16004
16001
  __publicField(this, "_exportTimeoutMillis");
16002
+ __publicField(this, "_exporter");
16005
16003
  __publicField(this, "_isExporting", false);
16006
16004
  __publicField(this, "_finishedSpans", []);
16007
16005
  __publicField(this, "_timer");
16008
16006
  __publicField(this, "_shutdownOnce");
16009
16007
  __publicField(this, "_droppedSpansCount", 0);
16010
16008
  var _a2, _b, _c, _d;
16011
- this._exporter = _exporter;
16009
+ this._exporter = exporter;
16012
16010
  this._maxExportBatchSize = typeof (config == null ? void 0 : config.maxExportBatchSize) === "number" ? config.maxExportBatchSize : (_a2 = getNumberFromEnv("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")) != null ? _a2 : 512;
16013
16011
  this._maxQueueSize = typeof (config == null ? void 0 : config.maxQueueSize) === "number" ? config.maxQueueSize : (_b = getNumberFromEnv("OTEL_BSP_MAX_QUEUE_SIZE")) != null ? _b : 2048;
16014
16012
  this._scheduledDelayMillis = typeof (config == null ? void 0 : config.scheduledDelayMillis) === "number" ? config.scheduledDelayMillis : (_c = getNumberFromEnv("OTEL_BSP_SCHEDULE_DELAY")) != null ? _c : 5e3;
@@ -16244,7 +16242,7 @@ var init_RandomIdGenerator = __esm({
16244
16242
  });
16245
16243
 
16246
16244
  // ../../../node_modules/@opentelemetry/sdk-trace-web/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js
16247
- var init_browser9 = __esm({
16245
+ var init_browser8 = __esm({
16248
16246
  "../../../node_modules/@opentelemetry/sdk-trace-web/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js"() {
16249
16247
  init_BatchSpanProcessor();
16250
16248
  init_RandomIdGenerator();
@@ -16259,7 +16257,7 @@ var init_Tracer = __esm({
16259
16257
  init_esm3();
16260
16258
  init_Span();
16261
16259
  init_utility();
16262
- init_browser9();
16260
+ init_browser8();
16263
16261
  Tracer = class {
16264
16262
  /**
16265
16263
  * Constructs a new Tracer instance.
@@ -16381,9 +16379,9 @@ var init_MultiSpanProcessor = __esm({
16381
16379
  "../../../node_modules/@opentelemetry/sdk-trace-web/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js"() {
16382
16380
  init_esm3();
16383
16381
  MultiSpanProcessor = class {
16384
- constructor(_spanProcessors) {
16382
+ constructor(spanProcessors) {
16385
16383
  __publicField(this, "_spanProcessors");
16386
- this._spanProcessors = _spanProcessors;
16384
+ this._spanProcessors = spanProcessors;
16387
16385
  }
16388
16386
  forceFlush() {
16389
16387
  const promises = [];
@@ -16404,6 +16402,13 @@ var init_MultiSpanProcessor = __esm({
16404
16402
  spanProcessor.onStart(span, context2);
16405
16403
  }
16406
16404
  }
16405
+ onEnding(span) {
16406
+ for (const spanProcessor of this._spanProcessors) {
16407
+ if (spanProcessor.onEnding) {
16408
+ spanProcessor.onEnding(span);
16409
+ }
16410
+ }
16411
+ }
16407
16412
  onEnd(span) {
16408
16413
  for (const spanProcessor of this._spanProcessors) {
16409
16414
  spanProcessor.onEnd(span);
@@ -16509,7 +16514,7 @@ var init_BasicTracerProvider = __esm({
16509
16514
  var init_esm15 = __esm({
16510
16515
  "../../../node_modules/@opentelemetry/sdk-trace-web/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"() {
16511
16516
  init_BasicTracerProvider();
16512
- init_browser9();
16517
+ init_browser8();
16513
16518
  init_Sampler();
16514
16519
  }
16515
16520
  });