@localstack/appinspector-ui 1.0.89 → 1.0.91

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.cjs CHANGED
@@ -26515,12 +26515,13 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26515
26515
  requestPayload.MessageBody = tryParseJson(requestPayload.MessageBody);
26516
26516
  }
26517
26517
  }
26518
+ const isResponseSuppressed = selectedEvent.attributes?.["localstack.aws.service.response_suppressed"] === true;
26518
26519
  const responsePayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.response"]);
26519
26520
  if (parseNestedJson && isLambdaInvoke && responsePayload && typeof responsePayload === "object" && "Payload" in responsePayload) {
26520
26521
  responsePayload.Payload = tryParseJson(responsePayload.Payload);
26521
26522
  }
26522
26523
  const exceptionPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.exception"]);
26523
- const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0;
26524
+ const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0 || isResponseSuppressed;
26524
26525
  const duration = selectedEvent.end_time_unix_nano ? ((BigInt(selectedEvent.end_time_unix_nano) - BigInt(selectedEvent.start_time_unix_nano)) / BigInt("1000000")).toString() : void 0;
26525
26526
  return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material15.Box, { "data-testid": EVENT_DETAILS_TEST_ID, sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
26526
26527
  /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
@@ -26626,9 +26627,9 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26626
26627
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Request" }),
26627
26628
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(PayloadViewer, { testId: EVENT_DETAILS_REQUEST_PAYLOAD, value: requestPayload })
26628
26629
  ] }),
26629
- responsePayload !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material15.Box, { children: [
26630
+ (responsePayload !== void 0 || isResponseSuppressed) && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material15.Box, { children: [
26630
26631
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Response" }),
26631
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(PayloadViewer, { testId: EVENT_DETAILS_RESPONSE_PAYLOAD_TEST_ID, value: responsePayload })
26632
+ isResponseSuppressed ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Box, { sx: { py: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Alert, { severity: "warning", sx: { mb: 1 }, children: "Response payload is available \u2014 upgrade your license to view" }) }) : /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(PayloadViewer, { testId: EVENT_DETAILS_RESPONSE_PAYLOAD_TEST_ID, value: responsePayload })
26632
26633
  ] }),
26633
26634
  exceptionPayload !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material15.Box, { children: [
26634
26635
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Exception" }),
@@ -26672,7 +26673,7 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26672
26673
  };
26673
26674
  var PayloadViewer = (0, import_react56.memo)(({ testId, value }) => {
26674
26675
  const theme = (0, import_material15.useTheme)();
26675
- return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Box, { "data-testid": testId, sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
26676
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Box, { "data-testid": testId, sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", py: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
26676
26677
  JsonViewer,
26677
26678
  {
26678
26679
  displayDataTypes: false,
@@ -26841,19 +26842,44 @@ var ServiceNode = (0, import_react59.memo)(({ data, selected }) => {
26841
26842
 
26842
26843
  // src/components/trace-graph/utils.ts
26843
26844
  var import_dagre = __toESM(require("@dagrejs/dagre"), 1);
26844
- var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
26845
+ var getLayoutedNodesAndEdges = (inputNodes, inputEdges, order2 = "oldest_first") => {
26845
26846
  const dagreGraph = new import_dagre.default.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
26846
26847
  const direction = "LR";
26847
26848
  const nodeWidth = 200;
26848
26849
  const nodeHeight = 70;
26849
26850
  dagreGraph.setGraph({ rankdir: direction });
26851
+ const timestampMap = new Map(
26852
+ inputNodes.map((n2) => [n2.id, n2.data.event.start_time_unix_nano])
26853
+ );
26850
26854
  for (const node of inputNodes) {
26851
26855
  dagreGraph.setNode(node.id, { height: nodeHeight, width: nodeWidth });
26852
26856
  }
26853
26857
  for (const edge of inputEdges) {
26854
26858
  dagreGraph.setEdge(edge.source, edge.target);
26855
26859
  }
26856
- import_dagre.default.layout(dagreGraph);
26860
+ import_dagre.default.layout(dagreGraph, {
26861
+ customOrder: (g2) => {
26862
+ const rankMap = /* @__PURE__ */ new Map();
26863
+ for (const nodeId of g2.nodes()) {
26864
+ const rank = g2.node(nodeId).rank;
26865
+ if (rank === void 0) continue;
26866
+ const group4 = rankMap.get(rank) ?? [];
26867
+ group4.push(nodeId);
26868
+ rankMap.set(rank, group4);
26869
+ }
26870
+ for (const nodeIds of rankMap.values()) {
26871
+ nodeIds.sort((a3, b3) => {
26872
+ const tsA = timestampMap.get(a3) ?? "";
26873
+ const tsB = timestampMap.get(b3) ?? "";
26874
+ return order2 === "newest_first" ? tsB.localeCompare(tsA) : tsA.localeCompare(tsB);
26875
+ });
26876
+ for (const [index, nodeId] of nodeIds.entries()) {
26877
+ ;
26878
+ g2.node(nodeId).order = index;
26879
+ }
26880
+ }
26881
+ }
26882
+ });
26857
26883
  const layoutedNodes = inputNodes.map((node) => {
26858
26884
  const nodeWithPosition = dagreGraph.node(node.id);
26859
26885
  return {
@@ -26949,6 +26975,7 @@ var TraceGraph = ({
26949
26975
  initialFocusEventId,
26950
26976
  onEventSelect,
26951
26977
  onRefresh,
26978
+ order: order2 = "oldest_first",
26952
26979
  spans
26953
26980
  }) => {
26954
26981
  const [nodes, setNodes, onNodesChange] = (0, import_react62.useNodesState)([]);
@@ -26994,7 +27021,7 @@ var TraceGraph = ({
26994
27021
  });
26995
27022
  }
26996
27023
  }
26997
- const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
27024
+ const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges, order2);
26998
27025
  for (const node of layoutedNodes) {
26999
27026
  if (node.id === initialFocusEventId) {
27000
27027
  node.selected = true;
@@ -27002,7 +27029,7 @@ var TraceGraph = ({
27002
27029
  }
27003
27030
  setNodes(layoutedNodes);
27004
27031
  setEdges(layoutedEdges);
27005
- }, [spans.data, initialFocusEventId, setNodes, setEdges]);
27032
+ }, [spans.data, initialFocusEventId, order2, setNodes, setEdges]);
27006
27033
  const theme = (0, import_material19.useTheme)();
27007
27034
  return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
27008
27035
  spans.error && /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
@@ -27093,6 +27120,7 @@ var TraceGraphView = ({
27093
27120
  loading,
27094
27121
  navigateToSpansList,
27095
27122
  open,
27123
+ order: order2,
27096
27124
  selectedEvent,
27097
27125
  spanId,
27098
27126
  spans,
@@ -27154,6 +27182,7 @@ var TraceGraphView = ({
27154
27182
  onRefresh: () => {
27155
27183
  fetchSpans();
27156
27184
  },
27185
+ order: order2,
27157
27186
  spans: {
27158
27187
  data: spans,
27159
27188
  error: fetchError,
@@ -27205,7 +27234,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
27205
27234
  }
27206
27235
  return [...allSpans.values()];
27207
27236
  }
27208
- var TraceGraphPage = ({ onClose, spanId, traceId }) => {
27237
+ var TraceGraphPage = ({ onClose, order: order2 = "oldest_first", spanId, traceId }) => {
27209
27238
  const api = useAppInspectorApi();
27210
27239
  const [spans, setSpans] = (0, import_react65.useState)();
27211
27240
  const [loading, setLoading] = (0, import_react65.useState)(false);
@@ -27265,6 +27294,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
27265
27294
  loading,
27266
27295
  navigateToSpansList,
27267
27296
  open,
27297
+ order: order2,
27268
27298
  selectedEvent,
27269
27299
  spanId: spanId ?? void 0,
27270
27300
  spans,
@@ -27368,7 +27398,7 @@ var SpansListPage = () => {
27368
27398
  ),
27369
27399
  selectedTraceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(TraceGraphPage, { onClose: () => {
27370
27400
  setSelectedTraceId(void 0);
27371
- }, spanId: selectedSpanId, traceId: selectedTraceId })
27401
+ }, order: order2, spanId: selectedSpanId, traceId: selectedTraceId })
27372
27402
  ] });
27373
27403
  };
27374
27404