@mastra/cloudflare 0.0.0-workflow-deno-20250616132510 → 0.0.0-working-memory-per-user-20250620163010

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.
@@ -1,6 +1,7 @@
1
1
  import type { EvalRow } from '@mastra/core/storage';
2
2
  import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types';
3
3
  import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types';
4
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
5
  import type { MastraMessageV1 } from '@mastra/core/memory';
5
6
  import type { MastraMessageV2 } from '@mastra/core/memory';
6
7
  import { MastraStorage } from '@mastra/core/storage';
@@ -8,10 +9,12 @@ import type { PaginationInfo } from '@mastra/core/storage';
8
9
  import type { StorageColumn } from '@mastra/core/storage';
9
10
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
10
11
  import type { StorageGetTracesArg } from '@mastra/core/storage';
12
+ import type { StorageResourceType } from '@mastra/core/storage';
11
13
  import type { StorageThreadType } from '@mastra/core/memory';
12
14
  import type { TABLE_EVALS } from '@mastra/core/storage';
13
15
  import type { TABLE_MESSAGES } from '@mastra/core/storage';
14
16
  import type { TABLE_NAMES } from '@mastra/core/storage';
17
+ import type { TABLE_RESOURCES } from '@mastra/core/storage';
15
18
  import type { TABLE_THREADS } from '@mastra/core/storage';
16
19
  import type { TABLE_TRACES } from '@mastra/core/storage';
17
20
  import type { TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
@@ -228,6 +231,15 @@ declare class CloudflareStore extends MastraStorage {
228
231
  messages: MastraMessageV1[] | MastraMessageV2[];
229
232
  }>;
230
233
  close(): Promise<void>;
234
+ updateMessages(_args: {
235
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
236
+ id: string;
237
+ content?: {
238
+ metadata?: MastraMessageContentV2['metadata'];
239
+ content?: MastraMessageContentV2['content'];
240
+ };
241
+ }[];
242
+ }): Promise<MastraMessageV2[]>;
231
243
  }
232
244
  export { CloudflareStore }
233
245
  export { CloudflareStore as CloudflareStore_alias_1 }
@@ -302,6 +314,7 @@ export declare type RecordTypes = {
302
314
  [TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
303
315
  [TABLE_EVALS]: EvalRow;
304
316
  [TABLE_TRACES]: any;
317
+ [TABLE_RESOURCES]: StorageResourceType;
305
318
  };
306
319
 
307
320
  export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
@@ -1,6 +1,7 @@
1
1
  import type { EvalRow } from '@mastra/core/storage';
2
2
  import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types';
3
3
  import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types';
4
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
5
  import type { MastraMessageV1 } from '@mastra/core/memory';
5
6
  import type { MastraMessageV2 } from '@mastra/core/memory';
6
7
  import { MastraStorage } from '@mastra/core/storage';
@@ -8,10 +9,12 @@ import type { PaginationInfo } from '@mastra/core/storage';
8
9
  import type { StorageColumn } from '@mastra/core/storage';
9
10
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
10
11
  import type { StorageGetTracesArg } from '@mastra/core/storage';
12
+ import type { StorageResourceType } from '@mastra/core/storage';
11
13
  import type { StorageThreadType } from '@mastra/core/memory';
12
14
  import type { TABLE_EVALS } from '@mastra/core/storage';
13
15
  import type { TABLE_MESSAGES } from '@mastra/core/storage';
14
16
  import type { TABLE_NAMES } from '@mastra/core/storage';
17
+ import type { TABLE_RESOURCES } from '@mastra/core/storage';
15
18
  import type { TABLE_THREADS } from '@mastra/core/storage';
16
19
  import type { TABLE_TRACES } from '@mastra/core/storage';
17
20
  import type { TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
@@ -228,6 +231,15 @@ declare class CloudflareStore extends MastraStorage {
228
231
  messages: MastraMessageV1[] | MastraMessageV2[];
229
232
  }>;
230
233
  close(): Promise<void>;
234
+ updateMessages(_args: {
235
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
236
+ id: string;
237
+ content?: {
238
+ metadata?: MastraMessageContentV2['metadata'];
239
+ content?: MastraMessageContentV2['content'];
240
+ };
241
+ }[];
242
+ }): Promise<MastraMessageV2[]>;
231
243
  }
232
244
  export { CloudflareStore }
233
245
  export { CloudflareStore as CloudflareStore_alias_1 }
@@ -302,6 +314,7 @@ export declare type RecordTypes = {
302
314
  [TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
303
315
  [TABLE_EVALS]: EvalRow;
304
316
  [TABLE_TRACES]: any;
317
+ [TABLE_RESOURCES]: StorageResourceType;
305
318
  };
306
319
 
307
320
  export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
package/dist/index.cjs CHANGED
@@ -28,7 +28,7 @@ var CloudflareStore = class extends storage.MastraStorage {
28
28
  if (!config.bindings) {
29
29
  throw new Error("KV bindings are required when using Workers Binding API");
30
30
  }
31
- const requiredTables = [storage.TABLE_THREADS, storage.TABLE_MESSAGES, storage.TABLE_WORKFLOW_SNAPSHOT, storage.TABLE_EVALS, storage.TABLE_TRACES];
31
+ const requiredTables = [storage.TABLE_THREADS, storage.TABLE_MESSAGES, storage.TABLE_WORKFLOW_SNAPSHOT, storage.TABLE_EVALS, storage.TABLE_TRACES, storage.TABLE_RESOURCES];
32
32
  for (const table of requiredTables) {
33
33
  if (!(table in config.bindings)) {
34
34
  throw new Error(`Missing KV binding for table: ${table}`);
@@ -889,12 +889,7 @@ var CloudflareStore = class extends storage.MastraStorage {
889
889
  format
890
890
  }) {
891
891
  if (!threadId) throw new Error("threadId is required");
892
- let limit = 40;
893
- if (typeof selectBy?.last === "number") {
894
- limit = Math.max(0, selectBy.last);
895
- } else if (selectBy?.last === false) {
896
- limit = 0;
897
- }
892
+ const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
898
893
  const messageIds = /* @__PURE__ */ new Set();
899
894
  if (limit === 0 && !selectBy?.include?.length) return [];
900
895
  try {
@@ -1246,6 +1241,10 @@ var CloudflareStore = class extends storage.MastraStorage {
1246
1241
  }
1247
1242
  async close() {
1248
1243
  }
1244
+ async updateMessages(_args) {
1245
+ this.logger.error("updateMessages is not yet implemented in CloudflareStore");
1246
+ throw new Error("Method not implemented");
1247
+ }
1249
1248
  };
1250
1249
 
1251
1250
  exports.CloudflareStore = CloudflareStore;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MessageList } from '@mastra/core/agent';
2
- import { MastraStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_TRACES } from '@mastra/core/storage';
2
+ import { MastraStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_TRACES, TABLE_RESOURCES } from '@mastra/core/storage';
3
3
  import Cloudflare from 'cloudflare';
4
4
 
5
5
  // src/storage/index.ts
@@ -22,7 +22,7 @@ var CloudflareStore = class extends MastraStorage {
22
22
  if (!config.bindings) {
23
23
  throw new Error("KV bindings are required when using Workers Binding API");
24
24
  }
25
- const requiredTables = [TABLE_THREADS, TABLE_MESSAGES, TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_TRACES];
25
+ const requiredTables = [TABLE_THREADS, TABLE_MESSAGES, TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_TRACES, TABLE_RESOURCES];
26
26
  for (const table of requiredTables) {
27
27
  if (!(table in config.bindings)) {
28
28
  throw new Error(`Missing KV binding for table: ${table}`);
@@ -883,12 +883,7 @@ var CloudflareStore = class extends MastraStorage {
883
883
  format
884
884
  }) {
885
885
  if (!threadId) throw new Error("threadId is required");
886
- let limit = 40;
887
- if (typeof selectBy?.last === "number") {
888
- limit = Math.max(0, selectBy.last);
889
- } else if (selectBy?.last === false) {
890
- limit = 0;
891
- }
886
+ const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
892
887
  const messageIds = /* @__PURE__ */ new Set();
893
888
  if (limit === 0 && !selectBy?.include?.length) return [];
894
889
  try {
@@ -1240,6 +1235,10 @@ var CloudflareStore = class extends MastraStorage {
1240
1235
  }
1241
1236
  async close() {
1242
1237
  }
1238
+ async updateMessages(_args) {
1239
+ this.logger.error("updateMessages is not yet implemented in CloudflareStore");
1240
+ throw new Error("Method not implemented");
1241
+ }
1243
1242
  };
1244
1243
 
1245
1244
  export { CloudflareStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/cloudflare",
3
- "version": "0.0.0-workflow-deno-20250616132510",
3
+ "version": "0.0.0-working-memory-per-user-20250620163010",
4
4
  "description": "Cloudflare provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "files": [
@@ -31,16 +31,16 @@
31
31
  "@types/node": "^20.19.0",
32
32
  "dotenv": "^16.5.0",
33
33
  "eslint": "^9.28.0",
34
- "miniflare": "^4.20250604.0",
34
+ "miniflare": "^4.20250604.1",
35
35
  "tsup": "^8.5.0",
36
36
  "typescript": "^5.8.3",
37
37
  "vitest": "^3.2.3",
38
- "@internal/lint": "0.0.0-workflow-deno-20250616132510",
39
- "@internal/storage-test-utils": "0.0.8",
40
- "@mastra/core": "0.0.0-workflow-deno-20250616132510"
38
+ "@internal/lint": "0.0.0-working-memory-per-user-20250620163010",
39
+ "@internal/storage-test-utils": "0.0.9",
40
+ "@mastra/core": "0.0.0-working-memory-per-user-20250620163010"
41
41
  },
42
42
  "peerDependencies": {
43
- "@mastra/core": "0.0.0-workflow-deno-20250616132510"
43
+ "@mastra/core": "0.0.0-working-memory-per-user-20250620163010"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",