@mastra/dynamodb 1.3.0-alpha.0 → 1.3.0-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.
- package/CHANGELOG.md +9 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +7 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/dynamodb
|
|
2
2
|
|
|
3
|
+
## 1.3.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed resource-scoped message includes across storage adapters so included context cannot cross resource boundaries. ([#20984](https://github.com/mastra-ai/mastra/pull/20984))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`6445eba`](https://github.com/mastra-ai/mastra/commit/6445eba6020abac681aba1cc9289f446cb400cbe), [`df31eb0`](https://github.com/mastra-ai/mastra/commit/df31eb0c7087d782a0d9346e467f9a4af4b0eef6), [`fcd0667`](https://github.com/mastra-ai/mastra/commit/fcd0667a4e378be35c9a1b1eb19cce78fbfd7282), [`bab06b1`](https://github.com/mastra-ai/mastra/commit/bab06b18923873a584bdfc71a6b4ec7fb4727fb7)]:
|
|
10
|
+
- @mastra/core@1.58.0-alpha.5
|
|
11
|
+
|
|
3
12
|
## 1.3.0-alpha.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-dynamodb
|
|
|
3
3
|
description: Documentation for @mastra/dynamodb. Use when working with @mastra/dynamodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/dynamodb"
|
|
6
|
-
version: "1.3.0-alpha.
|
|
6
|
+
version: "1.3.0-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/index.cjs
CHANGED
|
@@ -1746,7 +1746,10 @@ var MemoryStorageDynamoDB = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1746
1746
|
hasMore: false
|
|
1747
1747
|
};
|
|
1748
1748
|
if (perPage === 0 && include && include.length > 0) {
|
|
1749
|
-
const includeMessages = await this._getIncludedMessages({
|
|
1749
|
+
const includeMessages = await this._getIncludedMessages({
|
|
1750
|
+
include,
|
|
1751
|
+
resourceId
|
|
1752
|
+
});
|
|
1750
1753
|
const list = new _mastra_core_agent.MessageList().add(includeMessages, "memory");
|
|
1751
1754
|
return {
|
|
1752
1755
|
messages: this._sortMessages(list.get.all.db(), field, direction),
|
|
@@ -1835,7 +1838,10 @@ var MemoryStorageDynamoDB = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1835
1838
|
const messageIds = new Set(paginatedMessages.map((m) => m.id));
|
|
1836
1839
|
let includeMessages = [];
|
|
1837
1840
|
if (include && include.length > 0) {
|
|
1838
|
-
includeMessages = await this._getIncludedMessages({
|
|
1841
|
+
includeMessages = await this._getIncludedMessages({
|
|
1842
|
+
include,
|
|
1843
|
+
resourceId
|
|
1844
|
+
});
|
|
1839
1845
|
for (const includeMsg of includeMessages) if (!messageIds.has(includeMsg.id)) {
|
|
1840
1846
|
paginatedMessages.push(includeMsg);
|
|
1841
1847
|
messageIds.add(includeMsg.id);
|
|
@@ -2010,7 +2016,14 @@ var MemoryStorageDynamoDB = class extends _mastra_core_storage.MemoryStorage {
|
|
|
2010
2016
|
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
2011
2017
|
});
|
|
2012
2018
|
}
|
|
2013
|
-
|
|
2019
|
+
/**
|
|
2020
|
+
* Fetches the messages named by `include` together with their surrounding context.
|
|
2021
|
+
*
|
|
2022
|
+
* @param include - Message ids to pin, each with an optional before/after window.
|
|
2023
|
+
* @param resourceId - When set, restricts both the pinned messages and their context
|
|
2024
|
+
* to that resource so an id from another resource returns nothing.
|
|
2025
|
+
*/
|
|
2026
|
+
async _getIncludedMessages({ include, resourceId }) {
|
|
2014
2027
|
if (!include?.length) return [];
|
|
2015
2028
|
const targetResults = await Promise.all(include.map((inc) => this.service.entities.message.get({
|
|
2016
2029
|
entity: "message",
|
|
@@ -2023,7 +2036,7 @@ var MemoryStorageDynamoDB = class extends _mastra_core_storage.MemoryStorage {
|
|
|
2023
2036
|
data: null
|
|
2024
2037
|
}))));
|
|
2025
2038
|
const targetMap = /* @__PURE__ */ new Map();
|
|
2026
|
-
for (const { id, data } of targetResults) if (data) {
|
|
2039
|
+
for (const { id, data } of targetResults) if (data && (!resourceId || data.resourceId === resourceId)) {
|
|
2027
2040
|
const createdAt = typeof data.createdAt === "string" ? data.createdAt : new Date(data.createdAt).toISOString();
|
|
2028
2041
|
targetMap.set(id, {
|
|
2029
2042
|
threadId: data.threadId,
|
|
@@ -2031,7 +2044,7 @@ var MemoryStorageDynamoDB = class extends _mastra_core_storage.MemoryStorage {
|
|
|
2031
2044
|
});
|
|
2032
2045
|
}
|
|
2033
2046
|
if (targetMap.size === 0) return [];
|
|
2034
|
-
const parseQueryMessages = (data) => data.map((item) => this.parseMessageData(item)).filter((msg) => "content" in msg && typeof msg.content === "object");
|
|
2047
|
+
const parseQueryMessages = (data) => data.map((item) => this.parseMessageData(item)).filter((msg) => "content" in msg && typeof msg.content === "object").filter((msg) => !resourceId || msg.resourceId === resourceId);
|
|
2035
2048
|
const includeMessages = [];
|
|
2036
2049
|
for (const includeItem of include) {
|
|
2037
2050
|
const { id, withPreviousMessages = 0, withNextMessages = 0 } = includeItem;
|