@workglow/indexeddb 0.2.34 → 0.2.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/storage/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/storage/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,wCAAwC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/storage/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/storage/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,UAAU,CAAC"}
@@ -1081,7 +1081,7 @@ class IndexedDbTabularStorage extends BaseTabularStorage {
1081
1081
  };
1082
1082
  });
1083
1083
  }
1084
- async getBulk(offset, limit) {
1084
+ async getOffsetPage(offset, limit) {
1085
1085
  if (offset < 0) {
1086
1086
  throw new RangeError(`offset must be non-negative, got ${offset}`);
1087
1087
  }
@@ -1518,21 +1518,6 @@ function matchesFilter(metadata, filter) {
1518
1518
  }
1519
1519
  return true;
1520
1520
  }
1521
- function textRelevance(text, query) {
1522
- const textLower = text.toLowerCase();
1523
- const queryLower = query.toLowerCase();
1524
- const queryWords = queryLower.split(/\s+/).filter((w) => w.length > 0);
1525
- if (queryWords.length === 0) {
1526
- return 0;
1527
- }
1528
- let matches = 0;
1529
- for (const word of queryWords) {
1530
- if (textLower.includes(word)) {
1531
- matches++;
1532
- }
1533
- }
1534
- return matches / queryWords.length;
1535
- }
1536
1521
 
1537
1522
  class IndexedDbVectorStorage extends IndexedDbTabularStorage {
1538
1523
  vectorDimensions;
@@ -1574,35 +1559,6 @@ class IndexedDbVectorStorage extends IndexedDbTabularStorage {
1574
1559
  const topResults = results.slice(0, topK);
1575
1560
  return topResults;
1576
1561
  }
1577
- async hybridSearch(query, options) {
1578
- const { topK = 10, filter, scoreThreshold = 0, textQuery, vectorWeight = 0.7 } = options;
1579
- if (!textQuery || textQuery.trim().length === 0) {
1580
- return this.similaritySearch(query, { topK, filter, scoreThreshold });
1581
- }
1582
- const results = [];
1583
- const allEntities = await this.getAll() || [];
1584
- for (const entity of allEntities) {
1585
- const vector = entity[this.vectorPropertyName];
1586
- const metadata = this.metadataPropertyName ? entity[this.metadataPropertyName] : {};
1587
- if (filter && !matchesFilter(metadata, filter)) {
1588
- continue;
1589
- }
1590
- const vectorScore = cosineSimilarity(query, vector);
1591
- const metadataText = Object.values(metadata).join(" ").toLowerCase();
1592
- const textScore = textRelevance(metadataText, textQuery);
1593
- const combinedScore = vectorWeight * vectorScore + (1 - vectorWeight) * textScore;
1594
- if (combinedScore < scoreThreshold) {
1595
- continue;
1596
- }
1597
- results.push({
1598
- ...entity,
1599
- score: combinedScore
1600
- });
1601
- }
1602
- results.sort((a, b) => b.score - a.score);
1603
- const topResults = results.slice(0, topK);
1604
- return topResults;
1605
- }
1606
1562
  }
1607
1563
  export {
1608
1564
  runIndexedDbMigrationGroups,
@@ -1621,4 +1577,4 @@ export {
1621
1577
  IDB_KV_REPOSITORY
1622
1578
  };
1623
1579
 
1624
- //# debugId=2A9580D89ED3759364756E2164756E21
1580
+ //# debugId=57629A91C188FCE764756E2164756E21