@mastra/cloudflare-d1 0.1.7-alpha.1 → 0.1.7-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.
@@ -161,12 +161,14 @@ declare class D1Store extends MastraStorage {
161
161
  tableName: TABLE_NAMES;
162
162
  records: Record<string, any>[];
163
163
  }): Promise<void>;
164
- getTraces({ name, scope, page, perPage, attributes, }: {
164
+ getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
165
165
  name?: string;
166
166
  scope?: string;
167
167
  page: number;
168
168
  perPage: number;
169
169
  attributes?: Record<string, string>;
170
+ fromDate?: Date;
171
+ toDate?: Date;
170
172
  }): Promise<Record<string, any>[]>;
171
173
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
172
174
  private parseWorkflowRun;
@@ -161,12 +161,14 @@ declare class D1Store extends MastraStorage {
161
161
  tableName: TABLE_NAMES;
162
162
  records: Record<string, any>[];
163
163
  }): Promise<void>;
164
- getTraces({ name, scope, page, perPage, attributes, }: {
164
+ getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
165
165
  name?: string;
166
166
  scope?: string;
167
167
  page: number;
168
168
  perPage: number;
169
169
  attributes?: Record<string, string>;
170
+ fromDate?: Date;
171
+ toDate?: Date;
170
172
  }): Promise<Record<string, any>[]>;
171
173
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
172
174
  private parseWorkflowRun;
package/dist/index.cjs CHANGED
@@ -869,7 +869,9 @@ var D1Store = class extends storage.MastraStorage {
869
869
  scope,
870
870
  page,
871
871
  perPage,
872
- attributes
872
+ attributes,
873
+ fromDate,
874
+ toDate
873
875
  }) {
874
876
  const fullTableName = this.getTableName(storage.TABLE_TRACES);
875
877
  try {
@@ -885,6 +887,12 @@ var D1Store = class extends storage.MastraStorage {
885
887
  query.jsonLike("attributes", key, value);
886
888
  }
887
889
  }
890
+ if (fromDate) {
891
+ query.andWhere("createdAt >= ?", fromDate instanceof Date ? fromDate.toISOString() : fromDate);
892
+ }
893
+ if (toDate) {
894
+ query.andWhere("createdAt <= ?", toDate instanceof Date ? toDate.toISOString() : toDate);
895
+ }
888
896
  query.orderBy("startTime", "DESC").limit(perPage).offset((page - 1) * perPage);
889
897
  const { sql, params } = query.build();
890
898
  const results = await this.executeQuery({ sql, params });
package/dist/index.js CHANGED
@@ -863,7 +863,9 @@ var D1Store = class extends MastraStorage {
863
863
  scope,
864
864
  page,
865
865
  perPage,
866
- attributes
866
+ attributes,
867
+ fromDate,
868
+ toDate
867
869
  }) {
868
870
  const fullTableName = this.getTableName(TABLE_TRACES);
869
871
  try {
@@ -879,6 +881,12 @@ var D1Store = class extends MastraStorage {
879
881
  query.jsonLike("attributes", key, value);
880
882
  }
881
883
  }
884
+ if (fromDate) {
885
+ query.andWhere("createdAt >= ?", fromDate instanceof Date ? fromDate.toISOString() : fromDate);
886
+ }
887
+ if (toDate) {
888
+ query.andWhere("createdAt <= ?", toDate instanceof Date ? toDate.toISOString() : toDate);
889
+ }
882
890
  query.orderBy("startTime", "DESC").limit(perPage).offset((page - 1) * perPage);
883
891
  const { sql, params } = query.build();
884
892
  const results = await this.executeQuery({ sql, params });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/cloudflare-d1",
3
- "version": "0.1.7-alpha.1",
3
+ "version": "0.1.7-alpha.3",
4
4
  "description": "D1 provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "cloudflare": "^4.1.0",
26
- "@mastra/core": "^0.9.2-alpha.1"
26
+ "@mastra/core": "^0.9.2-alpha.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@cloudflare/workers-types": "^4.20250417.0",