@tanstack/db 0.5.27 → 0.5.29
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/cjs/query/compiler/group-by.cjs +88 -8
- package/dist/cjs/query/compiler/group-by.cjs.map +1 -1
- package/dist/cjs/query/compiler/group-by.d.cts +6 -0
- package/dist/cjs/query/compiler/index.cjs +1 -1
- package/dist/cjs/query/compiler/index.cjs.map +1 -1
- package/dist/cjs/query/compiler/select.cjs +2 -1
- package/dist/cjs/query/compiler/select.cjs.map +1 -1
- package/dist/cjs/query/live/collection-config-builder.cjs +22 -1
- package/dist/cjs/query/live/collection-config-builder.cjs.map +1 -1
- package/dist/cjs/query/predicate-utils.cjs +10 -10
- package/dist/cjs/query/predicate-utils.cjs.map +1 -1
- package/dist/esm/query/compiler/group-by.d.ts +6 -0
- package/dist/esm/query/compiler/group-by.js +89 -9
- package/dist/esm/query/compiler/group-by.js.map +1 -1
- package/dist/esm/query/compiler/index.js +2 -2
- package/dist/esm/query/compiler/index.js.map +1 -1
- package/dist/esm/query/compiler/select.js +2 -1
- package/dist/esm/query/compiler/select.js.map +1 -1
- package/dist/esm/query/live/collection-config-builder.js +22 -1
- package/dist/esm/query/live/collection-config-builder.js.map +1 -1
- package/dist/esm/query/predicate-utils.js +10 -10
- package/dist/esm/query/predicate-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/query/compiler/group-by.ts +131 -14
- package/src/query/compiler/index.ts +2 -2
- package/src/query/compiler/select.ts +5 -2
- package/src/query/live/collection-config-builder.ts +30 -1
- package/src/query/predicate-utils.ts +18 -16
|
@@ -87,6 +87,24 @@ function isWhereSubsetInternal(
|
|
|
87
87
|
)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// Handle OR in subset: (A OR B) ⊆ C only if both A ⊆ C and B ⊆ C.
|
|
91
|
+
// Must be checked before OR superset so that or(A, B) ⊆ or(C, D)
|
|
92
|
+
// decomposes the subset first: A ⊆ or(C, D) AND B ⊆ or(C, D).
|
|
93
|
+
if (subset.type === `func` && subset.name === `or`) {
|
|
94
|
+
return subset.args.every((arg) =>
|
|
95
|
+
isWhereSubsetInternal(arg as BasicExpression<boolean>, superset),
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Handle OR in superset: subset ⊆ (A OR B) if subset ⊆ A or subset ⊆ B.
|
|
100
|
+
// Must be checked before decomposing AND subsets so that and(A, B) can
|
|
101
|
+
// match a structurally equal disjunct via areExpressionsEqual.
|
|
102
|
+
if (superset.type === `func` && superset.name === `or`) {
|
|
103
|
+
return superset.args.some((arg) =>
|
|
104
|
+
isWhereSubsetInternal(subset, arg as BasicExpression<boolean>),
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
90
108
|
// Handle subset being an AND: (A AND B) implies both A and B
|
|
91
109
|
if (subset.type === `func` && subset.name === `and`) {
|
|
92
110
|
// For (A AND B) ⊆ C, since (A AND B) implies A, we check if any conjunct implies C
|
|
@@ -111,22 +129,6 @@ function isWhereSubsetInternal(
|
|
|
111
129
|
}
|
|
112
130
|
}
|
|
113
131
|
|
|
114
|
-
// Handle OR in subset: (A OR B) is subset of C only if both A and B are subsets of C
|
|
115
|
-
if (subset.type === `func` && subset.name === `or`) {
|
|
116
|
-
return subset.args.every((arg) =>
|
|
117
|
-
isWhereSubsetInternal(arg as BasicExpression<boolean>, superset),
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Handle OR in superset: subset ⊆ (A OR B) if subset ⊆ A or subset ⊆ B
|
|
122
|
-
// (A OR B) as superset means data can satisfy A or B
|
|
123
|
-
// If subset is contained in any disjunct, it's contained in the union
|
|
124
|
-
if (superset.type === `func` && superset.name === `or`) {
|
|
125
|
-
return superset.args.some((arg) =>
|
|
126
|
-
isWhereSubsetInternal(subset, arg as BasicExpression<boolean>),
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
132
|
// Handle comparison operators on the same field
|
|
131
133
|
if (subset.type === `func` && superset.type === `func`) {
|
|
132
134
|
const subsetFunc = subset as Func
|