Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

index.ts

110 lines2.2 KB

1// Main exports for the new query builder system
2​
3// Query builder exports
4export {
5 BaseQueryBuilder,
6 Query,
7 type InitialQueryBuilder,
8 type QueryBuilder,
9 type Context,
10 type ContextSchema,
11 type Source,
12 type GetResult,
13 type InferResultType,
14 type ExtractContext,
15 type QueryResult,
16 // Types needed for declaration emit (https://github.com/TanStack/db/issues/1012)
17 type ContextFromSource,
18 type ContextFromUnionBranches,
19 type ContextFromUnionSource,
20 type SchemaFromSource,
21 type SingleSource,
22 type InferCollectionType,
23 type MergeContextWithJoinType,
24 type MergeContextForJoinCallback,
25 type ApplyJoinOptionalityToMergedSchema,
26 type ResultTypeFromSelect,
27 type WithResult,
28 type JoinOnCallback,
29 type RefsForContext,
30 type WhereCallback,
31 type OrderByCallback,
32 type GroupByCallback,
33 type SelectObject,
34 type FunctionalHavingRow,
35 type Prettify,
36} from './builder/index.js'
37​
38// Expression functions exports
39export {
40 // Operators
41 eq,
42 gt,
43 gte,
44 lt,
45 lte,
46 and,
47 or,
48 not,
49 inArray,
50 like,
51 ilike,
52 isUndefined,
53 isNull,
54 // Functions
55 upper,
56 lower,
57 length,
58 concat,
59 coalesce,
60 caseWhen,
61 add,
62 subtract,
63 multiply,
64 divide,
65 // Aggregates
66 count,
67 avg,
68 sum,
69 min,
70 max,
71 // Includes helpers
72 toArray,
73 materialize,
74} from './builder/functions.js'
75​
76// Ref proxy utilities
77export type { Ref } from './builder/types.js'
78​
79// Compiler
80export { compileQuery } from './compiler/index.js'
81export {
82 compileExpression,
83 compileSingleRowExpression,
84 toBooleanPredicate,
85} from './compiler/evaluators.js'
86​
87// Live query collection utilities
88export {
89 createLiveQueryCollection,
90 liveQueryCollectionOptions,
91} from './live-query-collection.js'
92​
93// One-shot query execution
94export { queryOnce, type QueryOnceConfig } from './query-once.js'
95​
96export { type LiveQueryCollectionConfig } from './live/types.js'
97export { type LiveQueryCollectionUtils } from './live/collection-config-builder.js'
98​
99// Predicate utilities for predicate push-down
100export {
101 isWhereSubset,
102 unionWherePredicates,
103 minusWherePredicates,
104 isOrderBySubset,
105 isLimitSubset,
106 isOffsetLimitSubset,
107 isPredicateSubset,
108} from './predicate-utils.js'
109​
110export { DeduplicatedLoadSubset } from './subset-dedupe.js'