@nicia-ai/typegraph 0.24.1 → 0.25.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.
Files changed (159) hide show
  1. package/dist/backend/postgres/index.cjs +226 -55
  2. package/dist/backend/postgres/index.cjs.map +1 -1
  3. package/dist/backend/postgres/index.d.cts +6 -7
  4. package/dist/backend/postgres/index.d.ts +6 -7
  5. package/dist/backend/postgres/index.js +195 -28
  6. package/dist/backend/postgres/index.js.map +1 -1
  7. package/dist/backend/sqlite/index.cjs +19 -17
  8. package/dist/backend/sqlite/index.d.cts +6 -7
  9. package/dist/backend/sqlite/index.d.ts +6 -7
  10. package/dist/backend/sqlite/index.js +9 -7
  11. package/dist/backend/sqlite/libsql.cjs +12 -10
  12. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  13. package/dist/backend/sqlite/libsql.d.cts +4 -5
  14. package/dist/backend/sqlite/libsql.d.ts +4 -5
  15. package/dist/backend/sqlite/libsql.js +9 -7
  16. package/dist/backend/sqlite/libsql.js.map +1 -1
  17. package/dist/backend/sqlite/local.cjs +14 -12
  18. package/dist/backend/sqlite/local.cjs.map +1 -1
  19. package/dist/backend/sqlite/local.d.cts +4 -5
  20. package/dist/backend/sqlite/local.d.ts +4 -5
  21. package/dist/backend/sqlite/local.js +9 -7
  22. package/dist/backend/sqlite/local.js.map +1 -1
  23. package/dist/chunk-4BOWVUGQ.js +2029 -0
  24. package/dist/chunk-4BOWVUGQ.js.map +1 -0
  25. package/dist/chunk-7V335GHG.cjs +112 -0
  26. package/dist/chunk-7V335GHG.cjs.map +1 -0
  27. package/dist/chunk-AAA2CR3P.js +2628 -0
  28. package/dist/chunk-AAA2CR3P.js.map +1 -0
  29. package/dist/{chunk-QOLTW7OZ.js → chunk-CLEUFN2K.js} +195 -13
  30. package/dist/chunk-CLEUFN2K.js.map +1 -0
  31. package/dist/{chunk-OVJ2BE5Q.cjs → chunk-CLGC7AQ2.cjs} +215 -33
  32. package/dist/chunk-CLGC7AQ2.cjs.map +1 -0
  33. package/dist/{chunk-GUTQTMOV.js → chunk-CPFR3O7L.js} +2 -2
  34. package/dist/chunk-CPFR3O7L.js.map +1 -0
  35. package/dist/{chunk-5HVDOPZU.cjs → chunk-CQVNGKU7.cjs} +452 -104
  36. package/dist/chunk-CQVNGKU7.cjs.map +1 -0
  37. package/dist/chunk-CTHNVU6K.cjs +551 -0
  38. package/dist/chunk-CTHNVU6K.cjs.map +1 -0
  39. package/dist/chunk-D2GO3RBL.cjs +12 -0
  40. package/dist/chunk-D2GO3RBL.cjs.map +1 -0
  41. package/dist/{chunk-WFMTAEEN.js → chunk-DOTEN2FG.js} +81 -7
  42. package/dist/chunk-DOTEN2FG.js.map +1 -0
  43. package/dist/chunk-E5JZSEGJ.cjs +301 -0
  44. package/dist/chunk-E5JZSEGJ.cjs.map +1 -0
  45. package/dist/chunk-EG6TJ3I5.js +286 -0
  46. package/dist/chunk-EG6TJ3I5.js.map +1 -0
  47. package/dist/chunk-EJCDOA37.js +537 -0
  48. package/dist/chunk-EJCDOA37.js.map +1 -0
  49. package/dist/{chunk-UVZHTBZ5.cjs → chunk-EK6RJ373.cjs} +7 -150
  50. package/dist/chunk-EK6RJ373.cjs.map +1 -0
  51. package/dist/{chunk-3JK66E3I.cjs → chunk-JTI5WT4P.cjs} +630 -59
  52. package/dist/chunk-JTI5WT4P.cjs.map +1 -0
  53. package/dist/chunk-NHQWXSTS.js +10 -0
  54. package/dist/chunk-NHQWXSTS.js.map +1 -0
  55. package/dist/chunk-NZ5PMBTG.js +105 -0
  56. package/dist/chunk-NZ5PMBTG.js.map +1 -0
  57. package/dist/{chunk-SUHW2UYL.cjs → chunk-OECDVACY.cjs} +2 -2
  58. package/dist/chunk-OECDVACY.cjs.map +1 -0
  59. package/dist/{chunk-EYELZHKY.js → chunk-OOS2RKRH.js} +5 -140
  60. package/dist/chunk-OOS2RKRH.js.map +1 -0
  61. package/dist/{chunk-EY4LBX3F.js → chunk-PSKUWVCB.js} +373 -38
  62. package/dist/chunk-PSKUWVCB.js.map +1 -0
  63. package/dist/chunk-QMQYK3IF.cjs +2680 -0
  64. package/dist/chunk-QMQYK3IF.cjs.map +1 -0
  65. package/dist/chunk-RCAJZG67.cjs +2069 -0
  66. package/dist/chunk-RCAJZG67.cjs.map +1 -0
  67. package/dist/{chunk-O5PST6TB.cjs → chunk-W5MTHMTE.cjs} +83 -6
  68. package/dist/chunk-W5MTHMTE.cjs.map +1 -0
  69. package/dist/chunk-WVQXAFP3.js +79 -0
  70. package/dist/chunk-WVQXAFP3.js.map +1 -0
  71. package/dist/chunk-X3244EKP.cjs +84 -0
  72. package/dist/chunk-X3244EKP.cjs.map +1 -0
  73. package/dist/{chunk-753F33CV.js → chunk-YZZBDCLV.js} +617 -44
  74. package/dist/chunk-YZZBDCLV.js.map +1 -0
  75. package/dist/{ddl-B_H8JM-E.d.cts → ddl-BqMmpNor.d.ts} +1328 -283
  76. package/dist/{ddl-1tFIvt9V.d.ts → ddl-Bwjh8Hff.d.cts} +1328 -283
  77. package/dist/extension-types-D07e_NTw.d.cts +543 -0
  78. package/dist/extension-types-D07e_NTw.d.ts +543 -0
  79. package/dist/graph-extension/index.cjs +71 -0
  80. package/dist/graph-extension/index.cjs.map +1 -0
  81. package/dist/graph-extension/index.d.cts +278 -0
  82. package/dist/graph-extension/index.d.ts +278 -0
  83. package/dist/graph-extension/index.js +6 -0
  84. package/dist/graph-extension/index.js.map +1 -0
  85. package/dist/{index-DXkEXpNz.d.ts → index-CT6nvtxL.d.cts} +114 -5
  86. package/dist/{index-DXkEXpNz.d.cts → index-DQheiVQV.d.ts} +114 -5
  87. package/dist/index.cjs +2672 -901
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +29 -10
  90. package/dist/index.d.ts +29 -10
  91. package/dist/index.js +2248 -598
  92. package/dist/index.js.map +1 -1
  93. package/dist/indexes/index.cjs +25 -23
  94. package/dist/indexes/index.d.cts +40 -22
  95. package/dist/indexes/index.d.ts +40 -22
  96. package/dist/indexes/index.js +5 -3
  97. package/dist/interchange/index.cjs +8 -7
  98. package/dist/interchange/index.cjs.map +1 -1
  99. package/dist/interchange/index.d.cts +5 -4
  100. package/dist/interchange/index.d.ts +5 -4
  101. package/dist/interchange/index.js +3 -2
  102. package/dist/interchange/index.js.map +1 -1
  103. package/dist/{manager-Vkz28eAC.d.cts → manager-Cy3dhwYO.d.cts} +194 -6
  104. package/dist/{manager-nIhmttD-.d.ts → manager-sZkU2VPC.d.ts} +194 -6
  105. package/dist/materialize-indexes-BB9N5uQl.d.cts +68 -0
  106. package/dist/materialize-indexes-BYpU2RKh.d.ts +68 -0
  107. package/dist/profiler/index.cjs +10 -8
  108. package/dist/profiler/index.cjs.map +1 -1
  109. package/dist/profiler/index.d.cts +8 -7
  110. package/dist/profiler/index.d.ts +8 -7
  111. package/dist/profiler/index.js +3 -1
  112. package/dist/profiler/index.js.map +1 -1
  113. package/dist/schema/index.cjs +43 -22
  114. package/dist/schema/index.cjs.map +1 -1
  115. package/dist/schema/index.d.cts +17 -8
  116. package/dist/schema/index.d.ts +17 -8
  117. package/dist/schema/index.js +9 -4
  118. package/dist/schema/index.js.map +1 -1
  119. package/dist/{sqlite-D0aceIe0.d.cts → sqlite-BhFswiAR.d.cts} +837 -120
  120. package/dist/{sqlite-SUxbZqfy.d.ts → sqlite-h6dta1IJ.d.ts} +837 -120
  121. package/dist/{store-CpvwTMxV.d.cts → store-BS_hehiz.d.ts} +659 -23
  122. package/dist/{store-U3i2tUch.d.ts → store-CkCvqRUf.d.cts} +659 -23
  123. package/dist/{types-yH4_p0XB.d.cts → types-BpgACExN.d.cts} +3 -2
  124. package/dist/{types-qYFZ9SqD.d.ts → types-Bz-Pi681.d.ts} +3 -2
  125. package/dist/types-DptZHe-l.d.ts +2132 -0
  126. package/dist/types-WF5ItKQu.d.cts +2132 -0
  127. package/dist/where-C40InMIp.d.ts +11 -0
  128. package/dist/where-DZYMiXVq.d.cts +11 -0
  129. package/package.json +33 -73
  130. package/dist/ast-C8S37w1A.d.ts +0 -497
  131. package/dist/ast-dgLhLOg0.d.cts +0 -497
  132. package/dist/chunk-3JK66E3I.cjs.map +0 -1
  133. package/dist/chunk-3PPEHLGK.js +0 -1116
  134. package/dist/chunk-3PPEHLGK.js.map +0 -1
  135. package/dist/chunk-5HVDOPZU.cjs.map +0 -1
  136. package/dist/chunk-753F33CV.js.map +0 -1
  137. package/dist/chunk-EY4LBX3F.js.map +0 -1
  138. package/dist/chunk-EYELZHKY.js.map +0 -1
  139. package/dist/chunk-GFGVREHH.js +0 -1381
  140. package/dist/chunk-GFGVREHH.js.map +0 -1
  141. package/dist/chunk-GUTQTMOV.js.map +0 -1
  142. package/dist/chunk-LBORRUNJ.js +0 -135
  143. package/dist/chunk-LBORRUNJ.js.map +0 -1
  144. package/dist/chunk-O5PST6TB.cjs.map +0 -1
  145. package/dist/chunk-OLROXS2S.cjs +0 -147
  146. package/dist/chunk-OLROXS2S.cjs.map +0 -1
  147. package/dist/chunk-OVJ2BE5Q.cjs.map +0 -1
  148. package/dist/chunk-PAUN562Y.cjs +0 -1417
  149. package/dist/chunk-PAUN562Y.cjs.map +0 -1
  150. package/dist/chunk-PEE4EWXZ.cjs +0 -1131
  151. package/dist/chunk-PEE4EWXZ.cjs.map +0 -1
  152. package/dist/chunk-QOLTW7OZ.js.map +0 -1
  153. package/dist/chunk-SUHW2UYL.cjs.map +0 -1
  154. package/dist/chunk-UVZHTBZ5.cjs.map +0 -1
  155. package/dist/chunk-WFMTAEEN.js.map +0 -1
  156. package/dist/types-C-zfYDJB.d.ts +0 -159
  157. package/dist/types-CQx4iW5Y.d.cts +0 -159
  158. package/dist/types-Qk2l3IkQ.d.cts +0 -1254
  159. package/dist/types-Qk2l3IkQ.d.ts +0 -1254
@@ -1,497 +0,0 @@
1
- import { T as TemporalMode, j as FulltextQueryMode } from './types-Qk2l3IkQ.cjs';
2
-
3
- declare const MAX_JSON_POINTER_DEPTH: 5;
4
- type JsonPointer = string & {
5
- readonly __jsonPointer: unique symbol;
6
- };
7
- type JsonPointerSegment = string | number;
8
- type JsonPointerSegments = readonly JsonPointerSegment[];
9
- type Depth = 0 | 1 | 2 | 3 | 4 | 5;
10
- interface DepthDecrementMap {
11
- 0: 0;
12
- 1: 0;
13
- 2: 1;
14
- 3: 2;
15
- 4: 3;
16
- 5: 4;
17
- }
18
- type Decrement<Current extends Depth> = DepthDecrementMap[Current];
19
- type NonNegativeIntegerString = Exclude<`${bigint}`, `-${string}`>;
20
- type ObjectPointerKey<T> = Exclude<Extract<keyof T, string>, NonNegativeIntegerString>;
21
- type EncodeTilde<S extends string> = S extends `${infer Head}~${infer Tail}` ? `${EncodeTilde<Head>}~0${EncodeTilde<Tail>}` : S;
22
- type EncodeSlash<S extends string> = S extends `${infer Head}/${infer Tail}` ? `${EncodeSlash<Head>}~1${EncodeSlash<Tail>}` : S;
23
- type EncodePointerSegment<S extends string> = EncodeSlash<EncodeTilde<S>>;
24
- type DecodePointerSegment<S extends string> = S extends `${infer Head}~1${infer Tail}` ? `${DecodePointerSegment<Head>}/${DecodePointerSegment<Tail>}` : S extends `${infer Head}~0${infer Tail}` ? `${DecodePointerSegment<Head>}~${DecodePointerSegment<Tail>}` : S;
25
- type PointerForArray<T, Current extends Depth> = `/${NonNegativeIntegerString}` | (Current extends 1 ? never : `/${NonNegativeIntegerString}${JsonPointerFor<T, Decrement<Current>>}`);
26
- type PointerForObject<T, Current extends Depth> = {
27
- [K in ObjectPointerKey<T>]: `/${EncodePointerSegment<K>}` | (Current extends 1 ? never : `/${EncodePointerSegment<K>}${JsonPointerFor<T[K], Decrement<Current>>}`);
28
- }[ObjectPointerKey<T>];
29
- type JsonPointerFor<T, Current extends Depth = 5> = "" | (Current extends 0 ? "" : T extends readonly (infer U)[] ? PointerForArray<U, Current> : never) | (Current extends 0 ? "" : T extends Record<string, unknown> ? PointerForObject<T, Current> : never);
30
- type PointerSegmentsForArray<T, Current extends Depth> = readonly [number] | (Current extends 1 ? readonly [number] : readonly [number, ...JsonPointerSegmentsFor<T, Decrement<Current>>]);
31
- type PointerSegmentsForObject<T, Current extends Depth> = {
32
- [K in ObjectPointerKey<T>]: readonly [K] | (Current extends 1 ? readonly [K] : readonly [K, ...JsonPointerSegmentsFor<T[K], Decrement<Current>>]);
33
- }[ObjectPointerKey<T>];
34
- type JsonPointerSegmentsFor<T, Current extends Depth = 5> = readonly [] | (Current extends 0 ? readonly [] : T extends readonly (infer U)[] ? PointerSegmentsForArray<U, Current> : never) | (Current extends 0 ? readonly [] : T extends Record<string, unknown> ? PointerSegmentsForObject<T, Current> : never);
35
- type JsonPointerInput<T> = JsonPointerFor<T> | JsonPointerSegmentsFor<T> | JsonPointer;
36
- type ResolveJsonPointer<T, Pointer extends string> = Pointer extends "" ? T : Pointer extends `/${infer Head}/${infer Tail}` ? ResolveJsonPointer<ResolvePointerSegment<T, DecodePointerSegment<Head>>, `/${Tail}`> : Pointer extends `/${infer Head}` ? ResolvePointerSegment<T, DecodePointerSegment<Head>> : unknown;
37
- type ResolvePointerSegment<T, Segment extends string> = T extends readonly (infer U)[] ? Segment extends NonNegativeIntegerString ? U : unknown : T extends Record<string, unknown> ? Segment extends keyof T ? Segment extends NonNegativeIntegerString ? unknown : T[Segment] : unknown : unknown;
38
- type ResolveJsonPointerSegments<T, Segments extends readonly JsonPointerSegment[]> = Segments extends readonly [] ? T : Segments extends readonly [infer Head, ...infer Tail] ? ResolveJsonPointerSegments<ResolvePointerSegment<T, SegmentToString<Head>>, Extract<Tail, readonly JsonPointerSegment[]>> : unknown;
39
- type SegmentToString<Segment> = Segment extends number ? `${Segment}` : Segment extends string ? Segment : string;
40
- declare function jsonPointer(segments: JsonPointerSegments): JsonPointer;
41
- declare function normalizeJsonPointer<T>(input: JsonPointerInput<T>): JsonPointer;
42
- declare function parseJsonPointer(pointer: JsonPointer): readonly string[];
43
- declare function joinJsonPointers(base: JsonPointer | undefined, relative: JsonPointer): JsonPointer;
44
-
45
- /**
46
- * Query AST types.
47
- *
48
- * Defines the abstract syntax tree for TypeGraph queries.
49
- * This portable representation can be compiled to SQL (today)
50
- * or other query languages (Cypher, SPARQL) in the future.
51
- */
52
-
53
- /**
54
- * A field reference in a predicate.
55
- */
56
- type FieldRef = Readonly<{
57
- __type: "field_ref";
58
- alias: string;
59
- path: readonly string[];
60
- jsonPointer?: JsonPointer | undefined;
61
- valueType?: ValueType | undefined;
62
- elementType?: ValueType | undefined;
63
- }>;
64
- /**
65
- * A literal value in a predicate.
66
- */
67
- type LiteralValue = Readonly<{
68
- __type: "literal";
69
- value: string | number | boolean;
70
- valueType?: ValueType | undefined;
71
- }>;
72
- /**
73
- * A parameter reference for prepared queries.
74
- *
75
- * Used in place of a literal value to create parameterized queries
76
- * that can be executed multiple times with different bindings.
77
- */
78
- type ParameterRef = Readonly<{
79
- __type: "parameter";
80
- name: string;
81
- valueType?: ValueType | undefined;
82
- }>;
83
- /**
84
- * Supported value types for predicates.
85
- */
86
- type ValueType = "string" | "number" | "boolean" | "date" | "array" | "object" | "embedding" | "unknown";
87
- /**
88
- * Comparison operators.
89
- */
90
- type ComparisonOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "notIn";
91
- /**
92
- * String operators.
93
- */
94
- type StringOp = "contains" | "startsWith" | "endsWith" | "like" | "ilike";
95
- /**
96
- * A comparison predicate.
97
- */
98
- type ComparisonPredicate = Readonly<{
99
- __type: "comparison";
100
- op: ComparisonOp;
101
- left: FieldRef;
102
- right: LiteralValue | LiteralValue[] | ParameterRef;
103
- }>;
104
- /**
105
- * A string predicate.
106
- */
107
- type StringPredicate = Readonly<{
108
- __type: "string_op";
109
- op: StringOp;
110
- field: FieldRef;
111
- pattern: string | ParameterRef;
112
- }>;
113
- /**
114
- * A null check predicate.
115
- */
116
- type NullPredicate = Readonly<{
117
- __type: "null_check";
118
- op: "isNull" | "isNotNull";
119
- field: FieldRef;
120
- }>;
121
- /**
122
- * A between predicate.
123
- */
124
- type BetweenPredicate = Readonly<{
125
- __type: "between";
126
- field: FieldRef;
127
- lower: LiteralValue | ParameterRef;
128
- upper: LiteralValue | ParameterRef;
129
- }>;
130
- /**
131
- * Array operators.
132
- */
133
- type ArrayOp = "contains" | "containsAll" | "containsAny" | "isEmpty" | "isNotEmpty" | "lengthEq" | "lengthGt" | "lengthGte" | "lengthLt" | "lengthLte";
134
- /**
135
- * An array predicate.
136
- */
137
- type ArrayPredicate = Readonly<{
138
- __type: "array_op";
139
- op: ArrayOp;
140
- field: FieldRef;
141
- values?: readonly LiteralValue[];
142
- length?: number;
143
- }>;
144
- /**
145
- * Object operators.
146
- */
147
- type ObjectOp = "hasKey" | "hasPath" | "pathEquals" | "pathContains" | "pathIsNull" | "pathIsNotNull";
148
- /**
149
- * An object/JSON predicate.
150
- */
151
- type ObjectPredicate = Readonly<{
152
- __type: "object_op";
153
- op: ObjectOp;
154
- field: FieldRef;
155
- pointer: JsonPointer;
156
- value?: LiteralValue;
157
- valueType?: ValueType;
158
- elementType?: ValueType;
159
- }>;
160
- /**
161
- * Logical AND predicate.
162
- */
163
- type AndPredicate = Readonly<{
164
- __type: "and";
165
- predicates: readonly PredicateExpression[];
166
- }>;
167
- /**
168
- * Logical OR predicate.
169
- */
170
- type OrPredicate = Readonly<{
171
- __type: "or";
172
- predicates: readonly PredicateExpression[];
173
- }>;
174
- /**
175
- * Logical NOT predicate.
176
- */
177
- type NotPredicate = Readonly<{
178
- __type: "not";
179
- predicate: PredicateExpression;
180
- }>;
181
- /**
182
- * An aggregate comparison predicate (for HAVING clauses).
183
- */
184
- type AggregateComparisonPredicate = Readonly<{
185
- __type: "aggregate_comparison";
186
- op: ComparisonOp;
187
- aggregate: AggregateExpr;
188
- value: LiteralValue;
189
- }>;
190
- /**
191
- * An EXISTS subquery predicate.
192
- * Tests whether the subquery returns any rows.
193
- */
194
- type ExistsSubquery = Readonly<{
195
- __type: "exists";
196
- subquery: QueryAst;
197
- negated: boolean;
198
- }>;
199
- /**
200
- * An IN subquery predicate.
201
- * Tests whether a field value is in the subquery results.
202
- */
203
- type InSubquery = Readonly<{
204
- __type: "in_subquery";
205
- field: FieldRef;
206
- subquery: QueryAst;
207
- negated: boolean;
208
- }>;
209
- /**
210
- * Vector similarity metric types.
211
- */
212
- type VectorMetricType = "cosine" | "l2" | "inner_product";
213
- /**
214
- * A vector similarity predicate.
215
- * Finds nodes with embeddings similar to the query embedding.
216
- *
217
- * This predicate affects query execution by:
218
- * - Joining with the embeddings table
219
- * - Adding ORDER BY distance (ascending)
220
- * - Applying LIMIT (top k results)
221
- * - Optionally filtering by minimum score
222
- */
223
- type VectorSimilarityPredicate = Readonly<{
224
- __type: "vector_similarity";
225
- /** The embedding field reference */
226
- field: FieldRef;
227
- /** The query embedding to compare against */
228
- queryEmbedding: readonly number[];
229
- /** Similarity metric to use */
230
- metric: VectorMetricType;
231
- /** Maximum number of results to return */
232
- limit: number;
233
- /** Optional minimum similarity score (0-1 for cosine) */
234
- minScore?: number;
235
- }>;
236
-
237
- /**
238
- * A fulltext MATCH predicate.
239
- *
240
- * Finds nodes whose combined searchable content matches the query. Affects
241
- * query execution by joining with the fulltext table, adding an ORDER BY
242
- * on relevance rank (descending), and applying a LIMIT (top k).
243
- */
244
- type FulltextMatchPredicate = Readonly<{
245
- __type: "fulltext_match";
246
- /**
247
- * Reserved for forward compatibility with per-field fulltext dispatch.
248
- * Today only `field.alias` is consumed: the MATCH always targets the
249
- * combined `content` column, so `field.path` is a synthetic
250
- * `["$fulltext"]` marker rather than a real props path. Future
251
- * strategies (per-field indexes, `setweight()`-style boosts) can use
252
- * the full `FieldRef` without breaking the AST shape.
253
- */
254
- field: FieldRef;
255
- /** The user-supplied query string. */
256
- query: string;
257
- /** Parse mode for the query string. Default: "websearch". */
258
- mode: FulltextQueryMode;
259
- /** Language override for query parsing. */
260
- language?: string;
261
- /** Maximum number of results to return. */
262
- limit: number;
263
- /** Minimum relevance to include (backend-native units). */
264
- minScore?: number;
265
- }>;
266
- /**
267
- * Fusion options for hybrid (vector + fulltext) queries.
268
- *
269
- * Shared between:
270
- * - Query-builder path: `QueryBuilder.fuseWith()` stores this on `QueryAst`.
271
- * - Store path: `store.search.hybrid(kind, { fusion })` accepts the same shape.
272
- *
273
- * Only applied when the query contains both a vector and a fulltext
274
- * predicate. Defaults (when omitted): RRF with k=60 and equal weights.
275
- */
276
- type HybridFusionOptions = Readonly<{
277
- /** RRF is the only currently supported fusion method. */
278
- method?: "rrf";
279
- /** RRF constant. The classic value is 60. */
280
- k?: number;
281
- /** Per-source weights. Default: { vector: 1, fulltext: 1 }. */
282
- weights?: Readonly<{
283
- vector?: number;
284
- fulltext?: number;
285
- }>;
286
- }>;
287
- /**
288
- * All predicate expression types.
289
- */
290
- type PredicateExpression = ComparisonPredicate | StringPredicate | NullPredicate | BetweenPredicate | ArrayPredicate | ObjectPredicate | AndPredicate | OrPredicate | NotPredicate | AggregateComparisonPredicate | ExistsSubquery | InSubquery | VectorSimilarityPredicate | FulltextMatchPredicate;
291
- /**
292
- * The starting point of a query (the FROM clause).
293
- */
294
- type QueryStart = Readonly<{
295
- alias: string;
296
- kinds: readonly string[];
297
- includeSubClasses: boolean;
298
- }>;
299
- /**
300
- * Direction of edge traversal.
301
- */
302
- type TraversalDirection = "out" | "in";
303
- /**
304
- * Traversal ontology expansion behavior.
305
- *
306
- * - `"none"` — follow only the exact edge kind specified
307
- * - `"implying"` — also follow edge kinds that imply the specified kind (subClassOf)
308
- * - `"inverse"` — also follow the ontological inverse edge kind (inverseOf)
309
- * - `"all"` — follow both implying and inverse expansions
310
- */
311
- type TraversalExpansion = "none" | "implying" | "inverse" | "all";
312
- /**
313
- * Cycle handling policy for recursive traversals.
314
- */
315
- type RecursiveCyclePolicy = "prevent" | "allow";
316
- /**
317
- * Variable-length traversal specification for recursive graph traversals.
318
- */
319
- type VariableLengthSpec = Readonly<{
320
- /** Minimum number of hops before including results (default: 1) */
321
- minDepth: number;
322
- /** Maximum number of hops (-1 = unlimited, default: -1) */
323
- maxDepth: number;
324
- /**
325
- * Cycle handling mode.
326
- *
327
- * - "prevent": Track visited nodes per path and reject revisits
328
- * - "allow": Skip cycle checks (faster, may revisit nodes)
329
- */
330
- cyclePolicy: RecursiveCyclePolicy;
331
- /** Optional column alias for projected traversal path array */
332
- pathAlias?: string;
333
- /** Optional column alias for projected traversal depth */
334
- depthAlias?: string;
335
- }>;
336
- /**
337
- * A traversal step in the query.
338
- */
339
- type Traversal = Readonly<{
340
- edgeAlias: string;
341
- edgeKinds: readonly string[];
342
- /**
343
- * Edge kinds traversed in the opposite direction.
344
- *
345
- * Populated when query options request inverse/symmetric expansion.
346
- */
347
- inverseEdgeKinds?: readonly string[];
348
- direction: TraversalDirection;
349
- nodeAlias: string;
350
- nodeKinds: readonly string[];
351
- joinFromAlias: string;
352
- joinEdgeField: "from_id" | "to_id";
353
- /** If true, use LEFT JOIN instead of INNER JOIN (optional match) */
354
- optional: boolean;
355
- /** Variable-length traversal configuration (for recursive CTEs) */
356
- variableLength?: VariableLengthSpec;
357
- }>;
358
- /**
359
- * Supported aggregate functions.
360
- */
361
- type AggregateFunction = "count" | "countDistinct" | "sum" | "avg" | "min" | "max";
362
- /**
363
- * An aggregate expression.
364
- */
365
- type AggregateExpr = Readonly<{
366
- __type: "aggregate";
367
- function: AggregateFunction;
368
- field: FieldRef;
369
- }>;
370
- /**
371
- * A GROUP BY specification.
372
- */
373
- type GroupBySpec = Readonly<{
374
- fields: readonly FieldRef[];
375
- }>;
376
- /**
377
- * A projected field in the SELECT clause.
378
- * Can be either a direct field reference or an aggregate expression.
379
- */
380
- type ProjectedField = Readonly<{
381
- outputName: string;
382
- source: FieldRef | AggregateExpr;
383
- /** Override the CTE alias for this field (used for edge fields in node CTEs) */
384
- cteAlias?: string;
385
- }>;
386
- /**
387
- * The projection (SELECT) clause.
388
- */
389
- type Projection = Readonly<{
390
- fields: readonly ProjectedField[];
391
- }>;
392
- /**
393
- * A selectively projected field for optimized queries.
394
- *
395
- * Used when the select callback only accesses specific fields,
396
- * allowing the compiler to generate optimized SQL that fetches
397
- * only those fields instead of the full props blob.
398
- */
399
- type SelectiveField = Readonly<{
400
- /** The alias (node or edge) this field belongs to */
401
- alias: string;
402
- /** The field name (e.g., "email", "name", "id") */
403
- field: string;
404
- /** The output column name in the result (e.g., "p_email") */
405
- outputName: string;
406
- /** True if this is a system field (id, kind, etc.), false for props */
407
- isSystemField: boolean;
408
- /**
409
- * Optional value type for props fields.
410
- *
411
- * When present, the compiler can use type-aware JSON extraction
412
- * (e.g. numeric/date casts) to better match predicate compilation
413
- * and enable expression index coverage.
414
- */
415
- valueType?: ValueType | undefined;
416
- }>;
417
- /**
418
- * Null ordering preference.
419
- */
420
- type NullOrdering = "first" | "last";
421
- /**
422
- * Sort direction.
423
- */
424
- type SortDirection = "asc" | "desc";
425
- /**
426
- * An ordering specification.
427
- */
428
- type OrderSpec = Readonly<{
429
- field: FieldRef;
430
- direction: SortDirection;
431
- nulls?: NullOrdering;
432
- }>;
433
- /**
434
- * A predicate applied to a specific node or edge alias.
435
- */
436
- type NodePredicate = Readonly<{
437
- targetAlias: string;
438
- /** Whether this predicate targets a node or edge. Defaults to "node". */
439
- targetType?: "node" | "edge";
440
- expression: PredicateExpression;
441
- }>;
442
- /**
443
- * Temporal query options.
444
- */
445
- type TemporalOptions = Readonly<{
446
- mode: TemporalMode;
447
- asOf?: string;
448
- }>;
449
- /**
450
- * The complete query AST.
451
- */
452
- type QueryAst = Readonly<{
453
- /** The graph ID this query is for (used for subqueries) */
454
- graphId?: string;
455
- start: QueryStart;
456
- traversals: readonly Traversal[];
457
- predicates: readonly NodePredicate[];
458
- projection: Projection;
459
- temporalMode: TemporalOptions;
460
- orderBy?: readonly OrderSpec[];
461
- limit?: number;
462
- offset?: number;
463
- /** GROUP BY specification for aggregate queries */
464
- groupBy?: GroupBySpec;
465
- /** HAVING clause - predicates applied after GROUP BY */
466
- having?: PredicateExpression;
467
- /**
468
- * Selective fields for optimized queries.
469
- * When present, the compiler generates SQL that only fetches these specific
470
- * fields instead of the full props blob, enabling covered index usage.
471
- */
472
- selectiveFields?: readonly SelectiveField[];
473
- /** Fusion options for hybrid queries. Ignored unless both predicates present. */
474
- fusion?: HybridFusionOptions;
475
- }>;
476
- /**
477
- * Set operation types for combining queries.
478
- */
479
- type SetOperationType = "union" | "unionAll" | "intersect" | "except";
480
- /**
481
- * A set operation combining two queries.
482
- */
483
- type SetOperation = Readonly<{
484
- __type: "set_operation";
485
- operator: SetOperationType;
486
- left: ComposableQuery;
487
- right: ComposableQuery;
488
- orderBy?: readonly OrderSpec[];
489
- limit?: number;
490
- offset?: number;
491
- }>;
492
- /**
493
- * A composable query - either a base query or a set operation.
494
- */
495
- type ComposableQuery = QueryAst | SetOperation;
496
-
497
- export { type AggregateExpr as A, type ComparisonOp as C, type FieldRef as F, type GroupBySpec as G, type HybridFusionOptions as H, type JsonPointer as J, MAX_JSON_POINTER_DEPTH as M, type NodePredicate as N, type OrderSpec as O, type ParameterRef as P, type QueryAst as Q, type ResolveJsonPointer as R, type SortDirection as S, type TraversalExpansion as T, type ValueType as V, type AggregateComparisonPredicate as a, type JsonPointerFor as b, type JsonPointerInput as c, type JsonPointerSegment as d, type JsonPointerSegments as e, type JsonPointerSegmentsFor as f, type ResolveJsonPointerSegments as g, jsonPointer as h, type PredicateExpression as i, joinJsonPointers as j, type VectorMetricType as k, type Traversal as l, type ProjectedField as m, normalizeJsonPointer as n, type RecursiveCyclePolicy as o, parseJsonPointer as p, type TraversalDirection as q, type SelectiveField as r, type ComposableQuery as s, type SetOperationType as t, type SetOperation as u };