adonisjs-server-stats 1.9.0 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/README.md +23 -14
  2. package/dist/core/config-utils.d.ts +8 -0
  3. package/dist/core/constants.d.ts +4 -0
  4. package/dist/core/dashboard-data-controller.d.ts +16 -0
  5. package/dist/core/dashboard-data-helpers.d.ts +12 -0
  6. package/dist/core/debug-data-controller.d.ts +4 -0
  7. package/dist/core/define-config-helpers.d.ts +25 -0
  8. package/dist/core/feature-detect-helpers.d.ts +36 -0
  9. package/dist/core/formatters-helpers.d.ts +23 -0
  10. package/dist/core/index.js +596 -509
  11. package/dist/core/log-utils-helpers.d.ts +13 -0
  12. package/dist/core/metrics.d.ts +3 -28
  13. package/dist/core/pagination.d.ts +0 -9
  14. package/dist/core/server-stats-controller.d.ts +6 -0
  15. package/dist/core/split-pane.d.ts +18 -0
  16. package/dist/core/trace-utils.d.ts +5 -0
  17. package/dist/core/transmit-helpers.d.ts +7 -0
  18. package/dist/core/types-dashboard.d.ts +178 -0
  19. package/dist/core/types-diagnostics.d.ts +85 -0
  20. package/dist/core/types.d.ts +11 -443
  21. package/dist/react/{CacheSection-xH75hwXu.js → CacheSection-baMZotSn.js} +2 -2
  22. package/dist/react/CacheTab-2cw_rMzj.js +117 -0
  23. package/dist/react/{ConfigSection-D8BO1Ry9.js → ConfigSection-DGgqjAal.js} +1 -1
  24. package/dist/react/{ConfigTab-CcN-tfjv.js → ConfigTab-H3OnYqmK.js} +1 -1
  25. package/dist/react/CustomPaneTab-B6r7ha0u.js +98 -0
  26. package/dist/react/{EmailsSection-BzlsTdPs.js → EmailsSection-C-UZISG-.js} +2 -2
  27. package/dist/react/EmailsTab-DbK4Eobn.js +139 -0
  28. package/dist/react/{EventsSection-CGQWiIdV.js → EventsSection-C7RQW_LY.js} +2 -2
  29. package/dist/react/EventsTab-CfVr7AiM.js +57 -0
  30. package/dist/react/{FilterBar-DQRXpWrb.js → FilterBar-CQ7bD669.js} +15 -15
  31. package/dist/react/{JobsSection-D7AHQmZi.js → JobsSection-CQHNK_Ls.js} +2 -2
  32. package/dist/react/{JobsTab-B3Lfdqed.js → JobsTab-znzf6jzk.js} +54 -42
  33. package/dist/react/{LogsSection-Cly1dpvS.js → LogsSection-Dmm3rE2B.js} +9 -3
  34. package/dist/react/LogsTab-D8unMV5P.js +108 -0
  35. package/dist/react/{OverviewSection-CkBGFEWq.js → OverviewSection-ABP9ueBo.js} +1 -1
  36. package/dist/react/{QueriesSection-CfCpnNUD.js → QueriesSection-CnmSkznA.js} +2 -2
  37. package/dist/react/{QueriesTab-DbBmAqzO.js → QueriesTab-BQzcxEiW.js} +37 -40
  38. package/dist/react/RelatedLogs-3A8RuGKH.js +52 -0
  39. package/dist/react/RequestsSection-kW79_M7k.js +341 -0
  40. package/dist/react/{RoutesSection-CRqF-cNM.js → RoutesSection-BRhxrtjZ.js} +2 -2
  41. package/dist/react/RoutesTab-CpYH5lUw.js +68 -0
  42. package/dist/react/TimelineTab-DjLR35Ce.js +214 -0
  43. package/dist/react/index-CsImORX6.js +1121 -0
  44. package/dist/react/index.js +1 -1
  45. package/dist/react/react/components/{Dashboard/shared → shared}/FilterBar.d.ts +4 -3
  46. package/dist/react/react/components/shared/RelatedLogs.d.ts +7 -0
  47. package/dist/react/react/hooks/useDashboardData.d.ts +4 -8
  48. package/dist/react/style.css +1 -1
  49. package/dist/src/collectors/app_collector.d.ts +0 -8
  50. package/dist/src/collectors/app_collector.js +45 -52
  51. package/dist/src/collectors/auto_detect.d.ts +0 -23
  52. package/dist/src/collectors/auto_detect.js +33 -55
  53. package/dist/src/collectors/db_pool_collector.d.ts +14 -16
  54. package/dist/src/collectors/db_pool_collector.js +72 -57
  55. package/dist/src/collectors/log_collector.d.ts +0 -47
  56. package/dist/src/collectors/log_collector.js +36 -65
  57. package/dist/src/collectors/queue_collector.d.ts +0 -20
  58. package/dist/src/collectors/queue_collector.js +60 -76
  59. package/dist/src/collectors/redis_collector.d.ts +10 -10
  60. package/dist/src/collectors/redis_collector.js +69 -66
  61. package/dist/src/config/deprecation_migration.d.ts +7 -0
  62. package/dist/src/config/deprecation_migration.js +201 -0
  63. package/dist/src/controller/debug_controller.d.ts +1 -1
  64. package/dist/src/controller/debug_controller.js +87 -81
  65. package/dist/src/dashboard/cache_handlers.d.ts +14 -0
  66. package/dist/src/dashboard/cache_handlers.js +52 -0
  67. package/dist/src/dashboard/chart_aggregator.d.ts +0 -7
  68. package/dist/src/dashboard/chart_aggregator.js +68 -50
  69. package/dist/src/dashboard/coalesce_cache.d.ts +25 -0
  70. package/dist/src/dashboard/coalesce_cache.js +47 -0
  71. package/dist/src/dashboard/dashboard_controller.d.ts +11 -37
  72. package/dist/src/dashboard/dashboard_controller.js +52 -532
  73. package/dist/src/dashboard/dashboard_page_assets.d.ts +17 -0
  74. package/dist/src/dashboard/dashboard_page_assets.js +51 -0
  75. package/dist/src/dashboard/dashboard_store.d.ts +19 -217
  76. package/dist/src/dashboard/dashboard_store.js +115 -1069
  77. package/dist/src/dashboard/dashboard_types.d.ts +83 -0
  78. package/dist/src/dashboard/dashboard_types.js +4 -0
  79. package/dist/src/dashboard/detail_queries.d.ts +19 -0
  80. package/dist/src/dashboard/detail_queries.js +98 -0
  81. package/dist/src/dashboard/email_event_builder.d.ts +8 -0
  82. package/dist/src/dashboard/email_event_builder.js +65 -0
  83. package/dist/src/dashboard/explain_query.d.ts +8 -0
  84. package/dist/src/dashboard/explain_query.js +22 -0
  85. package/dist/src/dashboard/filter_handlers.d.ts +23 -0
  86. package/dist/src/dashboard/filter_handlers.js +56 -0
  87. package/dist/src/dashboard/filtered_queries.d.ts +15 -0
  88. package/dist/src/dashboard/filtered_queries.js +155 -0
  89. package/dist/src/dashboard/flush_manager.d.ts +25 -0
  90. package/dist/src/dashboard/flush_manager.js +107 -0
  91. package/dist/src/dashboard/format_helpers.d.ts +126 -0
  92. package/dist/src/dashboard/format_helpers.js +140 -0
  93. package/dist/src/dashboard/inspector_manager.d.ts +36 -0
  94. package/dist/src/dashboard/inspector_manager.js +102 -0
  95. package/dist/src/dashboard/integrations/config_inspector.js +11 -13
  96. package/dist/src/dashboard/integrations/queue_inspector.d.ts +3 -3
  97. package/dist/src/dashboard/integrations/queue_inspector.js +13 -10
  98. package/dist/src/dashboard/jobs_handlers.d.ts +14 -0
  99. package/dist/src/dashboard/jobs_handlers.js +61 -0
  100. package/dist/src/dashboard/knex_factory.d.ts +18 -0
  101. package/dist/src/dashboard/knex_factory.js +91 -0
  102. package/dist/src/dashboard/migrator.js +30 -153
  103. package/dist/src/dashboard/migrator_tables.d.ts +19 -0
  104. package/dist/src/dashboard/migrator_tables.js +153 -0
  105. package/dist/src/dashboard/overview_queries.d.ts +66 -0
  106. package/dist/src/dashboard/overview_queries.js +155 -0
  107. package/dist/src/dashboard/overview_query_runners.d.ts +25 -0
  108. package/dist/src/dashboard/overview_query_runners.js +84 -0
  109. package/dist/src/dashboard/overview_store_queries.d.ts +40 -0
  110. package/dist/src/dashboard/overview_store_queries.js +69 -0
  111. package/dist/src/dashboard/paginate_helper.d.ts +12 -0
  112. package/dist/src/dashboard/paginate_helper.js +33 -0
  113. package/dist/src/dashboard/query_explain_handler.d.ts +10 -0
  114. package/dist/src/dashboard/query_explain_handler.js +80 -0
  115. package/dist/src/dashboard/read_queries.d.ts +32 -0
  116. package/dist/src/dashboard/read_queries.js +107 -0
  117. package/dist/src/dashboard/saved_filter_queries.d.ts +10 -0
  118. package/dist/src/dashboard/saved_filter_queries.js +24 -0
  119. package/dist/src/dashboard/storage_stats.d.ts +41 -0
  120. package/dist/src/dashboard/storage_stats.js +81 -0
  121. package/dist/src/dashboard/write_queue.d.ts +106 -0
  122. package/dist/src/dashboard/write_queue.js +225 -0
  123. package/dist/src/data/data_access.d.ts +6 -36
  124. package/dist/src/data/data_access.js +43 -188
  125. package/dist/src/data/data_access_helpers.d.ts +130 -0
  126. package/dist/src/data/data_access_helpers.js +212 -0
  127. package/dist/src/debug/debug_store.js +37 -32
  128. package/dist/src/debug/email_collector.d.ts +1 -10
  129. package/dist/src/debug/email_collector.js +78 -81
  130. package/dist/src/debug/event_collector.d.ts +0 -9
  131. package/dist/src/debug/event_collector.js +79 -62
  132. package/dist/src/debug/query_collector.js +23 -19
  133. package/dist/src/debug/route_inspector.d.ts +1 -5
  134. package/dist/src/debug/route_inspector.js +50 -51
  135. package/dist/src/debug/trace_collector.d.ts +10 -2
  136. package/dist/src/debug/trace_collector.js +23 -16
  137. package/dist/src/debug/types.d.ts +5 -1
  138. package/dist/src/define_config.d.ts +0 -65
  139. package/dist/src/define_config.js +93 -333
  140. package/dist/src/edge/client/dashboard.js +2 -2
  141. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  142. package/dist/src/edge/client/stats-bar.js +1 -1
  143. package/dist/src/edge/client-vue/dashboard.js +5 -5
  144. package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
  145. package/dist/src/edge/client-vue/stats-bar.js +3 -3
  146. package/dist/src/edge/plugin.d.ts +0 -16
  147. package/dist/src/edge/plugin.js +57 -64
  148. package/dist/src/engine/request_metrics.d.ts +1 -0
  149. package/dist/src/engine/request_metrics.js +32 -42
  150. package/dist/src/middleware/request_tracking_middleware.d.ts +3 -8
  151. package/dist/src/middleware/request_tracking_middleware.js +65 -91
  152. package/dist/src/provider/auth_middleware_detector.d.ts +16 -0
  153. package/dist/src/provider/auth_middleware_detector.js +97 -0
  154. package/dist/src/provider/boot_helpers.d.ts +20 -0
  155. package/dist/src/provider/boot_helpers.js +91 -0
  156. package/dist/src/provider/boot_initializer.d.ts +28 -0
  157. package/dist/src/provider/boot_initializer.js +35 -0
  158. package/dist/src/provider/dashboard_init.d.ts +30 -0
  159. package/dist/src/provider/dashboard_init.js +138 -0
  160. package/dist/src/provider/dashboard_setup.d.ts +25 -0
  161. package/dist/src/provider/dashboard_setup.js +78 -0
  162. package/dist/src/provider/diagnostics.d.ts +134 -0
  163. package/dist/src/provider/diagnostics.js +127 -0
  164. package/dist/src/provider/email_bridge.d.ts +43 -0
  165. package/dist/src/provider/email_bridge.js +80 -0
  166. package/dist/src/provider/email_helpers.d.ts +13 -0
  167. package/dist/src/provider/email_helpers.js +68 -0
  168. package/dist/src/provider/pino_hook.d.ts +17 -0
  169. package/dist/src/provider/pino_hook.js +35 -0
  170. package/dist/src/provider/provider_helpers_extra.d.ts +47 -0
  171. package/dist/src/provider/provider_helpers_extra.js +177 -0
  172. package/dist/src/provider/server_stats_provider.d.ts +39 -85
  173. package/dist/src/provider/server_stats_provider.js +131 -936
  174. package/dist/src/provider/shutdown_helpers.d.ts +43 -0
  175. package/dist/src/provider/shutdown_helpers.js +70 -0
  176. package/dist/src/provider/toolbar_setup.d.ts +57 -0
  177. package/dist/src/provider/toolbar_setup.js +141 -0
  178. package/dist/src/routes/dashboard_routes.d.ts +14 -0
  179. package/dist/src/routes/dashboard_routes.js +197 -0
  180. package/dist/src/routes/debug_routes.d.ts +14 -0
  181. package/dist/src/routes/debug_routes.js +101 -0
  182. package/dist/src/routes/register_routes.d.ts +0 -78
  183. package/dist/src/routes/register_routes.js +22 -347
  184. package/dist/src/routes/stats_routes.d.ts +5 -0
  185. package/dist/src/routes/stats_routes.js +14 -0
  186. package/dist/src/styles/components.css +177 -0
  187. package/dist/src/styles/dashboard.css +8 -90
  188. package/dist/src/styles/debug-panel.css +10 -31
  189. package/dist/src/types.d.ts +306 -15
  190. package/dist/vue/{CacheSection-Cx-hj09X.js → CacheSection-ITqvpfH5.js} +1 -1
  191. package/dist/vue/{ConfigSection-CMXyryf6.js → ConfigSection-DTn3GslE.js} +1 -1
  192. package/dist/vue/{EmailsSection-DgKl9xGT.js → EmailsSection-DtLJ4XoS.js} +1 -1
  193. package/dist/vue/{EventsSection-BNMCAim1.js → EventsSection-BOYYz0Ty.js} +1 -1
  194. package/dist/vue/{JobsSection-CCMgMlxd.js → JobsSection-BazTxcJL.js} +1 -1
  195. package/dist/vue/{LogsSection-CvOnTxUu.js → LogsSection-D55PjTKX.js} +9 -3
  196. package/dist/vue/{LogsTab-Bg3o0Mm6.js → LogsTab-47zEK7jL.js} +4 -1
  197. package/dist/vue/{OverviewSection-CHgaKtUR.js → OverviewSection-1uBKo-Tu.js} +1 -1
  198. package/dist/vue/{QueriesSection-BnHRD98z.js → QueriesSection-rpoZ4ogd.js} +1 -1
  199. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +84 -0
  200. package/dist/vue/RequestsSection-x7LvT0MC.js +401 -0
  201. package/dist/vue/{RoutesSection-BrceOcKQ.js → RoutesSection-CCD0zZqQ.js} +1 -1
  202. package/dist/vue/TimelineTab-zj5Z5OdT.js +338 -0
  203. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +4 -0
  204. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +4 -0
  205. package/dist/vue/components/{Dashboard/sections/TimelineSection.vue.d.ts → shared/RelatedLogs.vue.d.ts} +5 -6
  206. package/dist/vue/composables/useDashboardData.d.ts +12 -23
  207. package/dist/vue/index-C8MxnS7Q.js +1232 -0
  208. package/dist/vue/index.js +1 -1
  209. package/dist/vue/style.css +1 -1
  210. package/package.json +1 -1
  211. package/dist/react/CacheTab-DYmsZJJ1.js +0 -123
  212. package/dist/react/CustomPaneTab-D7_o3Ec6.js +0 -104
  213. package/dist/react/EmailsTab-Uh2CQY3o.js +0 -153
  214. package/dist/react/EventsTab-CC6DQzEm.js +0 -63
  215. package/dist/react/LogsTab-BbYK-iyh.js +0 -103
  216. package/dist/react/RequestsSection-Cb5a6MlT.js +0 -209
  217. package/dist/react/RoutesTab-Bwreij3e.js +0 -74
  218. package/dist/react/TimelineSection-B2y06kRE.js +0 -158
  219. package/dist/react/TimelineTab-6hthfdBB.js +0 -193
  220. package/dist/react/WaterfallChart-Cj73WdfM.js +0 -100
  221. package/dist/react/index-CecA4IdQ.js +0 -1075
  222. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +0 -8
  223. package/dist/vue/RequestsSection-B-uSlM0f.js +0 -243
  224. package/dist/vue/TimelineSection-CfvnA2Oo.js +0 -186
  225. package/dist/vue/TimelineTab-Db6lKKsD.js +0 -250
  226. package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +0 -118
  227. package/dist/vue/index-oLxS08vN.js +0 -1235
@@ -0,0 +1,84 @@
1
+ import { defineComponent as y, ref as k, openBlock as a, createElementBlock as n, createElementVNode as i, normalizeClass as t, createTextVNode as L, toDisplayString as c, Fragment as v, renderList as h, unref as e, createVNode as C, createCommentVNode as g } from "vue";
2
+ import { getStructuredData as r, getLogLevelCssClass as N, resolveLogLevel as P, resolveLogTimestamp as u, formatTime as V, timeAgo as q, resolveLogRequestId as m, resolveLogMessage as E } from "adonisjs-server-stats/core";
3
+ import { _ as R } from "./JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js";
4
+ const T = { key: 0 }, w = { style: { overflow: "auto" } }, B = ["onClick"], D = ["title"], I = ["title"], S = {
5
+ key: 3,
6
+ style: { width: "14px" }
7
+ }, M = /* @__PURE__ */ y({
8
+ __name: "RelatedLogs",
9
+ props: {
10
+ logs: {},
11
+ classPrefix: { default: "ss-dash" }
12
+ },
13
+ setup(s) {
14
+ const o = k(null);
15
+ function $(x, d) {
16
+ d && (o.value = o.value === x ? null : x);
17
+ }
18
+ return (x, d) => s.logs.length > 0 ? (a(), n("div", T, [
19
+ i("div", {
20
+ class: t(`${s.classPrefix}-related-logs-title`)
21
+ }, [
22
+ d[0] || (d[0] = L(" Related Logs ", -1)),
23
+ i("span", {
24
+ class: t(`${s.classPrefix}-related-logs-count`)
25
+ }, "(" + c(s.logs.length) + ")", 3)
26
+ ], 2),
27
+ i("div", w, [
28
+ (a(!0), n(v, null, h(s.logs, (l, f) => (a(), n(v, {
29
+ key: l.id || f
30
+ }, [
31
+ i("div", {
32
+ class: t([
33
+ `${s.classPrefix}-log-entry`,
34
+ e(r)(l) ? `${s.classPrefix}-log-entry-expandable` : ""
35
+ ]),
36
+ onClick: (b) => $(f, !!e(r)(l))
37
+ }, [
38
+ i("span", {
39
+ class: t([
40
+ `${s.classPrefix}-log-level`,
41
+ e(N)(e(P)(l), `${s.classPrefix}-log-level`)
42
+ ])
43
+ }, c(e(P)(l).toUpperCase()), 3),
44
+ i("span", {
45
+ class: t(`${s.classPrefix}-log-time`),
46
+ title: e(u)(l) ? e(V)(e(u)(l)) : ""
47
+ }, c(e(u)(l) ? e(q)(e(u)(l)) : "-"), 11, D),
48
+ e(m)(l) ? (a(), n("span", {
49
+ key: 0,
50
+ class: t(`${s.classPrefix}-log-reqid`),
51
+ title: e(m)(l)
52
+ }, c(e(m)(l).slice(0, 8)), 11, I)) : (a(), n("span", {
53
+ key: 1,
54
+ class: t(`${s.classPrefix}-log-reqid-empty`)
55
+ }, "--", 2)),
56
+ e(r)(l) ? (a(), n("span", {
57
+ key: 2,
58
+ class: t([
59
+ `${s.classPrefix}-log-expand-icon`,
60
+ o.value === f ? `${s.classPrefix}-log-expand-icon-open` : ""
61
+ ])
62
+ }, "▶", 2)) : (a(), n("span", S)),
63
+ i("span", {
64
+ class: t(`${s.classPrefix}-log-msg`)
65
+ }, c(e(E)(l)), 3)
66
+ ], 10, B),
67
+ o.value === f && e(r)(l) ? (a(), n("div", {
68
+ key: 0,
69
+ class: t(`${s.classPrefix}-log-detail`)
70
+ }, [
71
+ C(R, {
72
+ value: e(r)(l),
73
+ "class-prefix": s.classPrefix,
74
+ "default-expanded": !0
75
+ }, null, 8, ["value", "class-prefix"])
76
+ ], 2)) : g("", !0)
77
+ ], 64))), 128))
78
+ ])
79
+ ])) : g("", !0);
80
+ }
81
+ });
82
+ export {
83
+ M as _
84
+ };
@@ -0,0 +1,401 @@
1
+ import { defineComponent as I, computed as x, openBlock as l, createElementBlock as o, normalizeClass as p, createElementVNode as s, Fragment as f, renderList as B, normalizeStyle as U, toDisplayString as d, createTextVNode as k, createCommentVNode as v, inject as L, ref as m, watch as es, nextTick as as, onUnmounted as ls, createVNode as j, createBlock as G, unref as r } from "vue";
2
+ import { initSplitPane as ns, formatTime as os, timeAgo as is, normalizeTraceFields as ds, durationSeverity as rs } from "adonisjs-server-stats/core";
3
+ import { u as us } from "./useApiClient-BQQ9CF-q.js";
4
+ import { u as cs } from "./index-C8MxnS7Q.js";
5
+ import { u as hs } from "./useResizableTable-BoivAevK.js";
6
+ import { _ as ms } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
7
+ import { _ as vs } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
8
+ import { _ as ps } from "./RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js";
9
+ const fs = {
10
+ key: 0,
11
+ class: "ss-dash-empty"
12
+ }, gs = { class: "ss-dash-tl-legend" }, ys = ["title"], _s = { class: "ss-dash-tl-track" }, ks = ["title"], ws = { class: "ss-dash-tl-dur" }, bs = {
13
+ key: 0,
14
+ class: "ss-dash-tl-warnings"
15
+ }, Cs = { class: "ss-dash-tl-warnings-title" }, H = /* @__PURE__ */ I({
16
+ __name: "WaterfallChart",
17
+ props: {
18
+ spans: {},
19
+ totalDuration: {},
20
+ className: {},
21
+ warnings: {}
22
+ },
23
+ setup(g) {
24
+ const w = g, b = {
25
+ request: "#1e3a5f",
26
+ middleware: "rgba(30, 58, 95, 0.7)",
27
+ db: "#6d28d9",
28
+ view: "#0e7490",
29
+ mail: "#059669",
30
+ event: "#b45309",
31
+ custom: "var(--ss-dim)"
32
+ }, R = {
33
+ request: "Request",
34
+ middleware: "Middleware",
35
+ db: "DB",
36
+ mail: "Mail",
37
+ event: "Event",
38
+ view: "View",
39
+ custom: "Custom"
40
+ }, C = x(() => w.spans || []), y = x(
41
+ () => [...C.value].sort((a, u) => a.startOffset - u.startOffset)
42
+ ), T = x(() => {
43
+ const a = {};
44
+ for (const u of y.value)
45
+ a[u.id] = u.parentId ? (a[u.parentId] || 0) + 1 : 0;
46
+ return a;
47
+ });
48
+ function A(a) {
49
+ const u = w.totalDuration || 1;
50
+ return `${a.startOffset / u * 100}%`;
51
+ }
52
+ function _(a) {
53
+ const u = w.totalDuration || 1;
54
+ return `${Math.max(a.duration / u * 100, 0.5)}%`;
55
+ }
56
+ function h(a) {
57
+ return a.length > 50 ? a.slice(0, 50) + "..." : a;
58
+ }
59
+ function F(a) {
60
+ return a === "db" ? "DB" : a;
61
+ }
62
+ function N(a) {
63
+ return a === "db" ? "purple" : a === "mail" ? "green" : a === "event" ? "amber" : a === "view" ? "blue" : "muted";
64
+ }
65
+ function q(a) {
66
+ const u = a.metadata ? Object.entries(a.metadata).filter(([, i]) => i != null).map(([i, n]) => `${i}=${n}`).join(", ") : "";
67
+ return u ? `${a.label} (${a.duration.toFixed(2)}ms)
68
+ ${u}` : `${a.label} (${a.duration.toFixed(2)}ms)`;
69
+ }
70
+ return (a, u) => C.value.length === 0 ? (l(), o("div", fs, "No spans recorded")) : (l(), o("div", {
71
+ key: 1,
72
+ class: p(`ss-dash-tl-waterfall ${g.className || ""}`)
73
+ }, [
74
+ s("div", gs, [
75
+ (l(), o(f, null, B(R, (i, n) => s("div", {
76
+ key: n,
77
+ class: "ss-dash-tl-legend-item"
78
+ }, [
79
+ s("span", {
80
+ class: "ss-dash-tl-legend-dot",
81
+ style: U({ background: b[n] || b.custom })
82
+ }, null, 4),
83
+ s("span", null, d(i), 1)
84
+ ])), 64))
85
+ ]),
86
+ (l(!0), o(f, null, B(y.value, (i) => (l(), o("div", {
87
+ key: i.id,
88
+ class: "ss-dash-tl-row"
89
+ }, [
90
+ s("div", {
91
+ class: "ss-dash-tl-label",
92
+ title: q(i),
93
+ style: U({ paddingLeft: 8 + (T.value[i.id] || 0) * 16 + "px" })
94
+ }, [
95
+ s("span", {
96
+ class: p(`ss-dash-badge ss-dash-badge-${N(i.category)}`),
97
+ style: { "font-size": "9px", "margin-right": "4px" }
98
+ }, d(F(i.category)), 3),
99
+ k(" " + d(h(i.label)), 1)
100
+ ], 12, ys),
101
+ s("div", _s, [
102
+ s("div", {
103
+ class: p(`ss-dash-tl-bar ss-dash-tl-bar-${i.category || "custom"}`),
104
+ style: U({
105
+ left: A(i),
106
+ width: _(i)
107
+ }),
108
+ title: q(i)
109
+ }, null, 14, ks)
110
+ ]),
111
+ s("span", ws, d(i.duration.toFixed(2)) + "ms", 1)
112
+ ]))), 128)),
113
+ g.warnings && g.warnings.length > 0 ? (l(), o("div", bs, [
114
+ s("div", Cs, "Warnings (" + d(g.warnings.length) + ")", 1),
115
+ (l(!0), o(f, null, B(g.warnings, (i, n) => (l(), o("div", {
116
+ key: n,
117
+ class: "ss-dash-tl-warning"
118
+ }, d(i), 1))), 128))
119
+ ])) : v("", !0)
120
+ ], 2));
121
+ }
122
+ }), $s = { class: "ss-dash-tl-detail-header" }, xs = { style: { color: "var(--ss-text)" } }, Rs = { class: "ss-dash-tl-meta" }, qs = { class: "ss-dash-tl-detail-header" }, Ds = {
123
+ key: 0,
124
+ class: "ss-dash-empty"
125
+ }, Ss = {
126
+ key: 1,
127
+ class: "ss-dash-empty"
128
+ }, Ls = { class: "ss-dash-table-wrap" }, Bs = {
129
+ key: 0,
130
+ class: "ss-dash-sort-arrow"
131
+ }, Ts = {
132
+ key: 0,
133
+ class: "ss-dash-sort-arrow"
134
+ }, As = {
135
+ key: 0,
136
+ class: "ss-dash-sort-arrow"
137
+ }, Fs = {
138
+ key: 0,
139
+ class: "ss-dash-sort-arrow"
140
+ }, Ns = {
141
+ key: 0,
142
+ class: "ss-dash-sort-arrow"
143
+ }, Os = ["onClick"], Ps = { style: { color: "var(--ss-dim)" } }, Es = ["title"], Ms = { style: { color: "var(--ss-muted)", "text-align": "center" } }, Vs = {
144
+ key: 0,
145
+ style: { color: "var(--ss-amber-fg)", "text-align": "center", display: "block" }
146
+ }, zs = {
147
+ key: 1,
148
+ style: { color: "var(--ss-dim)", "text-align": "center", display: "block" }
149
+ }, Us = ["title"], js = {
150
+ key: 1,
151
+ class: "ss-dash-empty"
152
+ }, Xs = /* @__PURE__ */ I({
153
+ __name: "RequestsSection",
154
+ setup(g) {
155
+ const w = L("ss-refresh-key", m(0)), b = L("ss-dashboard-endpoint", "/__stats/api"), R = L("ss-auth-token", void 0), C = L("ss-base-url", ""), { data: y, loading: T, error: A, pagination: _, sort: h, goToPage: F, setSearch: N, setSort: q } = cs(
156
+ () => "requests",
157
+ {
158
+ baseUrl: C,
159
+ dashboardEndpoint: b,
160
+ authToken: R,
161
+ refreshKey: w
162
+ }
163
+ ), a = m(""), u = m(null), i = m(!1), n = m(null), O = x(() => {
164
+ if (!y.value) return [];
165
+ const c = y.value;
166
+ return c.data || c.requests || y.value || [];
167
+ }), K = us(C, R);
168
+ async function Y(c) {
169
+ const t = c.id;
170
+ i.value = !0;
171
+ try {
172
+ const e = b || "/__stats/api", S = await K().fetch(`${e}/requests/${t}`), W = S.trace, ts = W ? { ...S, ...W, logs: S.logs } : S;
173
+ n.value = ds(ts), u.value = c;
174
+ } catch {
175
+ } finally {
176
+ i.value = !1;
177
+ }
178
+ }
179
+ function J() {
180
+ u.value = null, n.value = null;
181
+ }
182
+ function Q(c) {
183
+ a.value = c, N(c);
184
+ }
185
+ function $(c) {
186
+ q(c);
187
+ }
188
+ function X(c) {
189
+ const t = rs(c);
190
+ return t === "very-slow" ? "ss-dash-very-slow" : t === "slow" ? "ss-dash-slow" : "";
191
+ }
192
+ const { tableRef: Z } = hs(() => O.value), P = m(null), E = m(null), M = m(null), V = m(null);
193
+ let D = null;
194
+ const z = x(() => n.value ? n.value.logs || [] : []);
195
+ return es([() => u.value, () => n.value], async () => {
196
+ D?.(), D = null, n.value && z.value.length > 0 && (await as(), P.value && E.value && M.value && V.value && (D = ns({
197
+ container: P.value,
198
+ handle: E.value,
199
+ topPane: M.value,
200
+ bottomPane: V.value,
201
+ storageKey: "ss-requests-split"
202
+ })));
203
+ }), ls(() => {
204
+ D?.();
205
+ }), (c, t) => (l(), o("div", null, [
206
+ n.value && u.value ? (l(), o(f, { key: 0 }, [
207
+ s("div", $s, [
208
+ s("button", {
209
+ type: "button",
210
+ class: "ss-dash-btn",
211
+ onClick: J
212
+ }, " ← Back to Requests "),
213
+ s("span", {
214
+ class: p(`ss-dash-method ss-dash-method-${(n.value.method || "").toLowerCase()}`)
215
+ }, d(n.value.method), 3),
216
+ s("span", xs, d(n.value.url), 1),
217
+ s("span", {
218
+ class: p(`ss-dash-status ss-dash-status-${Math.floor((n.value.statusCode || 200) / 100)}xx`)
219
+ }, d(n.value.statusCode), 3),
220
+ s("span", Rs, d(n.value.totalDuration.toFixed(1)) + "ms · " + d(n.value.spanCount) + " spans ", 1)
221
+ ]),
222
+ z.value.length > 0 ? (l(), o("div", {
223
+ key: 0,
224
+ ref_key: "splitContainerRef",
225
+ ref: P,
226
+ class: "ss-dash-split-container"
227
+ }, [
228
+ s("div", {
229
+ ref_key: "splitTopRef",
230
+ ref: M,
231
+ class: "ss-dash-split-top"
232
+ }, [
233
+ j(H, {
234
+ spans: n.value.spans,
235
+ "total-duration": n.value.totalDuration,
236
+ warnings: n.value.warnings
237
+ }, null, 8, ["spans", "total-duration", "warnings"])
238
+ ], 512),
239
+ s("div", {
240
+ ref_key: "splitHandleRef",
241
+ ref: E,
242
+ class: "ss-dash-split-handle"
243
+ }, null, 512),
244
+ s("div", {
245
+ ref_key: "splitBottomRef",
246
+ ref: V,
247
+ class: "ss-dash-split-bottom"
248
+ }, [
249
+ j(ps, {
250
+ logs: z.value,
251
+ "class-prefix": "ss-dash"
252
+ }, null, 8, ["logs"])
253
+ ], 512)
254
+ ], 512)) : (l(), G(H, {
255
+ key: 1,
256
+ spans: n.value.spans,
257
+ "total-duration": n.value.totalDuration,
258
+ warnings: n.value.warnings
259
+ }, null, 8, ["spans", "total-duration", "warnings"]))
260
+ ], 64)) : i.value ? (l(), o(f, { key: 1 }, [
261
+ s("div", qs, [
262
+ s("button", {
263
+ type: "button",
264
+ class: "ss-dash-btn",
265
+ onClick: t[0] || (t[0] = (e) => i.value = !1)
266
+ }, " ← Back to Requests ")
267
+ ]),
268
+ t[6] || (t[6] = s("div", { class: "ss-dash-empty" }, "Loading request detail...", -1))
269
+ ], 64)) : (l(), o(f, { key: 2 }, [
270
+ j(ms, {
271
+ "model-value": a.value,
272
+ placeholder: "Filter requests...",
273
+ summary: `${r(_).total ?? 0} requests`,
274
+ "onUpdate:modelValue": Q
275
+ }, null, 8, ["model-value", "summary"]),
276
+ r(A) ? (l(), o("div", Ds, "Failed to load requests")) : v("", !0),
277
+ r(T) && !r(y) ? (l(), o("div", Ss, "Loading requests...")) : (l(), o(f, { key: 2 }, [
278
+ s("div", Ls, [
279
+ O.value.length > 0 ? (l(), o("table", {
280
+ key: 0,
281
+ ref_key: "tableRef",
282
+ ref: Z,
283
+ class: "ss-dash-table"
284
+ }, [
285
+ t[15] || (t[15] = s("colgroup", null, [
286
+ s("col", { style: { width: "40px" } }),
287
+ s("col", { style: { width: "70px" } }),
288
+ s("col"),
289
+ s("col", { style: { width: "60px" } }),
290
+ s("col", { style: { width: "80px" } }),
291
+ s("col", { style: { width: "50px" } }),
292
+ s("col", { style: { width: "40px" } }),
293
+ s("col", { style: { width: "80px" } })
294
+ ], -1)),
295
+ s("thead", null, [
296
+ s("tr", null, [
297
+ t[12] || (t[12] = s("th", null, "#", -1)),
298
+ s("th", {
299
+ class: "ss-dash-sortable",
300
+ onClick: t[1] || (t[1] = (e) => $("method"))
301
+ }, [
302
+ t[7] || (t[7] = k(" Method ", -1)),
303
+ r(h).column === "method" ? (l(), o("span", Bs, d(r(h).direction === "asc" ? " ▲" : " ▼"), 1)) : v("", !0)
304
+ ]),
305
+ s("th", {
306
+ class: "ss-dash-sortable",
307
+ onClick: t[2] || (t[2] = (e) => $("url"))
308
+ }, [
309
+ t[8] || (t[8] = k(" URL ", -1)),
310
+ r(h).column === "url" ? (l(), o("span", Ts, d(r(h).direction === "asc" ? " ▲" : " ▼"), 1)) : v("", !0)
311
+ ]),
312
+ s("th", {
313
+ class: "ss-dash-sortable",
314
+ onClick: t[3] || (t[3] = (e) => $("statusCode"))
315
+ }, [
316
+ t[9] || (t[9] = k(" Status ", -1)),
317
+ r(h).column === "statusCode" ? (l(), o("span", As, d(r(h).direction === "asc" ? " ▲" : " ▼"), 1)) : v("", !0)
318
+ ]),
319
+ s("th", {
320
+ class: "ss-dash-sortable",
321
+ onClick: t[4] || (t[4] = (e) => $("duration"))
322
+ }, [
323
+ t[10] || (t[10] = k(" Duration ", -1)),
324
+ r(h).column === "duration" ? (l(), o("span", Fs, d(r(h).direction === "asc" ? " ▲" : " ▼"), 1)) : v("", !0)
325
+ ]),
326
+ t[13] || (t[13] = s("th", null, "Spans", -1)),
327
+ t[14] || (t[14] = s("th", null, "⚠", -1)),
328
+ s("th", {
329
+ class: "ss-dash-sortable",
330
+ onClick: t[5] || (t[5] = (e) => $("createdAt"))
331
+ }, [
332
+ t[11] || (t[11] = k(" Time ", -1)),
333
+ r(h).column === "createdAt" ? (l(), o("span", Ns, d(r(h).direction === "asc" ? " ▲" : " ▼"), 1)) : v("", !0)
334
+ ])
335
+ ])
336
+ ]),
337
+ s("tbody", null, [
338
+ (l(!0), o(f, null, B(O.value, (e) => (l(), o("tr", {
339
+ key: e.id,
340
+ class: "ss-dash-clickable",
341
+ onClick: (ss) => Y(e)
342
+ }, [
343
+ s("td", null, [
344
+ s("span", Ps, d(e.id), 1)
345
+ ]),
346
+ s("td", null, [
347
+ s("span", {
348
+ class: p(`ss-dash-method ss-dash-method-${(e.method || "").toLowerCase()}`)
349
+ }, d(e.method), 3)
350
+ ]),
351
+ s("td", null, [
352
+ s("span", {
353
+ style: { color: "var(--ss-text)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" },
354
+ title: e.url
355
+ }, d(e.url), 9, Es)
356
+ ]),
357
+ s("td", null, [
358
+ s("span", {
359
+ class: p(`ss-dash-status ss-dash-status-${Math.floor((e.status_code || e.statusCode || 200) / 100)}xx`)
360
+ }, d(e.status_code || e.statusCode), 3)
361
+ ]),
362
+ s("td", null, [
363
+ s("span", {
364
+ class: p(`ss-dash-duration ${X(e.total_duration || e.totalDuration || e.duration || 0)}`)
365
+ }, d((e.total_duration || e.totalDuration || e.duration || 0).toFixed(1)) + "ms ", 3)
366
+ ]),
367
+ s("td", null, [
368
+ s("span", Ms, d(e.span_count || e.spanCount || 0), 1)
369
+ ]),
370
+ s("td", null, [
371
+ (e.warning_count || e.warningCount || 0) > 0 ? (l(), o("span", Vs, d(e.warning_count || e.warningCount || 0), 1)) : (l(), o("span", zs, "-"))
372
+ ]),
373
+ s("td", null, [
374
+ s("span", {
375
+ class: "ss-dash-event-time",
376
+ title: r(os)(
377
+ e.createdAt || e.created_at || e.timestamp || ""
378
+ )
379
+ }, d(r(is)(
380
+ e.createdAt || e.created_at || e.timestamp || ""
381
+ )), 9, Us)
382
+ ])
383
+ ], 8, Os))), 128))
384
+ ])
385
+ ], 512)) : (l(), o("div", js, "No requests recorded yet"))
386
+ ]),
387
+ r(_).totalPages > 1 ? (l(), G(vs, {
388
+ key: 0,
389
+ page: r(_).page,
390
+ "last-page": r(_).totalPages,
391
+ total: r(_).total,
392
+ onPageChange: r(F)
393
+ }, null, 8, ["page", "last-page", "total", "onPageChange"])) : v("", !0)
394
+ ], 64))
395
+ ], 64))
396
+ ]));
397
+ }
398
+ });
399
+ export {
400
+ Xs as default
401
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as g, inject as d, ref as c, computed as A, openBlock as l, createElementBlock as o, createVNode as N, unref as u, createElementVNode as e, Fragment as R, renderList as S, normalizeClass as j, toDisplayString as a } from "vue";
2
- import { u as z } from "./index-oLxS08vN.js";
2
+ import { u as z } from "./index-C8MxnS7Q.js";
3
3
  import { u as C } from "./useResizableTable-BoivAevK.js";
4
4
  import { _ as D } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
5
5
  const E = {