@tanstack/db 0.5.16 → 0.5.17

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 (43) hide show
  1. package/dist/cjs/collection/changes.cjs +15 -1
  2. package/dist/cjs/collection/changes.cjs.map +1 -1
  3. package/dist/cjs/collection/changes.d.cts +1 -1
  4. package/dist/cjs/collection/index.cjs +8 -5
  5. package/dist/cjs/collection/index.cjs.map +1 -1
  6. package/dist/cjs/collection/index.d.cts +9 -6
  7. package/dist/cjs/errors.cjs +13 -0
  8. package/dist/cjs/errors.cjs.map +1 -1
  9. package/dist/cjs/errors.d.cts +3 -0
  10. package/dist/cjs/index.cjs +1 -0
  11. package/dist/cjs/index.cjs.map +1 -1
  12. package/dist/cjs/query/builder/index.cjs +12 -0
  13. package/dist/cjs/query/builder/index.cjs.map +1 -1
  14. package/dist/cjs/query/builder/index.d.cts +2 -1
  15. package/dist/cjs/query/index.d.cts +1 -1
  16. package/dist/cjs/types.d.cts +18 -2
  17. package/dist/cjs/utils.cjs +9 -0
  18. package/dist/cjs/utils.cjs.map +1 -1
  19. package/dist/esm/collection/changes.d.ts +1 -1
  20. package/dist/esm/collection/changes.js +15 -1
  21. package/dist/esm/collection/changes.js.map +1 -1
  22. package/dist/esm/collection/index.d.ts +9 -6
  23. package/dist/esm/collection/index.js +8 -5
  24. package/dist/esm/collection/index.js.map +1 -1
  25. package/dist/esm/errors.d.ts +3 -0
  26. package/dist/esm/errors.js +13 -0
  27. package/dist/esm/errors.js.map +1 -1
  28. package/dist/esm/index.js +2 -1
  29. package/dist/esm/query/builder/index.d.ts +2 -1
  30. package/dist/esm/query/builder/index.js +13 -1
  31. package/dist/esm/query/builder/index.js.map +1 -1
  32. package/dist/esm/query/index.d.ts +1 -1
  33. package/dist/esm/types.d.ts +18 -2
  34. package/dist/esm/utils.js +9 -0
  35. package/dist/esm/utils.js.map +1 -1
  36. package/package.json +4 -4
  37. package/src/collection/changes.ts +22 -2
  38. package/src/collection/index.ts +9 -6
  39. package/src/errors.ts +13 -0
  40. package/src/query/builder/index.ts +27 -0
  41. package/src/query/index.ts +2 -0
  42. package/src/types.ts +22 -5
  43. package/src/utils.ts +20 -0
package/src/utils.ts CHANGED
@@ -52,12 +52,16 @@ function deepEqualsInternal(
52
52
  if (!(b instanceof Date)) return false
53
53
  return a.getTime() === b.getTime()
54
54
  }
55
+ // Symmetric check: if b is Date but a is not, they're not equal
56
+ if (b instanceof Date) return false
55
57
 
56
58
  // Handle RegExp objects
57
59
  if (a instanceof RegExp) {
58
60
  if (!(b instanceof RegExp)) return false
59
61
  return a.source === b.source && a.flags === b.flags
60
62
  }
63
+ // Symmetric check: if b is RegExp but a is not, they're not equal
64
+ if (b instanceof RegExp) return false
61
65
 
62
66
  // Handle Map objects - only if both are Maps
63
67
  if (a instanceof Map) {
@@ -78,6 +82,8 @@ function deepEqualsInternal(
78
82
  visited.delete(a)
79
83
  return result
80
84
  }
85
+ // Symmetric check: if b is Map but a is not, they're not equal
86
+ if (b instanceof Map) return false
81
87
 
82
88
  // Handle Set objects - only if both are Sets
83
89
  if (a instanceof Set) {
@@ -106,6 +112,8 @@ function deepEqualsInternal(
106
112
  visited.delete(a)
107
113
  return result
108
114
  }
115
+ // Symmetric check: if b is Set but a is not, they're not equal
116
+ if (b instanceof Set) return false
109
117
 
110
118
  // Handle TypedArrays
111
119
  if (
@@ -124,6 +132,14 @@ function deepEqualsInternal(
124
132
 
125
133
  return true
126
134
  }
135
+ // Symmetric check: if b is TypedArray but a is not, they're not equal
136
+ if (
137
+ ArrayBuffer.isView(b) &&
138
+ !(b instanceof DataView) &&
139
+ !ArrayBuffer.isView(a)
140
+ ) {
141
+ return false
142
+ }
127
143
 
128
144
  // Handle Temporal objects
129
145
  // Check if both are Temporal objects of the same type
@@ -142,6 +158,8 @@ function deepEqualsInternal(
142
158
  // Fallback to toString comparison for other types
143
159
  return a.toString() === b.toString()
144
160
  }
161
+ // Symmetric check: if b is Temporal but a is not, they're not equal
162
+ if (isTemporal(b)) return false
145
163
 
146
164
  // Handle arrays
147
165
  if (Array.isArray(a)) {
@@ -159,6 +177,8 @@ function deepEqualsInternal(
159
177
  visited.delete(a)
160
178
  return result
161
179
  }
180
+ // Symmetric check: if b is array but a is not, they're not equal
181
+ if (Array.isArray(b)) return false
162
182
 
163
183
  // Handle objects
164
184
  if (typeof a === `object`) {