@nicia-ai/typegraph 0.29.0 → 0.31.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/README.md +39 -0
- package/dist/backend/postgres/index.cjs +21 -20
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -10
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -10
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +18 -18
- package/dist/backend/sqlite/index.d.cts +12 -7
- package/dist/backend/sqlite/index.d.ts +12 -7
- package/dist/backend/sqlite/index.js +9 -9
- package/dist/backend/sqlite/libsql.cjs +14 -14
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +10 -10
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +9 -3
- package/dist/backend/sqlite/local.d.ts +9 -3
- package/dist/backend/sqlite/local.js +12 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-7KLVFWXR.js → chunk-2HZGWCB4.js} +121 -497
- package/dist/chunk-2HZGWCB4.js.map +1 -0
- package/dist/chunk-2YMGNYXY.js +40 -0
- package/dist/chunk-2YMGNYXY.js.map +1 -0
- package/dist/chunk-2ZY4K43M.js +90 -0
- package/dist/chunk-2ZY4K43M.js.map +1 -0
- package/dist/chunk-3EUKJEQ3.js +77 -0
- package/dist/chunk-3EUKJEQ3.js.map +1 -0
- package/dist/chunk-3JBJEYWE.cjs +604 -0
- package/dist/chunk-3JBJEYWE.cjs.map +1 -0
- package/dist/{chunk-A4H6QMV4.js → chunk-4A4GUZTQ.js} +15 -11
- package/dist/chunk-4A4GUZTQ.js.map +1 -0
- package/dist/{chunk-F2Q76CQ4.cjs → chunk-54JVNOAQ.cjs} +5 -37
- package/dist/chunk-54JVNOAQ.cjs.map +1 -0
- package/dist/{chunk-KGAJ5HFO.cjs → chunk-5CN7B4CZ.cjs} +17 -98
- package/dist/chunk-5CN7B4CZ.cjs.map +1 -0
- package/dist/{chunk-XTQHSOIC.cjs → chunk-5DTPBFX5.cjs} +88 -87
- package/dist/chunk-5DTPBFX5.cjs.map +1 -0
- package/dist/chunk-6G35I3VW.cjs +40 -0
- package/dist/chunk-6G35I3VW.cjs.map +1 -0
- package/dist/{chunk-UPBXUOW7.cjs → chunk-6RMLO5O4.cjs} +19 -64
- package/dist/chunk-6RMLO5O4.cjs.map +1 -0
- package/dist/chunk-6SA7UIQJ.cjs +94 -0
- package/dist/chunk-6SA7UIQJ.cjs.map +1 -0
- package/dist/chunk-6ZR4QC3O.cjs +12 -0
- package/dist/{chunk-Q3ZZLU3O.cjs.map → chunk-6ZR4QC3O.cjs.map} +1 -1
- package/dist/chunk-73KASJGO.cjs +52 -0
- package/dist/chunk-73KASJGO.cjs.map +1 -0
- package/dist/{chunk-R2LA6MKR.cjs → chunk-7JGLPAFV.cjs} +8 -8
- package/dist/{chunk-R2LA6MKR.cjs.map → chunk-7JGLPAFV.cjs.map} +1 -1
- package/dist/chunk-A3W7QG7K.js +45 -0
- package/dist/chunk-A3W7QG7K.js.map +1 -0
- package/dist/{chunk-Q5ASTPM4.cjs → chunk-ASYQDPPU.cjs} +19 -19
- package/dist/{chunk-Q5ASTPM4.cjs.map → chunk-ASYQDPPU.cjs.map} +1 -1
- package/dist/{chunk-IE2TPFBT.js → chunk-ATTXBMAX.js} +4 -74
- package/dist/chunk-ATTXBMAX.js.map +1 -0
- package/dist/chunk-AW4A3P5A.cjs +51 -0
- package/dist/chunk-AW4A3P5A.cjs.map +1 -0
- package/dist/{chunk-ZYQEXGYC.cjs → chunk-CIINW6PS.cjs} +92 -87
- package/dist/chunk-CIINW6PS.cjs.map +1 -0
- package/dist/{chunk-UP4QAJND.cjs → chunk-FLOI7QOT.cjs} +66 -65
- package/dist/chunk-FLOI7QOT.cjs.map +1 -0
- package/dist/{chunk-7V335GHG.cjs → chunk-FLRCVI2G.cjs} +12 -2
- package/dist/chunk-FLRCVI2G.cjs.map +1 -0
- package/dist/{chunk-HKN622O4.js → chunk-GKFWM3DS.js} +4 -32
- package/dist/chunk-GKFWM3DS.js.map +1 -0
- package/dist/chunk-HTGDWIDE.cjs +89 -0
- package/dist/chunk-HTGDWIDE.cjs.map +1 -0
- package/dist/{chunk-OGUH56BB.js → chunk-IJORSAC3.js} +6 -42
- package/dist/chunk-IJORSAC3.js.map +1 -0
- package/dist/{chunk-G6P3OVDY.cjs → chunk-JIEJCTDS.cjs} +18 -2
- package/dist/chunk-JIEJCTDS.cjs.map +1 -0
- package/dist/{chunk-NZ5PMBTG.js → chunk-K5P5OZXS.js} +12 -3
- package/dist/chunk-K5P5OZXS.js.map +1 -0
- package/dist/{chunk-HM6XMR3E.cjs → chunk-KTIEB7VH.cjs} +42 -32
- package/dist/chunk-KTIEB7VH.cjs.map +1 -0
- package/dist/chunk-LJLMDDCW.js +282 -0
- package/dist/chunk-LJLMDDCW.js.map +1 -0
- package/dist/{chunk-Z36W5WUM.js → chunk-MAQJYNJR.js} +3 -3
- package/dist/{chunk-Z36W5WUM.js.map → chunk-MAQJYNJR.js.map} +1 -1
- package/dist/{chunk-N3VVQDMA.js → chunk-MXE2U3EX.js} +3 -3
- package/dist/{chunk-N3VVQDMA.js.map → chunk-MXE2U3EX.js.map} +1 -1
- package/dist/{chunk-4K6IHUW6.cjs → chunk-N2MBPTAF.cjs} +14 -14
- package/dist/{chunk-4K6IHUW6.cjs.map → chunk-N2MBPTAF.cjs.map} +1 -1
- package/dist/{chunk-CUZGBWFT.js → chunk-O4VUR6SI.js} +3 -3
- package/dist/{chunk-CUZGBWFT.js.map → chunk-O4VUR6SI.js.map} +1 -1
- package/dist/chunk-RZ4DH4E7.cjs +15832 -0
- package/dist/chunk-RZ4DH4E7.cjs.map +1 -0
- package/dist/chunk-SAJSMR2B.js +35 -0
- package/dist/chunk-SAJSMR2B.js.map +1 -0
- package/dist/{chunk-RU5BBUU2.cjs → chunk-SFFJ2IKN.cjs} +71 -67
- package/dist/chunk-SFFJ2IKN.cjs.map +1 -0
- package/dist/{chunk-Y52UNT66.js → chunk-STP7QVUB.js} +8 -7
- package/dist/chunk-STP7QVUB.js.map +1 -0
- package/dist/chunk-THX25XW6.js +590 -0
- package/dist/chunk-THX25XW6.js.map +1 -0
- package/dist/{chunk-MB363HT5.js → chunk-TQOYM4LN.js} +18 -3
- package/dist/chunk-TQOYM4LN.js.map +1 -0
- package/dist/chunk-UIFEEPME.js +15787 -0
- package/dist/chunk-UIFEEPME.js.map +1 -0
- package/dist/{chunk-GPUNAJFH.js → chunk-UJ4V3YUQ.js} +3 -3
- package/dist/{chunk-GPUNAJFH.js.map → chunk-UJ4V3YUQ.js.map} +1 -1
- package/dist/{chunk-C2RWFIYP.cjs → chunk-V4IQYOQ4.cjs} +127 -511
- package/dist/chunk-V4IQYOQ4.cjs.map +1 -0
- package/dist/chunk-VMEWZU2N.cjs +287 -0
- package/dist/chunk-VMEWZU2N.cjs.map +1 -0
- package/dist/{chunk-3DTLDGIM.js → chunk-VZX2KSY3.js} +14 -9
- package/dist/chunk-VZX2KSY3.js.map +1 -0
- package/dist/{chunk-BMDF2S7S.js → chunk-WYTUF3QO.js} +3 -3
- package/dist/{chunk-BMDF2S7S.js.map → chunk-WYTUF3QO.js.map} +1 -1
- package/dist/{chunk-MRMD7S7E.js → chunk-XKJQQQVR.js} +9 -8
- package/dist/chunk-XKJQQQVR.js.map +1 -0
- package/dist/{chunk-SFNUHFON.js → chunk-YCV72E6L.js} +25 -19
- package/dist/chunk-YCV72E6L.js.map +1 -0
- package/dist/{chunk-VGU26WIU.cjs → chunk-YQGLVWB2.cjs} +4 -4
- package/dist/{chunk-VGU26WIU.cjs.map → chunk-YQGLVWB2.cjs.map} +1 -1
- package/dist/{ddl-BwH00BB6.d.ts → ddl-BJcPrB4L.d.ts} +3 -3
- package/dist/{ddl-D3o-RmsV.d.cts → ddl-CPZ7mB7X.d.cts} +3 -3
- package/dist/{extension-types-CwHV-Uk4.d.ts → extension-types-D1k0inWU.d.cts} +1 -1
- package/dist/{extension-types-CwHV-Uk4.d.cts → extension-types-D1k0inWU.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +5 -16
- package/dist/graph-extension/index.d.ts +5 -16
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +3822 -0
- package/dist/graph-merge/index.cjs.map +1 -0
- package/dist/graph-merge/index.d.cts +1191 -0
- package/dist/graph-merge/index.d.ts +1191 -0
- package/dist/graph-merge/index.js +3791 -0
- package/dist/graph-merge/index.js.map +1 -0
- package/dist/{index-CapHwi1a.d.ts → index-BEK0VtNB.d.ts} +11 -3
- package/dist/{index-jPPexxM5.d.cts → index-C8sSTErx.d.cts} +11 -3
- package/dist/index.cjs +365 -15732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +27 -15533
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +32 -28
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -4
- package/dist/interchange/index.cjs +50 -593
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +3 -589
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-BUugwCYz.d.ts → manager-By-WEd8M.d.ts} +3 -3
- package/dist/{manager-DpIpn1HQ.d.cts → manager-Np7VVSlE.d.cts} +3 -3
- package/dist/{materialize-indexes-lkawaDor.d.ts → materialize-indexes-CAGhqPHQ.d.ts} +1 -1
- package/dist/{materialize-indexes-oanE3RU0.d.cts → materialize-indexes-DEYkU-wr.d.cts} +1 -1
- package/dist/{postgres-CQL9UIn2.d.cts → postgres-4J2tmauh.d.cts} +1 -1
- package/dist/{postgres-CcRLaxz0.d.ts → postgres-BdIb7tS_.d.ts} +1 -1
- package/dist/profiler/index.cjs +9 -9
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/result-DWo6mUVz.d.cts +37 -0
- package/dist/result-DWo6mUVz.d.ts +37 -0
- package/dist/schema/index.cjs +33 -32
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +10 -9
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-Rj3xu4It.d.cts → sqlite-Gatk_iw_.d.cts} +1 -1
- package/dist/{sqlite-CZDFUfHS.d.ts → sqlite-aM_PAz-O.d.ts} +1 -1
- package/dist/{store-B43FpOVX.d.cts → store-DuCbdqsh.d.cts} +84 -44
- package/dist/{store-De0Y33wP.d.ts → store-MloRPwb9.d.ts} +84 -44
- package/dist/{types-DXCSyxac.d.cts → types-BKQljXom.d.ts} +18 -2
- package/dist/{types-CmAT-Z47.d.ts → types-C1CYxWrL.d.cts} +18 -2
- package/dist/{types-Bwlp_yvu.d.cts → types-DoByHGyU.d.cts} +2 -2
- package/dist/{types-B5GSeE3t.d.ts → types-K3vpaJAL.d.ts} +2 -2
- package/dist/{where-CP4qGIHd.d.ts → where-Dt49bvo6.d.ts} +2 -2
- package/dist/{where-2dsyYt3d.d.cts → where-DydZjGOb.d.cts} +2 -2
- package/package.json +6 -1
- package/dist/chunk-3DTLDGIM.js.map +0 -1
- package/dist/chunk-7KLVFWXR.js.map +0 -1
- package/dist/chunk-7V335GHG.cjs.map +0 -1
- package/dist/chunk-A4H6QMV4.js.map +0 -1
- package/dist/chunk-C2RWFIYP.cjs.map +0 -1
- package/dist/chunk-F2Q76CQ4.cjs.map +0 -1
- package/dist/chunk-G6P3OVDY.cjs.map +0 -1
- package/dist/chunk-HKN622O4.js.map +0 -1
- package/dist/chunk-HM6XMR3E.cjs.map +0 -1
- package/dist/chunk-IE2TPFBT.js.map +0 -1
- package/dist/chunk-KGAJ5HFO.cjs.map +0 -1
- package/dist/chunk-MB363HT5.js.map +0 -1
- package/dist/chunk-MRMD7S7E.js.map +0 -1
- package/dist/chunk-NZ5PMBTG.js.map +0 -1
- package/dist/chunk-OGUH56BB.js.map +0 -1
- package/dist/chunk-Q3ZZLU3O.cjs +0 -12
- package/dist/chunk-RU5BBUU2.cjs.map +0 -1
- package/dist/chunk-SFNUHFON.js.map +0 -1
- package/dist/chunk-UP4QAJND.cjs.map +0 -1
- package/dist/chunk-UPBXUOW7.cjs.map +0 -1
- package/dist/chunk-XTQHSOIC.cjs.map +0 -1
- package/dist/chunk-Y52UNT66.js.map +0 -1
- package/dist/chunk-ZYQEXGYC.cjs.map +0 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsonPointer, parseJsonPointer } from './chunk-K5P5OZXS.js';
|
|
2
2
|
import { sql } from 'drizzle-orm';
|
|
3
|
-
import { CasingCache } from 'drizzle-orm/casing';
|
|
4
|
-
import { uniqueIndex, index } from 'drizzle-orm/pg-core';
|
|
5
|
-
import { uniqueIndex as uniqueIndex$1, index as index$1 } from 'drizzle-orm/sqlite-core';
|
|
6
3
|
|
|
7
4
|
function sqlNull(value) {
|
|
8
5
|
return value ?? sql.raw("NULL");
|
|
@@ -382,6 +379,97 @@ var fts5Strategy = {
|
|
|
382
379
|
return stmt === void 0 ? [] : [stmt];
|
|
383
380
|
}
|
|
384
381
|
};
|
|
382
|
+
var VECTOR_CONTRIBUTION_PREFIX = "vector";
|
|
383
|
+
function buildVectorCapabilities(strategy) {
|
|
384
|
+
return strategy.capabilities;
|
|
385
|
+
}
|
|
386
|
+
function vectorScoreExpression(distanceExpression, metric) {
|
|
387
|
+
switch (metric) {
|
|
388
|
+
case "cosine": {
|
|
389
|
+
return sql`(1 - (${distanceExpression}))`;
|
|
390
|
+
}
|
|
391
|
+
case "l2":
|
|
392
|
+
case "inner_product": {
|
|
393
|
+
return distanceExpression;
|
|
394
|
+
}
|
|
395
|
+
default: {
|
|
396
|
+
const _exhaustive = metric;
|
|
397
|
+
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function vectorMinScoreCondition(distanceExpression, metric, minScore) {
|
|
402
|
+
assertVectorMinScore(minScore, metric);
|
|
403
|
+
switch (metric) {
|
|
404
|
+
case "cosine": {
|
|
405
|
+
return sql`${distanceExpression} <= ${1 - minScore}`;
|
|
406
|
+
}
|
|
407
|
+
case "l2": {
|
|
408
|
+
return sql`${distanceExpression} <= ${minScore}`;
|
|
409
|
+
}
|
|
410
|
+
case "inner_product": {
|
|
411
|
+
return sql`${distanceExpression} <= ${-minScore}`;
|
|
412
|
+
}
|
|
413
|
+
default: {
|
|
414
|
+
const _exhaustive = metric;
|
|
415
|
+
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function assertFiniteEmbedding(embedding, name) {
|
|
420
|
+
for (const [index, value] of embedding.entries()) {
|
|
421
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
422
|
+
throw new TypeError(
|
|
423
|
+
`${name}[${index}] must be a finite number, got: ${value}`
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function assertVectorSearchLimit(limit) {
|
|
429
|
+
if (!Number.isInteger(limit) || limit <= 0) {
|
|
430
|
+
throw new RangeError(
|
|
431
|
+
`vectorSearch limit must be a positive integer, got: ${limit}`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function assertVectorMinScore(minScore, metric, label = "minScore") {
|
|
436
|
+
if (!Number.isFinite(minScore)) {
|
|
437
|
+
throw new RangeError(`${label} must be a finite number, got: ${minScore}`);
|
|
438
|
+
}
|
|
439
|
+
if (metric === "cosine" && (minScore < -1 || minScore > 1)) {
|
|
440
|
+
throw new RangeError(
|
|
441
|
+
`${label} for the cosine metric must be between -1 and 1, got: ${minScore}`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
var MAX_VECTOR_IDENTIFIER_LENGTH = 63;
|
|
446
|
+
function sanitizeIdentifierPart(value) {
|
|
447
|
+
return value.toLowerCase().replaceAll(/[^a-z0-9_]/g, "_");
|
|
448
|
+
}
|
|
449
|
+
function shortHash(input) {
|
|
450
|
+
let h1 = 3735928559;
|
|
451
|
+
let h2 = 1103547991;
|
|
452
|
+
for (let index = 0; index < input.length; index++) {
|
|
453
|
+
const ch = input.codePointAt(index);
|
|
454
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
455
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
456
|
+
}
|
|
457
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
458
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
459
|
+
const hi = (h2 >>> 0).toString(16).padStart(8, "0");
|
|
460
|
+
const lo = (h1 >>> 0).toString(16).padStart(8, "0");
|
|
461
|
+
return `${hi}${lo}`.slice(0, 8);
|
|
462
|
+
}
|
|
463
|
+
function vectorPhysicalName(prefix, graphId, nodeKind, fieldPath) {
|
|
464
|
+
const readable = `${prefix}_${sanitizeIdentifierPart(graphId)}_${sanitizeIdentifierPart(nodeKind)}_${sanitizeIdentifierPart(fieldPath)}`;
|
|
465
|
+
const hash = shortHash(JSON.stringify([graphId, nodeKind, fieldPath]));
|
|
466
|
+
const full = `${readable}_${hash}`;
|
|
467
|
+
if (full.length <= MAX_VECTOR_IDENTIFIER_LENGTH) return full;
|
|
468
|
+
return `${readable.slice(0, MAX_VECTOR_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;
|
|
469
|
+
}
|
|
470
|
+
function quoteIdentifier2(name) {
|
|
471
|
+
return `"${name.replaceAll('"', '""')}"`;
|
|
472
|
+
}
|
|
385
473
|
function escapePostgresLiteral(value) {
|
|
386
474
|
return `'${value.replaceAll("'", "''")}'`;
|
|
387
475
|
}
|
|
@@ -477,6 +565,12 @@ var postgresDialect = {
|
|
|
477
565
|
return sql`(${column} #> ${path} IS NOT NULL AND ${column} #>> ${path} != 'null')`;
|
|
478
566
|
},
|
|
479
567
|
// ============================================================
|
|
568
|
+
// Comparison Operations
|
|
569
|
+
// ============================================================
|
|
570
|
+
nullSafeEquals(left, right) {
|
|
571
|
+
return sql`${left} IS NOT DISTINCT FROM ${right}`;
|
|
572
|
+
},
|
|
573
|
+
// ============================================================
|
|
480
574
|
// String Operations
|
|
481
575
|
// ============================================================
|
|
482
576
|
ilike(column, pattern) {
|
|
@@ -636,6 +730,12 @@ var sqliteDialect = {
|
|
|
636
730
|
return sql`(json_extract(${column}, ${pathSql}) IS NOT NULL AND json_type(${column}, ${pathSql}) != 'null')`;
|
|
637
731
|
},
|
|
638
732
|
// ============================================================
|
|
733
|
+
// Comparison Operations
|
|
734
|
+
// ============================================================
|
|
735
|
+
nullSafeEquals(left, right) {
|
|
736
|
+
return sql`${left} IS ${right}`;
|
|
737
|
+
},
|
|
738
|
+
// ============================================================
|
|
639
739
|
// String Operations
|
|
640
740
|
// ============================================================
|
|
641
741
|
ilike(column, pattern) {
|
|
@@ -694,97 +794,6 @@ var sqliteDialect = {
|
|
|
694
794
|
// ============================================================
|
|
695
795
|
fulltext: fts5Strategy
|
|
696
796
|
};
|
|
697
|
-
var VECTOR_CONTRIBUTION_PREFIX = "vector";
|
|
698
|
-
function buildVectorCapabilities(strategy) {
|
|
699
|
-
return strategy.capabilities;
|
|
700
|
-
}
|
|
701
|
-
function vectorScoreExpression(distanceExpression, metric) {
|
|
702
|
-
switch (metric) {
|
|
703
|
-
case "cosine": {
|
|
704
|
-
return sql`(1 - (${distanceExpression}))`;
|
|
705
|
-
}
|
|
706
|
-
case "l2":
|
|
707
|
-
case "inner_product": {
|
|
708
|
-
return distanceExpression;
|
|
709
|
-
}
|
|
710
|
-
default: {
|
|
711
|
-
const _exhaustive = metric;
|
|
712
|
-
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
function vectorMinScoreCondition(distanceExpression, metric, minScore) {
|
|
717
|
-
assertVectorMinScore(minScore, metric);
|
|
718
|
-
switch (metric) {
|
|
719
|
-
case "cosine": {
|
|
720
|
-
return sql`${distanceExpression} <= ${1 - minScore}`;
|
|
721
|
-
}
|
|
722
|
-
case "l2": {
|
|
723
|
-
return sql`${distanceExpression} <= ${minScore}`;
|
|
724
|
-
}
|
|
725
|
-
case "inner_product": {
|
|
726
|
-
return sql`${distanceExpression} <= ${-minScore}`;
|
|
727
|
-
}
|
|
728
|
-
default: {
|
|
729
|
-
const _exhaustive = metric;
|
|
730
|
-
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
function assertFiniteEmbedding(embedding, name) {
|
|
735
|
-
for (const [index, value] of embedding.entries()) {
|
|
736
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
737
|
-
throw new TypeError(
|
|
738
|
-
`${name}[${index}] must be a finite number, got: ${value}`
|
|
739
|
-
);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
function assertVectorSearchLimit(limit) {
|
|
744
|
-
if (!Number.isInteger(limit) || limit <= 0) {
|
|
745
|
-
throw new RangeError(
|
|
746
|
-
`vectorSearch limit must be a positive integer, got: ${limit}`
|
|
747
|
-
);
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
function assertVectorMinScore(minScore, metric, label = "minScore") {
|
|
751
|
-
if (!Number.isFinite(minScore)) {
|
|
752
|
-
throw new RangeError(`${label} must be a finite number, got: ${minScore}`);
|
|
753
|
-
}
|
|
754
|
-
if (metric === "cosine" && (minScore < -1 || minScore > 1)) {
|
|
755
|
-
throw new RangeError(
|
|
756
|
-
`${label} for the cosine metric must be between -1 and 1, got: ${minScore}`
|
|
757
|
-
);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
var MAX_VECTOR_IDENTIFIER_LENGTH = 63;
|
|
761
|
-
function sanitizeIdentifierPart(value) {
|
|
762
|
-
return value.toLowerCase().replaceAll(/[^a-z0-9_]/g, "_");
|
|
763
|
-
}
|
|
764
|
-
function shortHash(input) {
|
|
765
|
-
let h1 = 3735928559;
|
|
766
|
-
let h2 = 1103547991;
|
|
767
|
-
for (let index = 0; index < input.length; index++) {
|
|
768
|
-
const ch = input.codePointAt(index);
|
|
769
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
770
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
771
|
-
}
|
|
772
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
773
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
774
|
-
const hi = (h2 >>> 0).toString(16).padStart(8, "0");
|
|
775
|
-
const lo = (h1 >>> 0).toString(16).padStart(8, "0");
|
|
776
|
-
return `${hi}${lo}`.slice(0, 8);
|
|
777
|
-
}
|
|
778
|
-
function vectorPhysicalName(prefix, graphId, nodeKind, fieldPath) {
|
|
779
|
-
const readable = `${prefix}_${sanitizeIdentifierPart(graphId)}_${sanitizeIdentifierPart(nodeKind)}_${sanitizeIdentifierPart(fieldPath)}`;
|
|
780
|
-
const hash = shortHash(JSON.stringify([graphId, nodeKind, fieldPath]));
|
|
781
|
-
const full = `${readable}_${hash}`;
|
|
782
|
-
if (full.length <= MAX_VECTOR_IDENTIFIER_LENGTH) return full;
|
|
783
|
-
return `${readable.slice(0, MAX_VECTOR_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;
|
|
784
|
-
}
|
|
785
|
-
function quoteIdentifier2(name) {
|
|
786
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
787
|
-
}
|
|
788
797
|
|
|
789
798
|
// src/query/dialect/index.ts
|
|
790
799
|
var DIALECT_ADAPTERS = {
|
|
@@ -840,6 +849,20 @@ function compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn) {
|
|
|
840
849
|
}
|
|
841
850
|
return { keys };
|
|
842
851
|
}
|
|
852
|
+
function compileNodeIndexFieldKeys(index, ctx) {
|
|
853
|
+
const adapter = getDialect(ctx.dialect);
|
|
854
|
+
const keys = [];
|
|
855
|
+
for (const [position, pointer] of index.fields.entries()) {
|
|
856
|
+
const extracted = compileIndexKeyValue(
|
|
857
|
+
adapter,
|
|
858
|
+
ctx.propsColumn,
|
|
859
|
+
pointer,
|
|
860
|
+
index.fieldValueTypes[position]
|
|
861
|
+
);
|
|
862
|
+
keys.push(sql`(${extracted})`);
|
|
863
|
+
}
|
|
864
|
+
return keys;
|
|
865
|
+
}
|
|
843
866
|
function compileIndexKeyValue(dialect, propsColumn, pointer, valueType) {
|
|
844
867
|
switch (valueType) {
|
|
845
868
|
case "number": {
|
|
@@ -1010,405 +1033,6 @@ function escapeStringLiteral(value) {
|
|
|
1010
1033
|
return `'${value.replaceAll("'", "''")}'`;
|
|
1011
1034
|
}
|
|
1012
1035
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
return generateNodeIndexDDL(index, dialect, options);
|
|
1017
|
-
}
|
|
1018
|
-
return generateEdgeIndexDDL(index, dialect, options);
|
|
1019
|
-
}
|
|
1020
|
-
function generateNodeIndexDDL(index, dialect, options = {}) {
|
|
1021
|
-
const tableName = options.nodesTableName ?? "typegraph_nodes";
|
|
1022
|
-
return generateTableIndexDDL(index, dialect, tableName, options);
|
|
1023
|
-
}
|
|
1024
|
-
function generateEdgeIndexDDL(index, dialect, options = {}) {
|
|
1025
|
-
const tableName = options.edgesTableName ?? "typegraph_edges";
|
|
1026
|
-
return generateTableIndexDDL(index, dialect, tableName, options);
|
|
1027
|
-
}
|
|
1028
|
-
function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
1029
|
-
const ifNotExists = options.ifNotExists ?? true;
|
|
1030
|
-
const propsColumn = sql.raw('"props"');
|
|
1031
|
-
const systemColumn = (column) => sql.raw(quoteIdentifier3(column));
|
|
1032
|
-
const keys = index.entity === "node" ? compileNodeIndexKeys(index, dialect, propsColumn, systemColumn).keys : compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn).keys;
|
|
1033
|
-
const whereSql = index.where ? sqlToInlineString(
|
|
1034
|
-
compileIndexWhere(
|
|
1035
|
-
{
|
|
1036
|
-
dialect,
|
|
1037
|
-
propsColumn,
|
|
1038
|
-
systemColumn
|
|
1039
|
-
},
|
|
1040
|
-
index.where
|
|
1041
|
-
),
|
|
1042
|
-
dialect
|
|
1043
|
-
) : void 0;
|
|
1044
|
-
const keySql = keys.map((k) => sqlToInlineString(k, dialect)).join(", ");
|
|
1045
|
-
const unique = index.unique ? "UNIQUE " : "";
|
|
1046
|
-
const concurrent = options.concurrent === true && dialect === "postgres" ? "CONCURRENTLY " : "";
|
|
1047
|
-
const ifNotExistsSql = ifNotExists ? "IF NOT EXISTS " : "";
|
|
1048
|
-
const whereClause = whereSql ? ` WHERE ${whereSql}` : "";
|
|
1049
|
-
return `CREATE ${unique}INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier3(index.name)} ON ${quoteIdentifier3(tableName)} (${keySql})${whereClause};`;
|
|
1050
|
-
}
|
|
1051
|
-
function quoteIdentifier3(identifier) {
|
|
1052
|
-
return `"${identifier.replaceAll('"', '""')}"`;
|
|
1053
|
-
}
|
|
1054
|
-
function sqlToInlineString(object, dialect) {
|
|
1055
|
-
const query = object.toQuery({
|
|
1056
|
-
casing: new CasingCache(),
|
|
1057
|
-
escapeName: (name) => name,
|
|
1058
|
-
escapeParam: (_number, value) => inlineParam(value, dialect),
|
|
1059
|
-
escapeString: (value) => escapeStringLiteral2(value),
|
|
1060
|
-
inlineParams: true,
|
|
1061
|
-
invokeSource: "indexes"
|
|
1062
|
-
});
|
|
1063
|
-
if (query.params.length > 0) {
|
|
1064
|
-
throw new Error(
|
|
1065
|
-
"Index DDL generation produced parameters; expected fully inlined SQL"
|
|
1066
|
-
);
|
|
1067
|
-
}
|
|
1068
|
-
return query.sql;
|
|
1069
|
-
}
|
|
1070
|
-
function inlineParam(value, dialect) {
|
|
1071
|
-
if (value === null || value === void 0) {
|
|
1072
|
-
return "NULL";
|
|
1073
|
-
}
|
|
1074
|
-
if (value instanceof Date) {
|
|
1075
|
-
return escapeStringLiteral2(value.toISOString());
|
|
1076
|
-
}
|
|
1077
|
-
if (typeof value === "string") {
|
|
1078
|
-
return escapeStringLiteral2(value);
|
|
1079
|
-
}
|
|
1080
|
-
if (typeof value === "number") {
|
|
1081
|
-
return value.toString();
|
|
1082
|
-
}
|
|
1083
|
-
if (typeof value === "boolean") {
|
|
1084
|
-
return getDialect(dialect).booleanLiteralString(value);
|
|
1085
|
-
}
|
|
1086
|
-
if (typeof value === "bigint") {
|
|
1087
|
-
return value.toString();
|
|
1088
|
-
}
|
|
1089
|
-
throw new TypeError(
|
|
1090
|
-
"Index DDL generation received an unsupported SQL parameter value"
|
|
1091
|
-
);
|
|
1092
|
-
}
|
|
1093
|
-
function escapeStringLiteral2(value) {
|
|
1094
|
-
return `'${value.replaceAll("'", "''")}'`;
|
|
1095
|
-
}
|
|
1096
|
-
function buildPostgresNodeIndexBuilders(table, indexes) {
|
|
1097
|
-
const nodeIndexes = indexes.filter(
|
|
1098
|
-
(index) => index.entity === "node"
|
|
1099
|
-
);
|
|
1100
|
-
return nodeIndexes.map((index$1) => {
|
|
1101
|
-
const propsColumn = sql`${table.props}`;
|
|
1102
|
-
const systemColumn = (column) => sql`${getPostgresNodeSystemColumn(table, column)}`;
|
|
1103
|
-
const { keys } = compileNodeIndexKeys(
|
|
1104
|
-
index$1,
|
|
1105
|
-
"postgres",
|
|
1106
|
-
propsColumn,
|
|
1107
|
-
systemColumn
|
|
1108
|
-
);
|
|
1109
|
-
assertNonEmpty(keys, `node index "${index$1.name}"`);
|
|
1110
|
-
const base = index$1.unique ? uniqueIndex(index$1.name) : index(index$1.name);
|
|
1111
|
-
const builder = base.on(...keys);
|
|
1112
|
-
if (index$1.where) {
|
|
1113
|
-
const ctx = {
|
|
1114
|
-
dialect: "postgres",
|
|
1115
|
-
propsColumn,
|
|
1116
|
-
systemColumn
|
|
1117
|
-
};
|
|
1118
|
-
builder.where(compileIndexWhere(ctx, index$1.where));
|
|
1119
|
-
}
|
|
1120
|
-
return builder;
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
function buildPostgresEdgeIndexBuilders(table, indexes) {
|
|
1124
|
-
const edgeIndexes = indexes.filter(
|
|
1125
|
-
(index) => index.entity === "edge"
|
|
1126
|
-
);
|
|
1127
|
-
return edgeIndexes.map((index$1) => {
|
|
1128
|
-
const propsColumn = sql`${table.props}`;
|
|
1129
|
-
const systemColumn = (column) => sql`${getPostgresEdgeSystemColumn(table, column)}`;
|
|
1130
|
-
const { keys } = compileEdgeIndexKeys(
|
|
1131
|
-
index$1,
|
|
1132
|
-
"postgres",
|
|
1133
|
-
propsColumn,
|
|
1134
|
-
systemColumn
|
|
1135
|
-
);
|
|
1136
|
-
assertNonEmpty(keys, `edge index "${index$1.name}"`);
|
|
1137
|
-
const base = index$1.unique ? uniqueIndex(index$1.name) : index(index$1.name);
|
|
1138
|
-
const builder = base.on(...keys);
|
|
1139
|
-
if (index$1.where) {
|
|
1140
|
-
const ctx = {
|
|
1141
|
-
dialect: "postgres",
|
|
1142
|
-
propsColumn,
|
|
1143
|
-
systemColumn
|
|
1144
|
-
};
|
|
1145
|
-
builder.where(compileIndexWhere(ctx, index$1.where));
|
|
1146
|
-
}
|
|
1147
|
-
return builder;
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
function getPostgresNodeSystemColumn(table, column) {
|
|
1151
|
-
switch (column) {
|
|
1152
|
-
case "graph_id": {
|
|
1153
|
-
return table.graphId;
|
|
1154
|
-
}
|
|
1155
|
-
case "kind": {
|
|
1156
|
-
return table.kind;
|
|
1157
|
-
}
|
|
1158
|
-
case "id": {
|
|
1159
|
-
return table.id;
|
|
1160
|
-
}
|
|
1161
|
-
case "from_kind":
|
|
1162
|
-
case "from_id":
|
|
1163
|
-
case "to_kind":
|
|
1164
|
-
case "to_id": {
|
|
1165
|
-
throw new Error(`Unsupported node system column for indexes: ${column}`);
|
|
1166
|
-
}
|
|
1167
|
-
case "deleted_at": {
|
|
1168
|
-
return table.deletedAt;
|
|
1169
|
-
}
|
|
1170
|
-
case "valid_from": {
|
|
1171
|
-
return table.validFrom;
|
|
1172
|
-
}
|
|
1173
|
-
case "valid_to": {
|
|
1174
|
-
return table.validTo;
|
|
1175
|
-
}
|
|
1176
|
-
case "created_at": {
|
|
1177
|
-
return table.createdAt;
|
|
1178
|
-
}
|
|
1179
|
-
case "updated_at": {
|
|
1180
|
-
return table.updatedAt;
|
|
1181
|
-
}
|
|
1182
|
-
case "version": {
|
|
1183
|
-
return table.version;
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
function getPostgresEdgeSystemColumn(table, column) {
|
|
1188
|
-
switch (column) {
|
|
1189
|
-
case "graph_id": {
|
|
1190
|
-
return table.graphId;
|
|
1191
|
-
}
|
|
1192
|
-
case "kind": {
|
|
1193
|
-
return table.kind;
|
|
1194
|
-
}
|
|
1195
|
-
case "id": {
|
|
1196
|
-
return table.id;
|
|
1197
|
-
}
|
|
1198
|
-
case "from_kind": {
|
|
1199
|
-
return table.fromKind;
|
|
1200
|
-
}
|
|
1201
|
-
case "from_id": {
|
|
1202
|
-
return table.fromId;
|
|
1203
|
-
}
|
|
1204
|
-
case "to_kind": {
|
|
1205
|
-
return table.toKind;
|
|
1206
|
-
}
|
|
1207
|
-
case "to_id": {
|
|
1208
|
-
return table.toId;
|
|
1209
|
-
}
|
|
1210
|
-
case "deleted_at": {
|
|
1211
|
-
return table.deletedAt;
|
|
1212
|
-
}
|
|
1213
|
-
case "valid_from": {
|
|
1214
|
-
return table.validFrom;
|
|
1215
|
-
}
|
|
1216
|
-
case "valid_to": {
|
|
1217
|
-
return table.validTo;
|
|
1218
|
-
}
|
|
1219
|
-
case "created_at": {
|
|
1220
|
-
return table.createdAt;
|
|
1221
|
-
}
|
|
1222
|
-
case "updated_at": {
|
|
1223
|
-
return table.updatedAt;
|
|
1224
|
-
}
|
|
1225
|
-
case "version": {
|
|
1226
|
-
throw new Error(`Unsupported edge system column for indexes: ${column}`);
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
function buildSqliteNodeIndexBuilders(table, indexes) {
|
|
1231
|
-
const nodeIndexes = indexes.filter(
|
|
1232
|
-
(index) => index.entity === "node"
|
|
1233
|
-
);
|
|
1234
|
-
return nodeIndexes.map((index) => {
|
|
1235
|
-
const propsColumn = sql`${table.props}`;
|
|
1236
|
-
const systemColumn = (column) => sql`${getSqliteNodeSystemColumn(table, column)}`;
|
|
1237
|
-
const { keys } = compileNodeIndexKeys(
|
|
1238
|
-
index,
|
|
1239
|
-
"sqlite",
|
|
1240
|
-
propsColumn,
|
|
1241
|
-
systemColumn
|
|
1242
|
-
);
|
|
1243
|
-
assertNonEmpty(keys, `node index "${index.name}"`);
|
|
1244
|
-
const base = index.unique ? uniqueIndex$1(index.name) : index$1(index.name);
|
|
1245
|
-
const builder = base.on(...keys);
|
|
1246
|
-
if (index.where) {
|
|
1247
|
-
const ctx = {
|
|
1248
|
-
dialect: "sqlite",
|
|
1249
|
-
propsColumn,
|
|
1250
|
-
systemColumn
|
|
1251
|
-
};
|
|
1252
|
-
builder.where(compileIndexWhere(ctx, index.where));
|
|
1253
|
-
}
|
|
1254
|
-
return builder;
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
function buildSqliteEdgeIndexBuilders(table, indexes) {
|
|
1258
|
-
const edgeIndexes = indexes.filter(
|
|
1259
|
-
(index) => index.entity === "edge"
|
|
1260
|
-
);
|
|
1261
|
-
return edgeIndexes.map((index) => {
|
|
1262
|
-
const propsColumn = sql`${table.props}`;
|
|
1263
|
-
const systemColumn = (column) => sql`${getSqliteEdgeSystemColumn(table, column)}`;
|
|
1264
|
-
const { keys } = compileEdgeIndexKeys(
|
|
1265
|
-
index,
|
|
1266
|
-
"sqlite",
|
|
1267
|
-
propsColumn,
|
|
1268
|
-
systemColumn
|
|
1269
|
-
);
|
|
1270
|
-
assertNonEmpty(keys, `edge index "${index.name}"`);
|
|
1271
|
-
const base = index.unique ? uniqueIndex$1(index.name) : index$1(index.name);
|
|
1272
|
-
const builder = base.on(...keys);
|
|
1273
|
-
if (index.where) {
|
|
1274
|
-
const ctx = {
|
|
1275
|
-
dialect: "sqlite",
|
|
1276
|
-
propsColumn,
|
|
1277
|
-
systemColumn
|
|
1278
|
-
};
|
|
1279
|
-
builder.where(compileIndexWhere(ctx, index.where));
|
|
1280
|
-
}
|
|
1281
|
-
return builder;
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
function getSqliteNodeSystemColumn(table, column) {
|
|
1285
|
-
switch (column) {
|
|
1286
|
-
case "graph_id": {
|
|
1287
|
-
return table.graphId;
|
|
1288
|
-
}
|
|
1289
|
-
case "kind": {
|
|
1290
|
-
return table.kind;
|
|
1291
|
-
}
|
|
1292
|
-
case "id": {
|
|
1293
|
-
return table.id;
|
|
1294
|
-
}
|
|
1295
|
-
case "from_kind":
|
|
1296
|
-
case "from_id":
|
|
1297
|
-
case "to_kind":
|
|
1298
|
-
case "to_id": {
|
|
1299
|
-
throw new Error(`Unsupported node system column for indexes: ${column}`);
|
|
1300
|
-
}
|
|
1301
|
-
case "deleted_at": {
|
|
1302
|
-
return table.deletedAt;
|
|
1303
|
-
}
|
|
1304
|
-
case "valid_from": {
|
|
1305
|
-
return table.validFrom;
|
|
1306
|
-
}
|
|
1307
|
-
case "valid_to": {
|
|
1308
|
-
return table.validTo;
|
|
1309
|
-
}
|
|
1310
|
-
case "created_at": {
|
|
1311
|
-
return table.createdAt;
|
|
1312
|
-
}
|
|
1313
|
-
case "updated_at": {
|
|
1314
|
-
return table.updatedAt;
|
|
1315
|
-
}
|
|
1316
|
-
case "version": {
|
|
1317
|
-
return table.version;
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
function getSqliteEdgeSystemColumn(table, column) {
|
|
1322
|
-
switch (column) {
|
|
1323
|
-
case "graph_id": {
|
|
1324
|
-
return table.graphId;
|
|
1325
|
-
}
|
|
1326
|
-
case "kind": {
|
|
1327
|
-
return table.kind;
|
|
1328
|
-
}
|
|
1329
|
-
case "id": {
|
|
1330
|
-
return table.id;
|
|
1331
|
-
}
|
|
1332
|
-
case "from_kind": {
|
|
1333
|
-
return table.fromKind;
|
|
1334
|
-
}
|
|
1335
|
-
case "from_id": {
|
|
1336
|
-
return table.fromId;
|
|
1337
|
-
}
|
|
1338
|
-
case "to_kind": {
|
|
1339
|
-
return table.toKind;
|
|
1340
|
-
}
|
|
1341
|
-
case "to_id": {
|
|
1342
|
-
return table.toId;
|
|
1343
|
-
}
|
|
1344
|
-
case "deleted_at": {
|
|
1345
|
-
return table.deletedAt;
|
|
1346
|
-
}
|
|
1347
|
-
case "valid_from": {
|
|
1348
|
-
return table.validFrom;
|
|
1349
|
-
}
|
|
1350
|
-
case "valid_to": {
|
|
1351
|
-
return table.validTo;
|
|
1352
|
-
}
|
|
1353
|
-
case "created_at": {
|
|
1354
|
-
return table.createdAt;
|
|
1355
|
-
}
|
|
1356
|
-
case "updated_at": {
|
|
1357
|
-
return table.updatedAt;
|
|
1358
|
-
}
|
|
1359
|
-
case "version": {
|
|
1360
|
-
throw new Error(`Unsupported edge system column for indexes: ${column}`);
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
function assertNonEmpty(values, label) {
|
|
1365
|
-
if (values.length === 0) {
|
|
1366
|
-
throw new Error(`Index must have at least one key (${label})`);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
// src/indexes/profiler.ts
|
|
1371
|
-
function toDeclaredIndex(index) {
|
|
1372
|
-
return {
|
|
1373
|
-
entityType: index.entity,
|
|
1374
|
-
kind: index.kind,
|
|
1375
|
-
fields: [...index.fields],
|
|
1376
|
-
unique: index.unique,
|
|
1377
|
-
name: index.name
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
function toDeclaredIndexes(indexes) {
|
|
1381
|
-
return indexes.filter(
|
|
1382
|
-
(index) => index.entity === "node" || index.entity === "edge"
|
|
1383
|
-
).map((index) => toDeclaredIndex(index));
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
// src/indexes/where.ts
|
|
1387
|
-
function andWhere(...predicates) {
|
|
1388
|
-
if (predicates.length === 1) {
|
|
1389
|
-
return predicates[0];
|
|
1390
|
-
}
|
|
1391
|
-
return {
|
|
1392
|
-
__type: "index_where_and",
|
|
1393
|
-
predicates
|
|
1394
|
-
};
|
|
1395
|
-
}
|
|
1396
|
-
function orWhere(...predicates) {
|
|
1397
|
-
if (predicates.length === 1) {
|
|
1398
|
-
return predicates[0];
|
|
1399
|
-
}
|
|
1400
|
-
return {
|
|
1401
|
-
__type: "index_where_or",
|
|
1402
|
-
predicates
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
function notWhere(predicate) {
|
|
1406
|
-
return {
|
|
1407
|
-
__type: "index_where_not",
|
|
1408
|
-
predicate
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
export { BASE_CONTRIBUTION_OWNER, VECTOR_CONTRIBUTION_PREFIX, andWhere, assertFiniteEmbedding, assertVectorMinScore, assertVectorSearchLimit, buildFulltextCapabilities, buildPostgresEdgeIndexBuilders, buildPostgresNodeIndexBuilders, buildSqliteEdgeIndexBuilders, buildSqliteNodeIndexBuilders, buildVectorCapabilities, edgeColumnList, fts5Strategy, generateEdgeIndexDDL, generateIndexDDL, generateNodeIndexDDL, getDialect, nodeColumnList, notWhere, orWhere, quoteIdentifier2 as quoteIdentifier, quotedColumn, quotedTableName, sqlNull, toDeclaredIndex, toDeclaredIndexes, tsvectorStrategy, vectorMinScoreCondition, vectorPhysicalName, vectorScoreExpression };
|
|
1413
|
-
//# sourceMappingURL=chunk-7KLVFWXR.js.map
|
|
1414
|
-
//# sourceMappingURL=chunk-7KLVFWXR.js.map
|
|
1036
|
+
export { BASE_CONTRIBUTION_OWNER, VECTOR_CONTRIBUTION_PREFIX, assertFiniteEmbedding, assertVectorMinScore, assertVectorSearchLimit, buildFulltextCapabilities, buildVectorCapabilities, compileEdgeIndexKeys, compileIndexWhere, compileNodeIndexFieldKeys, compileNodeIndexKeys, edgeColumnList, fts5Strategy, getDialect, nodeColumnList, quoteIdentifier2 as quoteIdentifier, quotedColumn, quotedTableName, sqlNull, tsvectorStrategy, vectorMinScoreCondition, vectorPhysicalName, vectorScoreExpression };
|
|
1037
|
+
//# sourceMappingURL=chunk-2HZGWCB4.js.map
|
|
1038
|
+
//# sourceMappingURL=chunk-2HZGWCB4.js.map
|