@mastra/mongodb 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/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { saveScorePayloadSchema } from '@mastra/core/evals';
12
12
 
13
13
  // package.json
14
14
  var package_default = {
15
- version: "1.3.0-alpha.0"};
15
+ version: "1.3.0-alpha.1"};
16
16
  var MongoDBFilterTranslator = class extends BaseFilterTranslator {
17
17
  getSupportedOperators() {
18
18
  return {
@@ -2766,10 +2766,10 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
2766
2766
  );
2767
2767
  }
2768
2768
  }
2769
- async addPendingMessageTokens(id, tokenCount) {
2769
+ async setPendingMessageTokens(id, tokenCount) {
2770
2770
  if (typeof tokenCount !== "number" || !Number.isFinite(tokenCount) || tokenCount < 0) {
2771
2771
  throw new MastraError({
2772
- id: createStorageErrorId("MONGODB", "ADD_PENDING_MESSAGE_TOKENS", "INVALID_INPUT"),
2772
+ id: createStorageErrorId("MONGODB", "SET_PENDING_MESSAGE_TOKENS", "INVALID_INPUT"),
2773
2773
  text: `Invalid tokenCount: must be a finite non-negative number, got ${tokenCount}`,
2774
2774
  domain: ErrorDomain.STORAGE,
2775
2775
  category: ErrorCategory.USER,
@@ -2781,13 +2781,12 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
2781
2781
  const result = await collection.updateOne(
2782
2782
  { id },
2783
2783
  {
2784
- $inc: { pendingMessageTokens: tokenCount },
2785
- $set: { updatedAt: /* @__PURE__ */ new Date() }
2784
+ $set: { pendingMessageTokens: tokenCount, updatedAt: /* @__PURE__ */ new Date() }
2786
2785
  }
2787
2786
  );
2788
2787
  if (result.matchedCount === 0) {
2789
2788
  throw new MastraError({
2790
- id: createStorageErrorId("MONGODB", "ADD_PENDING_MESSAGE_TOKENS", "NOT_FOUND"),
2789
+ id: createStorageErrorId("MONGODB", "SET_PENDING_MESSAGE_TOKENS", "NOT_FOUND"),
2791
2790
  text: `Observational memory record not found: ${id}`,
2792
2791
  domain: ErrorDomain.STORAGE,
2793
2792
  category: ErrorCategory.THIRD_PARTY,
@@ -2800,7 +2799,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
2800
2799
  }
2801
2800
  throw new MastraError(
2802
2801
  {
2803
- id: createStorageErrorId("MONGODB", "ADD_PENDING_MESSAGE_TOKENS", "FAILED"),
2802
+ id: createStorageErrorId("MONGODB", "SET_PENDING_MESSAGE_TOKENS", "FAILED"),
2804
2803
  domain: ErrorDomain.STORAGE,
2805
2804
  category: ErrorCategory.THIRD_PARTY,
2806
2805
  details: { id, tokenCount }