@localstack/appinspector-ui 1.0.145 → 1.0.147

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
@@ -15128,7 +15128,7 @@ var ICONS_MAP = {
15128
15128
  };
15129
15129
  var AwsServiceIconBase = memo5((props) => {
15130
15130
  const Icon = ICONS_MAP[props.service];
15131
- return Icon ? /* @__PURE__ */ jsx121(Icon, { ...props }) : void 0;
15131
+ return Icon ? /* @__PURE__ */ jsx121(Icon, { ...props }) : null;
15132
15132
  });
15133
15133
  var supportedServiceNames = Object.keys(ICONS_MAP);
15134
15134
 
@@ -16659,17 +16659,6 @@ import { useCallback as useCallback5, useMemo as useMemo5 } from "react";
16659
16659
  // src/api/client.ts
16660
16660
  var import_semver2 = __toESM(require_semver2(), 1);
16661
16661
 
16662
- // src/utils/time.ts
16663
- function unixNanoToDate(unixNanoString) {
16664
- const milliseconds = unixNanoToMilliseconds(unixNanoString);
16665
- if (!milliseconds) return void 0;
16666
- return new Date(milliseconds);
16667
- }
16668
- function unixNanoToMilliseconds(unixNanoString) {
16669
- if (!unixNanoString) return void 0;
16670
- return Number(BigInt(unixNanoString) / BigInt("1000000"));
16671
- }
16672
-
16673
16662
  // src/constants/error-messages.ts
16674
16663
  var ERROR_MESSAGES = {
16675
16664
  APP_INSPECTOR_DISABLED: "App Inspector is currently disabled.",
@@ -16723,6 +16712,17 @@ var createScopedLogger = (scope) => ({
16723
16712
  }
16724
16713
  });
16725
16714
 
16715
+ // src/utils/time.ts
16716
+ function unixNanoToDate(unixNanoString) {
16717
+ const milliseconds = unixNanoToMilliseconds(unixNanoString);
16718
+ if (!milliseconds) return void 0;
16719
+ return new Date(milliseconds);
16720
+ }
16721
+ function unixNanoToMilliseconds(unixNanoString) {
16722
+ if (!unixNanoString) return void 0;
16723
+ return Number(BigInt(unixNanoString) / BigInt("1000000"));
16724
+ }
16725
+
16726
16726
  // src/api/client.ts
16727
16727
  var apiLogger = createScopedLogger("API");
16728
16728
  var analyticsLogger = createScopedLogger("ANALYTICS");
@@ -32082,10 +32082,17 @@ var TraceGraph = ({
32082
32082
  });
32083
32083
  }
32084
32084
  }
32085
+ allNodes.sort((a3, b3) => {
32086
+ const tsA = a3.data.event.start_time_unix_nano;
32087
+ const tsB = b3.data.event.start_time_unix_nano;
32088
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32089
+ });
32085
32090
  const knownSpanIds = new Set(allNodes.map((node) => node.id));
32086
- const validEdges = allEdges.filter(
32087
- (edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)
32088
- );
32091
+ const validEdges = allEdges.filter((edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)).toSorted((edgeA, edgeB) => {
32092
+ const tsA = allNodes.find((n) => n.id === edgeA.target)?.data.event.start_time_unix_nano ?? "";
32093
+ const tsB = allNodes.find((n) => n.id === edgeB.target)?.data.event.start_time_unix_nano ?? "";
32094
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32095
+ });
32089
32096
  const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, validEdges);
32090
32097
  for (const node of layoutedNodes) {
32091
32098
  if (node.id === initialFocusEventId) {
@@ -32248,7 +32255,14 @@ var TraceGraphView = ({
32248
32255
  ]
32249
32256
  }
32250
32257
  );
32251
- async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32258
+ async function fetchConnectedTraces(api, traceId) {
32259
+ const response = await api.getSpans({ trace_id: traceId, with_span_links: true });
32260
+ if (response.with_span_links) {
32261
+ return response.spans;
32262
+ }
32263
+ return fetchConnectedTracesWaterfall(api, [traceId]);
32264
+ }
32265
+ async function fetchConnectedTracesWaterfall(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32252
32266
  const newTraceIds = traceIds.filter((id2) => !processedTraceIds.has(id2));
32253
32267
  if (newTraceIds.length === 0) {
32254
32268
  return [...allSpans.values()];
@@ -32273,7 +32287,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
32273
32287
  }
32274
32288
  }
32275
32289
  if (discoveredTraceIds.size > 0) {
32276
- return fetchConnectedTraces(
32290
+ return fetchConnectedTracesWaterfall(
32277
32291
  api,
32278
32292
  [...discoveredTraceIds],
32279
32293
  allSpans,
@@ -32291,7 +32305,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32291
32305
  const fetchSpans = useCallback10(async () => {
32292
32306
  setLoading(true);
32293
32307
  try {
32294
- const spans2 = await fetchConnectedTraces(api, [traceId]);
32308
+ const spans2 = await fetchConnectedTraces(api, traceId);
32295
32309
  setSpans(spans2);
32296
32310
  setFetchError(void 0);
32297
32311
  } catch (error) {