@localstack/appinspector-ui 1.0.134 → 1.0.135

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
@@ -2422,7 +2422,7 @@ var init_event_streams = __esm({
2422
2422
 
2423
2423
  // src/pages/spans-list-page.tsx
2424
2424
  import { Box as Box20 } from "@mui/material";
2425
- import { useCallback as useCallback12, useEffect as useEffect22, useRef as useRef16, useState as useState18 } from "react";
2425
+ import { useCallback as useCallback11, useEffect as useEffect22, useRef as useRef16, useState as useState18 } from "react";
2426
2426
 
2427
2427
  // src/api/errors.ts
2428
2428
  var AppInspectorDisabledError = class extends Error {
@@ -15943,11 +15943,10 @@ import { Alert as Alert3, AlertTitle, Box as Box7, Button as Button4, CircularPr
15943
15943
  import { useState as useState5 } from "react";
15944
15944
  import { Fragment as Fragment6, jsx as jsx129, jsxs as jsxs123 } from "react/jsx-runtime";
15945
15945
  var StatusMessage = ({
15946
- error,
15947
15946
  localstackVersion,
15948
15947
  onEnable,
15949
15948
  onRetry,
15950
- status
15949
+ phase
15951
15950
  }) => {
15952
15951
  const [enabling, setEnabling] = useState5(false);
15953
15952
  const [enableError, setEnableError] = useState5();
@@ -15963,8 +15962,23 @@ var StatusMessage = ({
15963
15962
  setEnabling(false);
15964
15963
  }
15965
15964
  };
15966
- const isBelowMinimum = localstackVersion !== void 0 && checkEmulatorVersion(localstackVersion) === "below-minimum";
15967
- if (isBelowMinimum || error instanceof AppInspectorNotFoundError) {
15965
+ if (phase === "CHECKING_STATUS" || phase === "CONNECTING_WS") {
15966
+ return /* @__PURE__ */ jsx129(
15967
+ Box7,
15968
+ {
15969
+ sx: {
15970
+ alignItems: "center",
15971
+ display: "flex",
15972
+ flexDirection: "column",
15973
+ gap: 2,
15974
+ justifyContent: "center",
15975
+ p: 4
15976
+ },
15977
+ children: /* @__PURE__ */ jsx129(CircularProgress2, { size: 32 })
15978
+ }
15979
+ );
15980
+ }
15981
+ if (phase === "INCOMPATIBLE") {
15968
15982
  return /* @__PURE__ */ jsx129(
15969
15983
  Box7,
15970
15984
  {
@@ -15984,7 +15998,7 @@ var StatusMessage = ({
15984
15998
  sx: { maxWidth: 600, width: "100%" },
15985
15999
  children: [
15986
16000
  /* @__PURE__ */ jsx129(AlertTitle, { sx: { fontWeight: "bold" }, children: "App Inspector Not Available" }),
15987
- /* @__PURE__ */ jsx129(Typography5, { sx: { mb: 2 }, variant: "body2", children: isBelowMinimum ? `App Inspector requires LocalStack ${MINIMUM_EMULATOR_VERSION} or later. You are running version ${localstackVersion}. Please update LocalStack.` : `App Inspector requires LocalStack ${MINIMUM_EMULATOR_VERSION} or later. Please update LocalStack.` }),
16001
+ /* @__PURE__ */ jsx129(Typography5, { sx: { mb: 2 }, variant: "body2", children: localstackVersion === void 0 ? `App Inspector requires LocalStack ${MINIMUM_EMULATOR_VERSION} or later. Please update LocalStack.` : `App Inspector requires LocalStack ${MINIMUM_EMULATOR_VERSION} or later. You are running version ${localstackVersion}. Please update LocalStack.` }),
15988
16002
  /* @__PURE__ */ jsx129(Typography5, { sx: { mb: 1 }, variant: "body2", children: /* @__PURE__ */ jsx129("strong", { children: "Update LocalStack:" }) }),
15989
16003
  /* @__PURE__ */ jsx129(
15990
16004
  Box7,
@@ -15999,11 +16013,10 @@ var StatusMessage = ({
15999
16013
  children: "localstack update docker-images"
16000
16014
  }
16001
16015
  ),
16002
- /* @__PURE__ */ jsx129(Box7, { sx: { display: "flex", gap: 1, mt: 2 }, children: onRetry && /* @__PURE__ */ jsx129(
16016
+ onRetry && /* @__PURE__ */ jsx129(Box7, { sx: { display: "flex", gap: 1, mt: 2 }, children: /* @__PURE__ */ jsx129(
16003
16017
  Button4,
16004
16018
  {
16005
16019
  "aria-label": "Check App Inspector status again",
16006
- disabled: enabling,
16007
16020
  onClick: onRetry,
16008
16021
  variant: "outlined",
16009
16022
  children: "Check Again"
@@ -16015,7 +16028,7 @@ var StatusMessage = ({
16015
16028
  }
16016
16029
  );
16017
16030
  }
16018
- if (error instanceof ConnectionError) {
16031
+ if (phase === "UNREACHABLE") {
16019
16032
  return /* @__PURE__ */ jsx129(
16020
16033
  Box7,
16021
16034
  {
@@ -16077,7 +16090,7 @@ var StatusMessage = ({
16077
16090
  }
16078
16091
  );
16079
16092
  }
16080
- if (error instanceof AppInspectorDisabledError || status?.status === "DISABLED") {
16093
+ if (phase === "DISABLED") {
16081
16094
  return /* @__PURE__ */ jsx129(
16082
16095
  Box7,
16083
16096
  {
@@ -16132,102 +16145,99 @@ var StatusMessage = ({
16132
16145
  }
16133
16146
  );
16134
16147
  }
16135
- if (error) {
16136
- return /* @__PURE__ */ jsx129(
16137
- Box7,
16138
- {
16139
- sx: {
16140
- alignItems: "center",
16141
- display: "flex",
16142
- flexDirection: "column",
16143
- gap: 2,
16144
- justifyContent: "center",
16145
- p: 4
16146
- },
16147
- children: /* @__PURE__ */ jsxs123(
16148
- Alert3,
16149
- {
16150
- icon: /* @__PURE__ */ jsx129(ErrorOutline, { fontSize: "large" }),
16151
- severity: "error",
16152
- sx: { maxWidth: 600, width: "100%" },
16153
- children: [
16154
- /* @__PURE__ */ jsx129(AlertTitle, { sx: { fontWeight: "bold" }, children: "Error" }),
16155
- /* @__PURE__ */ jsx129(Typography5, { sx: { mb: 2 }, variant: "body2", children: error.message }),
16156
- onRetry && /* @__PURE__ */ jsx129(Box7, { sx: { display: "flex", justifyContent: "flex-start", mt: 2 }, children: /* @__PURE__ */ jsx129(
16157
- Button4,
16158
- {
16159
- "aria-label": "Retry operation",
16160
- onClick: onRetry,
16161
- variant: "outlined",
16162
- children: "Retry"
16163
- }
16164
- ) })
16165
- ]
16166
- }
16167
- )
16168
- }
16169
- );
16170
- }
16171
16148
  return /* @__PURE__ */ jsx129(Fragment6, {});
16172
16149
  };
16173
16150
 
16174
16151
  // src/hooks/status-provider.tsx
16175
- import { createContext as createContext8, useCallback as useCallback4, useContext as useContext14, useMemo as useMemo5 } from "react";
16152
+ import { createContext as createContext8, useContext as useContext14 } from "react";
16176
16153
 
16177
- // src/hooks/use-status.tsx
16154
+ // src/hooks/use-connection-state-machine.ts
16178
16155
  import { useCallback as useCallback3, useEffect as useEffect12, useRef as useRef7, useState as useState6 } from "react";
16179
- var useStatus = () => {
16156
+ var POLL_INTERVAL_MS = 5e3;
16157
+ function useConnectionStateMachine() {
16180
16158
  const api = useAppInspectorApi();
16159
+ const [phase, setPhase] = useState6("CHECKING_STATUS");
16181
16160
  const [checking, setChecking] = useState6(true);
16182
16161
  const [status, setStatus] = useState6();
16183
- const [error, setError] = useState6();
16184
- const hasFetchedReference = useRef7(false);
16185
- const abortControllerReference = useRef7(null);
16186
- const checkStatus = useCallback3(async () => {
16187
- if (abortControllerReference.current !== null) {
16188
- abortControllerReference.current.abort();
16162
+ const [statusError, setStatusError] = useState6();
16163
+ const abortControllerRef = useRef7(null);
16164
+ const dispatchStatus = useCallback3((result, error) => {
16165
+ if (result === void 0) {
16166
+ setStatus(void 0);
16167
+ setStatusError(error);
16168
+ setPhase(error instanceof AppInspectorNotFoundError ? "INCOMPATIBLE" : "UNREACHABLE");
16169
+ return;
16170
+ }
16171
+ setStatus(result);
16172
+ setStatusError(void 0);
16173
+ if (checkEmulatorVersion(result.localstackVersion) === "below-minimum") {
16174
+ setPhase("INCOMPATIBLE");
16175
+ return;
16176
+ }
16177
+ setPhase(result.status === "ENABLED" ? "CONNECTING_WS" : "DISABLED");
16178
+ }, []);
16179
+ const runCheck = useCallback3(async () => {
16180
+ if (abortControllerRef.current !== null) {
16181
+ abortControllerRef.current.abort();
16189
16182
  }
16190
16183
  const abortController = new AbortController();
16191
- abortControllerReference.current = abortController;
16184
+ abortControllerRef.current = abortController;
16192
16185
  setChecking(true);
16193
16186
  try {
16194
- const response = await api.getStatus();
16187
+ const result = await api.getStatus();
16195
16188
  if (!abortController.signal.aborted) {
16196
- setStatus(response);
16197
- setError(void 0);
16189
+ dispatchStatus(result);
16198
16190
  }
16199
- } catch (error_) {
16191
+ } catch (error) {
16200
16192
  if (!abortController.signal.aborted) {
16201
- setError(error_ instanceof Error ? error_ : new Error("Unknown error"));
16202
- setStatus(void 0);
16193
+ dispatchStatus(void 0, error instanceof Error ? error : new Error("Unknown error"));
16203
16194
  }
16204
16195
  } finally {
16205
16196
  if (!abortController.signal.aborted) {
16206
16197
  setChecking(false);
16207
16198
  }
16208
16199
  }
16209
- }, [api]);
16200
+ }, [api, dispatchStatus]);
16210
16201
  useEffect12(() => {
16211
- if (!hasFetchedReference.current) {
16212
- hasFetchedReference.current = true;
16213
- void checkStatus();
16214
- }
16215
- }, [checkStatus]);
16216
- return { checking, checkStatus, error, status };
16217
- };
16202
+ void runCheck();
16203
+ }, [runCheck]);
16204
+ useEffect12(() => {
16205
+ if (phase !== "UNREACHABLE" && phase !== "DISABLED") return;
16206
+ const intervalId = globalThis.setInterval(() => {
16207
+ void runCheck();
16208
+ }, POLL_INTERVAL_MS);
16209
+ return () => {
16210
+ globalThis.clearInterval(intervalId);
16211
+ };
16212
+ }, [phase, runCheck]);
16213
+ const checkStatus = useCallback3(() => {
16214
+ void runCheck();
16215
+ }, [runCheck]);
16216
+ const onWsOpen = useCallback3(() => {
16217
+ setPhase("LIVE");
16218
+ }, []);
16219
+ const onWsClose = useCallback3(() => {
16220
+ setPhase("CHECKING_STATUS");
16221
+ void runCheck();
16222
+ }, [runCheck]);
16223
+ const wsEnabled = phase === "CONNECTING_WS" || phase === "LIVE";
16224
+ return {
16225
+ checking,
16226
+ checkStatus,
16227
+ onWsClose,
16228
+ onWsOpen,
16229
+ phase,
16230
+ status,
16231
+ statusError,
16232
+ wsEnabled
16233
+ };
16234
+ }
16218
16235
 
16219
16236
  // src/hooks/status-provider.tsx
16220
16237
  import { jsx as jsx130 } from "react/jsx-runtime";
16221
16238
  var AppInspectorStatusContext = createContext8(void 0);
16222
16239
  var StatusProvider = ({ children }) => {
16223
- const { checking, checkStatus, error, status } = useStatus();
16224
- const reportDisabled = useCallback4(() => {
16225
- void checkStatus();
16226
- }, [checkStatus]);
16227
- const value = useMemo5(
16228
- () => ({ checking, checkStatus, reportDisabled, status, statusError: error }),
16229
- [checking, checkStatus, reportDisabled, status, error]
16230
- );
16240
+ const value = useConnectionStateMachine();
16231
16241
  return /* @__PURE__ */ jsx130(AppInspectorStatusContext.Provider, { value, children });
16232
16242
  };
16233
16243
  var useAppInspectorStatus = () => {
@@ -16239,7 +16249,7 @@ var useAppInspectorStatus = () => {
16239
16249
  };
16240
16250
 
16241
16251
  // src/hooks/use-local-storage.tsx
16242
- import { useCallback as useCallback5, useEffect as useEffect13, useState as useState7 } from "react";
16252
+ import { useCallback as useCallback4, useEffect as useEffect13, useState as useState7 } from "react";
16243
16253
  function useLocalStorage(key, initialValue) {
16244
16254
  const [storedValue, setStoredValue] = useState7(() => {
16245
16255
  try {
@@ -16250,7 +16260,7 @@ function useLocalStorage(key, initialValue) {
16250
16260
  return initialValue;
16251
16261
  }
16252
16262
  });
16253
- const setValue = useCallback5((value) => {
16263
+ const setValue = useCallback4((value) => {
16254
16264
  try {
16255
16265
  setStoredValue((previousState) => {
16256
16266
  const next = typeof value === "function" ? value(previousState) : value;
@@ -16284,7 +16294,7 @@ function useLocalStorage(key, initialValue) {
16284
16294
  }
16285
16295
 
16286
16296
  // src/hooks/use-spans.ts
16287
- import { useCallback as useCallback8, useEffect as useEffect16, useRef as useRef10, useState as useState9 } from "react";
16297
+ import { useCallback as useCallback7, useEffect as useEffect16, useRef as useRef10, useState as useState9 } from "react";
16288
16298
 
16289
16299
  // src/utils/pagination-buffer.ts
16290
16300
  var insertSorted = (array, item, compareFunction, hint = "back") => {
@@ -16465,7 +16475,7 @@ var createPaginationBuffer = (options) => {
16465
16475
  };
16466
16476
 
16467
16477
  // src/hooks/use-spans-ws.tsx
16468
- import { useCallback as useCallback7, useEffect as useEffect15, useRef as useRef9, useState as useState8 } from "react";
16478
+ import { useCallback as useCallback6, useEffect as useEffect15, useRef as useRef9, useState as useState8 } from "react";
16469
16479
 
16470
16480
  // src/config.ts
16471
16481
  var APPINSPECTOR_API_PREFIX = "/_localstack/appinspector";
@@ -16495,7 +16505,7 @@ var LOCALSTACK_INFO_PATH = "/_localstack/info";
16495
16505
 
16496
16506
  // src/context.tsx
16497
16507
  import { createContext as createContext9, useContext as useContext15 } from "react";
16498
- import { useCallback as useCallback6, useMemo as useMemo6 } from "react";
16508
+ import { useCallback as useCallback5, useMemo as useMemo5 } from "react";
16499
16509
 
16500
16510
  // src/api/client.ts
16501
16511
  var import_semver2 = __toESM(require_semver2(), 1);
@@ -18661,11 +18671,11 @@ var AppInspectorAnalyticsBoundary = ({ children }) => {
18661
18671
  return /* @__PURE__ */ jsx131(Fragment7, { children });
18662
18672
  };
18663
18673
  var AppInspectorContextProvider = (props) => {
18664
- const api = useMemo6(
18674
+ const api = useMemo5(
18665
18675
  () => createApiClient({ localstackEndpoint: props.localstackEndpoint }),
18666
18676
  [props.localstackEndpoint]
18667
18677
  );
18668
- const resolveLink = useCallback6(
18678
+ const resolveLink = useCallback5(
18669
18679
  (options) => {
18670
18680
  if (options.to === "settings") {
18671
18681
  return `${props.routePrefix}/settings`;
@@ -18677,11 +18687,11 @@ var AppInspectorContextProvider = (props) => {
18677
18687
  },
18678
18688
  [props.routePrefix]
18679
18689
  );
18680
- const deploymentContainer = useMemo6(
18690
+ const deploymentContainer = useMemo5(
18681
18691
  () => props.deploymentContainer ?? { source: "web" },
18682
18692
  [props.deploymentContainer]
18683
18693
  );
18684
- const contextValue = useMemo6(
18694
+ const contextValue = useMemo5(
18685
18695
  () => ({
18686
18696
  deploymentContainer,
18687
18697
  linkComponent: props.linkComponent,
@@ -18695,35 +18705,45 @@ var AppInspectorContextProvider = (props) => {
18695
18705
 
18696
18706
  // src/hooks/use-spans-ws.tsx
18697
18707
  function useSpansWebSocket(options) {
18698
- const { onMessage } = options;
18708
+ const { enabled, onClose, onMessage, onOpen } = options;
18699
18709
  const onMessageRef = useRef9(onMessage);
18710
+ const onOpenRef = useRef9(onOpen);
18711
+ const onCloseRef = useRef9(onClose);
18700
18712
  useEffect15(() => {
18701
18713
  onMessageRef.current = onMessage;
18702
18714
  }, [onMessage]);
18715
+ useEffect15(() => {
18716
+ onOpenRef.current = onOpen;
18717
+ }, [onOpen]);
18718
+ useEffect15(() => {
18719
+ onCloseRef.current = onClose;
18720
+ }, [onClose]);
18703
18721
  const [connected, setConnected] = useState8(false);
18704
18722
  const wsRef = useRef9(void 0);
18705
- const reconnectRef = useRef9(void 0);
18706
18723
  const { localstackEndpoint } = useAppInspector();
18707
- const connect = useCallback7(() => {
18724
+ const connect = useCallback6(() => {
18708
18725
  if (wsRef.current !== void 0) return;
18709
18726
  const url = new URL(getAppInspectorApiUrl(localstackEndpoint, API_ENDPOINTS.WEBSOCKET_SPANS));
18710
18727
  url.protocol = globalThis.location.protocol === "https:" ? "wss" : "ws";
18711
18728
  const ws = new WebSocket(url);
18712
18729
  wsRef.current = ws;
18713
18730
  ws.addEventListener("open", () => {
18731
+ if (wsRef.current !== ws) return;
18714
18732
  setConnected(true);
18733
+ onOpenRef.current();
18715
18734
  });
18716
18735
  ws.addEventListener("message", () => {
18736
+ if (wsRef.current !== ws) return;
18717
18737
  onMessageRef.current();
18718
18738
  });
18719
18739
  ws.addEventListener("close", () => {
18740
+ if (wsRef.current !== ws) return;
18720
18741
  setConnected(false);
18721
18742
  wsRef.current = void 0;
18722
- reconnectRef.current = globalThis.setTimeout(() => {
18723
- connect();
18724
- }, 2e3);
18743
+ onCloseRef.current();
18725
18744
  });
18726
18745
  ws.addEventListener("error", () => {
18746
+ if (wsRef.current !== ws) return;
18727
18747
  try {
18728
18748
  ws.close();
18729
18749
  } catch {
@@ -18731,18 +18751,26 @@ function useSpansWebSocket(options) {
18731
18751
  });
18732
18752
  }, [localstackEndpoint]);
18733
18753
  useEffect15(() => {
18754
+ if (!enabled) {
18755
+ if (wsRef.current !== void 0) {
18756
+ wsRef.current.close();
18757
+ wsRef.current = void 0;
18758
+ setConnected(false);
18759
+ }
18760
+ return;
18761
+ }
18734
18762
  connect();
18735
18763
  return () => {
18736
- if (reconnectRef.current !== void 0) clearTimeout(reconnectRef.current);
18737
18764
  if (wsRef.current !== void 0) {
18738
18765
  try {
18739
18766
  wsRef.current.close();
18740
18767
  } catch {
18741
18768
  }
18742
18769
  wsRef.current = void 0;
18770
+ setConnected(false);
18743
18771
  }
18744
18772
  };
18745
- }, [connect]);
18773
+ }, [enabled, connect]);
18746
18774
  return { connected };
18747
18775
  }
18748
18776
 
@@ -18750,7 +18778,7 @@ function useSpansWebSocket(options) {
18750
18778
  var PAGE_SIZE = 100;
18751
18779
  var useSpans = () => {
18752
18780
  const api = useAppInspectorApi();
18753
- const { reportDisabled } = useAppInspectorStatus();
18781
+ const { onWsClose, onWsOpen, wsEnabled } = useAppInspectorStatus();
18754
18782
  const [spans, setSpans] = useState9();
18755
18783
  const [fetchError, setFetchError] = useState9();
18756
18784
  const [fetchingForward, setFetchingForward] = useState9(false);
@@ -18801,17 +18829,17 @@ var useSpans = () => {
18801
18829
  const [warningCount, setWarningCount] = useState9();
18802
18830
  const [hasMoreBackward, setHasMoreBackward] = useState9();
18803
18831
  const [hasMoreForward, setHasMoreForward] = useState9();
18804
- const fetchForward = useCallback8(() => {
18832
+ const fetchForward = useCallback7(() => {
18805
18833
  void paginationBufferRef.current.fetchForward();
18806
18834
  }, []);
18807
- const fetchBackward = useCallback8(() => {
18835
+ const fetchBackward = useCallback7(() => {
18808
18836
  void paginationBufferRef.current.fetchBackward();
18809
18837
  }, []);
18810
18838
  useEffect16(() => {
18811
18839
  fetchForward();
18812
18840
  }, [fetchForward]);
18813
18841
  const [clearingSpans, setClearingSpans] = useState9(false);
18814
- const clearSpans = useCallback8(async () => {
18842
+ const clearSpans = useCallback7(async () => {
18815
18843
  if (clearingSpans) {
18816
18844
  return;
18817
18845
  }
@@ -18839,6 +18867,8 @@ var useSpans = () => {
18839
18867
  }
18840
18868
  }, [hasMoreBackward, fetchingBackward, fetchingForward]);
18841
18869
  useSpansWebSocket({
18870
+ enabled: wsEnabled,
18871
+ onClose: onWsClose,
18842
18872
  onMessage: () => {
18843
18873
  if (clearingSpans) {
18844
18874
  return;
@@ -18846,16 +18876,15 @@ var useSpans = () => {
18846
18876
  if (!hasMoreForward) {
18847
18877
  void paginationBufferRef.current.fetchForward();
18848
18878
  }
18879
+ },
18880
+ onOpen: () => {
18881
+ onWsOpen();
18882
+ fetchForward();
18849
18883
  }
18850
18884
  });
18851
- const clearFetchError = useCallback8(() => {
18885
+ const clearFetchError = useCallback7(() => {
18852
18886
  setFetchError(void 0);
18853
18887
  }, []);
18854
- useEffect16(() => {
18855
- if (fetchError instanceof AppInspectorDisabledError || fetchError instanceof ConnectionError) {
18856
- reportDisabled();
18857
- }
18858
- }, [fetchError, reportDisabled]);
18859
18888
  return {
18860
18889
  clearFetchError,
18861
18890
  clearingSpans,
@@ -18881,12 +18910,12 @@ import { ArrowBack } from "@mui/icons-material";
18881
18910
  import { Box as Box19, Button as Button6, Drawer, Paper as Paper3 } from "@mui/material";
18882
18911
  import { styled } from "@mui/material/styles";
18883
18912
  import { ReactFlowProvider } from "@xyflow/react";
18884
- import { useCallback as useCallback11, useEffect as useEffect21, useRef as useRef15, useState as useState17 } from "react";
18913
+ import { useCallback as useCallback10, useEffect as useEffect21, useRef as useRef15, useState as useState17 } from "react";
18885
18914
 
18886
18915
  // src/components/event-details/event-details.tsx
18887
18916
  import { Close as Close2 } from "@mui/icons-material";
18888
18917
  import { Alert as Alert4, Box as Box16, Chip as Chip3, Divider as Divider4, FormControlLabel as FormControlLabel2, IconButton as IconButton4, Stack as Stack3, Switch, Typography as Typography11 } from "@mui/material";
18889
- import { useMemo as useMemo11, useState as useState15 } from "react";
18918
+ import { useMemo as useMemo10, useState as useState15 } from "react";
18890
18919
 
18891
18920
  // src/utils/event-utils.ts
18892
18921
  var iamEventParser = (eventName, attributes) => {
@@ -18999,11 +19028,11 @@ var getEventGroupsByType = (events) => {
18999
19028
  // src/components/event-details/copy-button.tsx
19000
19029
  import { Check, ContentCopy } from "@mui/icons-material";
19001
19030
  import { IconButton as IconButton2, Tooltip as Tooltip5 } from "@mui/material";
19002
- import { useCallback as useCallback9, useState as useState10 } from "react";
19031
+ import { useCallback as useCallback8, useState as useState10 } from "react";
19003
19032
  import { jsx as jsx132 } from "react/jsx-runtime";
19004
19033
  var CopyButton = ({ value }) => {
19005
19034
  const [copied, setCopied] = useState10(false);
19006
- const handleCopy = useCallback9(() => {
19035
+ const handleCopy = useCallback8(() => {
19007
19036
  const text2 = typeof value === "string" ? value : JSON.stringify(value, void 0, 2);
19008
19037
  void navigator.clipboard.writeText(text2).then(() => {
19009
19038
  setCopied(true);
@@ -19027,7 +19056,7 @@ var CopyButton = ({ value }) => {
19027
19056
  // src/components/event-details/event-detail.tsx
19028
19057
  import { KeyboardArrowDown, KeyboardArrowRight } from "@mui/icons-material";
19029
19058
  import { Box as Box13, IconButton as IconButton3, Typography as Typography8 } from "@mui/material";
19030
- import { useEffect as useEffect18, useMemo as useMemo9, useRef as useRef12, useState as useState12 } from "react";
19059
+ import { useEffect as useEffect18, useMemo as useMemo8, useRef as useRef12, useState as useState12 } from "react";
19031
19060
 
19032
19061
  // src/components/status-icon.tsx
19033
19062
  import { Cancel as Cancel2, CheckCircle, Error as Error3, Info, RemoveCircle } from "@mui/icons-material";
@@ -19136,7 +19165,7 @@ var IAMEventDetail = ({ event }) => {
19136
19165
 
19137
19166
  // src/components/event-details/iam-permission-detail.tsx
19138
19167
  import { Box as Box10, Chip as Chip2, Stack, Typography as Typography7 } from "@mui/material";
19139
- import { useMemo as useMemo7 } from "react";
19168
+ import { useMemo as useMemo6 } from "react";
19140
19169
  import { jsx as jsx135, jsxs as jsxs125 } from "react/jsx-runtime";
19141
19170
  var getChipColor = (isAllowed, spanStatusCode) => {
19142
19171
  if (isAllowed) return "success.main";
@@ -19144,7 +19173,7 @@ var getChipColor = (isAllowed, spanStatusCode) => {
19144
19173
  return "warning.main";
19145
19174
  };
19146
19175
  var IAMPermissionItem = ({ event, spanStatusCode }) => {
19147
- const parsedData = useMemo7(() => {
19176
+ const parsedData = useMemo6(() => {
19148
19177
  const payloadString = event.attributes?.payload;
19149
19178
  if (!payloadString) return;
19150
19179
  const parsedIAM2 = parseIAMEvent(payloadString);
@@ -19193,7 +19222,7 @@ import { Box as Box12, useTheme as useTheme3 } from "@mui/material";
19193
19222
  var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
19194
19223
  import { jsx as jsx136, jsxs as jsxs126, Fragment as Fragment8 } from "react/jsx-runtime";
19195
19224
  import { Box as Box11, InputBase, NoSsr, SvgIcon, createTheme, ThemeProvider, Paper as Paper2 } from "@mui/material";
19196
- import { createContext as createContext10, useContext as useContext16, useState as useState11, useRef as useRef11, useCallback as useCallback10, useMemo as useMemo8, useEffect as useEffect17, memo as memo10 } from "react";
19225
+ import { createContext as createContext10, useContext as useContext16, useState as useState11, useRef as useRef11, useCallback as useCallback9, useMemo as useMemo7, useEffect as useEffect17, memo as memo10 } from "react";
19197
19226
  import { create, useStore, createStore } from "zustand";
19198
19227
  function r(e2) {
19199
19228
  var t, f2, n = "";
@@ -19439,7 +19468,7 @@ function useClipboard() {
19439
19468
  let { timeout = 2e3 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
19440
19469
  const [copied, setCopied] = useState11(false);
19441
19470
  const copyTimeout = useRef11(null);
19442
- const handleCopyResult = useCallback10((value) => {
19471
+ const handleCopyResult = useCallback9((value) => {
19443
19472
  const current = copyTimeout.current;
19444
19473
  if (current) {
19445
19474
  window.clearTimeout(current);
@@ -19450,7 +19479,7 @@ function useClipboard() {
19450
19479
  timeout
19451
19480
  ]);
19452
19481
  const onCopy = useJsonViewerStore((store) => store.onCopy);
19453
- const copy = useCallback10(async (path, value) => {
19482
+ const copy = useCallback9(async (path, value) => {
19454
19483
  if (typeof onCopy === "function") {
19455
19484
  try {
19456
19485
  await onCopy(path, value, copyString);
@@ -19471,7 +19500,7 @@ function useClipboard() {
19471
19500
  handleCopyResult,
19472
19501
  onCopy
19473
19502
  ]);
19474
- const reset = useCallback10(() => {
19503
+ const reset = useCallback9(() => {
19475
19504
  setCopied(false);
19476
19505
  if (copyTimeout.current) {
19477
19506
  clearTimeout(copyTimeout.current);
@@ -19485,7 +19514,7 @@ function useClipboard() {
19485
19514
  }
19486
19515
  function useIsCycleReference(path, value) {
19487
19516
  const rootValue = useJsonViewerStore((store) => store.value);
19488
- return useMemo8(() => isCycleReference(rootValue, path, value), [
19517
+ return useMemo7(() => isCycleReference(rootValue, path, value), [
19489
19518
  path,
19490
19519
  value,
19491
19520
  rootValue
@@ -19530,7 +19559,7 @@ function useInspect(path, value, nestedIndex) {
19530
19559
  }
19531
19560
  return isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
19532
19561
  });
19533
- const setInspect = useCallback10((apply) => {
19562
+ const setInspect = useCallback9((apply) => {
19534
19563
  set((oldState) => {
19535
19564
  const newState = typeof apply === "boolean" ? apply : apply(oldState);
19536
19565
  setInspectCache(path, newState, nestedIndex);
@@ -19607,7 +19636,7 @@ function defineEasyType(param) {
19607
19636
  const EasyTypeEditor = (param2) => {
19608
19637
  let { value, setValue, abortEditing, commitEditing } = param2;
19609
19638
  const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
19610
- const handleKeyDown = useCallback10((event) => {
19639
+ const handleKeyDown = useCallback9((event) => {
19611
19640
  if (event.key === "Enter") {
19612
19641
  event.preventDefault();
19613
19642
  commitEditing(value);
@@ -19621,7 +19650,7 @@ function defineEasyType(param) {
19621
19650
  commitEditing,
19622
19651
  value
19623
19652
  ]);
19624
- const handleChange = useCallback10((event) => {
19653
+ const handleChange = useCallback9((event) => {
19625
19654
  setValue(event.target.value);
19626
19655
  }, [
19627
19656
  setValue
@@ -19946,17 +19975,17 @@ function inspectMetadata(value) {
19946
19975
  var PreObjectType = (props) => {
19947
19976
  const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
19948
19977
  const textColor = useTextColor();
19949
- const isArrayLike = useMemo8(() => Array.isArray(props.value) || props.value instanceof Set, [
19978
+ const isArrayLike = useMemo7(() => Array.isArray(props.value) || props.value instanceof Set, [
19950
19979
  props.value
19951
19980
  ]);
19952
- const isEmptyValue = useMemo8(() => getValueSize(props.value) === 0, [
19981
+ const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
19953
19982
  props.value
19954
19983
  ]);
19955
- const sizeOfValue = useMemo8(() => inspectMetadata(props.value), [
19984
+ const sizeOfValue = useMemo7(() => inspectMetadata(props.value), [
19956
19985
  props.value
19957
19986
  ]);
19958
19987
  const displaySize = useJsonViewerStore((store) => store.displaySize);
19959
- const shouldDisplaySize = useMemo8(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
19988
+ const shouldDisplaySize = useMemo7(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
19960
19989
  displaySize,
19961
19990
  props.path,
19962
19991
  props.value
@@ -20004,17 +20033,17 @@ var PreObjectType = (props) => {
20004
20033
  var PostObjectType = (props) => {
20005
20034
  const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
20006
20035
  const textColor = useTextColor();
20007
- const isArrayLike = useMemo8(() => Array.isArray(props.value) || props.value instanceof Set, [
20036
+ const isArrayLike = useMemo7(() => Array.isArray(props.value) || props.value instanceof Set, [
20008
20037
  props.value
20009
20038
  ]);
20010
- const isEmptyValue = useMemo8(() => getValueSize(props.value) === 0, [
20039
+ const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
20011
20040
  props.value
20012
20041
  ]);
20013
- const sizeOfValue = useMemo8(() => inspectMetadata(props.value), [
20042
+ const sizeOfValue = useMemo7(() => inspectMetadata(props.value), [
20014
20043
  props.value
20015
20044
  ]);
20016
20045
  const displaySize = useJsonViewerStore((store) => store.displaySize);
20017
- const shouldDisplaySize = useMemo8(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
20046
+ const shouldDisplaySize = useMemo7(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
20018
20047
  displaySize,
20019
20048
  props.path,
20020
20049
  props.value
@@ -20053,7 +20082,7 @@ var ObjectType = (props) => {
20053
20082
  const isTrap = useIsCycleReference(props.path, props.value);
20054
20083
  const [displayLength, setDisplayLength] = useState11(useJsonViewerStore((store) => store.maxDisplayLength));
20055
20084
  const objectSortKeys = useJsonViewerStore((store) => store.objectSortKeys);
20056
- const elements = useMemo8(() => {
20085
+ const elements = useMemo7(() => {
20057
20086
  if (!props.inspect) {
20058
20087
  return null;
20059
20088
  }
@@ -20214,7 +20243,7 @@ var ObjectType = (props) => {
20214
20243
  const marginLeft = props.inspect ? 0.6 : 0;
20215
20244
  const width = useJsonViewerStore((store) => store.indentWidth);
20216
20245
  const indentWidth = props.inspect ? width - marginLeft : width;
20217
- const isEmptyValue = useMemo8(() => getValueSize(props.value) === 0, [
20246
+ const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
20218
20247
  props.value
20219
20248
  ]);
20220
20249
  if (isEmptyValue) {
@@ -20373,7 +20402,7 @@ function matchTypeComponents(value, path, registry) {
20373
20402
  }
20374
20403
  function useTypeComponents(value, path) {
20375
20404
  const registry = useTypeRegistryStore((store) => store.registry);
20376
- return useMemo8(() => matchTypeComponents(value, path, registry), [
20405
+ return useMemo7(() => matchTypeComponents(value, path, registry), [
20377
20406
  value,
20378
20407
  path,
20379
20408
  registry
@@ -20394,7 +20423,7 @@ var DataKeyPair = (props) => {
20394
20423
  var _props_editable;
20395
20424
  const propsEditable = (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : void 0;
20396
20425
  const storeEditable = useJsonViewerStore((store) => store.editable);
20397
- const editable = useMemo8(() => {
20426
+ const editable = useMemo7(() => {
20398
20427
  if (storeEditable === false) {
20399
20428
  return false;
20400
20429
  }
@@ -20415,7 +20444,7 @@ var DataKeyPair = (props) => {
20415
20444
  const depth = path.length;
20416
20445
  const key = path[depth - 1];
20417
20446
  const hoverPath = useJsonViewerStore((store) => store.hoverPath);
20418
- const isHover = useMemo8(() => {
20447
+ const isHover = useMemo7(() => {
20419
20448
  return hoverPath && path.every((value2, index) => value2 === hoverPath.path[index] && nestedIndex === hoverPath.nestedIndex);
20420
20449
  }, [
20421
20450
  hoverPath,
@@ -20437,7 +20466,7 @@ var DataKeyPair = (props) => {
20437
20466
  const isNumberKey = Number.isInteger(Number(key));
20438
20467
  const storeEnableAdd = useJsonViewerStore((store) => store.enableAdd);
20439
20468
  const onAdd = useJsonViewerStore((store) => store.onAdd);
20440
- const enableAdd = useMemo8(() => {
20469
+ const enableAdd = useMemo7(() => {
20441
20470
  if (!onAdd || nestedIndex !== void 0) return false;
20442
20471
  if (storeEnableAdd === false) {
20443
20472
  return false;
@@ -20462,7 +20491,7 @@ var DataKeyPair = (props) => {
20462
20491
  ]);
20463
20492
  const storeEnableDelete = useJsonViewerStore((store) => store.enableDelete);
20464
20493
  const onDelete = useJsonViewerStore((store) => store.onDelete);
20465
- const enableDelete = useMemo8(() => {
20494
+ const enableDelete = useMemo7(() => {
20466
20495
  if (!onDelete || nestedIndex !== void 0) return false;
20467
20496
  if (isRoot) {
20468
20497
  return false;
@@ -20489,7 +20518,7 @@ var DataKeyPair = (props) => {
20489
20518
  const enableClipboard = useJsonViewerStore((store) => store.enableClipboard);
20490
20519
  const { copy, copied } = useClipboard();
20491
20520
  const highlightUpdates = useJsonViewerStore((store) => store.highlightUpdates);
20492
- const isHighlight = useMemo8(() => {
20521
+ const isHighlight = useMemo7(() => {
20493
20522
  if (!highlightUpdates || prevValue === void 0) return false;
20494
20523
  if (typeof value !== typeof prevValue) {
20495
20524
  return true;
@@ -20534,7 +20563,7 @@ var DataKeyPair = (props) => {
20534
20563
  prevValue,
20535
20564
  value
20536
20565
  ]);
20537
- const startEditing = useCallback10((event) => {
20566
+ const startEditing = useCallback9((event) => {
20538
20567
  event.preventDefault();
20539
20568
  if (serialize) setTempValue(serialize(value));
20540
20569
  setEditing(true);
@@ -20542,14 +20571,14 @@ var DataKeyPair = (props) => {
20542
20571
  serialize,
20543
20572
  value
20544
20573
  ]);
20545
- const abortEditing = useCallback10(() => {
20574
+ const abortEditing = useCallback9(() => {
20546
20575
  setEditing(false);
20547
20576
  setTempValue("");
20548
20577
  }, [
20549
20578
  setEditing,
20550
20579
  setTempValue
20551
20580
  ]);
20552
- const commitEditing = useCallback10((newValue) => {
20581
+ const commitEditing = useCallback9((newValue) => {
20553
20582
  setEditing(false);
20554
20583
  if (!deserialize) return;
20555
20584
  try {
@@ -20563,7 +20592,7 @@ var DataKeyPair = (props) => {
20563
20592
  path,
20564
20593
  value
20565
20594
  ]);
20566
- const actionIcons = useMemo8(() => {
20595
+ const actionIcons = useMemo7(() => {
20567
20596
  if (editing) {
20568
20597
  return /* @__PURE__ */ jsxs126(Fragment8, {
20569
20598
  children: [
@@ -20659,12 +20688,12 @@ var DataKeyPair = (props) => {
20659
20688
  abortEditing,
20660
20689
  commitEditing
20661
20690
  ]);
20662
- const isEmptyValue = useMemo8(() => getValueSize(value) === 0, [
20691
+ const isEmptyValue = useMemo7(() => getValueSize(value) === 0, [
20663
20692
  value
20664
20693
  ]);
20665
20694
  const expandable = !isEmptyValue && !!(PreComponent && PostComponent);
20666
20695
  const KeyRenderer = useJsonViewerStore((store) => store.keyRenderer);
20667
- const downstreamProps = useMemo8(() => ({
20696
+ const downstreamProps = useMemo7(() => ({
20668
20697
  path,
20669
20698
  inspect,
20670
20699
  setInspect,
@@ -20685,7 +20714,7 @@ var DataKeyPair = (props) => {
20685
20714
  sx: {
20686
20715
  userSelect: "text"
20687
20716
  },
20688
- onMouseEnter: useCallback10(() => setHover(path, nestedIndex), [
20717
+ onMouseEnter: useCallback9(() => setHover(path, nestedIndex), [
20689
20718
  setHover,
20690
20719
  path,
20691
20720
  nestedIndex
@@ -20700,7 +20729,7 @@ var DataKeyPair = (props) => {
20700
20729
  letterSpacing: 0.5,
20701
20730
  opacity: 0.8
20702
20731
  },
20703
- onClick: useCallback10((event) => {
20732
+ onClick: useCallback9((event) => {
20704
20733
  if (event.isDefaultPrevented()) {
20705
20734
  return;
20706
20735
  }
@@ -20882,7 +20911,7 @@ var JsonViewerInner = (props) => {
20882
20911
  setState,
20883
20912
  props.theme
20884
20913
  ]);
20885
- const themeCls = useMemo8(() => {
20914
+ const themeCls = useMemo7(() => {
20886
20915
  if (typeof props.theme === "object") return "json-viewer-theme-custom";
20887
20916
  return props.theme === "dark" ? "json-viewer-theme-dark" : "json-viewer-theme-light";
20888
20917
  }, [
@@ -20914,9 +20943,9 @@ var JsonViewerInner = (props) => {
20914
20943
  ]);
20915
20944
  const value = useJsonViewerStore((store) => store.value);
20916
20945
  const prevValue = useJsonViewerStore((store) => store.prevValue);
20917
- const emptyPath = useMemo8(() => [], []);
20946
+ const emptyPath = useMemo7(() => [], []);
20918
20947
  const setHover = useJsonViewerStore((store) => store.setHover);
20919
- const onMouseLeave = useCallback10(() => setHover(null), [
20948
+ const onMouseLeave = useCallback9(() => setHover(null), [
20920
20949
  setHover
20921
20950
  ]);
20922
20951
  return /* @__PURE__ */ jsx136(Paper2, {
@@ -20945,14 +20974,14 @@ var JsonViewer = function JsonViewer2(props) {
20945
20974
  }
20946
20975
  }
20947
20976
  const isAutoDarkTheme = useThemeDetector();
20948
- const themeType = useMemo8(() => {
20977
+ const themeType = useMemo7(() => {
20949
20978
  var _props_theme;
20950
20979
  return props.theme === "auto" ? isAutoDarkTheme ? "dark" : "light" : (_props_theme = props.theme) !== null && _props_theme !== void 0 ? _props_theme : "light";
20951
20980
  }, [
20952
20981
  isAutoDarkTheme,
20953
20982
  props.theme
20954
20983
  ]);
20955
- const theme = useMemo8(() => {
20984
+ const theme = useMemo7(() => {
20956
20985
  const backgroundColor = typeof themeType === "object" ? themeType.base00 : themeType === "dark" ? darkColorspace.base00 : lightColorspace.base00;
20957
20986
  const foregroundColor = typeof themeType === "object" ? themeType.base07 : themeType === "dark" ? darkColorspace.base07 : lightColorspace.base07;
20958
20987
  return createTheme({
@@ -20980,8 +21009,8 @@ var JsonViewer = function JsonViewer2(props) {
20980
21009
  ...props,
20981
21010
  theme: themeType
20982
21011
  };
20983
- const jsonViewerStore = useMemo8(() => createJsonViewerStore(props), []);
20984
- const typeRegistryStore = useMemo8(() => createTypeRegistryStore(), []);
21012
+ const jsonViewerStore = useMemo7(() => createJsonViewerStore(props), []);
21013
+ const typeRegistryStore = useMemo7(() => createTypeRegistryStore(), []);
20985
21014
  return /* @__PURE__ */ jsx136(ThemeProvider, {
20986
21015
  theme,
20987
21016
  children: /* @__PURE__ */ jsx136(TypeRegistryStoreContext.Provider, {
@@ -21034,8 +21063,8 @@ var EventMessage = ({ event }) => {
21034
21063
  const [isOpen, setIsOpen] = useState12(false);
21035
21064
  const [isOverflowing, setIsOverflowing] = useState12(false);
21036
21065
  const textReference = useRef12(null);
21037
- const parsedMessage = useMemo9(() => parseEventMessage(event), [event]);
21038
- const isIAMPolicyEvent = useMemo9(
21066
+ const parsedMessage = useMemo8(() => parseEventMessage(event), [event]);
21067
+ const isIAMPolicyEvent = useMemo8(
21039
21068
  () => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
21040
21069
  [event]
21041
21070
  );
@@ -21052,11 +21081,11 @@ var EventMessage = ({ event }) => {
21052
21081
  window.removeEventListener("resize", checkOverflow);
21053
21082
  };
21054
21083
  }, [parsedMessage.headline]);
21055
- const hasAdditionalContent = useMemo9(
21084
+ const hasAdditionalContent = useMemo8(
21056
21085
  () => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
21057
21086
  [parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
21058
21087
  );
21059
- const shouldShowToggle = useMemo9(
21088
+ const shouldShowToggle = useMemo8(
21060
21089
  () => isOverflowing || hasAdditionalContent,
21061
21090
  [isOverflowing, hasAdditionalContent]
21062
21091
  );
@@ -31095,9 +31124,9 @@ var QueryStatus = {
31095
31124
 
31096
31125
  // src/components/event-details/lambda-invoke-logs-section.tsx
31097
31126
  import { Box as Box14, CircularProgress as CircularProgress3, Stack as Stack2, Typography as Typography9 } from "@mui/material";
31098
- import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef13, useState as useState13 } from "react";
31127
+ import { useEffect as useEffect19, useMemo as useMemo9, useRef as useRef13, useState as useState13 } from "react";
31099
31128
  import { jsx as jsx139, jsxs as jsxs128 } from "react/jsx-runtime";
31100
- var POLL_INTERVAL_MS = 1e3;
31129
+ var POLL_INTERVAL_MS2 = 1e3;
31101
31130
  async function pollQueryResults(client, queryId) {
31102
31131
  return client.send(new GetQueryResultsCommand({ queryId }));
31103
31132
  }
@@ -31113,7 +31142,7 @@ async function startLambdaLogsQuery(client, functionName2, requestId, startTimeS
31113
31142
  }
31114
31143
  function useCloudWatchLogsClient(region) {
31115
31144
  const { localstackEndpoint } = useAppInspector();
31116
- const client = useMemo10(() => new CloudWatchLogsClient({
31145
+ const client = useMemo9(() => new CloudWatchLogsClient({
31117
31146
  credentials: {
31118
31147
  accessKeyId: "test",
31119
31148
  secretAccessKey: "test"
@@ -31158,7 +31187,7 @@ function useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, en
31158
31187
  setError(new Error(`Query ended with status: ${status}`));
31159
31188
  setLoading(false);
31160
31189
  } else {
31161
- pollTimerRef.current = setTimeout(() => void poll(), POLL_INTERVAL_MS);
31190
+ pollTimerRef.current = setTimeout(() => void poll(), POLL_INTERVAL_MS2);
31162
31191
  }
31163
31192
  } catch (error_) {
31164
31193
  if (!cancelled) {
@@ -31263,7 +31292,7 @@ var checkIsSqsSendMessage = (span) => {
31263
31292
  return span.operation_name.startsWith("SendMessage");
31264
31293
  };
31265
31294
  var EventDetails = ({ onClose, selectedEvent }) => {
31266
- const eventGroups = useMemo11(
31295
+ const eventGroups = useMemo10(
31267
31296
  () => getEventGroupsByType(selectedEvent?.events ?? []),
31268
31297
  [selectedEvent?.events]
31269
31298
  );
@@ -31495,7 +31524,7 @@ import { Box as Box17, Divider as Divider5, Stack as Stack4, Tooltip as Tooltip6
31495
31524
  import { Handle, Position } from "@xyflow/react";
31496
31525
  import "@xyflow/react/dist/style.css";
31497
31526
  import "react";
31498
- import { memo as memo12, useMemo as useMemo12, useRef as useRef14, useState as useState16 } from "react";
31527
+ import { memo as memo12, useMemo as useMemo11, useRef as useRef14, useState as useState16 } from "react";
31499
31528
  import { Fragment as Fragment11, jsx as jsx142, jsxs as jsxs131 } from "react/jsx-runtime";
31500
31529
  var handleStyle = {
31501
31530
  backgroundColor: "white",
@@ -31583,7 +31612,7 @@ var ServiceNode = memo12(({ data, selected }) => {
31583
31612
  const [isHovered, setIsHovered] = useState16(false);
31584
31613
  const nodeRef = useRef14(null);
31585
31614
  const isError = data.event.status_code === 2;
31586
- const hasPermissionEvents = useMemo12(
31615
+ const hasPermissionEvents = useMemo11(
31587
31616
  () => data.event.events.some(
31588
31617
  (event) => event.event_type === "iam.policy_evaluation" && event.name === "iam.policy.denied"
31589
31618
  ),
@@ -31931,7 +31960,7 @@ var TraceGraph = ({
31931
31960
  };
31932
31961
 
31933
31962
  // src/pages/trace-graph-page.tsx
31934
- import { Fragment as Fragment13, jsx as jsx145, jsxs as jsxs134 } from "react/jsx-runtime";
31963
+ import { jsx as jsx145, jsxs as jsxs134 } from "react/jsx-runtime";
31935
31964
  var HEADER_HEIGHT = 56;
31936
31965
  var DRAWER_WIDTH = "35%";
31937
31966
  var Main = styled("main", { shouldForwardProp: (property) => property !== "open" })(({ open, theme }) => ({
@@ -31966,90 +31995,75 @@ var TraceGraphView = ({
31966
31995
  fetchError,
31967
31996
  fetchSpans,
31968
31997
  handleClose,
31969
- handleEnable,
31970
31998
  handleEventSelect,
31971
- handleRetry,
31972
31999
  loading,
31973
32000
  navigateToSpansList,
31974
32001
  open,
31975
32002
  selectedEvent,
31976
32003
  spanId,
31977
32004
  spans,
31978
- status,
31979
- statusError,
31980
32005
  traceId
31981
- }) => {
31982
- const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
31983
- return /* @__PURE__ */ jsxs134(
31984
- Box19,
31985
- {
31986
- "data-testid": TRACE_GRAPH_PAGE_TEST_ID,
31987
- sx: {
31988
- alignItems: "center",
31989
- display: "flex",
31990
- flexDirection: "column",
31991
- flexGrow: 1,
31992
- gap: 2,
31993
- overflow: "hidden"
31994
- },
31995
- children: [
31996
- /* @__PURE__ */ jsxs134(Box19, { sx: { display: "flex", width: "100%" }, children: [
31997
- /* @__PURE__ */ jsx145(Button6, { onClick: () => {
31998
- navigateToSpansList();
31999
- }, startIcon: /* @__PURE__ */ jsx145(ArrowBack, {}), children: "Go back" }),
32000
- /* @__PURE__ */ jsx145(Box19, { sx: { flexGrow: 1 } })
32001
- ] }),
32002
- /* @__PURE__ */ jsx145(
32003
- Paper3,
32004
- {
32005
- sx: {
32006
- display: "flex",
32007
- flexGrow: 1,
32008
- overflow: "hidden",
32009
- position: "relative",
32010
- width: "100%"
32011
- },
32012
- children: shouldShowStatusMessage ? /* @__PURE__ */ jsx145(
32013
- StatusMessage,
32006
+ }) => /* @__PURE__ */ jsxs134(
32007
+ Box19,
32008
+ {
32009
+ "data-testid": TRACE_GRAPH_PAGE_TEST_ID,
32010
+ sx: {
32011
+ alignItems: "center",
32012
+ display: "flex",
32013
+ flexDirection: "column",
32014
+ flexGrow: 1,
32015
+ gap: 2,
32016
+ overflow: "hidden"
32017
+ },
32018
+ children: [
32019
+ /* @__PURE__ */ jsxs134(Box19, { sx: { display: "flex", width: "100%" }, children: [
32020
+ /* @__PURE__ */ jsx145(Button6, { onClick: () => {
32021
+ navigateToSpansList();
32022
+ }, startIcon: /* @__PURE__ */ jsx145(ArrowBack, {}), children: "Go back" }),
32023
+ /* @__PURE__ */ jsx145(Box19, { sx: { flexGrow: 1 } })
32024
+ ] }),
32025
+ /* @__PURE__ */ jsxs134(
32026
+ Paper3,
32027
+ {
32028
+ sx: {
32029
+ display: "flex",
32030
+ flexGrow: 1,
32031
+ overflow: "hidden",
32032
+ position: "relative",
32033
+ width: "100%"
32034
+ },
32035
+ children: [
32036
+ /* @__PURE__ */ jsx145(Main, { open, children: /* @__PURE__ */ jsx145(
32037
+ Box19,
32014
32038
  {
32015
- error: statusError,
32016
- onEnable: handleEnable,
32017
- onRetry: handleRetry,
32018
- status
32019
- }
32020
- ) : /* @__PURE__ */ jsxs134(Fragment13, { children: [
32021
- /* @__PURE__ */ jsx145(Main, { open, children: /* @__PURE__ */ jsx145(
32022
- Box19,
32023
- {
32024
- sx: {
32025
- height: "100%",
32026
- overflow: "auto"
32027
- },
32028
- children: traceId !== void 0 && /* @__PURE__ */ jsx145(ReactFlowProvider, { children: /* @__PURE__ */ jsx145(
32029
- TraceGraph,
32030
- {
32031
- initialFocusEventId: spanId,
32032
- onEventSelect: handleEventSelect,
32033
- onRefresh: () => {
32034
- fetchSpans();
32035
- },
32036
- spans: {
32037
- data: spans,
32038
- error: fetchError,
32039
- loading
32040
- }
32039
+ sx: {
32040
+ height: "100%",
32041
+ overflow: "auto"
32042
+ },
32043
+ children: traceId !== void 0 && /* @__PURE__ */ jsx145(ReactFlowProvider, { children: /* @__PURE__ */ jsx145(
32044
+ TraceGraph,
32045
+ {
32046
+ initialFocusEventId: spanId,
32047
+ onEventSelect: handleEventSelect,
32048
+ onRefresh: () => {
32049
+ fetchSpans();
32050
+ },
32051
+ spans: {
32052
+ data: spans,
32053
+ error: fetchError,
32054
+ loading
32041
32055
  }
32042
- ) })
32043
- }
32044
- ) }),
32045
- /* @__PURE__ */ jsx145(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ jsx145(EventDetails, { onClose: handleClose, selectedEvent }) })
32046
- ] })
32047
- }
32048
- )
32049
- ]
32050
- }
32051
- );
32052
- };
32056
+ }
32057
+ ) })
32058
+ }
32059
+ ) }),
32060
+ /* @__PURE__ */ jsx145(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ jsx145(EventDetails, { onClose: handleClose, selectedEvent }) })
32061
+ ]
32062
+ }
32063
+ )
32064
+ ]
32065
+ }
32066
+ );
32053
32067
  async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32054
32068
  const newTraceIds = traceIds.filter((id2) => !processedTraceIds.has(id2));
32055
32069
  if (newTraceIds.length === 0) {
@@ -32089,7 +32103,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32089
32103
  const [spans, setSpans] = useState17();
32090
32104
  const [loading, setLoading] = useState17(false);
32091
32105
  const [fetchError, setFetchError] = useState17();
32092
- const fetchSpans = useCallback11(async () => {
32106
+ const fetchSpans = useCallback10(async () => {
32093
32107
  setLoading(true);
32094
32108
  try {
32095
32109
  const spans2 = await fetchConnectedTraces(api, [traceId]);
@@ -32114,25 +32128,12 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32114
32128
  spansReference.current = spans;
32115
32129
  }
32116
32130
  }, [spans, setSelectedEvent, spanId]);
32117
- const { checkStatus, reportDisabled, status, statusError } = useAppInspectorStatus();
32118
- useEffect21(() => {
32119
- if (fetchError instanceof AppInspectorDisabledError || fetchError instanceof ConnectionError) {
32120
- reportDisabled();
32121
- }
32122
- }, [fetchError, reportDisabled]);
32123
- const handleEnable = useCallback11(async () => {
32124
- await api.setStatus({ status: "ENABLED" });
32125
- void checkStatus();
32126
- }, [api, checkStatus]);
32127
- const handleEventSelect = useCallback11((spanId2) => {
32131
+ const handleEventSelect = useCallback10((spanId2) => {
32128
32132
  const span = spans?.find((s) => s.span_id === spanId2);
32129
32133
  setSelectedEvent(span);
32130
32134
  setOpen(true);
32131
32135
  }, [spans]);
32132
- const handleRetry = useCallback11(() => {
32133
- void checkStatus();
32134
- }, [checkStatus]);
32135
- const navigateToSpansList = useCallback11(() => {
32136
+ const navigateToSpansList = useCallback10(() => {
32136
32137
  onClose?.();
32137
32138
  }, [onClose]);
32138
32139
  return /* @__PURE__ */ jsx145(
@@ -32143,24 +32144,20 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32143
32144
  handleClose: () => {
32144
32145
  setOpen(false);
32145
32146
  },
32146
- handleEnable,
32147
32147
  handleEventSelect,
32148
- handleRetry,
32149
32148
  loading,
32150
32149
  navigateToSpansList,
32151
32150
  open,
32152
32151
  selectedEvent,
32153
32152
  spanId: spanId ?? void 0,
32154
32153
  spans,
32155
- status,
32156
- statusError,
32157
32154
  traceId
32158
32155
  }
32159
32156
  );
32160
32157
  };
32161
32158
 
32162
32159
  // src/pages/spans-list-page.tsx
32163
- import { Fragment as Fragment14, jsx as jsx146, jsxs as jsxs135 } from "react/jsx-runtime";
32160
+ import { Fragment as Fragment13, jsx as jsx146, jsxs as jsxs135 } from "react/jsx-runtime";
32164
32161
  var SpansListPage = () => {
32165
32162
  const api = useAppInspectorApi();
32166
32163
  const {
@@ -32180,8 +32177,8 @@ var SpansListPage = () => {
32180
32177
  totalCount,
32181
32178
  warningCount
32182
32179
  } = useSpans();
32183
- const { checking, checkStatus, status, statusError } = useAppInspectorStatus();
32184
- const clearSpansSync = useCallback12(() => {
32180
+ const { checkStatus, phase, status, statusError } = useAppInspectorStatus();
32181
+ const clearSpansSync = useCallback11(() => {
32185
32182
  void clearSpans();
32186
32183
  }, [clearSpans]);
32187
32184
  const localstackVersion = status?.localstackVersion ?? (statusError instanceof AppInspectorNotFoundError ? statusError.localstackVersion : void 0);
@@ -32190,18 +32187,18 @@ var SpansListPage = () => {
32190
32187
  const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
32191
32188
  const [selectedTraceId, setSelectedTraceId] = useState18();
32192
32189
  const [selectedSpanId, setSelectedSpanId] = useState18();
32193
- const navigateToSpan = useCallback12((span) => {
32190
+ const navigateToSpan = useCallback11((span) => {
32194
32191
  setSelectedTraceId(span.trace_id);
32195
32192
  setSelectedSpanId(span.span_id);
32196
32193
  }, []);
32197
- const handleRetry = useCallback12(() => {
32198
- void checkStatus();
32194
+ const handleRetry = useCallback11(() => {
32195
+ checkStatus();
32199
32196
  fetchForward();
32200
32197
  }, [checkStatus, fetchForward]);
32201
- const handleEnable = useCallback12(async () => {
32198
+ const handleEnable = useCallback11(async () => {
32202
32199
  await api.setStatus({ status: "ENABLED" });
32203
32200
  clearFetchError();
32204
- void checkStatus();
32201
+ checkStatus();
32205
32202
  }, [api, checkStatus, clearFetchError]);
32206
32203
  const isDelayedRefetchRef = useRef16(false);
32207
32204
  const delayedRefetchTimerRef = useRef16();
@@ -32224,29 +32221,44 @@ var SpansListPage = () => {
32224
32221
  clearTimeout(delayedRefetchTimerRef.current);
32225
32222
  };
32226
32223
  }, [fetchingForward, fetchForward]);
32227
- const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
32228
- if (versionCompatibility === "below-minimum") {
32229
- return /* @__PURE__ */ jsx146(
32230
- StatusMessage,
32231
- {
32232
- localstackVersion,
32233
- onRetry: handleRetry
32234
- }
32235
- );
32236
- }
32237
- if (shouldShowStatusMessage) {
32238
- return /* @__PURE__ */ jsx146(
32239
- StatusMessage,
32240
- {
32241
- error: statusError,
32242
- localstackVersion,
32243
- onEnable: handleEnable,
32244
- onRetry: handleRetry,
32245
- status
32246
- }
32247
- );
32224
+ switch (phase) {
32225
+ case "CHECKING_STATUS":
32226
+ case "CONNECTING_WS": {
32227
+ return /* @__PURE__ */ jsx146(StatusMessage, { phase });
32228
+ }
32229
+ case "DISABLED": {
32230
+ return /* @__PURE__ */ jsx146(
32231
+ StatusMessage,
32232
+ {
32233
+ onEnable: handleEnable,
32234
+ phase
32235
+ }
32236
+ );
32237
+ }
32238
+ case "INCOMPATIBLE": {
32239
+ return /* @__PURE__ */ jsx146(
32240
+ StatusMessage,
32241
+ {
32242
+ localstackVersion,
32243
+ onRetry: handleRetry,
32244
+ phase
32245
+ }
32246
+ );
32247
+ }
32248
+ case "LIVE": {
32249
+ break;
32250
+ }
32251
+ case "UNREACHABLE": {
32252
+ return /* @__PURE__ */ jsx146(
32253
+ StatusMessage,
32254
+ {
32255
+ onRetry: handleRetry,
32256
+ phase
32257
+ }
32258
+ );
32259
+ }
32248
32260
  }
32249
- return /* @__PURE__ */ jsxs135(Fragment14, { children: [
32261
+ return /* @__PURE__ */ jsxs135(Fragment13, { children: [
32250
32262
  /* @__PURE__ */ jsxs135(
32251
32263
  Box20,
32252
32264
  {
@@ -32263,7 +32275,7 @@ var SpansListPage = () => {
32263
32275
  width: "100%"
32264
32276
  },
32265
32277
  children: [
32266
- !checking && /* @__PURE__ */ jsx146(
32278
+ /* @__PURE__ */ jsx146(
32267
32279
  EmulatorVersionBanner,
32268
32280
  {
32269
32281
  compatibility: bannerDismissed && versionCompatibility === "warning" ? "ok" : versionCompatibility,