@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.
- package/dist/abstracts/adapter.cjs +70 -5
- package/dist/abstracts/adapter.js +37 -5
- package/dist/abstracts/store.cjs +26 -6
- package/dist/abstracts/store.js +3 -4
- package/dist/context/container.cjs +57 -6
- package/dist/context/container.js +34 -4
- package/dist/context/context.cjs +71 -7
- package/dist/context/context.js +42 -6
- package/dist/core/api_controller.cjs +148 -7
- package/dist/core/api_controller.js +121 -7
- package/dist/core/lens.cjs +404 -12
- package/dist/core/lens.js +370 -12
- package/dist/core/watcher.cjs +26 -6
- package/dist/core/watcher.js +3 -4
- package/dist/{index-D0Vszdac.d.ts → index-DiLfwsvc.d.cts} +2 -11
- package/dist/{index-D0Vszdac.d.cts → index-DiLfwsvc.d.ts} +2 -11
- package/dist/index.cjs +611 -55
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +556 -42
- package/dist/stores/better_sqlite.cjs +149 -7
- package/dist/stores/better_sqlite.js +116 -7
- package/dist/stores/index.cjs +153 -8
- package/dist/stores/index.js +116 -8
- package/dist/types/index.cjs +33 -6
- package/dist/types/index.js +6 -4
- package/dist/ui/assets/QueriesContainer-CAAsjjW5.js +2 -0
- package/dist/ui/assets/{QueryDetailsContainer-BkaktbOw.js → QueryDetailsContainer-E7P-IO7f.js} +19 -19
- package/dist/ui/assets/QueryTable-BcrtUssT.js +1 -0
- package/dist/ui/assets/RequestDetails-C2DZBu5H.js +1 -0
- package/dist/ui/assets/RequestDetailsContainer-DuDo-IqS.js +2 -0
- package/dist/ui/assets/{RequestsContainer-zoWMoB7o.js → RequestsContainer-DK3hQVz9.js} +2 -2
- package/dist/ui/assets/RequetsTable-DgP8p60b.js +1 -0
- package/dist/ui/assets/{StatusCode-DH20lQ6a.js → StatusCode-FQEjz7gK.js} +1 -1
- package/dist/ui/assets/TabbedDataViewer-cBDdPwIz.js +1 -0
- package/dist/ui/assets/{Table-HwlddLhp.js → Table-DYaXk80S.js} +2 -2
- package/dist/ui/assets/index-BS8XxorB.js +114 -0
- package/dist/ui/assets/index-CpP2Ap5X.js +1 -0
- package/dist/ui/assets/index-DzNHqeKh.css +1 -0
- package/dist/ui/assets/{useLensApi-Bmk2bGb0.js → useLensApi-DG6atd6d.js} +1 -1
- package/dist/ui/assets/{useLoadMore-CvIajdjM.js → useLoadMore-CJltToLI.js} +1 -1
- package/dist/ui/assets/{useQueries-DuyhGJyf.js → useQueries-C8mDDDc6.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/utils/event_emitter.cjs +42 -10
- package/dist/utils/event_emitter.d.cts +1 -11
- package/dist/utils/event_emitter.d.ts +1 -11
- package/dist/utils/event_emitter.js +6 -9
- package/dist/utils/index.cjs +163 -31
- package/dist/utils/index.d.cts +1 -2
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +109 -20
- package/dist/watchers/index.cjs +105 -10
- package/dist/watchers/index.js +79 -12
- package/dist/watchers/query_watcher.cjs +78 -8
- package/dist/watchers/query_watcher.js +55 -8
- package/dist/watchers/request_watcher.cjs +90 -8
- package/dist/watchers/request_watcher.js +67 -8
- package/package.json +18 -18
- package/README.md +0 -1
- package/dist/chunk-2HRVJRKV.cjs +0 -10
- package/dist/chunk-3R5QARPT.cjs +0 -14
- package/dist/chunk-4HLDYZJA.js +0 -34
- package/dist/chunk-5PYQWLAZ.js +0 -129
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-7EKM5HB5.cjs +0 -1
- package/dist/chunk-AUDSBNLF.cjs +0 -122
- package/dist/chunk-BFFOUTTE.cjs +0 -32
- package/dist/chunk-BL4Z6JFH.cjs +0 -34
- package/dist/chunk-CQ2Z4TCR.js +0 -7
- package/dist/chunk-EHOWCXZV.cjs +0 -7
- package/dist/chunk-EJ5BW35V.js +0 -159
- package/dist/chunk-EKG3FVLV.cjs +0 -7
- package/dist/chunk-FCMQ3WE3.cjs +0 -129
- package/dist/chunk-FKMBNWX4.js +0 -7
- package/dist/chunk-FLOVBBFU.js +0 -10
- package/dist/chunk-GI7SJDNQ.cjs +0 -38
- package/dist/chunk-IPMTMCFP.js +0 -122
- package/dist/chunk-JZ2JLQXL.cjs +0 -87
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-QRZUNYF6.cjs +0 -16
- package/dist/chunk-RMZ4UAQ2.js +0 -14
- package/dist/chunk-SJXZARBJ.cjs +0 -22
- package/dist/chunk-TJDE6AZM.js +0 -87
- package/dist/chunk-TPUVRGYT.js +0 -32
- package/dist/chunk-UF5HFNMI.js +0 -22
- package/dist/chunk-VD5IMUWL.js +0 -0
- package/dist/chunk-WU6IZUEV.cjs +0 -159
- package/dist/chunk-XXYRWHSQ.js +0 -0
- package/dist/chunk-XYXPHWEI.js +0 -16
- package/dist/chunk-XZFXXD3A.cjs +0 -1
- package/dist/chunk-YC6T4XWI.js +0 -38
- package/dist/ui/assets/QueriesContainer-DHnHEGG1.js +0 -2
- package/dist/ui/assets/QueryTable-DegVNDkJ.js +0 -1
- package/dist/ui/assets/RequestDetails-zrL0n6gL.js +0 -1
- package/dist/ui/assets/RequestDetailsContainer-CsHWDxn7.js +0 -2
- package/dist/ui/assets/RequetsTable-1K9hhs0W.js +0 -1
- package/dist/ui/assets/TabbedDataViewer-DDVxzZiW.js +0 -1
- package/dist/ui/assets/date-CZdBf-JH.js +0 -1
- package/dist/ui/assets/index-C-9tn0L6.js +0 -114
- package/dist/ui/assets/index-DaNx3ROH.css +0 -1
package/dist/chunk-WU6IZUEV.cjs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
|
|
4
|
-
|
|
5
|
-
// src/utils/index.ts
|
|
6
|
-
var utils_exports = {};
|
|
7
|
-
_chunk75ZPJI57cjs.__export.call(void 0, utils_exports, {
|
|
8
|
-
convertToUTC: () => convertToUTC,
|
|
9
|
-
formatSqlQuery: () => formatSqlQuery,
|
|
10
|
-
generateRandomUuid: () => generateRandomUuid,
|
|
11
|
-
getMeta: () => getMeta,
|
|
12
|
-
interpolateQuery: () => interpolateQuery,
|
|
13
|
-
isStaticFile: () => isStaticFile,
|
|
14
|
-
now: () => now,
|
|
15
|
-
nowISO: () => nowISO,
|
|
16
|
-
prepareIgnoredPaths: () => prepareIgnoredPaths,
|
|
17
|
-
prettyHrTime: () => prettyHrTime,
|
|
18
|
-
shouldIgnoreCurrentPath: () => shouldIgnoreCurrentPath,
|
|
19
|
-
sqlDateTime: () => sqlDateTime,
|
|
20
|
-
stripBeforeAssetsPath: () => stripBeforeAssetsPath
|
|
21
|
-
});
|
|
22
|
-
var _luxon = require('luxon');
|
|
23
|
-
var _sqlformatter = require('sql-formatter');
|
|
24
|
-
var _crypto = require('crypto');
|
|
25
|
-
var _url = require('url');
|
|
26
|
-
var _posix = require('path/posix'); var _posix2 = _interopRequireDefault(_posix);
|
|
27
|
-
var generateRandomUuid = () => {
|
|
28
|
-
return _crypto.randomUUID.call(void 0, );
|
|
29
|
-
};
|
|
30
|
-
function interpolateQuery(query, bindings) {
|
|
31
|
-
const formatValue = (value) => {
|
|
32
|
-
if (value === null || value === void 0) return "NULL";
|
|
33
|
-
if (typeof value === "string") return `'${value.replace(/'/g, "''")}'`;
|
|
34
|
-
if (value instanceof _luxon.DateTime) return `'${value.toISO()}'`;
|
|
35
|
-
if (value instanceof Date) return `'${value.toISOString()}'`;
|
|
36
|
-
if (Array.isArray(value))
|
|
37
|
-
return value.map((v) => typeof v === "string" ? `'${v.replace(/'/g, "''")}'` : v).join(", ");
|
|
38
|
-
if (typeof value === "object")
|
|
39
|
-
return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
|
|
40
|
-
return value.toString();
|
|
41
|
-
};
|
|
42
|
-
if (Array.isArray(bindings)) {
|
|
43
|
-
let i = 0;
|
|
44
|
-
return query.replace(/\?/g, () => {
|
|
45
|
-
if (i >= bindings.length)
|
|
46
|
-
throw new Error("Not enough bindings for placeholders");
|
|
47
|
-
return formatValue(bindings[i++]);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return query.replace(/(\$|\:)(\w+)/g, (match, prefix, keyOrIndex) => {
|
|
51
|
-
let value;
|
|
52
|
-
if (prefix === "$" && /^\d+$/.test(keyOrIndex)) {
|
|
53
|
-
const index = parseInt(keyOrIndex, 10) - 1;
|
|
54
|
-
const keys = Object.keys(bindings);
|
|
55
|
-
if (index < 0 || index >= keys.length)
|
|
56
|
-
throw new Error(`Missing binding for ${match}`);
|
|
57
|
-
value = bindings[keys[index]];
|
|
58
|
-
} else {
|
|
59
|
-
if (!(keyOrIndex in bindings))
|
|
60
|
-
throw new Error(`Missing binding for ${match}`);
|
|
61
|
-
value = bindings[keyOrIndex];
|
|
62
|
-
}
|
|
63
|
-
return formatValue(value);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
var formatSqlQuery = (query, language) => {
|
|
67
|
-
return _sqlformatter.format.call(void 0, query, {
|
|
68
|
-
language,
|
|
69
|
-
dataTypeCase: "upper",
|
|
70
|
-
keywordCase: "upper",
|
|
71
|
-
functionCase: "upper"
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
function now() {
|
|
75
|
-
return _luxon.DateTime.now().setZone("utc");
|
|
76
|
-
}
|
|
77
|
-
function nowISO() {
|
|
78
|
-
return now().toISO({ includeOffset: false });
|
|
79
|
-
}
|
|
80
|
-
function sqlDateTime(dateTime) {
|
|
81
|
-
const time = _nullishCoalesce(dateTime, () => ( now()));
|
|
82
|
-
return time.toSQL({ includeOffset: false });
|
|
83
|
-
}
|
|
84
|
-
function convertToUTC(dateTime) {
|
|
85
|
-
return _luxon.DateTime.fromISO(dateTime).setZone("utc").toISO({ includeOffset: false });
|
|
86
|
-
}
|
|
87
|
-
function getMeta(metaUrl) {
|
|
88
|
-
const isESM = typeof __dirname === "undefined";
|
|
89
|
-
if (isESM) {
|
|
90
|
-
if (!metaUrl) {
|
|
91
|
-
throw new Error("In ESM, you must pass import.meta.url to getMeta()");
|
|
92
|
-
}
|
|
93
|
-
const __filename2 = _url.fileURLToPath.call(void 0, metaUrl);
|
|
94
|
-
const __dirname2 = _posix2.default.dirname(__filename2);
|
|
95
|
-
return { __filename: __filename2, __dirname: __dirname2 };
|
|
96
|
-
} else {
|
|
97
|
-
return { __filename, __dirname };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function isStaticFile(params) {
|
|
101
|
-
return params.includes("assets");
|
|
102
|
-
}
|
|
103
|
-
function stripBeforeAssetsPath(url) {
|
|
104
|
-
const match = url.match(/assets.*/);
|
|
105
|
-
return match ? match[0] : url;
|
|
106
|
-
}
|
|
107
|
-
function prepareIgnoredPaths(path2, ignoredPaths) {
|
|
108
|
-
const normalizedPath = path2.replace(/^\/+|\/+$/g, "");
|
|
109
|
-
ignoredPaths = [
|
|
110
|
-
...ignoredPaths,
|
|
111
|
-
new RegExp(`^/?${normalizedPath}(/|$)`),
|
|
112
|
-
/^\/?lens-config$/,
|
|
113
|
-
/^\/\.well-known\//
|
|
114
|
-
];
|
|
115
|
-
return { ignoredPaths, normalizedPath };
|
|
116
|
-
}
|
|
117
|
-
function shouldIgnoreCurrentPath(path2, ignoredPaths, onlyPaths) {
|
|
118
|
-
if (onlyPaths.length > 0) {
|
|
119
|
-
return !onlyPaths.some((pattern) => pattern.test(path2));
|
|
120
|
-
}
|
|
121
|
-
return ignoredPaths.some((pattern) => pattern.test(path2));
|
|
122
|
-
}
|
|
123
|
-
function prettyHrTime(hrtime, verbose = false) {
|
|
124
|
-
const seconds = hrtime[0];
|
|
125
|
-
const nanoseconds = hrtime[1];
|
|
126
|
-
const ms = seconds * 1e3 + nanoseconds / 1e6;
|
|
127
|
-
if (verbose) {
|
|
128
|
-
if (seconds > 60) {
|
|
129
|
-
const minutes = Math.floor(seconds / 60);
|
|
130
|
-
const remainingSeconds = seconds % 60;
|
|
131
|
-
return `${minutes}m ${remainingSeconds}s`;
|
|
132
|
-
}
|
|
133
|
-
if (seconds >= 1) {
|
|
134
|
-
return `${seconds}.${Math.floor(nanoseconds / 1e7)}s`;
|
|
135
|
-
}
|
|
136
|
-
return `${ms.toFixed(3)} ms`;
|
|
137
|
-
}
|
|
138
|
-
if (ms < 1e3) {
|
|
139
|
-
return `${ms.toFixed(0)} ms`;
|
|
140
|
-
}
|
|
141
|
-
return `${(ms / 1e3).toFixed(1)} s`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
exports.generateRandomUuid = generateRandomUuid; exports.interpolateQuery = interpolateQuery; exports.formatSqlQuery = formatSqlQuery; exports.now = now; exports.nowISO = nowISO; exports.sqlDateTime = sqlDateTime; exports.convertToUTC = convertToUTC; exports.getMeta = getMeta; exports.isStaticFile = isStaticFile; exports.stripBeforeAssetsPath = stripBeforeAssetsPath; exports.prepareIgnoredPaths = prepareIgnoredPaths; exports.shouldIgnoreCurrentPath = shouldIgnoreCurrentPath; exports.prettyHrTime = prettyHrTime; exports.utils_exports = utils_exports;
|
package/dist/chunk-XXYRWHSQ.js
DELETED
|
File without changes
|
package/dist/chunk-XYXPHWEI.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Container
|
|
3
|
-
} from "./chunk-YC6T4XWI.js";
|
|
4
|
-
|
|
5
|
-
// src/context/context.ts
|
|
6
|
-
var getStore = () => {
|
|
7
|
-
return Container.make("store");
|
|
8
|
-
};
|
|
9
|
-
var getUiConfig = () => {
|
|
10
|
-
return Container.make("uiConfig");
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
getStore,
|
|
15
|
-
getUiConfig
|
|
16
|
-
};
|
package/dist/chunk-XZFXXD3A.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/chunk-YC6T4XWI.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// src/context/container.ts
|
|
2
|
-
var Container = class {
|
|
3
|
-
static bindings = /* @__PURE__ */ new Map();
|
|
4
|
-
static singletons = /* @__PURE__ */ new Map();
|
|
5
|
-
static instances = /* @__PURE__ */ new Map();
|
|
6
|
-
static bind(key, factory) {
|
|
7
|
-
this.bindings.set(key, factory);
|
|
8
|
-
}
|
|
9
|
-
static singleton(key, factory) {
|
|
10
|
-
this.singletons.set(key, factory);
|
|
11
|
-
}
|
|
12
|
-
static make(key) {
|
|
13
|
-
if (this.instances.has(key)) {
|
|
14
|
-
return this.instances.get(key);
|
|
15
|
-
}
|
|
16
|
-
if (this.singletons.has(key)) {
|
|
17
|
-
const instance = this.singletons.get(key)();
|
|
18
|
-
this.instances.set(key, instance);
|
|
19
|
-
return instance;
|
|
20
|
-
}
|
|
21
|
-
if (this.bindings.has(key)) {
|
|
22
|
-
return this.bindings.get(key)();
|
|
23
|
-
}
|
|
24
|
-
throw new Error(`Service "${key}" is not bound in the container`);
|
|
25
|
-
}
|
|
26
|
-
static has(key) {
|
|
27
|
-
return this.bindings.has(key) || this.singletons.has(key) || this.instances.has(key);
|
|
28
|
-
}
|
|
29
|
-
static clear() {
|
|
30
|
-
this.bindings.clear();
|
|
31
|
-
this.singletons.clear();
|
|
32
|
-
this.instances.clear();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
Container
|
|
38
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./QueryTable-DegVNDkJ.js","./index-C-9tn0L6.js","./index-DaNx3ROH.css","./Table-HwlddLhp.js","./date-CZdBf-JH.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as t,j as s,_ as a}from"./index-C-9tn0L6.js";import{u as i}from"./useQueries-DuyhGJyf.js";import{u}from"./useLoadMore-CvIajdjM.js";import"./useLensApi-Bmk2bGb0.js";const m=t.lazy(()=>a(()=>import("./QueryTable-DegVNDkJ.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),l=()=>{const{loadMoreRequests:o,fetchQueries:r}=i(),e=u({paginatedPage:o});return t.useEffect(()=>{r()},[]),console.log("data",e.data),s.jsx(m,{hasMoreObject:e})};export{l as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as r,k as o,j as e,L as i}from"./index-C-9tn0L6.js";import{C as l,T as d,L as c}from"./Table-HwlddLhp.js";import{h as x}from"./date-CZdBf-JH.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as t}from"./index-C-9tn0L6.js";import{D as d,T as o}from"./TabbedDataViewer-DDVxzZiW.js";import{f as m}from"./date-CZdBf-JH.js";import{M as i,S as n}from"./StatusCode-DH20lQ6a.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RequestDetails-zrL0n6gL.js","./index-C-9tn0L6.js","./index-DaNx3ROH.css","./TabbedDataViewer-DDVxzZiW.js","./date-CZdBf-JH.js","./StatusCode-DH20lQ6a.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{S as V,p as M,a as l,s as w,b as m,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-C-9tn0L6.js";var tt=class extends V{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=M(),this.options.experimental_prefetchInRender||this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#n;#c;#r;#i;#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.#m())}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 r=this.hasListeners();r&&B(this.#t,s,this.options,e)&&this.#u(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(e.staleTime,this.#t))&&this.#b();const a=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||a!==this.#a)&&this.#y(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,r)=>(this.trackProp(r),e?.(r),Reflect.get(s,r))})}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=m(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}#y(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))}#m(){this.#b(),this.#y(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,r=this.options,a=this.#e,u=this.#n,i=this.#c,o=t!==s?t.state:this.#p,{state:d}=t;let n={...d},y=!1,h;if(e._optimisticResults){const c=this.hasListeners(),g=!c&&A(t,e),v=c&&B(t,s,e,r);(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===i?.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),y=!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.#i=null}catch(c){this.#i=c}this.#i&&(_=this.#i,h=this.#l,P=Date.now(),R="error");const O=n.fetchStatus==="fetching",S=R==="pending",E=R==="error",U=S&&O,k=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&&!k,isPaused:n.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:E&&k,isStale:F(t,e),refetch:this.refetch,promise:this.#r,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.#r=f.promise=M();c(C)},v=this.#r;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:r}=this.options,a=typeof r=="function"?r():r;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(i=>{const b=i;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.#m()}#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&&m(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&F(t,e)}return!1}function B(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&F(t,s)}function F(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(m(e.staleTime,t))}function st(t,e){return!w(t.getCurrentResult(),e)}var z=p.createContext(!1),rt=()=>p.useContext(z);z.Provider;function it(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var at=p.createContext(it()),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:r,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(a&&t.data===void 0||N(s,[t.error,r])),ct=t=>{if(t.suspense){const e=r=>r==="static"?r:Math.max(r??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...r)=>e(s(...r)):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 r=rt(),a=nt(),u=J(),i=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=r?"isRestoring":"optimistic",ct(i),ot(i,a),ht(a);const b=!u.getQueryCache().get(i.queryHash),[o]=p.useState(()=>new e(u,i)),d=o.getOptimisticResult(i),n=!r&&t.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(y=>{const h=n?o.subscribe(H.batchCalls(y)):x;return o.updateResult(),h},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),p.useEffect(()=>{o.setOptions(i)},[i,o]),dt(i,d))throw q(i,o,a);if(ut({result:d,errorResetBoundary:a,throwOnError:i.throwOnError,query:u.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw d.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!I&<(d,r)&&(b?q(i,o,a):u.getQueryCache().get(i.queryHash)?.promise)?.catch(x).finally(()=>{o.updateResult()}),i.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-zrL0n6gL.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 +0,0 @@
|
|
|
1
|
-
import{v as o,k as d,j as e,L as s}from"./index-C-9tn0L6.js";import{C as i,T as m,L as l}from"./Table-HwlddLhp.js";import{M as u,S as x}from"./StatusCode-DH20lQ6a.js";import{h as c}from"./date-CZdBf-JH.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 +0,0 @@
|
|
|
1
|
-
import{j as e,r as b}from"./index-C-9tn0L6.js";const N=({title:n,items:l,emptyMessage:c="No data available"})=>!l||l.length===0||l.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:n})," ",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:n})}),e.jsx("div",{className:"px-6 py-4",children:e.jsx("div",{className:"space-y-4",children:l.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(n="key"){return n+"-"+Math.random().toString(36).substr(2,9)}const k=({data:n})=>{const[l,c]=b.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(n,null,2)),c(!0),setTimeout(()=>c(!1),2e3)}catch(d){console.error("Failed to copy: ",d)}},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=(d,p=0)=>{const r=[],x=" ".repeat(p);if(Array.isArray(d))r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"["},t("open-bracket"))),d.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<d.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 d=="object"&&d!==null){r.push(e.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"{"},t("open-brace")));const u=Object.entries(d);u.forEach(([m,o],g)=>{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)),g<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};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 ${l?"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:l?"Copied!":"Copy to clipboard",children:l?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:h(n)})]})},f=({tabs:n,title:l,defaultActiveTab:c})=>{const[s,i]=b.useState(c||n[0]?.id||"");return e.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-[15px] shadow-sm",children:[l&&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:l})}),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:n.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:n.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(k,{data:a.data})})},a.id))})]})};export{N as D,f as T};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as o}from"./index-C-9tn0L6.js";function a(){return o.tz.guess()}function n(t){return o.utc(t).tz(a())}const s=t=>{const r=n(t);return{label:r.fromNow(),exact:r.format("YYYY-MM-DD HH:mm:ss")}};function i(t,r="en"){if(!t)return"N/A";const e=n(t);return e.isValid()?`${e.locale(r).format("MMMM D, YYYY h:mm A")} (${e.fromNow()})`:"N/A"}export{i as f,s as h};
|