@mastra/cloudflare 0.10.2 → 0.10.3-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.
@@ -4,7 +4,6 @@ import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-
4
4
  import type { MastraMessageV1 } from '@mastra/core/memory';
5
5
  import type { MastraMessageV2 } from '@mastra/core/agent';
6
6
  import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
7
- import type { MastraMessageV2 as MastraMessageV2_3 } from '@mastra/core';
8
7
  import { MastraStorage } from '@mastra/core/storage';
9
8
  import type { StorageColumn } from '@mastra/core/storage';
10
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
@@ -109,13 +108,22 @@ declare class CloudflareStore extends MastraStorage {
109
108
  private validateColumnValue;
110
109
  private validateAgainstSchema;
111
110
  private validateRecord;
112
- private ensureDate;
113
- private serializeDate;
114
111
  private ensureMetadata;
115
112
  createTable({ tableName, schema, }: {
116
113
  tableName: TABLE_NAMES;
117
114
  schema: Record<string, StorageColumn>;
118
115
  }): Promise<void>;
116
+ /**
117
+ * No-op: This backend is schemaless and does not require schema changes.
118
+ * @param tableName Name of the table
119
+ * @param schema Schema of the table
120
+ * @param ifNotExists Array of column names to add if they don't exist
121
+ */
122
+ alterTable(_args: {
123
+ tableName: TABLE_NAMES;
124
+ schema: Record<string, StorageColumn>;
125
+ ifNotExists: string[];
126
+ }): Promise<void>;
119
127
  clearTable({ tableName }: {
120
128
  tableName: TABLE_NAMES;
121
129
  }): Promise<void>;
@@ -228,19 +236,6 @@ export declare interface CloudflareWorkersConfig {
228
236
  keyPrefix?: string;
229
237
  }
230
238
 
231
- export declare const createSampleMessage: (threadId: string, parts?: MastraMessageV2_3["content"]["parts"]) => MastraMessageV2_3;
232
-
233
- export declare const createSampleThread: () => {
234
- id: string;
235
- resourceId: string;
236
- title: string;
237
- createdAt: Date;
238
- updatedAt: Date;
239
- metadata: {
240
- key: string;
241
- };
242
- };
243
-
244
239
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
245
240
  id: string;
246
241
  parentSpanId: string;
@@ -4,7 +4,6 @@ import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-
4
4
  import type { MastraMessageV1 } from '@mastra/core/memory';
5
5
  import type { MastraMessageV2 } from '@mastra/core/agent';
6
6
  import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
7
- import type { MastraMessageV2 as MastraMessageV2_3 } from '@mastra/core';
8
7
  import { MastraStorage } from '@mastra/core/storage';
9
8
  import type { StorageColumn } from '@mastra/core/storage';
10
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
@@ -109,13 +108,22 @@ declare class CloudflareStore extends MastraStorage {
109
108
  private validateColumnValue;
110
109
  private validateAgainstSchema;
111
110
  private validateRecord;
112
- private ensureDate;
113
- private serializeDate;
114
111
  private ensureMetadata;
115
112
  createTable({ tableName, schema, }: {
116
113
  tableName: TABLE_NAMES;
117
114
  schema: Record<string, StorageColumn>;
118
115
  }): Promise<void>;
116
+ /**
117
+ * No-op: This backend is schemaless and does not require schema changes.
118
+ * @param tableName Name of the table
119
+ * @param schema Schema of the table
120
+ * @param ifNotExists Array of column names to add if they don't exist
121
+ */
122
+ alterTable(_args: {
123
+ tableName: TABLE_NAMES;
124
+ schema: Record<string, StorageColumn>;
125
+ ifNotExists: string[];
126
+ }): Promise<void>;
119
127
  clearTable({ tableName }: {
120
128
  tableName: TABLE_NAMES;
121
129
  }): Promise<void>;
@@ -228,19 +236,6 @@ export declare interface CloudflareWorkersConfig {
228
236
  keyPrefix?: string;
229
237
  }
230
238
 
231
- export declare const createSampleMessage: (threadId: string, parts?: MastraMessageV2_3["content"]["parts"]) => MastraMessageV2_3;
232
-
233
- export declare const createSampleThread: () => {
234
- id: string;
235
- resourceId: string;
236
- title: string;
237
- createdAt: Date;
238
- updatedAt: Date;
239
- metadata: {
240
- key: string;
241
- };
242
- };
243
-
244
239
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
245
240
  id: string;
246
241
  parentSpanId: string;
package/dist/index.cjs CHANGED
@@ -614,15 +614,6 @@ var CloudflareStore = class extends storage.MastraStorage {
614
614
  throw error;
615
615
  }
616
616
  }
617
- ensureDate(date) {
618
- if (!date) return void 0;
619
- return date instanceof Date ? date : new Date(date);
620
- }
621
- serializeDate(date) {
622
- if (!date) return void 0;
623
- const dateObj = this.ensureDate(date);
624
- return dateObj?.toISOString();
625
- }
626
617
  ensureMetadata(metadata) {
627
618
  if (!metadata) return {};
628
619
  return typeof metadata === "string" ? JSON.parse(metadata) : metadata;
@@ -644,6 +635,14 @@ var CloudflareStore = class extends storage.MastraStorage {
644
635
  throw new Error(`Failed to store schema: ${error.message}`);
645
636
  }
646
637
  }
638
+ /**
639
+ * No-op: This backend is schemaless and does not require schema changes.
640
+ * @param tableName Name of the table
641
+ * @param schema Schema of the table
642
+ * @param ifNotExists Array of column names to add if they don't exist
643
+ */
644
+ async alterTable(_args) {
645
+ }
647
646
  async clearTable({ tableName }) {
648
647
  const keys = await this.listKV(tableName);
649
648
  if (keys.length > 0) {
package/dist/index.js CHANGED
@@ -608,15 +608,6 @@ var CloudflareStore = class extends MastraStorage {
608
608
  throw error;
609
609
  }
610
610
  }
611
- ensureDate(date) {
612
- if (!date) return void 0;
613
- return date instanceof Date ? date : new Date(date);
614
- }
615
- serializeDate(date) {
616
- if (!date) return void 0;
617
- const dateObj = this.ensureDate(date);
618
- return dateObj?.toISOString();
619
- }
620
611
  ensureMetadata(metadata) {
621
612
  if (!metadata) return {};
622
613
  return typeof metadata === "string" ? JSON.parse(metadata) : metadata;
@@ -638,6 +629,14 @@ var CloudflareStore = class extends MastraStorage {
638
629
  throw new Error(`Failed to store schema: ${error.message}`);
639
630
  }
640
631
  }
632
+ /**
633
+ * No-op: This backend is schemaless and does not require schema changes.
634
+ * @param tableName Name of the table
635
+ * @param schema Schema of the table
636
+ * @param ifNotExists Array of column names to add if they don't exist
637
+ */
638
+ async alterTable(_args) {
639
+ }
641
640
  async clearTable({ tableName }) {
642
641
  const keys = await this.listKV(tableName);
643
642
  if (keys.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/cloudflare",
3
- "version": "0.10.2",
3
+ "version": "0.10.3-alpha.1",
4
4
  "description": "Cloudflare provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,20 +23,21 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "cloudflare": "^4.1.0"
26
+ "cloudflare": "^4.3.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@cloudflare/workers-types": "^4.20250313.0",
30
- "@microsoft/api-extractor": "^7.52.5",
31
- "@types/node": "^20.17.27",
32
- "dotenv": "^16.4.7",
33
- "eslint": "^9.23.0",
34
- "miniflare": "^4.20250310.0",
35
- "tsup": "^8.4.0",
29
+ "@cloudflare/workers-types": "^4.20250607.0",
30
+ "@microsoft/api-extractor": "^7.52.8",
31
+ "@types/node": "^20.17.57",
32
+ "dotenv": "^16.5.0",
33
+ "eslint": "^9.28.0",
34
+ "miniflare": "^4.20250525.1",
35
+ "tsup": "^8.5.0",
36
36
  "typescript": "^5.8.2",
37
- "vitest": "^3.1.2",
38
- "@internal/lint": "0.0.8",
39
- "@mastra/core": "0.10.2"
37
+ "vitest": "^3.2.2",
38
+ "@internal/lint": "0.0.10",
39
+ "@internal/storage-test-utils": "0.0.6",
40
+ "@mastra/core": "0.10.4-alpha.1"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@mastra/core": "^0.10.2-alpha.0"