@mastra/cloudflare 1.0.0-beta.10 → 1.0.0-beta.12
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/CHANGELOG.md +118 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/storage/01-reference.md +2 -0
- package/dist/index.cjs +28 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -18
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +2 -2
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,123 @@
|
|
|
1
1
|
# @mastra/cloudflare
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added new `listThreads` method for flexible thread filtering across all storage adapters. ([#11832](https://github.com/mastra-ai/mastra/pull/11832))
|
|
8
|
+
|
|
9
|
+
**New Features**
|
|
10
|
+
- Filter threads by `resourceId`, `metadata`, or both (with AND logic for metadata key-value pairs)
|
|
11
|
+
- All filter parameters are optional, allowing you to list all threads or filter as needed
|
|
12
|
+
- Full pagination and sorting support
|
|
13
|
+
|
|
14
|
+
**Example Usage**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// List all threads
|
|
18
|
+
const allThreads = await memory.listThreads({});
|
|
19
|
+
|
|
20
|
+
// Filter by resourceId only
|
|
21
|
+
const userThreads = await memory.listThreads({
|
|
22
|
+
filter: { resourceId: 'user-123' },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Filter by metadata only
|
|
26
|
+
const supportThreads = await memory.listThreads({
|
|
27
|
+
filter: { metadata: { category: 'support' } },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Filter by both with pagination
|
|
31
|
+
const filteredThreads = await memory.listThreads({
|
|
32
|
+
filter: {
|
|
33
|
+
resourceId: 'user-123',
|
|
34
|
+
metadata: { priority: 'high', status: 'open' },
|
|
35
|
+
},
|
|
36
|
+
orderBy: { field: 'updatedAt', direction: 'DESC' },
|
|
37
|
+
page: 0,
|
|
38
|
+
perPage: 20,
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Security Improvements**
|
|
43
|
+
- Added validation to prevent SQL injection via malicious metadata keys
|
|
44
|
+
- Added pagination parameter validation to prevent integer overflow attacks
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`ed3e3dd`](https://github.com/mastra-ai/mastra/commit/ed3e3ddec69d564fe2b125e083437f76331f1283), [`6833c69`](https://github.com/mastra-ai/mastra/commit/6833c69607418d257750bbcdd84638993d343539), [`47b1c16`](https://github.com/mastra-ai/mastra/commit/47b1c16a01c7ffb6765fe1e499b49092f8b7eba3), [`3a76a80`](https://github.com/mastra-ai/mastra/commit/3a76a80284cb71a0faa975abb3d4b2a9631e60cd), [`8538a0d`](https://github.com/mastra-ai/mastra/commit/8538a0d232619bf55dad7ddc2a8b0ca77c679a87), [`9312dcd`](https://github.com/mastra-ai/mastra/commit/9312dcd1c6f5b321929e7d382e763d95fdc030f5)]:
|
|
47
|
+
- @mastra/core@1.0.0-beta.25
|
|
48
|
+
|
|
49
|
+
## 1.0.0-beta.11
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Aligned vector store configuration with underlying library APIs, giving you access to all library options directly. ([#11742](https://github.com/mastra-ai/mastra/pull/11742))
|
|
54
|
+
|
|
55
|
+
**Why this change?**
|
|
56
|
+
|
|
57
|
+
Previously, each vector store defined its own configuration types that only exposed a subset of the underlying library's options. This meant users couldn't access advanced features like authentication, SSL, compression, or custom headers without creating their own client instances. Now, the configuration types extend the library types directly, so all options are available.
|
|
58
|
+
|
|
59
|
+
**@mastra/libsql** (Breaking)
|
|
60
|
+
|
|
61
|
+
Renamed `connectionUrl` to `url` to match the `@libsql/client` API and align with LibSQLStorage.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// Before
|
|
65
|
+
new LibSQLVector({ id: 'my-vector', connectionUrl: 'file:./db.sqlite' });
|
|
66
|
+
|
|
67
|
+
// After
|
|
68
|
+
new LibSQLVector({ id: 'my-vector', url: 'file:./db.sqlite' });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**@mastra/opensearch** (Breaking)
|
|
72
|
+
|
|
73
|
+
Renamed `url` to `node` and added support for all OpenSearch `ClientOptions` including authentication, SSL, and compression.
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// Before
|
|
77
|
+
new OpenSearchVector({ id: 'my-vector', url: 'http://localhost:9200' });
|
|
78
|
+
|
|
79
|
+
// After
|
|
80
|
+
new OpenSearchVector({ id: 'my-vector', node: 'http://localhost:9200' });
|
|
81
|
+
|
|
82
|
+
// With authentication (now possible)
|
|
83
|
+
new OpenSearchVector({
|
|
84
|
+
id: 'my-vector',
|
|
85
|
+
node: 'https://localhost:9200',
|
|
86
|
+
auth: { username: 'admin', password: 'admin' },
|
|
87
|
+
ssl: { rejectUnauthorized: false },
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**@mastra/pinecone** (Breaking)
|
|
92
|
+
|
|
93
|
+
Removed `environment` parameter. Use `controllerHostUrl` instead (the actual Pinecone SDK field name). Added support for all `PineconeConfiguration` options.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Before
|
|
97
|
+
new PineconeVector({ id: 'my-vector', apiKey: '...', environment: '...' });
|
|
98
|
+
|
|
99
|
+
// After
|
|
100
|
+
new PineconeVector({ id: 'my-vector', apiKey: '...' });
|
|
101
|
+
|
|
102
|
+
// With custom controller host (if needed)
|
|
103
|
+
new PineconeVector({ id: 'my-vector', apiKey: '...', controllerHostUrl: '...' });
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**@mastra/clickhouse**
|
|
107
|
+
|
|
108
|
+
Added support for all `ClickHouseClientConfigOptions` like `request_timeout`, `compression`, `keep_alive`, and `database`. Existing configurations continue to work unchanged.
|
|
109
|
+
|
|
110
|
+
**@mastra/cloudflare, @mastra/cloudflare-d1, @mastra/lance, @mastra/libsql, @mastra/mongodb, @mastra/pg, @mastra/upstash**
|
|
111
|
+
|
|
112
|
+
Improved logging by replacing `console.warn` with structured logger in workflow storage domains.
|
|
113
|
+
|
|
114
|
+
**@mastra/deployer-cloud**
|
|
115
|
+
|
|
116
|
+
Updated internal LibSQLVector configuration for compatibility with the new API.
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [[`ebae12a`](https://github.com/mastra-ai/mastra/commit/ebae12a2dd0212e75478981053b148a2c246962d), [`c61a0a5`](https://github.com/mastra-ai/mastra/commit/c61a0a5de4904c88fd8b3718bc26d1be1c2ec6e7), [`69136e7`](https://github.com/mastra-ai/mastra/commit/69136e748e32f57297728a4e0f9a75988462f1a7), [`449aed2`](https://github.com/mastra-ai/mastra/commit/449aed2ba9d507b75bf93d427646ea94f734dfd1), [`eb648a2`](https://github.com/mastra-ai/mastra/commit/eb648a2cc1728f7678768dd70cd77619b448dab9), [`0131105`](https://github.com/mastra-ai/mastra/commit/0131105532e83bdcbb73352fc7d0879eebf140dc), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`b00ccd3`](https://github.com/mastra-ai/mastra/commit/b00ccd325ebd5d9e37e34dd0a105caae67eb568f), [`3bdfa75`](https://github.com/mastra-ai/mastra/commit/3bdfa7507a91db66f176ba8221aa28dd546e464a), [`e770de9`](https://github.com/mastra-ai/mastra/commit/e770de941a287a49b1964d44db5a5763d19890a6), [`52e2716`](https://github.com/mastra-ai/mastra/commit/52e2716b42df6eff443de72360ae83e86ec23993), [`27b4040`](https://github.com/mastra-ai/mastra/commit/27b4040bfa1a95d92546f420a02a626b1419a1d6), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`8dc7f55`](https://github.com/mastra-ai/mastra/commit/8dc7f55900395771da851dc7d78d53ae84fe34ec), [`8379099`](https://github.com/mastra-ai/mastra/commit/8379099fc467af6bef54dd7f80c9bd75bf8bbddf), [`8c0ec25`](https://github.com/mastra-ai/mastra/commit/8c0ec25646c8a7df253ed1e5ff4863a0d3f1316c), [`ff4d9a6`](https://github.com/mastra-ai/mastra/commit/ff4d9a6704fc87b31a380a76ed22736fdedbba5a), [`69821ef`](https://github.com/mastra-ai/mastra/commit/69821ef806482e2c44e2197ac0b050c3fe3a5285), [`1ed5716`](https://github.com/mastra-ai/mastra/commit/1ed5716830867b3774c4a1b43cc0d82935f32b96), [`4186bdd`](https://github.com/mastra-ai/mastra/commit/4186bdd00731305726fa06adba0b076a1d50b49f), [`7aaf973`](https://github.com/mastra-ai/mastra/commit/7aaf973f83fbbe9521f1f9e7a4fd99b8de464617)]:
|
|
119
|
+
- @mastra/core@1.0.0-beta.22
|
|
120
|
+
|
|
3
121
|
## 1.0.0-beta.10
|
|
4
122
|
|
|
5
123
|
### Patch Changes
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -24,6 +24,7 @@ import { CloudflareStore } from "@mastra/cloudflare";
|
|
|
24
24
|
|
|
25
25
|
// --- Example 1: Using Workers Binding ---
|
|
26
26
|
const storageWorkers = new CloudflareStore({
|
|
27
|
+
id: "cloudflare-workers-storage",
|
|
27
28
|
bindings: {
|
|
28
29
|
threads: THREADS_KV, // KVNamespace binding for threads table
|
|
29
30
|
messages: MESSAGES_KV, // KVNamespace binding for messages table
|
|
@@ -34,6 +35,7 @@ const storageWorkers = new CloudflareStore({
|
|
|
34
35
|
|
|
35
36
|
// --- Example 2: Using REST API ---
|
|
36
37
|
const storageRest = new CloudflareStore({
|
|
38
|
+
id: "cloudflare-rest-storage",
|
|
37
39
|
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!, // Cloudflare Account ID
|
|
38
40
|
apiToken: process.env.CLOUDFLARE_API_TOKEN!, // Cloudflare API Token
|
|
39
41
|
namespacePrefix: "dev_", // Optional: isolate namespaces per environment
|
package/dist/index.cjs
CHANGED
|
@@ -620,21 +620,23 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
620
620
|
return null;
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
|
-
async
|
|
623
|
+
async listThreads(args) {
|
|
624
|
+
const { page = 0, perPage: perPageInput, orderBy, filter } = args;
|
|
625
|
+
try {
|
|
626
|
+
this.validatePaginationInput(page, perPageInput ?? 100);
|
|
627
|
+
} catch (error$1) {
|
|
628
|
+
throw new error.MastraError(
|
|
629
|
+
{
|
|
630
|
+
id: storage.createStorageErrorId("CLOUDFLARE", "LIST_THREADS", "INVALID_PAGE"),
|
|
631
|
+
domain: error.ErrorDomain.STORAGE,
|
|
632
|
+
category: error.ErrorCategory.USER,
|
|
633
|
+
details: { page, ...perPageInput !== void 0 && { perPage: perPageInput } }
|
|
634
|
+
},
|
|
635
|
+
error$1 instanceof Error ? error$1 : new Error("Invalid pagination parameters")
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
const perPage = storage.normalizePerPage(perPageInput, 100);
|
|
624
639
|
try {
|
|
625
|
-
const { resourceId, page = 0, perPage: perPageInput, orderBy } = args;
|
|
626
|
-
const perPage = storage.normalizePerPage(perPageInput, 100);
|
|
627
|
-
if (page < 0) {
|
|
628
|
-
throw new error.MastraError(
|
|
629
|
-
{
|
|
630
|
-
id: storage.createStorageErrorId("CLOUDFLARE", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
631
|
-
domain: error.ErrorDomain.STORAGE,
|
|
632
|
-
category: error.ErrorCategory.USER,
|
|
633
|
-
details: { page }
|
|
634
|
-
},
|
|
635
|
-
new Error("page must be >= 0")
|
|
636
|
-
);
|
|
637
|
-
}
|
|
638
640
|
const { offset, perPage: perPageForResponse } = storage.calculatePagination(page, perPageInput, perPage);
|
|
639
641
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
640
642
|
const prefix = this.#db.namespacePrefix ? `${this.#db.namespacePrefix}:` : "";
|
|
@@ -643,7 +645,15 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
643
645
|
for (const { name: key } of keyObjs) {
|
|
644
646
|
const data = await this.#db.getKV(storage.TABLE_THREADS, key);
|
|
645
647
|
if (!data) continue;
|
|
646
|
-
if (data.resourceId !== resourceId)
|
|
648
|
+
if (filter?.resourceId && data.resourceId !== filter.resourceId) {
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
if (filter?.metadata && Object.keys(filter.metadata).length > 0) {
|
|
652
|
+
const metadata = this.ensureMetadata(data.metadata);
|
|
653
|
+
if (!metadata) continue;
|
|
654
|
+
const matches = Object.entries(filter.metadata).every(([key2, value]) => metadata[key2] === value);
|
|
655
|
+
if (!matches) continue;
|
|
656
|
+
}
|
|
647
657
|
threads.push(data);
|
|
648
658
|
}
|
|
649
659
|
threads.sort((a, b) => {
|
|
@@ -663,10 +673,10 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
663
673
|
} catch (error$1) {
|
|
664
674
|
throw new error.MastraError(
|
|
665
675
|
{
|
|
666
|
-
id: storage.createStorageErrorId("CLOUDFLARE", "
|
|
676
|
+
id: storage.createStorageErrorId("CLOUDFLARE", "LIST_THREADS", "FAILED"),
|
|
667
677
|
domain: error.ErrorDomain.STORAGE,
|
|
668
678
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
669
|
-
text: "Failed to
|
|
679
|
+
text: "Failed to list threads with filters"
|
|
670
680
|
},
|
|
671
681
|
error$1
|
|
672
682
|
);
|
|
@@ -1985,7 +1995,7 @@ var WorkflowsStorageCloudflare = class extends storage.WorkflowsStorage {
|
|
|
1985
1995
|
try {
|
|
1986
1996
|
parsedSnapshot = JSON.parse(row.snapshot);
|
|
1987
1997
|
} catch (e) {
|
|
1988
|
-
|
|
1998
|
+
this.logger.warn(`Failed to parse snapshot for workflow ${row.workflow_name}: ${e}`);
|
|
1989
1999
|
}
|
|
1990
2000
|
}
|
|
1991
2001
|
return {
|