@lensjs/core 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/core/lens.cjs +32 -27
  2. package/dist/core/lens.d.cts +27 -3
  3. package/dist/core/lens.d.ts +27 -3
  4. package/dist/core/lens.js +32 -27
  5. package/dist/{index-DiLfwsvc.d.cts → index-CMvlRWcQ.d.cts} +5 -4
  6. package/dist/{index-DiLfwsvc.d.ts → index-CMvlRWcQ.d.ts} +5 -4
  7. package/dist/index.cjs +58 -39
  8. package/dist/index.d.cts +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +58 -39
  11. package/dist/stores/better_sqlite.cjs +2 -0
  12. package/dist/stores/better_sqlite.js +2 -0
  13. package/dist/stores/index.cjs +2 -0
  14. package/dist/stores/index.js +2 -0
  15. package/dist/ui/assets/{CacheActionBadge-CK7JdKoE.js → CacheActionBadge-DhWgzJKU.js} +1 -1
  16. package/dist/ui/assets/CacheEntriesTable-BHqlkmET.js +1 -0
  17. package/dist/ui/assets/CacheEntryContainer-Bp2C09iw.js +2 -0
  18. package/dist/ui/assets/{CacheEntryDetails-D9Xy7d9u.js → CacheEntryDetails-BUZc5j1q.js} +1 -1
  19. package/dist/ui/assets/CacheEntryDetailsContainer-C_EUSu_d.js +2 -0
  20. package/dist/ui/assets/ExceptionContainer-DYNMF7Fh.js +2 -0
  21. package/dist/ui/assets/{ExceptionDetails-BbIFoM7M.js → ExceptionDetails-OVDydGbv.js} +1 -1
  22. package/dist/ui/assets/ExceptionDetailsContainer-xXWwVaQA.js +2 -0
  23. package/dist/ui/assets/{ExceptionTable-DY3mmGT4.js → ExceptionTable-D9KqPbq2.js} +1 -1
  24. package/dist/ui/assets/{LoadMore-CJh7FLbl.js → LoadMore-CG1d6vXW.js} +1 -1
  25. package/dist/ui/assets/QueriesContainer-CMcyoEiM.js +2 -0
  26. package/dist/ui/assets/{QueryDetailsContainer-7CA9a5de.js → QueryDetailsContainer-DFQCEBLy.js} +1 -1
  27. package/dist/ui/assets/{QueryTable-pn7Ayura.js → QueryTable-WVYW33VB.js} +1 -1
  28. package/dist/ui/assets/RequestDetails-BIY8CWBr.js +1 -0
  29. package/dist/ui/assets/{RequestDetailsContainer-BECT0XJh.js → RequestDetailsContainer-Apuww5Zb.js} +2 -2
  30. package/dist/ui/assets/{RequestsContainer-DLkjpX67.js → RequestsContainer-BGQCjoDx.js} +2 -2
  31. package/dist/ui/assets/{RequetsTable-Cgas07Fe.js → RequetsTable-C0uox4Jg.js} +1 -1
  32. package/dist/ui/assets/{StatusCode-C5lihzKZ.js → StatusCode-1rRaEP-3.js} +1 -1
  33. package/dist/ui/assets/{TabbedDataViewer-BUMQ0QVm.js → TabbedDataViewer-Cj9wJA8v.js} +1 -1
  34. package/dist/ui/assets/{Table-BesHc4Lc.js → Table-B7P54I_5.js} +1 -1
  35. package/dist/ui/assets/{columns-C1CwS8yE.js → columns-DpE4hBXR.js} +1 -1
  36. package/dist/ui/assets/{columns-CULxhcpY.js → columns-T9b-fLbu.js} +1 -1
  37. package/dist/ui/assets/{columns-gYFQU5qH.js → columns-yzAlNtNs.js} +1 -1
  38. package/dist/ui/assets/{index-PEcJ5nx0.js → index-ymy5EHnx.js} +2 -2
  39. package/dist/ui/assets/{useCacheEntries-jbGe2CRY.js → useCacheEntries-C5Y3eu1s.js} +1 -1
  40. package/dist/ui/assets/{useExceptions-uYUhAW-J.js → useExceptions-CN6DxiEv.js} +1 -1
  41. package/dist/ui/assets/{useLensApi-BsDmB7vx.js → useLensApi-ufHx5Ujl.js} +1 -1
  42. package/dist/ui/assets/{useLoadMore-sLsrekV5.js → useLoadMore-dVvcuWYt.js} +1 -1
  43. package/dist/ui/assets/{useQueries-DJE91mYq.js → useQueries-BsRJ7RGS.js} +1 -1
  44. package/dist/ui/index.html +1 -1
  45. package/dist/utils/index.cjs +27 -12
  46. package/dist/utils/index.d.cts +1 -1
  47. package/dist/utils/index.d.ts +1 -1
  48. package/dist/utils/index.js +26 -12
  49. package/package.json +1 -1
  50. package/dist/ui/assets/CacheEntriesTable-C5HcgCZI.js +0 -1
  51. package/dist/ui/assets/CacheEntryContainer-C0no2_6_.js +0 -2
  52. package/dist/ui/assets/CacheEntryDetailsContainer-BcwliP55.js +0 -2
  53. package/dist/ui/assets/ExceptionContainer-CQalcd8x.js +0 -2
  54. package/dist/ui/assets/ExceptionDetailsContainer-fajmF7id.js +0 -2
  55. package/dist/ui/assets/QueriesContainer-DWTsKzEk.js +0 -2
  56. package/dist/ui/assets/RequestDetails-CYSM4og8.js +0 -1
package/dist/index.js CHANGED
@@ -284,6 +284,8 @@ var BetterSqliteStore = class extends Store {
284
284
  return this.mapRow(row, true);
285
285
  }
286
286
  setupSchema() {
287
+ this.connection.exec("PRAGMA journal_mode = WAL;");
288
+ this.connection.exec("PRAGMA synchronous = NORMAL;");
287
289
  const createTable = `
288
290
  CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
289
291
  id TEXT PRIMARY KEY,
@@ -340,6 +342,7 @@ __export(utils_exports, {
340
342
  getMeta: () => getMeta,
341
343
  interpolateQuery: () => interpolateQuery,
342
344
  isStaticFile: () => isStaticFile,
345
+ normalizePath: () => normalizePath,
343
346
  prepareIgnoredPaths: () => prepareIgnoredPaths,
344
347
  prettyHrTime: () => prettyHrTime,
345
348
  shouldIgnoreCurrentPath: () => shouldIgnoreCurrentPath,
@@ -356,34 +359,44 @@ var generateRandomUuid = () => {
356
359
  function interpolateQuery(query, bindings) {
357
360
  const formatValue = (value) => {
358
361
  if (value === null || value === void 0) return "NULL";
359
- if (typeof value === "string") return `'${value.replace(/'/g, "''")}'`;
360
- if (value instanceof DateTime) return `'${value.toISO()}'`;
361
- if (value instanceof Date) return `'${value.toISOString()}'`;
362
- if (Array.isArray(value))
363
- return value.map((v) => typeof v === "string" ? `'${v.replace(/'/g, "''")}'` : v).join(", ");
364
- if (typeof value === "object")
362
+ if (typeof value === "string") {
363
+ return `'${value.replace(/'/g, "''")}'`;
364
+ }
365
+ if (value instanceof DateTime) {
366
+ return `'${value.toISO()}'`;
367
+ }
368
+ if (value instanceof Date) {
369
+ return `'${value.toISOString()}'`;
370
+ }
371
+ if (Array.isArray(value)) {
372
+ return value.map((v) => formatValue(v)).join(", ");
373
+ }
374
+ if (typeof value === "object") {
365
375
  return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
376
+ }
366
377
  return value.toString();
367
378
  };
368
379
  if (Array.isArray(bindings)) {
369
380
  let i = 0;
370
381
  return query.replace(/\?/g, () => {
371
- if (i >= bindings.length)
382
+ if (i >= bindings.length) {
372
383
  throw new Error("Not enough bindings for placeholders");
384
+ }
373
385
  return formatValue(bindings[i++]);
374
386
  });
375
387
  }
376
388
  return query.replace(/(\$|\:)(\w+)/g, (match, prefix, keyOrIndex) => {
377
389
  let value;
378
390
  if (prefix === "$" && /^\d+$/.test(keyOrIndex)) {
379
- const index = parseInt(keyOrIndex, 10) - 1;
380
- const keys = Object.keys(bindings);
381
- if (index < 0 || index >= keys.length)
391
+ const placeholder = `$${keyOrIndex}`;
392
+ if (!(placeholder in bindings)) {
382
393
  throw new Error(`Missing binding for ${match}`);
383
- value = bindings[keys[index]];
394
+ }
395
+ value = bindings[placeholder];
384
396
  } else {
385
- if (!(keyOrIndex in bindings))
397
+ if (!(keyOrIndex in bindings)) {
386
398
  throw new Error(`Missing binding for ${match}`);
399
+ }
387
400
  value = bindings[keyOrIndex];
388
401
  }
389
402
  return formatValue(value);
@@ -454,6 +467,9 @@ function prettyHrTime(hrtime, verbose = false) {
454
467
  }
455
468
  return `${(ms / 1e3).toFixed(1)} s`;
456
469
  }
470
+ function normalizePath(path4) {
471
+ return path4.startsWith("/") ? path4 : `/${path4}`;
472
+ }
457
473
 
458
474
  // src/core/lens.ts
459
475
  var Lens = class {
@@ -483,8 +499,7 @@ var Lens = class {
483
499
  basePath: config.basePath
484
500
  });
485
501
  adapter.registerRoutes(apiRoutes);
486
- const { __dirname: __dirname2 } = getMeta(import.meta.url);
487
- const uiPath = path2.resolve(this.normalizeDirName(__dirname2), "ui");
502
+ const uiPath = this.getUiPath();
488
503
  adapter.serveUI(uiPath, config.basePath, getUiConfig());
489
504
  }
490
505
  static setStore(store) {
@@ -504,22 +519,9 @@ var Lens = class {
504
519
  }
505
520
  return this.adapter;
506
521
  }
507
- static async bindContainerDeps(config) {
508
- const dbStore = await this.getStore();
509
- Container.singleton("store", () => dbStore);
510
- Container.singleton("uiConfig", () => {
511
- return {
512
- appName: config.appName,
513
- path: `/${config.basePath}`,
514
- api: {
515
- requests: `/${config.basePath}/api/requests`,
516
- queries: `/${config.basePath}/api/queries`,
517
- cache: `/${config.basePath}/api/cache`,
518
- exceptions: `/${config.basePath}/api/exceptions`,
519
- truncate: `/${config.basePath}/api/truncate`
520
- }
521
- };
522
- });
522
+ static getUiPath() {
523
+ const { __dirname: __dirname2 } = getMeta(import.meta.url);
524
+ return path2.resolve(this.normalizeDirName(__dirname2), "ui");
523
525
  }
524
526
  static getRoutes({ basePath }) {
525
527
  const apiRoutes = [
@@ -530,52 +532,69 @@ var Lens = class {
530
532
  },
531
533
  {
532
534
  method: "GET",
533
- path: `${basePath}/api/requests`,
535
+ path: `/${basePath}/api/requests`,
534
536
  handler: async (data) => await ApiController.getRequests(data)
535
537
  },
536
538
  {
537
539
  method: "GET",
538
- path: `${basePath}/api/requests/:id`,
540
+ path: `/${basePath}/api/requests/:id`,
539
541
  handler: async (data) => await ApiController.getRequest(data)
540
542
  },
541
543
  {
542
544
  method: "GET",
543
- path: `${basePath}/api/queries`,
545
+ path: `/${basePath}/api/queries`,
544
546
  handler: async (data) => await ApiController.getQueries(data)
545
547
  },
546
548
  {
547
549
  method: "GET",
548
- path: `${basePath}/api/queries/:id`,
550
+ path: `/${basePath}/api/queries/:id`,
549
551
  handler: async (data) => await ApiController.getQuery(data)
550
552
  },
551
553
  {
552
554
  method: "GET",
553
- path: `${basePath}/api/cache`,
555
+ path: `/${basePath}/api/cache`,
554
556
  handler: async (data) => await ApiController.getCacheEntries(data)
555
557
  },
556
558
  {
557
559
  method: "GET",
558
- path: `${basePath}/api/cache/:id`,
560
+ path: `/${basePath}/api/cache/:id`,
559
561
  handler: async (data) => await ApiController.getCacheEntry(data)
560
562
  },
561
563
  {
562
564
  method: "GET",
563
- path: `${basePath}/api/exceptions`,
565
+ path: `/${basePath}/api/exceptions`,
564
566
  handler: async (data) => await ApiController.getExceptions(data)
565
567
  },
566
568
  {
567
569
  method: "GET",
568
- path: `${basePath}/api/exceptions/:id`,
570
+ path: `/${basePath}/api/exceptions/:id`,
569
571
  handler: async (data) => await ApiController.getException(data)
570
572
  },
571
573
  {
572
574
  method: "DELETE",
573
- path: `${basePath}/api/truncate`,
575
+ path: `/${basePath}/api/truncate`,
574
576
  handler: async () => await ApiController.truncate()
575
577
  }
576
578
  ];
577
579
  return { apiRoutes };
578
580
  }
581
+ static async bindContainerDeps(config) {
582
+ const dbStore = await this.getStore();
583
+ Container.singleton("store", () => dbStore);
584
+ Container.singleton("uiConfig", () => {
585
+ return {
586
+ appName: config.appName,
587
+ path: `/${config.basePath}`,
588
+ api: {
589
+ requests: `/${config.basePath}/api/requests`,
590
+ queries: `/${config.basePath}/api/queries`,
591
+ cache: `/${config.basePath}/api/cache`,
592
+ exceptions: `/${config.basePath}/api/exceptions`,
593
+ truncate: `/${config.basePath}/api/truncate`
594
+ }
595
+ };
596
+ });
597
+ }
579
598
  static async getDefaultStore() {
580
599
  const store = new BetterSqliteStore();
581
600
  await store.initialize();
@@ -137,6 +137,8 @@ var BetterSqliteStore = class extends Store {
137
137
  return this.mapRow(row, true);
138
138
  }
139
139
  setupSchema() {
140
+ this.connection.exec("PRAGMA journal_mode = WAL;");
141
+ this.connection.exec("PRAGMA synchronous = NORMAL;");
140
142
  const createTable = `
141
143
  CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
142
144
  id TEXT PRIMARY KEY,
@@ -101,6 +101,8 @@ var BetterSqliteStore = class extends Store {
101
101
  return this.mapRow(row, true);
102
102
  }
103
103
  setupSchema() {
104
+ this.connection.exec("PRAGMA journal_mode = WAL;");
105
+ this.connection.exec("PRAGMA synchronous = NORMAL;");
104
106
  const createTable = `
105
107
  CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
106
108
  id TEXT PRIMARY KEY,
@@ -137,6 +137,8 @@ var BetterSqliteStore = class extends Store {
137
137
  return this.mapRow(row, true);
138
138
  }
139
139
  setupSchema() {
140
+ this.connection.exec("PRAGMA journal_mode = WAL;");
141
+ this.connection.exec("PRAGMA synchronous = NORMAL;");
140
142
  const createTable = `
141
143
  CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
142
144
  id TEXT PRIMARY KEY,
@@ -101,6 +101,8 @@ var BetterSqliteStore = class extends Store {
101
101
  return this.mapRow(row, true);
102
102
  }
103
103
  setupSchema() {
104
+ this.connection.exec("PRAGMA journal_mode = WAL;");
105
+ this.connection.exec("PRAGMA synchronous = NORMAL;");
104
106
  const createTable = `
105
107
  CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
106
108
  id TEXT PRIMARY KEY,
@@ -1 +1 @@
1
- import{j as r}from"./index-PEcJ5nx0.js";const d=({action:e})=>{const t={hit:"bg-green-100 text-green-800 dark:bg-green-600 dark:text-white",miss:"bg-amber-100 text-amber-800 dark:bg-amber-600 dark:text-white",write:"bg-blue-100 text-blue-800 dark:bg-blue-600 dark:text-white",delete:"bg-red-100 text-red-800 dark:bg-red-600 dark:text-white",clear:"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white"};return r.jsx("span",{className:`rounded px-2 py-1 text-sm font-semibold ${t[e]||t.clear}`,children:e})};export{d as C};
1
+ import{j as r}from"./index-ymy5EHnx.js";const d=({action:e})=>{const t={hit:"bg-green-100 text-green-800 dark:bg-green-600 dark:text-white",miss:"bg-amber-100 text-amber-800 dark:bg-amber-600 dark:text-white",write:"bg-blue-100 text-blue-800 dark:bg-blue-600 dark:text-white",delete:"bg-red-100 text-red-800 dark:bg-red-600 dark:text-white",clear:"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white"};return r.jsx("span",{className:`rounded px-2 py-1 text-sm font-semibold ${t[e]||t.clear}`,children:e})};export{d as C};
@@ -0,0 +1 @@
1
+ import{j as a}from"./index-ymy5EHnx.js";import{L as s}from"./LoadMore-CG1d6vXW.js";import{T as t}from"./Table-B7P54I_5.js";import{g as r}from"./columns-yzAlNtNs.js";import"./index-BRRKsoNv.js";import"./CacheActionBadge-DhWgzJKU.js";const p=({hasMoreObject:o})=>a.jsxs("div",{className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsx(t,{columns:r(),data:o.data})}),a.jsx(s,{paginatedPage:o})]});export{p as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CacheEntriesTable-BHqlkmET.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./LoadMore-CG1d6vXW.js","./Table-B7P54I_5.js","./columns-yzAlNtNs.js","./index-BRRKsoNv.js","./CacheActionBadge-DhWgzJKU.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as a,_ as s}from"./index-ymy5EHnx.js";import{u as i}from"./useLoadMore-dVvcuWYt.js";import{u as m}from"./useCacheEntries-C5Y3eu1s.js";import"./useLensApi-ufHx5Ujl.js";const n=t.lazy(()=>s(()=>import("./CacheEntriesTable-BHqlkmET.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),_=()=>{const{loadMoreItems:e,getItems:r}=m(),o=i({paginatedPage:e});return t.useEffect(()=>{r()},[]),a.jsx(n,{hasMoreObject:o})};export{_ as default};
@@ -1 +1 @@
1
- import{j as a,L as s,q as i,k as r}from"./index-PEcJ5nx0.js";import{D as n,T as o,J as u}from"./TabbedDataViewer-BUMQ0QVm.js";import{C as d}from"./CacheActionBadge-CK7JdKoE.js";function y({data:e}){const t=[e.lens_entry_id?{label:"Request",value:a.jsx(s,{to:`${i(r()).REQUESTS}/${e.lens_entry_id}`,className:"text-blue-600 hover:underline font-semibold",children:"View Request"}),className:"text-gray-900 dark:text-gray-100"}:null,{label:"Operation",value:a.jsx(d,{action:e.data.action}),className:"text-gray-900 dark:text-gray-100"},e.data.data.key?{label:"Key",value:e.data.data.key??"__",className:"text-gray-900 dark:text-gray-100"}:null].filter(l=>!!l);return a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx(n,{title:"Details",items:t}),a.jsx(o,{tabs:[{id:"value",label:"Value",shouldShow:!!e.data.data.value,content:a.jsx(u,{data:e.data.data.value})}],defaultActiveTab:"value"})]})}export{y as default};
1
+ import{j as a,L as s,q as i,k as r}from"./index-ymy5EHnx.js";import{D as n,T as o,J as u}from"./TabbedDataViewer-Cj9wJA8v.js";import{C as d}from"./CacheActionBadge-DhWgzJKU.js";function y({data:e}){const t=[e.lens_entry_id?{label:"Request",value:a.jsx(s,{to:`${i(r()).REQUESTS}/${e.lens_entry_id}`,className:"text-blue-600 hover:underline font-semibold",children:"View Request"}),className:"text-gray-900 dark:text-gray-100"}:null,{label:"Operation",value:a.jsx(d,{action:e.data.action}),className:"text-gray-900 dark:text-gray-100"},e.data.data.key?{label:"Key",value:e.data.data.key??"__",className:"text-gray-900 dark:text-gray-100"}:null].filter(l=>!!l);return a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx(n,{title:"Details",items:t}),a.jsx(o,{tabs:[{id:"value",label:"Value",shouldShow:!!e.data.data.value,content:a.jsx(u,{data:e.data.data.value})}],defaultActiveTab:"value"})]})}export{y as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CacheEntryDetails-BUZc5j1q.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./TabbedDataViewer-Cj9wJA8v.js","./CacheActionBadge-DhWgzJKU.js"])))=>i.map(i=>d[i]);
2
+ import{m as o,r as s,j as r,_ as i}from"./index-ymy5EHnx.js";import{u as m}from"./useCacheEntries-C5Y3eu1s.js";import"./useLensApi-ufHx5Ujl.js";const n=s.lazy(()=>i(()=>import("./CacheEntryDetails-BUZc5j1q.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),E=()=>{const{item:e,getItem:a}=m(),{id:t}=o();return s.useEffect(()=>{t&&a(t)},[t]),r.jsx("div",{children:e&&r.jsx(n,{data:e})})};export{E as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExceptionTable-D9KqPbq2.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./LoadMore-CG1d6vXW.js","./Table-B7P54I_5.js","./columns-DpE4hBXR.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as s,_ as a}from"./index-ymy5EHnx.js";import{u as i}from"./useLoadMore-dVvcuWYt.js";import{u as m}from"./useExceptions-CN6DxiEv.js";import"./useLensApi-ufHx5Ujl.js";const n=t.lazy(()=>a(()=>import("./ExceptionTable-D9KqPbq2.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),_=()=>{const{loadMoreItems:e,getItems:o}=m(),r=i({paginatedPage:e});return t.useEffect(()=>{o()},[]),s.jsx(n,{hasMoreObject:r})};export{_ as default};
@@ -1,4 +1,4 @@
1
- import{o as g,j as e,L as j,q as N,k as v}from"./index-PEcJ5nx0.js";import{D as w,T as S}from"./TabbedDataViewer-BUMQ0QVm.js";/**
1
+ import{o as g,j as e,L as j,q as N,k as v}from"./index-ymy5EHnx.js";import{D as w,T as S}from"./TabbedDataViewer-Cj9wJA8v.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExceptionDetails-OVDydGbv.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./TabbedDataViewer-Cj9wJA8v.js"])))=>i.map(i=>d[i]);
2
+ import{m as a,r as s,j as r,_ as i}from"./index-ymy5EHnx.js";import{u as m}from"./useExceptions-CN6DxiEv.js";import"./useLensApi-ufHx5Ujl.js";const n=s.lazy(()=>i(()=>import("./ExceptionDetails-OVDydGbv.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),x=()=>{const{item:e,getItem:o}=m(),{id:t}=a();return s.useEffect(()=>{t&&o(t)},[t]),r.jsx("div",{children:e&&r.jsx(n,{data:e})})};export{x as default};
@@ -1 +1 @@
1
- import{j as a}from"./index-PEcJ5nx0.js";import{L as s}from"./LoadMore-CJh7FLbl.js";import{T as t}from"./Table-BesHc4Lc.js";import{g as r}from"./columns-C1CwS8yE.js";import"./index-BRRKsoNv.js";const d=({hasMoreObject:o})=>a.jsxs("div",{className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsx(t,{columns:r(),data:o.data})}),a.jsx(s,{paginatedPage:o})]});export{d as default};
1
+ import{j as a}from"./index-ymy5EHnx.js";import{L as s}from"./LoadMore-CG1d6vXW.js";import{T as t}from"./Table-B7P54I_5.js";import{g as r}from"./columns-DpE4hBXR.js";import"./index-BRRKsoNv.js";const d=({hasMoreObject:o})=>a.jsxs("div",{className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsx(t,{columns:r(),data:o.data})}),a.jsx(s,{paginatedPage:o})]});export{d as default};
@@ -1 +1 @@
1
- import{j as o}from"./index-PEcJ5nx0.js";import{t}from"./Table-BesHc4Lc.js";function n({paginatedPage:r}){return r.hasMore?o.jsx("div",{className:"flex justify-center p-4",children:o.jsx("button",{onClick:r.loadMore,disabled:r.loading,className:t("px-4 py-2 rounded-md bg-gray-200 text-gray-800 dark:bg-neutral-800 dark:text-white text-sm hover:bg-gray-300 dark:hover:bg-neutral-700 transition-colors",r.loading&&"opacity-50 cursor-not-allowed"),children:r.loading?"Loading...":"Load More"})}):null}export{n as L};
1
+ import{j as o}from"./index-ymy5EHnx.js";import{t}from"./Table-B7P54I_5.js";function n({paginatedPage:r}){return r.hasMore?o.jsx("div",{className:"flex justify-center p-4",children:o.jsx("button",{onClick:r.loadMore,disabled:r.loading,className:t("px-4 py-2 rounded-md bg-gray-200 text-gray-800 dark:bg-neutral-800 dark:text-white text-sm hover:bg-gray-300 dark:hover:bg-neutral-700 transition-colors",r.loading&&"opacity-50 cursor-not-allowed"),children:r.loading?"Loading...":"Load More"})}):null}export{n as L};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./QueryTable-WVYW33VB.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./LoadMore-CG1d6vXW.js","./Table-B7P54I_5.js","./columns-T9b-fLbu.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,j as s,_ as a}from"./index-ymy5EHnx.js";import{u as i}from"./useQueries-BsRJ7RGS.js";import{u}from"./useLoadMore-dVvcuWYt.js";import"./useLensApi-ufHx5Ujl.js";const m=e.lazy(()=>a(()=>import("./QueryTable-WVYW33VB.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),f=()=>{const{loadMoreRequests:r,fetchQueries:t}=i(),o=u({paginatedPage:r});return e.useEffect(()=>{t()},[]),s.jsx(m,{hasMoreObject:o})};export{f as default};
@@ -1,4 +1,4 @@
1
- import{o as zt,j as N,r as D,L as Ht,q as Jt,k as Zt,m as te}from"./index-PEcJ5nx0.js";import{u as ee}from"./useQueries-DJE91mYq.js";import{D as ie,T as se}from"./TabbedDataViewer-BUMQ0QVm.js";import{f as ne}from"./index-BRRKsoNv.js";import"./useLensApi-BsDmB7vx.js";function _e(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}/**
1
+ import{o as zt,j as N,r as D,L as Ht,q as Jt,k as Zt,m as te}from"./index-ymy5EHnx.js";import{u as ee}from"./useQueries-BsRJ7RGS.js";import{D as ie,T as se}from"./TabbedDataViewer-Cj9wJA8v.js";import{f as ne}from"./index-BRRKsoNv.js";import"./useLensApi-ufHx5Ujl.js";function _e(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as a}from"./index-PEcJ5nx0.js";import{L as s}from"./LoadMore-CJh7FLbl.js";import{T as r}from"./Table-BesHc4Lc.js";import{g as t}from"./columns-CULxhcpY.js";import"./index-BRRKsoNv.js";const n=({hasMoreObject:o})=>a.jsxs("div",{className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsx(r,{columns:t(),data:o.data})}),a.jsx(s,{paginatedPage:o})]});export{n as default};
1
+ import{j as a}from"./index-ymy5EHnx.js";import{L as s}from"./LoadMore-CG1d6vXW.js";import{T as r}from"./Table-B7P54I_5.js";import{g as t}from"./columns-T9b-fLbu.js";import"./index-BRRKsoNv.js";const n=({hasMoreObject:o})=>a.jsxs("div",{className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsx(r,{columns:t(),data:o.data})}),a.jsx(s,{paginatedPage:o})]});export{n as default};
@@ -0,0 +1 @@
1
+ import{r as n,j as e}from"./index-ymy5EHnx.js";import{D as r,T as o}from"./TabbedDataViewer-Cj9wJA8v.js";import{T as d}from"./Table-B7P54I_5.js";import{g as i}from"./columns-T9b-fLbu.js";import{g as m}from"./columns-DpE4hBXR.js";import{g as u}from"./columns-yzAlNtNs.js";import{f as c}from"./index-BRRKsoNv.js";import{R as x,S as b}from"./StatusCode-1rRaEP-3.js";import"./CacheActionBadge-DhWgzJKU.js";const h=({request:a})=>{const t=n.useMemo(()=>c(a?.request.data?.createdAt),[a?.request.data.createdAt]);if(!a||!a.request)return e.jsx(r,{title:"Request Details",items:[],emptyMessage:"No request data available"});const s=()=>a?.request.data?.headers?.host||"Unknown",l=n.useMemo(()=>[{label:"Time",value:t,className:"text-gray-900 dark:text-gray-100"},{label:"Hostname",value:s(),className:"text-gray-900 dark:text-gray-100 font-mono"},{label:"Method",value:a.request.data.method?e.jsx(x,{method:a.request.data.method}):"Unknown"},{label:"Request ID",value:a.request.data.id||"N/A",className:"text-gray-700 dark:text-gray-300 font-mono text-sm"},{label:"Path",value:a.request.data.path||"N/A",className:"text-gray-900 dark:text-gray-100 font-mono"},{label:"Status",value:a.request.data.status?e.jsx(b,{status:a.request.data.status}):"N/A"},{label:"Duration",value:a.request.data.duration||"N/A",className:"text-gray-900 dark:text-gray-100 font-medium"},{label:"IP Address",value:a.request.data.ip||"N/A",className:"text-gray-900 dark:text-gray-100 font-mono"}],[a.request.data,t]);return e.jsx(r,{title:"Request Details",items:l})},A=({request:a})=>{const t=[{id:"payload",label:"Payload",data:a?.request?.data?.body},{id:"headers",label:"Headers",data:a?.request?.data?.headers}],s=[{id:"response-body",label:"Body",data:a?.request?.data?.response?.json},{id:"response-headers",label:"Headers",data:a?.request?.data?.response?.headers}],l=[{id:"request-queries",label:`Queries (${a?.queries?.length})`,shouldShow:a?.queries?.length>0,content:e.jsx(d,{columns:i(),data:a?.queries})},{id:"request-cache",label:`Cache (${a?.cacheEntries.length})`,shouldShow:a?.cacheEntries.length>0,content:e.jsx(d,{columns:u(),data:a?.cacheEntries})},{id:"request-exceptions",label:`Exceptions (${a.exceptions.length})`,shouldShow:a.exceptions.length>0,content:e.jsx(d,{columns:m(),data:a.exceptions})}];return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(h,{request:a}),a?.request?.data?.user&&e.jsx(r,{title:"User",items:[{label:"ID",value:a?.request?.data?.user?.id},{label:"Email",value:a?.request?.data?.user?.email},{label:"Name",value:a?.request?.data?.user?.name}]}),e.jsx(o,{tabs:t,title:"Request Data",defaultActiveTab:"payload"}),e.jsx(o,{tabs:s,title:"Response Data",defaultActiveTab:"response-body"}),e.jsx(o,{tabs:l})]})};export{A as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequestDetails-CYSM4og8.js","./index-PEcJ5nx0.js","./index-B2QCOgug.css","./TabbedDataViewer-BUMQ0QVm.js","./Table-BesHc4Lc.js","./columns-CULxhcpY.js","./index-BRRKsoNv.js","./columns-C1CwS8yE.js","./columns-gYFQU5qH.js","./CacheActionBadge-CK7JdKoE.js","./StatusCode-C5lihzKZ.js"])))=>i.map(i=>d[i]);
2
- import{S as V,p as k,a as l,s as w,b as y,n as x,i as I,c as L,t as W,f as $,d as K,e as j,g as H,r as p,h as N,u as J,k as G,l as X,m as Y,j as T,_ as Z}from"./index-PEcJ5nx0.js";var tt=class extends V{constructor(t,e){super(),this.options=e,this.#s=t,this.#r=null,this.#i=k(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#n;#c;#i;#r;#R;#l;#d;#o;#h;#a;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),A(this.#t,this.options)?this.#u():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Q(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Q(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#C(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!w(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&B(this.#t,s,this.options,e)&&this.#u(),this.updateResult(),i&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const a=this.#v();i&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||a!==this.#a)&&this.#m(a)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return st(this,s)&&(this.#e=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),i==="promise"&&!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,i))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#u({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#u(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(x)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(I||this.#e.isStale||!L(t))return;const s=W(this.#e.dataUpdatedAt,t)+1;this.#o=setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#C(),this.#a=t,!(I||l(this.options.enabled,this.#t)===!1||!L(this.#a)||this.#a===0)&&(this.#h=setInterval(()=>{(this.options.refetchIntervalInBackground||$.isFocused())&&this.#u()},this.#a))}#y(){this.#b(),this.#m(this.#v())}#g(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}#C(){this.#h&&(clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,i=this.options,a=this.#e,u=this.#n,r=this.#c,o=t!==s?t.state:this.#p,{state:d}=t;let n={...d},m=!1,h;if(e._optimisticResults){const c=this.hasListeners(),g=!c&&A(t,e),v=c&&B(t,s,e,i);(g||v)&&(n={...n,...K(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:_,errorUpdatedAt:P,status:R}=n;h=n.data;let D=!1;if(e.placeholderData!==void 0&&h===void 0&&R==="pending"){let c;a?.isPlaceholderData&&e.placeholderData===r?.placeholderData?(c=a.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(R="success",h=j(a?.data,c,e),m=!0)}if(e.select&&h!==void 0&&!D)if(a&&h===u?.data&&e.select===this.#R)h=this.#l;else try{this.#R=e.select,h=e.select(h),h=j(a?.data,h,e),this.#l=h,this.#r=null}catch(c){this.#r=c}this.#r&&(_=this.#r,h=this.#l,P=Date.now(),R="error");const O=n.fetchStatus==="fetching",S=R==="pending",E=R==="error",U=S&&O,M=h!==void 0,f={status:R,fetchStatus:n.fetchStatus,isPending:S,isSuccess:R==="success",isError:E,isInitialLoading:U,isLoading:U,data:h,dataUpdatedAt:n.dataUpdatedAt,error:_,errorUpdatedAt:P,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>o.dataUpdateCount||n.errorUpdateCount>o.errorUpdateCount,isFetching:O,isRefetching:O&&!S,isLoadingError:E&&!M,isPaused:n.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:E&&M,isStale:F(t,e),refetch:this.refetch,promise:this.#i,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=C=>{f.status==="error"?C.reject(f.error):f.data!==void 0&&C.resolve(f.data)},g=()=>{const C=this.#i=f.promise=k();c(C)},v=this.#i;switch(v.status){case"pending":t.queryHash===s.queryHash&&c(v);break;case"fulfilled":(f.status==="error"||f.data!==v.value)&&g();break;case"rejected":(f.status!=="error"||f.error!==v.reason)&&g();break}}return f}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#d=this.#t),w(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!this.#f.size)return!0;const u=new Set(a??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(r=>{const b=r;return this.#e[b]!==t[b]&&u.has(b)})};this.#S({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#S(t){H.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function et(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function A(t,e){return et(t,e)||t.state.data!==void 0&&Q(t,e,e.refetchOnMount)}function Q(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&F(t,e)}return!1}function B(t,e,s,i){return(t!==e||l(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&F(t,s)}function F(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function st(t,e){return!w(t.getCurrentResult(),e)}var z=p.createContext(!1),it=()=>p.useContext(z);z.Provider;function rt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var at=p.createContext(rt()),nt=()=>p.useContext(at),ot=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},ht=t=>{p.useEffect(()=>{t.clearReset()},[t])},ut=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(a&&t.data===void 0||N(s,[t.error,i])),ct=t=>{if(t.suspense){const e=i=>i==="static"?i:Math.max(i??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...i)=>e(s(...i)):e(s),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},lt=(t,e)=>t.isLoading&&t.isFetching&&!e,dt=(t,e)=>t?.suspense&&e.isPending,q=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function ft(t,e,s){const i=it(),a=nt(),u=J(),r=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(r),r._optimisticResults=i?"isRestoring":"optimistic",ct(r),ot(r,a),ht(a);const b=!u.getQueryCache().get(r.queryHash),[o]=p.useState(()=>new e(u,r)),d=o.getOptimisticResult(r),n=!i&&t.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(m=>{const h=n?o.subscribe(H.batchCalls(m)):x;return o.updateResult(),h},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),p.useEffect(()=>{o.setOptions(r)},[r,o]),dt(r,d))throw q(r,o,a);if(ut({result:d,errorResetBoundary:a,throwOnError:r.throwOnError,query:u.getQueryCache().get(r.queryHash),suspense:r.suspense}))throw d.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(r,d),r.experimental_prefetchInRender&&!I&&lt(d,i)&&(b?q(r,o,a):u.getQueryCache().get(r.queryHash)?.promise)?.catch(x).finally(()=>{o.updateResult()}),r.notifyOnChangeProps?d:o.trackResult(d)}function pt(t,e){return ft(t,tt)}async function Rt(t,e){const s=await fetch(t,{headers:{"Content-Type":"application/json"},...e});if(!s.ok)throw new Error(`Failed to fetch: ${t}`);return s.json()}function bt(t,e){const s=G();return pt({queryKey:["request",t],queryFn:async()=>await Rt(X(`${s.api.requests}/${t}`)),enabled:!!t,...e})}const vt=p.lazy(()=>Z(()=>import("./RequestDetails-CYSM4og8.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),gt=()=>{const{id:t}=Y(),{data:e}=bt(t);return T.jsx(T.Fragment,{children:e?.data&&T.jsx(vt,{request:e?.data})})};export{gt as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequestDetails-BIY8CWBr.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./TabbedDataViewer-Cj9wJA8v.js","./Table-B7P54I_5.js","./columns-T9b-fLbu.js","./index-BRRKsoNv.js","./columns-DpE4hBXR.js","./columns-yzAlNtNs.js","./CacheActionBadge-DhWgzJKU.js","./StatusCode-1rRaEP-3.js"])))=>i.map(i=>d[i]);
2
+ import{S as V,p as k,a as l,s as w,b as y,n as x,i as I,c as L,t as W,f as $,d as K,e as j,g as H,r as p,h as N,u as J,k as G,l as X,m as Y,j as T,_ as Z}from"./index-ymy5EHnx.js";var tt=class extends V{constructor(t,e){super(),this.options=e,this.#s=t,this.#r=null,this.#i=k(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#n;#c;#i;#r;#R;#l;#d;#o;#h;#a;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),A(this.#t,this.options)?this.#u():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Q(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Q(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#C(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!w(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&B(this.#t,s,this.options,e)&&this.#u(),this.updateResult(),i&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const a=this.#v();i&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||a!==this.#a)&&this.#m(a)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return st(this,s)&&(this.#e=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),i==="promise"&&!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,i))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#u({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#u(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(x)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(I||this.#e.isStale||!L(t))return;const s=W(this.#e.dataUpdatedAt,t)+1;this.#o=setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#C(),this.#a=t,!(I||l(this.options.enabled,this.#t)===!1||!L(this.#a)||this.#a===0)&&(this.#h=setInterval(()=>{(this.options.refetchIntervalInBackground||$.isFocused())&&this.#u()},this.#a))}#y(){this.#b(),this.#m(this.#v())}#g(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}#C(){this.#h&&(clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,i=this.options,a=this.#e,u=this.#n,r=this.#c,o=t!==s?t.state:this.#p,{state:d}=t;let n={...d},m=!1,h;if(e._optimisticResults){const c=this.hasListeners(),g=!c&&A(t,e),v=c&&B(t,s,e,i);(g||v)&&(n={...n,...K(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:_,errorUpdatedAt:P,status:R}=n;h=n.data;let D=!1;if(e.placeholderData!==void 0&&h===void 0&&R==="pending"){let c;a?.isPlaceholderData&&e.placeholderData===r?.placeholderData?(c=a.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(R="success",h=j(a?.data,c,e),m=!0)}if(e.select&&h!==void 0&&!D)if(a&&h===u?.data&&e.select===this.#R)h=this.#l;else try{this.#R=e.select,h=e.select(h),h=j(a?.data,h,e),this.#l=h,this.#r=null}catch(c){this.#r=c}this.#r&&(_=this.#r,h=this.#l,P=Date.now(),R="error");const O=n.fetchStatus==="fetching",S=R==="pending",E=R==="error",U=S&&O,M=h!==void 0,f={status:R,fetchStatus:n.fetchStatus,isPending:S,isSuccess:R==="success",isError:E,isInitialLoading:U,isLoading:U,data:h,dataUpdatedAt:n.dataUpdatedAt,error:_,errorUpdatedAt:P,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>o.dataUpdateCount||n.errorUpdateCount>o.errorUpdateCount,isFetching:O,isRefetching:O&&!S,isLoadingError:E&&!M,isPaused:n.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:E&&M,isStale:F(t,e),refetch:this.refetch,promise:this.#i,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=C=>{f.status==="error"?C.reject(f.error):f.data!==void 0&&C.resolve(f.data)},g=()=>{const C=this.#i=f.promise=k();c(C)},v=this.#i;switch(v.status){case"pending":t.queryHash===s.queryHash&&c(v);break;case"fulfilled":(f.status==="error"||f.data!==v.value)&&g();break;case"rejected":(f.status!=="error"||f.error!==v.reason)&&g();break}}return f}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#d=this.#t),w(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!this.#f.size)return!0;const u=new Set(a??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(r=>{const b=r;return this.#e[b]!==t[b]&&u.has(b)})};this.#S({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#S(t){H.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function et(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function A(t,e){return et(t,e)||t.state.data!==void 0&&Q(t,e,e.refetchOnMount)}function Q(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&F(t,e)}return!1}function B(t,e,s,i){return(t!==e||l(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&F(t,s)}function F(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function st(t,e){return!w(t.getCurrentResult(),e)}var z=p.createContext(!1),it=()=>p.useContext(z);z.Provider;function rt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var at=p.createContext(rt()),nt=()=>p.useContext(at),ot=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},ht=t=>{p.useEffect(()=>{t.clearReset()},[t])},ut=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(a&&t.data===void 0||N(s,[t.error,i])),ct=t=>{if(t.suspense){const e=i=>i==="static"?i:Math.max(i??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...i)=>e(s(...i)):e(s),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},lt=(t,e)=>t.isLoading&&t.isFetching&&!e,dt=(t,e)=>t?.suspense&&e.isPending,q=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function ft(t,e,s){const i=it(),a=nt(),u=J(),r=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(r),r._optimisticResults=i?"isRestoring":"optimistic",ct(r),ot(r,a),ht(a);const b=!u.getQueryCache().get(r.queryHash),[o]=p.useState(()=>new e(u,r)),d=o.getOptimisticResult(r),n=!i&&t.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(m=>{const h=n?o.subscribe(H.batchCalls(m)):x;return o.updateResult(),h},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),p.useEffect(()=>{o.setOptions(r)},[r,o]),dt(r,d))throw q(r,o,a);if(ut({result:d,errorResetBoundary:a,throwOnError:r.throwOnError,query:u.getQueryCache().get(r.queryHash),suspense:r.suspense}))throw d.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(r,d),r.experimental_prefetchInRender&&!I&&lt(d,i)&&(b?q(r,o,a):u.getQueryCache().get(r.queryHash)?.promise)?.catch(x).finally(()=>{o.updateResult()}),r.notifyOnChangeProps?d:o.trackResult(d)}function pt(t,e){return ft(t,tt)}async function Rt(t,e){const s=await fetch(t,{headers:{"Content-Type":"application/json"},...e});if(!s.ok)throw new Error(`Failed to fetch: ${t}`);return s.json()}function bt(t,e){const s=G();return pt({queryKey:["request",t],queryFn:async()=>await Rt(X(`${s.api.requests}/${t}`)),enabled:!!t,...e})}const vt=p.lazy(()=>Z(()=>import("./RequestDetails-BIY8CWBr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),gt=()=>{const{id:t}=Y(),{data:e}=bt(t);return T.jsx(T.Fragment,{children:e?.data&&T.jsx(vt,{request:e?.data})})};export{gt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequetsTable-Cgas07Fe.js","./index-PEcJ5nx0.js","./index-B2QCOgug.css","./LoadMore-CJh7FLbl.js","./Table-BesHc4Lc.js","./StatusCode-C5lihzKZ.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
2
- import{r as e,j as p,_ as m}from"./index-PEcJ5nx0.js";import{D as h,u as _}from"./useLensApi-BsDmB7vx.js";import{u as E}from"./useLoadMore-sLsrekV5.js";const y={queries:[],cacheEntries:[],exceptions:[],request:{created_at:"",data:{body:{},createdAt:"",duration:"",headers:{},id:"",ip:"",method:"GET",path:"",response:{headers:{},json:{}},status:0,user:null},id:"",lens_entry_id:null,type:"request"}};function M(){const[t,o]=e.useState([]),[r,d]=e.useState(y),[c,s]=e.useState(!1),[i,q]=e.useState(h),{getAllRequests:a,getRequestById:l}=_(),f=e.useCallback(async n=>{s(!0),l(n).then(u=>{d({request:u.data,queries:[],cacheEntries:[],exceptions:[]})}).finally(()=>{s(!1)})},[l]),R=e.useCallback(async n=>{s(!0),a(n).then(u=>{o(u.data),q(u.meta)}).finally(()=>{s(!1)})},[a]);return{loadMoreRequests:e.useMemo(()=>({initialData:t,meta:i,loading:c,fetchRawPage:a}),[t,i,c,a]),fetchRequests:R,fetchRequest:f,request:r}}const g=e.lazy(()=>m(()=>import("./RequetsTable-Cgas07Fe.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),L=()=>{const{loadMoreRequests:t,fetchRequests:o}=M(),r=E({paginatedPage:t});return e.useEffect(()=>{o()},[]),p.jsx(g,{hasMoreObject:r})};export{L as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequetsTable-C0uox4Jg.js","./index-ymy5EHnx.js","./index-B2QCOgug.css","./LoadMore-CG1d6vXW.js","./Table-B7P54I_5.js","./StatusCode-1rRaEP-3.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,j as p,_ as m}from"./index-ymy5EHnx.js";import{D as h,u as _}from"./useLensApi-ufHx5Ujl.js";import{u as E}from"./useLoadMore-dVvcuWYt.js";const y={queries:[],cacheEntries:[],exceptions:[],request:{created_at:"",data:{body:{},createdAt:"",duration:"",headers:{},id:"",ip:"",method:"GET",path:"",response:{headers:{},json:{}},status:0,user:null},id:"",lens_entry_id:null,type:"request"}};function M(){const[t,o]=e.useState([]),[r,d]=e.useState(y),[c,s]=e.useState(!1),[i,q]=e.useState(h),{getAllRequests:a,getRequestById:l}=_(),f=e.useCallback(async n=>{s(!0),l(n).then(u=>{d({request:u.data,queries:[],cacheEntries:[],exceptions:[]})}).finally(()=>{s(!1)})},[l]),R=e.useCallback(async n=>{s(!0),a(n).then(u=>{o(u.data),q(u.meta)}).finally(()=>{s(!1)})},[a]);return{loadMoreRequests:e.useMemo(()=>({initialData:t,meta:i,loading:c,fetchRawPage:a}),[t,i,c,a]),fetchRequests:R,fetchRequest:f,request:r}}const g=e.lazy(()=>m(()=>import("./RequetsTable-C0uox4Jg.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),L=()=>{const{loadMoreRequests:t,fetchRequests:o}=M(),r=E({paginatedPage:t});return e.useEffect(()=>{o()},[]),p.jsx(g,{hasMoreObject:r})};export{L as default};
@@ -1 +1 @@
1
- import{q as o,k as d,j as e,L as s}from"./index-PEcJ5nx0.js";import{L as i}from"./LoadMore-CJh7FLbl.js";import{C as m,T as u}from"./Table-BesHc4Lc.js";import{R as l,S as x}from"./StatusCode-C5lihzKZ.js";import{h as c}from"./index-BRRKsoNv.js";const h=()=>{const a=o(d());return[{name:"Method",render:t=>e.jsx(l,{method:t.data.method})},{name:"Path",render:t=>e.jsx(s,{to:`${a.REQUESTS}/${t.id}`,className:"line-clamp-2 max-w-80 min-w-40 text-base text-blue-600 dark:text-neutral-200 hover:underline",children:t.data.path})},{name:"Status",render:t=>e.jsx(x,{status:t.data.status})},{name:"Duration",value:t=>t.data.duration},{name:"Happened",render:t=>{const{label:n,exact:r}=c(t.data.createdAt);return e.jsx("span",{title:r,children:n})},position:"end",class:"min-w-32"},{name:"Actions",render:t=>e.jsx(s,{to:`${a.REQUESTS}/${t.id}`,className:"transition-colors duration-100 hover:text-white",children:e.jsx(m,{size:20})}),position:"end"}]},S=({hasMoreObject:a})=>e.jsxs("div",{children:[e.jsx(u,{columns:h(),data:a.data}),e.jsx(i,{paginatedPage:a})]});export{S as default};
1
+ import{q as o,k as d,j as e,L as s}from"./index-ymy5EHnx.js";import{L as i}from"./LoadMore-CG1d6vXW.js";import{C as m,T as u}from"./Table-B7P54I_5.js";import{R as l,S as x}from"./StatusCode-1rRaEP-3.js";import{h as c}from"./index-BRRKsoNv.js";const h=()=>{const a=o(d());return[{name:"Method",render:t=>e.jsx(l,{method:t.data.method})},{name:"Path",render:t=>e.jsx(s,{to:`${a.REQUESTS}/${t.id}`,className:"line-clamp-2 max-w-80 min-w-40 text-base text-blue-600 dark:text-neutral-200 hover:underline",children:t.data.path})},{name:"Status",render:t=>e.jsx(x,{status:t.data.status})},{name:"Duration",value:t=>t.data.duration},{name:"Happened",render:t=>{const{label:n,exact:r}=c(t.data.createdAt);return e.jsx("span",{title:r,children:n})},position:"end",class:"min-w-32"},{name:"Actions",render:t=>e.jsx(s,{to:`${a.REQUESTS}/${t.id}`,className:"transition-colors duration-100 hover:text-white",children:e.jsx(m,{size:20})}),position:"end"}]},S=({hasMoreObject:a})=>e.jsxs("div",{children:[e.jsx(u,{columns:h(),data:a.data}),e.jsx(i,{paginatedPage:a})]});export{S as default};
@@ -1 +1 @@
1
- import{j as r}from"./index-PEcJ5nx0.js";function g({method:e}){const t={GET:"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white",POST:"bg-blue-100 text-blue-800 dark:bg-blue-600 dark:text-white",PUT:"bg-yellow-100 text-yellow-800 dark:bg-yellow-600 dark:text-white",DELETE:"bg-red-100 text-red-800 dark:bg-red-600 dark:text-white"};return r.jsx("span",{className:`rounded px-2 py-1 text-sm font-semibold ${t[e.toUpperCase()]||"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white"}`,children:e})}const d=e=>e>=200&&e<300?"bg-green-100 text-green-800 dark:bg-green-700 dark:text-green-100":e>=300&&e<400?"bg-blue-100 text-blue-800 dark:bg-blue-700 dark:text-blue-100":e>=400&&e<500?"bg-yellow-100 text-yellow-800 dark:bg-yellow-700 dark:text-yellow-100":e>=500?"bg-red-100 text-red-800 dark:bg-red-700 dark:text-red-100":"bg-gray-100 text-gray-800 dark:bg-neutral-700 dark:text-neutral-200",l=({status:e})=>r.jsx("span",{className:`rounded-lg px-2 py-1 text-sm font-semibold ${d(e)}`,children:e});export{g as R,l as S};
1
+ import{j as r}from"./index-ymy5EHnx.js";function g({method:e}){const t={GET:"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white",POST:"bg-blue-100 text-blue-800 dark:bg-blue-600 dark:text-white",PUT:"bg-yellow-100 text-yellow-800 dark:bg-yellow-600 dark:text-white",DELETE:"bg-red-100 text-red-800 dark:bg-red-600 dark:text-white"};return r.jsx("span",{className:`rounded px-2 py-1 text-sm font-semibold ${t[e.toUpperCase()]||"bg-gray-100 text-gray-800 dark:bg-gray-600 dark:text-white"}`,children:e})}const d=e=>e>=200&&e<300?"bg-green-100 text-green-800 dark:bg-green-700 dark:text-green-100":e>=300&&e<400?"bg-blue-100 text-blue-800 dark:bg-blue-700 dark:text-blue-100":e>=400&&e<500?"bg-yellow-100 text-yellow-800 dark:bg-yellow-700 dark:text-yellow-100":e>=500?"bg-red-100 text-red-800 dark:bg-red-700 dark:text-red-100":"bg-gray-100 text-gray-800 dark:bg-neutral-700 dark:text-neutral-200",l=({status:e})=>r.jsx("span",{className:`rounded-lg px-2 py-1 text-sm font-semibold ${d(e)}`,children:e});export{g as R,l as S};