@mastra/lance 0.2.11 → 0.2.12-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 +15 -0
- package/dist/index.cjs +19 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -401,6 +401,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
401
401
|
threadConfig
|
|
402
402
|
}) {
|
|
403
403
|
try {
|
|
404
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
404
405
|
if (threadConfig) {
|
|
405
406
|
throw new Error("ThreadConfig is not supported by LanceDB storage");
|
|
406
407
|
}
|
|
@@ -441,7 +442,11 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
441
442
|
{
|
|
442
443
|
id: "LANCE_STORE_GET_MESSAGES_FAILED",
|
|
443
444
|
domain: ErrorDomain.STORAGE,
|
|
444
|
-
category: ErrorCategory.THIRD_PARTY
|
|
445
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
446
|
+
details: {
|
|
447
|
+
threadId,
|
|
448
|
+
resourceId: resourceId ?? ""
|
|
449
|
+
}
|
|
445
450
|
},
|
|
446
451
|
error
|
|
447
452
|
);
|
|
@@ -612,13 +617,11 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
612
617
|
return Array.from(allIndices).sort((a, b) => a - b).map((index) => records[index]);
|
|
613
618
|
}
|
|
614
619
|
async getMessagesPaginated(args) {
|
|
620
|
+
const { threadId, resourceId, selectBy, format = "v1" } = args;
|
|
621
|
+
const page = selectBy?.pagination?.page ?? 0;
|
|
622
|
+
const perPage = selectBy?.pagination?.perPage ?? 10;
|
|
615
623
|
try {
|
|
616
|
-
|
|
617
|
-
if (!threadId) {
|
|
618
|
-
throw new Error("Thread ID is required for getMessagesPaginated");
|
|
619
|
-
}
|
|
620
|
-
const page = selectBy?.pagination?.page ?? 0;
|
|
621
|
-
const perPage = selectBy?.pagination?.perPage ?? 10;
|
|
624
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
622
625
|
const dateRange = selectBy?.pagination?.dateRange;
|
|
623
626
|
const fromDate = dateRange?.start;
|
|
624
627
|
const toDate = dateRange?.end;
|
|
@@ -720,14 +723,21 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
720
723
|
hasMore: total > (page + 1) * perPage
|
|
721
724
|
};
|
|
722
725
|
} catch (error) {
|
|
723
|
-
|
|
726
|
+
const mastraError = new MastraError(
|
|
724
727
|
{
|
|
725
728
|
id: "LANCE_STORE_GET_MESSAGES_PAGINATED_FAILED",
|
|
726
729
|
domain: ErrorDomain.STORAGE,
|
|
727
|
-
category: ErrorCategory.THIRD_PARTY
|
|
730
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
731
|
+
details: {
|
|
732
|
+
threadId,
|
|
733
|
+
resourceId: resourceId ?? ""
|
|
734
|
+
}
|
|
728
735
|
},
|
|
729
736
|
error
|
|
730
737
|
);
|
|
738
|
+
this.logger?.trackException?.(mastraError);
|
|
739
|
+
this.logger?.error?.(mastraError.toString());
|
|
740
|
+
return { messages: [], total: 0, page, perPage, hasMore: false };
|
|
731
741
|
}
|
|
732
742
|
}
|
|
733
743
|
/**
|