@mastra/pg 1.28.1-alpha.1 → 1.29.0
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 +25 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10455,6 +10455,7 @@ function dedupeMessagesForSave(messages) {
|
|
|
10455
10455
|
var MemoryPG = class MemoryPG extends MemoryStorage {
|
|
10456
10456
|
supportsPartialThreadUpdate = true;
|
|
10457
10457
|
supportsObservationalMemory = true;
|
|
10458
|
+
supportsObservationalMemoryHistorySearch = true;
|
|
10458
10459
|
/**
|
|
10459
10460
|
* Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
|
|
10460
10461
|
* on the timezone-aware `createdAtZ` mirror column (kept in sync by triggers),
|
|
@@ -12061,6 +12062,10 @@ var MemoryPG = class MemoryPG extends MemoryStorage {
|
|
|
12061
12062
|
const conditions = [`"lookupKey" = $1`];
|
|
12062
12063
|
const params = [lookupKey];
|
|
12063
12064
|
let paramIndex = 2;
|
|
12065
|
+
if (options?.recordId !== void 0) {
|
|
12066
|
+
conditions.push(`id = $${paramIndex++}`);
|
|
12067
|
+
params.push(options.recordId);
|
|
12068
|
+
}
|
|
12064
12069
|
if (options?.from) {
|
|
12065
12070
|
conditions.push(`"createdAtZ" >= $${paramIndex}`);
|
|
12066
12071
|
params.push(options.from.toISOString());
|
|
@@ -12071,8 +12076,27 @@ var MemoryPG = class MemoryPG extends MemoryStorage {
|
|
|
12071
12076
|
params.push(options.to.toISOString());
|
|
12072
12077
|
paramIndex++;
|
|
12073
12078
|
}
|
|
12079
|
+
if (options?.groupId !== void 0) {
|
|
12080
|
+
conditions.push(`(strpos("activeObservations", $${paramIndex}) > 0 OR EXISTS (
|
|
12081
|
+
SELECT 1 FROM jsonb_array_elements(
|
|
12082
|
+
CASE WHEN jsonb_typeof("bufferedObservationChunks") = 'array' THEN "bufferedObservationChunks" ELSE '[]'::jsonb END
|
|
12083
|
+
) AS chunk
|
|
12084
|
+
WHERE strpos(chunk->>'observations', $${paramIndex}) > 0
|
|
12085
|
+
))`);
|
|
12086
|
+
paramIndex++;
|
|
12087
|
+
params.push(`<observation-group id="${options.groupId}"`);
|
|
12088
|
+
}
|
|
12089
|
+
if (options?.beforeGeneration !== void 0) {
|
|
12090
|
+
conditions.push(`"generationCount" < $${paramIndex++}`);
|
|
12091
|
+
params.push(options.beforeGeneration);
|
|
12092
|
+
}
|
|
12093
|
+
if (options?.afterGeneration !== void 0) {
|
|
12094
|
+
conditions.push(`"generationCount" > $${paramIndex++}`);
|
|
12095
|
+
params.push(options.afterGeneration);
|
|
12096
|
+
}
|
|
12097
|
+
const order = options?.sortDirection === "ASC" ? `"generationCount" ASC, "createdAt" ASC, id ASC` : OM_GENERATION_ORDER;
|
|
12074
12098
|
params.push(limit);
|
|
12075
|
-
let sql = `SELECT * FROM ${tableName} WHERE ${conditions.join(" AND ")} ORDER BY ${
|
|
12099
|
+
let sql = `SELECT * FROM ${tableName} WHERE ${conditions.join(" AND ")} ORDER BY ${order} LIMIT $${paramIndex}`;
|
|
12076
12100
|
paramIndex++;
|
|
12077
12101
|
if (options?.offset != null) {
|
|
12078
12102
|
params.push(options.offset);
|