@mastra/mysql 0.17.2-alpha.1 → 0.17.2-alpha.3

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.
@@ -305,6 +305,16 @@ export declare function legacyKnowledgeTablesToDrop(snapshot: {
305
305
  }): string[];
306
306
  /** Message for the error an adapter throws on `incompatible-reset-required`. */
307
307
  export declare function knowledgePagesResetMessage(reason: string): string;
308
+ /**
309
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
310
+ * here so every adapter can throw it on any core version; core re-exports it from
311
+ * `@mastra/core/storage`. Recognise it by `name`.
312
+ * @experimental
313
+ */
314
+ export declare class KnowledgeInvalidCursorError extends Error {
315
+ readonly cursor: string;
316
+ constructor(cursor: string);
317
+ }
308
318
  /**
309
319
  * The page-store runtime pieces adapters take from `@mastra/core/storage`. They are loaded through
310
320
  * `createKnowledgePagesCoreLoader` instead of static imports so adapters keep loading on cores
@@ -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.17.2-alpha.1"
6
+ version: "0.17.2-alpha.3"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.17.2-alpha.1",
2
+ "version": "0.17.2-alpha.3",
3
3
  "package": "@mastra/mysql",
4
4
  "exports": {
5
5
  "AgentsMySQL": {
@@ -20,52 +20,52 @@
20
20
  "ExperimentsMySQL": {
21
21
  "types": "dist/storage/domains/experiments/index.d.ts",
22
22
  "implementation": "dist/index.js",
23
- "line": 3098
23
+ "line": 3107
24
24
  },
25
25
  "MCPClientsMySQL": {
26
26
  "types": "dist/storage/domains/mcp-clients/index.d.ts",
27
27
  "implementation": "dist/index.js",
28
- "line": 6064
28
+ "line": 6087
29
29
  },
30
30
  "MCPServersMySQL": {
31
31
  "types": "dist/storage/domains/mcp-servers/index.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 6537
33
+ "line": 6560
34
34
  },
35
35
  "MemoryMySQL": {
36
36
  "types": "dist/storage/domains/memory/index.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 7300
38
+ "line": 7323
39
39
  },
40
40
  "MySQLStore": {
41
41
  "types": "dist/storage/index.d.ts",
42
42
  "implementation": "dist/index.js",
43
- "line": 13603
43
+ "line": 13626
44
44
  },
45
45
  "ObservabilityMySQL": {
46
46
  "types": "dist/storage/domains/observability/index.d.ts",
47
47
  "implementation": "dist/index.js",
48
- "line": 9415
48
+ "line": 9438
49
49
  },
50
50
  "PromptBlocksMySQL": {
51
51
  "types": "dist/storage/domains/prompt-blocks/index.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 9934
53
+ "line": 9957
54
54
  },
55
55
  "ScorerDefinitionsMySQL": {
56
56
  "types": "dist/storage/domains/scorer-definitions/index.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 10692
58
+ "line": 10715
59
59
  },
60
60
  "ScoresMySQL": {
61
61
  "types": "dist/storage/domains/scores/index.d.ts",
62
62
  "implementation": "dist/index.js",
63
- "line": 11179
63
+ "line": 11202
64
64
  },
65
65
  "SkillsMySQL": {
66
66
  "types": "dist/storage/domains/skills/index.d.ts",
67
67
  "implementation": "dist/index.js",
68
- "line": 11476
68
+ "line": 11499
69
69
  },
70
70
  "StoreOperationsMySQL": {
71
71
  "types": "dist/storage/domains/operations/index.d.ts",
@@ -75,12 +75,12 @@
75
75
  "WorkflowsMySQL": {
76
76
  "types": "dist/storage/domains/workflows/index.d.ts",
77
77
  "implementation": "dist/index.js",
78
- "line": 12444
78
+ "line": 12467
79
79
  },
80
80
  "WorkspacesMySQL": {
81
81
  "types": "dist/storage/domains/workspaces/index.d.ts",
82
82
  "implementation": "dist/index.js",
83
- "line": 13007
83
+ "line": 13030
84
84
  }
85
85
  },
86
86
  "modules": {}
package/dist/index.cjs CHANGED
@@ -2831,6 +2831,15 @@ var DatasetsMySQL = class DatasetsMySQL extends _mastra_core_storage.DatasetsSto
2831
2831
  };
2832
2832
  const perPage = (0, _mastra_core_storage.normalizePerPage)(perPageInput, 100);
2833
2833
  const { offset, perPage: perPageForResponse } = (0, _mastra_core_storage.calculatePagination)(page, perPageInput, perPage);
2834
+ if (perPage === 0) return {
2835
+ items: [],
2836
+ pagination: {
2837
+ total,
2838
+ page,
2839
+ perPage: perPageForResponse,
2840
+ hasMore: true
2841
+ }
2842
+ };
2834
2843
  const limitValue = perPageInput === false ? total : perPage;
2835
2844
  const [rows] = await this.pool.execute(`SELECT ${ITEM_SELECT_COLUMNS} FROM ${tableItemsName}${whereSql} ORDER BY ${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC LIMIT ${limitValue} OFFSET ${offset}`, params);
2836
2845
  return {
@@ -4288,6 +4297,20 @@ function legacyKnowledgeTablesToDrop(snapshot) {
4288
4297
  const drop = /* @__PURE__ */ new Set([...legacy, ...reused]);
4289
4298
  return [...RETIRED_KNOWLEDGE_TABLE_NAMES, ...[...KNOWLEDGE_TABLE_NAMES].reverse()].filter((name) => drop.has(name));
4290
4299
  }
4300
+ /**
4301
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
4302
+ * here so every adapter can throw it on any core version; core re-exports it from
4303
+ * `@mastra/core/storage`. Recognise it by `name`.
4304
+ * @experimental
4305
+ */
4306
+ var KnowledgeInvalidCursorError = class extends Error {
4307
+ cursor;
4308
+ constructor(cursor) {
4309
+ super("Invalid Knowledge cursor: this store cannot decode it");
4310
+ this.cursor = cursor;
4311
+ this.name = "KnowledgeInvalidCursorError";
4312
+ }
4313
+ };
4291
4314
  const KNOWLEDGE_PAGES_CORE_FUNCTIONS = [
4292
4315
  "assertKnowledgePageDescriptionWithinBound",
4293
4316
  "assertKnowledgeNoteTextWithinBound",
@@ -4581,7 +4604,7 @@ function decodeCursor(cursor, length) {
4581
4604
  const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
4582
4605
  if (Array.isArray(parsed) && parsed.length === length && parsed.every((item) => typeof item === "string")) return parsed;
4583
4606
  } catch {}
4584
- throw new Error("Invalid Knowledge cursor");
4607
+ throw new KnowledgeInvalidCursorError(cursor);
4585
4608
  }
4586
4609
  function isRetryableRace(error) {
4587
4610
  for (let current = error; current && typeof current === "object"; current = current.cause) {
package/dist/index.js CHANGED
@@ -2830,6 +2830,15 @@ var DatasetsMySQL = class DatasetsMySQL extends DatasetsStorage {
2830
2830
  };
2831
2831
  const perPage = normalizePerPage(perPageInput, 100);
2832
2832
  const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
2833
+ if (perPage === 0) return {
2834
+ items: [],
2835
+ pagination: {
2836
+ total,
2837
+ page,
2838
+ perPage: perPageForResponse,
2839
+ hasMore: true
2840
+ }
2841
+ };
2833
2842
  const limitValue = perPageInput === false ? total : perPage;
2834
2843
  const [rows] = await this.pool.execute(`SELECT ${ITEM_SELECT_COLUMNS} FROM ${tableItemsName}${whereSql} ORDER BY ${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC LIMIT ${limitValue} OFFSET ${offset}`, params);
2835
2844
  return {
@@ -4287,6 +4296,20 @@ function legacyKnowledgeTablesToDrop(snapshot) {
4287
4296
  const drop = /* @__PURE__ */ new Set([...legacy, ...reused]);
4288
4297
  return [...RETIRED_KNOWLEDGE_TABLE_NAMES, ...[...KNOWLEDGE_TABLE_NAMES].reverse()].filter((name) => drop.has(name));
4289
4298
  }
4299
+ /**
4300
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
4301
+ * here so every adapter can throw it on any core version; core re-exports it from
4302
+ * `@mastra/core/storage`. Recognise it by `name`.
4303
+ * @experimental
4304
+ */
4305
+ var KnowledgeInvalidCursorError = class extends Error {
4306
+ cursor;
4307
+ constructor(cursor) {
4308
+ super("Invalid Knowledge cursor: this store cannot decode it");
4309
+ this.cursor = cursor;
4310
+ this.name = "KnowledgeInvalidCursorError";
4311
+ }
4312
+ };
4290
4313
  const KNOWLEDGE_PAGES_CORE_FUNCTIONS = [
4291
4314
  "assertKnowledgePageDescriptionWithinBound",
4292
4315
  "assertKnowledgeNoteTextWithinBound",
@@ -4580,7 +4603,7 @@ function decodeCursor(cursor, length) {
4580
4603
  const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
4581
4604
  if (Array.isArray(parsed) && parsed.length === length && parsed.every((item) => typeof item === "string")) return parsed;
4582
4605
  } catch {}
4583
- throw new Error("Invalid Knowledge cursor");
4606
+ throw new KnowledgeInvalidCursorError(cursor);
4584
4607
  }
4585
4608
  function isRetryableRace(error) {
4586
4609
  for (let current = error; current && typeof current === "object"; current = current.cause) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mysql",
3
- "version": "0.17.2-alpha.1",
3
+ "version": "0.17.2-alpha.3",
4
4
  "description": "MySQL provider for Mastra - db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "tsx": "^4.23.15",
31
31
  "typescript": "^7.0.2",
32
32
  "vitest": "5.1.0",
33
- "@internal/lint": "0.0.151",
34
33
  "@internal/core": "0.1.4",
34
+ "@internal/lint": "0.0.151",
35
35
  "@internal/storage-test-utils": "0.0.147",
36
36
  "@internal/types-builder": "0.0.126",
37
- "@mastra/core": "1.86.0-alpha.7"
37
+ "@mastra/core": "1.86.0-alpha.9"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@mastra/core": ">=1.76.0-0 <2.0.0-0"