@lensjs/core 2.2.2 → 2.3.1
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/store.cjs +3 -0
- package/dist/abstracts/store.d.cts +3 -1
- package/dist/abstracts/store.d.ts +3 -1
- package/dist/abstracts/store.js +3 -0
- package/dist/core/lens.cjs +151 -24
- package/dist/core/lens.d.cts +3 -2
- package/dist/core/lens.d.ts +3 -2
- package/dist/core/lens.js +151 -24
- package/dist/{index-CMvlRWcQ.d.cts → index-CZsa0Zcm.d.ts} +3 -1
- package/dist/{index-CMvlRWcQ.d.ts → index-QmOJr0K-.d.cts} +3 -1
- package/dist/index.cjs +199 -29
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +198 -29
- package/dist/mixins/queued_store.cjs +114 -0
- package/dist/mixins/queued_store.d.cts +38 -0
- package/dist/mixins/queued_store.d.ts +38 -0
- package/dist/mixins/queued_store.js +79 -0
- package/dist/stores/better_sqlite.cjs +36 -0
- package/dist/stores/better_sqlite.d.cts +3 -0
- package/dist/stores/better_sqlite.d.ts +3 -0
- package/dist/stores/better_sqlite.js +36 -0
- package/dist/stores/index.cjs +129 -2
- package/dist/stores/index.d.cts +2 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.js +127 -1
- package/dist/stores/queued_sqlite.cjs +313 -0
- package/dist/stores/queued_sqlite.d.cts +43 -0
- package/dist/stores/queued_sqlite.d.ts +43 -0
- package/dist/stores/queued_sqlite.js +280 -0
- package/dist/types/index.d.cts +16 -2
- package/dist/types/index.d.ts +16 -2
- package/dist/ui/assets/{CacheActionBadge-CL10Xlw7.js → CacheActionBadge-BB4uokI1.js} +1 -1
- package/dist/ui/assets/CacheEntriesTable-B8cUXhos.js +1 -0
- package/dist/ui/assets/CacheEntryContainer-WkdnGvnu.js +2 -0
- package/dist/ui/assets/CacheEntryDetails-BeZnoIpm.js +1 -0
- package/dist/ui/assets/CacheEntryDetailsContainer-DI0mEvpu.js +2 -0
- package/dist/ui/assets/ExceptionContainer-YNcR0F5U.js +2 -0
- package/dist/ui/assets/{ExceptionDetails-Bzj8OZ70.js → ExceptionDetails-BKHzv6hf.js} +1 -1
- package/dist/ui/assets/ExceptionDetailsContainer-CJHILjb3.js +2 -0
- package/dist/ui/assets/{ExceptionTable-BkFSFGbn.js → ExceptionTable-DzBmQLLa.js} +1 -1
- package/dist/ui/assets/JsonViewer-D-KPN089.js +1 -0
- package/dist/ui/assets/{LoadMore-Du7yL-Hr.js → LoadMore-CLPR6Zd4.js} +1 -1
- package/dist/ui/assets/QueriesContainer-B_PmBkHR.js +2 -0
- package/dist/ui/assets/{QueryDetailsContainer-BtbvRyBf.js → QueryDetailsContainer-Cqj3E6Dr.js} +16 -26
- package/dist/ui/assets/{QueryTable-tJVEncUM.js → QueryTable-DmWdZSnJ.js} +1 -1
- package/dist/ui/assets/{RequestDetails-C6tqSqg9.js → RequestDetails-CF338Kcv.js} +1 -1
- package/dist/ui/assets/{RequestDetailsContainer---KvdZKp.js → RequestDetailsContainer-aW4GLool.js} +2 -2
- package/dist/ui/assets/{RequestsContainer-Bogurt1b.js → RequestsContainer-DdLSvAbl.js} +2 -2
- package/dist/ui/assets/{RequetsTable-BMrYHd0d.js → RequetsTable-Bdp_PhGU.js} +1 -1
- package/dist/ui/assets/{StatusCode-DpZO0dUJ.js → StatusCode-C605nHvd.js} +1 -1
- package/dist/ui/assets/TabbedDataViewer-ofhEq_Wj.js +2 -0
- package/dist/ui/assets/{Table-BtkmKVTF.js → Table-kak5sL5X.js} +1 -1
- package/dist/ui/assets/{columns-D_NhXbk6.js → columns-BEyDhUNq.js} +1 -1
- package/dist/ui/assets/{columns-DlGaMv5C.js → columns-Bu5psHyp.js} +1 -1
- package/dist/ui/assets/{columns-DF7BR0z_.js → columns-BvIUTkjN.js} +1 -1
- package/dist/ui/assets/copy-DzXuP4eO.js +11 -0
- package/dist/ui/assets/index-CsnKQ5Mh.css +1 -0
- package/dist/ui/assets/{index-EQXljT95.js → index-TW_-MgRG.js} +25 -25
- package/dist/ui/assets/{useCacheEntries-jC9XYsV_.js → useCacheEntries-Pvte_aNc.js} +1 -1
- package/dist/ui/assets/{useExceptions-CwwK33mG.js → useExceptions-P3cnURvN.js} +1 -1
- package/dist/ui/assets/{useLensApi-CPvDlyGv.js → useLensApi-BFdsfrzR.js} +1 -1
- package/dist/ui/assets/{useLoadMore-C2bqGSaL.js → useLoadMore-JCWak1Dg.js} +1 -1
- package/dist/ui/assets/{useQueries-CzbIajH6.js → useQueries-CNquFtm0.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/utils/compose.cjs +32 -0
- package/dist/utils/compose.d.cts +11 -0
- package/dist/utils/compose.d.ts +11 -0
- package/dist/utils/compose.js +7 -0
- package/dist/utils/index.cjs +10 -1
- package/dist/utils/index.d.cts +3 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +9 -1
- package/dist/watchers/index.cjs +45 -5
- package/dist/watchers/index.js +45 -5
- package/dist/watchers/request_watcher.cjs +45 -5
- package/dist/watchers/request_watcher.d.cts +12 -1
- package/dist/watchers/request_watcher.d.ts +12 -1
- package/dist/watchers/request_watcher.js +45 -5
- package/package.json +2 -1
- package/dist/ui/assets/CacheEntriesTable-DuLoeu0e.js +0 -1
- package/dist/ui/assets/CacheEntryContainer-DqHm-jQl.js +0 -2
- package/dist/ui/assets/CacheEntryDetails-k-74LsSb.js +0 -1
- package/dist/ui/assets/CacheEntryDetailsContainer-DTI7gtUq.js +0 -2
- package/dist/ui/assets/ExceptionContainer-0dCs6QMQ.js +0 -2
- package/dist/ui/assets/ExceptionDetailsContainer-Bim0gTpE.js +0 -2
- package/dist/ui/assets/QueriesContainer-5xlqsYl0.js +0 -2
- package/dist/ui/assets/TabbedDataViewer-C60W9bqz.js +0 -1
- package/dist/ui/assets/index-CMJVCuvo.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t}from"./index-
|
|
1
|
+
import{r as t}from"./index-TW_-MgRG.js";import{D as I,u as h}from"./useLensApi-BFdsfrzR.js";function C(){const[n,r]=t.useState([]),[l,m]=t.useState(),[c,a]=t.useState(!1),[i,u]=t.useState(I),{getCacheEntries:e,getCacheEntryById:f}=h(),d=t.useCallback(async o=>{a(!0),f(o).then(s=>{m(s.data)}).finally(()=>{a(!1)})},[e]),g=t.useCallback(async o=>{a(!0),await e(o??1).then(s=>{r(s.data),u(s.meta)}).finally(()=>{a(!1)})},[e]);return{loadMoreItems:t.useMemo(()=>({initialData:n,meta:i,loading:c,fetchRawPage:e}),[n,i,c,e]),getItems:g,getItem:d,items:n,item:l}}export{C as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t}from"./index-
|
|
1
|
+
import{r as t}from"./index-TW_-MgRG.js";import{D as g,u as I}from"./useLensApi-BFdsfrzR.js";function M(){const[o,l]=t.useState([]),[m,u]=t.useState(),[c,a]=t.useState(!1),[i,r]=t.useState(g),{getExceptions:e,getExceptionById:f}=I(),p=t.useCallback(async n=>{a(!0),f(n).then(s=>{u(s.data)}).finally(()=>{a(!1)})},[e]),d=t.useCallback(async n=>{a(!0),await e(n??1).then(s=>{l(s.data),r(s.meta)}).finally(()=>{a(!1)})},[e]);return{loadMoreItems:t.useMemo(()=>({initialData:o,meta:i,loading:c,fetchRawPage:e}),[o,i,c,e]),getItems:d,getItem:p,items:o,item:m}}export{M as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as p,l as s}from"./index-
|
|
1
|
+
import{k as p,l as s}from"./index-TW_-MgRG.js";const B={currentPage:1,lastPage:1,total:0},I=()=>{const t=p();async function n(e,a){const r=await fetch(e,{headers:{"Content-Type":"application/json"},...a});if(!r.ok)throw new Error(`Failed to fetch: ${e}`);return r.json()}const c=(e,a)=>{const r=new URLSearchParams(Object.entries(a||{}).reduce((i,[u,o])=>(o!=null&&(i[u]=String(o)),i),{}));return`${e}${r.toString()?`?${r}`:""}`};return{getAllRequests:async e=>n(s(c(t.api.requests,{page:e}))),getRequestById:async e=>n(s(`${t.api.requests}/${e}`)),getQueries:async e=>n(s(c(t.api.queries,{page:e}))),getQueryById:async e=>n(s(`${t.api.queries}/${e}`)),getCacheEntries:async e=>n(s(c(t.api.cache,{page:e}))),getCacheEntryById:async e=>n(s(`${t.api.cache}/${e}`)),getExceptions:async e=>n(s(c(t.api.exceptions,{page:e}))),getExceptionById:async e=>n(s(`${t.api.exceptions}/${e}`))}};export{B as D,I as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./index-
|
|
1
|
+
import{r as e}from"./index-TW_-MgRG.js";function D({paginatedPage:t}){const[f,r]=e.useState([]),[m,l]=e.useState(1),[c,s]=e.useState(!1),[n,o]=e.useState(!1);return e.useEffect(()=>{s(t.loading),o(t.meta.currentPage<t.meta.lastPage),l(1),t.loading||r(t.initialData)},[t.initialData,t.loading,t.meta.currentPage,t.meta.lastPage]),{data:f,loading:c,hasMore:n,loadMore:async()=>{if(c||!n)return;s(!0);const u=m+1,a=await t.fetchRawPage(u);r(i=>[...i,...a.data]),l(u),a?.meta?o(a.meta.currentPage<a.meta.lastPage):o(!1),s(!1)}}}export{D as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./index-
|
|
1
|
+
import{r as e}from"./index-TW_-MgRG.js";import{D as Q,u as g}from"./useLensApi-BFdsfrzR.js";function q(){const[u,c]=e.useState([]),[i,l]=e.useState(),[r,s]=e.useState(!1),[n,f]=e.useState(Q),{getQueries:t,getQueryById:y}=g(),d=e.useCallback(async o=>{s(!0),y(o).then(a=>{l(a.data)}).finally(()=>{s(!1)})},[t]),m=e.useCallback(async o=>{s(!0),await t(o??1).then(a=>{c(a.data),f(a.meta)}).finally(()=>{s(!1)})},[t]);return{loadMoreRequests:e.useMemo(()=>({initialData:u,meta:n,loading:r,fetchRawPage:t}),[u,n,r,t]),fetchQueries:m,fetchQuery:d,queries:u,query:i}}export{q as u};
|
package/dist/ui/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="./assets/favicon-CwRXoGYE.ico" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Lens</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-TW_-MgRG.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CsnKQ5Mh.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/compose.ts
|
|
21
|
+
var compose_exports = {};
|
|
22
|
+
__export(compose_exports, {
|
|
23
|
+
compose: () => compose
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(compose_exports);
|
|
26
|
+
function compose(superclass, ...mixins) {
|
|
27
|
+
return mixins.reduce((c, mixin) => mixin(c), superclass);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
compose
|
|
32
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Constructor } from '../types/index.cjs';
|
|
2
|
+
import 'sql-formatter';
|
|
3
|
+
|
|
4
|
+
interface UnaryFunction<T, R> {
|
|
5
|
+
(source: T): R;
|
|
6
|
+
}
|
|
7
|
+
declare function compose<T extends Constructor, A>(superclass: T, mixin: UnaryFunction<T, A>): A;
|
|
8
|
+
declare function compose<T extends Constructor, A, B>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>): B;
|
|
9
|
+
declare function compose<T extends Constructor, A, B, C>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>): C;
|
|
10
|
+
|
|
11
|
+
export { compose };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Constructor } from '../types/index.js';
|
|
2
|
+
import 'sql-formatter';
|
|
3
|
+
|
|
4
|
+
interface UnaryFunction<T, R> {
|
|
5
|
+
(source: T): R;
|
|
6
|
+
}
|
|
7
|
+
declare function compose<T extends Constructor, A>(superclass: T, mixin: UnaryFunction<T, A>): A;
|
|
8
|
+
declare function compose<T extends Constructor, A, B>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>): B;
|
|
9
|
+
declare function compose<T extends Constructor, A, B, C>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>): C;
|
|
10
|
+
|
|
11
|
+
export { compose };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/utils/index.ts
|
|
31
31
|
var utils_exports = {};
|
|
32
32
|
__export(utils_exports, {
|
|
33
|
+
compose: () => compose,
|
|
33
34
|
formatSqlQuery: () => formatSqlQuery,
|
|
34
35
|
generateRandomUuid: () => generateRandomUuid,
|
|
35
36
|
getMeta: () => getMeta,
|
|
@@ -47,6 +48,13 @@ var import_sql_formatter = require("sql-formatter");
|
|
|
47
48
|
var import_crypto = require("crypto");
|
|
48
49
|
var import_url = require("url");
|
|
49
50
|
var path = __toESM(require("path"), 1);
|
|
51
|
+
|
|
52
|
+
// src/utils/compose.ts
|
|
53
|
+
function compose(superclass, ...mixins) {
|
|
54
|
+
return mixins.reduce((c, mixin) => mixin(c), superclass);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/utils/index.ts
|
|
50
58
|
var generateRandomUuid = () => {
|
|
51
59
|
return (0, import_crypto.randomUUID)();
|
|
52
60
|
};
|
|
@@ -105,7 +113,7 @@ var formatSqlQuery = (query, language) => {
|
|
|
105
113
|
});
|
|
106
114
|
};
|
|
107
115
|
function getMeta(metaUrl) {
|
|
108
|
-
const isESM = typeof __dirname === "undefined";
|
|
116
|
+
const isESM = typeof __dirname === "undefined" || typeof __filename === "undefined";
|
|
109
117
|
if (isESM) {
|
|
110
118
|
if (!metaUrl) {
|
|
111
119
|
throw new Error("In ESM, you must pass import.meta.url to getMeta()");
|
|
@@ -166,6 +174,7 @@ function normalizePath(path2) {
|
|
|
166
174
|
}
|
|
167
175
|
// Annotate the CommonJS export names for ESM import in node:
|
|
168
176
|
0 && (module.exports = {
|
|
177
|
+
compose,
|
|
169
178
|
formatSqlQuery,
|
|
170
179
|
generateRandomUuid,
|
|
171
180
|
getMeta,
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import 'sql-formatter';
|
|
2
|
-
export {
|
|
2
|
+
export { compose } from './compose.cjs';
|
|
3
|
+
export { f as formatSqlQuery, g as generateRandomUuid, b as getMeta, a as interpolateQuery, c as isStaticFile, n as normalizePath, p as prepareIgnoredPaths, e as prettyHrTime, d as shouldIgnoreCurrentPath, s as stripBeforeAssetsPath } from '../index-QmOJr0K-.cjs';
|
|
4
|
+
import '../types/index.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import 'sql-formatter';
|
|
2
|
-
export {
|
|
2
|
+
export { compose } from './compose.js';
|
|
3
|
+
export { f as formatSqlQuery, g as generateRandomUuid, b as getMeta, a as interpolateQuery, c as isStaticFile, n as normalizePath, p as prepareIgnoredPaths, e as prettyHrTime, d as shouldIgnoreCurrentPath, s as stripBeforeAssetsPath } from '../index-CZsa0Zcm.js';
|
|
4
|
+
import '../types/index.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -4,6 +4,13 @@ import { format } from "sql-formatter";
|
|
|
4
4
|
import { randomUUID } from "crypto";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import * as path from "path";
|
|
7
|
+
|
|
8
|
+
// src/utils/compose.ts
|
|
9
|
+
function compose(superclass, ...mixins) {
|
|
10
|
+
return mixins.reduce((c, mixin) => mixin(c), superclass);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/utils/index.ts
|
|
7
14
|
var generateRandomUuid = () => {
|
|
8
15
|
return randomUUID();
|
|
9
16
|
};
|
|
@@ -62,7 +69,7 @@ var formatSqlQuery = (query, language) => {
|
|
|
62
69
|
});
|
|
63
70
|
};
|
|
64
71
|
function getMeta(metaUrl) {
|
|
65
|
-
const isESM = typeof __dirname === "undefined";
|
|
72
|
+
const isESM = typeof __dirname === "undefined" || typeof __filename === "undefined";
|
|
66
73
|
if (isESM) {
|
|
67
74
|
if (!metaUrl) {
|
|
68
75
|
throw new Error("In ESM, you must pass import.meta.url to getMeta()");
|
|
@@ -122,6 +129,7 @@ function normalizePath(path2) {
|
|
|
122
129
|
return path2.startsWith("/") ? path2 : `/${path2}`;
|
|
123
130
|
}
|
|
124
131
|
export {
|
|
132
|
+
compose,
|
|
125
133
|
formatSqlQuery,
|
|
126
134
|
generateRandomUuid,
|
|
127
135
|
getMeta,
|
package/dist/watchers/index.cjs
CHANGED
|
@@ -94,10 +94,19 @@ var QueryWatcher = class extends Watcher {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
// src/watchers/request_watcher.ts
|
|
97
|
-
var RequestWatcher = class extends Watcher {
|
|
97
|
+
var RequestWatcher = class _RequestWatcher extends Watcher {
|
|
98
98
|
name = "request" /* REQUEST */;
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
static DEFAULT_HIDDEN_HEADERS = ["Authorization", "Basic"];
|
|
100
|
+
static DEFAULT_HIDDEN_BODY_PARAMS = [
|
|
101
|
+
"password",
|
|
102
|
+
"passwordConfirmation",
|
|
103
|
+
"secret",
|
|
104
|
+
"password_confirmation"
|
|
105
|
+
];
|
|
106
|
+
async log(data, hidden = {}) {
|
|
107
|
+
const headersToHide = (hidden.headers?.length ? hidden.headers : _RequestWatcher.DEFAULT_HIDDEN_HEADERS).map((header) => header.toLowerCase());
|
|
108
|
+
const bodyParamsToHide = hidden.bodyParams?.length ? hidden.bodyParams : _RequestWatcher.DEFAULT_HIDDEN_BODY_PARAMS;
|
|
109
|
+
const payload = {
|
|
101
110
|
id: data.request.id,
|
|
102
111
|
type: this.name,
|
|
103
112
|
minimal_data: {
|
|
@@ -111,9 +120,40 @@ var RequestWatcher = class extends Watcher {
|
|
|
111
120
|
data: {
|
|
112
121
|
...data.request,
|
|
113
122
|
user: data.user,
|
|
114
|
-
response: data.response
|
|
123
|
+
response: data.response || {}
|
|
115
124
|
}
|
|
116
|
-
}
|
|
125
|
+
};
|
|
126
|
+
payload.data.headers = this.hideSensitive(
|
|
127
|
+
this.normalizeHeaders(payload.data.headers),
|
|
128
|
+
headersToHide
|
|
129
|
+
);
|
|
130
|
+
payload.data.response.headers = this.hideSensitive(
|
|
131
|
+
this.normalizeHeaders(payload.data.response?.headers),
|
|
132
|
+
headersToHide
|
|
133
|
+
);
|
|
134
|
+
payload.data.body = this.hideSensitive(payload.data.body, bodyParamsToHide, false);
|
|
135
|
+
await getStore().save(payload);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Normalize headers: converts keys to lowercase.
|
|
139
|
+
*/
|
|
140
|
+
normalizeHeaders(headers) {
|
|
141
|
+
if (!headers || typeof headers !== "object") return {};
|
|
142
|
+
return Object.fromEntries(
|
|
143
|
+
Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
hideSensitive(obj, keysToHide = [], isObjHeaders = true) {
|
|
147
|
+
if (!obj || typeof obj !== "object") {
|
|
148
|
+
return isObjHeaders ? {} : obj;
|
|
149
|
+
}
|
|
150
|
+
const clone = { ...obj };
|
|
151
|
+
for (const key of keysToHide) {
|
|
152
|
+
if (key in clone) {
|
|
153
|
+
clone[key] = "*******";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return clone;
|
|
117
157
|
}
|
|
118
158
|
};
|
|
119
159
|
|
package/dist/watchers/index.js
CHANGED
|
@@ -55,10 +55,19 @@ var QueryWatcher = class extends Watcher {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/watchers/request_watcher.ts
|
|
58
|
-
var RequestWatcher = class extends Watcher {
|
|
58
|
+
var RequestWatcher = class _RequestWatcher extends Watcher {
|
|
59
59
|
name = "request" /* REQUEST */;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
static DEFAULT_HIDDEN_HEADERS = ["Authorization", "Basic"];
|
|
61
|
+
static DEFAULT_HIDDEN_BODY_PARAMS = [
|
|
62
|
+
"password",
|
|
63
|
+
"passwordConfirmation",
|
|
64
|
+
"secret",
|
|
65
|
+
"password_confirmation"
|
|
66
|
+
];
|
|
67
|
+
async log(data, hidden = {}) {
|
|
68
|
+
const headersToHide = (hidden.headers?.length ? hidden.headers : _RequestWatcher.DEFAULT_HIDDEN_HEADERS).map((header) => header.toLowerCase());
|
|
69
|
+
const bodyParamsToHide = hidden.bodyParams?.length ? hidden.bodyParams : _RequestWatcher.DEFAULT_HIDDEN_BODY_PARAMS;
|
|
70
|
+
const payload = {
|
|
62
71
|
id: data.request.id,
|
|
63
72
|
type: this.name,
|
|
64
73
|
minimal_data: {
|
|
@@ -72,9 +81,40 @@ var RequestWatcher = class extends Watcher {
|
|
|
72
81
|
data: {
|
|
73
82
|
...data.request,
|
|
74
83
|
user: data.user,
|
|
75
|
-
response: data.response
|
|
84
|
+
response: data.response || {}
|
|
76
85
|
}
|
|
77
|
-
}
|
|
86
|
+
};
|
|
87
|
+
payload.data.headers = this.hideSensitive(
|
|
88
|
+
this.normalizeHeaders(payload.data.headers),
|
|
89
|
+
headersToHide
|
|
90
|
+
);
|
|
91
|
+
payload.data.response.headers = this.hideSensitive(
|
|
92
|
+
this.normalizeHeaders(payload.data.response?.headers),
|
|
93
|
+
headersToHide
|
|
94
|
+
);
|
|
95
|
+
payload.data.body = this.hideSensitive(payload.data.body, bodyParamsToHide, false);
|
|
96
|
+
await getStore().save(payload);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Normalize headers: converts keys to lowercase.
|
|
100
|
+
*/
|
|
101
|
+
normalizeHeaders(headers) {
|
|
102
|
+
if (!headers || typeof headers !== "object") return {};
|
|
103
|
+
return Object.fromEntries(
|
|
104
|
+
Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
hideSensitive(obj, keysToHide = [], isObjHeaders = true) {
|
|
108
|
+
if (!obj || typeof obj !== "object") {
|
|
109
|
+
return isObjHeaders ? {} : obj;
|
|
110
|
+
}
|
|
111
|
+
const clone = { ...obj };
|
|
112
|
+
for (const key of keysToHide) {
|
|
113
|
+
if (key in clone) {
|
|
114
|
+
clone[key] = "*******";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return clone;
|
|
78
118
|
}
|
|
79
119
|
};
|
|
80
120
|
|
|
@@ -69,10 +69,19 @@ var Watcher = class {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
// src/watchers/request_watcher.ts
|
|
72
|
-
var RequestWatcher = class extends Watcher {
|
|
72
|
+
var RequestWatcher = class _RequestWatcher extends Watcher {
|
|
73
73
|
name = "request" /* REQUEST */;
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
static DEFAULT_HIDDEN_HEADERS = ["Authorization", "Basic"];
|
|
75
|
+
static DEFAULT_HIDDEN_BODY_PARAMS = [
|
|
76
|
+
"password",
|
|
77
|
+
"passwordConfirmation",
|
|
78
|
+
"secret",
|
|
79
|
+
"password_confirmation"
|
|
80
|
+
];
|
|
81
|
+
async log(data, hidden = {}) {
|
|
82
|
+
const headersToHide = (hidden.headers?.length ? hidden.headers : _RequestWatcher.DEFAULT_HIDDEN_HEADERS).map((header) => header.toLowerCase());
|
|
83
|
+
const bodyParamsToHide = hidden.bodyParams?.length ? hidden.bodyParams : _RequestWatcher.DEFAULT_HIDDEN_BODY_PARAMS;
|
|
84
|
+
const payload = {
|
|
76
85
|
id: data.request.id,
|
|
77
86
|
type: this.name,
|
|
78
87
|
minimal_data: {
|
|
@@ -86,8 +95,39 @@ var RequestWatcher = class extends Watcher {
|
|
|
86
95
|
data: {
|
|
87
96
|
...data.request,
|
|
88
97
|
user: data.user,
|
|
89
|
-
response: data.response
|
|
98
|
+
response: data.response || {}
|
|
90
99
|
}
|
|
91
|
-
}
|
|
100
|
+
};
|
|
101
|
+
payload.data.headers = this.hideSensitive(
|
|
102
|
+
this.normalizeHeaders(payload.data.headers),
|
|
103
|
+
headersToHide
|
|
104
|
+
);
|
|
105
|
+
payload.data.response.headers = this.hideSensitive(
|
|
106
|
+
this.normalizeHeaders(payload.data.response?.headers),
|
|
107
|
+
headersToHide
|
|
108
|
+
);
|
|
109
|
+
payload.data.body = this.hideSensitive(payload.data.body, bodyParamsToHide, false);
|
|
110
|
+
await getStore().save(payload);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Normalize headers: converts keys to lowercase.
|
|
114
|
+
*/
|
|
115
|
+
normalizeHeaders(headers) {
|
|
116
|
+
if (!headers || typeof headers !== "object") return {};
|
|
117
|
+
return Object.fromEntries(
|
|
118
|
+
Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
hideSensitive(obj, keysToHide = [], isObjHeaders = true) {
|
|
122
|
+
if (!obj || typeof obj !== "object") {
|
|
123
|
+
return isObjHeaders ? {} : obj;
|
|
124
|
+
}
|
|
125
|
+
const clone = { ...obj };
|
|
126
|
+
for (const key of keysToHide) {
|
|
127
|
+
if (key in clone) {
|
|
128
|
+
clone[key] = "*******";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return clone;
|
|
92
132
|
}
|
|
93
133
|
};
|
|
@@ -2,9 +2,20 @@ import Watcher from '../core/watcher.cjs';
|
|
|
2
2
|
import { WatcherTypeEnum, RequestEntry } from '../types/index.cjs';
|
|
3
3
|
import 'sql-formatter';
|
|
4
4
|
|
|
5
|
+
type HiddenFields = {
|
|
6
|
+
headers?: string[];
|
|
7
|
+
bodyParams?: string[];
|
|
8
|
+
};
|
|
5
9
|
declare class RequestWatcher extends Watcher {
|
|
6
10
|
name: WatcherTypeEnum;
|
|
7
|
-
|
|
11
|
+
private static readonly DEFAULT_HIDDEN_HEADERS;
|
|
12
|
+
private static readonly DEFAULT_HIDDEN_BODY_PARAMS;
|
|
13
|
+
log(data: RequestEntry, hidden?: HiddenFields): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Normalize headers: converts keys to lowercase.
|
|
16
|
+
*/
|
|
17
|
+
protected normalizeHeaders(headers?: Record<string, string>): Record<string, string>;
|
|
18
|
+
protected hideSensitive<T extends Record<string, any>>(obj?: T, keysToHide?: string[], isObjHeaders?: boolean): T;
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
export { RequestWatcher as default };
|
|
@@ -2,9 +2,20 @@ import Watcher from '../core/watcher.js';
|
|
|
2
2
|
import { WatcherTypeEnum, RequestEntry } from '../types/index.js';
|
|
3
3
|
import 'sql-formatter';
|
|
4
4
|
|
|
5
|
+
type HiddenFields = {
|
|
6
|
+
headers?: string[];
|
|
7
|
+
bodyParams?: string[];
|
|
8
|
+
};
|
|
5
9
|
declare class RequestWatcher extends Watcher {
|
|
6
10
|
name: WatcherTypeEnum;
|
|
7
|
-
|
|
11
|
+
private static readonly DEFAULT_HIDDEN_HEADERS;
|
|
12
|
+
private static readonly DEFAULT_HIDDEN_BODY_PARAMS;
|
|
13
|
+
log(data: RequestEntry, hidden?: HiddenFields): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Normalize headers: converts keys to lowercase.
|
|
16
|
+
*/
|
|
17
|
+
protected normalizeHeaders(headers?: Record<string, string>): Record<string, string>;
|
|
18
|
+
protected hideSensitive<T extends Record<string, any>>(obj?: T, keysToHide?: string[], isObjHeaders?: boolean): T;
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
export { RequestWatcher as default };
|
|
@@ -43,10 +43,19 @@ var Watcher = class {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/watchers/request_watcher.ts
|
|
46
|
-
var RequestWatcher = class extends Watcher {
|
|
46
|
+
var RequestWatcher = class _RequestWatcher extends Watcher {
|
|
47
47
|
name = "request" /* REQUEST */;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
static DEFAULT_HIDDEN_HEADERS = ["Authorization", "Basic"];
|
|
49
|
+
static DEFAULT_HIDDEN_BODY_PARAMS = [
|
|
50
|
+
"password",
|
|
51
|
+
"passwordConfirmation",
|
|
52
|
+
"secret",
|
|
53
|
+
"password_confirmation"
|
|
54
|
+
];
|
|
55
|
+
async log(data, hidden = {}) {
|
|
56
|
+
const headersToHide = (hidden.headers?.length ? hidden.headers : _RequestWatcher.DEFAULT_HIDDEN_HEADERS).map((header) => header.toLowerCase());
|
|
57
|
+
const bodyParamsToHide = hidden.bodyParams?.length ? hidden.bodyParams : _RequestWatcher.DEFAULT_HIDDEN_BODY_PARAMS;
|
|
58
|
+
const payload = {
|
|
50
59
|
id: data.request.id,
|
|
51
60
|
type: this.name,
|
|
52
61
|
minimal_data: {
|
|
@@ -60,9 +69,40 @@ var RequestWatcher = class extends Watcher {
|
|
|
60
69
|
data: {
|
|
61
70
|
...data.request,
|
|
62
71
|
user: data.user,
|
|
63
|
-
response: data.response
|
|
72
|
+
response: data.response || {}
|
|
64
73
|
}
|
|
65
|
-
}
|
|
74
|
+
};
|
|
75
|
+
payload.data.headers = this.hideSensitive(
|
|
76
|
+
this.normalizeHeaders(payload.data.headers),
|
|
77
|
+
headersToHide
|
|
78
|
+
);
|
|
79
|
+
payload.data.response.headers = this.hideSensitive(
|
|
80
|
+
this.normalizeHeaders(payload.data.response?.headers),
|
|
81
|
+
headersToHide
|
|
82
|
+
);
|
|
83
|
+
payload.data.body = this.hideSensitive(payload.data.body, bodyParamsToHide, false);
|
|
84
|
+
await getStore().save(payload);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Normalize headers: converts keys to lowercase.
|
|
88
|
+
*/
|
|
89
|
+
normalizeHeaders(headers) {
|
|
90
|
+
if (!headers || typeof headers !== "object") return {};
|
|
91
|
+
return Object.fromEntries(
|
|
92
|
+
Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
hideSensitive(obj, keysToHide = [], isObjHeaders = true) {
|
|
96
|
+
if (!obj || typeof obj !== "object") {
|
|
97
|
+
return isObjHeaders ? {} : obj;
|
|
98
|
+
}
|
|
99
|
+
const clone = { ...obj };
|
|
100
|
+
for (const key of keysToHide) {
|
|
101
|
+
if (key in clone) {
|
|
102
|
+
clone[key] = "*******";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return clone;
|
|
66
106
|
}
|
|
67
107
|
};
|
|
68
108
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lensjs/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@lensjs/typescript-config": "1.0.12"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"denque": "^2.1.0",
|
|
28
29
|
"libsql": "^0.5.22",
|
|
29
30
|
"luxon": "^3.7.2",
|
|
30
31
|
"rimraf": "^6.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./index-EQXljT95.js";import{L as s}from"./LoadMore-Du7yL-Hr.js";import{T as t}from"./Table-BtkmKVTF.js";import{g as r}from"./columns-DF7BR0z_.js";import"./index-BRRKsoNv.js";import"./CacheActionBadge-CL10Xlw7.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CacheEntriesTable-DuLoeu0e.js","./index-EQXljT95.js","./index-CMJVCuvo.css","./LoadMore-Du7yL-Hr.js","./Table-BtkmKVTF.js","./columns-DF7BR0z_.js","./index-BRRKsoNv.js","./CacheActionBadge-CL10Xlw7.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as t,j as a,_ as s}from"./index-EQXljT95.js";import{u as i}from"./useLoadMore-C2bqGSaL.js";import{u as m}from"./useCacheEntries-jC9XYsV_.js";import"./useLensApi-CPvDlyGv.js";const n=t.lazy(()=>s(()=>import("./CacheEntriesTable-DuLoeu0e.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 +0,0 @@
|
|
|
1
|
-
import{j as a,L as s,q as i,k as r}from"./index-EQXljT95.js";import{D as n,T as o,J as u}from"./TabbedDataViewer-C60W9bqz.js";import{C as d}from"./CacheActionBadge-CL10Xlw7.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,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CacheEntryDetails-k-74LsSb.js","./index-EQXljT95.js","./index-CMJVCuvo.css","./TabbedDataViewer-C60W9bqz.js","./CacheActionBadge-CL10Xlw7.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{m as o,r as s,j as r,_ as i}from"./index-EQXljT95.js";import{u as m}from"./useCacheEntries-jC9XYsV_.js";import"./useLensApi-CPvDlyGv.js";const n=s.lazy(()=>i(()=>import("./CacheEntryDetails-k-74LsSb.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExceptionTable-BkFSFGbn.js","./index-EQXljT95.js","./index-CMJVCuvo.css","./LoadMore-Du7yL-Hr.js","./Table-BtkmKVTF.js","./columns-D_NhXbk6.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as t,j as s,_ as a}from"./index-EQXljT95.js";import{u as i}from"./useLoadMore-C2bqGSaL.js";import{u as m}from"./useExceptions-CwwK33mG.js";import"./useLensApi-CPvDlyGv.js";const n=t.lazy(()=>a(()=>import("./ExceptionTable-BkFSFGbn.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,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExceptionDetails-Bzj8OZ70.js","./index-EQXljT95.js","./index-CMJVCuvo.css","./TabbedDataViewer-C60W9bqz.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{m as a,r as s,j as r,_ as i}from"./index-EQXljT95.js";import{u as m}from"./useExceptions-CwwK33mG.js";import"./useLensApi-CPvDlyGv.js";const n=s.lazy(()=>i(()=>import("./ExceptionDetails-Bzj8OZ70.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,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./QueryTable-tJVEncUM.js","./index-EQXljT95.js","./index-CMJVCuvo.css","./LoadMore-Du7yL-Hr.js","./Table-BtkmKVTF.js","./columns-DlGaMv5C.js","./index-BRRKsoNv.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,j as s,_ as a}from"./index-EQXljT95.js";import{u as i}from"./useQueries-CzbIajH6.js";import{u}from"./useLoadMore-C2bqGSaL.js";import"./useLensApi-CPvDlyGv.js";const m=e.lazy(()=>a(()=>import("./QueryTable-tJVEncUM.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};
|