@mastra/mysql 0.11.1 → 0.12.1-alpha.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 +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -3
- 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/dist/storage/domains/schedules/index.d.ts +2 -2
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6121,6 +6121,7 @@ function addMySQLMessageMetadataFilter(conditions, params, metadataFilter) {
|
|
|
6121
6121
|
var MemoryMySQL = class MemoryMySQL extends _mastra_core_storage.MemoryStorage {
|
|
6122
6122
|
supportsPartialThreadUpdate = true;
|
|
6123
6123
|
supportsObservationalMemory = true;
|
|
6124
|
+
supportsObservationalMemoryHistorySearch = true;
|
|
6124
6125
|
pool;
|
|
6125
6126
|
operations;
|
|
6126
6127
|
#skipDefaultIndexes;
|
|
@@ -7323,6 +7324,10 @@ var MemoryMySQL = class MemoryMySQL extends _mastra_core_storage.MemoryStorage {
|
|
|
7323
7324
|
const safeLimit = Math.max(1, Math.floor(Number(limit)) || 10);
|
|
7324
7325
|
const conditions = [`${omCol("lookupKey")} = ?`];
|
|
7325
7326
|
const params = [lookupKey];
|
|
7327
|
+
if (options?.recordId !== void 0) {
|
|
7328
|
+
conditions.push(`${omCol("id")} = ?`);
|
|
7329
|
+
params.push(options.recordId);
|
|
7330
|
+
}
|
|
7326
7331
|
if (options?.from) {
|
|
7327
7332
|
conditions.push(`${omCol("createdAt")} >= ?`);
|
|
7328
7333
|
params.push(transformToSqlValue(options.from));
|
|
@@ -7331,8 +7336,26 @@ var MemoryMySQL = class MemoryMySQL extends _mastra_core_storage.MemoryStorage {
|
|
|
7331
7336
|
conditions.push(`${omCol("createdAt")} <= ?`);
|
|
7332
7337
|
params.push(transformToSqlValue(options.to));
|
|
7333
7338
|
}
|
|
7339
|
+
if (options?.groupId !== void 0) {
|
|
7340
|
+
conditions.push(`(LOCATE(CAST(? AS BINARY), CAST(${omCol("activeObservations")} AS BINARY)) > 0 OR EXISTS (
|
|
7341
|
+
SELECT 1 FROM JSON_TABLE(${omCol("bufferedObservationChunks")}, '$[*]'
|
|
7342
|
+
COLUMNS (observations LONGTEXT PATH '$.observations')) AS chunk
|
|
7343
|
+
WHERE LOCATE(CAST(? AS BINARY), CAST(chunk.observations AS BINARY)) > 0
|
|
7344
|
+
))`);
|
|
7345
|
+
const prefix = `<observation-group id="${options.groupId}"`;
|
|
7346
|
+
params.push(prefix, prefix);
|
|
7347
|
+
}
|
|
7348
|
+
if (options?.beforeGeneration !== void 0) {
|
|
7349
|
+
conditions.push(`${omCol("generationCount")} < ?`);
|
|
7350
|
+
params.push(options.beforeGeneration);
|
|
7351
|
+
}
|
|
7352
|
+
if (options?.afterGeneration !== void 0) {
|
|
7353
|
+
conditions.push(`${omCol("generationCount")} > ?`);
|
|
7354
|
+
params.push(options.afterGeneration);
|
|
7355
|
+
}
|
|
7356
|
+
const direction = options?.sortDirection === "ASC" ? "ASC" : "DESC";
|
|
7334
7357
|
const whereClause = conditions.join(" AND ");
|
|
7335
|
-
let sql = `SELECT * FROM ${OM_TABLE_QUOTED} WHERE ${whereClause} ORDER BY ${omCol("generationCount")}
|
|
7358
|
+
let sql = `SELECT * FROM ${OM_TABLE_QUOTED} WHERE ${whereClause} ORDER BY ${omCol("generationCount")} ${direction}, ${omCol("createdAt")} ASC, id ASC LIMIT ${safeLimit}`;
|
|
7336
7359
|
if (options?.offset != null && options.offset > 0) sql += ` OFFSET ${options.offset}`;
|
|
7337
7360
|
const [rows] = await this.pool.execute(sql, params);
|
|
7338
7361
|
if (!rows) return [];
|
|
@@ -9104,12 +9127,13 @@ var SchedulesMySQL = class SchedulesMySQL extends _mastra_core_storage.Schedules
|
|
|
9104
9127
|
if (!updated) throw new Error(`Schedule ${id} not found`);
|
|
9105
9128
|
return updated;
|
|
9106
9129
|
}
|
|
9107
|
-
async updateScheduleNextFire(id, expectedNextFireAt, newNextFireAt, lastFireAt, lastRunId) {
|
|
9108
|
-
const [result] = await this.pool.execute(`UPDATE ${formatTableName(_mastra_core_storage.TABLE_SCHEDULES)} SET ${quoteIdentifier("next_fire_at", "column name")} = ?, ${quoteIdentifier("last_fire_at", "column name")} = ?, ${quoteIdentifier("last_run_id", "column name")} = ?, ${quoteIdentifier("updated_at", "column name")} =
|
|
9130
|
+
async updateScheduleNextFire(id, expectedNextFireAt, newNextFireAt, lastFireAt, lastRunId, newStatus) {
|
|
9131
|
+
const [result] = await this.pool.execute(`UPDATE ${formatTableName(_mastra_core_storage.TABLE_SCHEDULES)} SET ${quoteIdentifier("next_fire_at", "column name")} = ?, ${quoteIdentifier("last_fire_at", "column name")} = ?, ${quoteIdentifier("last_run_id", "column name")} = ?, ${quoteIdentifier("updated_at", "column name")} = ?, ${quoteIdentifier("status", "column name")} = COALESCE(?, ${quoteIdentifier("status", "column name")}) WHERE ${quoteIdentifier("id", "column name")} = ? AND ${quoteIdentifier("next_fire_at", "column name")} = ? AND ${quoteIdentifier("status", "column name")} = ?`, [
|
|
9109
9132
|
newNextFireAt,
|
|
9110
9133
|
lastFireAt,
|
|
9111
9134
|
lastRunId,
|
|
9112
9135
|
Date.now(),
|
|
9136
|
+
newStatus ?? null,
|
|
9113
9137
|
id,
|
|
9114
9138
|
expectedNextFireAt,
|
|
9115
9139
|
"active"
|