@mastra/mongodb 1.18.2 → 1.18.3-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 +9 -0
- package/LICENSE.md +6 -4
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +2 -0
- package/dist/docs/references/docs-memory-working-memory.md +2 -0
- package/dist/docs/references/docs-storage.md +2 -0
- package/dist/docs/references/integrations-databases-mongodb.md +2 -0
- package/dist/docs/references/reference-rag-retrieval.md +2 -0
- package/dist/docs/references/reference-rag-vector-databases.md +2 -0
- package/dist/docs/references/reference-storage-composite.md +2 -0
- package/dist/docs/references/reference-vectors-mongodb.md +2 -0
- package/dist/index.cjs +40 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -6
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/knowledge/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.18.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add an optional bounded description field to knowledge nodes across storage adapters, written through a dedicated curator tool. Part of an unreleased experimental memory feature. ([#21830](https://github.com/mastra-ai/mastra/pull/21830))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0885364`](https://github.com/mastra-ai/mastra/commit/0885364c2fc7fa31febcfc444fc1ba5231ac1257)]:
|
|
10
|
+
- @mastra/core@1.63.1-alpha.2
|
|
11
|
+
|
|
3
12
|
## 1.18.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/LICENSE.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Portions of this software are licensed as follows:
|
|
2
2
|
|
|
3
|
-
- All content that resides under any directory named
|
|
3
|
+
- All content that resides under any directory named `ee/` within this
|
|
4
4
|
repository, including but not limited to:
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
|
|
5
|
+
- `@mastra/core/auth/ee`
|
|
6
|
+
- `@mastra/core/agent-builder/ee`
|
|
7
|
+
- `@mastra/editor/ee`
|
|
8
|
+
|
|
9
|
+
is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
|
|
8
10
|
|
|
9
11
|
- All third-party components incorporated into the Mastra Software are
|
|
10
12
|
licensed under the original license provided by the owner of the
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.18.
|
|
13
|
+
var version = "1.18.3-alpha.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/vector/filter.ts
|
|
16
16
|
/**
|
|
@@ -4377,6 +4377,7 @@ function nodeFromDocument(row) {
|
|
|
4377
4377
|
name: String(row.name),
|
|
4378
4378
|
kind: String(row.kind),
|
|
4379
4379
|
content: row.content == null ? void 0 : String(row.content),
|
|
4380
|
+
description: row.description == null ? void 0 : String(row.description),
|
|
4380
4381
|
scope: cloneScope(row.scope),
|
|
4381
4382
|
version: Number(row.version),
|
|
4382
4383
|
mergedInto: row.mergedInto ?? void 0,
|
|
@@ -4484,6 +4485,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4484
4485
|
});
|
|
4485
4486
|
}
|
|
4486
4487
|
async createNode(input) {
|
|
4488
|
+
(0, _mastra_core_storage.assertKnowledgeDescriptionWithinBound)(input.description);
|
|
4487
4489
|
const scope = (0, _mastra_core_storage.canonicalizeKnowledgeScope)(input.scope);
|
|
4488
4490
|
return this.#connector.withTransaction(async (session) => {
|
|
4489
4491
|
const existing = await this.#getNodeByName(input.name, scope, session);
|
|
@@ -4499,6 +4501,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4499
4501
|
name: input.name.trim(),
|
|
4500
4502
|
kind: input.kind,
|
|
4501
4503
|
content: input.content,
|
|
4504
|
+
description: input.description,
|
|
4502
4505
|
scope,
|
|
4503
4506
|
version: 1,
|
|
4504
4507
|
createdAt: now,
|
|
@@ -4560,6 +4563,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4560
4563
|
}).limit(input.limit ?? 100).toArray()).map(nodeFromDocument);
|
|
4561
4564
|
}
|
|
4562
4565
|
async updateNode(input) {
|
|
4566
|
+
(0, _mastra_core_storage.assertKnowledgeDescriptionWithinBound)(input.description);
|
|
4563
4567
|
return this.#connector.withTransaction(async (session) => {
|
|
4564
4568
|
const existing = await this.#getNode(input.id, session);
|
|
4565
4569
|
if (!existing) throw new _mastra_core_storage.KnowledgeNotFoundError("node", input.id);
|
|
@@ -4567,6 +4571,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4567
4571
|
const scope = input.scope ? (0, _mastra_core_storage.canonicalizeKnowledgeScope)(input.scope) : existing.scope;
|
|
4568
4572
|
const name = input.name?.trim() ?? existing.name;
|
|
4569
4573
|
const content = input.content ?? existing.content;
|
|
4574
|
+
const description = input.description ?? existing.description;
|
|
4570
4575
|
const now = /* @__PURE__ */ new Date();
|
|
4571
4576
|
const result = await (await this.#nodes()).findOneAndUpdate({
|
|
4572
4577
|
id: input.id,
|
|
@@ -4578,6 +4583,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4578
4583
|
canonicalName: canonicalName(name),
|
|
4579
4584
|
kind: input.kind ?? existing.kind,
|
|
4580
4585
|
content: content ?? null,
|
|
4586
|
+
description: description ?? null,
|
|
4581
4587
|
scope,
|
|
4582
4588
|
scopeKey: (0, _mastra_core_storage.knowledgeScopeKey)(scope),
|
|
4583
4589
|
updatedAt: now
|
|
@@ -4641,10 +4647,34 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4641
4647
|
}, sessionOptions(session)))?.scope;
|
|
4642
4648
|
if (scope) await this.#outbox(mention.sourceType, mention.sourceId, "upsert", (0, _mastra_core_storage.createKnowledgeUlid)(), scope, session);
|
|
4643
4649
|
}
|
|
4650
|
+
let mergedTarget = target;
|
|
4651
|
+
if (target.description === void 0 && source.description) {
|
|
4652
|
+
const adoptedAt = /* @__PURE__ */ new Date();
|
|
4653
|
+
if ((await (await this.#nodes()).updateOne({
|
|
4654
|
+
id: target.id,
|
|
4655
|
+
type: "node",
|
|
4656
|
+
version: target.version,
|
|
4657
|
+
description: null
|
|
4658
|
+
}, {
|
|
4659
|
+
$set: {
|
|
4660
|
+
description: source.description,
|
|
4661
|
+
updatedAt: adoptedAt
|
|
4662
|
+
},
|
|
4663
|
+
$inc: { version: 1 }
|
|
4664
|
+
}, sessionOptions(session))).modifiedCount > 0) {
|
|
4665
|
+
mergedTarget = {
|
|
4666
|
+
...target,
|
|
4667
|
+
description: source.description,
|
|
4668
|
+
version: target.version + 1,
|
|
4669
|
+
updatedAt: adoptedAt
|
|
4670
|
+
};
|
|
4671
|
+
await this.#activity("node-updated", "node", target.id, target.scope, void 0, session);
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4644
4674
|
await this.#activity("node-merged", "node", source.id, source.scope, void 0, session);
|
|
4645
4675
|
await this.#outbox("node", source.id, "delete", input.sourceVersion + 1, source.scope, session);
|
|
4646
|
-
await this.#outbox("node", target.id, "upsert", (0, _mastra_core_storage.createKnowledgeUlid)(),
|
|
4647
|
-
return
|
|
4676
|
+
await this.#outbox("node", target.id, "upsert", (0, _mastra_core_storage.createKnowledgeUlid)(), mergedTarget.scope, session);
|
|
4677
|
+
return mergedTarget;
|
|
4648
4678
|
});
|
|
4649
4679
|
}
|
|
4650
4680
|
async appendKnowledge(input) {
|
|
@@ -4794,14 +4824,19 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
4794
4824
|
$or: [
|
|
4795
4825
|
{ name: regex },
|
|
4796
4826
|
{ kind: regex },
|
|
4797
|
-
{ content: regex }
|
|
4827
|
+
{ content: regex },
|
|
4828
|
+
{ description: regex }
|
|
4798
4829
|
]
|
|
4799
4830
|
}).sort({ updatedAt: -1 }).limit(limit).toArray()).map((row) => ({
|
|
4800
4831
|
type: "node",
|
|
4801
4832
|
id: row.id,
|
|
4802
4833
|
recordId: row.id,
|
|
4803
4834
|
name: row.name,
|
|
4804
|
-
text:
|
|
4835
|
+
text: [
|
|
4836
|
+
row.name,
|
|
4837
|
+
...row.description ? [row.description] : [],
|
|
4838
|
+
...row.content ? [row.content] : []
|
|
4839
|
+
].join("\n"),
|
|
4805
4840
|
scope: cloneScope(row.scope)
|
|
4806
4841
|
}));
|
|
4807
4842
|
if (results.length < limit) {
|