@mastra/cloudflare 1.5.0-alpha.0 → 1.5.1-alpha.0
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 +31 -0
- package/dist/{chunk-5NOOV27A.js → chunk-CD6XB3H3.js} +21 -9
- package/dist/chunk-CD6XB3H3.js.map +1 -0
- package/dist/{chunk-4QM3RKOF.cjs → chunk-D7CPZ5NS.cjs} +21 -9
- package/dist/chunk-D7CPZ5NS.cjs.map +1 -0
- package/dist/{chunk-ADP2QAK4.js → chunk-OMTTR37Z.js} +32 -9
- package/dist/chunk-OMTTR37Z.js.map +1 -0
- package/dist/{chunk-63YHZAI7.cjs → chunk-UQ4IOLSC.cjs} +32 -9
- package/dist/chunk-UQ4IOLSC.cjs.map +1 -0
- package/dist/do/index.cjs +8 -8
- package/dist/do/index.js +1 -1
- package/dist/do/storage/domains/scores/index.d.ts +9 -5
- package/dist/do/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +18 -18
- package/dist/docs/references/reference-storage-cloudflare.md +2 -0
- package/dist/index.cjs +13 -13
- package/dist/index.js +2 -2
- package/dist/kv/index.cjs +7 -7
- package/dist/kv/index.js +1 -1
- package/dist/kv/storage/domains/scores/index.d.ts +9 -5
- package/dist/kv/storage/domains/scores/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-4QM3RKOF.cjs.map +0 -1
- package/dist/chunk-5NOOV27A.js.map +0 -1
- package/dist/chunk-63YHZAI7.cjs.map +0 -1
- package/dist/chunk-ADP2QAK4.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @mastra/cloudflare
|
|
2
2
|
|
|
3
|
+
## 1.5.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added optional `organizationId` and `projectId` fields to scores for multi-tenant isolation. Scores can now be saved with tenancy metadata and the `listScoresBy*` methods accept a `filters` option to scope results by organization and project. ([#18331](https://github.com/mastra-ai/mastra/pull/18331))
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
await storage.saveScore({ ...score, organizationId: 'org-a', projectId: 'proj-1' });
|
|
11
|
+
|
|
12
|
+
const result = await storage.listScoresByScorerId({
|
|
13
|
+
scorerId,
|
|
14
|
+
filters: { organizationId: 'org-a', projectId: 'proj-1' },
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`projectId` identifies the project scope, separate from `resourceId` which continues to mean the agent memory resource.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`9250acd`](https://github.com/mastra-ai/mastra/commit/9250acd1357f0f1f33d0dcca16f9655084c58eca), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`c64c2a8`](https://github.com/mastra-ai/mastra/commit/c64c2a8503a50252f9ca6b8e8c54cadee31b92a2), [`06e2680`](https://github.com/mastra-ai/mastra/commit/06e26806b51d2cbd858afdc66daa2b86ff3ba64a), [`1240f05`](https://github.com/mastra-ai/mastra/commit/1240f051c8e5371f1c014448bf37b1a1b9a05e47), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748)]:
|
|
21
|
+
- @mastra/core@1.49.0-alpha.5
|
|
22
|
+
|
|
23
|
+
## 1.5.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- Random bump ([#18178](https://github.com/mastra-ai/mastra/pull/18178))
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`7c0d868`](https://github.com/mastra-ai/mastra/commit/7c0d868d97d0fdbc04c14d0166dbf44d4c5a4a62), [`d9d2273`](https://github.com/mastra-ai/mastra/commit/d9d2273c702690c9a26eab2aebea879701d4355a), [`b04369d`](https://github.com/mastra-ai/mastra/commit/b04369d6b167c698ef103981171a8bf92808e756), [`8f3c262`](https://github.com/mastra-ai/mastra/commit/8f3c262587b335588a02d96b17fd6aca34c885b3)]:
|
|
32
|
+
- @mastra/core@1.45.0
|
|
33
|
+
|
|
3
34
|
## 1.5.0-alpha.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
|
@@ -1735,6 +1735,11 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
1735
1735
|
function transformScoreRow(row) {
|
|
1736
1736
|
return transformScoreRow$1(row);
|
|
1737
1737
|
}
|
|
1738
|
+
function matchesTenancy(score, filters) {
|
|
1739
|
+
if (filters?.organizationId !== void 0 && score.organizationId !== filters.organizationId) return false;
|
|
1740
|
+
if (filters?.projectId !== void 0 && score.projectId !== filters.projectId) return false;
|
|
1741
|
+
return true;
|
|
1742
|
+
}
|
|
1738
1743
|
var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
1739
1744
|
#db;
|
|
1740
1745
|
constructor(config) {
|
|
@@ -1833,7 +1838,8 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1833
1838
|
entityId,
|
|
1834
1839
|
entityType,
|
|
1835
1840
|
source,
|
|
1836
|
-
pagination
|
|
1841
|
+
pagination,
|
|
1842
|
+
filters
|
|
1837
1843
|
}) {
|
|
1838
1844
|
try {
|
|
1839
1845
|
const keys = await this.#db.listKV(TABLE_SCORERS);
|
|
@@ -1849,6 +1855,9 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1849
1855
|
if (source && score.source !== source) {
|
|
1850
1856
|
continue;
|
|
1851
1857
|
}
|
|
1858
|
+
if (!matchesTenancy(score, filters)) {
|
|
1859
|
+
continue;
|
|
1860
|
+
}
|
|
1852
1861
|
if (score && score.scorerId === scorerId) {
|
|
1853
1862
|
scores.push(transformScoreRow(score));
|
|
1854
1863
|
}
|
|
@@ -1890,14 +1899,15 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1890
1899
|
}
|
|
1891
1900
|
async listScoresByRunId({
|
|
1892
1901
|
runId,
|
|
1893
|
-
pagination
|
|
1902
|
+
pagination,
|
|
1903
|
+
filters
|
|
1894
1904
|
}) {
|
|
1895
1905
|
try {
|
|
1896
1906
|
const keys = await this.#db.listKV(TABLE_SCORERS);
|
|
1897
1907
|
const scores = [];
|
|
1898
1908
|
for (const { name: key } of keys) {
|
|
1899
1909
|
const score = await this.#db.getKV(TABLE_SCORERS, key);
|
|
1900
|
-
if (score && score.runId === runId) {
|
|
1910
|
+
if (score && score.runId === runId && matchesTenancy(score, filters)) {
|
|
1901
1911
|
scores.push(transformScoreRow(score));
|
|
1902
1912
|
}
|
|
1903
1913
|
}
|
|
@@ -1939,14 +1949,15 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1939
1949
|
async listScoresByEntityId({
|
|
1940
1950
|
entityId,
|
|
1941
1951
|
entityType,
|
|
1942
|
-
pagination
|
|
1952
|
+
pagination,
|
|
1953
|
+
filters
|
|
1943
1954
|
}) {
|
|
1944
1955
|
try {
|
|
1945
1956
|
const keys = await this.#db.listKV(TABLE_SCORERS);
|
|
1946
1957
|
const scores = [];
|
|
1947
1958
|
for (const { name: key } of keys) {
|
|
1948
1959
|
const score = await this.#db.getKV(TABLE_SCORERS, key);
|
|
1949
|
-
if (score && score.entityId === entityId && score.entityType === entityType) {
|
|
1960
|
+
if (score && score.entityId === entityId && score.entityType === entityType && matchesTenancy(score, filters)) {
|
|
1950
1961
|
scores.push(transformScoreRow(score));
|
|
1951
1962
|
}
|
|
1952
1963
|
}
|
|
@@ -1988,14 +1999,15 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1988
1999
|
async listScoresBySpan({
|
|
1989
2000
|
traceId,
|
|
1990
2001
|
spanId,
|
|
1991
|
-
pagination
|
|
2002
|
+
pagination,
|
|
2003
|
+
filters
|
|
1992
2004
|
}) {
|
|
1993
2005
|
try {
|
|
1994
2006
|
const keys = await this.#db.listKV(TABLE_SCORERS);
|
|
1995
2007
|
const scores = [];
|
|
1996
2008
|
for (const { name: key } of keys) {
|
|
1997
2009
|
const score = await this.#db.getKV(TABLE_SCORERS, key);
|
|
1998
|
-
if (score && score.traceId === traceId && score.spanId === spanId) {
|
|
2010
|
+
if (score && score.traceId === traceId && score.spanId === spanId && matchesTenancy(score, filters)) {
|
|
1999
2011
|
scores.push(transformScoreRow(score));
|
|
2000
2012
|
}
|
|
2001
2013
|
}
|
|
@@ -2405,5 +2417,5 @@ var CloudflareKVStorage = class extends MastraCompositeStore {
|
|
|
2405
2417
|
var CloudflareStore = CloudflareKVStorage;
|
|
2406
2418
|
|
|
2407
2419
|
export { BackgroundTasksStorageCloudflare, CloudflareKVStorage, CloudflareStore, MemoryStorageCloudflare, ScoresStorageCloudflare, WorkflowsStorageCloudflare };
|
|
2408
|
-
//# sourceMappingURL=chunk-
|
|
2409
|
-
//# sourceMappingURL=chunk-
|
|
2420
|
+
//# sourceMappingURL=chunk-CD6XB3H3.js.map
|
|
2421
|
+
//# sourceMappingURL=chunk-CD6XB3H3.js.map
|