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