@rebasepro/plugin-insights 0.12.1-canary.g389e9b2 → 0.12.1-canary.g4e7bcbf
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/plugin-insights",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.1-canary.
|
|
4
|
+
"version": "0.12.1-canary.g4e7bcbf",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.es.js",
|
|
7
7
|
"module": "./dist/index.es.js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@rebasepro/admin-types": "0.12.1-canary.
|
|
20
|
-
"@rebasepro/
|
|
21
|
-
"@rebasepro/
|
|
22
|
-
"@rebasepro/ui": "0.12.1-canary.
|
|
19
|
+
"@rebasepro/admin-types": "0.12.1-canary.g4e7bcbf",
|
|
20
|
+
"@rebasepro/app": "0.12.1-canary.g4e7bcbf",
|
|
21
|
+
"@rebasepro/types": "0.12.1-canary.g4e7bcbf",
|
|
22
|
+
"@rebasepro/ui": "0.12.1-canary.g4e7bcbf"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=19.0.0",
|
|
@@ -5,8 +5,7 @@ describe("InsightsCache", () => {
|
|
|
5
5
|
it("should set and get values from cache", () => {
|
|
6
6
|
const cache = new InsightsCache();
|
|
7
7
|
const data: InsightDataResult = {
|
|
8
|
-
|
|
9
|
-
columns: ["count"]
|
|
8
|
+
rows: [{ count: 10 }]
|
|
10
9
|
};
|
|
11
10
|
cache.set("query_key", data);
|
|
12
11
|
expect(cache.get("query_key")).toEqual(data);
|
|
@@ -15,8 +14,7 @@ describe("InsightsCache", () => {
|
|
|
15
14
|
it("should return null for expired keys", () => {
|
|
16
15
|
const cache = new InsightsCache(-1); // -1ms TTL to force immediate expiry
|
|
17
16
|
const data: InsightDataResult = {
|
|
18
|
-
|
|
19
|
-
columns: ["count"]
|
|
17
|
+
rows: [{ count: 10 }]
|
|
20
18
|
};
|
|
21
19
|
cache.set("query_key", data);
|
|
22
20
|
// Expired immediately
|
|
@@ -25,9 +23,8 @@ describe("InsightsCache", () => {
|
|
|
25
23
|
|
|
26
24
|
it("should manage inflight requests", () => {
|
|
27
25
|
const cache = new InsightsCache();
|
|
28
|
-
const promise = Promise.resolve({
|
|
29
|
-
|
|
30
|
-
columns: []
|
|
26
|
+
const promise = Promise.resolve<InsightDataResult>({
|
|
27
|
+
rows: []
|
|
31
28
|
});
|
|
32
29
|
expect(cache.getInflight("query_key")).toBeNull();
|
|
33
30
|
|
|
@@ -35,16 +32,14 @@ describe("InsightsCache", () => {
|
|
|
35
32
|
expect(cache.getInflight("query_key")).toBe(promise);
|
|
36
33
|
|
|
37
34
|
// Setting a result should remove the inflight reference
|
|
38
|
-
const data: InsightDataResult = {
|
|
39
|
-
columns: [] };
|
|
35
|
+
const data: InsightDataResult = { rows: [] };
|
|
40
36
|
cache.set("query_key", data);
|
|
41
37
|
expect(cache.getInflight("query_key")).toBeNull();
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
it("should invalidate entries", () => {
|
|
45
41
|
const cache = new InsightsCache();
|
|
46
|
-
const data: InsightDataResult = {
|
|
47
|
-
columns: [] };
|
|
42
|
+
const data: InsightDataResult = { rows: [] };
|
|
48
43
|
cache.set("key_1", data);
|
|
49
44
|
cache.set("key_2", data);
|
|
50
45
|
|