@mastra/pg 1.30.0-alpha.6 → 1.31.0-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 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/v-next/trace-query.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -17516,6 +17516,35 @@ function isMetadataField(field) {
|
|
|
17516
17516
|
function placeholders(values, offset) {
|
|
17517
17517
|
return values.map((_, index) => `$${offset + index}`).join(", ");
|
|
17518
17518
|
}
|
|
17519
|
+
/**
|
|
17520
|
+
* Unicode letters, marks, and digits as PostgreSQL bracket ranges, so `[^<ranges>]` splits words
|
|
17521
|
+
* like the planner's `[^\p{L}\p{M}\p{N}]`. PostgreSQL regexes have no `\p{…}` classes, and
|
|
17522
|
+
* `[[:alnum:]]` depends on the locale: it leaves out digits such as `² ½ ₂ ①`, and glibc files
|
|
17523
|
+
* some marks, such as the Devanagari virama, under punct. Derived once from the runtime's own
|
|
17524
|
+
* Unicode tables. A run may also absorb unassigned code points, which are never stored.
|
|
17525
|
+
* Private-use code points are not absorbed: the other stores treat them as separators.
|
|
17526
|
+
*/
|
|
17527
|
+
let pgWordRanges;
|
|
17528
|
+
function getPgWordRanges() {
|
|
17529
|
+
if (pgWordRanges !== void 0) return pgWordRanges;
|
|
17530
|
+
const escape = (cp) => cp > 65535 ? `\\U${cp.toString(16).padStart(8, "0")}` : `\\u${cp.toString(16).padStart(4, "0")}`;
|
|
17531
|
+
const chunks = [];
|
|
17532
|
+
for (let start = 0; start <= 1114111; start += 8192) {
|
|
17533
|
+
const codePoints = [];
|
|
17534
|
+
for (let cp = start; cp < start + 8192 && cp <= 1114111; cp++) if (cp < 55296 || cp > 57343) codePoints.push(cp);
|
|
17535
|
+
chunks.push(String.fromCodePoint(...codePoints));
|
|
17536
|
+
}
|
|
17537
|
+
const text = chunks.join("");
|
|
17538
|
+
const ranges = [];
|
|
17539
|
+
for (const match of text.matchAll(/[\p{L}\p{M}\p{N}\p{Cn}]+/gu)) {
|
|
17540
|
+
const first = match[0].codePointAt(0);
|
|
17541
|
+
const lastUnit = match.index + match[0].length - 1;
|
|
17542
|
+
const last = text.codePointAt(text.charCodeAt(lastUnit) >= 56320 && text.charCodeAt(lastUnit) <= 57343 ? lastUnit - 1 : lastUnit);
|
|
17543
|
+
ranges.push(first === last ? escape(first) : `${escape(first)}-${escape(last)}`);
|
|
17544
|
+
}
|
|
17545
|
+
pgWordRanges = ranges.join("");
|
|
17546
|
+
return pgWordRanges;
|
|
17547
|
+
}
|
|
17519
17548
|
function compileScalarPredicate(predicate, registry, parameterOffset, allowMetadata = false) {
|
|
17520
17549
|
if (predicate.type === "boolean") {
|
|
17521
17550
|
const values = [];
|
|
@@ -17559,6 +17588,13 @@ function compileScalarPredicate(predicate, registry, parameterOffset, allowMetad
|
|
|
17559
17588
|
values: fieldValues
|
|
17560
17589
|
};
|
|
17561
17590
|
}
|
|
17591
|
+
if (predicate.type === "text") {
|
|
17592
|
+
const found = `strpos(${`' ' || replace(lower(regexp_replace(normalize(${field}), '[^${getPgWordRanges()}]+', ' ', 'g')), 'ς', 'σ') || ' '`}, $${parameterOffset}) > 0`;
|
|
17593
|
+
return {
|
|
17594
|
+
sql: `COALESCE(${predicate.operator === "matches" ? found : `NOT (${found})`}, false)`,
|
|
17595
|
+
values: [...fieldValues, ` ${predicate.value} `]
|
|
17596
|
+
};
|
|
17597
|
+
}
|
|
17562
17598
|
if (predicate.type === "membership") {
|
|
17563
17599
|
const list = placeholders(predicate.values, parameterOffset);
|
|
17564
17600
|
if (predicate.operator === "in") return {
|