@elizaos/plugin-sql 1.6.2-alpha.2 → 1.6.2-alpha.3
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/browser/index.browser.js +17 -4
- package/dist/browser/index.browser.js.map +3 -3
- package/dist/browser/tsconfig.build.tsbuildinfo +1 -1
- package/dist/node/index.node.js +17 -4
- package/dist/node/index.node.js.map +3 -3
- package/dist/node/tsconfig.build.node.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/node/index.node.js
CHANGED
|
@@ -9022,9 +9022,12 @@ class BaseDrizzleAdapter extends DatabaseAdapter {
|
|
|
9022
9022
|
});
|
|
9023
9023
|
}
|
|
9024
9024
|
async getMemories(params) {
|
|
9025
|
-
const { entityId, agentId, roomId, worldId, tableName, unique: unique2, start, end } = params;
|
|
9025
|
+
const { entityId, agentId, roomId, worldId, tableName, unique: unique2, start, end, offset } = params;
|
|
9026
9026
|
if (!tableName)
|
|
9027
9027
|
throw new Error("tableName is required");
|
|
9028
|
+
if (offset !== undefined && offset < 0) {
|
|
9029
|
+
throw new Error("offset must be a non-negative number");
|
|
9030
|
+
}
|
|
9028
9031
|
return this.withDatabase(async () => {
|
|
9029
9032
|
const conditions2 = [eq(memoryTable.type, tableName)];
|
|
9030
9033
|
if (start) {
|
|
@@ -9048,7 +9051,7 @@ class BaseDrizzleAdapter extends DatabaseAdapter {
|
|
|
9048
9051
|
if (agentId) {
|
|
9049
9052
|
conditions2.push(eq(memoryTable.agentId, agentId));
|
|
9050
9053
|
}
|
|
9051
|
-
const
|
|
9054
|
+
const baseQuery = this.db.select({
|
|
9052
9055
|
memory: {
|
|
9053
9056
|
id: memoryTable.id,
|
|
9054
9057
|
type: memoryTable.type,
|
|
@@ -9062,7 +9065,17 @@ class BaseDrizzleAdapter extends DatabaseAdapter {
|
|
|
9062
9065
|
},
|
|
9063
9066
|
embedding: embeddingTable[this.embeddingDimension]
|
|
9064
9067
|
}).from(memoryTable).leftJoin(embeddingTable, eq(embeddingTable.memoryId, memoryTable.id)).where(and(...conditions2)).orderBy(desc(memoryTable.createdAt));
|
|
9065
|
-
const rows =
|
|
9068
|
+
const rows = await (async () => {
|
|
9069
|
+
if (params.count && offset !== undefined && offset > 0) {
|
|
9070
|
+
return baseQuery.limit(params.count).offset(offset);
|
|
9071
|
+
} else if (params.count) {
|
|
9072
|
+
return baseQuery.limit(params.count);
|
|
9073
|
+
} else if (offset !== undefined && offset > 0) {
|
|
9074
|
+
return baseQuery.offset(offset);
|
|
9075
|
+
} else {
|
|
9076
|
+
return baseQuery;
|
|
9077
|
+
}
|
|
9078
|
+
})();
|
|
9066
9079
|
return rows.map((row) => ({
|
|
9067
9080
|
id: row.memory.id,
|
|
9068
9081
|
type: row.memory.type,
|
|
@@ -11081,5 +11094,5 @@ export {
|
|
|
11081
11094
|
DatabaseMigrationService
|
|
11082
11095
|
};
|
|
11083
11096
|
|
|
11084
|
-
//# debugId=
|
|
11097
|
+
//# debugId=7A3BF5DE0942149C64756E2164756E21
|
|
11085
11098
|
//# sourceMappingURL=index.node.js.map
|