@mastra/upstash 1.6.0 → 1.6.1-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/docs/SKILL.md +1 -10
- package/dist/docs/assets/SOURCE_MAP.json +43 -2
- package/dist/index.cjs +23 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -28
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts +2 -1
- package/dist/vector/filter.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/docs/references/docs-memory-working-memory.md +0 -450
- package/dist/docs/references/reference-rag-retrieval.md +0 -672
- package/dist/docs/references/reference-rag-vector-databases.md +0 -808
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-upstash
|
|
|
3
3
|
description: Documentation for @mastra/upstash. Use when working with @mastra/upstash APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/upstash"
|
|
6
|
-
version: "1.6.
|
|
6
|
+
version: "1.6.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -14,19 +14,10 @@ Use this skill whenever you are working with @mastra/upstash to obtain the domai
|
|
|
14
14
|
|
|
15
15
|
Read the individual reference documents for detailed explanations and code examples.
|
|
16
16
|
|
|
17
|
-
### Docs
|
|
18
|
-
|
|
19
|
-
- [Working memory](references/docs-memory-working-memory.md) - Persist user profiles, preferences, and application data with Mastra working memory using resource- or thread-scoped templates and storage adapters.
|
|
20
|
-
|
|
21
17
|
### Integrations
|
|
22
18
|
|
|
23
19
|
- [Upstash](references/integrations-databases-upstash.md) - Use Upstash Redis as serverless Mastra storage with REST credentials, namespaced keys, durable persistence, and deployment-friendly connections.
|
|
24
20
|
- [Upstash](references/integrations-vectors-upstash.md) - Run serverless vector and hybrid search from Mastra with Upstash Vector, including metadata filtering and automatic index creation.
|
|
25
21
|
|
|
26
|
-
### Reference
|
|
27
|
-
|
|
28
|
-
- [Retrieval, semantic search, reranking](references/reference-rag-retrieval.md) - After storing embeddings, you need to retrieve relevant chunks to answer user queries.
|
|
29
|
-
- [Storing embeddings in a vector database](references/reference-rag-vector-databases.md) - After generating embeddings, you need to store them in a database that supports vector similarity search.
|
|
30
|
-
|
|
31
22
|
|
|
32
23
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.6.
|
|
2
|
+
"version": "1.6.1-alpha.1",
|
|
3
3
|
"package": "@mastra/upstash",
|
|
4
|
-
"exports": {
|
|
4
|
+
"exports": {
|
|
5
|
+
"BackgroundTasksUpstash": {
|
|
6
|
+
"types": "dist/storage/domains/background-tasks/index.d.ts",
|
|
7
|
+
"implementation": "dist/index.js",
|
|
8
|
+
"line": 221
|
|
9
|
+
},
|
|
10
|
+
"ScoresUpstash": {
|
|
11
|
+
"types": "dist/storage/domains/scores/index.d.ts",
|
|
12
|
+
"implementation": "dist/index.js",
|
|
13
|
+
"line": 1628
|
|
14
|
+
},
|
|
15
|
+
"StoreMemoryUpstash": {
|
|
16
|
+
"types": "dist/storage/domains/memory/index.d.ts",
|
|
17
|
+
"implementation": "dist/index.js",
|
|
18
|
+
"line": 608
|
|
19
|
+
},
|
|
20
|
+
"UPSTASH_PROMPT": {
|
|
21
|
+
"types": "dist/vector/prompt.d.ts",
|
|
22
|
+
"implementation": "dist/index.js",
|
|
23
|
+
"line": 2936
|
|
24
|
+
},
|
|
25
|
+
"UpstashServerCache": {
|
|
26
|
+
"types": "dist/cache/index.d.ts",
|
|
27
|
+
"implementation": "dist/index.js",
|
|
28
|
+
"line": 36
|
|
29
|
+
},
|
|
30
|
+
"UpstashStore": {
|
|
31
|
+
"types": "dist/storage/index.d.ts",
|
|
32
|
+
"implementation": "dist/index.js",
|
|
33
|
+
"line": 2404
|
|
34
|
+
},
|
|
35
|
+
"UpstashVector": {
|
|
36
|
+
"types": "dist/vector/index.d.ts",
|
|
37
|
+
"implementation": "dist/index.js",
|
|
38
|
+
"line": 2576
|
|
39
|
+
},
|
|
40
|
+
"WorkflowsUpstash": {
|
|
41
|
+
"types": "dist/storage/domains/workflows/index.d.ts",
|
|
42
|
+
"implementation": "dist/index.js",
|
|
43
|
+
"line": 1889
|
|
44
|
+
}
|
|
45
|
+
},
|
|
5
46
|
"modules": {}
|
|
6
47
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -607,6 +607,7 @@ function getMessageIndexKey(messageId) {
|
|
|
607
607
|
return `msg-idx:${messageId}`;
|
|
608
608
|
}
|
|
609
609
|
var StoreMemoryUpstash = class extends _mastra_core_storage.MemoryStorage {
|
|
610
|
+
listThreadsPaginatesInMemory = true;
|
|
610
611
|
supportsPartialThreadUpdate = true;
|
|
611
612
|
client;
|
|
612
613
|
#db;
|
|
@@ -2503,31 +2504,20 @@ var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
|
|
|
2503
2504
|
default: throw new Error(`Unsupported operator: ${operator}`);
|
|
2504
2505
|
}
|
|
2505
2506
|
}
|
|
2506
|
-
NEGATED_OPERATORS = {
|
|
2507
|
-
$eq: "$ne",
|
|
2508
|
-
$ne: "$eq",
|
|
2509
|
-
$gt: "$lte",
|
|
2510
|
-
$gte: "$lt",
|
|
2511
|
-
$lt: "$gte",
|
|
2512
|
-
$lte: "$gt",
|
|
2513
|
-
$in: "$nin",
|
|
2514
|
-
$nin: "$in",
|
|
2515
|
-
$exists: "$exists"
|
|
2516
|
-
};
|
|
2517
2507
|
formatNot(path, value) {
|
|
2518
2508
|
if (typeof value !== "object") return `${path} != ${this.formatValue(value)}`;
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
}
|
|
2528
|
-
return `${fieldName} != ${this.formatValue(fieldValue)}`;
|
|
2509
|
+
const negated = Object.entries(value).map(([key, val]) => key.startsWith("$") ? this.negateOperator(path, key, val) : this.negateField(path ? `${path}.${key}` : key, val));
|
|
2510
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0] ?? "";
|
|
2511
|
+
}
|
|
2512
|
+
negateField(fieldName, fieldValue) {
|
|
2513
|
+
if (Array.isArray(fieldValue)) return fieldValue.length === 0 ? "(HAS FIELD empty OR HAS NOT FIELD empty)" : `${fieldName} NOT IN (${this.formatArray(fieldValue)})`;
|
|
2514
|
+
if (typeof fieldValue === "object" && fieldValue !== null && Object.keys(fieldValue).length > 0) {
|
|
2515
|
+
const negated = Object.entries(fieldValue).map(([key, val]) => key.startsWith("$") ? this.negateOperator(fieldName, key, val) : this.negateField(`${fieldName}.${key}`, val));
|
|
2516
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
|
|
2529
2517
|
}
|
|
2530
|
-
|
|
2518
|
+
return `${fieldName} != ${this.formatValue(fieldValue)}`;
|
|
2519
|
+
}
|
|
2520
|
+
negateOperator(path, op, val) {
|
|
2531
2521
|
if (op === "$lt") return `${path} >= ${this.formatValue(val)}`;
|
|
2532
2522
|
if (op === "$lte") return `${path} > ${this.formatValue(val)}`;
|
|
2533
2523
|
if (op === "$gt") return `${path} <= ${this.formatValue(val)}`;
|
|
@@ -2539,16 +2529,21 @@ var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
|
|
|
2539
2529
|
if (op === "$in") return `${path} NOT IN (${this.formatArray(val)})`;
|
|
2540
2530
|
if (op === "$nin") return `${path} IN (${this.formatArray(val)})`;
|
|
2541
2531
|
if (op === "$exists") return val ? `HAS NOT FIELD ${path}` : `HAS FIELD ${path}`;
|
|
2532
|
+
if (op === "$all") {
|
|
2533
|
+
if (!Array.isArray(val) || val.length === 0) return "(HAS FIELD empty AND HAS NOT FIELD empty)";
|
|
2534
|
+
const negated = val.map((item) => `${path} NOT CONTAINS ${this.formatValue(item)}`);
|
|
2535
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
|
|
2536
|
+
}
|
|
2542
2537
|
if (op === "$and" || op === "$or") {
|
|
2543
2538
|
const newOp = op === "$and" ? "$or" : "$and";
|
|
2544
|
-
const conditions = val.map((condition) => {
|
|
2545
|
-
const [fieldName, fieldValue] = Object.entries(condition)[0] ?? [];
|
|
2546
|
-
return { [fieldName]: { $not: fieldValue } };
|
|
2547
|
-
});
|
|
2539
|
+
const conditions = val.map((condition) => path ? { [path]: { $not: condition } } : { $not: condition });
|
|
2548
2540
|
return this.translateOperator(newOp, conditions, "");
|
|
2549
2541
|
}
|
|
2550
|
-
if (op === "$nor")
|
|
2551
|
-
|
|
2542
|
+
if (op === "$nor") {
|
|
2543
|
+
const conditions = val.map((condition) => path ? { [path]: condition } : condition);
|
|
2544
|
+
return this.translateOperator("$or", conditions, "");
|
|
2545
|
+
}
|
|
2546
|
+
throw new Error(`Unsupported operator in NOT: ${op}`);
|
|
2552
2547
|
}
|
|
2553
2548
|
formatValue(value) {
|
|
2554
2549
|
if (value === null || value === void 0) throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|