@mastra/upstash 1.6.0 → 1.6.1-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.
@@ -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.0"
6
+ version: "1.6.1-alpha.0"
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.0",
2
+ "version": "1.6.1-alpha.0",
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": 1627
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": 2935
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": 2403
34
+ },
35
+ "UpstashVector": {
36
+ "types": "dist/vector/index.d.ts",
37
+ "implementation": "dist/index.js",
38
+ "line": 2575
39
+ },
40
+ "WorkflowsUpstash": {
41
+ "types": "dist/storage/domains/workflows/index.d.ts",
42
+ "implementation": "dist/index.js",
43
+ "line": 1888
44
+ }
45
+ },
5
46
  "modules": {}
6
47
  }
package/dist/index.cjs CHANGED
@@ -2503,31 +2503,20 @@ var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
2503
2503
  default: throw new Error(`Unsupported operator: ${operator}`);
2504
2504
  }
2505
2505
  }
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
2506
  formatNot(path, value) {
2518
2507
  if (typeof value !== "object") return `${path} != ${this.formatValue(value)}`;
2519
- if (!Object.keys(value).some((k) => k.startsWith("$"))) {
2520
- const [fieldName, fieldValue] = Object.entries(value)[0] ?? [];
2521
- if (typeof fieldValue === "object" && fieldValue !== null && Object.keys(fieldValue)[0]?.startsWith("$")) {
2522
- const [op, val] = Object.entries(fieldValue)[0] ?? [];
2523
- const negatedOp = this.NEGATED_OPERATORS[op];
2524
- if (!negatedOp) throw new Error(`Unsupported operator in NOT: ${op}`);
2525
- if (op === "$exists") return this.translateOperator(op, !val, fieldName ?? "");
2526
- return this.translateOperator(negatedOp, val, fieldName ?? "");
2527
- }
2528
- return `${fieldName} != ${this.formatValue(fieldValue)}`;
2508
+ const negated = Object.entries(value).map(([key, val]) => key.startsWith("$") ? this.negateOperator(path, key, val) : this.negateField(path ? `${path}.${key}` : key, val));
2509
+ return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0] ?? "";
2510
+ }
2511
+ negateField(fieldName, fieldValue) {
2512
+ if (Array.isArray(fieldValue)) return fieldValue.length === 0 ? "(HAS FIELD empty OR HAS NOT FIELD empty)" : `${fieldName} NOT IN (${this.formatArray(fieldValue)})`;
2513
+ if (typeof fieldValue === "object" && fieldValue !== null && Object.keys(fieldValue).length > 0) {
2514
+ const negated = Object.entries(fieldValue).map(([key, val]) => key.startsWith("$") ? this.negateOperator(fieldName, key, val) : this.negateField(`${fieldName}.${key}`, val));
2515
+ return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
2529
2516
  }
2530
- const [op, val] = Object.entries(value)[0] ?? [];
2517
+ return `${fieldName} != ${this.formatValue(fieldValue)}`;
2518
+ }
2519
+ negateOperator(path, op, val) {
2531
2520
  if (op === "$lt") return `${path} >= ${this.formatValue(val)}`;
2532
2521
  if (op === "$lte") return `${path} > ${this.formatValue(val)}`;
2533
2522
  if (op === "$gt") return `${path} <= ${this.formatValue(val)}`;
@@ -2539,16 +2528,21 @@ var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
2539
2528
  if (op === "$in") return `${path} NOT IN (${this.formatArray(val)})`;
2540
2529
  if (op === "$nin") return `${path} IN (${this.formatArray(val)})`;
2541
2530
  if (op === "$exists") return val ? `HAS NOT FIELD ${path}` : `HAS FIELD ${path}`;
2531
+ if (op === "$all") {
2532
+ if (!Array.isArray(val) || val.length === 0) return "(HAS FIELD empty AND HAS NOT FIELD empty)";
2533
+ const negated = val.map((item) => `${path} NOT CONTAINS ${this.formatValue(item)}`);
2534
+ return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
2535
+ }
2542
2536
  if (op === "$and" || op === "$or") {
2543
2537
  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
- });
2538
+ const conditions = val.map((condition) => path ? { [path]: { $not: condition } } : { $not: condition });
2548
2539
  return this.translateOperator(newOp, conditions, "");
2549
2540
  }
2550
- if (op === "$nor") return this.translateOperator("$or", val, "");
2551
- return `${path} != ${this.formatValue(val)}`;
2541
+ if (op === "$nor") {
2542
+ const conditions = val.map((condition) => path ? { [path]: condition } : condition);
2543
+ return this.translateOperator("$or", conditions, "");
2544
+ }
2545
+ throw new Error(`Unsupported operator in NOT: ${op}`);
2552
2546
  }
2553
2547
  formatValue(value) {
2554
2548
  if (value === null || value === void 0) throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");