@signaldb/core 2.0.0-beta.1 → 2.0.0-beta.11

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 (129) hide show
  1. package/dist/.vite/manifest.json +122 -82
  2. package/dist/AsyncDataAdapter.d.ts +44 -7
  3. package/dist/AutoFetchDataAdapter.d.ts +5 -7
  4. package/dist/Collection/Cursor.d.ts +6 -5
  5. package/dist/Collection/Observer.d.ts +2 -0
  6. package/dist/Collection/index.d.ts +34 -25
  7. package/dist/Collection/types.d.ts +10 -2
  8. package/dist/DataAdapter.d.ts +12 -6
  9. package/dist/DefaultDataAdapter.d.ts +6 -6
  10. package/dist/WorkerDataAdapter.d.ts +10 -6
  11. package/dist/WorkerDataAdapterHost.d.ts +7 -7
  12. package/dist/createIndex.d.ts +2 -2
  13. package/dist/createIndexProvider.d.ts +2 -2
  14. package/dist/createReactivityAdapter.d.ts +2 -2
  15. package/dist/createStorageAdapter.d.ts +1 -1
  16. package/dist/getIndexInfo.d.ts +3 -4
  17. package/dist/index.cjs.js +33 -31
  18. package/dist/index.d.ts +4 -1
  19. package/dist/index.mjs +17 -32
  20. package/dist/index10.cjs.js +23 -0
  21. package/dist/index10.mjs +21 -17
  22. package/dist/index11.cjs.js +45 -0
  23. package/dist/index11.mjs +44 -15
  24. package/dist/index12.cjs.js +22 -0
  25. package/dist/index12.mjs +21 -350
  26. package/dist/index13.cjs.js +45 -0
  27. package/dist/index13.mjs +44 -419
  28. package/dist/index14.cjs.js +86 -0
  29. package/dist/index14.mjs +85 -184
  30. package/dist/index15.cjs.js +15 -0
  31. package/dist/index15.mjs +14 -386
  32. package/dist/index16.cjs.js +136 -0
  33. package/dist/index16.mjs +133 -577
  34. package/dist/index17.cjs.js +47 -0
  35. package/dist/index17.mjs +46 -150
  36. package/dist/index18.cjs.js +15 -0
  37. package/dist/index18.mjs +14 -26
  38. package/dist/index19.cjs.js +23 -0
  39. package/dist/index19.mjs +22 -42
  40. package/dist/index2.cjs.js +33 -0
  41. package/dist/index2.mjs +32 -257
  42. package/dist/index20.cjs.js +37 -0
  43. package/dist/index20.mjs +36 -7
  44. package/dist/index21.cjs.js +35 -0
  45. package/dist/index21.mjs +33 -103
  46. package/dist/index22.cjs.js +25 -0
  47. package/dist/index22.mjs +23 -127
  48. package/dist/index23.cjs.js +19 -0
  49. package/dist/index23.mjs +18 -7
  50. package/dist/index24.cjs.js +342 -0
  51. package/dist/index24.mjs +340 -26
  52. package/dist/index25.cjs.js +542 -0
  53. package/dist/index25.mjs +541 -10
  54. package/dist/index26.cjs.js +11 -0
  55. package/dist/index26.mjs +10 -29
  56. package/dist/index27.cjs.js +11 -0
  57. package/dist/index27.mjs +10 -46
  58. package/dist/index28.cjs.js +90 -0
  59. package/dist/index28.mjs +87 -7
  60. package/dist/index29.cjs.js +424 -0
  61. package/dist/index29.mjs +423 -9
  62. package/dist/index3.cjs.js +19 -0
  63. package/dist/index3.mjs +18 -541
  64. package/dist/index30.cjs.js +72 -0
  65. package/dist/index30.mjs +71 -5
  66. package/dist/index31.cjs.js +191 -0
  67. package/dist/index31.mjs +190 -7
  68. package/dist/index32.cjs.js +21 -0
  69. package/dist/index32.mjs +20 -29
  70. package/dist/index33.cjs.js +335 -0
  71. package/dist/index33.mjs +334 -42
  72. package/dist/index34.cjs.js +539 -0
  73. package/dist/index34.mjs +539 -0
  74. package/dist/index4.cjs.js +150 -0
  75. package/dist/index4.mjs +149 -5
  76. package/dist/index5.cjs.js +254 -0
  77. package/dist/index5.mjs +252 -4
  78. package/dist/index6.cjs.js +125 -0
  79. package/dist/index6.mjs +124 -29
  80. package/dist/index7.cjs.js +33 -0
  81. package/dist/index7.mjs +32 -12
  82. package/dist/index8.cjs.js +12 -0
  83. package/dist/index8.mjs +10 -4
  84. package/dist/index9.cjs.js +11 -0
  85. package/dist/index9.mjs +10 -133
  86. package/dist/types/IndexProvider.d.ts +2 -2
  87. package/dist/types/Modifier.d.ts +1 -1
  88. package/dist/types/ReactivityAdapter.d.ts +1 -1
  89. package/dist/utils/createSignal.d.ts +2 -2
  90. package/dist/utils/deepClone.d.ts +1 -1
  91. package/dist/utils/getMatchingKeys.d.ts +2 -2
  92. package/dist/utils/isFieldExpression.d.ts +1 -1
  93. package/dist/utils/match.d.ts +1 -1
  94. package/dist/utils/modify.d.ts +1 -1
  95. package/dist/utils/queryId.d.ts +2 -2
  96. package/dist/utils/reactiveOrAsync.d.ts +59 -0
  97. package/package.json +3 -3
  98. package/dist/index.cjs10.js +0 -18
  99. package/dist/index.cjs11.js +0 -15
  100. package/dist/index.cjs12.js +0 -350
  101. package/dist/index.cjs13.js +0 -419
  102. package/dist/index.cjs14.js +0 -184
  103. package/dist/index.cjs15.js +0 -386
  104. package/dist/index.cjs16.js +0 -579
  105. package/dist/index.cjs17.js +0 -150
  106. package/dist/index.cjs18.js +0 -26
  107. package/dist/index.cjs19.js +0 -43
  108. package/dist/index.cjs2.js +0 -258
  109. package/dist/index.cjs20.js +0 -7
  110. package/dist/index.cjs21.js +0 -104
  111. package/dist/index.cjs22.js +0 -129
  112. package/dist/index.cjs23.js +0 -7
  113. package/dist/index.cjs24.js +0 -27
  114. package/dist/index.cjs25.js +0 -10
  115. package/dist/index.cjs26.js +0 -29
  116. package/dist/index.cjs27.js +0 -46
  117. package/dist/index.cjs28.js +0 -8
  118. package/dist/index.cjs29.js +0 -9
  119. package/dist/index.cjs3.js +0 -542
  120. package/dist/index.cjs30.js +0 -5
  121. package/dist/index.cjs31.js +0 -7
  122. package/dist/index.cjs32.js +0 -29
  123. package/dist/index.cjs33.js +0 -42
  124. package/dist/index.cjs4.js +0 -5
  125. package/dist/index.cjs5.js +0 -5
  126. package/dist/index.cjs6.js +0 -29
  127. package/dist/index.cjs7.js +0 -12
  128. package/dist/index.cjs8.js +0 -5
  129. package/dist/index.cjs9.js +0 -133
@@ -1,77 +1,84 @@
1
1
  {
2
2
  "src/AsyncDataAdapter.ts": {
3
- "file": "index.cjs13.js",
3
+ "file": "index29.cjs.js",
4
4
  "name": "AsyncDataAdapter",
5
5
  "src": "src/AsyncDataAdapter.ts",
6
+ "isDynamicEntry": true,
6
7
  "imports": [
8
+ "src/getIndexInfo.ts",
7
9
  "src/utils/deepClone.ts",
10
+ "src/utils/getMatchingKeys.ts",
11
+ "src/utils/isEqual.ts",
8
12
  "src/utils/match.ts",
9
13
  "src/utils/modify.ts",
14
+ "src/utils/project.ts",
10
15
  "src/utils/queryId.ts",
11
- "src/utils/isEqual.ts",
12
- "src/getIndexInfo.ts",
13
- "src/utils/getMatchingKeys.ts",
14
- "src/utils/sortItems.ts",
15
- "src/utils/project.ts"
16
+ "src/utils/sortItems.ts"
16
17
  ]
17
18
  },
18
19
  "src/AutoFetchDataAdapter.ts": {
19
- "file": "index.cjs16.js",
20
+ "file": "index34.cjs.js",
20
21
  "name": "AutoFetchDataAdapter",
21
22
  "src": "src/AutoFetchDataAdapter.ts",
23
+ "isDynamicEntry": true,
22
24
  "imports": [
25
+ "src/getIndexInfo.ts",
23
26
  "src/utils/deepClone.ts",
27
+ "src/utils/getMatchingKeys.ts",
28
+ "src/utils/isEqual.ts",
24
29
  "src/utils/match.ts",
25
30
  "src/utils/modify.ts",
31
+ "src/utils/project.ts",
26
32
  "src/utils/queryId.ts",
27
- "src/utils/isEqual.ts",
28
- "src/getIndexInfo.ts",
29
- "src/utils/getMatchingKeys.ts",
30
- "src/utils/sortItems.ts",
31
- "src/utils/project.ts"
33
+ "src/utils/sortItems.ts"
32
34
  ]
33
35
  },
34
36
  "src/Collection/Cursor.ts": {
35
- "file": "index.cjs2.js",
37
+ "file": "index5.cjs.js",
36
38
  "name": "Collection/Cursor",
37
39
  "src": "src/Collection/Cursor.ts",
40
+ "isDynamicEntry": true,
38
41
  "imports": [
39
42
  "src/Collection/Observer.ts"
40
43
  ]
41
44
  },
42
45
  "src/Collection/Observer.ts": {
43
- "file": "index.cjs17.js",
46
+ "file": "index4.cjs.js",
44
47
  "name": "Collection/Observer",
45
48
  "src": "src/Collection/Observer.ts",
49
+ "isDynamicEntry": true,
46
50
  "imports": [
47
51
  "src/utils/isEqual.ts",
48
52
  "src/utils/uniqueBy.ts"
49
53
  ]
50
54
  },
51
55
  "src/Collection/index.ts": {
52
- "file": "index.cjs3.js",
56
+ "file": "index25.cjs.js",
53
57
  "name": "Collection/index",
54
58
  "src": "src/Collection/index.ts",
59
+ "isDynamicEntry": true,
55
60
  "imports": [
61
+ "src/Collection/Cursor.ts",
62
+ "src/DefaultDataAdapter.ts",
63
+ "src/createIndex.ts",
56
64
  "src/utils/EventEmitter.ts",
57
65
  "src/utils/createSignal.ts",
58
- "src/utils/randomId.ts",
59
- "src/DefaultDataAdapter.ts",
60
- "src/utils/modify.ts",
61
66
  "src/utils/deepClone.ts",
67
+ "src/utils/modify.ts",
62
68
  "src/utils/queryId.ts",
63
- "src/Collection/Cursor.ts"
69
+ "src/utils/randomId.ts"
64
70
  ]
65
71
  },
66
72
  "src/DefaultDataAdapter.ts": {
67
- "file": "index.cjs12.js",
73
+ "file": "index24.cjs.js",
68
74
  "name": "DefaultDataAdapter",
69
75
  "src": "src/DefaultDataAdapter.ts",
76
+ "isDynamicEntry": true,
70
77
  "imports": [
71
78
  "src/createIndex.ts",
72
79
  "src/getIndexInfo.ts",
73
- "src/utils/deepClone.ts",
74
80
  "src/utils/EventEmitter.ts",
81
+ "src/utils/deepClone.ts",
75
82
  "src/utils/isEqual.ts",
76
83
  "src/utils/match.ts",
77
84
  "src/utils/modify.ts",
@@ -82,36 +89,39 @@
82
89
  ]
83
90
  },
84
91
  "src/WorkerDataAdapter.ts": {
85
- "file": "index.cjs14.js",
92
+ "file": "index31.cjs.js",
86
93
  "name": "WorkerDataAdapter",
87
94
  "src": "src/WorkerDataAdapter.ts",
95
+ "isDynamicEntry": true,
88
96
  "imports": [
97
+ "src/utils/batchOnNextTick.ts",
89
98
  "src/utils/queryId.ts",
90
- "src/utils/randomId.ts",
91
- "src/utils/batchOnNextTick.ts"
99
+ "src/utils/randomId.ts"
92
100
  ]
93
101
  },
94
102
  "src/WorkerDataAdapterHost.ts": {
95
- "file": "index.cjs15.js",
103
+ "file": "index33.cjs.js",
96
104
  "name": "WorkerDataAdapterHost",
97
105
  "src": "src/WorkerDataAdapterHost.ts",
106
+ "isDynamicEntry": true,
98
107
  "imports": [
108
+ "src/getIndexInfo.ts",
109
+ "src/utils/compact.ts",
99
110
  "src/utils/deepClone.ts",
111
+ "src/utils/getMatchingKeys.ts",
112
+ "src/utils/isEqual.ts",
100
113
  "src/utils/match.ts",
101
114
  "src/utils/modify.ts",
102
- "src/utils/queryId.ts",
103
- "src/utils/isEqual.ts",
104
- "src/getIndexInfo.ts",
105
- "src/utils/getMatchingKeys.ts",
106
- "src/utils/sortItems.ts",
107
115
  "src/utils/project.ts",
108
- "src/utils/compact.ts"
116
+ "src/utils/queryId.ts",
117
+ "src/utils/sortItems.ts"
109
118
  ]
110
119
  },
111
120
  "src/createIndex.ts": {
112
- "file": "index.cjs21.js",
121
+ "file": "index14.cjs.js",
113
122
  "name": "createIndex",
114
123
  "src": "src/createIndex.ts",
124
+ "isDynamicEntry": true,
115
125
  "imports": [
116
126
  "src/createIndexProvider.ts",
117
127
  "src/utils/get.ts",
@@ -120,24 +130,28 @@
120
130
  ]
121
131
  },
122
132
  "src/createIndexProvider.ts": {
123
- "file": "index.cjs30.js",
133
+ "file": "index9.cjs.js",
124
134
  "name": "createIndexProvider",
125
- "src": "src/createIndexProvider.ts"
135
+ "src": "src/createIndexProvider.ts",
136
+ "isDynamicEntry": true
126
137
  },
127
138
  "src/createReactivityAdapter.ts": {
128
- "file": "index.cjs5.js",
139
+ "file": "index27.cjs.js",
129
140
  "name": "createReactivityAdapter",
130
- "src": "src/createReactivityAdapter.ts"
141
+ "src": "src/createReactivityAdapter.ts",
142
+ "isDynamicEntry": true
131
143
  },
132
144
  "src/createStorageAdapter.ts": {
133
- "file": "index.cjs4.js",
145
+ "file": "index26.cjs.js",
134
146
  "name": "createStorageAdapter",
135
- "src": "src/createStorageAdapter.ts"
147
+ "src": "src/createStorageAdapter.ts",
148
+ "isDynamicEntry": true
136
149
  },
137
150
  "src/getIndexInfo.ts": {
138
- "file": "index.cjs22.js",
151
+ "file": "index16.cjs.js",
139
152
  "name": "getIndexInfo",
140
153
  "src": "src/getIndexInfo.ts",
154
+ "isDynamicEntry": true,
141
155
  "imports": [
142
156
  "src/utils/intersection.ts"
143
157
  ]
@@ -148,130 +162,156 @@
148
162
  "src": "src/index.ts",
149
163
  "isEntry": true,
150
164
  "imports": [
165
+ "src/AsyncDataAdapter.ts",
166
+ "src/AutoFetchDataAdapter.ts",
151
167
  "src/Collection/Cursor.ts",
152
168
  "src/Collection/index.ts",
153
- "src/createStorageAdapter.ts",
169
+ "src/DefaultDataAdapter.ts",
170
+ "src/WorkerDataAdapter.ts",
171
+ "src/WorkerDataAdapterHost.ts",
154
172
  "src/createReactivityAdapter.ts",
173
+ "src/createStorageAdapter.ts",
174
+ "src/utils/EventEmitter.ts",
175
+ "src/utils/get.ts",
155
176
  "src/utils/isEqual.ts",
156
177
  "src/utils/modify.ts",
157
178
  "src/utils/randomId.ts",
158
- "src/utils/EventEmitter.ts",
159
- "src/utils/get.ts",
160
- "src/utils/serializeValue.ts",
161
- "src/DefaultDataAdapter.ts",
162
- "src/AsyncDataAdapter.ts",
163
- "src/WorkerDataAdapter.ts",
164
- "src/WorkerDataAdapterHost.ts",
165
- "src/AutoFetchDataAdapter.ts"
179
+ "src/utils/reactiveOrAsync.ts",
180
+ "src/utils/serializeValue.ts"
166
181
  ]
167
182
  },
168
183
  "src/utils/EventEmitter.ts": {
169
- "file": "index.cjs9.js",
184
+ "file": "index6.cjs.js",
170
185
  "name": "utils/EventEmitter",
171
- "src": "src/utils/EventEmitter.ts"
186
+ "src": "src/utils/EventEmitter.ts",
187
+ "isDynamicEntry": true
172
188
  },
173
189
  "src/utils/batchOnNextTick.ts": {
174
- "file": "index.cjs27.js",
190
+ "file": "index30.cjs.js",
175
191
  "name": "utils/batchOnNextTick",
176
- "src": "src/utils/batchOnNextTick.ts"
192
+ "src": "src/utils/batchOnNextTick.ts",
193
+ "isDynamicEntry": true
177
194
  },
178
195
  "src/utils/compact.ts": {
179
- "file": "index.cjs28.js",
196
+ "file": "index32.cjs.js",
180
197
  "name": "utils/compact",
181
- "src": "src/utils/compact.ts"
198
+ "src": "src/utils/compact.ts",
199
+ "isDynamicEntry": true
182
200
  },
183
201
  "src/utils/createSignal.ts": {
184
- "file": "index.cjs18.js",
202
+ "file": "index7.cjs.js",
185
203
  "name": "utils/createSignal",
186
- "src": "src/utils/createSignal.ts"
204
+ "src": "src/utils/createSignal.ts",
205
+ "isDynamicEntry": true
187
206
  },
188
207
  "src/utils/deepClone.ts": {
189
- "file": "index.cjs19.js",
208
+ "file": "index17.cjs.js",
190
209
  "name": "utils/deepClone",
191
- "src": "src/utils/deepClone.ts"
210
+ "src": "src/utils/deepClone.ts",
211
+ "isDynamicEntry": true
192
212
  },
193
213
  "src/utils/get.ts": {
194
- "file": "index.cjs10.js",
214
+ "file": "index10.cjs.js",
195
215
  "name": "utils/get",
196
- "src": "src/utils/get.ts"
216
+ "src": "src/utils/get.ts",
217
+ "isDynamicEntry": true
197
218
  },
198
219
  "src/utils/getMatchingKeys.ts": {
199
- "file": "index.cjs26.js",
220
+ "file": "index13.cjs.js",
200
221
  "name": "utils/getMatchingKeys",
201
222
  "src": "src/utils/getMatchingKeys.ts",
223
+ "isDynamicEntry": true,
202
224
  "imports": [
203
225
  "src/utils/isFieldExpression.ts",
204
226
  "src/utils/serializeValue.ts"
205
227
  ]
206
228
  },
207
229
  "src/utils/intersection.ts": {
208
- "file": "index.cjs31.js",
230
+ "file": "index15.cjs.js",
209
231
  "name": "utils/intersection",
210
- "src": "src/utils/intersection.ts"
232
+ "src": "src/utils/intersection.ts",
233
+ "isDynamicEntry": true
211
234
  },
212
235
  "src/utils/isEqual.ts": {
213
- "file": "index.cjs6.js",
236
+ "file": "index2.cjs.js",
214
237
  "name": "utils/isEqual",
215
- "src": "src/utils/isEqual.ts"
238
+ "src": "src/utils/isEqual.ts",
239
+ "isDynamicEntry": true
216
240
  },
217
241
  "src/utils/isFieldExpression.ts": {
218
- "file": "index.cjs33.js",
242
+ "file": "index11.cjs.js",
219
243
  "name": "utils/isFieldExpression",
220
- "src": "src/utils/isFieldExpression.ts"
244
+ "src": "src/utils/isFieldExpression.ts",
245
+ "isDynamicEntry": true
221
246
  },
222
247
  "src/utils/match.ts": {
223
- "file": "index.cjs23.js",
248
+ "file": "index18.cjs.js",
224
249
  "name": "utils/match",
225
- "src": "src/utils/match.ts"
250
+ "src": "src/utils/match.ts",
251
+ "isDynamicEntry": true
226
252
  },
227
253
  "src/utils/modify.ts": {
228
- "file": "index.cjs7.js",
254
+ "file": "index19.cjs.js",
229
255
  "name": "utils/modify",
230
256
  "src": "src/utils/modify.ts",
257
+ "isDynamicEntry": true,
231
258
  "imports": [
232
259
  "src/utils/deepClone.ts"
233
260
  ]
234
261
  },
235
262
  "src/utils/project.ts": {
236
- "file": "index.cjs24.js",
263
+ "file": "index21.cjs.js",
237
264
  "name": "utils/project",
238
265
  "src": "src/utils/project.ts",
266
+ "isDynamicEntry": true,
239
267
  "imports": [
240
268
  "src/utils/get.ts",
241
269
  "src/utils/set.ts"
242
270
  ]
243
271
  },
244
272
  "src/utils/queryId.ts": {
245
- "file": "index.cjs20.js",
273
+ "file": "index22.cjs.js",
246
274
  "name": "utils/queryId",
247
- "src": "src/utils/queryId.ts"
275
+ "src": "src/utils/queryId.ts",
276
+ "isDynamicEntry": true
248
277
  },
249
278
  "src/utils/randomId.ts": {
250
- "file": "index.cjs8.js",
279
+ "file": "index8.cjs.js",
251
280
  "name": "utils/randomId",
252
- "src": "src/utils/randomId.ts"
281
+ "src": "src/utils/randomId.ts",
282
+ "isDynamicEntry": true
283
+ },
284
+ "src/utils/reactiveOrAsync.ts": {
285
+ "file": "index28.cjs.js",
286
+ "name": "utils/reactiveOrAsync",
287
+ "src": "src/utils/reactiveOrAsync.ts",
288
+ "isDynamicEntry": true
253
289
  },
254
290
  "src/utils/serializeValue.ts": {
255
- "file": "index.cjs11.js",
291
+ "file": "index12.cjs.js",
256
292
  "name": "utils/serializeValue",
257
- "src": "src/utils/serializeValue.ts"
293
+ "src": "src/utils/serializeValue.ts",
294
+ "isDynamicEntry": true
258
295
  },
259
296
  "src/utils/set.ts": {
260
- "file": "index.cjs32.js",
297
+ "file": "index20.cjs.js",
261
298
  "name": "utils/set",
262
- "src": "src/utils/set.ts"
299
+ "src": "src/utils/set.ts",
300
+ "isDynamicEntry": true
263
301
  },
264
302
  "src/utils/sortItems.ts": {
265
- "file": "index.cjs25.js",
303
+ "file": "index23.cjs.js",
266
304
  "name": "utils/sortItems",
267
305
  "src": "src/utils/sortItems.ts",
306
+ "isDynamicEntry": true,
268
307
  "imports": [
269
308
  "src/utils/get.ts"
270
309
  ]
271
310
  },
272
311
  "src/utils/uniqueBy.ts": {
273
- "file": "index.cjs29.js",
312
+ "file": "index3.cjs.js",
274
313
  "name": "utils/uniqueBy",
275
- "src": "src/utils/uniqueBy.ts"
314
+ "src": "src/utils/uniqueBy.ts",
315
+ "isDynamicEntry": true
276
316
  }
277
317
  }
@@ -1,8 +1,6 @@
1
- import type { BaseItem } from './Collection';
2
- import type Collection from './Collection';
3
- import type DataAdapter from './DataAdapter';
4
- import type { CollectionBackend } from './DataAdapter';
5
- import type StorageAdapter from './types/StorageAdapter';
1
+ import { BaseItem, default as Collection } from './Collection';
2
+ import { default as DataAdapter, CollectionBackend } from './DataAdapter';
3
+ import { default as StorageAdapter } from './types/StorageAdapter';
6
4
  export interface AsyncDataAdapterOptions {
7
5
  /** Factory to obtain a StorageAdapter per collection name */
8
6
  storage: (name: string) => StorageAdapter<any, any>;
@@ -10,6 +8,30 @@ export interface AsyncDataAdapterOptions {
10
8
  id?: string;
11
9
  /** Optional error hook (mirrors WorkerDataAdapterHost) */
12
10
  onError?: (error: Error) => void;
11
+ /**
12
+ * How often a failing query is retried before it is published as `'error'`.
13
+ * A query that fails is otherwise a dead end for the rest of the session —
14
+ * cursors only requery on `'complete'`, so they keep serving their neutral
15
+ * empty value, which consumers cannot tell apart from "there is no data".
16
+ */
17
+ retry?: {
18
+ /** Total attempts including the first one. Default 3. */
19
+ attempts?: number;
20
+ /** Delay in ms before attempt N+1. Default 100 * 4 ** (attempt - 1). */
21
+ delay?: (attempt: number) => number;
22
+ };
23
+ }
24
+ /**
25
+ * Carries the context needed to act on a failed query. The bare storage error
26
+ * on its own does not say which collection or selector produced it, which made
27
+ * the default `console.error` hook close to useless.
28
+ */
29
+ export declare class QueryError extends Error {
30
+ readonly collectionName: string;
31
+ readonly selector: unknown;
32
+ readonly options: unknown;
33
+ readonly attempts: number;
34
+ constructor(collectionName: string, selector: unknown, options: unknown, attempts: number, cause: unknown);
13
35
  }
14
36
  /**
15
37
  * AsyncDataAdapter
@@ -22,12 +44,14 @@ export default class AsyncDataAdapter implements DataAdapter {
22
44
  private options;
23
45
  private id;
24
46
  private onError;
47
+ private retryAttempts;
48
+ private retryDelay;
25
49
  private storageAdapters;
26
50
  private storageAdapterReady;
27
51
  private collectionIndices;
28
52
  private queries;
29
53
  constructor(options: AsyncDataAdapterOptions);
30
- createCollectionBackend<T extends BaseItem<I>, I = any, U = T>(collection: Collection<T, I, U>, indices: string[]): CollectionBackend<T, I>;
54
+ createCollectionBackend<T extends BaseItem<I>, I = any, E extends BaseItem = T, U = E>(collection: Collection<T, I, E, U>, indices: string[]): CollectionBackend<T, I>;
31
55
  private setupStorage;
32
56
  private ensureStorageAdapter;
33
57
  /**
@@ -37,6 +61,19 @@ export default class AsyncDataAdapter implements DataAdapter {
37
61
  * @param options - query options
38
62
  */
39
63
  private fulfillQuery;
64
+ /**
65
+ * Executes a query, retrying transient failures before giving up. The state
66
+ * stays `'active'` across retries — consumers should see "still loading",
67
+ * not "failed", until we actually stop trying. Only the final failure is
68
+ * published as `'error'` and reported through `onError`; previously that
69
+ * error was swallowed entirely (`fulfillQuery` caught it internally, so the
70
+ * `.catch(this.onError)` on its call site was unreachable) and the query
71
+ * stayed dead for the rest of the session.
72
+ * @param collectionName - name of the collection
73
+ * @param selector - query selector
74
+ * @param options - query options
75
+ */
76
+ private runQuery;
40
77
  /**
41
78
  * Notify listeners about state changes and keep the cache updated
42
79
  * @param collectionName - name of the collection
@@ -52,7 +89,7 @@ export default class AsyncDataAdapter implements DataAdapter {
52
89
  /**
53
90
  * After mutations, recompute and push updates for affected active queries
54
91
  * @param collectionName - name of the collection
55
- * @param changedItems - items that were inserted/updated/replaced/removed
92
+ * @param affectedItems - item states before and/or after the mutation
56
93
  */
57
94
  private checkQueryUpdates;
58
95
  private insert;
@@ -1,9 +1,7 @@
1
- import type { BaseItem } from './Collection';
2
- import type Collection from './Collection';
3
- import type DataAdapter from './DataAdapter';
4
- import type { CollectionBackend } from './DataAdapter';
5
- import type StorageAdapter from './types/StorageAdapter';
6
- import type Selector from './types/Selector';
1
+ import { BaseItem, default as Collection } from './Collection';
2
+ import { default as DataAdapter, CollectionBackend } from './DataAdapter';
3
+ import { default as StorageAdapter } from './types/StorageAdapter';
4
+ import { default as Selector } from './types/Selector';
7
5
  /**
8
6
  * AutoFetchDataAdapterOptions
9
7
  *
@@ -71,7 +69,7 @@ export default class AutoFetchDataAdapter implements DataAdapter {
71
69
  private idRefCounts;
72
70
  private autoloadIds;
73
71
  constructor(options: AutoFetchDataAdapterOptions);
74
- createCollectionBackend<T extends BaseItem<I>, I = any, U = T>(collection: Collection<T, I, U>, indices: string[]): CollectionBackend<T, I>;
72
+ createCollectionBackend<T extends BaseItem<I>, I = any, E extends BaseItem = T, U = E>(collection: Collection<T, I, E, U>, indices: string[]): CollectionBackend<T, I>;
75
73
  private forceRefetchAll;
76
74
  private fetchAndIngest;
77
75
  private purgeSelector;
@@ -1,6 +1,6 @@
1
- import type ReactivityAdapter from '../types/ReactivityAdapter';
2
- import type { BaseItem, FindOptions, Transform } from './types';
3
- import type { ObserveCallbacks } from './Observer';
1
+ import { default as ReactivityAdapter } from '../types/ReactivityAdapter';
2
+ import { BaseItem, FindOptions, Transform } from './types';
3
+ import { ObserveCallbacks } from './Observer';
4
4
  /**
5
5
  * Checks if the current scope is reactive, considering the provided reactivity adapter.
6
6
  * @param reactivity - The reactivity adapter or a boolean indicating whether reactivity is enabled.
@@ -15,7 +15,7 @@ export interface CursorOptions<T extends BaseItem, U = T, Async extends boolean
15
15
  * Represents a cursor for querying and observing a filtered, sorted, and transformed
16
16
  * subset of items from a collection. Supports reactivity and field tracking.
17
17
  * @template T - The type of the items in the collection.
18
- * @template U - The transformed item type after applying transformations (default is T).
18
+ * @template U - The transformed item type after applying transform (default is T).
19
19
  */
20
20
  export default class Cursor<T extends BaseItem, U = T, Async extends boolean = false> {
21
21
  private observer;
@@ -37,6 +37,7 @@ export default class Cursor<T extends BaseItem, U = T, Async extends boolean = f
37
37
  * @param options.limit - The maximum number of items to return in the result set.
38
38
  * @param options.reactive - A reactivity adapter to enable observing changes in the cursor's result set.
39
39
  * @param options.fieldTracking - A boolean to enable fine-grained field tracking for reactivity.
40
+ * @param options.transformAll - A function that will be able to solve the n+1 problem
40
41
  */
41
42
  constructor(getItems: Async extends true ? () => Promise<T[]> : () => T[], options?: CursorOptions<T, U, Async>);
42
43
  private addGetters;
@@ -102,7 +103,7 @@ export default class Cursor<T extends BaseItem, U = T, Async extends boolean = f
102
103
  * @param skipInitial - A boolean indicating whether to skip the initial notification of the current result set.
103
104
  * @returns A function to stop observing changes.
104
105
  */
105
- observeChanges(callbacks: ObserveCallbacks<U>, skipInitial?: boolean): () => void;
106
+ observeChanges(callbacks: ObserveCallbacks<T>, skipInitial?: boolean): () => void;
106
107
  /**
107
108
  * Forces the cursor to re-evaluate its result set by re-fetching items
108
109
  * from the collection. This is useful when the underlying data or query
@@ -43,8 +43,10 @@ export default class Observer<T extends {
43
43
  */
44
44
  runChecks(getItems: () => Promise<T[]> | T[]): void;
45
45
  private checkItems;
46
+ private stopped;
46
47
  /**
47
48
  * Stops the observer by unbinding all events and cleaning up resources.
49
+ * Safe to call multiple times - will only unbind once.
48
50
  */
49
51
  stop(): void;
50
52
  /**