@mastra/cloudflare-d1 1.0.0-beta.7 → 1.0.0-beta.9

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
2
- import { MastraStorage, createStorageErrorId, ScoresStorage, TABLE_SCHEMAS, TABLE_SCORERS, normalizePerPage, calculatePagination, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ensureDate, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, serializeDate, getSqlType, getDefaultValue, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
2
+ import { MemoryStorage, TABLE_SCHEMAS, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, ensureDate, createStorageErrorId, normalizePerPage, calculatePagination, serializeDate, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, MastraStorage, getSqlType, getDefaultValue, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
3
3
  import Cloudflare from 'cloudflare';
4
4
  import { MessageList } from '@mastra/core/agent';
5
5
  import { MastraBase } from '@mastra/core/base';
@@ -1205,12 +1205,14 @@ var MemoryStorageD1 = class extends MemoryStorage {
1205
1205
  const dateRange = filter?.dateRange;
1206
1206
  if (dateRange?.start) {
1207
1207
  const startDate = dateRange.start instanceof Date ? serializeDate(dateRange.start) : serializeDate(new Date(dateRange.start));
1208
- query += ` AND createdAt >= ?`;
1208
+ const startOp = dateRange.startExclusive ? ">" : ">=";
1209
+ query += ` AND createdAt ${startOp} ?`;
1209
1210
  queryParams.push(startDate);
1210
1211
  }
1211
1212
  if (dateRange?.end) {
1212
1213
  const endDate = dateRange.end instanceof Date ? serializeDate(dateRange.end) : serializeDate(new Date(dateRange.end));
1213
- query += ` AND createdAt <= ?`;
1214
+ const endOp = dateRange.endExclusive ? "<" : "<=";
1215
+ query += ` AND createdAt ${endOp} ?`;
1214
1216
  queryParams.push(endDate);
1215
1217
  }
1216
1218
  const { field, direction } = this.parseOrderBy(orderBy, "ASC");
@@ -1237,12 +1239,14 @@ var MemoryStorageD1 = class extends MemoryStorage {
1237
1239
  }
1238
1240
  if (dateRange?.start) {
1239
1241
  const startDate = dateRange.start instanceof Date ? serializeDate(dateRange.start) : serializeDate(new Date(dateRange.start));
1240
- countQuery += ` AND createdAt >= ?`;
1242
+ const startOp = dateRange.startExclusive ? ">" : ">=";
1243
+ countQuery += ` AND createdAt ${startOp} ?`;
1241
1244
  countParams.push(startDate);
1242
1245
  }
1243
1246
  if (dateRange?.end) {
1244
1247
  const endDate = dateRange.end instanceof Date ? serializeDate(dateRange.end) : serializeDate(new Date(dateRange.end));
1245
- countQuery += ` AND createdAt <= ?`;
1248
+ const endOp = dateRange.endExclusive ? "<" : "<=";
1249
+ countQuery += ` AND createdAt ${endOp} ?`;
1246
1250
  countParams.push(endDate);
1247
1251
  }
1248
1252
  const countResult = await this.#db.executeQuery({ sql: countQuery, params: countParams });
@@ -2097,19 +2101,6 @@ var D1Store = class extends MastraStorage {
2097
2101
  memory
2098
2102
  };
2099
2103
  }
2100
- get supports() {
2101
- return {
2102
- selectByIncludeResourceScope: true,
2103
- resourceWorkingMemory: true,
2104
- hasColumn: true,
2105
- createTable: true,
2106
- deleteMessages: true,
2107
- observability: false,
2108
- indexManagement: false,
2109
- listScoresBySpan: true,
2110
- agents: false
2111
- };
2112
- }
2113
2104
  /**
2114
2105
  * Close the database connection
2115
2106
  * No explicit cleanup needed for D1 in either REST or Workers Binding mode
@@ -2119,6 +2110,6 @@ var D1Store = class extends MastraStorage {
2119
2110
  }
2120
2111
  };
2121
2112
 
2122
- export { D1Store };
2113
+ export { D1Store, MemoryStorageD1, ScoresStorageD1, WorkflowsStorageD1 };
2123
2114
  //# sourceMappingURL=index.js.map
2124
2115
  //# sourceMappingURL=index.js.map