@tanstack/db 0.5.11 → 0.5.12
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/SortedMap.cjs +40 -26
- package/dist/cjs/SortedMap.cjs.map +1 -1
- package/dist/cjs/SortedMap.d.cts +10 -15
- package/dist/cjs/collection/change-events.cjs.map +1 -1
- package/dist/cjs/collection/changes.cjs.map +1 -1
- package/dist/cjs/collection/events.cjs.map +1 -1
- package/dist/cjs/collection/events.d.cts +12 -4
- package/dist/cjs/collection/index.cjs +2 -1
- package/dist/cjs/collection/index.cjs.map +1 -1
- package/dist/cjs/collection/indexes.cjs.map +1 -1
- package/dist/cjs/collection/lifecycle.cjs.map +1 -1
- package/dist/cjs/collection/mutations.cjs +5 -2
- package/dist/cjs/collection/mutations.cjs.map +1 -1
- package/dist/cjs/collection/state.cjs +6 -5
- package/dist/cjs/collection/state.cjs.map +1 -1
- package/dist/cjs/collection/state.d.cts +4 -1
- package/dist/cjs/collection/subscription.cjs +60 -53
- package/dist/cjs/collection/subscription.cjs.map +1 -1
- package/dist/cjs/collection/subscription.d.cts +18 -4
- package/dist/cjs/collection/sync.cjs.map +1 -1
- package/dist/cjs/errors.cjs +9 -0
- package/dist/cjs/errors.cjs.map +1 -1
- package/dist/cjs/errors.d.cts +3 -0
- package/dist/cjs/event-emitter.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/indexes/auto-index.cjs.map +1 -1
- package/dist/cjs/indexes/base-index.cjs.map +1 -1
- package/dist/cjs/indexes/btree-index.cjs +8 -6
- package/dist/cjs/indexes/btree-index.cjs.map +1 -1
- package/dist/cjs/indexes/lazy-index.cjs.map +1 -1
- package/dist/cjs/indexes/reverse-index.cjs.map +1 -1
- package/dist/cjs/local-only.cjs.map +1 -1
- package/dist/cjs/local-storage.cjs.map +1 -1
- package/dist/cjs/optimistic-action.cjs.map +1 -1
- package/dist/cjs/paced-mutations.cjs.map +1 -1
- package/dist/cjs/proxy.cjs.map +1 -1
- package/dist/cjs/query/builder/functions.cjs.map +1 -1
- package/dist/cjs/query/builder/index.cjs.map +1 -1
- package/dist/cjs/query/builder/ref-proxy.cjs.map +1 -1
- package/dist/cjs/query/compiler/evaluators.cjs.map +1 -1
- package/dist/cjs/query/compiler/expressions.cjs.map +1 -1
- package/dist/cjs/query/compiler/group-by.cjs.map +1 -1
- package/dist/cjs/query/compiler/index.cjs.map +1 -1
- package/dist/cjs/query/compiler/joins.cjs.map +1 -1
- package/dist/cjs/query/compiler/order-by.cjs +91 -38
- package/dist/cjs/query/compiler/order-by.cjs.map +1 -1
- package/dist/cjs/query/compiler/order-by.d.cts +6 -2
- package/dist/cjs/query/compiler/select.cjs.map +1 -1
- package/dist/cjs/query/expression-helpers.cjs.map +1 -1
- package/dist/cjs/query/index.d.cts +1 -1
- package/dist/cjs/query/ir.cjs.map +1 -1
- package/dist/cjs/query/live/collection-config-builder.cjs.map +1 -1
- package/dist/cjs/query/live/collection-registry.cjs.map +1 -1
- package/dist/cjs/query/live/collection-subscriber.cjs +30 -15
- package/dist/cjs/query/live/collection-subscriber.cjs.map +1 -1
- package/dist/cjs/query/live/internal.cjs.map +1 -1
- package/dist/cjs/query/live-query-collection.cjs.map +1 -1
- package/dist/cjs/query/optimizer.cjs.map +1 -1
- package/dist/cjs/query/predicate-utils.cjs +19 -2
- package/dist/cjs/query/predicate-utils.cjs.map +1 -1
- package/dist/cjs/query/predicate-utils.d.cts +32 -1
- package/dist/cjs/query/subset-dedupe.cjs.map +1 -1
- package/dist/cjs/scheduler.cjs.map +1 -1
- package/dist/cjs/strategies/debounceStrategy.cjs.map +1 -1
- package/dist/cjs/strategies/queueStrategy.cjs.map +1 -1
- package/dist/cjs/strategies/throttleStrategy.cjs.map +1 -1
- package/dist/cjs/transactions.cjs.map +1 -1
- package/dist/cjs/types.d.cts +43 -5
- package/dist/cjs/utils/browser-polyfills.cjs.map +1 -1
- package/dist/cjs/utils/btree.cjs.map +1 -1
- package/dist/cjs/utils/comparison.cjs.map +1 -1
- package/dist/cjs/utils/cursor.cjs +39 -0
- package/dist/cjs/utils/cursor.cjs.map +1 -0
- package/dist/cjs/utils/cursor.d.cts +18 -0
- package/dist/cjs/utils/index-optimization.cjs.map +1 -1
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/SortedMap.d.ts +10 -15
- package/dist/esm/SortedMap.js +40 -26
- package/dist/esm/SortedMap.js.map +1 -1
- package/dist/esm/collection/change-events.js.map +1 -1
- package/dist/esm/collection/changes.js.map +1 -1
- package/dist/esm/collection/events.d.ts +12 -4
- package/dist/esm/collection/events.js.map +1 -1
- package/dist/esm/collection/index.js +2 -1
- package/dist/esm/collection/index.js.map +1 -1
- package/dist/esm/collection/indexes.js.map +1 -1
- package/dist/esm/collection/lifecycle.js.map +1 -1
- package/dist/esm/collection/mutations.js +6 -3
- package/dist/esm/collection/mutations.js.map +1 -1
- package/dist/esm/collection/state.d.ts +4 -1
- package/dist/esm/collection/state.js +6 -5
- package/dist/esm/collection/state.js.map +1 -1
- package/dist/esm/collection/subscription.d.ts +18 -4
- package/dist/esm/collection/subscription.js +61 -54
- package/dist/esm/collection/subscription.js.map +1 -1
- package/dist/esm/collection/sync.js.map +1 -1
- package/dist/esm/errors.d.ts +3 -0
- package/dist/esm/errors.js +9 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/event-emitter.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +4 -2
- package/dist/esm/indexes/auto-index.js.map +1 -1
- package/dist/esm/indexes/base-index.js.map +1 -1
- package/dist/esm/indexes/btree-index.js +8 -6
- package/dist/esm/indexes/btree-index.js.map +1 -1
- package/dist/esm/indexes/lazy-index.js.map +1 -1
- package/dist/esm/indexes/reverse-index.js.map +1 -1
- package/dist/esm/local-only.js.map +1 -1
- package/dist/esm/local-storage.js.map +1 -1
- package/dist/esm/optimistic-action.js.map +1 -1
- package/dist/esm/paced-mutations.js.map +1 -1
- package/dist/esm/proxy.js.map +1 -1
- package/dist/esm/query/builder/functions.js.map +1 -1
- package/dist/esm/query/builder/index.js.map +1 -1
- package/dist/esm/query/builder/ref-proxy.js.map +1 -1
- package/dist/esm/query/compiler/evaluators.js.map +1 -1
- package/dist/esm/query/compiler/expressions.js.map +1 -1
- package/dist/esm/query/compiler/group-by.js.map +1 -1
- package/dist/esm/query/compiler/index.js.map +1 -1
- package/dist/esm/query/compiler/joins.js.map +1 -1
- package/dist/esm/query/compiler/order-by.d.ts +6 -2
- package/dist/esm/query/compiler/order-by.js +91 -38
- package/dist/esm/query/compiler/order-by.js.map +1 -1
- package/dist/esm/query/compiler/select.js.map +1 -1
- package/dist/esm/query/expression-helpers.js.map +1 -1
- package/dist/esm/query/index.d.ts +1 -1
- package/dist/esm/query/ir.js.map +1 -1
- package/dist/esm/query/live/collection-config-builder.js.map +1 -1
- package/dist/esm/query/live/collection-registry.js.map +1 -1
- package/dist/esm/query/live/collection-subscriber.js +30 -15
- package/dist/esm/query/live/collection-subscriber.js.map +1 -1
- package/dist/esm/query/live/internal.js.map +1 -1
- package/dist/esm/query/live-query-collection.js.map +1 -1
- package/dist/esm/query/optimizer.js.map +1 -1
- package/dist/esm/query/predicate-utils.d.ts +32 -1
- package/dist/esm/query/predicate-utils.js +19 -2
- package/dist/esm/query/predicate-utils.js.map +1 -1
- package/dist/esm/query/subset-dedupe.js.map +1 -1
- package/dist/esm/scheduler.js.map +1 -1
- package/dist/esm/strategies/debounceStrategy.js.map +1 -1
- package/dist/esm/strategies/queueStrategy.js.map +1 -1
- package/dist/esm/strategies/throttleStrategy.js.map +1 -1
- package/dist/esm/transactions.js.map +1 -1
- package/dist/esm/types.d.ts +43 -5
- package/dist/esm/utils/browser-polyfills.js.map +1 -1
- package/dist/esm/utils/btree.js.map +1 -1
- package/dist/esm/utils/comparison.js.map +1 -1
- package/dist/esm/utils/cursor.d.ts +18 -0
- package/dist/esm/utils/cursor.js +39 -0
- package/dist/esm/utils/cursor.js.map +1 -0
- package/dist/esm/utils/index-optimization.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/package.json +30 -28
- package/src/SortedMap.ts +50 -31
- package/src/collection/change-events.ts +20 -20
- package/src/collection/changes.ts +12 -12
- package/src/collection/events.ts +20 -10
- package/src/collection/index.ts +47 -46
- package/src/collection/indexes.ts +14 -14
- package/src/collection/lifecycle.ts +16 -16
- package/src/collection/mutations.ts +25 -20
- package/src/collection/state.ts +43 -36
- package/src/collection/subscription.ts +114 -83
- package/src/collection/sync.ts +13 -13
- package/src/duplicate-instance-check.ts +1 -1
- package/src/errors.ts +49 -40
- package/src/event-emitter.ts +5 -5
- package/src/index.ts +21 -21
- package/src/indexes/auto-index.ts +11 -11
- package/src/indexes/base-index.ts +13 -13
- package/src/indexes/btree-index.ts +21 -17
- package/src/indexes/index-options.ts +3 -3
- package/src/indexes/lazy-index.ts +8 -8
- package/src/indexes/reverse-index.ts +5 -5
- package/src/local-only.ts +12 -12
- package/src/local-storage.ts +17 -17
- package/src/optimistic-action.ts +5 -5
- package/src/paced-mutations.ts +6 -6
- package/src/proxy.ts +43 -43
- package/src/query/builder/functions.ts +28 -28
- package/src/query/builder/index.ts +22 -22
- package/src/query/builder/ref-proxy.ts +4 -4
- package/src/query/builder/types.ts +8 -8
- package/src/query/compiler/evaluators.ts +9 -9
- package/src/query/compiler/expressions.ts +6 -6
- package/src/query/compiler/group-by.ts +24 -24
- package/src/query/compiler/index.ts +44 -44
- package/src/query/compiler/joins.ts +37 -37
- package/src/query/compiler/order-by.ts +170 -77
- package/src/query/compiler/select.ts +13 -13
- package/src/query/compiler/types.ts +2 -2
- package/src/query/expression-helpers.ts +16 -16
- package/src/query/index.ts +10 -9
- package/src/query/ir.ts +13 -13
- package/src/query/live/collection-config-builder.ts +53 -53
- package/src/query/live/collection-registry.ts +6 -6
- package/src/query/live/collection-subscriber.ts +87 -48
- package/src/query/live/internal.ts +1 -1
- package/src/query/live/types.ts +4 -4
- package/src/query/live-query-collection.ts +15 -15
- package/src/query/optimizer.ts +29 -29
- package/src/query/predicate-utils.ts +105 -50
- package/src/query/subset-dedupe.ts +6 -6
- package/src/scheduler.ts +3 -3
- package/src/strategies/debounceStrategy.ts +6 -6
- package/src/strategies/index.ts +4 -4
- package/src/strategies/queueStrategy.ts +5 -5
- package/src/strategies/throttleStrategy.ts +6 -6
- package/src/strategies/types.ts +2 -2
- package/src/transactions.ts +9 -9
- package/src/types.ts +51 -12
- package/src/utils/array-utils.ts +1 -1
- package/src/utils/browser-polyfills.ts +2 -2
- package/src/utils/btree.ts +22 -22
- package/src/utils/comparison.ts +3 -3
- package/src/utils/cursor.ts +78 -0
- package/src/utils/index-optimization.ts +14 -14
- package/src/utils.ts +4 -4
package/src/errors.ts
CHANGED
|
@@ -28,7 +28,7 @@ export class SchemaValidationError extends TanStackDBError {
|
|
|
28
28
|
message: string
|
|
29
29
|
path?: ReadonlyArray<string | number | symbol>
|
|
30
30
|
}>,
|
|
31
|
-
message?: string
|
|
31
|
+
message?: string,
|
|
32
32
|
) {
|
|
33
33
|
const defaultMessage = `${type === `insert` ? `Insert` : `Update`} validation failed: ${issues
|
|
34
34
|
.map((issue) => `\n- ${issue.message} - path: ${issue.path}`)
|
|
@@ -61,7 +61,7 @@ export class DuplicateDbInstanceError extends TanStackDBError {
|
|
|
61
61
|
`3. Clear node_modules and lockfile, then reinstall\n\n` +
|
|
62
62
|
`To temporarily disable this check (not recommended):\n` +
|
|
63
63
|
`Set environment variable: TANSTACK_DB_DISABLE_DUP_CHECK=1\n\n` +
|
|
64
|
-
`See: https://tanstack.com/db/latest/docs/troubleshooting#duplicate-instances
|
|
64
|
+
`See: https://tanstack.com/db/latest/docs/troubleshooting#duplicate-instances`,
|
|
65
65
|
)
|
|
66
66
|
this.name = `DuplicateDbInstanceError`
|
|
67
67
|
}
|
|
@@ -110,7 +110,7 @@ export class CollectionStateError extends TanStackDBError {
|
|
|
110
110
|
export class CollectionInErrorStateError extends CollectionStateError {
|
|
111
111
|
constructor(operation: string, collectionId: string) {
|
|
112
112
|
super(
|
|
113
|
-
`Cannot perform ${operation} on collection "${collectionId}" - collection is in error state. Try calling cleanup() and restarting the collection
|
|
113
|
+
`Cannot perform ${operation} on collection "${collectionId}" - collection is in error state. Try calling cleanup() and restarting the collection.`,
|
|
114
114
|
)
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -118,7 +118,7 @@ export class CollectionInErrorStateError extends CollectionStateError {
|
|
|
118
118
|
export class InvalidCollectionStatusTransitionError extends CollectionStateError {
|
|
119
119
|
constructor(from: string, to: string, collectionId: string) {
|
|
120
120
|
super(
|
|
121
|
-
`Invalid collection status transition from "${from}" to "${to}" for collection "${collectionId}"
|
|
121
|
+
`Invalid collection status transition from "${from}" to "${to}" for collection "${collectionId}"`,
|
|
122
122
|
)
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -146,7 +146,16 @@ export class CollectionOperationError extends TanStackDBError {
|
|
|
146
146
|
export class UndefinedKeyError extends CollectionOperationError {
|
|
147
147
|
constructor(item: any) {
|
|
148
148
|
super(
|
|
149
|
-
`An object was created without a defined key: ${JSON.stringify(item)}
|
|
149
|
+
`An object was created without a defined key: ${JSON.stringify(item)}`,
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export class InvalidKeyError extends CollectionOperationError {
|
|
155
|
+
constructor(key: unknown, item: unknown) {
|
|
156
|
+
const keyType = key === null ? `null` : typeof key
|
|
157
|
+
super(
|
|
158
|
+
`getKey returned an invalid key type. Expected string or number, but got ${keyType}: ${JSON.stringify(key)}. Item: ${JSON.stringify(item)}`,
|
|
150
159
|
)
|
|
151
160
|
}
|
|
152
161
|
}
|
|
@@ -154,7 +163,7 @@ export class UndefinedKeyError extends CollectionOperationError {
|
|
|
154
163
|
export class DuplicateKeyError extends CollectionOperationError {
|
|
155
164
|
constructor(key: string | number) {
|
|
156
165
|
super(
|
|
157
|
-
`Cannot insert document with ID "${key}" because it already exists in the collection
|
|
166
|
+
`Cannot insert document with ID "${key}" because it already exists in the collection`,
|
|
158
167
|
)
|
|
159
168
|
}
|
|
160
169
|
}
|
|
@@ -163,7 +172,7 @@ export class DuplicateKeySyncError extends CollectionOperationError {
|
|
|
163
172
|
constructor(
|
|
164
173
|
key: string | number,
|
|
165
174
|
collectionId: string,
|
|
166
|
-
options?: { hasCustomGetKey?: boolean; hasJoins?: boolean }
|
|
175
|
+
options?: { hasCustomGetKey?: boolean; hasJoins?: boolean },
|
|
167
176
|
) {
|
|
168
177
|
const baseMessage = `Cannot insert document with key "${key}" from sync because it already exists in the collection "${collectionId}"`
|
|
169
178
|
|
|
@@ -175,7 +184,7 @@ export class DuplicateKeySyncError extends CollectionOperationError {
|
|
|
175
184
|
`Joined queries can produce multiple rows with the same key when relationships are not 1:1. ` +
|
|
176
185
|
`Consider: (1) using a composite key in your getKey function (e.g., \`\${item.key1}-\${item.key2}\`), ` +
|
|
177
186
|
`(2) ensuring your join produces unique rows per key, or (3) removing the custom getKey ` +
|
|
178
|
-
`to use the default composite key behavior
|
|
187
|
+
`to use the default composite key behavior.`,
|
|
179
188
|
)
|
|
180
189
|
} else {
|
|
181
190
|
super(baseMessage)
|
|
@@ -198,7 +207,7 @@ export class NoKeysPassedToUpdateError extends CollectionOperationError {
|
|
|
198
207
|
export class UpdateKeyNotFoundError extends CollectionOperationError {
|
|
199
208
|
constructor(key: string | number) {
|
|
200
209
|
super(
|
|
201
|
-
`The key "${key}" was passed to update but an object for this key was not found in the collection
|
|
210
|
+
`The key "${key}" was passed to update but an object for this key was not found in the collection`,
|
|
202
211
|
)
|
|
203
212
|
}
|
|
204
213
|
}
|
|
@@ -206,7 +215,7 @@ export class UpdateKeyNotFoundError extends CollectionOperationError {
|
|
|
206
215
|
export class KeyUpdateNotAllowedError extends CollectionOperationError {
|
|
207
216
|
constructor(originalKey: string | number, newKey: string | number) {
|
|
208
217
|
super(
|
|
209
|
-
`Updating the key of an item is not allowed. Original key: "${originalKey}", Attempted new key: "${newKey}". Please delete the old item and create a new one if a key change is necessary
|
|
218
|
+
`Updating the key of an item is not allowed. Original key: "${originalKey}", Attempted new key: "${newKey}". Please delete the old item and create a new one if a key change is necessary.`,
|
|
210
219
|
)
|
|
211
220
|
}
|
|
212
221
|
}
|
|
@@ -220,7 +229,7 @@ export class NoKeysPassedToDeleteError extends CollectionOperationError {
|
|
|
220
229
|
export class DeleteKeyNotFoundError extends CollectionOperationError {
|
|
221
230
|
constructor(key: string | number) {
|
|
222
231
|
super(
|
|
223
|
-
`Collection.delete was called with key '${key}' but there is no item in the collection with this key
|
|
232
|
+
`Collection.delete was called with key '${key}' but there is no item in the collection with this key`,
|
|
224
233
|
)
|
|
225
234
|
}
|
|
226
235
|
}
|
|
@@ -236,7 +245,7 @@ export class MissingHandlerError extends TanStackDBError {
|
|
|
236
245
|
export class MissingInsertHandlerError extends MissingHandlerError {
|
|
237
246
|
constructor() {
|
|
238
247
|
super(
|
|
239
|
-
`Collection.insert called directly (not within an explicit transaction) but no 'onInsert' handler is configured
|
|
248
|
+
`Collection.insert called directly (not within an explicit transaction) but no 'onInsert' handler is configured.`,
|
|
240
249
|
)
|
|
241
250
|
}
|
|
242
251
|
}
|
|
@@ -244,7 +253,7 @@ export class MissingInsertHandlerError extends MissingHandlerError {
|
|
|
244
253
|
export class MissingUpdateHandlerError extends MissingHandlerError {
|
|
245
254
|
constructor() {
|
|
246
255
|
super(
|
|
247
|
-
`Collection.update called directly (not within an explicit transaction) but no 'onUpdate' handler is configured
|
|
256
|
+
`Collection.update called directly (not within an explicit transaction) but no 'onUpdate' handler is configured.`,
|
|
248
257
|
)
|
|
249
258
|
}
|
|
250
259
|
}
|
|
@@ -252,7 +261,7 @@ export class MissingUpdateHandlerError extends MissingHandlerError {
|
|
|
252
261
|
export class MissingDeleteHandlerError extends MissingHandlerError {
|
|
253
262
|
constructor() {
|
|
254
263
|
super(
|
|
255
|
-
`Collection.delete called directly (not within an explicit transaction) but no 'onDelete' handler is configured
|
|
264
|
+
`Collection.delete called directly (not within an explicit transaction) but no 'onDelete' handler is configured.`,
|
|
256
265
|
)
|
|
257
266
|
}
|
|
258
267
|
}
|
|
@@ -274,7 +283,7 @@ export class MissingMutationFunctionError extends TransactionError {
|
|
|
274
283
|
export class OnMutateMustBeSynchronousError extends TransactionError {
|
|
275
284
|
constructor() {
|
|
276
285
|
super(
|
|
277
|
-
`onMutate must be synchronous and cannot return a promise. Remove async/await or returned promises from onMutate
|
|
286
|
+
`onMutate must be synchronous and cannot return a promise. Remove async/await or returned promises from onMutate.`,
|
|
278
287
|
)
|
|
279
288
|
this.name = `OnMutateMustBeSynchronousError`
|
|
280
289
|
}
|
|
@@ -283,7 +292,7 @@ export class OnMutateMustBeSynchronousError extends TransactionError {
|
|
|
283
292
|
export class TransactionNotPendingMutateError extends TransactionError {
|
|
284
293
|
constructor() {
|
|
285
294
|
super(
|
|
286
|
-
`You can no longer call .mutate() as the transaction is no longer pending
|
|
295
|
+
`You can no longer call .mutate() as the transaction is no longer pending`,
|
|
287
296
|
)
|
|
288
297
|
}
|
|
289
298
|
}
|
|
@@ -291,7 +300,7 @@ export class TransactionNotPendingMutateError extends TransactionError {
|
|
|
291
300
|
export class TransactionAlreadyCompletedRollbackError extends TransactionError {
|
|
292
301
|
constructor() {
|
|
293
302
|
super(
|
|
294
|
-
`You can no longer call .rollback() as the transaction is already completed
|
|
303
|
+
`You can no longer call .rollback() as the transaction is already completed`,
|
|
295
304
|
)
|
|
296
305
|
}
|
|
297
306
|
}
|
|
@@ -299,7 +308,7 @@ export class TransactionAlreadyCompletedRollbackError extends TransactionError {
|
|
|
299
308
|
export class TransactionNotPendingCommitError extends TransactionError {
|
|
300
309
|
constructor() {
|
|
301
310
|
super(
|
|
302
|
-
`You can no longer call .commit() as the transaction is no longer pending
|
|
311
|
+
`You can no longer call .commit() as the transaction is no longer pending`,
|
|
303
312
|
)
|
|
304
313
|
}
|
|
305
314
|
}
|
|
@@ -313,7 +322,7 @@ export class NoPendingSyncTransactionWriteError extends TransactionError {
|
|
|
313
322
|
export class SyncTransactionAlreadyCommittedWriteError extends TransactionError {
|
|
314
323
|
constructor() {
|
|
315
324
|
super(
|
|
316
|
-
`The pending sync transaction is already committed, you can't still write to it
|
|
325
|
+
`The pending sync transaction is already committed, you can't still write to it.`,
|
|
317
326
|
)
|
|
318
327
|
}
|
|
319
328
|
}
|
|
@@ -327,7 +336,7 @@ export class NoPendingSyncTransactionCommitError extends TransactionError {
|
|
|
327
336
|
export class SyncTransactionAlreadyCommittedError extends TransactionError {
|
|
328
337
|
constructor() {
|
|
329
338
|
super(
|
|
330
|
-
`The pending sync transaction is already committed, you can't commit it again
|
|
339
|
+
`The pending sync transaction is already committed, you can't commit it again.`,
|
|
331
340
|
)
|
|
332
341
|
}
|
|
333
342
|
}
|
|
@@ -355,7 +364,7 @@ export class SubQueryMustHaveFromClauseError extends QueryBuilderError {
|
|
|
355
364
|
export class InvalidSourceError extends QueryBuilderError {
|
|
356
365
|
constructor(alias: string) {
|
|
357
366
|
super(
|
|
358
|
-
`Invalid source for live query: The value provided for alias "${alias}" is not a Collection or subquery. Live queries only accept Collection instances or subqueries. Please ensure you're passing a valid Collection or QueryBuilder, not a plain array or other data type
|
|
367
|
+
`Invalid source for live query: The value provided for alias "${alias}" is not a Collection or subquery. Live queries only accept Collection instances or subqueries. Please ensure you're passing a valid Collection or QueryBuilder, not a plain array or other data type.`,
|
|
359
368
|
)
|
|
360
369
|
}
|
|
361
370
|
}
|
|
@@ -364,7 +373,7 @@ export class InvalidSourceTypeError extends QueryBuilderError {
|
|
|
364
373
|
constructor(context: string, type: string) {
|
|
365
374
|
super(
|
|
366
375
|
`Invalid source for ${context}: Expected an object with a single key-value pair like { alias: collection }. ` +
|
|
367
|
-
`For example: .from({ todos: todosCollection }). Got: ${type}
|
|
376
|
+
`For example: .from({ todos: todosCollection }). Got: ${type}`,
|
|
368
377
|
)
|
|
369
378
|
}
|
|
370
379
|
}
|
|
@@ -404,7 +413,7 @@ export class HavingRequiresGroupByError extends QueryCompilationError {
|
|
|
404
413
|
export class LimitOffsetRequireOrderByError extends QueryCompilationError {
|
|
405
414
|
constructor() {
|
|
406
415
|
super(
|
|
407
|
-
`LIMIT and OFFSET require an ORDER BY clause to ensure deterministic results
|
|
416
|
+
`LIMIT and OFFSET require an ORDER BY clause to ensure deterministic results`,
|
|
408
417
|
)
|
|
409
418
|
}
|
|
410
419
|
}
|
|
@@ -417,7 +426,7 @@ export class CollectionInputNotFoundError extends QueryCompilationError {
|
|
|
417
426
|
constructor(
|
|
418
427
|
alias: string,
|
|
419
428
|
collectionId?: string,
|
|
420
|
-
availableKeys?: Array<string
|
|
429
|
+
availableKeys?: Array<string>,
|
|
421
430
|
) {
|
|
422
431
|
const details = collectionId
|
|
423
432
|
? `alias "${alias}" (collection "${collectionId}")`
|
|
@@ -440,7 +449,7 @@ export class DuplicateAliasInSubqueryError extends QueryCompilationError {
|
|
|
440
449
|
`Subquery uses alias "${alias}" which is already used in the parent query. ` +
|
|
441
450
|
`Each alias must be unique across parent and subquery contexts. ` +
|
|
442
451
|
`Parent query aliases: ${parentAliases.join(`, `)}. ` +
|
|
443
|
-
`Please rename "${alias}" in either the parent query or subquery to avoid conflicts
|
|
452
|
+
`Please rename "${alias}" in either the parent query or subquery to avoid conflicts.`,
|
|
444
453
|
)
|
|
445
454
|
}
|
|
446
455
|
}
|
|
@@ -492,7 +501,7 @@ export class UnsupportedJoinTypeError extends JoinError {
|
|
|
492
501
|
export class InvalidJoinConditionSameSourceError extends JoinError {
|
|
493
502
|
constructor(sourceAlias: string) {
|
|
494
503
|
super(
|
|
495
|
-
`Invalid join condition: both expressions refer to the same source "${sourceAlias}"
|
|
504
|
+
`Invalid join condition: both expressions refer to the same source "${sourceAlias}"`,
|
|
496
505
|
)
|
|
497
506
|
}
|
|
498
507
|
}
|
|
@@ -506,7 +515,7 @@ export class InvalidJoinConditionSourceMismatchError extends JoinError {
|
|
|
506
515
|
export class InvalidJoinConditionLeftSourceError extends JoinError {
|
|
507
516
|
constructor(sourceAlias: string) {
|
|
508
517
|
super(
|
|
509
|
-
`Invalid join condition: left expression refers to an unavailable source "${sourceAlias}"
|
|
518
|
+
`Invalid join condition: left expression refers to an unavailable source "${sourceAlias}"`,
|
|
510
519
|
)
|
|
511
520
|
}
|
|
512
521
|
}
|
|
@@ -514,7 +523,7 @@ export class InvalidJoinConditionLeftSourceError extends JoinError {
|
|
|
514
523
|
export class InvalidJoinConditionRightSourceError extends JoinError {
|
|
515
524
|
constructor(sourceAlias: string) {
|
|
516
525
|
super(
|
|
517
|
-
`Invalid join condition: right expression does not refer to the joined source "${sourceAlias}"
|
|
526
|
+
`Invalid join condition: right expression does not refer to the joined source "${sourceAlias}"`,
|
|
518
527
|
)
|
|
519
528
|
}
|
|
520
529
|
}
|
|
@@ -542,7 +551,7 @@ export class GroupByError extends TanStackDBError {
|
|
|
542
551
|
export class NonAggregateExpressionNotInGroupByError extends GroupByError {
|
|
543
552
|
constructor(alias: string) {
|
|
544
553
|
super(
|
|
545
|
-
`Non-aggregate expression '${alias}' in SELECT must also appear in GROUP BY clause
|
|
554
|
+
`Non-aggregate expression '${alias}' in SELECT must also appear in GROUP BY clause`,
|
|
546
555
|
)
|
|
547
556
|
}
|
|
548
557
|
}
|
|
@@ -556,7 +565,7 @@ export class UnsupportedAggregateFunctionError extends GroupByError {
|
|
|
556
565
|
export class AggregateFunctionNotInSelectError extends GroupByError {
|
|
557
566
|
constructor(functionName: string) {
|
|
558
567
|
super(
|
|
559
|
-
`Aggregate function in HAVING clause must also be in SELECT clause: ${functionName}
|
|
568
|
+
`Aggregate function in HAVING clause must also be in SELECT clause: ${functionName}`,
|
|
560
569
|
)
|
|
561
570
|
}
|
|
562
571
|
}
|
|
@@ -578,7 +587,7 @@ export class StorageError extends TanStackDBError {
|
|
|
578
587
|
export class SerializationError extends StorageError {
|
|
579
588
|
constructor(operation: string, originalError: string) {
|
|
580
589
|
super(
|
|
581
|
-
`Cannot ${operation} item because it cannot be JSON serialized: ${originalError}
|
|
590
|
+
`Cannot ${operation} item because it cannot be JSON serialized: ${originalError}`,
|
|
582
591
|
)
|
|
583
592
|
}
|
|
584
593
|
}
|
|
@@ -600,7 +609,7 @@ export class StorageKeyRequiredError extends LocalStorageCollectionError {
|
|
|
600
609
|
export class InvalidStorageDataFormatError extends LocalStorageCollectionError {
|
|
601
610
|
constructor(storageKey: string, key: string) {
|
|
602
611
|
super(
|
|
603
|
-
`[LocalStorageCollection] Invalid data format in storage key "${storageKey}" for key "${key}"
|
|
612
|
+
`[LocalStorageCollection] Invalid data format in storage key "${storageKey}" for key "${key}".`,
|
|
604
613
|
)
|
|
605
614
|
}
|
|
606
615
|
}
|
|
@@ -608,7 +617,7 @@ export class InvalidStorageDataFormatError extends LocalStorageCollectionError {
|
|
|
608
617
|
export class InvalidStorageObjectFormatError extends LocalStorageCollectionError {
|
|
609
618
|
constructor(storageKey: string) {
|
|
610
619
|
super(
|
|
611
|
-
`[LocalStorageCollection] Invalid data format in storage key "${storageKey}". Expected object format
|
|
620
|
+
`[LocalStorageCollection] Invalid data format in storage key "${storageKey}". Expected object format.`,
|
|
612
621
|
)
|
|
613
622
|
}
|
|
614
623
|
}
|
|
@@ -618,7 +627,7 @@ export class SyncCleanupError extends TanStackDBError {
|
|
|
618
627
|
constructor(collectionId: string, error: Error | string) {
|
|
619
628
|
const message = error instanceof Error ? error.message : String(error)
|
|
620
629
|
super(
|
|
621
|
-
`Collection "${collectionId}" sync cleanup function threw an error: ${message}
|
|
630
|
+
`Collection "${collectionId}" sync cleanup function threw an error: ${message}`,
|
|
622
631
|
)
|
|
623
632
|
this.name = `SyncCleanupError`
|
|
624
633
|
}
|
|
@@ -644,7 +653,7 @@ export class CannotCombineEmptyExpressionListError extends QueryOptimizerError {
|
|
|
644
653
|
export class WhereClauseConversionError extends QueryOptimizerError {
|
|
645
654
|
constructor(collectionId: string, alias: string) {
|
|
646
655
|
super(
|
|
647
|
-
`Failed to convert WHERE clause to collection filter for collection '${collectionId}' alias '${alias}'. This indicates a bug in the query optimization logic
|
|
656
|
+
`Failed to convert WHERE clause to collection filter for collection '${collectionId}' alias '${alias}'. This indicates a bug in the query optimization logic.`,
|
|
648
657
|
)
|
|
649
658
|
}
|
|
650
659
|
}
|
|
@@ -658,10 +667,10 @@ export class SubscriptionNotFoundError extends QueryCompilationError {
|
|
|
658
667
|
resolvedAlias: string,
|
|
659
668
|
originalAlias: string,
|
|
660
669
|
collectionId: string,
|
|
661
|
-
availableAliases: Array<string
|
|
670
|
+
availableAliases: Array<string>,
|
|
662
671
|
) {
|
|
663
672
|
super(
|
|
664
|
-
`Internal error: subscription for alias '${resolvedAlias}' (remapped from '${originalAlias}', collection '${collectionId}') is missing in join pipeline. Available aliases: ${availableAliases.join(`, `)}. This indicates a bug in alias tracking
|
|
673
|
+
`Internal error: subscription for alias '${resolvedAlias}' (remapped from '${originalAlias}', collection '${collectionId}') is missing in join pipeline. Available aliases: ${availableAliases.join(`, `)}. This indicates a bug in alias tracking.`,
|
|
665
674
|
)
|
|
666
675
|
}
|
|
667
676
|
}
|
|
@@ -672,7 +681,7 @@ export class SubscriptionNotFoundError extends QueryCompilationError {
|
|
|
672
681
|
export class AggregateNotSupportedError extends QueryCompilationError {
|
|
673
682
|
constructor() {
|
|
674
683
|
super(
|
|
675
|
-
`Aggregate expressions are not supported in this context. Use GROUP BY clause for aggregates
|
|
684
|
+
`Aggregate expressions are not supported in this context. Use GROUP BY clause for aggregates.`,
|
|
676
685
|
)
|
|
677
686
|
}
|
|
678
687
|
}
|
|
@@ -685,7 +694,7 @@ export class MissingAliasInputsError extends QueryCompilationError {
|
|
|
685
694
|
constructor(missingAliases: Array<string>) {
|
|
686
695
|
super(
|
|
687
696
|
`Internal error: compiler returned aliases without inputs: ${missingAliases.join(`, `)}. ` +
|
|
688
|
-
`This indicates a bug in query compilation. Please report this issue
|
|
697
|
+
`This indicates a bug in query compilation. Please report this issue.`,
|
|
689
698
|
)
|
|
690
699
|
}
|
|
691
700
|
}
|
|
@@ -697,7 +706,7 @@ export class SetWindowRequiresOrderByError extends QueryCompilationError {
|
|
|
697
706
|
constructor() {
|
|
698
707
|
super(
|
|
699
708
|
`setWindow() can only be called on collections with an ORDER BY clause. ` +
|
|
700
|
-
`Add .orderBy() to your query to enable window movement
|
|
709
|
+
`Add .orderBy() to your query to enable window movement.`,
|
|
701
710
|
)
|
|
702
711
|
}
|
|
703
712
|
}
|
package/src/event-emitter.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class EventEmitter<TEvents extends Record<string, any>> {
|
|
|
16
16
|
*/
|
|
17
17
|
on<T extends keyof TEvents>(
|
|
18
18
|
event: T,
|
|
19
|
-
callback: (event: TEvents[T]) => void
|
|
19
|
+
callback: (event: TEvents[T]) => void,
|
|
20
20
|
): () => void {
|
|
21
21
|
if (!this.listeners.has(event)) {
|
|
22
22
|
this.listeners.set(event, new Set())
|
|
@@ -36,7 +36,7 @@ export class EventEmitter<TEvents extends Record<string, any>> {
|
|
|
36
36
|
*/
|
|
37
37
|
once<T extends keyof TEvents>(
|
|
38
38
|
event: T,
|
|
39
|
-
callback: (event: TEvents[T]) => void
|
|
39
|
+
callback: (event: TEvents[T]) => void,
|
|
40
40
|
): () => void {
|
|
41
41
|
const unsubscribe = this.on(event, (eventPayload) => {
|
|
42
42
|
callback(eventPayload)
|
|
@@ -52,7 +52,7 @@ export class EventEmitter<TEvents extends Record<string, any>> {
|
|
|
52
52
|
*/
|
|
53
53
|
off<T extends keyof TEvents>(
|
|
54
54
|
event: T,
|
|
55
|
-
callback: (event: TEvents[T]) => void
|
|
55
|
+
callback: (event: TEvents[T]) => void,
|
|
56
56
|
): void {
|
|
57
57
|
this.listeners.get(event)?.delete(callback as (event: any) => void)
|
|
58
58
|
}
|
|
@@ -65,7 +65,7 @@ export class EventEmitter<TEvents extends Record<string, any>> {
|
|
|
65
65
|
*/
|
|
66
66
|
waitFor<T extends keyof TEvents>(
|
|
67
67
|
event: T,
|
|
68
|
-
timeout?: number
|
|
68
|
+
timeout?: number,
|
|
69
69
|
): Promise<TEvents[T]> {
|
|
70
70
|
return new Promise((resolve, reject) => {
|
|
71
71
|
let timeoutId: NodeJS.Timeout | undefined
|
|
@@ -95,7 +95,7 @@ export class EventEmitter<TEvents extends Record<string, any>> {
|
|
|
95
95
|
*/
|
|
96
96
|
protected emitInner<T extends keyof TEvents>(
|
|
97
97
|
event: T,
|
|
98
|
-
eventPayload: TEvents[T]
|
|
98
|
+
eventPayload: TEvents[T],
|
|
99
99
|
): void {
|
|
100
100
|
this.listeners.get(event)?.forEach((listener) => {
|
|
101
101
|
try {
|
package/src/index.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// Re-export all public APIs
|
|
2
2
|
// Re-export IR types under their own namespace
|
|
3
3
|
// because custom collections need access to the IR types
|
|
4
|
-
import * as IR from
|
|
4
|
+
import * as IR from './query/ir.js'
|
|
5
5
|
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export { deepEquals } from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
6
|
+
export * from './collection/index.js'
|
|
7
|
+
export * from './SortedMap'
|
|
8
|
+
export * from './transactions'
|
|
9
|
+
export * from './types'
|
|
10
|
+
export * from './proxy'
|
|
11
|
+
export * from './query/index.js'
|
|
12
|
+
export * from './optimistic-action'
|
|
13
|
+
export * from './local-only'
|
|
14
|
+
export * from './local-storage'
|
|
15
|
+
export * from './errors'
|
|
16
|
+
export { deepEquals } from './utils'
|
|
17
|
+
export * from './paced-mutations'
|
|
18
|
+
export * from './strategies/index.js'
|
|
19
19
|
|
|
20
20
|
// Index system exports
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export { type IndexOptions } from
|
|
21
|
+
export * from './indexes/base-index.js'
|
|
22
|
+
export * from './indexes/btree-index.js'
|
|
23
|
+
export * from './indexes/lazy-index.js'
|
|
24
|
+
export { type IndexOptions } from './indexes/index-options.js'
|
|
25
25
|
|
|
26
26
|
// Expression helpers
|
|
27
|
-
export * from
|
|
27
|
+
export * from './query/expression-helpers.js'
|
|
28
28
|
|
|
29
29
|
// Re-export some stuff explicitly to ensure the type & value is exported
|
|
30
|
-
export type { Collection } from
|
|
30
|
+
export type { Collection } from './collection/index.js'
|
|
31
31
|
export { IR }
|
|
32
|
-
export { operators, type OperatorName } from
|
|
32
|
+
export { operators, type OperatorName } from './query/builder/functions.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DEFAULT_COMPARE_OPTIONS } from
|
|
2
|
-
import { BTreeIndex } from
|
|
3
|
-
import type { CompareOptions } from
|
|
4
|
-
import type { BasicExpression } from
|
|
5
|
-
import type { CollectionImpl } from
|
|
1
|
+
import { DEFAULT_COMPARE_OPTIONS } from '../utils'
|
|
2
|
+
import { BTreeIndex } from './btree-index'
|
|
3
|
+
import type { CompareOptions } from '../query/builder/types'
|
|
4
|
+
import type { BasicExpression } from '../query/ir'
|
|
5
|
+
import type { CollectionImpl } from '../collection/index.js'
|
|
6
6
|
|
|
7
7
|
export interface AutoIndexConfig {
|
|
8
8
|
autoIndex?: `off` | `eager`
|
|
@@ -25,7 +25,7 @@ export function ensureIndexForField<
|
|
|
25
25
|
fieldPath: Array<string>,
|
|
26
26
|
collection: CollectionImpl<T, TKey, any, any, any>,
|
|
27
27
|
compareOptions?: CompareOptions,
|
|
28
|
-
compareFn?: (a: any, b: any) => number
|
|
28
|
+
compareFn?: (a: any, b: any) => number,
|
|
29
29
|
) {
|
|
30
30
|
if (!shouldAutoIndex(collection)) {
|
|
31
31
|
return
|
|
@@ -39,7 +39,7 @@ export function ensureIndexForField<
|
|
|
39
39
|
// Check if we already have an index for this field
|
|
40
40
|
const existingIndex = Array.from(collection.indexes.values()).find(
|
|
41
41
|
(index) =>
|
|
42
|
-
index.matchesField(fieldPath) && index.matchesCompareOptions(compareOpts)
|
|
42
|
+
index.matchesField(fieldPath) && index.matchesCompareOptions(compareOpts),
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
if (existingIndex) {
|
|
@@ -62,12 +62,12 @@ export function ensureIndexForField<
|
|
|
62
62
|
name: `auto:${fieldPath.join(`.`)}`,
|
|
63
63
|
indexType: BTreeIndex,
|
|
64
64
|
options: compareFn ? { compareFn, compareOptions: compareOpts } : {},
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
66
|
)
|
|
67
67
|
} catch (error) {
|
|
68
68
|
console.warn(
|
|
69
69
|
`${collection.id ? `[${collection.id}] ` : ``}Failed to create auto-index for field path "${fieldPath.join(`.`)}":`,
|
|
70
|
-
error
|
|
70
|
+
error,
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -80,7 +80,7 @@ export function ensureIndexForExpression<
|
|
|
80
80
|
TKey extends string | number,
|
|
81
81
|
>(
|
|
82
82
|
expression: BasicExpression,
|
|
83
|
-
collection: CollectionImpl<T, TKey, any, any, any
|
|
83
|
+
collection: CollectionImpl<T, TKey, any, any, any>,
|
|
84
84
|
): void {
|
|
85
85
|
if (!shouldAutoIndex(collection)) {
|
|
86
86
|
return
|
|
@@ -98,7 +98,7 @@ export function ensureIndexForExpression<
|
|
|
98
98
|
* Extracts all indexable expressions from a where expression
|
|
99
99
|
*/
|
|
100
100
|
function extractIndexableExpressions(
|
|
101
|
-
expression: BasicExpression
|
|
101
|
+
expression: BasicExpression,
|
|
102
102
|
): Array<{ fieldName: string; fieldPath: Array<string> }> {
|
|
103
103
|
const results: Array<{ fieldName: string; fieldPath: Array<string> }> = []
|
|
104
104
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { compileSingleRowExpression } from
|
|
2
|
-
import { comparisonFunctions } from
|
|
3
|
-
import { DEFAULT_COMPARE_OPTIONS, deepEquals } from
|
|
4
|
-
import type { RangeQueryOptions } from
|
|
5
|
-
import type { CompareOptions } from
|
|
6
|
-
import type { BasicExpression, OrderByDirection } from
|
|
1
|
+
import { compileSingleRowExpression } from '../query/compiler/evaluators.js'
|
|
2
|
+
import { comparisonFunctions } from '../query/builder/functions.js'
|
|
3
|
+
import { DEFAULT_COMPARE_OPTIONS, deepEquals } from '../utils.js'
|
|
4
|
+
import type { RangeQueryOptions } from './btree-index.js'
|
|
5
|
+
import type { CompareOptions } from '../query/builder/types.js'
|
|
6
|
+
import type { BasicExpression, OrderByDirection } from '../query/ir.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Operations that indexes can support, imported from available comparison functions
|
|
@@ -46,12 +46,12 @@ export interface IndexInterface<
|
|
|
46
46
|
take: (
|
|
47
47
|
n: number,
|
|
48
48
|
from?: TKey,
|
|
49
|
-
filterFn?: (key: TKey) => boolean
|
|
49
|
+
filterFn?: (key: TKey) => boolean,
|
|
50
50
|
) => Array<TKey>
|
|
51
51
|
takeReversed: (
|
|
52
52
|
n: number,
|
|
53
53
|
from?: TKey,
|
|
54
|
-
filterFn?: (key: TKey) => boolean
|
|
54
|
+
filterFn?: (key: TKey) => boolean,
|
|
55
55
|
) => Array<TKey>
|
|
56
56
|
|
|
57
57
|
get keyCount(): number
|
|
@@ -90,7 +90,7 @@ export abstract class BaseIndex<
|
|
|
90
90
|
id: number,
|
|
91
91
|
expression: BasicExpression,
|
|
92
92
|
name?: string,
|
|
93
|
-
options?: any
|
|
93
|
+
options?: any,
|
|
94
94
|
) {
|
|
95
95
|
this.id = id
|
|
96
96
|
this.expression = expression
|
|
@@ -109,12 +109,12 @@ export abstract class BaseIndex<
|
|
|
109
109
|
abstract take(
|
|
110
110
|
n: number,
|
|
111
111
|
from?: TKey,
|
|
112
|
-
filterFn?: (key: TKey) => boolean
|
|
112
|
+
filterFn?: (key: TKey) => boolean,
|
|
113
113
|
): Array<TKey>
|
|
114
114
|
abstract takeReversed(
|
|
115
115
|
n: number,
|
|
116
116
|
from?: TKey,
|
|
117
|
-
filterFn?: (key: TKey) => boolean
|
|
117
|
+
filterFn?: (key: TKey) => boolean,
|
|
118
118
|
): Array<TKey>
|
|
119
119
|
abstract get keyCount(): number
|
|
120
120
|
abstract equalityLookup(value: any): Set<TKey>
|
|
@@ -155,7 +155,7 @@ export abstract class BaseIndex<
|
|
|
155
155
|
|
|
156
156
|
return deepEquals(
|
|
157
157
|
thisCompareOptionsWithoutDirection,
|
|
158
|
-
compareOptionsWithoutDirection
|
|
158
|
+
compareOptionsWithoutDirection,
|
|
159
159
|
)
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -203,7 +203,7 @@ export type IndexConstructor<TKey extends string | number = string | number> =
|
|
|
203
203
|
id: number,
|
|
204
204
|
expression: BasicExpression,
|
|
205
205
|
name?: string,
|
|
206
|
-
options?: any
|
|
206
|
+
options?: any,
|
|
207
207
|
) => BaseIndex<TKey>
|
|
208
208
|
|
|
209
209
|
/**
|