@epam/ai-dial-modulify-ui 0.42.4 → 0.42.6

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.
Files changed (2) hide show
  1. package/index.esm.js +25 -11
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -11276,7 +11276,7 @@ var constants = {};
11276
11276
  MiddlewareSpan["execute"] = "Middleware.execute";
11277
11277
  return MiddlewareSpan;
11278
11278
  }(MiddlewareSpan || {});
11279
- const NextVanillaSpanAllowlist = [
11279
+ const NextVanillaSpanAllowlist = new Set([
11280
11280
  "Middleware.execute",
11281
11281
  "BaseServer.handleRequest",
11282
11282
  "Render.getServerSideProps",
@@ -11293,12 +11293,12 @@ var constants = {};
11293
11293
  "NextNodeServer.getLayoutOrPageModule",
11294
11294
  "NextNodeServer.startResponse",
11295
11295
  "NextNodeServer.clientComponentLoading"
11296
- ];
11297
- const LogSpanAllowList = [
11296
+ ]);
11297
+ const LogSpanAllowList = new Set([
11298
11298
  "NextNodeServer.findPageComponents",
11299
11299
  "NextNodeServer.createComponentTree",
11300
11300
  "NextNodeServer.clientComponentLoading"
11301
- ];
11301
+ ]);
11302
11302
 
11303
11303
 
11304
11304
  } (constants));
@@ -13721,6 +13721,7 @@ function requireApi () {
13721
13721
  });
13722
13722
  const _constants = constants;
13723
13723
  const _isthenable = isThenable;
13724
+ const NEXT_OTEL_PERFORMANCE_PREFIX = process.env.NEXT_OTEL_PERFORMANCE_PREFIX;
13724
13725
  let api;
13725
13726
  // we want to allow users to use their own version of @opentelemetry/api if they
13726
13727
  // want to, so we try to require it first, and if it fails we fall back to the
@@ -13818,7 +13819,7 @@ function requireApi () {
13818
13819
  }
13819
13820
  };
13820
13821
  const spanName = options.spanName ?? type;
13821
- if (!_constants.NextVanillaSpanAllowlist.includes(type) && process.env.NEXT_OTEL_VERBOSE !== '1' || options.hideSpan) {
13822
+ if (!_constants.NextVanillaSpanAllowlist.has(type) && process.env.NEXT_OTEL_VERBOSE !== '1' || options.hideSpan) {
13822
13823
  return fn();
13823
13824
  }
13824
13825
  // Trying to get active scoped span to assign parent. If option specifies parent span manually, will try to use it.
@@ -13837,11 +13838,17 @@ function requireApi () {
13837
13838
  ...options.attributes
13838
13839
  };
13839
13840
  return context.with(spanContext.setValue(rootSpanIdKey, spanId), ()=>this.getTracerInstance().startActiveSpan(spanName, options, (span)=>{
13840
- const startTime = 'performance' in globalThis && 'measure' in performance ? globalThis.performance.now() : undefined;
13841
+ let startTime;
13842
+ if (NEXT_OTEL_PERFORMANCE_PREFIX && type && _constants.LogSpanAllowList.has(type)) {
13843
+ startTime = 'performance' in globalThis && 'measure' in performance ? globalThis.performance.now() : undefined;
13844
+ }
13845
+ let cleanedUp = false;
13841
13846
  const onCleanup = ()=>{
13847
+ if (cleanedUp) return;
13848
+ cleanedUp = true;
13842
13849
  rootSpanAttributesStore.delete(spanId);
13843
- if (startTime && process.env.NEXT_OTEL_PERFORMANCE_PREFIX && _constants.LogSpanAllowList.includes(type || '')) {
13844
- performance.measure(`${process.env.NEXT_OTEL_PERFORMANCE_PREFIX}:next-${(type.split('.').pop() || '').replace(/[A-Z]/g, (match)=>'-' + match.toLowerCase())}`, {
13850
+ if (startTime) {
13851
+ performance.measure(`${NEXT_OTEL_PERFORMANCE_PREFIX}:next-${(type.split('.').pop() || '').replace(/[A-Z]/g, (match)=>'-' + match.toLowerCase())}`, {
13845
13852
  start: startTime,
13846
13853
  end: performance.now()
13847
13854
  });
@@ -13850,10 +13857,17 @@ function requireApi () {
13850
13857
  if (isRootSpan) {
13851
13858
  rootSpanAttributesStore.set(spanId, new Map(Object.entries(options.attributes ?? {})));
13852
13859
  }
13853
- try {
13854
- if (fn.length > 1) {
13860
+ if (fn.length > 1) {
13861
+ try {
13855
13862
  return fn(span, (err)=>closeSpanWithError(span, err));
13863
+ } catch (err) {
13864
+ closeSpanWithError(span, err);
13865
+ throw err;
13866
+ } finally{
13867
+ onCleanup();
13856
13868
  }
13869
+ }
13870
+ try {
13857
13871
  const result = fn(span);
13858
13872
  if ((0, _isthenable.isThenable)(result)) {
13859
13873
  // If there's error make sure it throws
@@ -13885,7 +13899,7 @@ function requireApi () {
13885
13899
  {},
13886
13900
  args[1]
13887
13901
  ];
13888
- if (!_constants.NextVanillaSpanAllowlist.includes(name) && process.env.NEXT_OTEL_VERBOSE !== '1') {
13902
+ if (!_constants.NextVanillaSpanAllowlist.has(name) && process.env.NEXT_OTEL_VERBOSE !== '1') {
13889
13903
  return fn;
13890
13904
  }
13891
13905
  return function() {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@epam/ai-dial-modulify-ui",
3
3
  "description": "Modulify Toolkit (UI) for turning a monolith-like project into a modular one",
4
4
  "homepage": "https://dialx.ai",
5
- "version": "0.42.4",
5
+ "version": "0.42.6",
6
6
  "dependencies": {},
7
7
  "type": "module",
8
8
  "bugs": {