@mastra/cloudflare-d1 0.0.0-vector-query-tool-provider-options-20250828222356 → 0.0.0-vector-extension-schema-20250922130418
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 +1120 -0
- package/dist/index.cjs +20 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +2 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +20 -10
package/dist/index.js
CHANGED
|
@@ -802,6 +802,7 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
async _getIncludedMessages(threadId, selectBy) {
|
|
805
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
805
806
|
const include = selectBy?.include;
|
|
806
807
|
if (!include) return null;
|
|
807
808
|
const unionQueries = [];
|
|
@@ -860,17 +861,19 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
860
861
|
}
|
|
861
862
|
async getMessages({
|
|
862
863
|
threadId,
|
|
864
|
+
resourceId,
|
|
863
865
|
selectBy,
|
|
864
866
|
format
|
|
865
867
|
}) {
|
|
866
|
-
const fullTableName = this.operations.getTableName(TABLE_MESSAGES);
|
|
867
|
-
const limit = resolveMessageLimit({
|
|
868
|
-
last: selectBy?.last,
|
|
869
|
-
defaultLimit: 40
|
|
870
|
-
});
|
|
871
|
-
const include = selectBy?.include || [];
|
|
872
|
-
const messages = [];
|
|
873
868
|
try {
|
|
869
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
870
|
+
const fullTableName = this.operations.getTableName(TABLE_MESSAGES);
|
|
871
|
+
const limit = resolveMessageLimit({
|
|
872
|
+
last: selectBy?.last,
|
|
873
|
+
defaultLimit: 40
|
|
874
|
+
});
|
|
875
|
+
const include = selectBy?.include || [];
|
|
876
|
+
const messages = [];
|
|
874
877
|
if (include.length) {
|
|
875
878
|
const includeResult = await this._getIncludedMessages(threadId, selectBy);
|
|
876
879
|
if (Array.isArray(includeResult)) messages.push(...includeResult);
|
|
@@ -910,7 +913,7 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
910
913
|
domain: ErrorDomain.STORAGE,
|
|
911
914
|
category: ErrorCategory.THIRD_PARTY,
|
|
912
915
|
text: `Failed to retrieve messages for thread ${threadId}: ${error instanceof Error ? error.message : String(error)}`,
|
|
913
|
-
details: { threadId }
|
|
916
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
914
917
|
},
|
|
915
918
|
error
|
|
916
919
|
);
|
|
@@ -962,6 +965,7 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
962
965
|
}
|
|
963
966
|
async getMessagesPaginated({
|
|
964
967
|
threadId,
|
|
968
|
+
resourceId,
|
|
965
969
|
selectBy,
|
|
966
970
|
format
|
|
967
971
|
}) {
|
|
@@ -971,6 +975,7 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
971
975
|
const fullTableName = this.operations.getTableName(TABLE_MESSAGES);
|
|
972
976
|
const messages = [];
|
|
973
977
|
try {
|
|
978
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
974
979
|
if (selectBy?.include?.length) {
|
|
975
980
|
const includeResult = await this._getIncludedMessages(threadId, selectBy);
|
|
976
981
|
if (Array.isArray(includeResult)) messages.push(...includeResult);
|
|
@@ -1059,7 +1064,7 @@ var MemoryStorageD1 = class extends MemoryStorage {
|
|
|
1059
1064
|
domain: ErrorDomain.STORAGE,
|
|
1060
1065
|
category: ErrorCategory.THIRD_PARTY,
|
|
1061
1066
|
text: `Failed to retrieve messages for thread ${threadId}: ${error instanceof Error ? error.message : String(error)}`,
|
|
1062
|
-
details: { threadId }
|
|
1067
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
1063
1068
|
},
|
|
1064
1069
|
error
|
|
1065
1070
|
);
|
|
@@ -1874,7 +1879,7 @@ var TracesStorageD1 = class extends TracesStorage {
|
|
|
1874
1879
|
const allDataResult = await this.operations.executeQuery(
|
|
1875
1880
|
createSqlBuilder().select("*").from(fullTableName).where("1=1").build()
|
|
1876
1881
|
);
|
|
1877
|
-
console.
|
|
1882
|
+
console.info("allDataResult", allDataResult);
|
|
1878
1883
|
const countResult = await this.operations.executeQuery(countQuery.build());
|
|
1879
1884
|
const total = Number(countResult?.[0]?.count ?? 0);
|
|
1880
1885
|
dataQuery.orderBy("startTime", "DESC").limit(perPage).offset(page * perPage);
|
|
@@ -1945,6 +1950,7 @@ var WorkflowsStorageD1 = class extends WorkflowsStorage {
|
|
|
1945
1950
|
async persistWorkflowSnapshot({
|
|
1946
1951
|
workflowName,
|
|
1947
1952
|
runId,
|
|
1953
|
+
resourceId,
|
|
1948
1954
|
snapshot
|
|
1949
1955
|
}) {
|
|
1950
1956
|
const fullTableName = this.operations.getTableName(TABLE_WORKFLOW_SNAPSHOT);
|
|
@@ -1955,11 +1961,13 @@ var WorkflowsStorageD1 = class extends WorkflowsStorage {
|
|
|
1955
1961
|
});
|
|
1956
1962
|
const persisting = currentSnapshot ? {
|
|
1957
1963
|
...currentSnapshot,
|
|
1964
|
+
resourceId,
|
|
1958
1965
|
snapshot: JSON.stringify(snapshot),
|
|
1959
1966
|
updatedAt: now
|
|
1960
1967
|
} : {
|
|
1961
1968
|
workflow_name: workflowName,
|
|
1962
1969
|
run_id: runId,
|
|
1970
|
+
resourceId,
|
|
1963
1971
|
snapshot,
|
|
1964
1972
|
createdAt: now,
|
|
1965
1973
|
updatedAt: now
|
|
@@ -2329,9 +2337,10 @@ var D1Store = class extends MastraStorage {
|
|
|
2329
2337
|
async persistWorkflowSnapshot({
|
|
2330
2338
|
workflowName,
|
|
2331
2339
|
runId,
|
|
2340
|
+
resourceId,
|
|
2332
2341
|
snapshot
|
|
2333
2342
|
}) {
|
|
2334
|
-
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
2343
|
+
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
|
|
2335
2344
|
}
|
|
2336
2345
|
async loadWorkflowSnapshot(params) {
|
|
2337
2346
|
return this.stores.workflows.loadWorkflowSnapshot(params);
|