@signaldb/core 2.0.0-beta.0 → 2.0.0-beta.10

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 (128) hide show
  1. package/dist/.vite/manifest.json +128 -75
  2. package/dist/AsyncDataAdapter.d.ts +44 -7
  3. package/dist/AutoFetchDataAdapter.d.ts +5 -8
  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 +36 -25
  7. package/dist/Collection/types.d.ts +10 -2
  8. package/dist/DataAdapter.d.ts +18 -11
  9. package/dist/DefaultDataAdapter.d.ts +7 -6
  10. package/dist/WorkerDataAdapter.d.ts +7 -6
  11. package/dist/WorkerDataAdapterHost.d.ts +14 -11
  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 +3 -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 -339
  26. package/dist/index13.cjs.js +45 -0
  27. package/dist/index13.mjs +44 -407
  28. package/dist/index14.cjs.js +86 -0
  29. package/dist/index14.mjs +85 -190
  30. package/dist/index15.cjs.js +15 -0
  31. package/dist/index15.mjs +14 -341
  32. package/dist/index16.cjs.js +136 -0
  33. package/dist/index16.mjs +134 -569
  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 -254
  42. package/dist/index20.cjs.js +37 -0
  43. package/dist/index20.mjs +36 -104
  44. package/dist/index21.cjs.js +35 -0
  45. package/dist/index21.mjs +34 -128
  46. package/dist/index22.cjs.js +25 -0
  47. package/dist/index22.mjs +24 -7
  48. package/dist/index23.cjs.js +19 -0
  49. package/dist/index23.mjs +17 -26
  50. package/dist/index24.cjs.js +342 -0
  51. package/dist/index24.mjs +340 -6
  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 -5
  58. package/dist/index28.cjs.js +90 -0
  59. package/dist/index28.mjs +89 -8
  60. package/dist/index29.cjs.js +424 -0
  61. package/dist/index29.mjs +423 -29
  62. package/dist/index3.cjs.js +19 -0
  63. package/dist/index3.mjs +18 -537
  64. package/dist/index30.cjs.js +72 -0
  65. package/dist/index30.mjs +71 -42
  66. package/dist/index31.cjs.js +191 -0
  67. package/dist/index31.mjs +190 -9
  68. package/dist/index32.cjs.js +21 -0
  69. package/dist/index32.mjs +21 -0
  70. package/dist/index33.cjs.js +336 -0
  71. package/dist/index33.mjs +336 -0
  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/batchOnNextTick.d.ts +16 -0
  90. package/dist/utils/createSignal.d.ts +2 -2
  91. package/dist/utils/deepClone.d.ts +1 -1
  92. package/dist/utils/getMatchingKeys.d.ts +2 -2
  93. package/dist/utils/isFieldExpression.d.ts +1 -1
  94. package/dist/utils/match.d.ts +1 -1
  95. package/dist/utils/modify.d.ts +1 -1
  96. package/dist/utils/queryId.d.ts +2 -2
  97. package/dist/utils/reactiveOrAsync.d.ts +59 -0
  98. package/package.json +3 -3
  99. package/dist/index.cjs10.js +0 -18
  100. package/dist/index.cjs11.js +0 -15
  101. package/dist/index.cjs12.js +0 -339
  102. package/dist/index.cjs13.js +0 -407
  103. package/dist/index.cjs14.js +0 -190
  104. package/dist/index.cjs15.js +0 -341
  105. package/dist/index.cjs16.js +0 -570
  106. package/dist/index.cjs17.js +0 -150
  107. package/dist/index.cjs18.js +0 -26
  108. package/dist/index.cjs19.js +0 -43
  109. package/dist/index.cjs2.js +0 -255
  110. package/dist/index.cjs20.js +0 -104
  111. package/dist/index.cjs21.js +0 -129
  112. package/dist/index.cjs22.js +0 -7
  113. package/dist/index.cjs23.js +0 -27
  114. package/dist/index.cjs24.js +0 -7
  115. package/dist/index.cjs25.js +0 -10
  116. package/dist/index.cjs26.js +0 -29
  117. package/dist/index.cjs27.js +0 -5
  118. package/dist/index.cjs28.js +0 -7
  119. package/dist/index.cjs29.js +0 -29
  120. package/dist/index.cjs3.js +0 -538
  121. package/dist/index.cjs30.js +0 -42
  122. package/dist/index.cjs31.js +0 -9
  123. package/dist/index.cjs4.js +0 -5
  124. package/dist/index.cjs5.js +0 -5
  125. package/dist/index.cjs6.js +0 -29
  126. package/dist/index.cjs7.js +0 -12
  127. package/dist/index.cjs8.js +0 -5
  128. package/dist/index.cjs9.js +0 -133
@@ -1,76 +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",
62
- "src/Collection/Cursor.ts"
67
+ "src/utils/modify.ts",
68
+ "src/utils/queryId.ts",
69
+ "src/utils/randomId.ts"
63
70
  ]
64
71
  },
65
72
  "src/DefaultDataAdapter.ts": {
66
- "file": "index.cjs12.js",
73
+ "file": "index24.cjs.js",
67
74
  "name": "DefaultDataAdapter",
68
75
  "src": "src/DefaultDataAdapter.ts",
76
+ "isDynamicEntry": true,
69
77
  "imports": [
70
78
  "src/createIndex.ts",
71
79
  "src/getIndexInfo.ts",
72
- "src/utils/deepClone.ts",
73
80
  "src/utils/EventEmitter.ts",
81
+ "src/utils/deepClone.ts",
74
82
  "src/utils/isEqual.ts",
75
83
  "src/utils/match.ts",
76
84
  "src/utils/modify.ts",
@@ -81,34 +89,39 @@
81
89
  ]
82
90
  },
83
91
  "src/WorkerDataAdapter.ts": {
84
- "file": "index.cjs14.js",
92
+ "file": "index31.cjs.js",
85
93
  "name": "WorkerDataAdapter",
86
94
  "src": "src/WorkerDataAdapter.ts",
95
+ "isDynamicEntry": true,
87
96
  "imports": [
97
+ "src/utils/batchOnNextTick.ts",
88
98
  "src/utils/queryId.ts",
89
99
  "src/utils/randomId.ts"
90
100
  ]
91
101
  },
92
102
  "src/WorkerDataAdapterHost.ts": {
93
- "file": "index.cjs15.js",
103
+ "file": "index33.cjs.js",
94
104
  "name": "WorkerDataAdapterHost",
95
105
  "src": "src/WorkerDataAdapterHost.ts",
106
+ "isDynamicEntry": true,
96
107
  "imports": [
108
+ "src/getIndexInfo.ts",
109
+ "src/utils/compact.ts",
97
110
  "src/utils/deepClone.ts",
111
+ "src/utils/getMatchingKeys.ts",
112
+ "src/utils/isEqual.ts",
98
113
  "src/utils/match.ts",
99
114
  "src/utils/modify.ts",
115
+ "src/utils/project.ts",
100
116
  "src/utils/queryId.ts",
101
- "src/utils/isEqual.ts",
102
- "src/getIndexInfo.ts",
103
- "src/utils/getMatchingKeys.ts",
104
- "src/utils/sortItems.ts",
105
- "src/utils/project.ts"
117
+ "src/utils/sortItems.ts"
106
118
  ]
107
119
  },
108
120
  "src/createIndex.ts": {
109
- "file": "index.cjs20.js",
121
+ "file": "index14.cjs.js",
110
122
  "name": "createIndex",
111
123
  "src": "src/createIndex.ts",
124
+ "isDynamicEntry": true,
112
125
  "imports": [
113
126
  "src/createIndexProvider.ts",
114
127
  "src/utils/get.ts",
@@ -117,24 +130,28 @@
117
130
  ]
118
131
  },
119
132
  "src/createIndexProvider.ts": {
120
- "file": "index.cjs27.js",
133
+ "file": "index9.cjs.js",
121
134
  "name": "createIndexProvider",
122
- "src": "src/createIndexProvider.ts"
135
+ "src": "src/createIndexProvider.ts",
136
+ "isDynamicEntry": true
123
137
  },
124
138
  "src/createReactivityAdapter.ts": {
125
- "file": "index.cjs5.js",
139
+ "file": "index27.cjs.js",
126
140
  "name": "createReactivityAdapter",
127
- "src": "src/createReactivityAdapter.ts"
141
+ "src": "src/createReactivityAdapter.ts",
142
+ "isDynamicEntry": true
128
143
  },
129
144
  "src/createStorageAdapter.ts": {
130
- "file": "index.cjs4.js",
145
+ "file": "index26.cjs.js",
131
146
  "name": "createStorageAdapter",
132
- "src": "src/createStorageAdapter.ts"
147
+ "src": "src/createStorageAdapter.ts",
148
+ "isDynamicEntry": true
133
149
  },
134
150
  "src/getIndexInfo.ts": {
135
- "file": "index.cjs21.js",
151
+ "file": "index16.cjs.js",
136
152
  "name": "getIndexInfo",
137
153
  "src": "src/getIndexInfo.ts",
154
+ "isDynamicEntry": true,
138
155
  "imports": [
139
156
  "src/utils/intersection.ts"
140
157
  ]
@@ -145,120 +162,156 @@
145
162
  "src": "src/index.ts",
146
163
  "isEntry": true,
147
164
  "imports": [
165
+ "src/AsyncDataAdapter.ts",
166
+ "src/AutoFetchDataAdapter.ts",
148
167
  "src/Collection/Cursor.ts",
149
168
  "src/Collection/index.ts",
150
- "src/createStorageAdapter.ts",
169
+ "src/DefaultDataAdapter.ts",
170
+ "src/WorkerDataAdapter.ts",
171
+ "src/WorkerDataAdapterHost.ts",
151
172
  "src/createReactivityAdapter.ts",
173
+ "src/createStorageAdapter.ts",
174
+ "src/utils/EventEmitter.ts",
175
+ "src/utils/get.ts",
152
176
  "src/utils/isEqual.ts",
153
177
  "src/utils/modify.ts",
154
178
  "src/utils/randomId.ts",
155
- "src/utils/EventEmitter.ts",
156
- "src/utils/get.ts",
157
- "src/utils/serializeValue.ts",
158
- "src/DefaultDataAdapter.ts",
159
- "src/AsyncDataAdapter.ts",
160
- "src/WorkerDataAdapter.ts",
161
- "src/WorkerDataAdapterHost.ts",
162
- "src/AutoFetchDataAdapter.ts"
179
+ "src/utils/reactiveOrAsync.ts",
180
+ "src/utils/serializeValue.ts"
163
181
  ]
164
182
  },
165
183
  "src/utils/EventEmitter.ts": {
166
- "file": "index.cjs9.js",
184
+ "file": "index6.cjs.js",
167
185
  "name": "utils/EventEmitter",
168
- "src": "src/utils/EventEmitter.ts"
186
+ "src": "src/utils/EventEmitter.ts",
187
+ "isDynamicEntry": true
188
+ },
189
+ "src/utils/batchOnNextTick.ts": {
190
+ "file": "index30.cjs.js",
191
+ "name": "utils/batchOnNextTick",
192
+ "src": "src/utils/batchOnNextTick.ts",
193
+ "isDynamicEntry": true
194
+ },
195
+ "src/utils/compact.ts": {
196
+ "file": "index32.cjs.js",
197
+ "name": "utils/compact",
198
+ "src": "src/utils/compact.ts",
199
+ "isDynamicEntry": true
169
200
  },
170
201
  "src/utils/createSignal.ts": {
171
- "file": "index.cjs18.js",
202
+ "file": "index7.cjs.js",
172
203
  "name": "utils/createSignal",
173
- "src": "src/utils/createSignal.ts"
204
+ "src": "src/utils/createSignal.ts",
205
+ "isDynamicEntry": true
174
206
  },
175
207
  "src/utils/deepClone.ts": {
176
- "file": "index.cjs19.js",
208
+ "file": "index17.cjs.js",
177
209
  "name": "utils/deepClone",
178
- "src": "src/utils/deepClone.ts"
210
+ "src": "src/utils/deepClone.ts",
211
+ "isDynamicEntry": true
179
212
  },
180
213
  "src/utils/get.ts": {
181
- "file": "index.cjs10.js",
214
+ "file": "index10.cjs.js",
182
215
  "name": "utils/get",
183
- "src": "src/utils/get.ts"
216
+ "src": "src/utils/get.ts",
217
+ "isDynamicEntry": true
184
218
  },
185
219
  "src/utils/getMatchingKeys.ts": {
186
- "file": "index.cjs26.js",
220
+ "file": "index13.cjs.js",
187
221
  "name": "utils/getMatchingKeys",
188
222
  "src": "src/utils/getMatchingKeys.ts",
223
+ "isDynamicEntry": true,
189
224
  "imports": [
190
225
  "src/utils/isFieldExpression.ts",
191
226
  "src/utils/serializeValue.ts"
192
227
  ]
193
228
  },
194
229
  "src/utils/intersection.ts": {
195
- "file": "index.cjs28.js",
230
+ "file": "index15.cjs.js",
196
231
  "name": "utils/intersection",
197
- "src": "src/utils/intersection.ts"
232
+ "src": "src/utils/intersection.ts",
233
+ "isDynamicEntry": true
198
234
  },
199
235
  "src/utils/isEqual.ts": {
200
- "file": "index.cjs6.js",
236
+ "file": "index2.cjs.js",
201
237
  "name": "utils/isEqual",
202
- "src": "src/utils/isEqual.ts"
238
+ "src": "src/utils/isEqual.ts",
239
+ "isDynamicEntry": true
203
240
  },
204
241
  "src/utils/isFieldExpression.ts": {
205
- "file": "index.cjs30.js",
242
+ "file": "index11.cjs.js",
206
243
  "name": "utils/isFieldExpression",
207
- "src": "src/utils/isFieldExpression.ts"
244
+ "src": "src/utils/isFieldExpression.ts",
245
+ "isDynamicEntry": true
208
246
  },
209
247
  "src/utils/match.ts": {
210
- "file": "index.cjs22.js",
248
+ "file": "index18.cjs.js",
211
249
  "name": "utils/match",
212
- "src": "src/utils/match.ts"
250
+ "src": "src/utils/match.ts",
251
+ "isDynamicEntry": true
213
252
  },
214
253
  "src/utils/modify.ts": {
215
- "file": "index.cjs7.js",
254
+ "file": "index19.cjs.js",
216
255
  "name": "utils/modify",
217
256
  "src": "src/utils/modify.ts",
257
+ "isDynamicEntry": true,
218
258
  "imports": [
219
259
  "src/utils/deepClone.ts"
220
260
  ]
221
261
  },
222
262
  "src/utils/project.ts": {
223
- "file": "index.cjs23.js",
263
+ "file": "index21.cjs.js",
224
264
  "name": "utils/project",
225
265
  "src": "src/utils/project.ts",
266
+ "isDynamicEntry": true,
226
267
  "imports": [
227
268
  "src/utils/get.ts",
228
269
  "src/utils/set.ts"
229
270
  ]
230
271
  },
231
272
  "src/utils/queryId.ts": {
232
- "file": "index.cjs24.js",
273
+ "file": "index22.cjs.js",
233
274
  "name": "utils/queryId",
234
- "src": "src/utils/queryId.ts"
275
+ "src": "src/utils/queryId.ts",
276
+ "isDynamicEntry": true
235
277
  },
236
278
  "src/utils/randomId.ts": {
237
- "file": "index.cjs8.js",
279
+ "file": "index8.cjs.js",
238
280
  "name": "utils/randomId",
239
- "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
240
289
  },
241
290
  "src/utils/serializeValue.ts": {
242
- "file": "index.cjs11.js",
291
+ "file": "index12.cjs.js",
243
292
  "name": "utils/serializeValue",
244
- "src": "src/utils/serializeValue.ts"
293
+ "src": "src/utils/serializeValue.ts",
294
+ "isDynamicEntry": true
245
295
  },
246
296
  "src/utils/set.ts": {
247
- "file": "index.cjs29.js",
297
+ "file": "index20.cjs.js",
248
298
  "name": "utils/set",
249
- "src": "src/utils/set.ts"
299
+ "src": "src/utils/set.ts",
300
+ "isDynamicEntry": true
250
301
  },
251
302
  "src/utils/sortItems.ts": {
252
- "file": "index.cjs25.js",
303
+ "file": "index23.cjs.js",
253
304
  "name": "utils/sortItems",
254
305
  "src": "src/utils/sortItems.ts",
306
+ "isDynamicEntry": true,
255
307
  "imports": [
256
308
  "src/utils/get.ts"
257
309
  ]
258
310
  },
259
311
  "src/utils/uniqueBy.ts": {
260
- "file": "index.cjs31.js",
312
+ "file": "index3.cjs.js",
261
313
  "name": "utils/uniqueBy",
262
- "src": "src/utils/uniqueBy.ts"
314
+ "src": "src/utils/uniqueBy.ts",
315
+ "isDynamicEntry": true
263
316
  }
264
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,8 +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>;
75
- private selectorKey;
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>;
76
73
  private forceRefetchAll;
77
74
  private fetchAndIngest;
78
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
  /**