@lensjs/core 1.0.7 → 1.0.10

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 (100) hide show
  1. package/dist/abstracts/adapter.cjs +70 -5
  2. package/dist/abstracts/adapter.js +37 -5
  3. package/dist/abstracts/store.cjs +26 -6
  4. package/dist/abstracts/store.js +3 -4
  5. package/dist/context/container.cjs +57 -6
  6. package/dist/context/container.js +34 -4
  7. package/dist/context/context.cjs +71 -7
  8. package/dist/context/context.js +42 -6
  9. package/dist/core/api_controller.cjs +148 -7
  10. package/dist/core/api_controller.js +121 -7
  11. package/dist/core/lens.cjs +404 -12
  12. package/dist/core/lens.js +370 -12
  13. package/dist/core/watcher.cjs +26 -6
  14. package/dist/core/watcher.js +3 -4
  15. package/dist/{index-D0Vszdac.d.ts → index-DiLfwsvc.d.cts} +2 -11
  16. package/dist/{index-D0Vszdac.d.cts → index-DiLfwsvc.d.ts} +2 -11
  17. package/dist/index.cjs +611 -55
  18. package/dist/index.d.cts +2 -4
  19. package/dist/index.d.ts +2 -4
  20. package/dist/index.js +556 -42
  21. package/dist/stores/better_sqlite.cjs +149 -7
  22. package/dist/stores/better_sqlite.js +116 -7
  23. package/dist/stores/index.cjs +153 -8
  24. package/dist/stores/index.js +116 -8
  25. package/dist/types/index.cjs +33 -6
  26. package/dist/types/index.js +6 -4
  27. package/dist/ui/assets/QueriesContainer-CAAsjjW5.js +2 -0
  28. package/dist/ui/assets/{QueryDetailsContainer-BkaktbOw.js → QueryDetailsContainer-E7P-IO7f.js} +19 -19
  29. package/dist/ui/assets/QueryTable-BcrtUssT.js +1 -0
  30. package/dist/ui/assets/RequestDetails-C2DZBu5H.js +1 -0
  31. package/dist/ui/assets/RequestDetailsContainer-DuDo-IqS.js +2 -0
  32. package/dist/ui/assets/{RequestsContainer-zoWMoB7o.js → RequestsContainer-DK3hQVz9.js} +2 -2
  33. package/dist/ui/assets/RequetsTable-DgP8p60b.js +1 -0
  34. package/dist/ui/assets/{StatusCode-DH20lQ6a.js → StatusCode-FQEjz7gK.js} +1 -1
  35. package/dist/ui/assets/TabbedDataViewer-cBDdPwIz.js +1 -0
  36. package/dist/ui/assets/{Table-HwlddLhp.js → Table-DYaXk80S.js} +2 -2
  37. package/dist/ui/assets/index-BS8XxorB.js +114 -0
  38. package/dist/ui/assets/index-CpP2Ap5X.js +1 -0
  39. package/dist/ui/assets/index-DzNHqeKh.css +1 -0
  40. package/dist/ui/assets/{useLensApi-Bmk2bGb0.js → useLensApi-DG6atd6d.js} +1 -1
  41. package/dist/ui/assets/{useLoadMore-CvIajdjM.js → useLoadMore-CJltToLI.js} +1 -1
  42. package/dist/ui/assets/{useQueries-DuyhGJyf.js → useQueries-C8mDDDc6.js} +1 -1
  43. package/dist/ui/index.html +2 -2
  44. package/dist/utils/event_emitter.cjs +42 -10
  45. package/dist/utils/event_emitter.d.cts +1 -11
  46. package/dist/utils/event_emitter.d.ts +1 -11
  47. package/dist/utils/event_emitter.js +6 -9
  48. package/dist/utils/index.cjs +163 -31
  49. package/dist/utils/index.d.cts +1 -2
  50. package/dist/utils/index.d.ts +1 -2
  51. package/dist/utils/index.js +109 -20
  52. package/dist/watchers/index.cjs +105 -10
  53. package/dist/watchers/index.js +79 -12
  54. package/dist/watchers/query_watcher.cjs +78 -8
  55. package/dist/watchers/query_watcher.js +55 -8
  56. package/dist/watchers/request_watcher.cjs +90 -8
  57. package/dist/watchers/request_watcher.js +67 -8
  58. package/package.json +18 -18
  59. package/README.md +0 -1
  60. package/dist/chunk-2HRVJRKV.cjs +0 -10
  61. package/dist/chunk-3R5QARPT.cjs +0 -14
  62. package/dist/chunk-4HLDYZJA.js +0 -34
  63. package/dist/chunk-5PYQWLAZ.js +0 -129
  64. package/dist/chunk-75ZPJI57.cjs +0 -9
  65. package/dist/chunk-7EKM5HB5.cjs +0 -1
  66. package/dist/chunk-AUDSBNLF.cjs +0 -122
  67. package/dist/chunk-BFFOUTTE.cjs +0 -32
  68. package/dist/chunk-BL4Z6JFH.cjs +0 -34
  69. package/dist/chunk-CQ2Z4TCR.js +0 -7
  70. package/dist/chunk-EHOWCXZV.cjs +0 -7
  71. package/dist/chunk-EJ5BW35V.js +0 -159
  72. package/dist/chunk-EKG3FVLV.cjs +0 -7
  73. package/dist/chunk-FCMQ3WE3.cjs +0 -129
  74. package/dist/chunk-FKMBNWX4.js +0 -7
  75. package/dist/chunk-FLOVBBFU.js +0 -10
  76. package/dist/chunk-GI7SJDNQ.cjs +0 -38
  77. package/dist/chunk-IPMTMCFP.js +0 -122
  78. package/dist/chunk-JZ2JLQXL.cjs +0 -87
  79. package/dist/chunk-MLKGABMK.js +0 -9
  80. package/dist/chunk-QRZUNYF6.cjs +0 -16
  81. package/dist/chunk-RMZ4UAQ2.js +0 -14
  82. package/dist/chunk-SJXZARBJ.cjs +0 -22
  83. package/dist/chunk-TJDE6AZM.js +0 -87
  84. package/dist/chunk-TPUVRGYT.js +0 -32
  85. package/dist/chunk-UF5HFNMI.js +0 -22
  86. package/dist/chunk-VD5IMUWL.js +0 -0
  87. package/dist/chunk-WU6IZUEV.cjs +0 -159
  88. package/dist/chunk-XXYRWHSQ.js +0 -0
  89. package/dist/chunk-XYXPHWEI.js +0 -16
  90. package/dist/chunk-XZFXXD3A.cjs +0 -1
  91. package/dist/chunk-YC6T4XWI.js +0 -38
  92. package/dist/ui/assets/QueriesContainer-DHnHEGG1.js +0 -2
  93. package/dist/ui/assets/QueryTable-DegVNDkJ.js +0 -1
  94. package/dist/ui/assets/RequestDetails-zrL0n6gL.js +0 -1
  95. package/dist/ui/assets/RequestDetailsContainer-CsHWDxn7.js +0 -2
  96. package/dist/ui/assets/RequetsTable-1K9hhs0W.js +0 -1
  97. package/dist/ui/assets/TabbedDataViewer-DDVxzZiW.js +0 -1
  98. package/dist/ui/assets/date-CZdBf-JH.js +0 -1
  99. package/dist/ui/assets/index-C-9tn0L6.js +0 -114
  100. package/dist/ui/assets/index-DaNx3ROH.css +0 -1
@@ -0,0 +1 @@
1
+ import{q as r,k as o,j as e,L as i}from"./index-BS8XxorB.js";import{C as l,T as d,L as c}from"./Table-DYaXk80S.js";import{h as x}from"./index-CpP2Ap5X.js";function m(a){return e.jsx("span",{className:"text-red-600 dark:text-red-400 font-mono",children:a})}const u=()=>{const a=r(o());return[{name:"Query",render:t=>e.jsx("div",{className:"max-w-xl",children:e.jsx("code",{className:"text-sm font-mono text-slate-800 dark:text-slate-300 leading-relaxed line-clamp-1",title:t.data.query,children:m(t.data.query)})})},{name:"Duration",render:t=>e.jsx("div",{className:"col-span-1 text-right",children:e.jsx("span",{className:"text-sm text-slate-600 dark:text-slate-400 font-mono",children:t.data.duration})})},{name:"Provider",render:t=>e.jsx("div",{className:"col-span-2 text-right",children:e.jsx("span",{className:"text-sm text-slate-600 dark:text-slate-400 font-mono",children:t.data.type})})},{name:"Happened",render:t=>{const{label:s,exact:n}=x(t.data.createdAt);return e.jsx("span",{className:"text-nowrap",title:n,children:s})},position:"end",class:"min-w-32"},{name:"Actions",render:t=>e.jsx(i,{to:`${a.QUERIES}/${t.id}`,className:"transition-colors duration-100 hover:text-white",children:e.jsx(l,{size:20})}),position:"end"}]},f=({hasMoreObject:a})=>e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsx(d,{columns:u(),data:a.data})}),e.jsx(c,{paginatedPage:a})]});export{f as default};
@@ -0,0 +1 @@
1
+ import{r as l,j as t}from"./index-BS8XxorB.js";import{D as d,T as o}from"./TabbedDataViewer-cBDdPwIz.js";import{f as m}from"./index-CpP2Ap5X.js";import{M as i,S as n}from"./StatusCode-FQEjz7gK.js";const x=({request:a})=>{const e=l.useMemo(()=>m(a?.data?.createdAt),[a?.data?.createdAt]);if(!a||!a.data)return t.jsx(d,{title:"Request Details",items:[],emptyMessage:"No request data available"});const s=()=>a?.data?.headers?.host||"Unknown",r=l.useMemo(()=>[{label:"Time",value:e,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.data.method?t.jsx(i,{method:a.data.method}):"Unknown"},{label:"Request ID",value:a.data.id||"N/A",className:"text-gray-700 dark:text-gray-300 font-mono text-sm"},{label:"Path",value:a.data.path||"N/A",className:"text-gray-900 dark:text-gray-100 font-mono"},{label:"Status",value:a.data.status?t.jsx(n,{status:a.data.status}):"N/A"},{label:"Duration",value:a.data.duration||"N/A",className:"text-gray-900 dark:text-gray-100 font-medium"},{label:"IP Address",value:a.data.ip||"N/A",className:"text-gray-900 dark:text-gray-100 font-mono"}],[a.data,e]);return t.jsx(d,{title:"Request Details",items:r})},u=({request:a})=>{const e=[{id:"payload",label:"Payload",data:a.data.body},{id:"headers",label:"Headers",data:a.data.headers}],s=[{id:"response-body",label:"Body",data:a.data.response.json},{id:"response-headers",label:"Headers",data:a.data.response.headers}];return t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(x,{request:a}),a.data.user&&t.jsx(d,{title:"User",items:[{label:"ID",value:a?.data?.user?.id},{label:"Email",value:a?.data?.user?.email},{label:"Name",value:a?.data?.user?.name}]}),t.jsx(o,{tabs:e,title:"Request Data",defaultActiveTab:"payload"}),t.jsx(o,{tabs:s,title:"Response Data",defaultActiveTab:"response-body"})]})};export{u as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequestDetails-C2DZBu5H.js","./index-BS8XxorB.js","./index-DzNHqeKh.css","./TabbedDataViewer-cBDdPwIz.js","./index-CpP2Ap5X.js","./StatusCode-FQEjz7gK.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-BS8XxorB.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-C2DZBu5H.js"),__vite__mapDeps([0,1,2,3,4,5]),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-1K9hhs0W.js","./index-C-9tn0L6.js","./index-DaNx3ROH.css","./Table-HwlddLhp.js","./StatusCode-DH20lQ6a.js","./date-CZdBf-JH.js"])))=>i.map(i=>d[i]);
2
- import{r as e,j as m,_ as p}from"./index-C-9tn0L6.js";import{D as _,u as h}from"./useLensApi-Bmk2bGb0.js";import{u as y}from"./useLoadMore-CvIajdjM.js";const E={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,u]=e.useState([]),[n,i]=e.useState(E),[l,s]=e.useState(!1),[c,f]=e.useState(_),{getAllRequests:a,getRequestById:d}=h(),q=e.useCallback(async r=>{s(!0),d(r).then(o=>{i(o.data)}).finally(()=>{s(!1)})},[d]),R=e.useCallback(async r=>{s(!0),a(r).then(o=>{u(o.data),f(o.meta)}).finally(()=>{s(!1)})},[a]);return{loadMoreRequests:e.useMemo(()=>({initialData:t,meta:c,loading:l,fetchRawPage:a}),[t,c,l,a]),fetchRequests:R,fetchRequest:q,request:n}}const g=e.lazy(()=>p(()=>import("./RequetsTable-1K9hhs0W.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),L=()=>{const{loadMoreRequests:t,fetchRequests:u}=M(),n=y({paginatedPage:t});return e.useEffect(()=>{u()},[]),m.jsx(g,{hasMoreObject:n})};export{L as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequetsTable-DgP8p60b.js","./index-BS8XxorB.js","./index-DzNHqeKh.css","./Table-DYaXk80S.js","./StatusCode-FQEjz7gK.js","./index-CpP2Ap5X.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,j as m,_ as p}from"./index-BS8XxorB.js";import{D as _,u as h}from"./useLensApi-DG6atd6d.js";import{u as y}from"./useLoadMore-CJltToLI.js";const E={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,u]=e.useState([]),[n,i]=e.useState(E),[l,s]=e.useState(!1),[c,f]=e.useState(_),{getAllRequests:a,getRequestById:d}=h(),q=e.useCallback(async r=>{s(!0),d(r).then(o=>{i(o.data)}).finally(()=>{s(!1)})},[d]),R=e.useCallback(async r=>{s(!0),a(r).then(o=>{u(o.data),f(o.meta)}).finally(()=>{s(!1)})},[a]);return{loadMoreRequests:e.useMemo(()=>({initialData:t,meta:c,loading:l,fetchRawPage:a}),[t,c,l,a]),fetchRequests:R,fetchRequest:q,request:n}}const g=e.lazy(()=>p(()=>import("./RequetsTable-DgP8p60b.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),L=()=>{const{loadMoreRequests:t,fetchRequests:u}=M(),n=y({paginatedPage:t});return e.useEffect(()=>{u()},[]),m.jsx(g,{hasMoreObject:n})};export{L as default};
@@ -0,0 +1 @@
1
+ import{q as o,k as d,j as e,L as s}from"./index-BS8XxorB.js";import{C as i,T as m,L as l}from"./Table-DYaXk80S.js";import{M as u,S as x}from"./StatusCode-FQEjz7gK.js";import{h as c}from"./index-CpP2Ap5X.js";const h=()=>{const a=o(d());return[{name:"Method",render:t=>e.jsx(u,{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(i,{size:20})}),position:"end"}]},S=({hasMoreObject:a})=>e.jsxs("div",{children:[e.jsx(m,{columns:h(),data:a.data}),e.jsx(l,{paginatedPage:a})]});export{S as default};
@@ -1 +1 @@
1
- import{j as r}from"./index-C-9tn0L6.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 M,l as S};
1
+ import{j as r}from"./index-BS8XxorB.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 M,l as S};
@@ -0,0 +1 @@
1
+ import{j as e,r as b}from"./index-BS8XxorB.js";const f=({title:l,items:d,emptyMessage:c="No data available"})=>!d||d.length===0||d.every(s=>!s.value)?e.jsxs("div",{className:"bg-white dark:bg-neutral-800 border border-gray-200 dark:border-neutral-700 rounded-lg shadow-sm p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:l})," ",e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400",children:c})]}):e.jsxs("div",{className:"bg-white dark:bg-neutral-800 border border-gray-200 dark:border-neutral-700 rounded-lg shadow-sm",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-neutral-700 bg-gray-50 dark:bg-neutral-900",children:e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:l})}),e.jsx("div",{className:"px-6 py-4",children:e.jsx("div",{className:"space-y-4",children:d.map((s,i)=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-2",children:[e.jsx("div",{className:"w-full sm:w-32 flex-shrink-0",children:e.jsx("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s.label})}),e.jsx("div",{className:"flex-1",children:typeof s.value=="string"?e.jsx("span",{className:`text-sm ${s.className||""}`,children:s.value}):s.value})]},i))})})]});function t(l="key"){return l+"-"+Math.random().toString(36).substr(2,9)}const j=({data:l})=>{const[d,c]=b.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(l,null,2)),c(!0),setTimeout(()=>c(!1),2e3)}catch(n){console.error("Failed to copy: ",n)}},i=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),a=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),h=(n,p=0)=>{const r=[],x=" ".repeat(p);if(Array.isArray(n))r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"["},t("open-bracket"))),n.forEach((u,m)=>{r.push(e.jsx("br",{},t("br"))),r.push(e.jsxs("span",{className:"text-transparent",children:[x," "]},t("indent"))),r.push(...h(u,p+1)),m<n.length-1&&r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:","},t("comma")))}),r.push(e.jsx("br",{},t("br-close"))),r.push(e.jsx("span",{className:"text-transparent",children:x},t("indent-close"))),r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"]"},t("close-bracket")));else if(typeof n=="object"&&n!==null){r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"{"},t("open-brace")));const u=Object.entries(n);u.forEach(([m,o],k)=>{r.push(e.jsx("br",{},t("br"))),r.push(e.jsxs("span",{className:"text-transparent",children:[x," "]},t("indent"))),r.push(e.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:['"',m,'"']},t("key"))),r.push(e.jsxs("span",{className:"text-neutral-600 dark:text-neutral-400",children:[":"," "]},t("colon"))),typeof o=="string"?r.push(e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:['"',o,'"']},t("value-string"))):typeof o=="number"?r.push(e.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:o},t("value-number"))):typeof o=="boolean"?r.push(e.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:o.toString()},t("value-boolean"))):o===null?r.push(e.jsx("span",{className:"text-neutral-500 dark:text-neutral-400",children:"null"},t("value-null"))):r.push(...h(o,p+1)),k<u.length-1&&r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:","},t("comma")))}),r.push(e.jsx("br",{},t("br-close"))),r.push(e.jsx("span",{className:"text-transparent",children:x},t("indent-close"))),r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"}"},t("close-brace")))}return r};function g(n){return typeof n=="string"?e.jsx("span",{className:"text-green-600 dark:text-green-400",children:n}):h(n)}return e.jsxs("div",{className:"bg-neutral-50 dark:bg-slate-900 rounded-lg p-4 font-mono text-sm overflow-x-auto relative",children:[e.jsx("button",{onClick:s,className:`absolute top-3 right-3 p-2 rounded-md transition-colors ${d?"bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400":"bg-white text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:bg-slate-800 dark:text-neutral-400 dark:hover:text-neutral-300 dark:hover:bg-slate-700"}`,title:d?"Copied!":"Copy to clipboard",children:d?e.jsx(a,{}):e.jsx(i,{})}),e.jsx("pre",{className:"whitespace-pre-wrap pr-12 text-neutral-800 dark:text-neutral-200 min-h-10",children:g(l)})]})},y=({tabs:l,title:d,defaultActiveTab:c})=>{const[s,i]=b.useState(c||l[0]?.id||"");return e.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-[15px] shadow-sm",children:[d&&e.jsx("div",{className:"px-6 py-4 rounded-t-[15px] border-b border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900",children:e.jsx("h2",{className:"text-lg font-semibold text-neutral-900 dark:text-neutral-100",children:d})}),e.jsx("div",{className:"border-b rounded-[15px] border-neutral-200 dark:border-neutral-700",children:e.jsx("nav",{className:"flex space-x-8 px-6","aria-label":"Tabs",children:l.map(a=>e.jsx("button",{onClick:()=>i(a.id),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors duration-200 ${s===a.id?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 hover:border-neutral-300 dark:hover:border-neutral-600"}`,children:a.label},a.id))})}),e.jsx("div",{className:"p-6 ",children:l.map(a=>e.jsx("div",{className:s===a.id?"block":"hidden",children:a.content?e.jsx("div",{children:a.content}):e.jsx(e.Fragment,{children:a.data&&e.jsx(j,{data:a.data})})},a.id))})]})};export{f as D,y as T};
@@ -1,5 +1,5 @@
1
- import{o as Ie,j as y}from"./index-C-9tn0L6.js";/**
2
- * @license lucide-react v0.541.0 - ISC
1
+ import{o as Ie,j as y}from"./index-BS8XxorB.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.