@superatomai/sdk-node 0.0.41-mds → 0.0.42-mds
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/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2712,7 +2712,8 @@ declare const openaiLLM: OpenAILLM;
|
|
|
2712
2712
|
* Query Cache — Two mechanisms:
|
|
2713
2713
|
*
|
|
2714
2714
|
* 1. `cache` (query string → result data) — TTL-based with max size, for avoiding re-execution
|
|
2715
|
-
* of recently validated queries. LRU eviction
|
|
2715
|
+
* of recently validated queries. True LRU eviction: reads bubble entries to the back via
|
|
2716
|
+
* delete+re-set so the oldest *unused* entry is evicted, not the oldest *inserted*.
|
|
2716
2717
|
*
|
|
2717
2718
|
* 2. Encrypted queryId tokens — SQL is encrypted into the queryId itself (self-contained).
|
|
2718
2719
|
* No server-side storage needed for SQL mappings. The token is decrypted on each request.
|
|
@@ -2739,11 +2740,16 @@ declare class QueryCache {
|
|
|
2739
2740
|
*/
|
|
2740
2741
|
getTTL(): number;
|
|
2741
2742
|
/**
|
|
2742
|
-
* Store query result in data cache
|
|
2743
|
+
* Store query result in data cache.
|
|
2744
|
+
* If the key already exists, it's removed first so the re-insert places it
|
|
2745
|
+
* at the back of the iteration order (LRU). Eviction only fires when adding
|
|
2746
|
+
* a genuinely new key past the size limit.
|
|
2743
2747
|
*/
|
|
2744
2748
|
set(query: string, data: any): void;
|
|
2745
2749
|
/**
|
|
2746
|
-
* Get cached result if exists and not expired
|
|
2750
|
+
* Get cached result if exists and not expired.
|
|
2751
|
+
* On hit, re-inserts the entry so it moves to the back of the Map's
|
|
2752
|
+
* iteration order — turning FIFO eviction into true LRU.
|
|
2747
2753
|
*/
|
|
2748
2754
|
get(query: string): any | null;
|
|
2749
2755
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2712,7 +2712,8 @@ declare const openaiLLM: OpenAILLM;
|
|
|
2712
2712
|
* Query Cache — Two mechanisms:
|
|
2713
2713
|
*
|
|
2714
2714
|
* 1. `cache` (query string → result data) — TTL-based with max size, for avoiding re-execution
|
|
2715
|
-
* of recently validated queries. LRU eviction
|
|
2715
|
+
* of recently validated queries. True LRU eviction: reads bubble entries to the back via
|
|
2716
|
+
* delete+re-set so the oldest *unused* entry is evicted, not the oldest *inserted*.
|
|
2716
2717
|
*
|
|
2717
2718
|
* 2. Encrypted queryId tokens — SQL is encrypted into the queryId itself (self-contained).
|
|
2718
2719
|
* No server-side storage needed for SQL mappings. The token is decrypted on each request.
|
|
@@ -2739,11 +2740,16 @@ declare class QueryCache {
|
|
|
2739
2740
|
*/
|
|
2740
2741
|
getTTL(): number;
|
|
2741
2742
|
/**
|
|
2742
|
-
* Store query result in data cache
|
|
2743
|
+
* Store query result in data cache.
|
|
2744
|
+
* If the key already exists, it's removed first so the re-insert places it
|
|
2745
|
+
* at the back of the iteration order (LRU). Eviction only fires when adding
|
|
2746
|
+
* a genuinely new key past the size limit.
|
|
2743
2747
|
*/
|
|
2744
2748
|
set(query: string, data: any): void;
|
|
2745
2749
|
/**
|
|
2746
|
-
* Get cached result if exists and not expired
|
|
2750
|
+
* Get cached result if exists and not expired.
|
|
2751
|
+
* On hit, re-inserts the entry so it moves to the back of the Map's
|
|
2752
|
+
* iteration order — turning FIFO eviction into true LRU.
|
|
2747
2753
|
*/
|
|
2748
2754
|
get(query: string): any | null;
|
|
2749
2755
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1536,7 +1536,7 @@ var QueryCache = class {
|
|
|
1536
1536
|
this.cache = /* @__PURE__ */ new Map();
|
|
1537
1537
|
this.ttlMs = 10 * 60 * 1e3;
|
|
1538
1538
|
// Default: 10 minutes
|
|
1539
|
-
this.maxCacheSize =
|
|
1539
|
+
this.maxCacheSize = 5e3;
|
|
1540
1540
|
// Max data cache entries
|
|
1541
1541
|
this.cleanupInterval = null;
|
|
1542
1542
|
// Encryption for queryId tokens
|
|
@@ -1563,9 +1563,13 @@ var QueryCache = class {
|
|
|
1563
1563
|
return this.ttlMs / 60 / 1e3;
|
|
1564
1564
|
}
|
|
1565
1565
|
/**
|
|
1566
|
-
* Store query result in data cache
|
|
1566
|
+
* Store query result in data cache.
|
|
1567
|
+
* If the key already exists, it's removed first so the re-insert places it
|
|
1568
|
+
* at the back of the iteration order (LRU). Eviction only fires when adding
|
|
1569
|
+
* a genuinely new key past the size limit.
|
|
1567
1570
|
*/
|
|
1568
1571
|
set(query, data) {
|
|
1572
|
+
this.cache.delete(query);
|
|
1569
1573
|
if (this.cache.size >= this.maxCacheSize) {
|
|
1570
1574
|
const oldestKey = this.cache.keys().next().value;
|
|
1571
1575
|
if (oldestKey) this.cache.delete(oldestKey);
|
|
@@ -1578,7 +1582,9 @@ var QueryCache = class {
|
|
|
1578
1582
|
logger.debug(`[QueryCache] Stored result for query (${query.substring(0, 50)}...)`);
|
|
1579
1583
|
}
|
|
1580
1584
|
/**
|
|
1581
|
-
* Get cached result if exists and not expired
|
|
1585
|
+
* Get cached result if exists and not expired.
|
|
1586
|
+
* On hit, re-inserts the entry so it moves to the back of the Map's
|
|
1587
|
+
* iteration order — turning FIFO eviction into true LRU.
|
|
1582
1588
|
*/
|
|
1583
1589
|
get(query) {
|
|
1584
1590
|
const entry = this.cache.get(query);
|
|
@@ -1587,6 +1593,8 @@ var QueryCache = class {
|
|
|
1587
1593
|
this.cache.delete(query);
|
|
1588
1594
|
return null;
|
|
1589
1595
|
}
|
|
1596
|
+
this.cache.delete(query);
|
|
1597
|
+
this.cache.set(query, entry);
|
|
1590
1598
|
logger.info(`[QueryCache] Cache HIT for query (${query.substring(0, 50)}...)`);
|
|
1591
1599
|
return entry.data;
|
|
1592
1600
|
}
|