@mastra/mysql 0.11.1-alpha.0 → 0.11.1
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 +15 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/blobs/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1687,6 +1687,13 @@ var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksSto
|
|
|
1687
1687
|
};
|
|
1688
1688
|
//#endregion
|
|
1689
1689
|
//#region src/storage/domains/blobs/index.ts
|
|
1690
|
+
const INSERT_IGNORE_SQL = `INSERT IGNORE INTO ${formatTableName(TABLE_SKILL_BLOBS)} (${[
|
|
1691
|
+
"hash",
|
|
1692
|
+
"content",
|
|
1693
|
+
"size",
|
|
1694
|
+
"mimeType",
|
|
1695
|
+
"createdAt"
|
|
1696
|
+
].map((column) => quoteIdentifier(column, "column name")).join(", ")}) VALUES (?, ?, ?, ?, ?)`;
|
|
1690
1697
|
var BlobsMySQL = class extends BlobStore {
|
|
1691
1698
|
pool;
|
|
1692
1699
|
operations;
|
|
@@ -1702,14 +1709,16 @@ var BlobsMySQL = class extends BlobStore {
|
|
|
1702
1709
|
});
|
|
1703
1710
|
}
|
|
1704
1711
|
async put(entry) {
|
|
1705
|
-
|
|
1706
|
-
|
|
1712
|
+
await this.pool.execute(INSERT_IGNORE_SQL, this.#insertArgs(entry));
|
|
1713
|
+
}
|
|
1714
|
+
#insertArgs(entry) {
|
|
1715
|
+
return [
|
|
1707
1716
|
entry.hash,
|
|
1708
1717
|
entry.content,
|
|
1709
1718
|
entry.size,
|
|
1710
1719
|
entry.mimeType ?? null,
|
|
1711
|
-
transformToSqlValue(
|
|
1712
|
-
]
|
|
1720
|
+
transformToSqlValue(entry.createdAt ?? /* @__PURE__ */ new Date())
|
|
1721
|
+
];
|
|
1713
1722
|
}
|
|
1714
1723
|
async get(hash) {
|
|
1715
1724
|
const [rows] = await this.pool.execute(`SELECT * FROM ${formatTableName(TABLE_SKILL_BLOBS)} WHERE ${quoteIdentifier("hash", "column name")} = ?`, [hash]);
|
|
@@ -1726,15 +1735,8 @@ var BlobsMySQL = class extends BlobStore {
|
|
|
1726
1735
|
}
|
|
1727
1736
|
async putMany(entries) {
|
|
1728
1737
|
if (entries.length === 0) return;
|
|
1729
|
-
await this.operations.
|
|
1730
|
-
|
|
1731
|
-
records: entries.map((entry) => ({
|
|
1732
|
-
hash: entry.hash,
|
|
1733
|
-
content: entry.content,
|
|
1734
|
-
size: entry.size,
|
|
1735
|
-
mimeType: entry.mimeType ?? null,
|
|
1736
|
-
createdAt: entry.createdAt ?? /* @__PURE__ */ new Date()
|
|
1737
|
-
}))
|
|
1738
|
+
await this.operations.withTransaction(async (connection) => {
|
|
1739
|
+
for (const entry of entries) await connection.execute(INSERT_IGNORE_SQL, this.#insertArgs(entry));
|
|
1738
1740
|
});
|
|
1739
1741
|
}
|
|
1740
1742
|
async getMany(hashes) {
|