@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.
@@ -3,7 +3,7 @@ name: mastra-mysql
3
3
  description: Documentation for @mastra/mysql. Use when working with @mastra/mysql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mysql"
6
- version: "0.11.1-alpha.0"
6
+ version: "0.11.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.11.1-alpha.0",
2
+ "version": "0.11.1",
3
3
  "package": "@mastra/mysql",
4
4
  "exports": {},
5
5
  "modules": {}
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
- const now = entry.createdAt ?? /* @__PURE__ */ new Date();
1707
- await this.pool.execute(`INSERT IGNORE INTO ${formatTableName(_mastra_core_storage.TABLE_SKILL_BLOBS)} (${quoteIdentifier("hash", "column name")}, ${quoteIdentifier("content", "column name")}, ${quoteIdentifier("size", "column name")}, ${quoteIdentifier("mimeType", "column name")}, ${quoteIdentifier("createdAt", "column name")}) VALUES (?, ?, ?, ?, ?)`, [
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(now)
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.batchInsert({
1731
- tableName: _mastra_core_storage.TABLE_SKILL_BLOBS,
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) {