@mastra/lance 1.5.2-alpha.0 → 1.5.2
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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +16 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -24
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { MessageList } from "@mastra/core/agent";
|
|
|
7
7
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
8
8
|
import { MastraVector } from "@mastra/core/vector";
|
|
9
9
|
import { BaseFilterTranslator } from "@mastra/core/vector/filter";
|
|
10
|
-
|
|
10
|
+
// src/storage/db/utils.ts
|
|
11
11
|
function getPrimaryKeys(tableName) {
|
|
12
12
|
let primaryId = ["id"];
|
|
13
13
|
if (tableName === TABLE_WORKFLOW_SNAPSHOT) primaryId = ["workflow_name", "run_id"];
|
|
@@ -80,8 +80,7 @@ async function getTableSchema({ tableName, client }) {
|
|
|
80
80
|
}, error);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
//#region src/storage/db/index.ts
|
|
83
|
+
// src/storage/db/index.ts
|
|
85
84
|
/**
|
|
86
85
|
* Resolves LanceDomainConfig to a LanceDB Connection.
|
|
87
86
|
*/
|
|
@@ -412,7 +411,7 @@ var LanceDB = class extends MastraBase {
|
|
|
412
411
|
const quotedKey = /^[a-z][a-zA-Z]*$/.test(key) && /[A-Z]/.test(key) ? `\`${key}\`` : key;
|
|
413
412
|
if (typeof value === "string") return `${quotedKey} = '${value}'`;
|
|
414
413
|
else if (value === null) return `${quotedKey} IS NULL`;
|
|
415
|
-
|
|
414
|
+
return `${quotedKey} = ${value}`;
|
|
416
415
|
}).join(" AND ");
|
|
417
416
|
this.logger.debug("where clause generated: " + filterConditions);
|
|
418
417
|
query.where(filterConditions);
|
|
@@ -438,8 +437,7 @@ var LanceDB = class extends MastraBase {
|
|
|
438
437
|
}
|
|
439
438
|
}
|
|
440
439
|
};
|
|
441
|
-
|
|
442
|
-
//#region src/storage/domains/background-tasks/index.ts
|
|
440
|
+
// src/storage/domains/background-tasks/index.ts
|
|
443
441
|
function serializeJson(v) {
|
|
444
442
|
if (typeof v === "object" && v != null) return JSON.stringify(v);
|
|
445
443
|
return v ?? void 0;
|
|
@@ -642,8 +640,7 @@ var StoreBackgroundTasksLance = class extends BackgroundTasksStorage {
|
|
|
642
640
|
return total;
|
|
643
641
|
}
|
|
644
642
|
};
|
|
645
|
-
|
|
646
|
-
//#region src/storage/domains/memory/index.ts
|
|
643
|
+
// src/storage/domains/memory/index.ts
|
|
647
644
|
var StoreMemoryLance = class extends MemoryStorage {
|
|
648
645
|
client;
|
|
649
646
|
#db;
|
|
@@ -1373,8 +1370,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
1373
1370
|
throw new Error("Unexpected end of retry loop");
|
|
1374
1371
|
}
|
|
1375
1372
|
};
|
|
1376
|
-
|
|
1377
|
-
//#region src/storage/domains/scores/index.ts
|
|
1373
|
+
// src/storage/domains/scores/index.ts
|
|
1378
1374
|
/** Escapes a value for safe inclusion in a single-quoted Lance SQL string literal. */
|
|
1379
1375
|
function lanceStringLiteral(value) {
|
|
1380
1376
|
return `'${value.replaceAll("'", "''")}'`;
|
|
@@ -1644,8 +1640,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1644
1640
|
}
|
|
1645
1641
|
}
|
|
1646
1642
|
};
|
|
1647
|
-
|
|
1648
|
-
//#region src/storage/domains/workflows/index.ts
|
|
1643
|
+
// src/storage/domains/workflows/index.ts
|
|
1649
1644
|
/**
|
|
1650
1645
|
* Escapes single quotes in SQL string values to prevent SQL injection.
|
|
1651
1646
|
*/
|
|
@@ -1840,8 +1835,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1840
1835
|
}
|
|
1841
1836
|
}
|
|
1842
1837
|
};
|
|
1843
|
-
|
|
1844
|
-
//#region src/storage/index.ts
|
|
1838
|
+
// src/storage/index.ts
|
|
1845
1839
|
/**
|
|
1846
1840
|
* LanceDB storage adapter for Mastra.
|
|
1847
1841
|
*
|
|
@@ -1962,8 +1956,7 @@ var LanceStorage = class LanceStorage extends MastraCompositeStore {
|
|
|
1962
1956
|
this.stores = {};
|
|
1963
1957
|
}
|
|
1964
1958
|
};
|
|
1965
|
-
|
|
1966
|
-
//#region src/vector/filter.ts
|
|
1959
|
+
// src/vector/filter.ts
|
|
1967
1960
|
var LanceFilterTranslator = class extends BaseFilterTranslator {
|
|
1968
1961
|
translate(filter) {
|
|
1969
1962
|
if (!filter || Object.keys(filter).length === 0) return "";
|
|
@@ -1992,13 +1985,13 @@ var LanceFilterTranslator = class extends BaseFilterTranslator {
|
|
|
1992
1985
|
if (keys.length > 1) return keys.map((key) => {
|
|
1993
1986
|
const value = obj[key];
|
|
1994
1987
|
if (this.isNestedObject(value) && !this.isDateObject(value)) return this.processNestedObject(key, value);
|
|
1995
|
-
|
|
1988
|
+
return this.processField(key, value);
|
|
1996
1989
|
}).join(" AND ");
|
|
1997
1990
|
if (keys.length === 1) {
|
|
1998
1991
|
const key = keys[0];
|
|
1999
1992
|
const value = obj[key];
|
|
2000
1993
|
if (this.isNestedObject(value) && !this.isDateObject(value)) return this.processNestedObject(key, value);
|
|
2001
|
-
|
|
1994
|
+
return this.processField(key, value);
|
|
2002
1995
|
}
|
|
2003
1996
|
}
|
|
2004
1997
|
return "";
|
|
@@ -2013,7 +2006,7 @@ var LanceFilterTranslator = class extends BaseFilterTranslator {
|
|
|
2013
2006
|
const keys = Object.keys(condObj);
|
|
2014
2007
|
if (keys.length === 1 && this.isOperator(keys[0])) {
|
|
2015
2008
|
if (this.isLogicalOperator(keys[0])) return `(${this.processLogicalOperator(keys[0], condObj[keys[0]])})`;
|
|
2016
|
-
|
|
2009
|
+
throw new Error(BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(keys[0]));
|
|
2017
2010
|
}
|
|
2018
2011
|
if (keys.length > 1) return `(${this.processFilter(condition)})`;
|
|
2019
2012
|
return this.processFilter(condition);
|
|
@@ -2028,7 +2021,7 @@ var LanceFilterTranslator = class extends BaseFilterTranslator {
|
|
|
2028
2021
|
return keys.map((key) => {
|
|
2029
2022
|
const nestedPath = key.includes(".") ? `${path}.${key}` : `${path}.${key}`;
|
|
2030
2023
|
if (this.isNestedObject(obj[key]) && !this.isDateObject(obj[key])) return this.processNestedObject(nestedPath, obj[key]);
|
|
2031
|
-
|
|
2024
|
+
return this.processField(nestedPath, obj[key]);
|
|
2032
2025
|
}).join(" AND ");
|
|
2033
2026
|
}
|
|
2034
2027
|
processField(field, value) {
|
|
@@ -2190,8 +2183,7 @@ var LanceFilterTranslator = class extends BaseFilterTranslator {
|
|
|
2190
2183
|
};
|
|
2191
2184
|
}
|
|
2192
2185
|
};
|
|
2193
|
-
|
|
2194
|
-
//#region src/vector/index.ts
|
|
2186
|
+
// src/vector/index.ts
|
|
2195
2187
|
const LANCE_INDEX_FINGERPRINT_KEY = "mastra.index.fingerprint";
|
|
2196
2188
|
const LANCE_INDEX_UUID_KEY = "mastra.index.uuid";
|
|
2197
2189
|
var LanceVectorStore = class LanceVectorStore extends MastraVector {
|
|
@@ -2601,7 +2593,8 @@ var LanceVectorStore = class LanceVectorStore extends MastraVector {
|
|
|
2601
2593
|
}
|
|
2602
2594
|
this.logger.debug(`Table ${resolvedTableName} created. Index creation deferred until data is available.`);
|
|
2603
2595
|
return;
|
|
2604
|
-
}
|
|
2596
|
+
}
|
|
2597
|
+
table = await this.lanceClient.openTable(resolvedTableName);
|
|
2605
2598
|
const metricType = this.mastraMetricToLance(metric);
|
|
2606
2599
|
const rowCount = await table.countRows();
|
|
2607
2600
|
if (rowCount < 256) {
|
|
@@ -3180,7 +3173,6 @@ var LanceVectorStore = class LanceVectorStore extends MastraVector {
|
|
|
3180
3173
|
}
|
|
3181
3174
|
}
|
|
3182
3175
|
};
|
|
3183
|
-
//#endregion
|
|
3184
3176
|
export { LanceStorage, LanceVectorStore, StoreBackgroundTasksLance, StoreMemoryLance, StoreScoresLance, StoreWorkflowsLance };
|
|
3185
3177
|
|
|
3186
3178
|
//# sourceMappingURL=index.js.map
|