@mastra/mysql 0.10.0-alpha.1 → 0.10.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.
@@ -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.10.0-alpha.1"
6
+ version: "0.10.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.0-alpha.1",
2
+ "version": "0.10.0",
3
3
  "package": "@mastra/mysql",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -2280,6 +2280,14 @@ var DatasetsMySQL = class DatasetsMySQL extends _mastra_core_storage.DatasetsSto
2280
2280
  }
2281
2281
  async listDatasets(args) {
2282
2282
  try {
2283
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, [
2284
+ "createdAt",
2285
+ "updatedAt",
2286
+ "name"
2287
+ ], {
2288
+ field: "createdAt",
2289
+ direction: "DESC"
2290
+ });
2283
2291
  const { page, perPage: perPageInput } = args.pagination;
2284
2292
  const filterParts = [];
2285
2293
  const filterArgs = [];
@@ -2336,7 +2344,7 @@ var DatasetsMySQL = class DatasetsMySQL extends _mastra_core_storage.DatasetsSto
2336
2344
  datasets: (await this.operations.loadMany({
2337
2345
  tableName: _mastra_core_storage.TABLE_DATASETS,
2338
2346
  whereClause,
2339
- orderBy: `${quoteIdentifier("createdAt", "column name")} DESC, \`id\` ASC`,
2347
+ orderBy: `${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC`,
2340
2348
  offset,
2341
2349
  limit: limitValue
2342
2350
  })).map((row) => this.mapDataset(row)),
@@ -2699,6 +2707,10 @@ var DatasetsMySQL = class DatasetsMySQL extends _mastra_core_storage.DatasetsSto
2699
2707
  }
2700
2708
  async listItems(args) {
2701
2709
  try {
2710
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["createdAt", "updatedAt"], {
2711
+ field: "createdAt",
2712
+ direction: "DESC"
2713
+ });
2702
2714
  const { page, perPage: perPageInput } = args.pagination;
2703
2715
  const tableItemsName = formatTableName(_mastra_core_storage.TABLE_DATASET_ITEMS);
2704
2716
  const conditions = [`\`datasetId\` = ?`];
@@ -2740,7 +2752,7 @@ var DatasetsMySQL = class DatasetsMySQL extends _mastra_core_storage.DatasetsSto
2740
2752
  const perPage = (0, _mastra_core_storage.normalizePerPage)(perPageInput, 100);
2741
2753
  const { offset, perPage: perPageForResponse } = (0, _mastra_core_storage.calculatePagination)(page, perPageInput, perPage);
2742
2754
  const limitValue = perPageInput === false ? total : perPage;
2743
- const [rows] = await this.pool.execute(`SELECT * FROM ${tableItemsName}${whereSql} ORDER BY \`createdAt\` DESC, \`id\` ASC LIMIT ${limitValue} OFFSET ${offset}`, params);
2755
+ const [rows] = await this.pool.execute(`SELECT * FROM ${tableItemsName}${whereSql} ORDER BY ${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC LIMIT ${limitValue} OFFSET ${offset}`, params);
2744
2756
  return {
2745
2757
  items: rows.map((row) => this.mapItem(row)),
2746
2758
  pagination: {
@@ -3355,6 +3367,10 @@ var ExperimentsMySQL = class ExperimentsMySQL extends _mastra_core_storage.Exper
3355
3367
  }
3356
3368
  async listExperiments(args) {
3357
3369
  try {
3370
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["createdAt", "status"], {
3371
+ field: "createdAt",
3372
+ direction: "DESC"
3373
+ });
3358
3374
  const { page, perPage: perPageInput } = args.pagination;
3359
3375
  const conditions = [];
3360
3376
  const params = [];
@@ -3429,7 +3445,7 @@ var ExperimentsMySQL = class ExperimentsMySQL extends _mastra_core_storage.Exper
3429
3445
  experiments: (await this.operations.loadMany({
3430
3446
  tableName: _mastra_core_storage.TABLE_EXPERIMENTS,
3431
3447
  whereClause,
3432
- orderBy: `${quoteIdentifier("createdAt", "column name")} DESC`,
3448
+ orderBy: `${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC`,
3433
3449
  offset,
3434
3450
  limit: limitValue
3435
3451
  })).map((row) => this.mapExperiment(row)),
@@ -3760,6 +3776,10 @@ var ExperimentsMySQL = class ExperimentsMySQL extends _mastra_core_storage.Exper
3760
3776
  }
3761
3777
  async listExperimentResults(args) {
3762
3778
  try {
3779
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["startedAt", "createdAt"], {
3780
+ field: "startedAt",
3781
+ direction: "ASC"
3782
+ });
3763
3783
  const { page, perPage: perPageInput } = args.pagination;
3764
3784
  const conditions = [`${quoteIdentifier("experimentId", "column name")} = ?`];
3765
3785
  const params = [args.experimentId];
@@ -3810,7 +3830,7 @@ var ExperimentsMySQL = class ExperimentsMySQL extends _mastra_core_storage.Exper
3810
3830
  results: (await this.operations.loadMany({
3811
3831
  tableName: _mastra_core_storage.TABLE_EXPERIMENT_RESULTS,
3812
3832
  whereClause,
3813
- orderBy: `${quoteIdentifier("startedAt", "column name")} ASC`,
3833
+ orderBy: `${quoteIdentifier(orderBy.field, "column name")} ${orderBy.direction}, \`id\` ASC`,
3814
3834
  offset,
3815
3835
  limit: limitValue
3816
3836
  })).map((row) => this.mapExperimentResult(row)),