@mastra/upstash 1.6.0-alpha.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.
- package/dist/docs/SKILL.md +1 -10
- package/dist/docs/assets/SOURCE_MAP.json +43 -2
- package/dist/index.cjs +22 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -28
- package/dist/index.js.map +1 -1
- package/dist/vector/filter.d.ts +2 -1
- package/dist/vector/filter.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/docs/references/docs-memory-working-memory.md +0 -450
- package/dist/docs/references/reference-rag-retrieval.md +0 -668
- package/dist/docs/references/reference-rag-vector-databases.md +0 -808
package/dist/index.js
CHANGED
|
@@ -2502,31 +2502,20 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
2502
2502
|
default: throw new Error(`Unsupported operator: ${operator}`);
|
|
2503
2503
|
}
|
|
2504
2504
|
}
|
|
2505
|
-
NEGATED_OPERATORS = {
|
|
2506
|
-
$eq: "$ne",
|
|
2507
|
-
$ne: "$eq",
|
|
2508
|
-
$gt: "$lte",
|
|
2509
|
-
$gte: "$lt",
|
|
2510
|
-
$lt: "$gte",
|
|
2511
|
-
$lte: "$gt",
|
|
2512
|
-
$in: "$nin",
|
|
2513
|
-
$nin: "$in",
|
|
2514
|
-
$exists: "$exists"
|
|
2515
|
-
};
|
|
2516
2505
|
formatNot(path, value) {
|
|
2517
2506
|
if (typeof value !== "object") return `${path} != ${this.formatValue(value)}`;
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
}
|
|
2527
|
-
return `${fieldName} != ${this.formatValue(fieldValue)}`;
|
|
2507
|
+
const negated = Object.entries(value).map(([key, val]) => key.startsWith("$") ? this.negateOperator(path, key, val) : this.negateField(path ? `${path}.${key}` : key, val));
|
|
2508
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0] ?? "";
|
|
2509
|
+
}
|
|
2510
|
+
negateField(fieldName, fieldValue) {
|
|
2511
|
+
if (Array.isArray(fieldValue)) return fieldValue.length === 0 ? "(HAS FIELD empty OR HAS NOT FIELD empty)" : `${fieldName} NOT IN (${this.formatArray(fieldValue)})`;
|
|
2512
|
+
if (typeof fieldValue === "object" && fieldValue !== null && Object.keys(fieldValue).length > 0) {
|
|
2513
|
+
const negated = Object.entries(fieldValue).map(([key, val]) => key.startsWith("$") ? this.negateOperator(fieldName, key, val) : this.negateField(`${fieldName}.${key}`, val));
|
|
2514
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
|
|
2528
2515
|
}
|
|
2529
|
-
|
|
2516
|
+
return `${fieldName} != ${this.formatValue(fieldValue)}`;
|
|
2517
|
+
}
|
|
2518
|
+
negateOperator(path, op, val) {
|
|
2530
2519
|
if (op === "$lt") return `${path} >= ${this.formatValue(val)}`;
|
|
2531
2520
|
if (op === "$lte") return `${path} > ${this.formatValue(val)}`;
|
|
2532
2521
|
if (op === "$gt") return `${path} <= ${this.formatValue(val)}`;
|
|
@@ -2538,16 +2527,21 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
2538
2527
|
if (op === "$in") return `${path} NOT IN (${this.formatArray(val)})`;
|
|
2539
2528
|
if (op === "$nin") return `${path} IN (${this.formatArray(val)})`;
|
|
2540
2529
|
if (op === "$exists") return val ? `HAS NOT FIELD ${path}` : `HAS FIELD ${path}`;
|
|
2530
|
+
if (op === "$all") {
|
|
2531
|
+
if (!Array.isArray(val) || val.length === 0) return "(HAS FIELD empty AND HAS NOT FIELD empty)";
|
|
2532
|
+
const negated = val.map((item) => `${path} NOT CONTAINS ${this.formatValue(item)}`);
|
|
2533
|
+
return negated.length > 1 ? `(${negated.join(" OR ")})` : negated[0];
|
|
2534
|
+
}
|
|
2541
2535
|
if (op === "$and" || op === "$or") {
|
|
2542
2536
|
const newOp = op === "$and" ? "$or" : "$and";
|
|
2543
|
-
const conditions = val.map((condition) => {
|
|
2544
|
-
const [fieldName, fieldValue] = Object.entries(condition)[0] ?? [];
|
|
2545
|
-
return { [fieldName]: { $not: fieldValue } };
|
|
2546
|
-
});
|
|
2537
|
+
const conditions = val.map((condition) => path ? { [path]: { $not: condition } } : { $not: condition });
|
|
2547
2538
|
return this.translateOperator(newOp, conditions, "");
|
|
2548
2539
|
}
|
|
2549
|
-
if (op === "$nor")
|
|
2550
|
-
|
|
2540
|
+
if (op === "$nor") {
|
|
2541
|
+
const conditions = val.map((condition) => path ? { [path]: condition } : condition);
|
|
2542
|
+
return this.translateOperator("$or", conditions, "");
|
|
2543
|
+
}
|
|
2544
|
+
throw new Error(`Unsupported operator in NOT: ${op}`);
|
|
2551
2545
|
}
|
|
2552
2546
|
formatValue(value) {
|
|
2553
2547
|
if (value === null || value === void 0) throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|