@grafana/scenes 6.29.0--canary.1197.16594646941.0 → 6.29.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/dist/index.js CHANGED
@@ -607,246 +607,77 @@ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Ca
607
607
  var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
608
608
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
609
609
  var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
610
- var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
611
- const POST_STORM_WINDOW = 2e3;
612
- const SPAN_THRESHOLD = 30;
613
- class SceneRenderProfiler {
614
- constructor(queryController) {
615
- this.queryController = queryController;
616
- __privateAdd$3(this, _profileInProgress, null);
617
- __privateAdd$3(this, _profileStartTs, null);
618
- __privateAdd$3(this, _trailAnimationFrameId, null);
619
- // Will keep measured lengths trailing frames
620
- __privateAdd$3(this, _recordedTrailingSpans, []);
621
- this.lastFrameTime = 0;
622
- this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
623
- const currentFrameTime = performance.now();
624
- const frameLength = currentFrameTime - lastFrameTime;
625
- __privateGet$3(this, _recordedTrailingSpans).push(frameLength);
626
- if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
627
- __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
628
- () => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
629
- ));
630
- } else {
631
- const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
632
- const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
633
- writeSceneLog(
634
- this.constructor.name,
635
- "Profile tail recorded, slow frames duration:",
636
- slowFramesTime,
637
- slowFrames,
638
- __privateGet$3(this, _profileInProgress)
639
- );
640
- __privateSet$3(this, _recordedTrailingSpans, []);
641
- const profileDuration = measurementStartTs - profileStartTs;
642
- writeSceneLog(
643
- this.constructor.name,
644
- "Stoped recording, total measured time (network included):",
645
- profileDuration + slowFramesTime
646
- );
647
- __privateSet$3(this, _trailAnimationFrameId, null);
648
- const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
649
- performance.measure(`DashboardInteraction ${__privateGet$3(this, _profileInProgress).origin}`, {
650
- start: profileStartTs,
651
- end: profileEndTs
652
- });
653
- const networkDuration = captureNetwork(profileStartTs, profileEndTs);
654
- if (this.queryController.state.onProfileComplete) {
655
- this.queryController.state.onProfileComplete({
656
- origin: __privateGet$3(this, _profileInProgress).origin,
657
- crumbs: __privateGet$3(this, _profileInProgress).crumbs,
658
- duration: profileDuration + slowFramesTime,
659
- networkDuration,
660
- // @ts-ignore
661
- jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
662
- // @ts-ignore
663
- usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
664
- // @ts-ignore
665
- totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
666
- });
667
- __privateSet$3(this, _profileInProgress, null);
668
- }
669
- if (window.__runs) {
670
- window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
671
- `;
672
- } else {
673
- window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
674
- `;
675
- }
676
- }
677
- };
678
- }
679
- startProfile(name) {
680
- if (__privateGet$3(this, _profileInProgress)) {
681
- if (__privateGet$3(this, _trailAnimationFrameId)) {
682
- cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
683
- __privateSet$3(this, _trailAnimationFrameId, null);
684
- writeSceneLog(this.constructor.name, "New profile: Stopped recording frames ");
685
- __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
686
- __privateSet$3(this, _profileStartTs, performance.now());
687
- writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
688
- } else {
689
- this.addCrumb(name);
690
- }
691
- } else {
692
- __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
693
- __privateSet$3(this, _profileStartTs, performance.now());
694
- writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
695
- }
696
- }
697
- recordProfileTail(measurementStartTime, profileStartTs) {
698
- __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
699
- () => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
700
- ));
701
- }
702
- tryCompletingProfile() {
703
- writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
704
- if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
705
- writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
706
- this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
707
- }
708
- }
709
- isTailRecording() {
710
- return Boolean(__privateGet$3(this, _trailAnimationFrameId));
711
- }
712
- cancelTailRecording() {
713
- if (__privateGet$3(this, _trailAnimationFrameId)) {
714
- cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
715
- __privateSet$3(this, _trailAnimationFrameId, null);
716
- writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
717
- }
718
- }
719
- addCrumb(crumb) {
720
- if (__privateGet$3(this, _profileInProgress)) {
721
- writeSceneLog(this.constructor.name, "Adding crumb:", crumb);
722
- __privateGet$3(this, _profileInProgress).crumbs.push(crumb);
723
- }
724
- }
725
- }
726
- _profileInProgress = new WeakMap();
727
- _profileStartTs = new WeakMap();
728
- _trailAnimationFrameId = new WeakMap();
729
- _recordedTrailingSpans = new WeakMap();
730
- function processRecordedSpans(spans) {
731
- for (let i = spans.length - 1; i >= 0; i--) {
732
- if (spans[i] > SPAN_THRESHOLD) {
733
- return spans.slice(0, i + 1);
734
- }
735
- }
736
- return [spans[0]];
737
- }
738
- function captureNetwork(startTs, endTs) {
739
- const entries = performance.getEntriesByType("resource");
740
- performance.clearResourceTimings();
741
- const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
742
- for (const entry of networkEntries) {
743
- performance.measure("Network entry " + entry.name, {
744
- start: entry.startTime,
745
- end: entry.responseEnd
746
- });
747
- }
748
- return calculateNetworkTime(networkEntries);
749
- }
750
- function calculateNetworkTime(requests) {
751
- if (requests.length === 0) {
752
- return 0;
753
- }
754
- requests.sort((a, b) => a.startTime - b.startTime);
755
- let totalNetworkTime = 0;
756
- let currentStart = requests[0].startTime;
757
- let currentEnd = requests[0].responseEnd;
758
- for (let i = 1; i < requests.length; i++) {
759
- if (requests[i].startTime <= currentEnd) {
760
- currentEnd = Math.max(currentEnd, requests[i].responseEnd);
761
- } else {
762
- totalNetworkTime += currentEnd - currentStart;
763
- currentStart = requests[i].startTime;
764
- currentEnd = requests[i].responseEnd;
765
- }
766
- }
767
- totalNetworkTime += currentEnd - currentStart;
768
- return totalNetworkTime;
769
- }
770
- const REFRESH_INTERACTION = "refresh";
771
- const TIME_RANGE_CHANGE_INTERACTION = "time_range_change";
772
- const FILTER_REMOVED_INTERACTION = "filter_removed";
773
- const FILTER_CHANGED_INTERACTION = "filter_changed";
774
- const FILTER_RESTORED_INTERACTION = "filter_restored";
775
- const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
776
- const SCOPES_CHANGED_INTERACTION = "scopes_changed";
777
-
778
- var __typeError$2 = (msg) => {
779
- throw TypeError(msg);
780
- };
781
- var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
782
- var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
783
- var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
784
- var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
785
610
  var _running, _tryCompleteProfileFrameId;
786
611
  function isQueryController(s) {
787
612
  return "isQueryController" in s;
788
613
  }
789
614
  class SceneQueryController extends SceneObjectBase {
790
- constructor(state = {}) {
615
+ constructor(state = {}, profiler) {
791
616
  super({ ...state, isRunning: false });
617
+ this.profiler = profiler;
792
618
  this.isQueryController = true;
793
- this.profiler = new SceneRenderProfiler(this);
794
- __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
795
- __privateAdd$2(this, _tryCompleteProfileFrameId, null);
619
+ __privateAdd$3(this, _running, /* @__PURE__ */ new Set());
620
+ __privateAdd$3(this, _tryCompleteProfileFrameId, null);
796
621
  this.runningQueriesCount = () => {
797
- return __privateGet$2(this, _running).size;
622
+ return __privateGet$3(this, _running).size;
798
623
  };
624
+ if (profiler) {
625
+ this.profiler = profiler;
626
+ profiler.setQueryController(this);
627
+ }
799
628
  this.addActivationHandler(() => {
800
- return () => __privateGet$2(this, _running).clear();
629
+ return () => __privateGet$3(this, _running).clear();
801
630
  });
802
631
  }
803
632
  startProfile(name) {
633
+ var _a;
804
634
  if (!this.state.enableProfiling) {
805
635
  return;
806
636
  }
807
- this.profiler.startProfile(name);
637
+ (_a = this.profiler) == null ? void 0 : _a.startProfile(name);
808
638
  }
809
639
  queryStarted(entry) {
810
- __privateGet$2(this, _running).add(entry);
640
+ __privateGet$3(this, _running).add(entry);
811
641
  this.changeRunningQueryCount(1, entry);
812
642
  if (!this.state.isRunning) {
813
643
  this.setState({ isRunning: true });
814
644
  }
815
645
  }
816
646
  queryCompleted(entry) {
817
- if (!__privateGet$2(this, _running).has(entry)) {
647
+ if (!__privateGet$3(this, _running).has(entry)) {
818
648
  return;
819
649
  }
820
- __privateGet$2(this, _running).delete(entry);
650
+ __privateGet$3(this, _running).delete(entry);
821
651
  this.changeRunningQueryCount(-1);
822
- if (__privateGet$2(this, _running).size === 0) {
652
+ if (__privateGet$3(this, _running).size === 0) {
823
653
  this.setState({ isRunning: false });
824
654
  }
825
655
  }
826
656
  changeRunningQueryCount(dir, entry) {
827
- var _a;
657
+ var _a, _b, _c, _d;
828
658
  window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
829
659
  if (dir === 1 && this.state.enableProfiling) {
830
660
  if (entry) {
831
- this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
661
+ (_b = this.profiler) == null ? void 0 : _b.addCrumb(`${entry.type}`);
832
662
  }
833
- if (this.profiler.isTailRecording()) {
834
- writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
835
- this.profiler.cancelTailRecording();
663
+ if ((_c = this.profiler) == null ? void 0 : _c.isTailRecording()) {
664
+ writeSceneLog("SceneQueryController", "New query started, cancelling tail recording");
665
+ (_d = this.profiler) == null ? void 0 : _d.cancelTailRecording();
836
666
  }
837
667
  }
838
668
  if (this.state.enableProfiling) {
839
- if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
840
- cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
669
+ if (__privateGet$3(this, _tryCompleteProfileFrameId)) {
670
+ cancelAnimationFrame(__privateGet$3(this, _tryCompleteProfileFrameId));
841
671
  }
842
- __privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
843
- this.profiler.tryCompletingProfile();
672
+ __privateSet$3(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
673
+ var _a2;
674
+ (_a2 = this.profiler) == null ? void 0 : _a2.tryCompletingProfile();
844
675
  }));
845
676
  }
846
677
  }
847
678
  cancelAll() {
848
679
  var _a;
849
- for (const entry of __privateGet$2(this, _running).values()) {
680
+ for (const entry of __privateGet$3(this, _running).values()) {
850
681
  (_a = entry.cancel) == null ? void 0 : _a.call(entry);
851
682
  }
852
683
  }
@@ -1012,9 +843,185 @@ function isValid$1(value, roundUp, timeZone) {
1012
843
  if (data.dateMath.isMathString(value)) {
1013
844
  return data.dateMath.isValid(value);
1014
845
  }
1015
- const parsed = data.dateTimeParse(value, { roundUp, timeZone });
1016
- return parsed.isValid();
846
+ const parsed = data.dateTimeParse(value, { roundUp, timeZone });
847
+ return parsed.isValid();
848
+ }
849
+
850
+ var __typeError$2 = (msg) => {
851
+ throw TypeError(msg);
852
+ };
853
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
854
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
855
+ var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
856
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
857
+ var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
858
+ const POST_STORM_WINDOW = 2e3;
859
+ const SPAN_THRESHOLD = 30;
860
+ class SceneRenderProfiler {
861
+ constructor(queryController) {
862
+ this.queryController = queryController;
863
+ __privateAdd$2(this, _profileInProgress, null);
864
+ __privateAdd$2(this, _profileStartTs, null);
865
+ __privateAdd$2(this, _trailAnimationFrameId, null);
866
+ // Will keep measured lengths trailing frames
867
+ __privateAdd$2(this, _recordedTrailingSpans, []);
868
+ this.lastFrameTime = 0;
869
+ this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
870
+ var _a;
871
+ const currentFrameTime = performance.now();
872
+ const frameLength = currentFrameTime - lastFrameTime;
873
+ __privateGet$2(this, _recordedTrailingSpans).push(frameLength);
874
+ if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
875
+ if (__privateGet$2(this, _profileInProgress)) {
876
+ __privateSet$2(this, _trailAnimationFrameId, requestAnimationFrame(
877
+ () => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
878
+ ));
879
+ }
880
+ } else {
881
+ const slowFrames = processRecordedSpans(__privateGet$2(this, _recordedTrailingSpans));
882
+ const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
883
+ writeSceneLog(
884
+ this.constructor.name,
885
+ "Profile tail recorded, slow frames duration:",
886
+ slowFramesTime,
887
+ slowFrames,
888
+ __privateGet$2(this, _profileInProgress)
889
+ );
890
+ __privateSet$2(this, _recordedTrailingSpans, []);
891
+ const profileDuration = measurementStartTs - profileStartTs;
892
+ writeSceneLog(
893
+ this.constructor.name,
894
+ "Stoped recording, total measured time (network included):",
895
+ profileDuration + slowFramesTime
896
+ );
897
+ __privateSet$2(this, _trailAnimationFrameId, null);
898
+ const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
899
+ performance.measure(`DashboardInteraction ${__privateGet$2(this, _profileInProgress).origin}`, {
900
+ start: profileStartTs,
901
+ end: profileEndTs
902
+ });
903
+ const networkDuration = captureNetwork(profileStartTs, profileEndTs);
904
+ if ((_a = this.queryController) == null ? void 0 : _a.state.onProfileComplete) {
905
+ this.queryController.state.onProfileComplete({
906
+ origin: __privateGet$2(this, _profileInProgress).origin,
907
+ crumbs: __privateGet$2(this, _profileInProgress).crumbs,
908
+ duration: profileDuration + slowFramesTime,
909
+ networkDuration,
910
+ startTs: profileStartTs,
911
+ endTs: profileEndTs,
912
+ // @ts-ignore
913
+ jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
914
+ // @ts-ignore
915
+ usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
916
+ // @ts-ignore
917
+ totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
918
+ });
919
+ __privateSet$2(this, _profileInProgress, null);
920
+ __privateSet$2(this, _trailAnimationFrameId, null);
921
+ }
922
+ if (window.__runs) {
923
+ window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
924
+ `;
925
+ } else {
926
+ window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
927
+ `;
928
+ }
929
+ }
930
+ };
931
+ }
932
+ setQueryController(queryController) {
933
+ this.queryController = queryController;
934
+ }
935
+ startProfile(name) {
936
+ if (__privateGet$2(this, _profileInProgress)) {
937
+ this.addCrumb(name);
938
+ } else {
939
+ __privateSet$2(this, _profileInProgress, { origin: name, crumbs: [] });
940
+ __privateSet$2(this, _profileStartTs, performance.now());
941
+ writeSceneLog("SceneRenderProfiler", "Profile started:", __privateGet$2(this, _profileInProgress), __privateGet$2(this, _profileStartTs));
942
+ }
943
+ }
944
+ recordProfileTail(measurementStartTime, profileStartTs) {
945
+ __privateSet$2(this, _trailAnimationFrameId, requestAnimationFrame(
946
+ () => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
947
+ ));
948
+ }
949
+ tryCompletingProfile() {
950
+ var _a;
951
+ writeSceneLog("SceneRenderProfiler", "Trying to complete profile", __privateGet$2(this, _profileInProgress));
952
+ if (((_a = this.queryController) == null ? void 0 : _a.runningQueriesCount()) === 0 && __privateGet$2(this, _profileInProgress)) {
953
+ writeSceneLog("SceneRenderProfiler", "All queries completed, stopping profile");
954
+ this.recordProfileTail(performance.now(), __privateGet$2(this, _profileStartTs));
955
+ }
956
+ }
957
+ isTailRecording() {
958
+ return Boolean(__privateGet$2(this, _trailAnimationFrameId));
959
+ }
960
+ cancelTailRecording() {
961
+ if (__privateGet$2(this, _trailAnimationFrameId)) {
962
+ cancelAnimationFrame(__privateGet$2(this, _trailAnimationFrameId));
963
+ __privateSet$2(this, _trailAnimationFrameId, null);
964
+ writeSceneLog("SceneRenderProfiler", "Cancelled recording frames, new profile started");
965
+ }
966
+ }
967
+ addCrumb(crumb) {
968
+ if (__privateGet$2(this, _profileInProgress)) {
969
+ writeSceneLog("SceneRenderProfiler", "Adding crumb:", crumb);
970
+ __privateGet$2(this, _profileInProgress).crumbs.push(crumb);
971
+ }
972
+ }
973
+ }
974
+ _profileInProgress = new WeakMap();
975
+ _profileStartTs = new WeakMap();
976
+ _trailAnimationFrameId = new WeakMap();
977
+ _recordedTrailingSpans = new WeakMap();
978
+ function processRecordedSpans(spans) {
979
+ for (let i = spans.length - 1; i >= 0; i--) {
980
+ if (spans[i] > SPAN_THRESHOLD) {
981
+ return spans.slice(0, i + 1);
982
+ }
983
+ }
984
+ return [spans[0]];
985
+ }
986
+ function captureNetwork(startTs, endTs) {
987
+ const entries = performance.getEntriesByType("resource");
988
+ performance.clearResourceTimings();
989
+ const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
990
+ for (const entry of networkEntries) {
991
+ performance.measure("Network entry " + entry.name, {
992
+ start: entry.startTime,
993
+ end: entry.responseEnd
994
+ });
995
+ }
996
+ return calculateNetworkTime(networkEntries);
997
+ }
998
+ function calculateNetworkTime(requests) {
999
+ if (requests.length === 0) {
1000
+ return 0;
1001
+ }
1002
+ requests.sort((a, b) => a.startTime - b.startTime);
1003
+ let totalNetworkTime = 0;
1004
+ let currentStart = requests[0].startTime;
1005
+ let currentEnd = requests[0].responseEnd;
1006
+ for (let i = 1; i < requests.length; i++) {
1007
+ if (requests[i].startTime <= currentEnd) {
1008
+ currentEnd = Math.max(currentEnd, requests[i].responseEnd);
1009
+ } else {
1010
+ totalNetworkTime += currentEnd - currentStart;
1011
+ currentStart = requests[i].startTime;
1012
+ currentEnd = requests[i].responseEnd;
1013
+ }
1014
+ }
1015
+ totalNetworkTime += currentEnd - currentStart;
1016
+ return totalNetworkTime;
1017
1017
  }
1018
+ const REFRESH_INTERACTION = "refresh";
1019
+ const TIME_RANGE_CHANGE_INTERACTION = "time_range_change";
1020
+ const FILTER_REMOVED_INTERACTION = "filter_removed";
1021
+ const FILTER_CHANGED_INTERACTION = "filter_changed";
1022
+ const FILTER_RESTORED_INTERACTION = "filter_restored";
1023
+ const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
1024
+ const SCOPES_CHANGED_INTERACTION = "scopes_changed";
1018
1025
 
1019
1026
  class SceneTimeRange extends SceneObjectBase {
1020
1027
  constructor(state = {}) {
@@ -2420,13 +2427,17 @@ const macrosIndex = /* @__PURE__ */ new Map([
2420
2427
  ["__interval", IntervalMacro],
2421
2428
  ["__interval_ms", IntervalMacro]
2422
2429
  ]);
2423
- function registerVariableMacro(name, macro) {
2424
- if (macrosIndex.get(name)) {
2430
+ function registerVariableMacro(name, macro, replace = false) {
2431
+ if (!replace && macrosIndex.get(name)) {
2425
2432
  throw new Error(`Macro already registered ${name}`);
2426
2433
  }
2427
2434
  macrosIndex.set(name, macro);
2428
2435
  return () => {
2429
- macrosIndex.delete(name);
2436
+ if (replace) {
2437
+ throw new Error(`Replaced macros can not be unregistered. They need to be restored manually.`);
2438
+ } else {
2439
+ macrosIndex.delete(name);
2440
+ }
2430
2441
  };
2431
2442
  }
2432
2443
 
@@ -2588,7 +2599,7 @@ async function getDataSource(datasource, scopedVars) {
2588
2599
  if (queryControler && queryControler.state.enableProfiling) {
2589
2600
  wrapPromiseInStateObservable(dsPromise).pipe(
2590
2601
  registerQueryWithController({
2591
- type: `plugin/${(_a = datasource == null ? void 0 : datasource.type) != null ? _a : "unknown"}`,
2602
+ type: `getDataSource/${(_a = datasource == null ? void 0 : datasource.type) != null ? _a : "unknown"}`,
2592
2603
  origin: scopedVars.__sceneObject.value.valueOf()
2593
2604
  })
2594
2605
  ).subscribe(() => {
@@ -6518,7 +6529,7 @@ class SceneQueryRunner extends SceneObjectBase {
6518
6529
  }
6519
6530
  stream = stream.pipe(
6520
6531
  registerQueryWithController({
6521
- type: "data",
6532
+ type: "SceneQueryRunner/runQueries",
6522
6533
  request: primary,
6523
6534
  origin: this,
6524
6535
  cancel: () => this.cancelQuery()
@@ -7439,7 +7450,7 @@ class QueryVariable extends MultiValueVariable {
7439
7450
  const request = this.getRequest(target, args.searchFilter);
7440
7451
  return runner.runRequest({ variable: this, searchFilter: args.searchFilter }, request).pipe(
7441
7452
  registerQueryWithController({
7442
- type: "variable",
7453
+ type: "QueryVariable/getValueOptions",
7443
7454
  request,
7444
7455
  origin: this
7445
7456
  }),
@@ -8497,6 +8508,253 @@ const createProperty = (color) => {
8497
8508
  };
8498
8509
  };
8499
8510
 
8511
+ class SceneDataLayerSetBase extends SceneObjectBase {
8512
+ constructor() {
8513
+ super(...arguments);
8514
+ /** Mark it as a data layer */
8515
+ this.isDataLayer = true;
8516
+ /**
8517
+ * Subject to emit results to.
8518
+ */
8519
+ this._results = new rxjs.ReplaySubject(1);
8520
+ this._dataLayersMerger = new DataLayersMerger();
8521
+ }
8522
+ subscribeToAllLayers(layers) {
8523
+ if (layers.length > 0) {
8524
+ this.querySub = this._dataLayersMerger.getMergedStream(layers).subscribe(this._onLayerUpdateReceived.bind(this));
8525
+ } else {
8526
+ this._results.next({ origin: this, data: emptyPanelData });
8527
+ this.setStateHelper({ data: emptyPanelData });
8528
+ }
8529
+ }
8530
+ _onLayerUpdateReceived(results) {
8531
+ var _a;
8532
+ let series = [];
8533
+ for (const result of results) {
8534
+ if ((_a = result.data) == null ? void 0 : _a.series) {
8535
+ series = series.concat(result.data.series);
8536
+ }
8537
+ }
8538
+ const combinedData = { ...emptyPanelData, series };
8539
+ this._results.next({ origin: this, data: combinedData });
8540
+ this.setStateHelper({ data: combinedData });
8541
+ }
8542
+ getResultsStream() {
8543
+ return this._results;
8544
+ }
8545
+ cancelQuery() {
8546
+ var _a;
8547
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8548
+ }
8549
+ /**
8550
+ * This helper function is to counter the contravariance of setState
8551
+ */
8552
+ setStateHelper(state) {
8553
+ setBaseClassState(this, state);
8554
+ }
8555
+ }
8556
+ class SceneDataLayerSet extends SceneDataLayerSetBase {
8557
+ constructor(state) {
8558
+ var _a, _b;
8559
+ super({
8560
+ name: (_a = state.name) != null ? _a : "Data layers",
8561
+ layers: (_b = state.layers) != null ? _b : []
8562
+ });
8563
+ this.addActivationHandler(() => this._onActivate());
8564
+ }
8565
+ _onActivate() {
8566
+ this._subs.add(
8567
+ this.subscribeToState((newState, oldState) => {
8568
+ var _a;
8569
+ if (newState.layers !== oldState.layers) {
8570
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8571
+ this.subscribeToAllLayers(newState.layers);
8572
+ }
8573
+ })
8574
+ );
8575
+ this.subscribeToAllLayers(this.state.layers);
8576
+ return () => {
8577
+ var _a;
8578
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8579
+ };
8580
+ }
8581
+ }
8582
+ SceneDataLayerSet.Component = ({ model }) => {
8583
+ const { layers } = model.useState();
8584
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, layers.map((layer) => /* @__PURE__ */ React__default.default.createElement(layer.Component, { model: layer, key: layer.state.key })));
8585
+ };
8586
+
8587
+ class SceneDataTransformer extends SceneObjectBase {
8588
+ constructor(state) {
8589
+ super(state);
8590
+ this._results = new rxjs.ReplaySubject(1);
8591
+ /**
8592
+ * Scan transformations for variable usage and re-process transforms when a variable values change
8593
+ */
8594
+ this._variableDependency = new VariableDependencyConfig(
8595
+ this,
8596
+ {
8597
+ statePaths: ["transformations"],
8598
+ onReferencedVariableValueChanged: () => this.reprocessTransformations()
8599
+ }
8600
+ );
8601
+ this.addActivationHandler(() => this.activationHandler());
8602
+ }
8603
+ activationHandler() {
8604
+ const sourceData = this.getSourceData();
8605
+ this._subs.add(sourceData.subscribeToState((state) => this.transform(state.data)));
8606
+ if (sourceData.state.data) {
8607
+ this.transform(sourceData.state.data);
8608
+ }
8609
+ return () => {
8610
+ if (this._transformSub) {
8611
+ this._transformSub.unsubscribe();
8612
+ }
8613
+ };
8614
+ }
8615
+ getSourceData() {
8616
+ if (this.state.$data) {
8617
+ if (this.state.$data instanceof SceneDataLayerSet) {
8618
+ throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");
8619
+ }
8620
+ return this.state.$data;
8621
+ }
8622
+ if (!this.parent || !this.parent.parent) {
8623
+ throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");
8624
+ }
8625
+ return sceneGraph.getData(this.parent.parent);
8626
+ }
8627
+ setContainerWidth(width) {
8628
+ if (this.state.$data && this.state.$data.setContainerWidth) {
8629
+ this.state.$data.setContainerWidth(width);
8630
+ }
8631
+ }
8632
+ isDataReadyToDisplay() {
8633
+ const dataObject = this.getSourceData();
8634
+ if (dataObject.isDataReadyToDisplay) {
8635
+ return dataObject.isDataReadyToDisplay();
8636
+ }
8637
+ return true;
8638
+ }
8639
+ reprocessTransformations() {
8640
+ this.transform(this.getSourceData().state.data, true);
8641
+ }
8642
+ cancelQuery() {
8643
+ var _a, _b;
8644
+ (_b = (_a = this.getSourceData()).cancelQuery) == null ? void 0 : _b.call(_a);
8645
+ }
8646
+ getResultsStream() {
8647
+ return this._results;
8648
+ }
8649
+ clone(withState) {
8650
+ const clone = super.clone(withState);
8651
+ if (this._prevDataFromSource) {
8652
+ clone["_prevDataFromSource"] = this._prevDataFromSource;
8653
+ }
8654
+ return clone;
8655
+ }
8656
+ haveAlreadyTransformedData(data) {
8657
+ if (!this._prevDataFromSource) {
8658
+ return false;
8659
+ }
8660
+ if (data === this._prevDataFromSource) {
8661
+ return true;
8662
+ }
8663
+ const { series, annotations } = this._prevDataFromSource;
8664
+ if (data.series === series && data.annotations === annotations) {
8665
+ if (this.state.data && data.state !== this.state.data.state) {
8666
+ this.setState({ data: { ...this.state.data, state: data.state } });
8667
+ }
8668
+ return true;
8669
+ }
8670
+ return false;
8671
+ }
8672
+ transform(data$1, force = false) {
8673
+ var _a;
8674
+ if (this.state.transformations.length === 0 || !data$1) {
8675
+ this._prevDataFromSource = data$1;
8676
+ this.setState({ data: data$1 });
8677
+ if (data$1) {
8678
+ this._results.next({ origin: this, data: data$1 });
8679
+ }
8680
+ return;
8681
+ }
8682
+ if (!force && this.haveAlreadyTransformedData(data$1)) {
8683
+ return;
8684
+ }
8685
+ let interpolatedTransformations = this._interpolateVariablesInTransformationConfigs(data$1);
8686
+ const seriesTransformations = interpolatedTransformations.filter((transformation) => {
8687
+ if ("options" in transformation || "topic" in transformation) {
8688
+ return transformation.topic == null || transformation.topic === data.DataTopic.Series;
8689
+ }
8690
+ return true;
8691
+ }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
8692
+ const annotationsTransformations = interpolatedTransformations.filter((transformation) => {
8693
+ if ("options" in transformation || "topic" in transformation) {
8694
+ return transformation.topic === data.DataTopic.Annotations;
8695
+ }
8696
+ return false;
8697
+ }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
8698
+ if (this._transformSub) {
8699
+ this._transformSub.unsubscribe();
8700
+ }
8701
+ const ctx = {
8702
+ interpolate: (value) => {
8703
+ var _a2;
8704
+ return sceneGraph.interpolate(this, value, (_a2 = data$1.request) == null ? void 0 : _a2.scopedVars);
8705
+ }
8706
+ };
8707
+ let streams = [data.transformDataFrame(seriesTransformations, data$1.series, ctx)];
8708
+ if (data$1.annotations && data$1.annotations.length > 0 && annotationsTransformations.length > 0) {
8709
+ streams.push(data.transformDataFrame(annotationsTransformations, (_a = data$1.annotations) != null ? _a : []));
8710
+ }
8711
+ this._transformSub = rxjs.forkJoin(streams).pipe(
8712
+ rxjs.map((values) => {
8713
+ const transformedSeries = values[0];
8714
+ const transformedAnnotations = values[1];
8715
+ return {
8716
+ ...data$1,
8717
+ series: transformedSeries,
8718
+ annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
8719
+ };
8720
+ }),
8721
+ rxjs.catchError((err) => {
8722
+ var _a2;
8723
+ console.error("Error transforming data: ", err);
8724
+ const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
8725
+ const transformationError = runtime.toDataQueryError(err);
8726
+ transformationError.message = `Error transforming data: ${transformationError.message}`;
8727
+ const result = {
8728
+ ...data$1,
8729
+ state: data.LoadingState.Error,
8730
+ // Combine transformation error with upstream errors
8731
+ errors: [...sourceErr, transformationError]
8732
+ };
8733
+ return rxjs.of(result);
8734
+ })
8735
+ ).subscribe((transformedData) => {
8736
+ this.setState({ data: transformedData });
8737
+ this._results.next({ origin: this, data: transformedData });
8738
+ this._prevDataFromSource = data$1;
8739
+ });
8740
+ }
8741
+ _interpolateVariablesInTransformationConfigs(data) {
8742
+ var _a;
8743
+ const transformations = this.state.transformations;
8744
+ if (this._variableDependency.getNames().size === 0) {
8745
+ return transformations;
8746
+ }
8747
+ const onlyObjects = transformations.every((t) => typeof t === "object");
8748
+ if (onlyObjects) {
8749
+ return JSON.parse(sceneGraph.interpolate(this, JSON.stringify(transformations), (_a = data.request) == null ? void 0 : _a.scopedVars));
8750
+ }
8751
+ return transformations.map((t) => {
8752
+ var _a2;
8753
+ return typeof t === "object" ? JSON.parse(sceneGraph.interpolate(this, JSON.stringify(t), (_a2 = data.request) == null ? void 0 : _a2.scopedVars)) : t;
8754
+ });
8755
+ }
8756
+ }
8757
+
8500
8758
  class VizPanel extends SceneObjectBase {
8501
8759
  constructor(state) {
8502
8760
  var _a;
@@ -8688,7 +8946,7 @@ class VizPanel extends SceneObjectBase {
8688
8946
  const panelPromise = importPanelPlugin(pluginId);
8689
8947
  const queryControler = sceneGraph.getQueryController(this);
8690
8948
  if (queryControler && queryControler.state.enableProfiling) {
8691
- wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: `plugin/${pluginId}`, origin: this })).subscribe(() => {
8949
+ wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: `VizPanel/loadPlugin/${pluginId}`, origin: this })).subscribe(() => {
8692
8950
  });
8693
8951
  }
8694
8952
  const result = await panelPromise;
@@ -8735,6 +8993,18 @@ class VizPanel extends SceneObjectBase {
8735
8993
  if (plugin.onPanelMigration && currentVersion !== pluginVersion && !isAfterPluginChange) {
8736
8994
  panel.options = await plugin.onPanelMigration(panel);
8737
8995
  }
8996
+ let $data = this.state.$data;
8997
+ if (panel.transformations && $data) {
8998
+ if ($data instanceof SceneDataTransformer) {
8999
+ $data.setState({ transformations: panel.transformations });
9000
+ } else if ($data instanceof SceneQueryRunner) {
9001
+ $data.clearParent();
9002
+ $data = new SceneDataTransformer({
9003
+ transformations: panel.transformations,
9004
+ $data
9005
+ });
9006
+ }
9007
+ }
8738
9008
  const withDefaults = data.getPanelOptionsWithDefaults({
8739
9009
  plugin,
8740
9010
  currentOptions: panel.options,
@@ -8743,6 +9013,7 @@ class VizPanel extends SceneObjectBase {
8743
9013
  });
8744
9014
  this._plugin = plugin;
8745
9015
  this.setState({
9016
+ $data,
8746
9017
  options: withDefaults.options,
8747
9018
  fieldConfig: withDefaults.fieldConfig,
8748
9019
  pluginVersion: currentVersion,
@@ -9480,7 +9751,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
9480
9751
  const ds = await this.resolveDataSource(query);
9481
9752
  let stream = executeAnnotationQuery(ds, timeRange, query, this).pipe(
9482
9753
  registerQueryWithController({
9483
- type: "annotations",
9754
+ type: "AnnotationsDataLayer/annotationsLoading",
9484
9755
  origin: this,
9485
9756
  cancel: () => this.cancelQuery()
9486
9757
  }),
@@ -9642,253 +9913,6 @@ class DataProviderProxy extends SceneObjectBase {
9642
9913
  }
9643
9914
  }
9644
9915
 
9645
- class SceneDataLayerSetBase extends SceneObjectBase {
9646
- constructor() {
9647
- super(...arguments);
9648
- /** Mark it as a data layer */
9649
- this.isDataLayer = true;
9650
- /**
9651
- * Subject to emit results to.
9652
- */
9653
- this._results = new rxjs.ReplaySubject(1);
9654
- this._dataLayersMerger = new DataLayersMerger();
9655
- }
9656
- subscribeToAllLayers(layers) {
9657
- if (layers.length > 0) {
9658
- this.querySub = this._dataLayersMerger.getMergedStream(layers).subscribe(this._onLayerUpdateReceived.bind(this));
9659
- } else {
9660
- this._results.next({ origin: this, data: emptyPanelData });
9661
- this.setStateHelper({ data: emptyPanelData });
9662
- }
9663
- }
9664
- _onLayerUpdateReceived(results) {
9665
- var _a;
9666
- let series = [];
9667
- for (const result of results) {
9668
- if ((_a = result.data) == null ? void 0 : _a.series) {
9669
- series = series.concat(result.data.series);
9670
- }
9671
- }
9672
- const combinedData = { ...emptyPanelData, series };
9673
- this._results.next({ origin: this, data: combinedData });
9674
- this.setStateHelper({ data: combinedData });
9675
- }
9676
- getResultsStream() {
9677
- return this._results;
9678
- }
9679
- cancelQuery() {
9680
- var _a;
9681
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9682
- }
9683
- /**
9684
- * This helper function is to counter the contravariance of setState
9685
- */
9686
- setStateHelper(state) {
9687
- setBaseClassState(this, state);
9688
- }
9689
- }
9690
- class SceneDataLayerSet extends SceneDataLayerSetBase {
9691
- constructor(state) {
9692
- var _a, _b;
9693
- super({
9694
- name: (_a = state.name) != null ? _a : "Data layers",
9695
- layers: (_b = state.layers) != null ? _b : []
9696
- });
9697
- this.addActivationHandler(() => this._onActivate());
9698
- }
9699
- _onActivate() {
9700
- this._subs.add(
9701
- this.subscribeToState((newState, oldState) => {
9702
- var _a;
9703
- if (newState.layers !== oldState.layers) {
9704
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9705
- this.subscribeToAllLayers(newState.layers);
9706
- }
9707
- })
9708
- );
9709
- this.subscribeToAllLayers(this.state.layers);
9710
- return () => {
9711
- var _a;
9712
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9713
- };
9714
- }
9715
- }
9716
- SceneDataLayerSet.Component = ({ model }) => {
9717
- const { layers } = model.useState();
9718
- return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, layers.map((layer) => /* @__PURE__ */ React__default.default.createElement(layer.Component, { model: layer, key: layer.state.key })));
9719
- };
9720
-
9721
- class SceneDataTransformer extends SceneObjectBase {
9722
- constructor(state) {
9723
- super(state);
9724
- this._results = new rxjs.ReplaySubject(1);
9725
- /**
9726
- * Scan transformations for variable usage and re-process transforms when a variable values change
9727
- */
9728
- this._variableDependency = new VariableDependencyConfig(
9729
- this,
9730
- {
9731
- statePaths: ["transformations"],
9732
- onReferencedVariableValueChanged: () => this.reprocessTransformations()
9733
- }
9734
- );
9735
- this.addActivationHandler(() => this.activationHandler());
9736
- }
9737
- activationHandler() {
9738
- const sourceData = this.getSourceData();
9739
- this._subs.add(sourceData.subscribeToState((state) => this.transform(state.data)));
9740
- if (sourceData.state.data) {
9741
- this.transform(sourceData.state.data);
9742
- }
9743
- return () => {
9744
- if (this._transformSub) {
9745
- this._transformSub.unsubscribe();
9746
- }
9747
- };
9748
- }
9749
- getSourceData() {
9750
- if (this.state.$data) {
9751
- if (this.state.$data instanceof SceneDataLayerSet) {
9752
- throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");
9753
- }
9754
- return this.state.$data;
9755
- }
9756
- if (!this.parent || !this.parent.parent) {
9757
- throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");
9758
- }
9759
- return sceneGraph.getData(this.parent.parent);
9760
- }
9761
- setContainerWidth(width) {
9762
- if (this.state.$data && this.state.$data.setContainerWidth) {
9763
- this.state.$data.setContainerWidth(width);
9764
- }
9765
- }
9766
- isDataReadyToDisplay() {
9767
- const dataObject = this.getSourceData();
9768
- if (dataObject.isDataReadyToDisplay) {
9769
- return dataObject.isDataReadyToDisplay();
9770
- }
9771
- return true;
9772
- }
9773
- reprocessTransformations() {
9774
- this.transform(this.getSourceData().state.data, true);
9775
- }
9776
- cancelQuery() {
9777
- var _a, _b;
9778
- (_b = (_a = this.getSourceData()).cancelQuery) == null ? void 0 : _b.call(_a);
9779
- }
9780
- getResultsStream() {
9781
- return this._results;
9782
- }
9783
- clone(withState) {
9784
- const clone = super.clone(withState);
9785
- if (this._prevDataFromSource) {
9786
- clone["_prevDataFromSource"] = this._prevDataFromSource;
9787
- }
9788
- return clone;
9789
- }
9790
- haveAlreadyTransformedData(data) {
9791
- if (!this._prevDataFromSource) {
9792
- return false;
9793
- }
9794
- if (data === this._prevDataFromSource) {
9795
- return true;
9796
- }
9797
- const { series, annotations } = this._prevDataFromSource;
9798
- if (data.series === series && data.annotations === annotations) {
9799
- if (this.state.data && data.state !== this.state.data.state) {
9800
- this.setState({ data: { ...this.state.data, state: data.state } });
9801
- }
9802
- return true;
9803
- }
9804
- return false;
9805
- }
9806
- transform(data$1, force = false) {
9807
- var _a;
9808
- if (this.state.transformations.length === 0 || !data$1) {
9809
- this._prevDataFromSource = data$1;
9810
- this.setState({ data: data$1 });
9811
- if (data$1) {
9812
- this._results.next({ origin: this, data: data$1 });
9813
- }
9814
- return;
9815
- }
9816
- if (!force && this.haveAlreadyTransformedData(data$1)) {
9817
- return;
9818
- }
9819
- let interpolatedTransformations = this._interpolateVariablesInTransformationConfigs(data$1);
9820
- const seriesTransformations = interpolatedTransformations.filter((transformation) => {
9821
- if ("options" in transformation || "topic" in transformation) {
9822
- return transformation.topic == null || transformation.topic === data.DataTopic.Series;
9823
- }
9824
- return true;
9825
- }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
9826
- const annotationsTransformations = interpolatedTransformations.filter((transformation) => {
9827
- if ("options" in transformation || "topic" in transformation) {
9828
- return transformation.topic === data.DataTopic.Annotations;
9829
- }
9830
- return false;
9831
- }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
9832
- if (this._transformSub) {
9833
- this._transformSub.unsubscribe();
9834
- }
9835
- const ctx = {
9836
- interpolate: (value) => {
9837
- var _a2;
9838
- return sceneGraph.interpolate(this, value, (_a2 = data$1.request) == null ? void 0 : _a2.scopedVars);
9839
- }
9840
- };
9841
- let streams = [data.transformDataFrame(seriesTransformations, data$1.series, ctx)];
9842
- if (data$1.annotations && data$1.annotations.length > 0 && annotationsTransformations.length > 0) {
9843
- streams.push(data.transformDataFrame(annotationsTransformations, (_a = data$1.annotations) != null ? _a : []));
9844
- }
9845
- this._transformSub = rxjs.forkJoin(streams).pipe(
9846
- rxjs.map((values) => {
9847
- const transformedSeries = values[0];
9848
- const transformedAnnotations = values[1];
9849
- return {
9850
- ...data$1,
9851
- series: transformedSeries,
9852
- annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
9853
- };
9854
- }),
9855
- rxjs.catchError((err) => {
9856
- var _a2;
9857
- console.error("Error transforming data: ", err);
9858
- const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
9859
- const transformationError = runtime.toDataQueryError(err);
9860
- transformationError.message = `Error transforming data: ${transformationError.message}`;
9861
- const result = {
9862
- ...data$1,
9863
- state: data.LoadingState.Error,
9864
- // Combine transformation error with upstream errors
9865
- errors: [...sourceErr, transformationError]
9866
- };
9867
- return rxjs.of(result);
9868
- })
9869
- ).subscribe((transformedData) => {
9870
- this.setState({ data: transformedData });
9871
- this._results.next({ origin: this, data: transformedData });
9872
- this._prevDataFromSource = data$1;
9873
- });
9874
- }
9875
- _interpolateVariablesInTransformationConfigs(data) {
9876
- var _a;
9877
- const transformations = this.state.transformations;
9878
- if (this._variableDependency.getNames().size === 0) {
9879
- return transformations;
9880
- }
9881
- const onlyObjects = transformations.every((t) => typeof t === "object");
9882
- if (onlyObjects) {
9883
- return JSON.parse(sceneGraph.interpolate(this, JSON.stringify(transformations), (_a = data.request) == null ? void 0 : _a.scopedVars));
9884
- }
9885
- return transformations.map((t) => {
9886
- var _a2;
9887
- return typeof t === "object" ? JSON.parse(sceneGraph.interpolate(this, JSON.stringify(t), (_a2 = data.request) == null ? void 0 : _a2.scopedVars)) : t;
9888
- });
9889
- }
9890
- }
9891
-
9892
9916
  class VariableValueSelectors extends SceneObjectBase {
9893
9917
  }
9894
9918
  VariableValueSelectors.Component = VariableValueSelectorsRenderer;
@@ -14596,6 +14620,7 @@ exports.SceneObjectUrlSyncConfig = SceneObjectUrlSyncConfig;
14596
14620
  exports.SceneQueryRunner = SceneQueryRunner;
14597
14621
  exports.SceneReactObject = SceneReactObject;
14598
14622
  exports.SceneRefreshPicker = SceneRefreshPicker;
14623
+ exports.SceneRenderProfiler = SceneRenderProfiler;
14599
14624
  exports.SceneTimePicker = SceneTimePicker;
14600
14625
  exports.SceneTimeRange = SceneTimeRange;
14601
14626
  exports.SceneTimeRangeCompare = SceneTimeRangeCompare;