@mastra/pg 1.28.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/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -10479,6 +10479,7 @@ function dedupeMessagesForSave(messages) {
|
|
|
10479
10479
|
var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
|
|
10480
10480
|
supportsPartialThreadUpdate = true;
|
|
10481
10481
|
supportsObservationalMemory = true;
|
|
10482
|
+
supportsObservationalMemoryHistorySearch = true;
|
|
10482
10483
|
/**
|
|
10483
10484
|
* Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
|
|
10484
10485
|
* on the timezone-aware `createdAtZ` mirror column (kept in sync by triggers),
|
|
@@ -12085,6 +12086,10 @@ var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
|
|
|
12085
12086
|
const conditions = [`"lookupKey" = $1`];
|
|
12086
12087
|
const params = [lookupKey];
|
|
12087
12088
|
let paramIndex = 2;
|
|
12089
|
+
if (options?.recordId !== void 0) {
|
|
12090
|
+
conditions.push(`id = $${paramIndex++}`);
|
|
12091
|
+
params.push(options.recordId);
|
|
12092
|
+
}
|
|
12088
12093
|
if (options?.from) {
|
|
12089
12094
|
conditions.push(`"createdAtZ" >= $${paramIndex}`);
|
|
12090
12095
|
params.push(options.from.toISOString());
|
|
@@ -12095,8 +12100,27 @@ var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
|
|
|
12095
12100
|
params.push(options.to.toISOString());
|
|
12096
12101
|
paramIndex++;
|
|
12097
12102
|
}
|
|
12103
|
+
if (options?.groupId !== void 0) {
|
|
12104
|
+
conditions.push(`(strpos("activeObservations", $${paramIndex}) > 0 OR EXISTS (
|
|
12105
|
+
SELECT 1 FROM jsonb_array_elements(
|
|
12106
|
+
CASE WHEN jsonb_typeof("bufferedObservationChunks") = 'array' THEN "bufferedObservationChunks" ELSE '[]'::jsonb END
|
|
12107
|
+
) AS chunk
|
|
12108
|
+
WHERE strpos(chunk->>'observations', $${paramIndex}) > 0
|
|
12109
|
+
))`);
|
|
12110
|
+
paramIndex++;
|
|
12111
|
+
params.push(`<observation-group id="${options.groupId}"`);
|
|
12112
|
+
}
|
|
12113
|
+
if (options?.beforeGeneration !== void 0) {
|
|
12114
|
+
conditions.push(`"generationCount" < $${paramIndex++}`);
|
|
12115
|
+
params.push(options.beforeGeneration);
|
|
12116
|
+
}
|
|
12117
|
+
if (options?.afterGeneration !== void 0) {
|
|
12118
|
+
conditions.push(`"generationCount" > $${paramIndex++}`);
|
|
12119
|
+
params.push(options.afterGeneration);
|
|
12120
|
+
}
|
|
12121
|
+
const order = options?.sortDirection === "ASC" ? `"generationCount" ASC, "createdAt" ASC, id ASC` : OM_GENERATION_ORDER;
|
|
12098
12122
|
params.push(limit);
|
|
12099
|
-
let sql = `SELECT * FROM ${tableName} WHERE ${conditions.join(" AND ")} ORDER BY ${
|
|
12123
|
+
let sql = `SELECT * FROM ${tableName} WHERE ${conditions.join(" AND ")} ORDER BY ${order} LIMIT $${paramIndex}`;
|
|
12100
12124
|
paramIndex++;
|
|
12101
12125
|
if (options?.offset != null) {
|
|
12102
12126
|
params.push(options.offset);
|