@mastra/cloudflare 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.1-alpha.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.
@@ -151,14 +151,13 @@ declare class CloudflareStore extends MastraStorage {
151
151
  tableName: T;
152
152
  records: Partial<RecordTypes[T]>[];
153
153
  }): Promise<void>;
154
- getTraces({ name, scope, page, perPage, attributes, }: {
154
+ getTraces(_input: {
155
155
  name?: string;
156
156
  scope?: string;
157
157
  page: number;
158
158
  perPage: number;
159
159
  attributes?: Record<string, string>;
160
160
  }): Promise<any[]>;
161
- private parseJSON;
162
161
  getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
163
162
  getWorkflowRuns(_args?: {
164
163
  namespace?: string;
@@ -190,23 +189,6 @@ export declare interface CloudflareWorkersConfig {
190
189
  keyPrefix?: string;
191
190
  }
192
191
 
193
- export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
194
- id: string;
195
- parentSpanId: string;
196
- traceId: string;
197
- name: string;
198
- scope: string | undefined;
199
- kind: string;
200
- status: string;
201
- events: string;
202
- links: string;
203
- attributes: string | undefined;
204
- startTime: string;
205
- endTime: string;
206
- other: string;
207
- createdAt: string;
208
- };
209
-
210
192
  /**
211
193
  * Helper to determine if a config is using Workers bindings
212
194
  */
@@ -151,14 +151,13 @@ declare class CloudflareStore extends MastraStorage {
151
151
  tableName: T;
152
152
  records: Partial<RecordTypes[T]>[];
153
153
  }): Promise<void>;
154
- getTraces({ name, scope, page, perPage, attributes, }: {
154
+ getTraces(_input: {
155
155
  name?: string;
156
156
  scope?: string;
157
157
  page: number;
158
158
  perPage: number;
159
159
  attributes?: Record<string, string>;
160
160
  }): Promise<any[]>;
161
- private parseJSON;
162
161
  getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
163
162
  getWorkflowRuns(_args?: {
164
163
  namespace?: string;
@@ -190,23 +189,6 @@ export declare interface CloudflareWorkersConfig {
190
189
  keyPrefix?: string;
191
190
  }
192
191
 
193
- export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
194
- id: string;
195
- parentSpanId: string;
196
- traceId: string;
197
- name: string;
198
- scope: string | undefined;
199
- kind: string;
200
- status: string;
201
- events: string;
202
- links: string;
203
- attributes: string | undefined;
204
- startTime: string;
205
- endTime: string;
206
- other: string;
207
- createdAt: string;
208
- };
209
-
210
192
  /**
211
193
  * Helper to determine if a config is using Workers bindings
212
194
  */
package/dist/index.cjs CHANGED
@@ -349,7 +349,7 @@ var CloudflareStore = class extends storage.MastraStorage {
349
349
  const threadMessagesKey = this.getThreadMessagesKey(threadId);
350
350
  const latestIds = await this.getLastN(threadMessagesKey, limit);
351
351
  latestIds.forEach((id) => messageIds.add(id));
352
- } catch {
352
+ } catch (error) {
353
353
  console.log(`No message order found for thread ${threadId}, skipping latest messages`);
354
354
  }
355
355
  }
@@ -438,9 +438,6 @@ var CloudflareStore = class extends storage.MastraStorage {
438
438
  throw new Error("Namespace, workflow name, and run ID are required");
439
439
  }
440
440
  return `${prefix}${tableName}:${record.namespace}:${record.workflow_name}:${record.run_id}`;
441
- case storage.TABLE_TRACES:
442
- if (!record.id) throw new Error("Trace ID is required");
443
- return `${prefix}${tableName}:${record.id}`;
444
441
  default:
445
442
  throw new Error(`Unsupported table: ${tableName}`);
446
443
  }
@@ -530,11 +527,6 @@ var CloudflareStore = class extends storage.MastraStorage {
530
527
  throw new Error("Workflow record missing required fields");
531
528
  }
532
529
  break;
533
- case storage.TABLE_TRACES:
534
- if (!("id" in recordTyped)) {
535
- throw new Error("Trace record missing required fields");
536
- }
537
- break;
538
530
  default:
539
531
  throw new Error(`Unknown table type: ${tableName}`);
540
532
  }
@@ -915,88 +907,8 @@ var CloudflareStore = class extends storage.MastraStorage {
915
907
  throw error;
916
908
  }
917
909
  }
918
- async getTraces({
919
- name,
920
- scope,
921
- page = 0,
922
- perPage = 100,
923
- attributes
924
- }) {
925
- try {
926
- let keys;
927
- if (this.bindings) {
928
- keys = (await this.listKV(storage.TABLE_TRACES))?.map((k) => k.name) || [];
929
- } else {
930
- const namespaceId = await this.getNamespaceId(storage.TABLE_TRACES);
931
- const result = await this.client.kv.namespaces.keys.list(namespaceId, {
932
- prefix: "",
933
- limit: 1e3,
934
- account_id: this.accountId
935
- });
936
- keys = result.result?.map((k) => k.name) || [];
937
- }
938
- const traceRecords = await Promise.all(
939
- keys.map(async (key) => {
940
- const record = await this.getKV(storage.TABLE_TRACES, key);
941
- if (!record) return null;
942
- return record;
943
- })
944
- );
945
- let filteredTraces = traceRecords.filter(
946
- (record) => record !== null && typeof record === "object"
947
- );
948
- if (name) {
949
- filteredTraces = filteredTraces.filter((record) => record.name?.toLowerCase().startsWith(name.toLowerCase()));
950
- }
951
- if (scope) {
952
- filteredTraces = filteredTraces.filter((record) => record.scope === scope);
953
- }
954
- if (attributes) {
955
- filteredTraces = filteredTraces.filter((record) => {
956
- if (!record.attributes) return false;
957
- const recordAttrs = this.parseJSON(record.attributes);
958
- if (!recordAttrs) return false;
959
- return Object.entries(attributes).every(([key, value]) => recordAttrs[key] === value);
960
- });
961
- }
962
- filteredTraces.sort((a, b) => {
963
- const dateA = new Date(a.createdAt).getTime();
964
- const dateB = new Date(b.createdAt).getTime();
965
- return dateB - dateA;
966
- });
967
- const start = page * perPage;
968
- const end = start + perPage;
969
- const paginatedTraces = filteredTraces.slice(start, end);
970
- return paginatedTraces.map((record) => ({
971
- id: record.id,
972
- parentSpanId: record.parentSpanId,
973
- traceId: record.traceId,
974
- name: record.name,
975
- scope: record.scope,
976
- kind: record.kind,
977
- status: this.parseJSON(record.status),
978
- events: this.parseJSON(record.events) || [],
979
- links: this.parseJSON(record.links) || [],
980
- attributes: this.parseJSON(record?.attributes) || {},
981
- startTime: record.startTime,
982
- endTime: record.endTime,
983
- other: this.parseJSON(record.other) || {},
984
- createdAt: record.createdAt
985
- }));
986
- } catch (error) {
987
- this.logger.error("Failed to get traces:", { message: error instanceof Error ? error.message : String(error) });
988
- return [];
989
- }
990
- }
991
- parseJSON(value) {
992
- if (typeof value === "string") {
993
- try {
994
- return JSON.parse(value);
995
- } catch {
996
- return value;
997
- }
998
- }
999
- return value;
910
+ getTraces(_input) {
911
+ throw new Error("Method not implemented.");
1000
912
  }
1001
913
  getEvalsByAgentName(_agentName, _type) {
1002
914
  throw new Error("Method not implemented.");
package/dist/index.js CHANGED
@@ -343,7 +343,7 @@ var CloudflareStore = class extends MastraStorage {
343
343
  const threadMessagesKey = this.getThreadMessagesKey(threadId);
344
344
  const latestIds = await this.getLastN(threadMessagesKey, limit);
345
345
  latestIds.forEach((id) => messageIds.add(id));
346
- } catch {
346
+ } catch (error) {
347
347
  console.log(`No message order found for thread ${threadId}, skipping latest messages`);
348
348
  }
349
349
  }
@@ -432,9 +432,6 @@ var CloudflareStore = class extends MastraStorage {
432
432
  throw new Error("Namespace, workflow name, and run ID are required");
433
433
  }
434
434
  return `${prefix}${tableName}:${record.namespace}:${record.workflow_name}:${record.run_id}`;
435
- case TABLE_TRACES:
436
- if (!record.id) throw new Error("Trace ID is required");
437
- return `${prefix}${tableName}:${record.id}`;
438
435
  default:
439
436
  throw new Error(`Unsupported table: ${tableName}`);
440
437
  }
@@ -524,11 +521,6 @@ var CloudflareStore = class extends MastraStorage {
524
521
  throw new Error("Workflow record missing required fields");
525
522
  }
526
523
  break;
527
- case TABLE_TRACES:
528
- if (!("id" in recordTyped)) {
529
- throw new Error("Trace record missing required fields");
530
- }
531
- break;
532
524
  default:
533
525
  throw new Error(`Unknown table type: ${tableName}`);
534
526
  }
@@ -909,88 +901,8 @@ var CloudflareStore = class extends MastraStorage {
909
901
  throw error;
910
902
  }
911
903
  }
912
- async getTraces({
913
- name,
914
- scope,
915
- page = 0,
916
- perPage = 100,
917
- attributes
918
- }) {
919
- try {
920
- let keys;
921
- if (this.bindings) {
922
- keys = (await this.listKV(TABLE_TRACES))?.map((k) => k.name) || [];
923
- } else {
924
- const namespaceId = await this.getNamespaceId(TABLE_TRACES);
925
- const result = await this.client.kv.namespaces.keys.list(namespaceId, {
926
- prefix: "",
927
- limit: 1e3,
928
- account_id: this.accountId
929
- });
930
- keys = result.result?.map((k) => k.name) || [];
931
- }
932
- const traceRecords = await Promise.all(
933
- keys.map(async (key) => {
934
- const record = await this.getKV(TABLE_TRACES, key);
935
- if (!record) return null;
936
- return record;
937
- })
938
- );
939
- let filteredTraces = traceRecords.filter(
940
- (record) => record !== null && typeof record === "object"
941
- );
942
- if (name) {
943
- filteredTraces = filteredTraces.filter((record) => record.name?.toLowerCase().startsWith(name.toLowerCase()));
944
- }
945
- if (scope) {
946
- filteredTraces = filteredTraces.filter((record) => record.scope === scope);
947
- }
948
- if (attributes) {
949
- filteredTraces = filteredTraces.filter((record) => {
950
- if (!record.attributes) return false;
951
- const recordAttrs = this.parseJSON(record.attributes);
952
- if (!recordAttrs) return false;
953
- return Object.entries(attributes).every(([key, value]) => recordAttrs[key] === value);
954
- });
955
- }
956
- filteredTraces.sort((a, b) => {
957
- const dateA = new Date(a.createdAt).getTime();
958
- const dateB = new Date(b.createdAt).getTime();
959
- return dateB - dateA;
960
- });
961
- const start = page * perPage;
962
- const end = start + perPage;
963
- const paginatedTraces = filteredTraces.slice(start, end);
964
- return paginatedTraces.map((record) => ({
965
- id: record.id,
966
- parentSpanId: record.parentSpanId,
967
- traceId: record.traceId,
968
- name: record.name,
969
- scope: record.scope,
970
- kind: record.kind,
971
- status: this.parseJSON(record.status),
972
- events: this.parseJSON(record.events) || [],
973
- links: this.parseJSON(record.links) || [],
974
- attributes: this.parseJSON(record?.attributes) || {},
975
- startTime: record.startTime,
976
- endTime: record.endTime,
977
- other: this.parseJSON(record.other) || {},
978
- createdAt: record.createdAt
979
- }));
980
- } catch (error) {
981
- this.logger.error("Failed to get traces:", { message: error instanceof Error ? error.message : String(error) });
982
- return [];
983
- }
984
- }
985
- parseJSON(value) {
986
- if (typeof value === "string") {
987
- try {
988
- return JSON.parse(value);
989
- } catch {
990
- return value;
991
- }
992
- }
993
- return value;
904
+ getTraces(_input) {
905
+ throw new Error("Method not implemented.");
994
906
  }
995
907
  getEvalsByAgentName(_agentName, _type) {
996
908
  throw new Error("Method not implemented.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/cloudflare",
3
- "version": "0.0.0-fix-memory-xxhash-20250409202110",
3
+ "version": "0.0.1-alpha.1",
4
4
  "description": "Cloudflare 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.0.0-fix-memory-xxhash-20250409202110"
26
+ "@mastra/core": "^0.8.0-alpha.8"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@cloudflare/workers-types": "^4.20250313.0",