From f8fd37f1339dff84c7608cc1263ea0154d1561c0 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Oct 2025 20:07:17 +0000 Subject: [PATCH 1/5] feat: Add QueryObserver state utilities and convert error utils to getters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds new utilities to expose TanStack Query's QueryObserver state: - isFetching: Check if query is currently fetching - isRefetching: Check if query is refetching in background - isLoading: Check if query is loading for first time - dataUpdatedAt: Timestamp of last successful data update - fetchStatus: Current fetch status ('fetching' | 'paused' | 'idle') BREAKING CHANGE: Error state utilities are now getters instead of methods: - collection.utils.lastError() → collection.utils.lastError - collection.utils.isError() → collection.utils.isError - collection.utils.errorCount() → collection.utils.errorCount --- .changeset/query-observer-state-utils.md | 55 ++++++ packages/db/src/collection/index.ts | 4 +- packages/db/src/types.ts | 4 +- packages/query-db-collection/src/query.ts | 172 ++++++++++++++---- .../query-db-collection/tests/query.test.ts | 98 +++++----- 5 files changed, 241 insertions(+), 92 deletions(-) create mode 100644 .changeset/query-observer-state-utils.md diff --git a/.changeset/query-observer-state-utils.md b/.changeset/query-observer-state-utils.md new file mode 100644 index 000000000..1d1d3996d --- /dev/null +++ b/.changeset/query-observer-state-utils.md @@ -0,0 +1,55 @@ +--- +"@tanstack/query-db-collection": minor +"@tanstack/db": patch +--- + +Add QueryObserver state utilities and convert error utils to getters + +Exposes TanStack Query's QueryObserver state through QueryCollectionUtils, providing visibility into sync status beyond just error states. Also converts existing error state utilities from methods to getters for consistency with TanStack DB/Query patterns. + +**Breaking Changes:** + +- `lastError()`, `isError()`, and `errorCount()` are now getters instead of methods + - Before: `collection.utils.lastError()` + - After: `collection.utils.lastError` + +**New Utilities:** + +- `isFetching` - Check if query is currently fetching (initial or background) +- `isRefetching` - Check if query is refetching in background +- `isLoading` - Check if query is loading for first time +- `dataUpdatedAt` - Get timestamp of last successful data update +- `fetchStatus` - Get current fetch status ('fetching' | 'paused' | 'idle') + +**Use Cases:** + +- Show loading indicators during background refetches +- Implement "Last updated X minutes ago" UI patterns +- Better understanding of query sync behavior + +**Example Usage:** + +```ts +const collection = queryCollectionOptions({ + // ... config +}) + +// Check sync status +if (collection.utils.isFetching) { + console.log("Syncing with server...") +} + +if (collection.utils.isRefetching) { + console.log("Background refresh in progress") +} + +// Show last update time +const lastUpdate = new Date(collection.utils.dataUpdatedAt) +console.log(`Last synced: ${lastUpdate.toLocaleTimeString()}`) + +// Check error state (now using getters) +if (collection.utils.isError) { + console.error("Sync failed:", collection.utils.lastError) + console.log(`Failed ${collection.utils.errorCount} times`) +} +``` diff --git a/packages/db/src/collection/index.ts b/packages/db/src/collection/index.ts index 5a4ab3c07..638c0e451 100644 --- a/packages/db/src/collection/index.ts +++ b/packages/db/src/collection/index.ts @@ -189,9 +189,9 @@ export function createCollection( options ) - // Copy utils to both top level and .utils namespace + // Attach utils to collection if (options.utils) { - collection.utils = { ...options.utils } + collection.utils = options.utils } else { collection.utils = {} } diff --git a/packages/db/src/types.ts b/packages/db/src/types.ts index 73c1fc4fe..04fadef51 100644 --- a/packages/db/src/types.ts +++ b/packages/db/src/types.ts @@ -35,9 +35,9 @@ export type TransactionState = `pending` | `persisting` | `completed` | `failed` export type Fn = (...args: Array) => any /** - * A record of utility functions that can be attached to a collection + * A record of utilities (functions or getters) that can be attached to a collection */ -export type UtilsRecord = Record +export type UtilsRecord = Record /** * diff --git a/packages/query-db-collection/src/query.ts b/packages/query-db-collection/src/query.ts index bbfd6db56..067a292cf 100644 --- a/packages/query-db-collection/src/query.ts +++ b/packages/query-db-collection/src/query.ts @@ -164,15 +164,28 @@ export interface QueryCollectionUtils< writeUpsert: (data: Partial | Array>) => void /** Execute multiple write operations as a single atomic batch to the synced data store */ writeBatch: (callback: () => void) => void + + // Query Observer State (getters) /** Get the last error encountered by the query (if any); reset on success */ - lastError: () => TError | undefined + lastError: TError | undefined /** Check if the collection is in an error state */ - isError: () => boolean + isError: boolean /** * Get the number of consecutive sync failures. * Incremented only when query fails completely (not per retry attempt); reset on success. */ - errorCount: () => number + errorCount: number + /** Check if query is currently fetching (initial or background) */ + isFetching: boolean + /** Check if query is refetching in background (not initial fetch) */ + isRefetching: boolean + /** Check if query is loading for the first time (no data yet) */ + isLoading: boolean + /** Get timestamp of last successful data update (in milliseconds) */ + dataUpdatedAt: number + /** Get current fetch status */ + fetchStatus: `fetching` | `paused` | `idle` + /** * Clear the error state and trigger a refetch of the query * @returns Promise that resolves when the refetch completes successfully @@ -286,7 +299,12 @@ export function queryCollectionOptions< schema: T select: (data: TQueryData) => Array> } -): CollectionConfig, TKey, T> & { +): CollectionConfig< + InferSchemaOutput, + TKey, + T, + QueryCollectionUtils, TKey, InferSchemaInput, TError> +> & { schema: T utils: QueryCollectionUtils< InferSchemaOutput, @@ -319,7 +337,12 @@ export function queryCollectionOptions< schema?: never // prohibit schema select: (data: TQueryData) => Array } -): CollectionConfig & { +): CollectionConfig< + T, + TKey, + never, + QueryCollectionUtils +> & { schema?: never // no schema in the result utils: QueryCollectionUtils } @@ -343,7 +366,12 @@ export function queryCollectionOptions< > & { schema: T } -): CollectionConfig, TKey, T> & { +): CollectionConfig< + InferSchemaOutput, + TKey, + T, + QueryCollectionUtils, TKey, InferSchemaInput, TError> +> & { schema: T utils: QueryCollectionUtils< InferSchemaOutput, @@ -369,14 +397,24 @@ export function queryCollectionOptions< > & { schema?: never // prohibit schema } -): CollectionConfig & { +): CollectionConfig< + T, + TKey, + never, + QueryCollectionUtils +> & { schema?: never // no schema in the result utils: QueryCollectionUtils } export function queryCollectionOptions( config: QueryCollectionConfig> -): CollectionConfig & { +): CollectionConfig< + Record, + string | number, + never, + QueryCollectionUtils +> & { utils: QueryCollectionUtils } { const { @@ -418,14 +456,15 @@ export function queryCollectionOptions( throw new GetKeyRequiredError() } - /** The last error encountered by the query */ - let lastError: any - /** The number of consecutive sync failures */ - let errorCount = 0 - /** The timestamp for when the query most recently returned the status as "error" */ - let lastErrorUpdatedAt = 0 - /** Reference to the QueryObserver for imperative refetch */ - let queryObserver: QueryObserver, any, Array, Array, any> + /** State object to hold error tracking and observer reference */ + const state = { + lastError: undefined as any, + errorCount: 0, + lastErrorUpdatedAt: 0, + queryObserver: undefined as + | QueryObserver, any, Array, Array, any> + | undefined, + } const internalSync: SyncConfig[`sync`] = (params) => { const { begin, write, commit, markReady, collection } = params @@ -459,7 +498,7 @@ export function queryCollectionOptions( >(queryClient, observerOptions) // Store reference for imperative refetch - queryObserver = localObserver + state.queryObserver = localObserver let isSubscribed = false let actualUnsubscribeFn: (() => void) | null = null @@ -468,8 +507,8 @@ export function queryCollectionOptions( const handleQueryResult: UpdateHandler = (result) => { if (result.isSuccess) { // Clear error state - lastError = undefined - errorCount = 0 + state.lastError = undefined + state.errorCount = 0 const rawData = result.data const newItemsArray = select ? select(rawData) : rawData @@ -543,10 +582,10 @@ export function queryCollectionOptions( // Mark collection as ready after first successful query result markReady() } else if (result.isError) { - if (result.errorUpdatedAt !== lastErrorUpdatedAt) { - lastError = result.error - errorCount++ - lastErrorUpdatedAt = result.errorUpdatedAt + if (result.errorUpdatedAt !== state.lastErrorUpdatedAt) { + state.lastError = result.error + state.errorCount++ + state.lastErrorUpdatedAt = result.errorUpdatedAt } console.error( @@ -622,12 +661,12 @@ export function queryCollectionOptions( */ const refetch: RefetchFn = async (opts) => { // Observer is created when sync starts. If never synced, nothing to refetch. - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!queryObserver) { + + if (!state.queryObserver) { return } // Return the QueryObserverResult for users to inspect - return queryObserver.refetch({ + return state.queryObserver.refetch({ throwOnError: opts?.throwOnError, }) } @@ -710,6 +749,73 @@ export function queryCollectionOptions( } : undefined + // Create utils object with getters using a class pattern + // This ensures proper closure and compatibility with testing frameworks like vitest + class QueryCollectionUtilsImpl { + // Write methods + public refetch: RefetchFn + public writeInsert: any + public writeUpdate: any + public writeDelete: any + public writeUpsert: any + public writeBatch: any + + constructor() { + // Initialize methods in constructor to capture correct scope + this.refetch = refetch + this.writeInsert = writeUtils.writeInsert + this.writeUpdate = writeUtils.writeUpdate + this.writeDelete = writeUtils.writeDelete + this.writeUpsert = writeUtils.writeUpsert + this.writeBatch = writeUtils.writeBatch + } + + public async clearError() { + state.lastError = undefined + state.errorCount = 0 + state.lastErrorUpdatedAt = 0 + await refetch({ throwOnError: true }) + } + + // Getters for error state + public get lastError() { + return state.lastError + } + + public get isError() { + return !!state.lastError + } + + public get errorCount() { + return state.errorCount + } + + // Getters for QueryObserver state + public get isFetching() { + return state.queryObserver?.getCurrentResult().isFetching ?? false + } + + public get isRefetching() { + return state.queryObserver?.getCurrentResult().isRefetching ?? false + } + + public get isLoading() { + return state.queryObserver?.getCurrentResult().isLoading ?? false + } + + public get dataUpdatedAt() { + return state.queryObserver?.getCurrentResult().dataUpdatedAt ?? 0 + } + + public get fetchStatus() { + return state.queryObserver?.getCurrentResult().fetchStatus ?? `idle` + } + } + + // Use class instance directly with getters + // createCollection now preserves the utils object instead of spreading it + const utils: any = new QueryCollectionUtilsImpl() + return { ...baseCollectionConfig, getKey, @@ -717,18 +823,6 @@ export function queryCollectionOptions( onInsert: wrappedOnInsert, onUpdate: wrappedOnUpdate, onDelete: wrappedOnDelete, - utils: { - refetch, - ...writeUtils, - lastError: () => lastError, - isError: () => !!lastError, - errorCount: () => errorCount, - clearError: async () => { - lastError = undefined - errorCount = 0 - lastErrorUpdatedAt = 0 - await refetch({ throwOnError: true }) - }, - }, + utils, } } diff --git a/packages/query-db-collection/tests/query.test.ts b/packages/query-db-collection/tests/query.test.ts index b3a6dd712..7d2547270 100644 --- a/packages/query-db-collection/tests/query.test.ts +++ b/packages/query-db-collection/tests/query.test.ts @@ -2097,7 +2097,7 @@ describe(`QueryCollection`, () => { const collection2 = createCollection(options2) await vi.waitFor(() => { - expect(collection1.utils.isError()).toBe(true) + expect(collection1.utils.isError).toBe(true) expect(collection2.status).toBe(`ready`) }) @@ -2134,7 +2134,7 @@ describe(`QueryCollection`, () => { ) await vi.waitFor(() => { - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.isError).toBe(true) }) await expect( @@ -2264,33 +2264,33 @@ describe(`QueryCollection`, () => { // Wait for initial success - no errors await vi.waitFor(() => { expect(collection.status).toBe(`ready`) - expect(collection.utils.lastError()).toBeUndefined() - expect(collection.utils.isError()).toBe(false) - expect(collection.utils.errorCount()).toBe(0) + expect(collection.utils.lastError).toBeUndefined() + expect(collection.utils.isError).toBe(false) + expect(collection.utils.errorCount).toBe(0) }) // First error - count increments await collection.utils.refetch() await vi.waitFor(() => { - expect(collection.utils.lastError()).toBe(errors[0]) - expect(collection.utils.errorCount()).toBe(1) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.lastError).toBe(errors[0]) + expect(collection.utils.errorCount).toBe(1) + expect(collection.utils.isError).toBe(true) }) // Second error - count increments again await collection.utils.refetch() await vi.waitFor(() => { - expect(collection.utils.lastError()).toBe(errors[1]) - expect(collection.utils.errorCount()).toBe(2) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.lastError).toBe(errors[1]) + expect(collection.utils.errorCount).toBe(2) + expect(collection.utils.isError).toBe(true) }) // Successful refetch resets error state await collection.utils.refetch() await vi.waitFor(() => { - expect(collection.utils.lastError()).toBeUndefined() - expect(collection.utils.isError()).toBe(false) - expect(collection.utils.errorCount()).toBe(0) + expect(collection.utils.lastError).toBeUndefined() + expect(collection.utils.isError).toBe(false) + expect(collection.utils.errorCount).toBe(0) expect(collection.get(`1`)).toEqual(updatedData[0]) }) }) @@ -2312,16 +2312,16 @@ describe(`QueryCollection`, () => { // Wait for initial error await vi.waitFor(() => { - expect(collection.utils.isError()).toBe(true) - expect(collection.utils.errorCount()).toBe(1) + expect(collection.utils.isError).toBe(true) + expect(collection.utils.errorCount).toBe(1) }) // Manual error clearing triggers refetch await collection.utils.clearError() - expect(collection.utils.lastError()).toBeUndefined() - expect(collection.utils.isError()).toBe(false) - expect(collection.utils.errorCount()).toBe(0) + expect(collection.utils.lastError).toBeUndefined() + expect(collection.utils.isError).toBe(false) + expect(collection.utils.errorCount).toBe(0) await vi.waitFor(() => { expect(collection.get(`1`)).toEqual(recoveryData[0]) @@ -2329,9 +2329,9 @@ describe(`QueryCollection`, () => { // Refetch on rejection should throw an error await expect(collection.utils.clearError()).rejects.toThrow(testError) - expect(collection.utils.lastError()).toBe(testError) - expect(collection.utils.isError()).toBe(true) - expect(collection.utils.errorCount()).toBe(1) + expect(collection.utils.lastError).toBe(testError) + expect(collection.utils.isError).toBe(true) + expect(collection.utils.errorCount).toBe(1) }) it(`should maintain collection functionality despite errors and persist error state`, async () => { @@ -2359,8 +2359,8 @@ describe(`QueryCollection`, () => { // Cause error await collection.utils.refetch() await vi.waitFor(() => { - expect(collection.utils.errorCount()).toBe(1) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.errorCount).toBe(1) + expect(collection.utils.isError).toBe(true) }) // Collection operations still work with cached data @@ -2377,25 +2377,25 @@ describe(`QueryCollection`, () => { await flushPromises() // Manual writes clear error state - expect(collection.utils.lastError()).toBeUndefined() - expect(collection.utils.isError()).toBe(false) - expect(collection.utils.errorCount()).toBe(0) + expect(collection.utils.lastError).toBeUndefined() + expect(collection.utils.isError).toBe(false) + expect(collection.utils.errorCount).toBe(0) // Create error state again for persistence test await collection.utils.refetch() - await vi.waitFor(() => expect(collection.utils.isError()).toBe(true)) + await vi.waitFor(() => expect(collection.utils.isError).toBe(true)) - const originalError = collection.utils.lastError() - const originalErrorCount = collection.utils.errorCount() + const originalError = collection.utils.lastError + const originalErrorCount = collection.utils.errorCount // Read-only operations don't affect error state expect(collection.has(`1`)).toBe(true) const changeHandler = vi.fn() const subscription = collection.subscribeChanges(changeHandler) - expect(collection.utils.lastError()).toBe(originalError) - expect(collection.utils.isError()).toBe(true) - expect(collection.utils.errorCount()).toBe(originalErrorCount) + expect(collection.utils.lastError).toBe(originalError) + expect(collection.utils.isError).toBe(true) + expect(collection.utils.errorCount).toBe(originalErrorCount) subscription.unsubscribe() }) @@ -2435,16 +2435,16 @@ describe(`QueryCollection`, () => { // Wait for collection to be ready (even with error) await vi.waitFor(() => { expect(collection.status).toBe(`ready`) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.isError).toBe(true) }) // Verify custom error is accessible with all its properties - const lastError = collection.utils.lastError() + const lastError = collection.utils.lastError expect(lastError).toBe(customError) expect(lastError?.code).toBe(`NETWORK_ERROR`) expect(lastError?.message).toBe(`Failed to fetch data`) expect(lastError?.details?.retryAfter).toBe(5000) - expect(collection.utils.errorCount()).toBe(1) + expect(collection.utils.errorCount).toBe(1) }) it(`should persist error state after collection cleanup`, async () => { @@ -2461,21 +2461,21 @@ describe(`QueryCollection`, () => { // Wait for collection to be ready (even with error) await vi.waitFor(() => { expect(collection.status).toBe(`ready`) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.isError).toBe(true) }) // Verify error state before cleanup - expect(collection.utils.lastError()).toBe(testError) - expect(collection.utils.errorCount()).toBe(1) + expect(collection.utils.lastError).toBe(testError) + expect(collection.utils.errorCount).toBe(1) // Cleanup collection await collection.cleanup() expect(collection.status).toBe(`cleaned-up`) // Error state should persist after cleanup - expect(collection.utils.isError()).toBe(true) - expect(collection.utils.lastError()).toBe(testError) - expect(collection.utils.errorCount()).toBe(1) + expect(collection.utils.isError).toBe(true) + expect(collection.utils.lastError).toBe(testError) + expect(collection.utils.errorCount).toBe(1) }) it(`should increment errorCount only after final failure when using Query retries`, async () => { @@ -2506,16 +2506,16 @@ describe(`QueryCollection`, () => { () => { expect(collection.status).toBe(`ready`) // Should be ready even with error expect(queryFn).toHaveBeenCalledTimes(totalAttempts) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.isError).toBe(true) }, { timeout: 2000 } ) // Error count should only increment once after all retries are exhausted // This ensures we track "consecutive post-retry failures," not per-attempt failures - expect(collection.utils.errorCount()).toBe(1) - expect(collection.utils.lastError()).toBe(testError) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.errorCount).toBe(1) + expect(collection.utils.lastError).toBe(testError) + expect(collection.utils.isError).toBe(true) // Reset attempt counter for second test queryFn.mockClear() @@ -2532,9 +2532,9 @@ describe(`QueryCollection`, () => { ) // Error count should now be 2 (two post-retry failures) - expect(collection.utils.errorCount()).toBe(2) - expect(collection.utils.lastError()).toBe(testError) - expect(collection.utils.isError()).toBe(true) + expect(collection.utils.errorCount).toBe(2) + expect(collection.utils.lastError).toBe(testError) + expect(collection.utils.isError).toBe(true) }) }) From 17adcff39fe8979dc2d4f9b5f46e910ddd3030dc Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 5 Nov 2025 08:40:38 -0700 Subject: [PATCH 2/5] refactor: Extract QueryCollectionUtilsImpl class from closure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses PR feedback from samwillis: refactor QueryCollectionUtilsImpl class to be extracted outside the function scope with required state passed through the constructor instead of relying on closure patterns. This improves code architecture by making dependencies explicit and avoiding nested class definitions within functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/query-db-collection/src/query.ts | 161 ++++++++++++---------- 1 file changed, 91 insertions(+), 70 deletions(-) diff --git a/packages/query-db-collection/src/query.ts b/packages/query-db-collection/src/query.ts index 067a292cf..2913e305c 100644 --- a/packages/query-db-collection/src/query.ts +++ b/packages/query-db-collection/src/query.ts @@ -194,6 +194,93 @@ export interface QueryCollectionUtils< clearError: () => Promise } +/** + * Internal state object for tracking query observer and errors + */ +interface QueryCollectionState { + lastError: any + errorCount: number + lastErrorUpdatedAt: number + queryObserver: + | QueryObserver, any, Array, Array, any> + | undefined +} + +/** + * Implementation class for QueryCollectionUtils that maintains proper closure + * and compatibility with testing frameworks + */ +class QueryCollectionUtilsImpl { + private state: QueryCollectionState + private refetchFn: RefetchFn + + // Write methods + public refetch: RefetchFn + public writeInsert: any + public writeUpdate: any + public writeDelete: any + public writeUpsert: any + public writeBatch: any + + constructor( + state: QueryCollectionState, + refetch: RefetchFn, + writeUtils: ReturnType + ) { + this.state = state + this.refetchFn = refetch + + // Initialize methods to use passed dependencies + this.refetch = refetch + this.writeInsert = writeUtils.writeInsert + this.writeUpdate = writeUtils.writeUpdate + this.writeDelete = writeUtils.writeDelete + this.writeUpsert = writeUtils.writeUpsert + this.writeBatch = writeUtils.writeBatch + } + + public async clearError() { + this.state.lastError = undefined + this.state.errorCount = 0 + this.state.lastErrorUpdatedAt = 0 + await this.refetchFn({ throwOnError: true }) + } + + // Getters for error state + public get lastError() { + return this.state.lastError + } + + public get isError() { + return !!this.state.lastError + } + + public get errorCount() { + return this.state.errorCount + } + + // Getters for QueryObserver state + public get isFetching() { + return this.state.queryObserver?.getCurrentResult().isFetching ?? false + } + + public get isRefetching() { + return this.state.queryObserver?.getCurrentResult().isRefetching ?? false + } + + public get isLoading() { + return this.state.queryObserver?.getCurrentResult().isLoading ?? false + } + + public get dataUpdatedAt() { + return this.state.queryObserver?.getCurrentResult().dataUpdatedAt ?? 0 + } + + public get fetchStatus() { + return this.state.queryObserver?.getCurrentResult().fetchStatus ?? `idle` + } +} + /** * Creates query collection options for use with a standard Collection. * This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -457,13 +544,11 @@ export function queryCollectionOptions( } /** State object to hold error tracking and observer reference */ - const state = { + const state: QueryCollectionState = { lastError: undefined as any, errorCount: 0, lastErrorUpdatedAt: 0, - queryObserver: undefined as - | QueryObserver, any, Array, Array, any> - | undefined, + queryObserver: undefined, } const internalSync: SyncConfig[`sync`] = (params) => { @@ -749,72 +834,8 @@ export function queryCollectionOptions( } : undefined - // Create utils object with getters using a class pattern - // This ensures proper closure and compatibility with testing frameworks like vitest - class QueryCollectionUtilsImpl { - // Write methods - public refetch: RefetchFn - public writeInsert: any - public writeUpdate: any - public writeDelete: any - public writeUpsert: any - public writeBatch: any - - constructor() { - // Initialize methods in constructor to capture correct scope - this.refetch = refetch - this.writeInsert = writeUtils.writeInsert - this.writeUpdate = writeUtils.writeUpdate - this.writeDelete = writeUtils.writeDelete - this.writeUpsert = writeUtils.writeUpsert - this.writeBatch = writeUtils.writeBatch - } - - public async clearError() { - state.lastError = undefined - state.errorCount = 0 - state.lastErrorUpdatedAt = 0 - await refetch({ throwOnError: true }) - } - - // Getters for error state - public get lastError() { - return state.lastError - } - - public get isError() { - return !!state.lastError - } - - public get errorCount() { - return state.errorCount - } - - // Getters for QueryObserver state - public get isFetching() { - return state.queryObserver?.getCurrentResult().isFetching ?? false - } - - public get isRefetching() { - return state.queryObserver?.getCurrentResult().isRefetching ?? false - } - - public get isLoading() { - return state.queryObserver?.getCurrentResult().isLoading ?? false - } - - public get dataUpdatedAt() { - return state.queryObserver?.getCurrentResult().dataUpdatedAt ?? 0 - } - - public get fetchStatus() { - return state.queryObserver?.getCurrentResult().fetchStatus ?? `idle` - } - } - - // Use class instance directly with getters - // createCollection now preserves the utils object instead of spreading it - const utils: any = new QueryCollectionUtilsImpl() + // Create utils instance with state and dependencies passed explicitly + const utils: any = new QueryCollectionUtilsImpl(state, refetch, writeUtils) return { ...baseCollectionConfig, From 06f4c19522b0c151e1dcb98487e459ee0d79d5d0 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 5 Nov 2025 08:49:26 -0700 Subject: [PATCH 3/5] chore: Update generated docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-generate documentation after QueryCollectionUtilsImpl refactoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../functions/useLiveSuspenseQuery.md | 490 +++++ docs/framework/react/reference/index.md | 1 + .../namespaces/IR/classes/Aggregate.md | 104 -- .../namespaces/IR/classes/CollectionRef.md | 98 - .../@tanstack/namespaces/IR/classes/Func.md | 104 -- .../namespaces/IR/classes/PropRef.md | 90 - .../namespaces/IR/classes/QueryRef.md | 98 - .../@tanstack/namespaces/IR/classes/Value.md | 90 - .../IR/functions/createResidualWhere.md | 24 - .../namespaces/IR/functions/followRef.md | 47 - .../IR/functions/getHavingExpression.md | 28 - .../IR/functions/getWhereExpression.md | 24 - .../IR/functions/isExpressionLike.md | 25 - .../IR/functions/isResidualWhere.md | 24 - .../@tanstack/namespaces/IR/index.md | 44 - .../namespaces/IR/interfaces/JoinClause.md | 50 - .../namespaces/IR/interfaces/QueryIR.md | 178 -- .../IR/type-aliases/BasicExpression.md | 21 - .../namespaces/IR/type-aliases/From.md | 14 - .../namespaces/IR/type-aliases/GroupBy.md | 12 - .../namespaces/IR/type-aliases/Having.md | 12 - .../namespaces/IR/type-aliases/Join.md | 12 - .../namespaces/IR/type-aliases/Limit.md | 12 - .../namespaces/IR/type-aliases/Offset.md | 12 - .../namespaces/IR/type-aliases/OrderBy.md | 12 - .../IR/type-aliases/OrderByClause.md | 32 - .../IR/type-aliases/OrderByDirection.md | 12 - .../namespaces/IR/type-aliases/Select.md | 21 - .../namespaces/IR/type-aliases/Where.md | 17 - .../AggregateFunctionNotInSelectError.md | 220 --- .../classes/AggregateNotSupportedError.md | 216 --- docs/reference/classes/BTreeIndex.md | 848 --------- docs/reference/classes/BaseIndex.md | 760 -------- docs/reference/classes/BaseQueryBuilder.md | 884 --------- .../CannotCombineEmptyExpressionListError.md | 214 --- .../classes/CollectionConfigurationError.md | 227 --- docs/reference/classes/CollectionImpl.md | 1421 --------------- .../classes/CollectionInErrorStateError.md | 224 --- .../classes/CollectionInputNotFoundError.md | 234 --- .../classes/CollectionIsInErrorStateError.md | 214 --- .../classes/CollectionOperationError.md | 232 --- .../classes/CollectionRequiresConfigError.md | 214 --- .../CollectionRequiresSyncConfigError.md | 214 --- .../reference/classes/CollectionStateError.md | 227 --- .../classes/DeleteKeyNotFoundError.md | 220 --- .../classes/DistinctRequiresSelectError.md | 214 --- .../classes/DuplicateAliasInSubqueryError.md | 228 --- .../classes/DuplicateDbInstanceError.md | 214 --- docs/reference/classes/DuplicateKeyError.md | 220 --- .../classes/DuplicateKeySyncError.md | 224 --- .../classes/EmptyReferencePathError.md | 214 --- docs/reference/classes/GroupByError.md | 227 --- .../classes/HavingRequiresGroupByError.md | 214 --- docs/reference/classes/IndexProxy.md | 346 ---- .../InvalidCollectionStatusTransitionError.md | 231 --- .../reference/classes/InvalidJoinCondition.md | 214 --- .../InvalidJoinConditionLeftSourceError.md | 220 --- .../InvalidJoinConditionRightSourceError.md | 220 --- .../InvalidJoinConditionSameSourceError.md | 220 --- ...InvalidJoinConditionSourceMismatchError.md | 214 --- docs/reference/classes/InvalidSchemaError.md | 214 --- docs/reference/classes/InvalidSourceError.md | 220 --- .../classes/InvalidStorageDataFormatError.md | 224 --- .../InvalidStorageObjectFormatError.md | 220 --- .../classes/JoinCollectionNotFoundError.md | 220 --- .../JoinConditionMustBeEqualityError.md | 214 --- docs/reference/classes/JoinError.md | 230 --- .../classes/KeyUpdateNotAllowedError.md | 224 --- docs/reference/classes/LazyIndexWrapper.md | 158 -- .../classes/LimitOffsetRequireOrderByError.md | 214 --- .../classes/LocalStorageCollectionError.md | 226 --- .../classes/MissingAliasInputsError.md | 223 --- .../classes/MissingDeleteHandlerError.md | 214 --- docs/reference/classes/MissingHandlerError.md | 226 --- .../classes/MissingInsertHandlerError.md | 214 --- .../classes/MissingMutationFunctionError.md | 214 --- .../classes/MissingUpdateArgumentError.md | 214 --- .../classes/MissingUpdateHandlerError.md | 214 --- .../classes/NegativeActiveSubscribersError.md | 214 --- .../classes/NoKeysPassedToDeleteError.md | 214 --- .../classes/NoKeysPassedToUpdateError.md | 214 --- .../NoPendingSyncTransactionCommitError.md | 214 --- .../NoPendingSyncTransactionWriteError.md | 214 --- ...NonAggregateExpressionNotInGroupByError.md | 220 --- docs/reference/classes/NonRetriableError.md | 220 --- .../classes/OnMutateMustBeSynchronousError.md | 214 --- .../classes/OnlyOneSourceAllowedError.md | 220 --- docs/reference/classes/QueryBuilderError.md | 228 --- .../classes/QueryCompilationError.md | 237 --- .../classes/QueryMustHaveFromClauseError.md | 214 --- docs/reference/classes/QueryOptimizerError.md | 225 --- .../classes/SchemaMustBeSynchronousError.md | 214 --- .../classes/SchemaValidationError.md | 251 --- docs/reference/classes/SerializationError.md | 224 --- .../classes/SetWindowRequiresOrderByError.md | 216 --- docs/reference/classes/SortedMap.md | 288 --- docs/reference/classes/StorageError.md | 225 --- .../classes/StorageKeyRequiredError.md | 214 --- .../SubQueryMustHaveFromClauseError.md | 220 --- .../classes/SubscriptionNotFoundError.md | 239 --- docs/reference/classes/SyncCleanupError.md | 224 --- .../SyncTransactionAlreadyCommittedError.md | 214 --- ...ncTransactionAlreadyCommittedWriteError.md | 214 --- docs/reference/classes/TanStackDBError.md | 254 --- ...ransactionAlreadyCompletedRollbackError.md | 214 --- docs/reference/classes/TransactionError.md | 232 --- .../TransactionNotPendingCommitError.md | 214 --- .../TransactionNotPendingMutateError.md | 214 --- docs/reference/classes/UndefinedKeyError.md | 220 --- .../classes/UnknownExpressionTypeError.md | 220 --- .../reference/classes/UnknownFunctionError.md | 220 --- .../UnknownHavingExpressionTypeError.md | 220 --- .../UnsupportedAggregateFunctionError.md | 220 --- .../classes/UnsupportedFromTypeError.md | 220 --- .../classes/UnsupportedJoinSourceTypeError.md | 220 --- .../classes/UnsupportedJoinTypeError.md | 220 --- .../classes/UpdateKeyNotFoundError.md | 220 --- .../classes/WhereClauseConversionError.md | 226 --- .../interfaces/ElectricCollectionUtils.md | 2 +- docs/reference/functions/add.md | 36 - docs/reference/functions/and.md | 57 - docs/reference/functions/avg.md | 28 - docs/reference/functions/coalesce.md | 22 - docs/reference/functions/compileQuery.md | 90 - docs/reference/functions/concat.md | 22 - docs/reference/functions/count.md | 22 - .../functions/createArrayChangeProxy.md | 50 - docs/reference/functions/createChangeProxy.md | 62 - docs/reference/functions/createCollection.md | 442 ----- .../functions/createLiveQueryCollection.md | 137 -- .../functions/createOptimisticAction.md | 90 - .../functions/createPacedMutations.md | 98 - docs/reference/functions/createTransaction.md | 87 - docs/reference/functions/debounceStrategy.md | 46 - docs/reference/functions/eq.md | 90 - .../functions/getActiveTransaction.md | 34 - docs/reference/functions/gt.md | 90 - docs/reference/functions/gte.md | 90 - docs/reference/functions/ilike.md | 26 - docs/reference/functions/inArray.md | 26 - docs/reference/functions/isNull.md | 22 - docs/reference/functions/isUndefined.md | 22 - docs/reference/functions/length.md | 28 - docs/reference/functions/like.md | 26 - .../functions/liveQueryCollectionOptions.md | 59 - .../functions/localOnlyCollectionOptions.md | 230 --- .../localStorageCollectionOptions.md | 236 --- docs/reference/functions/lower.md | 28 - docs/reference/functions/lt.md | 90 - docs/reference/functions/lte.md | 90 - docs/reference/functions/max.md | 28 - docs/reference/functions/min.md | 28 - docs/reference/functions/not.md | 22 - docs/reference/functions/or.md | 57 - docs/reference/functions/queueStrategy.md | 63 - docs/reference/functions/sum.md | 28 - docs/reference/functions/throttleStrategy.md | 65 - docs/reference/functions/upper.md | 28 - .../functions/withArrayChangeTracking.md | 41 - .../reference/functions/withChangeTracking.md | 41 - docs/reference/index.md | 253 --- .../reference/interfaces/BTreeIndexOptions.md | 44 - .../interfaces/BaseCollectionConfig.md | 412 ----- docs/reference/interfaces/BaseStrategy.md | 83 - docs/reference/interfaces/ChangeMessage.md | 72 - docs/reference/interfaces/Collection.md | 1584 ----------------- docs/reference/interfaces/CollectionConfig.md | 465 ----- docs/reference/interfaces/Context.md | 99 -- .../CreateOptimisticActionsOptions.md | 122 -- .../CurrentStateAsChangesOptions.md | 52 - docs/reference/interfaces/DebounceStrategy.md | 97 - .../interfaces/DebounceStrategyOptions.md | 47 - docs/reference/interfaces/IndexInterface.md | 458 ----- docs/reference/interfaces/IndexOptions.md | 46 - docs/reference/interfaces/IndexStats.md | 50 - docs/reference/interfaces/InsertConfig.md | 30 - .../interfaces/LiveQueryCollectionConfig.md | 172 -- .../interfaces/LocalOnlyCollectionConfig.md | 442 ----- .../interfaces/LocalOnlyCollectionUtils.md | 62 - .../LocalStorageCollectionConfig.md | 510 ------ .../interfaces/LocalStorageCollectionUtils.md | 82 - docs/reference/interfaces/OperationConfig.md | 30 - .../interfaces/OptimisticChangeMessage.md | 98 - .../interfaces/PacedMutationsConfig.md | 81 - docs/reference/interfaces/Parser.md | 48 - docs/reference/interfaces/PendingMutation.md | 157 -- docs/reference/interfaces/QueueStrategy.md | 99 -- .../interfaces/QueueStrategyOptions.md | 59 - .../reference/interfaces/RangeQueryOptions.md | 50 - .../interfaces/SubscribeChangesOptions.md | 34 - .../SubscribeChangesSnapshotOptions.md | 48 - docs/reference/interfaces/Subscription.md | 280 --- .../SubscriptionStatusChangeEvent.md | 50 - .../interfaces/SubscriptionStatusEvent.md | 56 - .../SubscriptionUnsubscribedEvent.md | 30 - docs/reference/interfaces/SyncConfig.md | 104 -- docs/reference/interfaces/ThrottleStrategy.md | 97 - .../interfaces/ThrottleStrategyOptions.md | 47 - docs/reference/interfaces/Transaction.md | 417 ----- .../reference/interfaces/TransactionConfig.md | 58 - .../classes/PowerSyncTransactor.md | 240 --- .../functions/powerSyncCollectionOptions.md | 213 --- .../powersync-db-collection/index.md | 33 - .../BasePowerSyncCollectionConfig.md | 58 - .../ConfigWithArbitraryCollectionTypes.md | 62 - .../type-aliases/ConfigWithSQLiteInputType.md | 33 - .../type-aliases/ConfigWithSQLiteTypes.md | 14 - .../type-aliases/CustomSQLiteSerializer.md | 48 - .../EnhancedPowerSyncCollectionConfig.md | 48 - .../type-aliases/InferPowerSyncOutputType.md | 26 - .../type-aliases/PowerSyncCollectionConfig.md | 51 - .../type-aliases/PowerSyncCollectionMeta.md | 66 - .../type-aliases/PowerSyncCollectionUtils.md | 34 - .../type-aliases/SerializerConfig.md | 77 - .../type-aliases/TransactorOptions.md | 22 - .../variables/DEFAULT_BATCH_SIZE.md | 14 - .../functions/queryCollectionOptions.md | 24 +- .../interfaces/QueryCollectionUtils.md | 84 +- docs/reference/type-aliases/ChangeListener.md | 68 - docs/reference/type-aliases/ChangesPayload.md | 18 - docs/reference/type-aliases/CleanupFn.md | 16 - docs/reference/type-aliases/ClearStorageFn.md | 18 - .../CollectionConfigSingleRowOption.md | 31 - .../type-aliases/CollectionStatus.md | 31 - .../type-aliases/DeleteMutationFn.md | 40 - .../type-aliases/DeleteMutationFnParams.md | 46 - docs/reference/type-aliases/Fn.md | 24 - docs/reference/type-aliases/GetResult.md | 42 - .../type-aliases/GetStorageSizeFn.md | 18 - .../type-aliases/IndexConstructor.md | 42 - docs/reference/type-aliases/IndexOperation.md | 14 - docs/reference/type-aliases/IndexResolver.md | 22 - .../reference/type-aliases/InferResultType.md | 20 - .../type-aliases/InferSchemaInput.md | 24 - .../type-aliases/InferSchemaOutput.md | 24 - .../type-aliases/InitialQueryBuilder.md | 12 - docs/reference/type-aliases/InputRow.md | 14 - .../type-aliases/InsertMutationFn.md | 40 - .../type-aliases/InsertMutationFnParams.md | 46 - .../type-aliases/KeyedNamespacedRow.md | 15 - docs/reference/type-aliases/KeyedStream.md | 15 - .../type-aliases/LiveQueryCollectionUtils.md | 78 - docs/reference/type-aliases/LoadSubsetFn.md | 22 - .../type-aliases/LoadSubsetOptions.md | 68 - .../type-aliases/MaybeSingleResult.md | 24 - docs/reference/type-aliases/MutationFn.md | 28 - .../type-aliases/MutationFnParams.md | 30 - .../type-aliases/NamespacedAndKeyedStream.md | 16 - docs/reference/type-aliases/NamespacedRow.md | 14 - docs/reference/type-aliases/NonEmptyArray.md | 20 - .../reference/type-aliases/NonSingleResult.md | 22 - docs/reference/type-aliases/OperationType.md | 12 - docs/reference/type-aliases/QueryBuilder.md | 18 - docs/reference/type-aliases/Ref.md | 39 - .../type-aliases/ResolveTransactionChanges.md | 30 - docs/reference/type-aliases/ResultStream.md | 15 - docs/reference/type-aliases/Row.md | 18 - docs/reference/type-aliases/SingleResult.md | 22 - docs/reference/type-aliases/Source.md | 29 - docs/reference/type-aliases/StandardSchema.md | 47 - .../type-aliases/StandardSchemaAlias.md | 20 - docs/reference/type-aliases/StorageApi.md | 14 - .../reference/type-aliases/StorageEventApi.md | 62 - docs/reference/type-aliases/Strategy.md | 18 - .../reference/type-aliases/StrategyOptions.md | 20 - .../type-aliases/SubscriptionEvents.md | 54 - .../type-aliases/SubscriptionStatus.md | 14 - docs/reference/type-aliases/SyncConfigRes.md | 32 - docs/reference/type-aliases/SyncMode.md | 12 - .../type-aliases/TransactionState.md | 12 - .../type-aliases/TransactionWithMutations.md | 33 - .../type-aliases/UpdateMutationFn.md | 40 - .../type-aliases/UpdateMutationFnParams.md | 46 - docs/reference/type-aliases/UtilsRecord.md | 14 - docs/reference/type-aliases/WritableDeep.md | 18 - docs/reference/variables/IndexOperation.md | 14 - docs/reference/variables/Query.md | 12 - 277 files changed, 570 insertions(+), 36613 deletions(-) create mode 100644 docs/framework/react/reference/functions/useLiveSuspenseQuery.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Func.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/PropRef.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Value.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/followRef.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/index.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/From.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md delete mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md delete mode 100644 docs/reference/classes/AggregateFunctionNotInSelectError.md delete mode 100644 docs/reference/classes/AggregateNotSupportedError.md delete mode 100644 docs/reference/classes/BTreeIndex.md delete mode 100644 docs/reference/classes/BaseIndex.md delete mode 100644 docs/reference/classes/BaseQueryBuilder.md delete mode 100644 docs/reference/classes/CannotCombineEmptyExpressionListError.md delete mode 100644 docs/reference/classes/CollectionConfigurationError.md delete mode 100644 docs/reference/classes/CollectionImpl.md delete mode 100644 docs/reference/classes/CollectionInErrorStateError.md delete mode 100644 docs/reference/classes/CollectionInputNotFoundError.md delete mode 100644 docs/reference/classes/CollectionIsInErrorStateError.md delete mode 100644 docs/reference/classes/CollectionOperationError.md delete mode 100644 docs/reference/classes/CollectionRequiresConfigError.md delete mode 100644 docs/reference/classes/CollectionRequiresSyncConfigError.md delete mode 100644 docs/reference/classes/CollectionStateError.md delete mode 100644 docs/reference/classes/DeleteKeyNotFoundError.md delete mode 100644 docs/reference/classes/DistinctRequiresSelectError.md delete mode 100644 docs/reference/classes/DuplicateAliasInSubqueryError.md delete mode 100644 docs/reference/classes/DuplicateDbInstanceError.md delete mode 100644 docs/reference/classes/DuplicateKeyError.md delete mode 100644 docs/reference/classes/DuplicateKeySyncError.md delete mode 100644 docs/reference/classes/EmptyReferencePathError.md delete mode 100644 docs/reference/classes/GroupByError.md delete mode 100644 docs/reference/classes/HavingRequiresGroupByError.md delete mode 100644 docs/reference/classes/IndexProxy.md delete mode 100644 docs/reference/classes/InvalidCollectionStatusTransitionError.md delete mode 100644 docs/reference/classes/InvalidJoinCondition.md delete mode 100644 docs/reference/classes/InvalidJoinConditionLeftSourceError.md delete mode 100644 docs/reference/classes/InvalidJoinConditionRightSourceError.md delete mode 100644 docs/reference/classes/InvalidJoinConditionSameSourceError.md delete mode 100644 docs/reference/classes/InvalidJoinConditionSourceMismatchError.md delete mode 100644 docs/reference/classes/InvalidSchemaError.md delete mode 100644 docs/reference/classes/InvalidSourceError.md delete mode 100644 docs/reference/classes/InvalidStorageDataFormatError.md delete mode 100644 docs/reference/classes/InvalidStorageObjectFormatError.md delete mode 100644 docs/reference/classes/JoinCollectionNotFoundError.md delete mode 100644 docs/reference/classes/JoinConditionMustBeEqualityError.md delete mode 100644 docs/reference/classes/JoinError.md delete mode 100644 docs/reference/classes/KeyUpdateNotAllowedError.md delete mode 100644 docs/reference/classes/LazyIndexWrapper.md delete mode 100644 docs/reference/classes/LimitOffsetRequireOrderByError.md delete mode 100644 docs/reference/classes/LocalStorageCollectionError.md delete mode 100644 docs/reference/classes/MissingAliasInputsError.md delete mode 100644 docs/reference/classes/MissingDeleteHandlerError.md delete mode 100644 docs/reference/classes/MissingHandlerError.md delete mode 100644 docs/reference/classes/MissingInsertHandlerError.md delete mode 100644 docs/reference/classes/MissingMutationFunctionError.md delete mode 100644 docs/reference/classes/MissingUpdateArgumentError.md delete mode 100644 docs/reference/classes/MissingUpdateHandlerError.md delete mode 100644 docs/reference/classes/NegativeActiveSubscribersError.md delete mode 100644 docs/reference/classes/NoKeysPassedToDeleteError.md delete mode 100644 docs/reference/classes/NoKeysPassedToUpdateError.md delete mode 100644 docs/reference/classes/NoPendingSyncTransactionCommitError.md delete mode 100644 docs/reference/classes/NoPendingSyncTransactionWriteError.md delete mode 100644 docs/reference/classes/NonAggregateExpressionNotInGroupByError.md delete mode 100644 docs/reference/classes/NonRetriableError.md delete mode 100644 docs/reference/classes/OnMutateMustBeSynchronousError.md delete mode 100644 docs/reference/classes/OnlyOneSourceAllowedError.md delete mode 100644 docs/reference/classes/QueryBuilderError.md delete mode 100644 docs/reference/classes/QueryCompilationError.md delete mode 100644 docs/reference/classes/QueryMustHaveFromClauseError.md delete mode 100644 docs/reference/classes/QueryOptimizerError.md delete mode 100644 docs/reference/classes/SchemaMustBeSynchronousError.md delete mode 100644 docs/reference/classes/SchemaValidationError.md delete mode 100644 docs/reference/classes/SerializationError.md delete mode 100644 docs/reference/classes/SetWindowRequiresOrderByError.md delete mode 100644 docs/reference/classes/SortedMap.md delete mode 100644 docs/reference/classes/StorageError.md delete mode 100644 docs/reference/classes/StorageKeyRequiredError.md delete mode 100644 docs/reference/classes/SubQueryMustHaveFromClauseError.md delete mode 100644 docs/reference/classes/SubscriptionNotFoundError.md delete mode 100644 docs/reference/classes/SyncCleanupError.md delete mode 100644 docs/reference/classes/SyncTransactionAlreadyCommittedError.md delete mode 100644 docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md delete mode 100644 docs/reference/classes/TanStackDBError.md delete mode 100644 docs/reference/classes/TransactionAlreadyCompletedRollbackError.md delete mode 100644 docs/reference/classes/TransactionError.md delete mode 100644 docs/reference/classes/TransactionNotPendingCommitError.md delete mode 100644 docs/reference/classes/TransactionNotPendingMutateError.md delete mode 100644 docs/reference/classes/UndefinedKeyError.md delete mode 100644 docs/reference/classes/UnknownExpressionTypeError.md delete mode 100644 docs/reference/classes/UnknownFunctionError.md delete mode 100644 docs/reference/classes/UnknownHavingExpressionTypeError.md delete mode 100644 docs/reference/classes/UnsupportedAggregateFunctionError.md delete mode 100644 docs/reference/classes/UnsupportedFromTypeError.md delete mode 100644 docs/reference/classes/UnsupportedJoinSourceTypeError.md delete mode 100644 docs/reference/classes/UnsupportedJoinTypeError.md delete mode 100644 docs/reference/classes/UpdateKeyNotFoundError.md delete mode 100644 docs/reference/classes/WhereClauseConversionError.md delete mode 100644 docs/reference/functions/add.md delete mode 100644 docs/reference/functions/and.md delete mode 100644 docs/reference/functions/avg.md delete mode 100644 docs/reference/functions/coalesce.md delete mode 100644 docs/reference/functions/compileQuery.md delete mode 100644 docs/reference/functions/concat.md delete mode 100644 docs/reference/functions/count.md delete mode 100644 docs/reference/functions/createArrayChangeProxy.md delete mode 100644 docs/reference/functions/createChangeProxy.md delete mode 100644 docs/reference/functions/createCollection.md delete mode 100644 docs/reference/functions/createLiveQueryCollection.md delete mode 100644 docs/reference/functions/createOptimisticAction.md delete mode 100644 docs/reference/functions/createPacedMutations.md delete mode 100644 docs/reference/functions/createTransaction.md delete mode 100644 docs/reference/functions/debounceStrategy.md delete mode 100644 docs/reference/functions/eq.md delete mode 100644 docs/reference/functions/getActiveTransaction.md delete mode 100644 docs/reference/functions/gt.md delete mode 100644 docs/reference/functions/gte.md delete mode 100644 docs/reference/functions/ilike.md delete mode 100644 docs/reference/functions/inArray.md delete mode 100644 docs/reference/functions/isNull.md delete mode 100644 docs/reference/functions/isUndefined.md delete mode 100644 docs/reference/functions/length.md delete mode 100644 docs/reference/functions/like.md delete mode 100644 docs/reference/functions/liveQueryCollectionOptions.md delete mode 100644 docs/reference/functions/localOnlyCollectionOptions.md delete mode 100644 docs/reference/functions/localStorageCollectionOptions.md delete mode 100644 docs/reference/functions/lower.md delete mode 100644 docs/reference/functions/lt.md delete mode 100644 docs/reference/functions/lte.md delete mode 100644 docs/reference/functions/max.md delete mode 100644 docs/reference/functions/min.md delete mode 100644 docs/reference/functions/not.md delete mode 100644 docs/reference/functions/or.md delete mode 100644 docs/reference/functions/queueStrategy.md delete mode 100644 docs/reference/functions/sum.md delete mode 100644 docs/reference/functions/throttleStrategy.md delete mode 100644 docs/reference/functions/upper.md delete mode 100644 docs/reference/functions/withArrayChangeTracking.md delete mode 100644 docs/reference/functions/withChangeTracking.md delete mode 100644 docs/reference/index.md delete mode 100644 docs/reference/interfaces/BTreeIndexOptions.md delete mode 100644 docs/reference/interfaces/BaseCollectionConfig.md delete mode 100644 docs/reference/interfaces/BaseStrategy.md delete mode 100644 docs/reference/interfaces/ChangeMessage.md delete mode 100644 docs/reference/interfaces/Collection.md delete mode 100644 docs/reference/interfaces/CollectionConfig.md delete mode 100644 docs/reference/interfaces/Context.md delete mode 100644 docs/reference/interfaces/CreateOptimisticActionsOptions.md delete mode 100644 docs/reference/interfaces/CurrentStateAsChangesOptions.md delete mode 100644 docs/reference/interfaces/DebounceStrategy.md delete mode 100644 docs/reference/interfaces/DebounceStrategyOptions.md delete mode 100644 docs/reference/interfaces/IndexInterface.md delete mode 100644 docs/reference/interfaces/IndexOptions.md delete mode 100644 docs/reference/interfaces/IndexStats.md delete mode 100644 docs/reference/interfaces/InsertConfig.md delete mode 100644 docs/reference/interfaces/LiveQueryCollectionConfig.md delete mode 100644 docs/reference/interfaces/LocalOnlyCollectionConfig.md delete mode 100644 docs/reference/interfaces/LocalOnlyCollectionUtils.md delete mode 100644 docs/reference/interfaces/LocalStorageCollectionConfig.md delete mode 100644 docs/reference/interfaces/LocalStorageCollectionUtils.md delete mode 100644 docs/reference/interfaces/OperationConfig.md delete mode 100644 docs/reference/interfaces/OptimisticChangeMessage.md delete mode 100644 docs/reference/interfaces/PacedMutationsConfig.md delete mode 100644 docs/reference/interfaces/Parser.md delete mode 100644 docs/reference/interfaces/PendingMutation.md delete mode 100644 docs/reference/interfaces/QueueStrategy.md delete mode 100644 docs/reference/interfaces/QueueStrategyOptions.md delete mode 100644 docs/reference/interfaces/RangeQueryOptions.md delete mode 100644 docs/reference/interfaces/SubscribeChangesOptions.md delete mode 100644 docs/reference/interfaces/SubscribeChangesSnapshotOptions.md delete mode 100644 docs/reference/interfaces/Subscription.md delete mode 100644 docs/reference/interfaces/SubscriptionStatusChangeEvent.md delete mode 100644 docs/reference/interfaces/SubscriptionStatusEvent.md delete mode 100644 docs/reference/interfaces/SubscriptionUnsubscribedEvent.md delete mode 100644 docs/reference/interfaces/SyncConfig.md delete mode 100644 docs/reference/interfaces/ThrottleStrategy.md delete mode 100644 docs/reference/interfaces/ThrottleStrategyOptions.md delete mode 100644 docs/reference/interfaces/Transaction.md delete mode 100644 docs/reference/interfaces/TransactionConfig.md delete mode 100644 docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md delete mode 100644 docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md delete mode 100644 docs/reference/powersync-db-collection/index.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md delete mode 100644 docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md delete mode 100644 docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md delete mode 100644 docs/reference/type-aliases/ChangeListener.md delete mode 100644 docs/reference/type-aliases/ChangesPayload.md delete mode 100644 docs/reference/type-aliases/CleanupFn.md delete mode 100644 docs/reference/type-aliases/ClearStorageFn.md delete mode 100644 docs/reference/type-aliases/CollectionConfigSingleRowOption.md delete mode 100644 docs/reference/type-aliases/CollectionStatus.md delete mode 100644 docs/reference/type-aliases/DeleteMutationFn.md delete mode 100644 docs/reference/type-aliases/DeleteMutationFnParams.md delete mode 100644 docs/reference/type-aliases/Fn.md delete mode 100644 docs/reference/type-aliases/GetResult.md delete mode 100644 docs/reference/type-aliases/GetStorageSizeFn.md delete mode 100644 docs/reference/type-aliases/IndexConstructor.md delete mode 100644 docs/reference/type-aliases/IndexOperation.md delete mode 100644 docs/reference/type-aliases/IndexResolver.md delete mode 100644 docs/reference/type-aliases/InferResultType.md delete mode 100644 docs/reference/type-aliases/InferSchemaInput.md delete mode 100644 docs/reference/type-aliases/InferSchemaOutput.md delete mode 100644 docs/reference/type-aliases/InitialQueryBuilder.md delete mode 100644 docs/reference/type-aliases/InputRow.md delete mode 100644 docs/reference/type-aliases/InsertMutationFn.md delete mode 100644 docs/reference/type-aliases/InsertMutationFnParams.md delete mode 100644 docs/reference/type-aliases/KeyedNamespacedRow.md delete mode 100644 docs/reference/type-aliases/KeyedStream.md delete mode 100644 docs/reference/type-aliases/LiveQueryCollectionUtils.md delete mode 100644 docs/reference/type-aliases/LoadSubsetFn.md delete mode 100644 docs/reference/type-aliases/LoadSubsetOptions.md delete mode 100644 docs/reference/type-aliases/MaybeSingleResult.md delete mode 100644 docs/reference/type-aliases/MutationFn.md delete mode 100644 docs/reference/type-aliases/MutationFnParams.md delete mode 100644 docs/reference/type-aliases/NamespacedAndKeyedStream.md delete mode 100644 docs/reference/type-aliases/NamespacedRow.md delete mode 100644 docs/reference/type-aliases/NonEmptyArray.md delete mode 100644 docs/reference/type-aliases/NonSingleResult.md delete mode 100644 docs/reference/type-aliases/OperationType.md delete mode 100644 docs/reference/type-aliases/QueryBuilder.md delete mode 100644 docs/reference/type-aliases/Ref.md delete mode 100644 docs/reference/type-aliases/ResolveTransactionChanges.md delete mode 100644 docs/reference/type-aliases/ResultStream.md delete mode 100644 docs/reference/type-aliases/Row.md delete mode 100644 docs/reference/type-aliases/SingleResult.md delete mode 100644 docs/reference/type-aliases/Source.md delete mode 100644 docs/reference/type-aliases/StandardSchema.md delete mode 100644 docs/reference/type-aliases/StandardSchemaAlias.md delete mode 100644 docs/reference/type-aliases/StorageApi.md delete mode 100644 docs/reference/type-aliases/StorageEventApi.md delete mode 100644 docs/reference/type-aliases/Strategy.md delete mode 100644 docs/reference/type-aliases/StrategyOptions.md delete mode 100644 docs/reference/type-aliases/SubscriptionEvents.md delete mode 100644 docs/reference/type-aliases/SubscriptionStatus.md delete mode 100644 docs/reference/type-aliases/SyncConfigRes.md delete mode 100644 docs/reference/type-aliases/SyncMode.md delete mode 100644 docs/reference/type-aliases/TransactionState.md delete mode 100644 docs/reference/type-aliases/TransactionWithMutations.md delete mode 100644 docs/reference/type-aliases/UpdateMutationFn.md delete mode 100644 docs/reference/type-aliases/UpdateMutationFnParams.md delete mode 100644 docs/reference/type-aliases/UtilsRecord.md delete mode 100644 docs/reference/type-aliases/WritableDeep.md delete mode 100644 docs/reference/variables/IndexOperation.md delete mode 100644 docs/reference/variables/Query.md diff --git a/docs/framework/react/reference/functions/useLiveSuspenseQuery.md b/docs/framework/react/reference/functions/useLiveSuspenseQuery.md new file mode 100644 index 000000000..679fb98fd --- /dev/null +++ b/docs/framework/react/reference/functions/useLiveSuspenseQuery.md @@ -0,0 +1,490 @@ +--- +id: useLiveSuspenseQuery +title: useLiveSuspenseQuery +--- + +# Function: useLiveSuspenseQuery() + +## Call Signature + +```ts +function useLiveSuspenseQuery(queryFn, deps?): object; +``` + +Defined in: [useLiveSuspenseQuery.ts:76](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L76) + +Create a live query with React Suspense support + +### Type Parameters + +#### TContext + +`TContext` *extends* `Context` + +### Parameters + +#### queryFn + +(`q`) => `QueryBuilder`\<`TContext`\> + +Query function that defines what data to fetch + +#### deps? + +`unknown`[] + +Array of dependencies that trigger query re-execution when changed + +### Returns + +`object` + +Object with reactive data and state - data is guaranteed to be defined + +#### collection + +```ts +collection: Collection<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }, string | number, { +}>; +``` + +#### data + +```ts +data: InferResultType; +``` + +#### state + +```ts +state: Map; +``` + +### Throws + +Promise when data is loading (caught by Suspense boundary) + +### Throws + +Error when collection fails (caught by Error boundary) + +### Examples + +```ts +// Basic usage with Suspense +function TodoList() { + const { data } = useLiveSuspenseQuery((q) => + q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.completed, false)) + .select(({ todos }) => ({ id: todos.id, text: todos.text })) + ) + + return ( +
    + {data.map(todo =>
  • {todo.text}
  • )} +
+ ) +} + +function App() { + return ( + Loading...}> + + + ) +} +``` + +```ts +// Single result query +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.id, 1)) + .findOne() +) +// data is guaranteed to be the single item (or undefined if not found) +``` + +```ts +// With dependencies that trigger re-suspension +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => gt(todos.priority, minPriority)), + [minPriority] // Re-suspends when minPriority changes +) +``` + +```ts +// With Error boundary +function App() { + return ( + Error loading data}> + Loading...}> + + + + ) +} +``` + +## Call Signature + +```ts +function useLiveSuspenseQuery(config, deps?): object; +``` + +Defined in: [useLiveSuspenseQuery.ts:86](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L86) + +Create a live query with React Suspense support + +### Type Parameters + +#### TContext + +`TContext` *extends* `Context` + +### Parameters + +#### config + +`LiveQueryCollectionConfig`\<`TContext`\> + +#### deps? + +`unknown`[] + +Array of dependencies that trigger query re-execution when changed + +### Returns + +`object` + +Object with reactive data and state - data is guaranteed to be defined + +#### collection + +```ts +collection: Collection<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }, string | number, { +}>; +``` + +#### data + +```ts +data: InferResultType; +``` + +#### state + +```ts +state: Map; +``` + +### Throws + +Promise when data is loading (caught by Suspense boundary) + +### Throws + +Error when collection fails (caught by Error boundary) + +### Examples + +```ts +// Basic usage with Suspense +function TodoList() { + const { data } = useLiveSuspenseQuery((q) => + q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.completed, false)) + .select(({ todos }) => ({ id: todos.id, text: todos.text })) + ) + + return ( +
    + {data.map(todo =>
  • {todo.text}
  • )} +
+ ) +} + +function App() { + return ( + Loading...}> + + + ) +} +``` + +```ts +// Single result query +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.id, 1)) + .findOne() +) +// data is guaranteed to be the single item (or undefined if not found) +``` + +```ts +// With dependencies that trigger re-suspension +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => gt(todos.priority, minPriority)), + [minPriority] // Re-suspends when minPriority changes +) +``` + +```ts +// With Error boundary +function App() { + return ( + Error loading data}> + Loading...}> + + + + ) +} +``` + +## Call Signature + +```ts +function useLiveSuspenseQuery(liveQueryCollection): object; +``` + +Defined in: [useLiveSuspenseQuery.ts:96](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L96) + +Create a live query with React Suspense support + +### Type Parameters + +#### TResult + +`TResult` *extends* `object` + +#### TKey + +`TKey` *extends* `string` \| `number` + +#### TUtils + +`TUtils` *extends* `Record`\<`string`, `any`\> + +### Parameters + +#### liveQueryCollection + +`Collection`\<`TResult`, `TKey`, `TUtils`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `TResult`\> & `NonSingleResult` + +### Returns + +`object` + +Object with reactive data and state - data is guaranteed to be defined + +#### collection + +```ts +collection: Collection; +``` + +#### data + +```ts +data: TResult[]; +``` + +#### state + +```ts +state: Map; +``` + +### Throws + +Promise when data is loading (caught by Suspense boundary) + +### Throws + +Error when collection fails (caught by Error boundary) + +### Examples + +```ts +// Basic usage with Suspense +function TodoList() { + const { data } = useLiveSuspenseQuery((q) => + q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.completed, false)) + .select(({ todos }) => ({ id: todos.id, text: todos.text })) + ) + + return ( +
    + {data.map(todo =>
  • {todo.text}
  • )} +
+ ) +} + +function App() { + return ( + Loading...}> + + + ) +} +``` + +```ts +// Single result query +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.id, 1)) + .findOne() +) +// data is guaranteed to be the single item (or undefined if not found) +``` + +```ts +// With dependencies that trigger re-suspension +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => gt(todos.priority, minPriority)), + [minPriority] // Re-suspends when minPriority changes +) +``` + +```ts +// With Error boundary +function App() { + return ( + Error loading data}> + Loading...}> + + + + ) +} +``` + +## Call Signature + +```ts +function useLiveSuspenseQuery(liveQueryCollection): object; +``` + +Defined in: [useLiveSuspenseQuery.ts:109](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L109) + +Create a live query with React Suspense support + +### Type Parameters + +#### TResult + +`TResult` *extends* `object` + +#### TKey + +`TKey` *extends* `string` \| `number` + +#### TUtils + +`TUtils` *extends* `Record`\<`string`, `any`\> + +### Parameters + +#### liveQueryCollection + +`Collection`\<`TResult`, `TKey`, `TUtils`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `TResult`\> & `SingleResult` + +### Returns + +`object` + +Object with reactive data and state - data is guaranteed to be defined + +#### collection + +```ts +collection: Collection, TResult> & SingleResult; +``` + +#### data + +```ts +data: TResult | undefined; +``` + +#### state + +```ts +state: Map; +``` + +### Throws + +Promise when data is loading (caught by Suspense boundary) + +### Throws + +Error when collection fails (caught by Error boundary) + +### Examples + +```ts +// Basic usage with Suspense +function TodoList() { + const { data } = useLiveSuspenseQuery((q) => + q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.completed, false)) + .select(({ todos }) => ({ id: todos.id, text: todos.text })) + ) + + return ( +
    + {data.map(todo =>
  • {todo.text}
  • )} +
+ ) +} + +function App() { + return ( + Loading...}> + + + ) +} +``` + +```ts +// Single result query +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => eq(todos.id, 1)) + .findOne() +) +// data is guaranteed to be the single item (or undefined if not found) +``` + +```ts +// With dependencies that trigger re-suspension +const { data } = useLiveSuspenseQuery( + (q) => q.from({ todos: todosCollection }) + .where(({ todos }) => gt(todos.priority, minPriority)), + [minPriority] // Re-suspends when minPriority changes +) +``` + +```ts +// With Error boundary +function App() { + return ( + Error loading data}> + Loading...}> + + + + ) +} +``` diff --git a/docs/framework/react/reference/index.md b/docs/framework/react/reference/index.md index 04dfde4ae..f60a0261c 100644 --- a/docs/framework/react/reference/index.md +++ b/docs/framework/react/reference/index.md @@ -15,4 +15,5 @@ title: "@tanstack/react-db" - [useLiveInfiniteQuery](../functions/useLiveInfiniteQuery.md) - [useLiveQuery](../functions/useLiveQuery.md) +- [useLiveSuspenseQuery](../functions/useLiveSuspenseQuery.md) - [usePacedMutations](../functions/usePacedMutations.md) diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md b/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md deleted file mode 100644 index 7a9758d72..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: Aggregate -title: Aggregate ---- - -# Class: Aggregate\ - -Defined in: [packages/db/src/query/ir.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L125) - -## Extends - -- `BaseExpression`\<`T`\> - -## Type Parameters - -### T - -`T` = `any` - -## Constructors - -### Constructor - -```ts -new Aggregate(name, args): Aggregate; -``` - -Defined in: [packages/db/src/query/ir.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L127) - -#### Parameters - -##### name - -`string` - -##### args - -[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\>[] - -#### Returns - -`Aggregate`\<`T`\> - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: T; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### args - -```ts -args: BasicExpression[]; -``` - -Defined in: [packages/db/src/query/ir.ts:129](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L129) - -*** - -### name - -```ts -name: string; -``` - -Defined in: [packages/db/src/query/ir.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L128) - -*** - -### type - -```ts -type: "agg"; -``` - -Defined in: [packages/db/src/query/ir.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L126) - -#### Overrides - -```ts -BaseExpression.type -``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md b/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md deleted file mode 100644 index 0d820a8b1..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: CollectionRef -title: CollectionRef ---- - -# Class: CollectionRef - -Defined in: [packages/db/src/query/ir.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L72) - -## Extends - -- `BaseExpression` - -## Constructors - -### Constructor - -```ts -new CollectionRef(collection, alias): CollectionRef; -``` - -Defined in: [packages/db/src/query/ir.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L74) - -#### Parameters - -##### collection - -[`CollectionImpl`](../../../../../classes/CollectionImpl.md) - -##### alias - -`string` - -#### Returns - -`CollectionRef` - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: any; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### alias - -```ts -alias: string; -``` - -Defined in: [packages/db/src/query/ir.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L76) - -*** - -### collection - -```ts -collection: CollectionImpl; -``` - -Defined in: [packages/db/src/query/ir.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L75) - -*** - -### type - -```ts -type: "collectionRef"; -``` - -Defined in: [packages/db/src/query/ir.ts:73](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L73) - -#### Overrides - -```ts -BaseExpression.type -``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Func.md b/docs/reference/@tanstack/namespaces/IR/classes/Func.md deleted file mode 100644 index 3550d8362..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/Func.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: Func -title: Func ---- - -# Class: Func\ - -Defined in: [packages/db/src/query/ir.ts:110](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L110) - -## Extends - -- `BaseExpression`\<`T`\> - -## Type Parameters - -### T - -`T` = `any` - -## Constructors - -### Constructor - -```ts -new Func(name, args): Func; -``` - -Defined in: [packages/db/src/query/ir.ts:112](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L112) - -#### Parameters - -##### name - -`string` - -##### args - -[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\>[] - -#### Returns - -`Func`\<`T`\> - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: T; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### args - -```ts -args: BasicExpression[]; -``` - -Defined in: [packages/db/src/query/ir.ts:114](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L114) - -*** - -### name - -```ts -name: string; -``` - -Defined in: [packages/db/src/query/ir.ts:113](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L113) - -*** - -### type - -```ts -type: "func"; -``` - -Defined in: [packages/db/src/query/ir.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L111) - -#### Overrides - -```ts -BaseExpression.type -``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md b/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md deleted file mode 100644 index ac7bfd418..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: PropRef -title: PropRef ---- - -# Class: PropRef\ - -Defined in: [packages/db/src/query/ir.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L92) - -## Extends - -- `BaseExpression`\<`T`\> - -## Type Parameters - -### T - -`T` = `any` - -## Constructors - -### Constructor - -```ts -new PropRef(path): PropRef; -``` - -Defined in: [packages/db/src/query/ir.ts:94](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L94) - -#### Parameters - -##### path - -`string`[] - -#### Returns - -`PropRef`\<`T`\> - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: T; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### path - -```ts -path: string[]; -``` - -Defined in: [packages/db/src/query/ir.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L95) - -*** - -### type - -```ts -type: "ref"; -``` - -Defined in: [packages/db/src/query/ir.ts:93](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L93) - -#### Overrides - -```ts -BaseExpression.type -``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md b/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md deleted file mode 100644 index 6650b0389..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: QueryRef -title: QueryRef ---- - -# Class: QueryRef - -Defined in: [packages/db/src/query/ir.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L82) - -## Extends - -- `BaseExpression` - -## Constructors - -### Constructor - -```ts -new QueryRef(query, alias): QueryRef; -``` - -Defined in: [packages/db/src/query/ir.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L84) - -#### Parameters - -##### query - -[`QueryIR`](../../interfaces/QueryIR.md) - -##### alias - -`string` - -#### Returns - -`QueryRef` - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: any; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### alias - -```ts -alias: string; -``` - -Defined in: [packages/db/src/query/ir.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L86) - -*** - -### query - -```ts -query: QueryIR; -``` - -Defined in: [packages/db/src/query/ir.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L85) - -*** - -### type - -```ts -type: "queryRef"; -``` - -Defined in: [packages/db/src/query/ir.ts:83](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L83) - -#### Overrides - -```ts -BaseExpression.type -``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Value.md b/docs/reference/@tanstack/namespaces/IR/classes/Value.md deleted file mode 100644 index 448308304..000000000 --- a/docs/reference/@tanstack/namespaces/IR/classes/Value.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: Value -title: Value ---- - -# Class: Value\ - -Defined in: [packages/db/src/query/ir.ts:101](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L101) - -## Extends - -- `BaseExpression`\<`T`\> - -## Type Parameters - -### T - -`T` = `any` - -## Constructors - -### Constructor - -```ts -new Value(value): Value; -``` - -Defined in: [packages/db/src/query/ir.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L103) - -#### Parameters - -##### value - -`T` - -#### Returns - -`Value`\<`T`\> - -#### Overrides - -```ts -BaseExpression.constructor -``` - -## Properties - -### \_\_returnType - -```ts -readonly __returnType: T; -``` - -Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) - -**`Internal`** - -- Type brand for TypeScript inference - -#### Inherited from - -```ts -BaseExpression.__returnType -``` - -*** - -### type - -```ts -type: "val"; -``` - -Defined in: [packages/db/src/query/ir.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L102) - -#### Overrides - -```ts -BaseExpression.type -``` - -*** - -### value - -```ts -value: T; -``` - -Defined in: [packages/db/src/query/ir.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L104) diff --git a/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md b/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md deleted file mode 100644 index 05ed3ea3d..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: createResidualWhere -title: createResidualWhere ---- - -# Function: createResidualWhere() - -```ts -function createResidualWhere(expression): Where; -``` - -Defined in: [packages/db/src/query/ir.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L187) - -Create a residual Where clause from an expression - -## Parameters - -### expression - -[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`boolean`\> - -## Returns - -[`Where`](../../type-aliases/Where.md) diff --git a/docs/reference/@tanstack/namespaces/IR/functions/followRef.md b/docs/reference/@tanstack/namespaces/IR/functions/followRef.md deleted file mode 100644 index 8b1fca465..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/followRef.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -id: followRef -title: followRef ---- - -# Function: followRef() - -```ts -function followRef( - query, - ref, - collection): - | void - | { - collection: Collection; - path: string[]; -}; -``` - -Defined in: [packages/db/src/query/ir.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L213) - -Follows the given reference in a query -until its finds the root field the reference points to. - -## Parameters - -### query - -[`QueryIR`](../../interfaces/QueryIR.md) - -### ref - -[`PropRef`](../../classes/PropRef.md)\<`any`\> - -### collection - -[`Collection`](../../../../../interfaces/Collection.md) - -## Returns - - \| `void` - \| \{ - `collection`: [`Collection`](../../../../../interfaces/Collection.md); - `path`: `string`[]; -\} - -The collection, its alias, and the path to the root field in this collection diff --git a/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md b/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md deleted file mode 100644 index 0fe5ee30c..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: getHavingExpression -title: getHavingExpression ---- - -# Function: getHavingExpression() - -```ts -function getHavingExpression(having): - | Aggregate -| BasicExpression; -``` - -Defined in: [packages/db/src/query/ir.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L165) - -Extract the expression from a HAVING clause -HAVING clauses can contain aggregates, unlike regular WHERE clauses - -## Parameters - -### having - -[`Where`](../../type-aliases/Where.md) - -## Returns - - \| [`Aggregate`](../../classes/Aggregate.md)\<`any`\> - \| [`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\> diff --git a/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md b/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md deleted file mode 100644 index fbc8b9808..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: getWhereExpression -title: getWhereExpression ---- - -# Function: getWhereExpression() - -```ts -function getWhereExpression(where): BasicExpression; -``` - -Defined in: [packages/db/src/query/ir.ts:155](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L155) - -Extract the expression from a Where clause - -## Parameters - -### where - -[`Where`](../../type-aliases/Where.md) - -## Returns - -[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md b/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md deleted file mode 100644 index a9e580e1a..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -id: isExpressionLike -title: isExpressionLike ---- - -# Function: isExpressionLike() - -```ts -function isExpressionLike(value): boolean; -``` - -Defined in: [packages/db/src/query/ir.ts:139](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L139) - -Runtime helper to detect IR expression-like objects. -Prefer this over ad-hoc local implementations to keep behavior consistent. - -## Parameters - -### value - -`any` - -## Returns - -`boolean` diff --git a/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md b/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md deleted file mode 100644 index 3b433feff..000000000 --- a/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: isResidualWhere -title: isResidualWhere ---- - -# Function: isResidualWhere() - -```ts -function isResidualWhere(where): boolean; -``` - -Defined in: [packages/db/src/query/ir.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L176) - -Check if a Where clause is marked as residual - -## Parameters - -### where - -[`Where`](../../type-aliases/Where.md) - -## Returns - -`boolean` diff --git a/docs/reference/@tanstack/namespaces/IR/index.md b/docs/reference/@tanstack/namespaces/IR/index.md deleted file mode 100644 index e1937961e..000000000 --- a/docs/reference/@tanstack/namespaces/IR/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -id: IR -title: IR ---- - -# IR - -## Classes - -- [Aggregate](../classes/Aggregate.md) -- [CollectionRef](../classes/CollectionRef.md) -- [Func](../classes/Func.md) -- [PropRef](../classes/PropRef.md) -- [QueryRef](../classes/QueryRef.md) -- [Value](../classes/Value.md) - -## Interfaces - -- [JoinClause](../interfaces/JoinClause.md) -- [QueryIR](../interfaces/QueryIR.md) - -## Type Aliases - -- [BasicExpression](../type-aliases/BasicExpression.md) -- [From](../type-aliases/From.md) -- [GroupBy](../type-aliases/GroupBy.md) -- [Having](../type-aliases/Having.md) -- [Join](../type-aliases/Join.md) -- [Limit](../type-aliases/Limit.md) -- [Offset](../type-aliases/Offset.md) -- [OrderBy](../type-aliases/OrderBy.md) -- [OrderByClause](../type-aliases/OrderByClause.md) -- [OrderByDirection](../type-aliases/OrderByDirection.md) -- [Select](../type-aliases/Select.md) -- [Where](../type-aliases/Where.md) - -## Functions - -- [createResidualWhere](../functions/createResidualWhere.md) -- [followRef](../functions/followRef.md) -- [getHavingExpression](../functions/getHavingExpression.md) -- [getWhereExpression](../functions/getWhereExpression.md) -- [isExpressionLike](../functions/isExpressionLike.md) -- [isResidualWhere](../functions/isResidualWhere.md) diff --git a/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md b/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md deleted file mode 100644 index 0ba211c77..000000000 --- a/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: JoinClause -title: JoinClause ---- - -# Interface: JoinClause - -Defined in: [packages/db/src/query/ir.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L36) - -## Properties - -### from - -```ts -from: - | CollectionRef - | QueryRef; -``` - -Defined in: [packages/db/src/query/ir.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L37) - -*** - -### left - -```ts -left: BasicExpression; -``` - -Defined in: [packages/db/src/query/ir.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L39) - -*** - -### right - -```ts -right: BasicExpression; -``` - -Defined in: [packages/db/src/query/ir.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L40) - -*** - -### type - -```ts -type: "inner" | "left" | "right" | "full" | "outer" | "cross"; -``` - -Defined in: [packages/db/src/query/ir.ts:38](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L38) diff --git a/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md b/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md deleted file mode 100644 index 835f2b562..000000000 --- a/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -id: QueryIR -title: QueryIR ---- - -# Interface: QueryIR - -Defined in: [packages/db/src/query/ir.ts:9](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L9) - -## Properties - -### distinct? - -```ts -optional distinct: true; -``` - -Defined in: [packages/db/src/query/ir.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L19) - -*** - -### fnHaving? - -```ts -optional fnHaving: (row) => any[]; -``` - -Defined in: [packages/db/src/query/ir.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L25) - -#### Parameters - -##### row - -[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) - -#### Returns - -`any` - -*** - -### fnSelect()? - -```ts -optional fnSelect: (row) => any; -``` - -Defined in: [packages/db/src/query/ir.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L23) - -#### Parameters - -##### row - -[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) - -#### Returns - -`any` - -*** - -### fnWhere? - -```ts -optional fnWhere: (row) => any[]; -``` - -Defined in: [packages/db/src/query/ir.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L24) - -#### Parameters - -##### row - -[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) - -#### Returns - -`any` - -*** - -### from - -```ts -from: From; -``` - -Defined in: [packages/db/src/query/ir.ts:10](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L10) - -*** - -### groupBy? - -```ts -optional groupBy: GroupBy; -``` - -Defined in: [packages/db/src/query/ir.ts:14](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L14) - -*** - -### having? - -```ts -optional having: Where[]; -``` - -Defined in: [packages/db/src/query/ir.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L15) - -*** - -### join? - -```ts -optional join: Join; -``` - -Defined in: [packages/db/src/query/ir.ts:12](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L12) - -*** - -### limit? - -```ts -optional limit: number; -``` - -Defined in: [packages/db/src/query/ir.ts:17](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L17) - -*** - -### offset? - -```ts -optional offset: number; -``` - -Defined in: [packages/db/src/query/ir.ts:18](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L18) - -*** - -### orderBy? - -```ts -optional orderBy: OrderBy; -``` - -Defined in: [packages/db/src/query/ir.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L16) - -*** - -### select? - -```ts -optional select: Select; -``` - -Defined in: [packages/db/src/query/ir.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L11) - -*** - -### singleResult? - -```ts -optional singleResult: true; -``` - -Defined in: [packages/db/src/query/ir.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L20) - -*** - -### where? - -```ts -optional where: Where[]; -``` - -Defined in: [packages/db/src/query/ir.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L13) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md deleted file mode 100644 index 8621d0743..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -id: BasicExpression -title: BasicExpression ---- - -# Type Alias: BasicExpression\ - -```ts -type BasicExpression = - | PropRef - | Value -| Func; -``` - -Defined in: [packages/db/src/query/ir.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L123) - -## Type Parameters - -### T - -`T` = `any` diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md deleted file mode 100644 index 53396c221..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: From -title: From ---- - -# Type Alias: From - -```ts -type From = - | CollectionRef - | QueryRef; -``` - -Defined in: [packages/db/src/query/ir.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L28) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md deleted file mode 100644 index 71426706e..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: GroupBy -title: GroupBy ---- - -# Type Alias: GroupBy - -```ts -type GroupBy = BasicExpression[]; -``` - -Defined in: [packages/db/src/query/ir.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L47) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md deleted file mode 100644 index 7c101b514..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: Having -title: Having ---- - -# Type Alias: Having - -```ts -type Having = Where; -``` - -Defined in: [packages/db/src/query/ir.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L49) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md deleted file mode 100644 index f05df96fd..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: Join -title: Join ---- - -# Type Alias: Join - -```ts -type Join = JoinClause[]; -``` - -Defined in: [packages/db/src/query/ir.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L34) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md deleted file mode 100644 index fd93855d3..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: Limit -title: Limit ---- - -# Type Alias: Limit - -```ts -type Limit = number; -``` - -Defined in: [packages/db/src/query/ir.ts:60](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L60) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md deleted file mode 100644 index eeb67a560..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: Offset -title: Offset ---- - -# Type Alias: Offset - -```ts -type Offset = number; -``` - -Defined in: [packages/db/src/query/ir.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L62) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md deleted file mode 100644 index af3fac551..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: OrderBy -title: OrderBy ---- - -# Type Alias: OrderBy - -```ts -type OrderBy = OrderByClause[]; -``` - -Defined in: [packages/db/src/query/ir.ts:51](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L51) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md deleted file mode 100644 index 98ea1969e..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: OrderByClause -title: OrderByClause ---- - -# Type Alias: OrderByClause - -```ts -type OrderByClause = object; -``` - -Defined in: [packages/db/src/query/ir.ts:53](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L53) - -## Properties - -### compareOptions - -```ts -compareOptions: CompareOptions; -``` - -Defined in: [packages/db/src/query/ir.ts:55](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L55) - -*** - -### expression - -```ts -expression: BasicExpression; -``` - -Defined in: [packages/db/src/query/ir.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L54) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md deleted file mode 100644 index 043ef946d..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: OrderByDirection -title: OrderByDirection ---- - -# Type Alias: OrderByDirection - -```ts -type OrderByDirection = "asc" | "desc"; -``` - -Defined in: [packages/db/src/query/ir.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L58) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md deleted file mode 100644 index 1bf77381f..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -id: Select -title: Select ---- - -# Type Alias: Select - -```ts -type Select = object; -``` - -Defined in: [packages/db/src/query/ir.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L30) - -## Index Signature - -```ts -[alias: string]: - | Aggregate - | BasicExpression - | Select -``` diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md deleted file mode 100644 index ac22debbd..000000000 --- a/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -id: Where -title: Where ---- - -# Type Alias: Where - -```ts -type Where = - | BasicExpression - | { - expression: BasicExpression; - residual?: boolean; -}; -``` - -Defined in: [packages/db/src/query/ir.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L43) diff --git a/docs/reference/classes/AggregateFunctionNotInSelectError.md b/docs/reference/classes/AggregateFunctionNotInSelectError.md deleted file mode 100644 index eca7c6447..000000000 --- a/docs/reference/classes/AggregateFunctionNotInSelectError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: AggregateFunctionNotInSelectError -title: AggregateFunctionNotInSelectError ---- - -# Class: AggregateFunctionNotInSelectError - -Defined in: [packages/db/src/errors.ts:531](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L531) - -## Extends - -- [`GroupByError`](../GroupByError.md) - -## Constructors - -### Constructor - -```ts -new AggregateFunctionNotInSelectError(functionName): AggregateFunctionNotInSelectError; -``` - -Defined in: [packages/db/src/errors.ts:532](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L532) - -#### Parameters - -##### functionName - -`string` - -#### Returns - -`AggregateFunctionNotInSelectError` - -#### Overrides - -[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/AggregateNotSupportedError.md b/docs/reference/classes/AggregateNotSupportedError.md deleted file mode 100644 index 4d20a59b3..000000000 --- a/docs/reference/classes/AggregateNotSupportedError.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -id: AggregateNotSupportedError -title: AggregateNotSupportedError ---- - -# Class: AggregateNotSupportedError - -Defined in: [packages/db/src/errors.ts:647](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L647) - -Error thrown when aggregate expressions are used outside of a GROUP BY context. - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new AggregateNotSupportedError(): AggregateNotSupportedError; -``` - -Defined in: [packages/db/src/errors.ts:648](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L648) - -#### Returns - -`AggregateNotSupportedError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/BTreeIndex.md b/docs/reference/classes/BTreeIndex.md deleted file mode 100644 index fe55cef10..000000000 --- a/docs/reference/classes/BTreeIndex.md +++ /dev/null @@ -1,848 +0,0 @@ ---- -id: BTreeIndex -title: BTreeIndex ---- - -# Class: BTreeIndex\ - -Defined in: [packages/db/src/indexes/btree-index.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L30) - -B+Tree index for sorted data with range queries -This maintains items in sorted order and provides efficient range operations - -## Extends - -- [`BaseIndex`](../BaseIndex.md)\<`TKey`\> - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Constructors - -### Constructor - -```ts -new BTreeIndex( - id, - expression, - name?, -options?): BTreeIndex; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L50) - -#### Parameters - -##### id - -`number` - -##### expression - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -##### name? - -`string` - -##### options? - -`any` - -#### Returns - -`BTreeIndex`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`constructor`](../BaseIndex.md#constructor) - -## Properties - -### compareOptions - -```ts -protected compareOptions: CompareOptions; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L87) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`compareOptions`](../BaseIndex.md#compareoptions) - -*** - -### expression - -```ts -readonly expression: BasicExpression; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L81) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`expression`](../BaseIndex.md#expression) - -*** - -### id - -```ts -readonly id: number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L79) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`id`](../BaseIndex.md#id) - -*** - -### lastUpdated - -```ts -protected lastUpdated: Date; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L86) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`lastUpdated`](../BaseIndex.md#lastupdated) - -*** - -### lookupCount - -```ts -protected lookupCount: number = 0; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L84) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`lookupCount`](../BaseIndex.md#lookupcount) - -*** - -### name? - -```ts -readonly optional name: string; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L80) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`name`](../BaseIndex.md#name) - -*** - -### supportedOperations - -```ts -readonly supportedOperations: Set<"eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "ilike">; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L33) - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`supportedOperations`](../BaseIndex.md#supportedoperations) - -*** - -### totalLookupTime - -```ts -protected totalLookupTime: number = 0; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L85) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`totalLookupTime`](../BaseIndex.md#totallookuptime) - -## Accessors - -### indexedKeysSet - -#### Get Signature - -```ts -get indexedKeysSet(): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L333) - -##### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`indexedKeysSet`](../BaseIndex.md#indexedkeysset) - -*** - -### keyCount - -#### Get Signature - -```ts -get keyCount(): number; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L199) - -Gets the number of indexed keys - -##### Returns - -`number` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`keyCount`](../BaseIndex.md#keycount) - -*** - -### orderedEntriesArray - -#### Get Signature - -```ts -get orderedEntriesArray(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:337](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L337) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`orderedEntriesArray`](../BaseIndex.md#orderedentriesarray) - -*** - -### orderedEntriesArrayReversed - -#### Get Signature - -```ts -get orderedEntriesArrayReversed(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:343](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L343) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`orderedEntriesArrayReversed`](../BaseIndex.md#orderedentriesarrayreversed) - -*** - -### valueMapData - -#### Get Signature - -```ts -get valueMapData(): Map>; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:350](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L350) - -##### Returns - -`Map`\<`any`, `Set`\<`TKey`\>\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`valueMapData`](../BaseIndex.md#valuemapdata) - -## Methods - -### add() - -```ts -add(key, item): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L69) - -Adds a value to the index - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`add`](../BaseIndex.md#add) - -*** - -### build() - -```ts -build(entries): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:143](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L143) - -Builds the index from a collection of entries - -#### Parameters - -##### entries - -`Iterable`\<\[`TKey`, `any`\]\> - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`build`](../BaseIndex.md#build) - -*** - -### clear() - -```ts -clear(): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L154) - -Clears all data from the index - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`clear`](../BaseIndex.md#clear) - -*** - -### equalityLookup() - -```ts -equalityLookup(value): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L208) - -Performs an equality lookup - -#### Parameters - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`equalityLookup`](../BaseIndex.md#equalitylookup) - -*** - -### evaluateIndexExpression() - -```ts -protected evaluateIndexExpression(item): any; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L182) - -#### Parameters - -##### item - -`any` - -#### Returns - -`any` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`evaluateIndexExpression`](../BaseIndex.md#evaluateindexexpression) - -*** - -### getStats() - -```ts -getStats(): IndexStats; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:169](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L169) - -#### Returns - -[`IndexStats`](../../interfaces/IndexStats.md) - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`getStats`](../BaseIndex.md#getstats) - -*** - -### inArrayLookup() - -```ts -inArrayLookup(values): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:318](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L318) - -Performs an IN array lookup - -#### Parameters - -##### values - -`any`[] - -#### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`inArrayLookup`](../BaseIndex.md#inarraylookup) - -*** - -### initialize() - -```ts -protected initialize(_options?): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:64](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L64) - -#### Parameters - -##### \_options? - -[`BTreeIndexOptions`](../../interfaces/BTreeIndexOptions.md) - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`initialize`](../BaseIndex.md#initialize) - -*** - -### lookup() - -```ts -lookup(operation, value): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:164](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L164) - -Performs a lookup operation - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`lookup`](../BaseIndex.md#lookup) - -*** - -### matchesCompareOptions() - -```ts -matchesCompareOptions(compareOptions): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L146) - -Checks if the compare options match the index's compare options. -The direction is ignored because the index can be reversed if the direction is different. - -#### Parameters - -##### compareOptions - -`CompareOptions` - -#### Returns - -`boolean` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`matchesCompareOptions`](../BaseIndex.md#matchescompareoptions) - -*** - -### matchesDirection() - -```ts -matchesDirection(direction): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L165) - -Checks if the index matches the provided direction. - -#### Parameters - -##### direction - -[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) - -#### Returns - -`boolean` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`matchesDirection`](../BaseIndex.md#matchesdirection) - -*** - -### matchesField() - -```ts -matchesField(fieldPath): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:134](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L134) - -#### Parameters - -##### fieldPath - -`string`[] - -#### Returns - -`boolean` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`matchesField`](../BaseIndex.md#matchesfield) - -*** - -### rangeQuery() - -```ts -rangeQuery(options): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:217](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L217) - -Performs a range query with options -This is more efficient for compound queries like "WHERE a > 5 AND a < 10" - -#### Parameters - -##### options - -[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) = `{}` - -#### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`rangeQuery`](../BaseIndex.md#rangequery) - -*** - -### rangeQueryReversed() - -```ts -rangeQueryReversed(options): Set; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:250](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L250) - -Performs a reversed range query - -#### Parameters - -##### options - -[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) = `{}` - -#### Returns - -`Set`\<`TKey`\> - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`rangeQueryReversed`](../BaseIndex.md#rangequeryreversed) - -*** - -### remove() - -```ts -remove(key, item): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:100](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L100) - -Removes a value from the index - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`remove`](../BaseIndex.md#remove) - -*** - -### supports() - -```ts -supports(operation): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L130) - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -#### Returns - -`boolean` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`supports`](../BaseIndex.md#supports) - -*** - -### take() - -```ts -take( - n, - from?, - filterFn?): TKey[]; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L295) - -Returns the next n items after the provided item or the first n items if no from item is provided. - -#### Parameters - -##### n - -`number` - -The number of items to return - -##### from? - -`any` - -The item to start from (exclusive). Starts from the smallest item (inclusive) if not provided. - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -The next n items after the provided key. Returns the first n items if no from item is provided. - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`take`](../BaseIndex.md#take) - -*** - -### takeReversed() - -```ts -takeReversed( - n, - from?, - filterFn?): TKey[]; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L306) - -Returns the next n items **before** the provided item (in descending order) or the last n items if no from item is provided. - -#### Parameters - -##### n - -`number` - -The number of items to return - -##### from? - -`any` - -The item to start from (exclusive). Starts from the largest item (inclusive) if not provided. - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -The next n items **before** the provided key. Returns the last n items if no from item is provided. - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`takeReversed`](../BaseIndex.md#takereversed) - -*** - -### trackLookup() - -```ts -protected trackLookup(startTime): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L187) - -#### Parameters - -##### startTime - -`number` - -#### Returns - -`void` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`trackLookup`](../BaseIndex.md#tracklookup) - -*** - -### update() - -```ts -update( - key, - oldItem, - newItem): void; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:135](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L135) - -Updates a value in the index - -#### Parameters - -##### key - -`TKey` - -##### oldItem - -`any` - -##### newItem - -`any` - -#### Returns - -`void` - -#### Overrides - -[`BaseIndex`](../BaseIndex.md).[`update`](../BaseIndex.md#update) - -*** - -### updateTimestamp() - -```ts -protected updateTimestamp(): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L193) - -#### Returns - -`void` - -#### Inherited from - -[`BaseIndex`](../BaseIndex.md).[`updateTimestamp`](../BaseIndex.md#updatetimestamp) diff --git a/docs/reference/classes/BaseIndex.md b/docs/reference/classes/BaseIndex.md deleted file mode 100644 index a1a6434c5..000000000 --- a/docs/reference/classes/BaseIndex.md +++ /dev/null @@ -1,760 +0,0 @@ ---- -id: BaseIndex -title: BaseIndex ---- - -# Abstract Class: BaseIndex\ - -Defined in: [packages/db/src/indexes/base-index.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L76) - -Base abstract class that all index types extend - -## Extended by - -- [`BTreeIndex`](../BTreeIndex.md) - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Implements - -- [`IndexInterface`](../../interfaces/IndexInterface.md)\<`TKey`\> - -## Constructors - -### Constructor - -```ts -new BaseIndex( - id, - expression, - name?, -options?): BaseIndex; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:89](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L89) - -#### Parameters - -##### id - -`number` - -##### expression - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -##### name? - -`string` - -##### options? - -`any` - -#### Returns - -`BaseIndex`\<`TKey`\> - -## Properties - -### compareOptions - -```ts -protected compareOptions: CompareOptions; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L87) - -*** - -### expression - -```ts -readonly expression: BasicExpression; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L81) - -*** - -### id - -```ts -readonly id: number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L79) - -*** - -### lastUpdated - -```ts -protected lastUpdated: Date; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L86) - -*** - -### lookupCount - -```ts -protected lookupCount: number = 0; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L84) - -*** - -### name? - -```ts -readonly optional name: string; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L80) - -*** - -### supportedOperations - -```ts -abstract readonly supportedOperations: Set<"eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "ilike">; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L82) - -*** - -### totalLookupTime - -```ts -protected totalLookupTime: number = 0; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L85) - -## Accessors - -### indexedKeysSet - -#### Get Signature - -```ts -get abstract indexedKeysSet(): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L126) - -##### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`indexedKeysSet`](../../interfaces/IndexInterface.md#indexedkeysset) - -*** - -### keyCount - -#### Get Signature - -```ts -get abstract keyCount(): number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L119) - -##### Returns - -`number` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`keyCount`](../../interfaces/IndexInterface.md#keycount) - -*** - -### orderedEntriesArray - -#### Get Signature - -```ts -get abstract orderedEntriesArray(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:124](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L124) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`orderedEntriesArray`](../../interfaces/IndexInterface.md#orderedentriesarray) - -*** - -### orderedEntriesArrayReversed - -#### Get Signature - -```ts -get abstract orderedEntriesArrayReversed(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L125) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`orderedEntriesArrayReversed`](../../interfaces/IndexInterface.md#orderedentriesarrayreversed) - -*** - -### valueMapData - -#### Get Signature - -```ts -get abstract valueMapData(): Map>; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L127) - -##### Returns - -`Map`\<`any`, `Set`\<`TKey`\>\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`valueMapData`](../../interfaces/IndexInterface.md#valuemapdata) - -## Methods - -### add() - -```ts -abstract add(key, item): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L103) - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`add`](../../interfaces/IndexInterface.md#add) - -*** - -### build() - -```ts -abstract build(entries): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:106](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L106) - -#### Parameters - -##### entries - -`Iterable`\<\[`TKey`, `any`\]\> - -#### Returns - -`void` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`build`](../../interfaces/IndexInterface.md#build) - -*** - -### clear() - -```ts -abstract clear(): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:107](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L107) - -#### Returns - -`void` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`clear`](../../interfaces/IndexInterface.md#clear) - -*** - -### equalityLookup() - -```ts -abstract equalityLookup(value): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L120) - -#### Parameters - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`equalityLookup`](../../interfaces/IndexInterface.md#equalitylookup) - -*** - -### evaluateIndexExpression() - -```ts -protected evaluateIndexExpression(item): any; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L182) - -#### Parameters - -##### item - -`any` - -#### Returns - -`any` - -*** - -### getStats() - -```ts -getStats(): IndexStats; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:169](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L169) - -#### Returns - -[`IndexStats`](../../interfaces/IndexStats.md) - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`getStats`](../../interfaces/IndexInterface.md#getstats) - -*** - -### inArrayLookup() - -```ts -abstract inArrayLookup(values): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:121](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L121) - -#### Parameters - -##### values - -`any`[] - -#### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`inArrayLookup`](../../interfaces/IndexInterface.md#inarraylookup) - -*** - -### initialize() - -```ts -abstract protected initialize(options?): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:180](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L180) - -#### Parameters - -##### options? - -`any` - -#### Returns - -`void` - -*** - -### lookup() - -```ts -abstract lookup(operation, value): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:108](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L108) - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`lookup`](../../interfaces/IndexInterface.md#lookup) - -*** - -### matchesCompareOptions() - -```ts -matchesCompareOptions(compareOptions): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L146) - -Checks if the compare options match the index's compare options. -The direction is ignored because the index can be reversed if the direction is different. - -#### Parameters - -##### compareOptions - -`CompareOptions` - -#### Returns - -`boolean` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesCompareOptions`](../../interfaces/IndexInterface.md#matchescompareoptions) - -*** - -### matchesDirection() - -```ts -matchesDirection(direction): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L165) - -Checks if the index matches the provided direction. - -#### Parameters - -##### direction - -[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) - -#### Returns - -`boolean` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesDirection`](../../interfaces/IndexInterface.md#matchesdirection) - -*** - -### matchesField() - -```ts -matchesField(fieldPath): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:134](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L134) - -#### Parameters - -##### fieldPath - -`string`[] - -#### Returns - -`boolean` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesField`](../../interfaces/IndexInterface.md#matchesfield) - -*** - -### rangeQuery() - -```ts -abstract rangeQuery(options): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L122) - -#### Parameters - -##### options - -[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) - -#### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`rangeQuery`](../../interfaces/IndexInterface.md#rangequery) - -*** - -### rangeQueryReversed() - -```ts -abstract rangeQueryReversed(options): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L123) - -#### Parameters - -##### options - -[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) - -#### Returns - -`Set`\<`TKey`\> - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`rangeQueryReversed`](../../interfaces/IndexInterface.md#rangequeryreversed) - -*** - -### remove() - -```ts -abstract remove(key, item): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L104) - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`remove`](../../interfaces/IndexInterface.md#remove) - -*** - -### supports() - -```ts -supports(operation): boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L130) - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -#### Returns - -`boolean` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`supports`](../../interfaces/IndexInterface.md#supports) - -*** - -### take() - -```ts -abstract take( - n, - from?, - filterFn?): TKey[]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:109](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L109) - -#### Parameters - -##### n - -`number` - -##### from? - -`TKey` - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`take`](../../interfaces/IndexInterface.md#take) - -*** - -### takeReversed() - -```ts -abstract takeReversed( - n, - from?, - filterFn?): TKey[]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:114](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L114) - -#### Parameters - -##### n - -`number` - -##### from? - -`TKey` - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`takeReversed`](../../interfaces/IndexInterface.md#takereversed) - -*** - -### trackLookup() - -```ts -protected trackLookup(startTime): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L187) - -#### Parameters - -##### startTime - -`number` - -#### Returns - -`void` - -*** - -### update() - -```ts -abstract update( - key, - oldItem, - newItem): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:105](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L105) - -#### Parameters - -##### key - -`TKey` - -##### oldItem - -`any` - -##### newItem - -`any` - -#### Returns - -`void` - -#### Implementation of - -[`IndexInterface`](../../interfaces/IndexInterface.md).[`update`](../../interfaces/IndexInterface.md#update) - -*** - -### updateTimestamp() - -```ts -protected updateTimestamp(): void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L193) - -#### Returns - -`void` diff --git a/docs/reference/classes/BaseQueryBuilder.md b/docs/reference/classes/BaseQueryBuilder.md deleted file mode 100644 index 6ce3d07b2..000000000 --- a/docs/reference/classes/BaseQueryBuilder.md +++ /dev/null @@ -1,884 +0,0 @@ ---- -id: BaseQueryBuilder -title: BaseQueryBuilder ---- - -# Class: BaseQueryBuilder\ - -Defined in: [packages/db/src/query/builder/index.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L46) - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) = [`Context`](../../interfaces/Context.md) - -## Constructors - -### Constructor - -```ts -new BaseQueryBuilder(query): BaseQueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L49) - -#### Parameters - -##### query - -`Partial`\<[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md)\> = `{}` - -#### Returns - -`BaseQueryBuilder`\<`TContext`\> - -## Accessors - -### fn - -#### Get Signature - -```ts -get fn(): object; -``` - -Defined in: [packages/db/src/query/builder/index.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L672) - -Functional variants of the query builder -These are imperative function that are called for ery row. -Warning: that these cannot be optimized by the query compiler, and may prevent -some type of optimizations being possible. - -##### Example - -```ts -q.fn.select((row) => ({ - name: row.user.name.toUpperCase(), - age: row.user.age + 1, -})) -``` - -##### Returns - -###### having() - -```ts -having(callback): QueryBuilder; -``` - -Filter grouped rows using a function that operates on each aggregated row -Warning: This cannot be optimized by the query compiler - -###### Parameters - -###### callback - -(`row`) => `any` - -A function that receives an aggregated row and returns a boolean - -###### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with functional having filter applied - -###### Example - -```ts -// Functional having (not optimized) -query - .from({ posts: postsCollection }) - .groupBy(({posts}) => posts.userId) - .fn.having(row => row.count > 5) -``` - -###### select() - -```ts -select(callback): QueryBuilder>; -``` - -Select fields using a function that operates on each row -Warning: This cannot be optimized by the query compiler - -###### Type Parameters - -###### TFuncSelectResult - -`TFuncSelectResult` - -###### Parameters - -###### callback - -(`row`) => `TFuncSelectResult` - -A function that receives a row and returns the selected value - -###### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`WithResult`\<`TContext`, `TFuncSelectResult`\>\> - -A QueryBuilder with functional selection applied - -###### Example - -```ts -// Functional select (not optimized) -query - .from({ users: usersCollection }) - .fn.select(row => ({ - name: row.users.name.toUpperCase(), - age: row.users.age + 1, - })) -``` - -###### where() - -```ts -where(callback): QueryBuilder; -``` - -Filter rows using a function that operates on each row -Warning: This cannot be optimized by the query compiler - -###### Parameters - -###### callback - -(`row`) => `any` - -A function that receives a row and returns a boolean - -###### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with functional filtering applied - -###### Example - -```ts -// Functional where (not optimized) -query - .from({ users: usersCollection }) - .fn.where(row => row.users.name.startsWith('A')) -``` - -## Methods - -### \_getQuery() - -```ts -_getQuery(): QueryIR; -``` - -Defined in: [packages/db/src/query/builder/index.ts:758](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L758) - -#### Returns - -[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md) - -*** - -### distinct() - -```ts -distinct(): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L611) - -Specify that the query should return distinct rows. -Deduplicates rows based on the selected columns. - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with distinct enabled - -#### Example - -```ts -// Get countries our users are from -query - .from({ users: usersCollection }) - .select(({users}) => users.country) - .distinct() -``` - -*** - -### findOne() - -```ts -findOne(): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L631) - -Specify that the query should return a single result - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext` & [`SingleResult`](../../type-aliases/SingleResult.md)\> - -A QueryBuilder that returns the first result - -#### Example - -```ts -// Get the user matching the query -query - .from({ users: usersCollection }) - .where(({users}) => eq(users.id, 1)) - .findOne() -``` - -*** - -### from() - -```ts -from(source): QueryBuilder<{ - baseSchema: SchemaFromSource; - fromSourceName: keyof TSource & string; - hasJoins: false; - schema: SchemaFromSource; -}>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L103) - -Specify the source table or subquery for the query - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<\{ - `baseSchema`: `SchemaFromSource`\<`TSource`\>; - `fromSourceName`: keyof `TSource` & `string`; - `hasJoins`: `false`; - `schema`: `SchemaFromSource`\<`TSource`\>; -\}\> - -A QueryBuilder with the specified source - -#### Example - -```ts -// Query from a collection -query.from({ users: usersCollection }) - -// Query from a subquery -const activeUsers = query.from({ u: usersCollection }).where(({u}) => u.active) -query.from({ activeUsers }) -``` - -*** - -### fullJoin() - -```ts -fullJoin(source, onCallback): QueryBuilder, "full">>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:294](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L294) - -Perform a FULL JOIN with another table or subquery - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -##### onCallback - -`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> - -A function that receives table references and returns the join condition - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"full"`\>\> - -A QueryBuilder with the full joined table available - -#### Example - -```ts -// Full join users with posts -query - .from({ users: usersCollection }) - .fullJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) -``` - -*** - -### groupBy() - -```ts -groupBy(callback): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:533](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L533) - -Group rows by one or more columns for aggregation - -#### Parameters - -##### callback - -`GroupByCallback`\<`TContext`\> - -A function that receives table references and returns the field(s) to group by - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with grouping applied (enables aggregate functions in SELECT and HAVING) - -#### Example - -```ts -// Group by a single column -query - .from({ posts: postsCollection }) - .groupBy(({posts}) => posts.userId) - .select(({posts, count}) => ({ - userId: posts.userId, - postCount: count() - })) - -// Group by multiple columns -query - .from({ sales: salesCollection }) - .groupBy(({sales}) => [sales.region, sales.category]) - .select(({sales, sum}) => ({ - region: sales.region, - category: sales.category, - totalSales: sum(sales.amount) - })) -``` - -*** - -### having() - -```ts -having(callback): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:374](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L374) - -Filter grouped rows based on aggregate conditions - -#### Parameters - -##### callback - -`WhereCallback`\<`TContext`\> - -A function that receives table references and returns an expression - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with the having condition applied - -#### Example - -```ts -// Filter groups by count -query - .from({ posts: postsCollection }) - .groupBy(({posts}) => posts.userId) - .having(({posts}) => gt(count(posts.id), 5)) - -// Filter by average -query - .from({ orders: ordersCollection }) - .groupBy(({orders}) => orders.customerId) - .having(({orders}) => gt(avg(orders.total), 100)) - -// Multiple having calls are ANDed together -query - .from({ orders: ordersCollection }) - .groupBy(({orders}) => orders.customerId) - .having(({orders}) => gt(count(orders.id), 5)) - .having(({orders}) => gt(avg(orders.total), 100)) -``` - -*** - -### innerJoin() - -```ts -innerJoin(source, onCallback): QueryBuilder, "inner">>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L268) - -Perform an INNER JOIN with another table or subquery - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -##### onCallback - -`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> - -A function that receives table references and returns the join condition - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"inner"`\>\> - -A QueryBuilder with the inner joined table available - -#### Example - -```ts -// Inner join users with posts -query - .from({ users: usersCollection }) - .innerJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) -``` - -*** - -### join() - -```ts -join( - source, - onCallback, -type): QueryBuilder, TJoinType>>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L146) - -Join another table or subquery to the current query - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -##### TJoinType - -`TJoinType` *extends* `"inner"` \| `"left"` \| `"right"` \| `"full"` = `"left"` - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -##### onCallback - -`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> - -A function that receives table references and returns the join condition - -##### type - -`TJoinType` = `...` - -The type of join: 'inner', 'left', 'right', or 'full' (defaults to 'left') - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `TJoinType`\>\> - -A QueryBuilder with the joined table available - -#### Example - -```ts -// Left join users with posts -query - .from({ users: usersCollection }) - .join({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) - -// Inner join with explicit type -query - .from({ u: usersCollection }) - .join({ p: postsCollection }, ({u, p}) => eq(u.id, p.userId), 'inner') -``` - -// Join with a subquery -const activeUsers = query.from({ u: usersCollection }).where(({u}) => u.active) -query - .from({ activeUsers }) - .join({ p: postsCollection }, ({u, p}) => eq(u.id, p.userId)) - -*** - -### leftJoin() - -```ts -leftJoin(source, onCallback): QueryBuilder, "left">>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L216) - -Perform a LEFT JOIN with another table or subquery - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -##### onCallback - -`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> - -A function that receives table references and returns the join condition - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"left"`\>\> - -A QueryBuilder with the left joined table available - -#### Example - -```ts -// Left join users with posts -query - .from({ users: usersCollection }) - .leftJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) -``` - -*** - -### limit() - -```ts -limit(count): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:566](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L566) - -Limit the number of rows returned by the query -`orderBy` is required for `limit` - -#### Parameters - -##### count - -`number` - -Maximum number of rows to return - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with the limit applied - -#### Example - -```ts -// Get top 5 posts by likes -query - .from({ posts: postsCollection }) - .orderBy(({posts}) => posts.likes, 'desc') - .limit(5) -``` - -*** - -### offset() - -```ts -offset(count): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:590](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L590) - -Skip a number of rows before returning results -`orderBy` is required for `offset` - -#### Parameters - -##### count - -`number` - -Number of rows to skip - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with the offset applied - -#### Example - -```ts -// Get second page of results -query - .from({ posts: postsCollection }) - .orderBy(({posts}) => posts.createdAt, 'desc') - .offset(page * pageSize) - .limit(pageSize) -``` - -*** - -### orderBy() - -```ts -orderBy(callback, options): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:462](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L462) - -Sort the query results by one or more columns - -#### Parameters - -##### callback - -`OrderByCallback`\<`TContext`\> - -A function that receives table references and returns the field to sort by - -##### options - -[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) | `OrderByOptions` - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with the ordering applied - -#### Example - -```ts -// Sort by a single column -query - .from({ users: usersCollection }) - .orderBy(({users}) => users.name) - -// Sort descending -query - .from({ users: usersCollection }) - .orderBy(({users}) => users.createdAt, 'desc') - -// Multiple sorts (chain orderBy calls) -query - .from({ users: usersCollection }) - .orderBy(({users}) => users.lastName) - .orderBy(({users}) => users.firstName) -``` - -*** - -### rightJoin() - -```ts -rightJoin(source, onCallback): QueryBuilder, "right">>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:242](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L242) - -Perform a RIGHT JOIN with another table or subquery - -#### Type Parameters - -##### TSource - -`TSource` *extends* [`Source`](../../type-aliases/Source.md) - -#### Parameters - -##### source - -`TSource` - -An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery - -##### onCallback - -`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> - -A function that receives table references and returns the join condition - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"right"`\>\> - -A QueryBuilder with the right joined table available - -#### Example - -```ts -// Right join users with posts -query - .from({ users: usersCollection }) - .rightJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) -``` - -*** - -### select() - -```ts -select(callback): QueryBuilder>>; -``` - -Defined in: [packages/db/src/query/builder/index.ts:421](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L421) - -Select specific columns or computed values from the query - -#### Type Parameters - -##### TSelectObject - -`TSelectObject` *extends* `SelectShape` - -#### Parameters - -##### callback - -(`refs`) => `TSelectObject` - -A function that receives table references and returns an object with selected fields or expressions - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`WithResult`\<`TContext`, `ResultTypeFromSelect`\<`TSelectObject`\>\>\> - -A QueryBuilder that returns only the selected fields - -#### Example - -```ts -// Select specific columns -query - .from({ users: usersCollection }) - .select(({users}) => ({ - name: users.name, - email: users.email - })) - -// Select with computed values -query - .from({ users: usersCollection }) - .select(({users}) => ({ - fullName: concat(users.firstName, ' ', users.lastName), - ageInMonths: mul(users.age, 12) - })) - -// Select with aggregates (requires GROUP BY) -query - .from({ posts: postsCollection }) - .groupBy(({posts}) => posts.userId) - .select(({posts, count}) => ({ - userId: posts.userId, - postCount: count(posts.id) - })) -``` - -*** - -### where() - -```ts -where(callback): QueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L333) - -Filter rows based on a condition - -#### Parameters - -##### callback - -`WhereCallback`\<`TContext`\> - -A function that receives table references and returns an expression - -#### Returns - -[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -A QueryBuilder with the where condition applied - -#### Example - -```ts -// Simple condition -query - .from({ users: usersCollection }) - .where(({users}) => gt(users.age, 18)) - -// Multiple conditions -query - .from({ users: usersCollection }) - .where(({users}) => and( - gt(users.age, 18), - eq(users.active, true) - )) - -// Multiple where calls are ANDed together -query - .from({ users: usersCollection }) - .where(({users}) => gt(users.age, 18)) - .where(({users}) => eq(users.active, true)) -``` diff --git a/docs/reference/classes/CannotCombineEmptyExpressionListError.md b/docs/reference/classes/CannotCombineEmptyExpressionListError.md deleted file mode 100644 index 9a1ca6b0f..000000000 --- a/docs/reference/classes/CannotCombineEmptyExpressionListError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: CannotCombineEmptyExpressionListError -title: CannotCombineEmptyExpressionListError ---- - -# Class: CannotCombineEmptyExpressionListError - -Defined in: [packages/db/src/errors.ts:610](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L610) - -## Extends - -- [`QueryOptimizerError`](../QueryOptimizerError.md) - -## Constructors - -### Constructor - -```ts -new CannotCombineEmptyExpressionListError(): CannotCombineEmptyExpressionListError; -``` - -Defined in: [packages/db/src/errors.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L611) - -#### Returns - -`CannotCombineEmptyExpressionListError` - -#### Overrides - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`constructor`](../QueryOptimizerError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`cause`](../QueryOptimizerError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`message`](../QueryOptimizerError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`name`](../QueryOptimizerError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`stack`](../QueryOptimizerError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`stackTraceLimit`](../QueryOptimizerError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`captureStackTrace`](../QueryOptimizerError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`prepareStackTrace`](../QueryOptimizerError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionConfigurationError.md b/docs/reference/classes/CollectionConfigurationError.md deleted file mode 100644 index 2a1d4274f..000000000 --- a/docs/reference/classes/CollectionConfigurationError.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -id: CollectionConfigurationError -title: CollectionConfigurationError ---- - -# Class: CollectionConfigurationError - -Defined in: [packages/db/src/errors.ts:71](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L71) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`CollectionRequiresConfigError`](../CollectionRequiresConfigError.md) -- [`CollectionRequiresSyncConfigError`](../CollectionRequiresSyncConfigError.md) -- [`InvalidSchemaError`](../InvalidSchemaError.md) -- [`SchemaMustBeSynchronousError`](../SchemaMustBeSynchronousError.md) - -## Constructors - -### Constructor - -```ts -new CollectionConfigurationError(message): CollectionConfigurationError; -``` - -Defined in: [packages/db/src/errors.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L72) - -#### Parameters - -##### message - -`string` - -#### Returns - -`CollectionConfigurationError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionImpl.md b/docs/reference/classes/CollectionImpl.md deleted file mode 100644 index 216db731a..000000000 --- a/docs/reference/classes/CollectionImpl.md +++ /dev/null @@ -1,1421 +0,0 @@ ---- -id: CollectionImpl -title: CollectionImpl ---- - -# Class: CollectionImpl\ - -Defined in: [packages/db/src/collection/index.ts:202](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L202) - -## Extended by - -- [`Collection`](../../interfaces/Collection.md) - -## Type Parameters - -### TOutput - -`TOutput` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = \{ -\} - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `StandardSchemaV1` - -### TInput - -`TInput` *extends* `object` = `TOutput` - -## Constructors - -### Constructor - -```ts -new CollectionImpl(config): CollectionImpl; -``` - -Defined in: [packages/db/src/collection/index.ts:239](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L239) - -Creates a new Collection instance - -#### Parameters - -##### config - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`TOutput`, `TKey`, `TSchema`\> - -Configuration object for the collection - -#### Returns - -`CollectionImpl`\<`TOutput`, `TKey`, `TUtils`, `TSchema`, `TInput`\> - -#### Throws - -Error if sync config is missing - -## Properties - -### \_lifecycle - -```ts -_lifecycle: CollectionLifecycleManager; -``` - -Defined in: [packages/db/src/collection/index.ts:219](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L219) - -*** - -### \_state - -```ts -_state: CollectionStateManager; -``` - -Defined in: [packages/db/src/collection/index.ts:231](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L231) - -*** - -### \_sync - -```ts -_sync: CollectionSyncManager; -``` - -Defined in: [packages/db/src/collection/index.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L220) - -*** - -### config - -```ts -config: CollectionConfig; -``` - -Defined in: [packages/db/src/collection/index.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L210) - -*** - -### id - -```ts -id: string; -``` - -Defined in: [packages/db/src/collection/index.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L209) - -*** - -### utils - -```ts -utils: Record = {}; -``` - -Defined in: [packages/db/src/collection/index.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L214) - -## Accessors - -### indexes - -#### Get Signature - -```ts -get indexes(): Map>; -``` - -Defined in: [packages/db/src/collection/index.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L496) - -Get resolved indexes for query optimization - -##### Returns - -`Map`\<`number`, [`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> - -*** - -### isLoadingSubset - -#### Get Signature - -```ts -get isLoadingSubset(): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:362](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L362) - -Check if the collection is currently loading more data - -##### Returns - -`boolean` - -true if the collection has pending load more operations, false otherwise - -*** - -### size - -#### Get Signature - -```ts -get size(): number; -``` - -Defined in: [packages/db/src/collection/index.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L399) - -Get the current size of the collection (cached) - -##### Returns - -`number` - -*** - -### state - -#### Get Signature - -```ts -get state(): Map; -``` - -Defined in: [packages/db/src/collection/index.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L683) - -Gets the current state of the collection as a Map - -##### Example - -```ts -const itemsMap = collection.state -console.log(`Collection has ${itemsMap.size} items`) - -for (const [key, item] of itemsMap) { - console.log(`${key}: ${item.title}`) -} - -// Check if specific item exists -if (itemsMap.has("todo-1")) { - console.log("Todo 1 exists:", itemsMap.get("todo-1")) -} -``` - -##### Returns - -`Map`\<`TKey`, `TOutput`\> - -Map containing all items in the collection, with keys as identifiers - -*** - -### status - -#### Get Signature - -```ts -get status(): CollectionStatus; -``` - -Defined in: [packages/db/src/collection/index.ts:317](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L317) - -Gets the current status of the collection - -##### Returns - -[`CollectionStatus`](../../type-aliases/CollectionStatus.md) - -*** - -### subscriberCount - -#### Get Signature - -```ts -get subscriberCount(): number; -``` - -Defined in: [packages/db/src/collection/index.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L324) - -Get the number of subscribers to the collection - -##### Returns - -`number` - -*** - -### toArray - -#### Get Signature - -```ts -get toArray(): TOutput[]; -``` - -Defined in: [packages/db/src/collection/index.ts:712](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L712) - -Gets the current state of the collection as an Array - -##### Returns - -`TOutput`[] - -An Array containing all items in the collection - -## Methods - -### \[iterator\]() - -```ts -iterator: IterableIterator<[TKey, TOutput]>; -``` - -Defined in: [packages/db/src/collection/index.ts:427](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L427) - -Get all entries (virtual derived state) - -#### Returns - -`IterableIterator`\<\[`TKey`, `TOutput`\]\> - -*** - -### cleanup() - -```ts -cleanup(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:846](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L846) - -Clean up the collection by stopping sync and clearing data -This can be called manually or automatically by garbage collection - -#### Returns - -`Promise`\<`void`\> - -*** - -### createIndex() - -```ts -createIndex(indexCallback, config): IndexProxy; -``` - -Defined in: [packages/db/src/collection/index.ts:486](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L486) - -Creates an index on a collection for faster queries. -Indexes significantly improve query performance by allowing constant time lookups -and logarithmic time range queries instead of full scans. - -#### Type Parameters - -##### TResolver - -`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> = *typeof* [`BTreeIndex`](../BTreeIndex.md) - -The type of the index resolver (constructor or async loader) - -#### Parameters - -##### indexCallback - -(`row`) => `any` - -Function that extracts the indexed value from each item - -##### config - -[`IndexOptions`](../../interfaces/IndexOptions.md)\<`TResolver`\> = `{}` - -Configuration including index type and type-specific options - -#### Returns - -[`IndexProxy`](../IndexProxy.md)\<`TKey`\> - -An index proxy that provides access to the index when ready - -#### Example - -```ts -// Create a default B+ tree index -const ageIndex = collection.createIndex((row) => row.age) - -// Create a ordered index with custom options -const ageIndex = collection.createIndex((row) => row.age, { - indexType: BTreeIndex, - options: { - compareFn: customComparator, - compareOptions: { direction: 'asc', nulls: 'first', stringSort: 'lexical' } - }, - name: 'age_btree' -}) - -// Create an async-loaded index -const textIndex = collection.createIndex((row) => row.content, { - indexType: async () => { - const { FullTextIndex } = await import('./indexes/fulltext.js') - return FullTextIndex - }, - options: { language: 'en' } -}) -``` - -*** - -### currentStateAsChanges() - -```ts -currentStateAsChanges(options): - | void - | ChangeMessage[]; -``` - -Defined in: [packages/db/src/collection/index.ts:750](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L750) - -Returns the current state of the collection as an array of changes - -#### Parameters - -##### options - -[`CurrentStateAsChangesOptions`](../../interfaces/CurrentStateAsChangesOptions.md) = `{}` - -Options including optional where filter - -#### Returns - - \| `void` - \| [`ChangeMessage`](../../interfaces/ChangeMessage.md)\<`TOutput`, `string` \| `number`\>[] - -An array of changes - -#### Example - -```ts -// Get all items as changes -const allChanges = collection.currentStateAsChanges() - -// Get only items matching a condition -const activeChanges = collection.currentStateAsChanges({ - where: (row) => row.status === 'active' -}) - -// Get only items using a pre-compiled expression -const activeChanges = collection.currentStateAsChanges({ - whereExpression: eq(row.status, 'active') -}) -``` - -*** - -### delete() - -```ts -delete(keys, config?): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L660) - -Deletes one or more items from the collection - -#### Parameters - -##### keys - -Single key or array of keys to delete - -`TKey` | `TKey`[] - -##### config? - -[`OperationConfig`](../../interfaces/OperationConfig.md) - -Optional configuration including metadata - -#### Returns - -[`Transaction`](../../interfaces/Transaction.md)\<`any`\> - -A Transaction object representing the delete operation(s) - -#### Examples - -```ts -// Delete a single item -const tx = collection.delete("todo-1") -await tx.isPersisted.promise -``` - -```ts -// Delete multiple items -const tx = collection.delete(["todo-1", "todo-2"]) -await tx.isPersisted.promise -``` - -```ts -// Delete with metadata -const tx = collection.delete("todo-1", { metadata: { reason: "completed" } }) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.delete("item-1") - await tx.isPersisted.promise - console.log('Delete successful') -} catch (error) { - console.log('Delete failed:', error) -} -``` - -*** - -### entries() - -```ts -entries(): IterableIterator<[TKey, TOutput]>; -``` - -Defined in: [packages/db/src/collection/index.ts:420](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L420) - -Get all entries (virtual derived state) - -#### Returns - -`IterableIterator`\<\[`TKey`, `TOutput`\]\> - -*** - -### forEach() - -```ts -forEach(callbackfn): void; -``` - -Defined in: [packages/db/src/collection/index.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L434) - -Execute a callback for each entry in the collection - -#### Parameters - -##### callbackfn - -(`value`, `key`, `index`) => `void` - -#### Returns - -`void` - -*** - -### get() - -```ts -get(key): TOutput | undefined; -``` - -Defined in: [packages/db/src/collection/index.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L385) - -Get the current value for a key (virtual derived state) - -#### Parameters - -##### key - -`TKey` - -#### Returns - -`TOutput` \| `undefined` - -*** - -### getKeyFromItem() - -```ts -getKeyFromItem(item): TKey; -``` - -Defined in: [packages/db/src/collection/index.ts:449](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L449) - -#### Parameters - -##### item - -`TOutput` - -#### Returns - -`TKey` - -*** - -### has() - -```ts -has(key): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L392) - -Check if a key exists in the collection (virtual derived state) - -#### Parameters - -##### key - -`TKey` - -#### Returns - -`boolean` - -*** - -### insert() - -```ts -insert(data, config?): - | Transaction> -| Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L547) - -Inserts one or more items into the collection - -#### Parameters - -##### data - -`TInput` | `TInput`[] - -##### config? - -[`InsertConfig`](../../interfaces/InsertConfig.md) - -Optional configuration including metadata - -#### Returns - - \| [`Transaction`](../../interfaces/Transaction.md)\<`Record`\<`string`, `unknown`\>\> - \| [`Transaction`](../../interfaces/Transaction.md)\<`TOutput`\> - -A Transaction object representing the insert operation(s) - -#### Throws - -If the data fails schema validation - -#### Examples - -```ts -// Insert a single todo (requires onInsert handler) -const tx = collection.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Insert multiple todos at once -const tx = collection.insert([ - { id: "1", text: "Buy milk", completed: false }, - { id: "2", text: "Walk dog", completed: true } -]) -await tx.isPersisted.promise -``` - -```ts -// Insert with metadata -const tx = collection.insert({ id: "1", text: "Buy groceries" }, - { metadata: { source: "mobile-app" } } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.insert({ id: "1", text: "New item" }) - await tx.isPersisted.promise - console.log('Insert successful') -} catch (error) { - console.log('Insert failed:', error) -} -``` - -*** - -### isReady() - -```ts -isReady(): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L354) - -Check if the collection is ready for use -Returns true if the collection has been marked as ready by its sync implementation - -#### Returns - -`boolean` - -true if the collection is ready, false otherwise - -#### Example - -```ts -if (collection.isReady()) { - console.log('Collection is ready, data is available') - // Safe to access collection.state -} else { - console.log('Collection is still loading') -} -``` - -*** - -### keys() - -```ts -keys(): IterableIterator; -``` - -Defined in: [packages/db/src/collection/index.ts:406](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L406) - -Get all keys (virtual derived state) - -#### Returns - -`IterableIterator`\<`TKey`\> - -*** - -### map() - -```ts -map(callbackfn): U[]; -``` - -Defined in: [packages/db/src/collection/index.ts:443](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L443) - -Create a new array with the results of calling a function for each entry in the collection - -#### Type Parameters - -##### U - -`U` - -#### Parameters - -##### callbackfn - -(`value`, `key`, `index`) => `U` - -#### Returns - -`U`[] - -*** - -### off() - -```ts -off(event, callback): void; -``` - -Defined in: [packages/db/src/collection/index.ts:825](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L825) - -Unsubscribe from a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -`void` - -*** - -### on() - -```ts -on(event, callback): () => void; -``` - -Defined in: [packages/db/src/collection/index.ts:805](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L805) - -Subscribe to a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -```ts -(): void; -``` - -##### Returns - -`void` - -*** - -### once() - -```ts -once(event, callback): () => void; -``` - -Defined in: [packages/db/src/collection/index.ts:815](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L815) - -Subscribe to a collection event once - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -```ts -(): void; -``` - -##### Returns - -`void` - -*** - -### onFirstReady() - -```ts -onFirstReady(callback): void; -``` - -Defined in: [packages/db/src/collection/index.ts:338](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L338) - -Register a callback to be executed when the collection first becomes ready -Useful for preloading collections - -#### Parameters - -##### callback - -() => `void` - -Function to call when the collection first becomes ready - -#### Returns - -`void` - -#### Example - -```ts -collection.onFirstReady(() => { - console.log('Collection is ready for the first time') - // Safe to access collection.state now -}) -``` - -*** - -### preload() - -```ts -preload(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:378](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L378) - -Preload the collection data by starting sync if not already started -Multiple concurrent calls will share the same promise - -#### Returns - -`Promise`\<`void`\> - -*** - -### startSyncImmediate() - -```ts -startSyncImmediate(): void; -``` - -Defined in: [packages/db/src/collection/index.ts:370](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L370) - -Start sync immediately - internal method for compiled queries -This bypasses lazy loading for special cases like live query results - -#### Returns - -`void` - -*** - -### stateWhenReady() - -```ts -stateWhenReady(): Promise>; -``` - -Defined in: [packages/db/src/collection/index.ts:697](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L697) - -Gets the current state of the collection as a Map, but only resolves when data is available -Waits for the first sync commit to complete before resolving - -#### Returns - -`Promise`\<`Map`\<`TKey`, `TOutput`\>\> - -Promise that resolves to a Map containing all items in the collection - -*** - -### subscribeChanges() - -```ts -subscribeChanges(callback, options): CollectionSubscription; -``` - -Defined in: [packages/db/src/collection/index.ts:795](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L795) - -Subscribe to changes in the collection - -#### Parameters - -##### callback - -(`changes`) => `void` - -Function called when items change - -##### options - -[`SubscribeChangesOptions`](../../interfaces/SubscribeChangesOptions.md) = `{}` - -Subscription options including includeInitialState and where filter - -#### Returns - -`CollectionSubscription` - -Unsubscribe function - Call this to stop listening for changes - -#### Examples - -```ts -// Basic subscription -const subscription = collection.subscribeChanges((changes) => { - changes.forEach(change => { - console.log(`${change.type}: ${change.key}`, change.value) - }) -}) - -// Later: subscription.unsubscribe() -``` - -```ts -// Include current state immediately -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { includeInitialState: true }) -``` - -```ts -// Subscribe only to changes matching a condition -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { - includeInitialState: true, - where: (row) => row.status === 'active' -}) -``` - -```ts -// Subscribe using a pre-compiled expression -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { - includeInitialState: true, - whereExpression: eq(row.status, 'active') -}) -``` - -*** - -### toArrayWhenReady() - -```ts -toArrayWhenReady(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:722](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L722) - -Gets the current state of the collection as an Array, but only resolves when data is available -Waits for the first sync commit to complete before resolving - -#### Returns - -`Promise`\<`TOutput`[]\> - -Promise that resolves to an Array containing all items in the collection - -*** - -### update() - -#### Call Signature - -```ts -update(key, callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L592) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### key - -`unknown`[] - -###### callback - -(`drafts`) => `void` - -##### Returns - -[`Transaction`](../../interfaces/Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -#### Call Signature - -```ts -update( - keys, - config, - callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L598) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### keys - -`unknown`[] - -Single key or array of keys to update - -###### config - -[`OperationConfig`](../../interfaces/OperationConfig.md) - -###### callback - -(`drafts`) => `void` - -##### Returns - -[`Transaction`](../../interfaces/Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -#### Call Signature - -```ts -update(id, callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L605) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### id - -`unknown` - -###### callback - -(`draft`) => `void` - -##### Returns - -[`Transaction`](../../interfaces/Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -#### Call Signature - -```ts -update( - id, - config, - callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L611) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### id - -`unknown` - -###### config - -[`OperationConfig`](../../interfaces/OperationConfig.md) - -###### callback - -(`draft`) => `void` - -##### Returns - -[`Transaction`](../../interfaces/Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -*** - -### validateData() - -```ts -validateData( - data, - type, - key?): TOutput; -``` - -Defined in: [packages/db/src/collection/index.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L503) - -Validates the data against the schema - -#### Parameters - -##### data - -`unknown` - -##### type - -`"insert"` | `"update"` - -##### key? - -`TKey` - -#### Returns - -`TOutput` - -*** - -### values() - -```ts -values(): IterableIterator; -``` - -Defined in: [packages/db/src/collection/index.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L413) - -Get all values (virtual derived state) - -#### Returns - -`IterableIterator`\<`TOutput`\> - -*** - -### waitFor() - -```ts -waitFor(event, timeout?): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:835](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L835) - -Wait for a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### timeout? - -`number` - -#### Returns - -`Promise`\<`AllCollectionEvents`\[`T`\]\> diff --git a/docs/reference/classes/CollectionInErrorStateError.md b/docs/reference/classes/CollectionInErrorStateError.md deleted file mode 100644 index 6a0da4bd1..000000000 --- a/docs/reference/classes/CollectionInErrorStateError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: CollectionInErrorStateError -title: CollectionInErrorStateError ---- - -# Class: CollectionInErrorStateError - -Defined in: [packages/db/src/errors.ts:110](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L110) - -## Extends - -- [`CollectionStateError`](../CollectionStateError.md) - -## Constructors - -### Constructor - -```ts -new CollectionInErrorStateError(operation, collectionId): CollectionInErrorStateError; -``` - -Defined in: [packages/db/src/errors.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L111) - -#### Parameters - -##### operation - -`string` - -##### collectionId - -`string` - -#### Returns - -`CollectionInErrorStateError` - -#### Overrides - -[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionInputNotFoundError.md b/docs/reference/classes/CollectionInputNotFoundError.md deleted file mode 100644 index d9efb03a5..000000000 --- a/docs/reference/classes/CollectionInputNotFoundError.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -id: CollectionInputNotFoundError -title: CollectionInputNotFoundError ---- - -# Class: CollectionInputNotFoundError - -Defined in: [packages/db/src/errors.ts:391](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L391) - -Error thrown when a collection input stream is not found during query compilation. -In self-joins, each alias (e.g., 'employee', 'manager') requires its own input stream. - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new CollectionInputNotFoundError( - alias, - collectionId?, - availableKeys?): CollectionInputNotFoundError; -``` - -Defined in: [packages/db/src/errors.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L392) - -#### Parameters - -##### alias - -`string` - -##### collectionId? - -`string` - -##### availableKeys? - -`string`[] - -#### Returns - -`CollectionInputNotFoundError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionIsInErrorStateError.md b/docs/reference/classes/CollectionIsInErrorStateError.md deleted file mode 100644 index a116584a7..000000000 --- a/docs/reference/classes/CollectionIsInErrorStateError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: CollectionIsInErrorStateError -title: CollectionIsInErrorStateError ---- - -# Class: CollectionIsInErrorStateError - -Defined in: [packages/db/src/errors.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L126) - -## Extends - -- [`CollectionStateError`](../CollectionStateError.md) - -## Constructors - -### Constructor - -```ts -new CollectionIsInErrorStateError(): CollectionIsInErrorStateError; -``` - -Defined in: [packages/db/src/errors.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L127) - -#### Returns - -`CollectionIsInErrorStateError` - -#### Overrides - -[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionOperationError.md b/docs/reference/classes/CollectionOperationError.md deleted file mode 100644 index e9ce186b1..000000000 --- a/docs/reference/classes/CollectionOperationError.md +++ /dev/null @@ -1,232 +0,0 @@ ---- -id: CollectionOperationError -title: CollectionOperationError ---- - -# Class: CollectionOperationError - -Defined in: [packages/db/src/errors.ts:139](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L139) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`UndefinedKeyError`](../UndefinedKeyError.md) -- [`DuplicateKeyError`](../DuplicateKeyError.md) -- [`DuplicateKeySyncError`](../DuplicateKeySyncError.md) -- [`MissingUpdateArgumentError`](../MissingUpdateArgumentError.md) -- [`NoKeysPassedToUpdateError`](../NoKeysPassedToUpdateError.md) -- [`UpdateKeyNotFoundError`](../UpdateKeyNotFoundError.md) -- [`KeyUpdateNotAllowedError`](../KeyUpdateNotAllowedError.md) -- [`NoKeysPassedToDeleteError`](../NoKeysPassedToDeleteError.md) -- [`DeleteKeyNotFoundError`](../DeleteKeyNotFoundError.md) - -## Constructors - -### Constructor - -```ts -new CollectionOperationError(message): CollectionOperationError; -``` - -Defined in: [packages/db/src/errors.ts:140](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L140) - -#### Parameters - -##### message - -`string` - -#### Returns - -`CollectionOperationError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionRequiresConfigError.md b/docs/reference/classes/CollectionRequiresConfigError.md deleted file mode 100644 index 86db7e06d..000000000 --- a/docs/reference/classes/CollectionRequiresConfigError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: CollectionRequiresConfigError -title: CollectionRequiresConfigError ---- - -# Class: CollectionRequiresConfigError - -Defined in: [packages/db/src/errors.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L78) - -## Extends - -- [`CollectionConfigurationError`](../CollectionConfigurationError.md) - -## Constructors - -### Constructor - -```ts -new CollectionRequiresConfigError(): CollectionRequiresConfigError; -``` - -Defined in: [packages/db/src/errors.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L79) - -#### Returns - -`CollectionRequiresConfigError` - -#### Overrides - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionRequiresSyncConfigError.md b/docs/reference/classes/CollectionRequiresSyncConfigError.md deleted file mode 100644 index 8a2a57092..000000000 --- a/docs/reference/classes/CollectionRequiresSyncConfigError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: CollectionRequiresSyncConfigError -title: CollectionRequiresSyncConfigError ---- - -# Class: CollectionRequiresSyncConfigError - -Defined in: [packages/db/src/errors.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L84) - -## Extends - -- [`CollectionConfigurationError`](../CollectionConfigurationError.md) - -## Constructors - -### Constructor - -```ts -new CollectionRequiresSyncConfigError(): CollectionRequiresSyncConfigError; -``` - -Defined in: [packages/db/src/errors.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L85) - -#### Returns - -`CollectionRequiresSyncConfigError` - -#### Overrides - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionStateError.md b/docs/reference/classes/CollectionStateError.md deleted file mode 100644 index 891c5b4db..000000000 --- a/docs/reference/classes/CollectionStateError.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -id: CollectionStateError -title: CollectionStateError ---- - -# Class: CollectionStateError - -Defined in: [packages/db/src/errors.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L103) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`CollectionInErrorStateError`](../CollectionInErrorStateError.md) -- [`InvalidCollectionStatusTransitionError`](../InvalidCollectionStatusTransitionError.md) -- [`CollectionIsInErrorStateError`](../CollectionIsInErrorStateError.md) -- [`NegativeActiveSubscribersError`](../NegativeActiveSubscribersError.md) - -## Constructors - -### Constructor - -```ts -new CollectionStateError(message): CollectionStateError; -``` - -Defined in: [packages/db/src/errors.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L104) - -#### Parameters - -##### message - -`string` - -#### Returns - -`CollectionStateError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/DeleteKeyNotFoundError.md b/docs/reference/classes/DeleteKeyNotFoundError.md deleted file mode 100644 index 61a6600cc..000000000 --- a/docs/reference/classes/DeleteKeyNotFoundError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: DeleteKeyNotFoundError -title: DeleteKeyNotFoundError ---- - -# Class: DeleteKeyNotFoundError - -Defined in: [packages/db/src/errors.ts:204](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L204) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new DeleteKeyNotFoundError(key): DeleteKeyNotFoundError; -``` - -Defined in: [packages/db/src/errors.ts:205](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L205) - -#### Parameters - -##### key - -`string` | `number` - -#### Returns - -`DeleteKeyNotFoundError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/DistinctRequiresSelectError.md b/docs/reference/classes/DistinctRequiresSelectError.md deleted file mode 100644 index 42ff98187..000000000 --- a/docs/reference/classes/DistinctRequiresSelectError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: DistinctRequiresSelectError -title: DistinctRequiresSelectError ---- - -# Class: DistinctRequiresSelectError - -Defined in: [packages/db/src/errors.ts:367](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L367) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new DistinctRequiresSelectError(): DistinctRequiresSelectError; -``` - -Defined in: [packages/db/src/errors.ts:368](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L368) - -#### Returns - -`DistinctRequiresSelectError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateAliasInSubqueryError.md b/docs/reference/classes/DuplicateAliasInSubqueryError.md deleted file mode 100644 index d951c456c..000000000 --- a/docs/reference/classes/DuplicateAliasInSubqueryError.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -id: DuplicateAliasInSubqueryError -title: DuplicateAliasInSubqueryError ---- - -# Class: DuplicateAliasInSubqueryError - -Defined in: [packages/db/src/errors.ts:412](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L412) - -Error thrown when a subquery uses the same alias as its parent query. -This causes issues because parent and subquery would share the same input streams, -leading to empty results or incorrect data (aggregation cross-leaking). - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new DuplicateAliasInSubqueryError(alias, parentAliases): DuplicateAliasInSubqueryError; -``` - -Defined in: [packages/db/src/errors.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L413) - -#### Parameters - -##### alias - -`string` - -##### parentAliases - -`string`[] - -#### Returns - -`DuplicateAliasInSubqueryError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateDbInstanceError.md b/docs/reference/classes/DuplicateDbInstanceError.md deleted file mode 100644 index 2d292ae10..000000000 --- a/docs/reference/classes/DuplicateDbInstanceError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: DuplicateDbInstanceError -title: DuplicateDbInstanceError ---- - -# Class: DuplicateDbInstanceError - -Defined in: [packages/db/src/errors.ts:45](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L45) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Constructors - -### Constructor - -```ts -new DuplicateDbInstanceError(): DuplicateDbInstanceError; -``` - -Defined in: [packages/db/src/errors.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L46) - -#### Returns - -`DuplicateDbInstanceError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateKeyError.md b/docs/reference/classes/DuplicateKeyError.md deleted file mode 100644 index 35d674b3f..000000000 --- a/docs/reference/classes/DuplicateKeyError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: DuplicateKeyError -title: DuplicateKeyError ---- - -# Class: DuplicateKeyError - -Defined in: [packages/db/src/errors.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L154) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new DuplicateKeyError(key): DuplicateKeyError; -``` - -Defined in: [packages/db/src/errors.ts:155](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L155) - -#### Parameters - -##### key - -`string` | `number` - -#### Returns - -`DuplicateKeyError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateKeySyncError.md b/docs/reference/classes/DuplicateKeySyncError.md deleted file mode 100644 index 6d31e7271..000000000 --- a/docs/reference/classes/DuplicateKeySyncError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: DuplicateKeySyncError -title: DuplicateKeySyncError ---- - -# Class: DuplicateKeySyncError - -Defined in: [packages/db/src/errors.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L162) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new DuplicateKeySyncError(key, collectionId): DuplicateKeySyncError; -``` - -Defined in: [packages/db/src/errors.ts:163](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L163) - -#### Parameters - -##### key - -`string` | `number` - -##### collectionId - -`string` - -#### Returns - -`DuplicateKeySyncError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/EmptyReferencePathError.md b/docs/reference/classes/EmptyReferencePathError.md deleted file mode 100644 index c630e7a50..000000000 --- a/docs/reference/classes/EmptyReferencePathError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: EmptyReferencePathError -title: EmptyReferencePathError ---- - -# Class: EmptyReferencePathError - -Defined in: [packages/db/src/errors.ts:435](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L435) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new EmptyReferencePathError(): EmptyReferencePathError; -``` - -Defined in: [packages/db/src/errors.ts:436](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L436) - -#### Returns - -`EmptyReferencePathError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/GroupByError.md b/docs/reference/classes/GroupByError.md deleted file mode 100644 index 58bf920e5..000000000 --- a/docs/reference/classes/GroupByError.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -id: GroupByError -title: GroupByError ---- - -# Class: GroupByError - -Defined in: [packages/db/src/errors.ts:510](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L510) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`NonAggregateExpressionNotInGroupByError`](../NonAggregateExpressionNotInGroupByError.md) -- [`UnsupportedAggregateFunctionError`](../UnsupportedAggregateFunctionError.md) -- [`AggregateFunctionNotInSelectError`](../AggregateFunctionNotInSelectError.md) -- [`UnknownHavingExpressionTypeError`](../UnknownHavingExpressionTypeError.md) - -## Constructors - -### Constructor - -```ts -new GroupByError(message): GroupByError; -``` - -Defined in: [packages/db/src/errors.ts:511](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L511) - -#### Parameters - -##### message - -`string` - -#### Returns - -`GroupByError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/HavingRequiresGroupByError.md b/docs/reference/classes/HavingRequiresGroupByError.md deleted file mode 100644 index a97da0785..000000000 --- a/docs/reference/classes/HavingRequiresGroupByError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: HavingRequiresGroupByError -title: HavingRequiresGroupByError ---- - -# Class: HavingRequiresGroupByError - -Defined in: [packages/db/src/errors.ts:373](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L373) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new HavingRequiresGroupByError(): HavingRequiresGroupByError; -``` - -Defined in: [packages/db/src/errors.ts:374](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L374) - -#### Returns - -`HavingRequiresGroupByError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/IndexProxy.md b/docs/reference/classes/IndexProxy.md deleted file mode 100644 index 0ff7dff72..000000000 --- a/docs/reference/classes/IndexProxy.md +++ /dev/null @@ -1,346 +0,0 @@ ---- -id: IndexProxy -title: IndexProxy ---- - -# Class: IndexProxy\ - -Defined in: [packages/db/src/indexes/lazy-index.ts:131](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L131) - -Proxy that provides synchronous interface while index loads asynchronously - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Constructors - -### Constructor - -```ts -new IndexProxy(indexId, lazyIndex): IndexProxy; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L132) - -#### Parameters - -##### indexId - -`number` - -##### lazyIndex - -[`LazyIndexWrapper`](../LazyIndexWrapper.md)\<`TKey`\> - -#### Returns - -`IndexProxy`\<`TKey`\> - -## Accessors - -### expression - -#### Get Signature - -```ts -get expression(): BasicExpression; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:178](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L178) - -Get the index expression (available immediately) - -##### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -*** - -### id - -#### Get Signature - -```ts -get id(): number; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:161](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L161) - -Get the index ID - -##### Returns - -`number` - -*** - -### index - -#### Get Signature - -```ts -get index(): BaseIndex; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:140](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L140) - -Get the resolved index (throws if not ready) - -##### Returns - -[`BaseIndex`](../BaseIndex.md)\<`TKey`\> - -*** - -### indexedKeysSet - -#### Get Signature - -```ts -get indexedKeysSet(): Set; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L216) - -##### Returns - -`Set`\<`TKey`\> - -*** - -### isReady - -#### Get Signature - -```ts -get isReady(): boolean; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L147) - -Check if index is ready - -##### Returns - -`boolean` - -*** - -### keyCount - -#### Get Signature - -```ts -get keyCount(): number; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:211](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L211) - -Get the key count (throws if not ready) - -##### Returns - -`number` - -*** - -### name - -#### Get Signature - -```ts -get name(): string | undefined; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:168](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L168) - -Get the index name (throws if not ready) - -##### Returns - -`string` \| `undefined` - -*** - -### orderedEntriesArray - -#### Get Signature - -```ts -get orderedEntriesArray(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L221) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -*** - -### valueMapData - -#### Get Signature - -```ts -get valueMapData(): Map>; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:226](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L226) - -##### Returns - -`Map`\<`any`, `Set`\<`TKey`\>\> - -## Methods - -### \_getLazyWrapper() - -```ts -_getLazyWrapper(): LazyIndexWrapper; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:248](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L248) - -#### Returns - -[`LazyIndexWrapper`](../LazyIndexWrapper.md)\<`TKey`\> - -*** - -### equalityLookup() - -```ts -equalityLookup(value): Set; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:232](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L232) - -#### Parameters - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -*** - -### getStats() - -```ts -getStats(): IndexStats; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:192](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L192) - -Get index statistics (throws if not ready) - -#### Returns - -[`IndexStats`](../../interfaces/IndexStats.md) - -*** - -### inArrayLookup() - -```ts -inArrayLookup(values): Set; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:242](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L242) - -#### Parameters - -##### values - -`any`[] - -#### Returns - -`Set`\<`TKey`\> - -*** - -### matchesField() - -```ts -matchesField(fieldPath): boolean; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L199) - -Check if index matches a field path (available immediately) - -#### Parameters - -##### fieldPath - -`string`[] - -#### Returns - -`boolean` - -*** - -### rangeQuery() - -```ts -rangeQuery(options): Set; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L237) - -#### Parameters - -##### options - -`any` - -#### Returns - -`Set`\<`TKey`\> - -*** - -### supports() - -```ts -supports(operation): boolean; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:185](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L185) - -Check if index supports an operation (throws if not ready) - -#### Parameters - -##### operation - -`any` - -#### Returns - -`boolean` - -*** - -### whenReady() - -```ts -whenReady(): Promise>; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L154) - -Wait for index to be ready - -#### Returns - -`Promise`\<[`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> diff --git a/docs/reference/classes/InvalidCollectionStatusTransitionError.md b/docs/reference/classes/InvalidCollectionStatusTransitionError.md deleted file mode 100644 index 81c1a3d0c..000000000 --- a/docs/reference/classes/InvalidCollectionStatusTransitionError.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -id: InvalidCollectionStatusTransitionError -title: InvalidCollectionStatusTransitionError ---- - -# Class: InvalidCollectionStatusTransitionError - -Defined in: [packages/db/src/errors.ts:118](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L118) - -## Extends - -- [`CollectionStateError`](../CollectionStateError.md) - -## Constructors - -### Constructor - -```ts -new InvalidCollectionStatusTransitionError( - from, - to, - collectionId): InvalidCollectionStatusTransitionError; -``` - -Defined in: [packages/db/src/errors.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L119) - -#### Parameters - -##### from - -`string` - -##### to - -`string` - -##### collectionId - -`string` - -#### Returns - -`InvalidCollectionStatusTransitionError` - -#### Overrides - -[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinCondition.md b/docs/reference/classes/InvalidJoinCondition.md deleted file mode 100644 index a859dc2de..000000000 --- a/docs/reference/classes/InvalidJoinCondition.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: InvalidJoinCondition -title: InvalidJoinCondition ---- - -# Class: InvalidJoinCondition - -Defined in: [packages/db/src/errors.ts:497](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L497) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new InvalidJoinCondition(): InvalidJoinCondition; -``` - -Defined in: [packages/db/src/errors.ts:498](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L498) - -#### Returns - -`InvalidJoinCondition` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionLeftSourceError.md b/docs/reference/classes/InvalidJoinConditionLeftSourceError.md deleted file mode 100644 index ffd4e1ab6..000000000 --- a/docs/reference/classes/InvalidJoinConditionLeftSourceError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: InvalidJoinConditionLeftSourceError -title: InvalidJoinConditionLeftSourceError ---- - -# Class: InvalidJoinConditionLeftSourceError - -Defined in: [packages/db/src/errors.ts:481](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L481) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new InvalidJoinConditionLeftSourceError(sourceAlias): InvalidJoinConditionLeftSourceError; -``` - -Defined in: [packages/db/src/errors.ts:482](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L482) - -#### Parameters - -##### sourceAlias - -`string` - -#### Returns - -`InvalidJoinConditionLeftSourceError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionRightSourceError.md b/docs/reference/classes/InvalidJoinConditionRightSourceError.md deleted file mode 100644 index 323433486..000000000 --- a/docs/reference/classes/InvalidJoinConditionRightSourceError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: InvalidJoinConditionRightSourceError -title: InvalidJoinConditionRightSourceError ---- - -# Class: InvalidJoinConditionRightSourceError - -Defined in: [packages/db/src/errors.ts:489](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L489) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new InvalidJoinConditionRightSourceError(sourceAlias): InvalidJoinConditionRightSourceError; -``` - -Defined in: [packages/db/src/errors.ts:490](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L490) - -#### Parameters - -##### sourceAlias - -`string` - -#### Returns - -`InvalidJoinConditionRightSourceError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionSameSourceError.md b/docs/reference/classes/InvalidJoinConditionSameSourceError.md deleted file mode 100644 index 0915736d7..000000000 --- a/docs/reference/classes/InvalidJoinConditionSameSourceError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: InvalidJoinConditionSameSourceError -title: InvalidJoinConditionSameSourceError ---- - -# Class: InvalidJoinConditionSameSourceError - -Defined in: [packages/db/src/errors.ts:467](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L467) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new InvalidJoinConditionSameSourceError(sourceAlias): InvalidJoinConditionSameSourceError; -``` - -Defined in: [packages/db/src/errors.ts:468](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L468) - -#### Parameters - -##### sourceAlias - -`string` - -#### Returns - -`InvalidJoinConditionSameSourceError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md b/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md deleted file mode 100644 index da3e0ca47..000000000 --- a/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: InvalidJoinConditionSourceMismatchError -title: InvalidJoinConditionSourceMismatchError ---- - -# Class: InvalidJoinConditionSourceMismatchError - -Defined in: [packages/db/src/errors.ts:475](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L475) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new InvalidJoinConditionSourceMismatchError(): InvalidJoinConditionSourceMismatchError; -``` - -Defined in: [packages/db/src/errors.ts:476](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L476) - -#### Returns - -`InvalidJoinConditionSourceMismatchError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidSchemaError.md b/docs/reference/classes/InvalidSchemaError.md deleted file mode 100644 index a98453c36..000000000 --- a/docs/reference/classes/InvalidSchemaError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: InvalidSchemaError -title: InvalidSchemaError ---- - -# Class: InvalidSchemaError - -Defined in: [packages/db/src/errors.ts:90](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L90) - -## Extends - -- [`CollectionConfigurationError`](../CollectionConfigurationError.md) - -## Constructors - -### Constructor - -```ts -new InvalidSchemaError(): InvalidSchemaError; -``` - -Defined in: [packages/db/src/errors.ts:91](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L91) - -#### Returns - -`InvalidSchemaError` - -#### Overrides - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidSourceError.md b/docs/reference/classes/InvalidSourceError.md deleted file mode 100644 index 23fea4c1d..000000000 --- a/docs/reference/classes/InvalidSourceError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: InvalidSourceError -title: InvalidSourceError ---- - -# Class: InvalidSourceError - -Defined in: [packages/db/src/errors.ts:339](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L339) - -## Extends - -- [`QueryBuilderError`](../QueryBuilderError.md) - -## Constructors - -### Constructor - -```ts -new InvalidSourceError(alias): InvalidSourceError; -``` - -Defined in: [packages/db/src/errors.ts:340](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L340) - -#### Parameters - -##### alias - -`string` - -#### Returns - -`InvalidSourceError` - -#### Overrides - -[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidStorageDataFormatError.md b/docs/reference/classes/InvalidStorageDataFormatError.md deleted file mode 100644 index ab6c2eeaa..000000000 --- a/docs/reference/classes/InvalidStorageDataFormatError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: InvalidStorageDataFormatError -title: InvalidStorageDataFormatError ---- - -# Class: InvalidStorageDataFormatError - -Defined in: [packages/db/src/errors.ts:575](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L575) - -## Extends - -- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) - -## Constructors - -### Constructor - -```ts -new InvalidStorageDataFormatError(storageKey, key): InvalidStorageDataFormatError; -``` - -Defined in: [packages/db/src/errors.ts:576](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L576) - -#### Parameters - -##### storageKey - -`string` - -##### key - -`string` - -#### Returns - -`InvalidStorageDataFormatError` - -#### Overrides - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidStorageObjectFormatError.md b/docs/reference/classes/InvalidStorageObjectFormatError.md deleted file mode 100644 index a08dbf47b..000000000 --- a/docs/reference/classes/InvalidStorageObjectFormatError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: InvalidStorageObjectFormatError -title: InvalidStorageObjectFormatError ---- - -# Class: InvalidStorageObjectFormatError - -Defined in: [packages/db/src/errors.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L583) - -## Extends - -- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) - -## Constructors - -### Constructor - -```ts -new InvalidStorageObjectFormatError(storageKey): InvalidStorageObjectFormatError; -``` - -Defined in: [packages/db/src/errors.ts:584](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L584) - -#### Parameters - -##### storageKey - -`string` - -#### Returns - -`InvalidStorageObjectFormatError` - -#### Overrides - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinCollectionNotFoundError.md b/docs/reference/classes/JoinCollectionNotFoundError.md deleted file mode 100644 index 931a5016f..000000000 --- a/docs/reference/classes/JoinCollectionNotFoundError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: JoinCollectionNotFoundError -title: JoinCollectionNotFoundError ---- - -# Class: JoinCollectionNotFoundError - -Defined in: [packages/db/src/errors.ts:447](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L447) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new JoinCollectionNotFoundError(collectionId): JoinCollectionNotFoundError; -``` - -Defined in: [packages/db/src/errors.ts:448](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L448) - -#### Parameters - -##### collectionId - -`string` - -#### Returns - -`JoinCollectionNotFoundError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinConditionMustBeEqualityError.md b/docs/reference/classes/JoinConditionMustBeEqualityError.md deleted file mode 100644 index 2a843bbfe..000000000 --- a/docs/reference/classes/JoinConditionMustBeEqualityError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: JoinConditionMustBeEqualityError -title: JoinConditionMustBeEqualityError ---- - -# Class: JoinConditionMustBeEqualityError - -Defined in: [packages/db/src/errors.ts:347](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L347) - -## Extends - -- [`QueryBuilderError`](../QueryBuilderError.md) - -## Constructors - -### Constructor - -```ts -new JoinConditionMustBeEqualityError(): JoinConditionMustBeEqualityError; -``` - -Defined in: [packages/db/src/errors.ts:348](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L348) - -#### Returns - -`JoinConditionMustBeEqualityError` - -#### Overrides - -[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinError.md b/docs/reference/classes/JoinError.md deleted file mode 100644 index ce0a159fa..000000000 --- a/docs/reference/classes/JoinError.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -id: JoinError -title: JoinError ---- - -# Class: JoinError - -Defined in: [packages/db/src/errors.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L454) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`UnsupportedJoinTypeError`](../UnsupportedJoinTypeError.md) -- [`InvalidJoinConditionSameSourceError`](../InvalidJoinConditionSameSourceError.md) -- [`InvalidJoinConditionSourceMismatchError`](../InvalidJoinConditionSourceMismatchError.md) -- [`InvalidJoinConditionLeftSourceError`](../InvalidJoinConditionLeftSourceError.md) -- [`InvalidJoinConditionRightSourceError`](../InvalidJoinConditionRightSourceError.md) -- [`InvalidJoinCondition`](../InvalidJoinCondition.md) -- [`UnsupportedJoinSourceTypeError`](../UnsupportedJoinSourceTypeError.md) - -## Constructors - -### Constructor - -```ts -new JoinError(message): JoinError; -``` - -Defined in: [packages/db/src/errors.ts:455](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L455) - -#### Parameters - -##### message - -`string` - -#### Returns - -`JoinError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/KeyUpdateNotAllowedError.md b/docs/reference/classes/KeyUpdateNotAllowedError.md deleted file mode 100644 index 269bb3572..000000000 --- a/docs/reference/classes/KeyUpdateNotAllowedError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: KeyUpdateNotAllowedError -title: KeyUpdateNotAllowedError ---- - -# Class: KeyUpdateNotAllowedError - -Defined in: [packages/db/src/errors.ts:190](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L190) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new KeyUpdateNotAllowedError(originalKey, newKey): KeyUpdateNotAllowedError; -``` - -Defined in: [packages/db/src/errors.ts:191](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L191) - -#### Parameters - -##### originalKey - -`string` | `number` - -##### newKey - -`string` | `number` - -#### Returns - -`KeyUpdateNotAllowedError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/LazyIndexWrapper.md b/docs/reference/classes/LazyIndexWrapper.md deleted file mode 100644 index 45592142b..000000000 --- a/docs/reference/classes/LazyIndexWrapper.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -id: LazyIndexWrapper -title: LazyIndexWrapper ---- - -# Class: LazyIndexWrapper\ - -Defined in: [packages/db/src/indexes/lazy-index.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L39) - -Wrapper that defers index creation until first sync - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Constructors - -### Constructor - -```ts -new LazyIndexWrapper( - id, - expression, - name, - resolver, - options, -collectionEntries?): LazyIndexWrapper; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L43) - -#### Parameters - -##### id - -`number` - -##### expression - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -##### name - -`string` | `undefined` - -##### resolver - -[`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> - -##### options - -`any` - -##### collectionEntries? - -`Iterable`\<\[`TKey`, `any`\], `any`, `any`\> - -#### Returns - -`LazyIndexWrapper`\<`TKey`\> - -## Methods - -### getExpression() - -```ts -getExpression(): BasicExpression; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:118](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L118) - -Get the index expression - -#### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -*** - -### getId() - -```ts -getId(): number; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L104) - -Get the index ID - -#### Returns - -`number` - -*** - -### getName() - -```ts -getName(): string | undefined; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L111) - -Get the index name - -#### Returns - -`string` \| `undefined` - -*** - -### getResolved() - -```ts -getResolved(): BaseIndex; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L92) - -Get resolved index (throws if not ready) - -#### Returns - -[`BaseIndex`](../BaseIndex.md)\<`TKey`\> - -*** - -### isResolved() - -```ts -isResolved(): boolean; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L85) - -Check if already resolved - -#### Returns - -`boolean` - -*** - -### resolve() - -```ts -resolve(): Promise>; -``` - -Defined in: [packages/db/src/indexes/lazy-index.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L69) - -Resolve the actual index - -#### Returns - -`Promise`\<[`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> diff --git a/docs/reference/classes/LimitOffsetRequireOrderByError.md b/docs/reference/classes/LimitOffsetRequireOrderByError.md deleted file mode 100644 index 60d20a51a..000000000 --- a/docs/reference/classes/LimitOffsetRequireOrderByError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: LimitOffsetRequireOrderByError -title: LimitOffsetRequireOrderByError ---- - -# Class: LimitOffsetRequireOrderByError - -Defined in: [packages/db/src/errors.ts:379](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L379) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new LimitOffsetRequireOrderByError(): LimitOffsetRequireOrderByError; -``` - -Defined in: [packages/db/src/errors.ts:380](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L380) - -#### Returns - -`LimitOffsetRequireOrderByError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/LocalStorageCollectionError.md b/docs/reference/classes/LocalStorageCollectionError.md deleted file mode 100644 index 851ef7f60..000000000 --- a/docs/reference/classes/LocalStorageCollectionError.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -id: LocalStorageCollectionError -title: LocalStorageCollectionError ---- - -# Class: LocalStorageCollectionError - -Defined in: [packages/db/src/errors.ts:562](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L562) - -## Extends - -- [`StorageError`](../StorageError.md) - -## Extended by - -- [`StorageKeyRequiredError`](../StorageKeyRequiredError.md) -- [`InvalidStorageDataFormatError`](../InvalidStorageDataFormatError.md) -- [`InvalidStorageObjectFormatError`](../InvalidStorageObjectFormatError.md) - -## Constructors - -### Constructor - -```ts -new LocalStorageCollectionError(message): LocalStorageCollectionError; -``` - -Defined in: [packages/db/src/errors.ts:563](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L563) - -#### Parameters - -##### message - -`string` - -#### Returns - -`LocalStorageCollectionError` - -#### Overrides - -[`StorageError`](../StorageError.md).[`constructor`](../StorageError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`cause`](../StorageError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`message`](../StorageError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`name`](../StorageError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`stack`](../StorageError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`StorageError`](../StorageError.md).[`stackTraceLimit`](../StorageError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`StorageError`](../StorageError.md).[`captureStackTrace`](../StorageError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`StorageError`](../StorageError.md).[`prepareStackTrace`](../StorageError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingAliasInputsError.md b/docs/reference/classes/MissingAliasInputsError.md deleted file mode 100644 index daf6f21ef..000000000 --- a/docs/reference/classes/MissingAliasInputsError.md +++ /dev/null @@ -1,223 +0,0 @@ ---- -id: MissingAliasInputsError -title: MissingAliasInputsError ---- - -# Class: MissingAliasInputsError - -Defined in: [packages/db/src/errors.ts:659](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L659) - -Internal error when the compiler returns aliases that don't have corresponding input streams. -This should never happen since all aliases come from user declarations. - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new MissingAliasInputsError(missingAliases): MissingAliasInputsError; -``` - -Defined in: [packages/db/src/errors.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L660) - -#### Parameters - -##### missingAliases - -`string`[] - -#### Returns - -`MissingAliasInputsError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingDeleteHandlerError.md b/docs/reference/classes/MissingDeleteHandlerError.md deleted file mode 100644 index 9c2a9075f..000000000 --- a/docs/reference/classes/MissingDeleteHandlerError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: MissingDeleteHandlerError -title: MissingDeleteHandlerError ---- - -# Class: MissingDeleteHandlerError - -Defined in: [packages/db/src/errors.ts:236](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L236) - -## Extends - -- [`MissingHandlerError`](../MissingHandlerError.md) - -## Constructors - -### Constructor - -```ts -new MissingDeleteHandlerError(): MissingDeleteHandlerError; -``` - -Defined in: [packages/db/src/errors.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L237) - -#### Returns - -`MissingDeleteHandlerError` - -#### Overrides - -[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingHandlerError.md b/docs/reference/classes/MissingHandlerError.md deleted file mode 100644 index f5c9c14d5..000000000 --- a/docs/reference/classes/MissingHandlerError.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -id: MissingHandlerError -title: MissingHandlerError ---- - -# Class: MissingHandlerError - -Defined in: [packages/db/src/errors.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L213) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`MissingInsertHandlerError`](../MissingInsertHandlerError.md) -- [`MissingUpdateHandlerError`](../MissingUpdateHandlerError.md) -- [`MissingDeleteHandlerError`](../MissingDeleteHandlerError.md) - -## Constructors - -### Constructor - -```ts -new MissingHandlerError(message): MissingHandlerError; -``` - -Defined in: [packages/db/src/errors.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L214) - -#### Parameters - -##### message - -`string` - -#### Returns - -`MissingHandlerError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingInsertHandlerError.md b/docs/reference/classes/MissingInsertHandlerError.md deleted file mode 100644 index 234ae6450..000000000 --- a/docs/reference/classes/MissingInsertHandlerError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: MissingInsertHandlerError -title: MissingInsertHandlerError ---- - -# Class: MissingInsertHandlerError - -Defined in: [packages/db/src/errors.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L220) - -## Extends - -- [`MissingHandlerError`](../MissingHandlerError.md) - -## Constructors - -### Constructor - -```ts -new MissingInsertHandlerError(): MissingInsertHandlerError; -``` - -Defined in: [packages/db/src/errors.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L221) - -#### Returns - -`MissingInsertHandlerError` - -#### Overrides - -[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingMutationFunctionError.md b/docs/reference/classes/MissingMutationFunctionError.md deleted file mode 100644 index 53c895268..000000000 --- a/docs/reference/classes/MissingMutationFunctionError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: MissingMutationFunctionError -title: MissingMutationFunctionError ---- - -# Class: MissingMutationFunctionError - -Defined in: [packages/db/src/errors.ts:252](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L252) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new MissingMutationFunctionError(): MissingMutationFunctionError; -``` - -Defined in: [packages/db/src/errors.ts:253](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L253) - -#### Returns - -`MissingMutationFunctionError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingUpdateArgumentError.md b/docs/reference/classes/MissingUpdateArgumentError.md deleted file mode 100644 index 6382787b1..000000000 --- a/docs/reference/classes/MissingUpdateArgumentError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: MissingUpdateArgumentError -title: MissingUpdateArgumentError ---- - -# Class: MissingUpdateArgumentError - -Defined in: [packages/db/src/errors.ts:170](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L170) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new MissingUpdateArgumentError(): MissingUpdateArgumentError; -``` - -Defined in: [packages/db/src/errors.ts:171](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L171) - -#### Returns - -`MissingUpdateArgumentError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingUpdateHandlerError.md b/docs/reference/classes/MissingUpdateHandlerError.md deleted file mode 100644 index dddb7d4c0..000000000 --- a/docs/reference/classes/MissingUpdateHandlerError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: MissingUpdateHandlerError -title: MissingUpdateHandlerError ---- - -# Class: MissingUpdateHandlerError - -Defined in: [packages/db/src/errors.ts:228](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L228) - -## Extends - -- [`MissingHandlerError`](../MissingHandlerError.md) - -## Constructors - -### Constructor - -```ts -new MissingUpdateHandlerError(): MissingUpdateHandlerError; -``` - -Defined in: [packages/db/src/errors.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L229) - -#### Returns - -`MissingUpdateHandlerError` - -#### Overrides - -[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/NegativeActiveSubscribersError.md b/docs/reference/classes/NegativeActiveSubscribersError.md deleted file mode 100644 index cd3b1cc36..000000000 --- a/docs/reference/classes/NegativeActiveSubscribersError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: NegativeActiveSubscribersError -title: NegativeActiveSubscribersError ---- - -# Class: NegativeActiveSubscribersError - -Defined in: [packages/db/src/errors.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L132) - -## Extends - -- [`CollectionStateError`](../CollectionStateError.md) - -## Constructors - -### Constructor - -```ts -new NegativeActiveSubscribersError(): NegativeActiveSubscribersError; -``` - -Defined in: [packages/db/src/errors.ts:133](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L133) - -#### Returns - -`NegativeActiveSubscribersError` - -#### Overrides - -[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/NoKeysPassedToDeleteError.md b/docs/reference/classes/NoKeysPassedToDeleteError.md deleted file mode 100644 index 25270764b..000000000 --- a/docs/reference/classes/NoKeysPassedToDeleteError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: NoKeysPassedToDeleteError -title: NoKeysPassedToDeleteError ---- - -# Class: NoKeysPassedToDeleteError - -Defined in: [packages/db/src/errors.ts:198](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L198) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new NoKeysPassedToDeleteError(): NoKeysPassedToDeleteError; -``` - -Defined in: [packages/db/src/errors.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L199) - -#### Returns - -`NoKeysPassedToDeleteError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/NoKeysPassedToUpdateError.md b/docs/reference/classes/NoKeysPassedToUpdateError.md deleted file mode 100644 index f9548e768..000000000 --- a/docs/reference/classes/NoKeysPassedToUpdateError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: NoKeysPassedToUpdateError -title: NoKeysPassedToUpdateError ---- - -# Class: NoKeysPassedToUpdateError - -Defined in: [packages/db/src/errors.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L176) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new NoKeysPassedToUpdateError(): NoKeysPassedToUpdateError; -``` - -Defined in: [packages/db/src/errors.ts:177](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L177) - -#### Returns - -`NoKeysPassedToUpdateError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/NoPendingSyncTransactionCommitError.md b/docs/reference/classes/NoPendingSyncTransactionCommitError.md deleted file mode 100644 index 830f3f3d9..000000000 --- a/docs/reference/classes/NoPendingSyncTransactionCommitError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: NoPendingSyncTransactionCommitError -title: NoPendingSyncTransactionCommitError ---- - -# Class: NoPendingSyncTransactionCommitError - -Defined in: [packages/db/src/errors.ts:305](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L305) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new NoPendingSyncTransactionCommitError(): NoPendingSyncTransactionCommitError; -``` - -Defined in: [packages/db/src/errors.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L306) - -#### Returns - -`NoPendingSyncTransactionCommitError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/NoPendingSyncTransactionWriteError.md b/docs/reference/classes/NoPendingSyncTransactionWriteError.md deleted file mode 100644 index 53260bfa4..000000000 --- a/docs/reference/classes/NoPendingSyncTransactionWriteError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: NoPendingSyncTransactionWriteError -title: NoPendingSyncTransactionWriteError ---- - -# Class: NoPendingSyncTransactionWriteError - -Defined in: [packages/db/src/errors.ts:291](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L291) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new NoPendingSyncTransactionWriteError(): NoPendingSyncTransactionWriteError; -``` - -Defined in: [packages/db/src/errors.ts:292](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L292) - -#### Returns - -`NoPendingSyncTransactionWriteError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md b/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md deleted file mode 100644 index a8b5b02bb..000000000 --- a/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: NonAggregateExpressionNotInGroupByError -title: NonAggregateExpressionNotInGroupByError ---- - -# Class: NonAggregateExpressionNotInGroupByError - -Defined in: [packages/db/src/errors.ts:517](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L517) - -## Extends - -- [`GroupByError`](../GroupByError.md) - -## Constructors - -### Constructor - -```ts -new NonAggregateExpressionNotInGroupByError(alias): NonAggregateExpressionNotInGroupByError; -``` - -Defined in: [packages/db/src/errors.ts:518](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L518) - -#### Parameters - -##### alias - -`string` - -#### Returns - -`NonAggregateExpressionNotInGroupByError` - -#### Overrides - -[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/NonRetriableError.md b/docs/reference/classes/NonRetriableError.md deleted file mode 100644 index c048829fd..000000000 --- a/docs/reference/classes/NonRetriableError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: NonRetriableError -title: NonRetriableError ---- - -# Class: NonRetriableError - -Defined in: [packages/db/src/errors.ts:10](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L10) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Constructors - -### Constructor - -```ts -new NonRetriableError(message): NonRetriableError; -``` - -Defined in: [packages/db/src/errors.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L11) - -#### Parameters - -##### message - -`string` - -#### Returns - -`NonRetriableError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/OnMutateMustBeSynchronousError.md b/docs/reference/classes/OnMutateMustBeSynchronousError.md deleted file mode 100644 index f227a2ccb..000000000 --- a/docs/reference/classes/OnMutateMustBeSynchronousError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: OnMutateMustBeSynchronousError -title: OnMutateMustBeSynchronousError ---- - -# Class: OnMutateMustBeSynchronousError - -Defined in: [packages/db/src/errors.ts:258](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L258) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new OnMutateMustBeSynchronousError(): OnMutateMustBeSynchronousError; -``` - -Defined in: [packages/db/src/errors.ts:259](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L259) - -#### Returns - -`OnMutateMustBeSynchronousError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/OnlyOneSourceAllowedError.md b/docs/reference/classes/OnlyOneSourceAllowedError.md deleted file mode 100644 index a834bbe02..000000000 --- a/docs/reference/classes/OnlyOneSourceAllowedError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: OnlyOneSourceAllowedError -title: OnlyOneSourceAllowedError ---- - -# Class: OnlyOneSourceAllowedError - -Defined in: [packages/db/src/errors.ts:327](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L327) - -## Extends - -- [`QueryBuilderError`](../QueryBuilderError.md) - -## Constructors - -### Constructor - -```ts -new OnlyOneSourceAllowedError(context): OnlyOneSourceAllowedError; -``` - -Defined in: [packages/db/src/errors.ts:328](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L328) - -#### Parameters - -##### context - -`string` - -#### Returns - -`OnlyOneSourceAllowedError` - -#### Overrides - -[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryBuilderError.md b/docs/reference/classes/QueryBuilderError.md deleted file mode 100644 index 088ac876e..000000000 --- a/docs/reference/classes/QueryBuilderError.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -id: QueryBuilderError -title: QueryBuilderError ---- - -# Class: QueryBuilderError - -Defined in: [packages/db/src/errors.ts:320](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L320) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`OnlyOneSourceAllowedError`](../OnlyOneSourceAllowedError.md) -- [`SubQueryMustHaveFromClauseError`](../SubQueryMustHaveFromClauseError.md) -- [`InvalidSourceError`](../InvalidSourceError.md) -- [`JoinConditionMustBeEqualityError`](../JoinConditionMustBeEqualityError.md) -- [`QueryMustHaveFromClauseError`](../QueryMustHaveFromClauseError.md) - -## Constructors - -### Constructor - -```ts -new QueryBuilderError(message): QueryBuilderError; -``` - -Defined in: [packages/db/src/errors.ts:321](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L321) - -#### Parameters - -##### message - -`string` - -#### Returns - -`QueryBuilderError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryCompilationError.md b/docs/reference/classes/QueryCompilationError.md deleted file mode 100644 index 8b6542c43..000000000 --- a/docs/reference/classes/QueryCompilationError.md +++ /dev/null @@ -1,237 +0,0 @@ ---- -id: QueryCompilationError -title: QueryCompilationError ---- - -# Class: QueryCompilationError - -Defined in: [packages/db/src/errors.ts:360](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L360) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`DistinctRequiresSelectError`](../DistinctRequiresSelectError.md) -- [`HavingRequiresGroupByError`](../HavingRequiresGroupByError.md) -- [`LimitOffsetRequireOrderByError`](../LimitOffsetRequireOrderByError.md) -- [`CollectionInputNotFoundError`](../CollectionInputNotFoundError.md) -- [`DuplicateAliasInSubqueryError`](../DuplicateAliasInSubqueryError.md) -- [`UnsupportedFromTypeError`](../UnsupportedFromTypeError.md) -- [`UnknownExpressionTypeError`](../UnknownExpressionTypeError.md) -- [`EmptyReferencePathError`](../EmptyReferencePathError.md) -- [`UnknownFunctionError`](../UnknownFunctionError.md) -- [`JoinCollectionNotFoundError`](../JoinCollectionNotFoundError.md) -- [`SubscriptionNotFoundError`](../SubscriptionNotFoundError.md) -- [`AggregateNotSupportedError`](../AggregateNotSupportedError.md) -- [`MissingAliasInputsError`](../MissingAliasInputsError.md) -- [`SetWindowRequiresOrderByError`](../SetWindowRequiresOrderByError.md) - -## Constructors - -### Constructor - -```ts -new QueryCompilationError(message): QueryCompilationError; -``` - -Defined in: [packages/db/src/errors.ts:361](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L361) - -#### Parameters - -##### message - -`string` - -#### Returns - -`QueryCompilationError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryMustHaveFromClauseError.md b/docs/reference/classes/QueryMustHaveFromClauseError.md deleted file mode 100644 index 4d0b6b6a4..000000000 --- a/docs/reference/classes/QueryMustHaveFromClauseError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: QueryMustHaveFromClauseError -title: QueryMustHaveFromClauseError ---- - -# Class: QueryMustHaveFromClauseError - -Defined in: [packages/db/src/errors.ts:353](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L353) - -## Extends - -- [`QueryBuilderError`](../QueryBuilderError.md) - -## Constructors - -### Constructor - -```ts -new QueryMustHaveFromClauseError(): QueryMustHaveFromClauseError; -``` - -Defined in: [packages/db/src/errors.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L354) - -#### Returns - -`QueryMustHaveFromClauseError` - -#### Overrides - -[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryOptimizerError.md b/docs/reference/classes/QueryOptimizerError.md deleted file mode 100644 index 54608cc22..000000000 --- a/docs/reference/classes/QueryOptimizerError.md +++ /dev/null @@ -1,225 +0,0 @@ ---- -id: QueryOptimizerError -title: QueryOptimizerError ---- - -# Class: QueryOptimizerError - -Defined in: [packages/db/src/errors.ts:603](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L603) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`CannotCombineEmptyExpressionListError`](../CannotCombineEmptyExpressionListError.md) -- [`WhereClauseConversionError`](../WhereClauseConversionError.md) - -## Constructors - -### Constructor - -```ts -new QueryOptimizerError(message): QueryOptimizerError; -``` - -Defined in: [packages/db/src/errors.ts:604](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L604) - -#### Parameters - -##### message - -`string` - -#### Returns - -`QueryOptimizerError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SchemaMustBeSynchronousError.md b/docs/reference/classes/SchemaMustBeSynchronousError.md deleted file mode 100644 index 85d06e5fa..000000000 --- a/docs/reference/classes/SchemaMustBeSynchronousError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: SchemaMustBeSynchronousError -title: SchemaMustBeSynchronousError ---- - -# Class: SchemaMustBeSynchronousError - -Defined in: [packages/db/src/errors.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L96) - -## Extends - -- [`CollectionConfigurationError`](../CollectionConfigurationError.md) - -## Constructors - -### Constructor - -```ts -new SchemaMustBeSynchronousError(): SchemaMustBeSynchronousError; -``` - -Defined in: [packages/db/src/errors.ts:97](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L97) - -#### Returns - -`SchemaMustBeSynchronousError` - -#### Overrides - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/SchemaValidationError.md b/docs/reference/classes/SchemaValidationError.md deleted file mode 100644 index fecd17ffa..000000000 --- a/docs/reference/classes/SchemaValidationError.md +++ /dev/null @@ -1,251 +0,0 @@ ---- -id: SchemaValidationError -title: SchemaValidationError ---- - -# Class: SchemaValidationError - -Defined in: [packages/db/src/errors.ts:18](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L18) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Constructors - -### Constructor - -```ts -new SchemaValidationError( - type, - issues, - message?): SchemaValidationError; -``` - -Defined in: [packages/db/src/errors.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L25) - -#### Parameters - -##### type - -`"insert"` | `"update"` - -##### issues - -readonly `object`[] - -##### message? - -`string` - -#### Returns - -`SchemaValidationError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### issues - -```ts -issues: readonly object[]; -``` - -Defined in: [packages/db/src/errors.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L20) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### type - -```ts -type: "insert" | "update"; -``` - -Defined in: [packages/db/src/errors.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L19) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SerializationError.md b/docs/reference/classes/SerializationError.md deleted file mode 100644 index 0723d29c1..000000000 --- a/docs/reference/classes/SerializationError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: SerializationError -title: SerializationError ---- - -# Class: SerializationError - -Defined in: [packages/db/src/errors.ts:553](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L553) - -## Extends - -- [`StorageError`](../StorageError.md) - -## Constructors - -### Constructor - -```ts -new SerializationError(operation, originalError): SerializationError; -``` - -Defined in: [packages/db/src/errors.ts:554](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L554) - -#### Parameters - -##### operation - -`string` - -##### originalError - -`string` - -#### Returns - -`SerializationError` - -#### Overrides - -[`StorageError`](../StorageError.md).[`constructor`](../StorageError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`cause`](../StorageError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`message`](../StorageError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`name`](../StorageError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`StorageError`](../StorageError.md).[`stack`](../StorageError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`StorageError`](../StorageError.md).[`stackTraceLimit`](../StorageError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`StorageError`](../StorageError.md).[`captureStackTrace`](../StorageError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`StorageError`](../StorageError.md).[`prepareStackTrace`](../StorageError.md#preparestacktrace) diff --git a/docs/reference/classes/SetWindowRequiresOrderByError.md b/docs/reference/classes/SetWindowRequiresOrderByError.md deleted file mode 100644 index cdcb797dd..000000000 --- a/docs/reference/classes/SetWindowRequiresOrderByError.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -id: SetWindowRequiresOrderByError -title: SetWindowRequiresOrderByError ---- - -# Class: SetWindowRequiresOrderByError - -Defined in: [packages/db/src/errors.ts:671](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L671) - -Error thrown when setWindow is called on a collection without an ORDER BY clause. - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new SetWindowRequiresOrderByError(): SetWindowRequiresOrderByError; -``` - -Defined in: [packages/db/src/errors.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L672) - -#### Returns - -`SetWindowRequiresOrderByError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/SortedMap.md b/docs/reference/classes/SortedMap.md deleted file mode 100644 index 9b81f77cf..000000000 --- a/docs/reference/classes/SortedMap.md +++ /dev/null @@ -1,288 +0,0 @@ ---- -id: SortedMap -title: SortedMap ---- - -# Class: SortedMap\ - -Defined in: [packages/db/src/SortedMap.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L6) - -A Map implementation that keeps its entries sorted based on a comparator function - -## Type Parameters - -### TKey - -`TKey` - -The type of keys in the map - -### TValue - -`TValue` - -The type of values in the map - -## Constructors - -### Constructor - -```ts -new SortedMap(comparator?): SortedMap; -``` - -Defined in: [packages/db/src/SortedMap.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L16) - -Creates a new SortedMap instance - -#### Parameters - -##### comparator? - -(`a`, `b`) => `number` - -Optional function to compare values for sorting - -#### Returns - -`SortedMap`\<`TKey`, `TValue`\> - -## Accessors - -### size - -#### Get Signature - -```ts -get size(): number; -``` - -Defined in: [packages/db/src/SortedMap.ts:138](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L138) - -Gets the number of key-value pairs in the map - -##### Returns - -`number` - -## Methods - -### \[iterator\]() - -```ts -iterator: IterableIterator<[TKey, TValue]>; -``` - -Defined in: [packages/db/src/SortedMap.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L147) - -Default iterator that returns entries in sorted order - -#### Returns - -`IterableIterator`\<\[`TKey`, `TValue`\]\> - -An iterator for the map's entries - -*** - -### clear() - -```ts -clear(): void; -``` - -Defined in: [packages/db/src/SortedMap.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L130) - -Removes all key-value pairs from the map - -#### Returns - -`void` - -*** - -### delete() - -```ts -delete(key): boolean; -``` - -Defined in: [packages/db/src/SortedMap.ts:106](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L106) - -Removes a key-value pair from the map - -#### Parameters - -##### key - -`TKey` - -The key to remove - -#### Returns - -`boolean` - -True if the key was found and removed, false otherwise - -*** - -### entries() - -```ts -entries(): IterableIterator<[TKey, TValue]>; -``` - -Defined in: [packages/db/src/SortedMap.ts:158](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L158) - -Returns an iterator for the map's entries in sorted order - -#### Returns - -`IterableIterator`\<\[`TKey`, `TValue`\]\> - -An iterator for the map's entries - -*** - -### forEach() - -```ts -forEach(callbackfn): void; -``` - -Defined in: [packages/db/src/SortedMap.ts:189](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L189) - -Executes a callback function for each key-value pair in the map in sorted order - -#### Parameters - -##### callbackfn - -(`value`, `key`, `map`) => `void` - -Function to execute for each entry - -#### Returns - -`void` - -*** - -### get() - -```ts -get(key): TValue | undefined; -``` - -Defined in: [packages/db/src/SortedMap.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L96) - -Gets a value by its key - -#### Parameters - -##### key - -`TKey` - -The key to look up - -#### Returns - -`TValue` \| `undefined` - -The value associated with the key, or undefined if not found - -*** - -### has() - -```ts -has(key): boolean; -``` - -Defined in: [packages/db/src/SortedMap.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L123) - -Checks if a key exists in the map - -#### Parameters - -##### key - -`TKey` - -The key to check - -#### Returns - -`boolean` - -True if the key exists, false otherwise - -*** - -### keys() - -```ts -keys(): IterableIterator; -``` - -Defined in: [packages/db/src/SortedMap.ts:167](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L167) - -Returns an iterator for the map's keys in sorted order - -#### Returns - -`IterableIterator`\<`TKey`\> - -An iterator for the map's keys - -*** - -### set() - -```ts -set(key, value): this; -``` - -Defined in: [packages/db/src/SortedMap.ts:73](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L73) - -Sets a key-value pair in the map and maintains sort order - -#### Parameters - -##### key - -`TKey` - -The key to set - -##### value - -`TValue` - -The value to associate with the key - -#### Returns - -`this` - -This SortedMap instance for chaining - -*** - -### values() - -```ts -values(): IterableIterator; -``` - -Defined in: [packages/db/src/SortedMap.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L176) - -Returns an iterator for the map's values in sorted order - -#### Returns - -`IterableIterator`\<`TValue`\> - -An iterator for the map's values diff --git a/docs/reference/classes/StorageError.md b/docs/reference/classes/StorageError.md deleted file mode 100644 index 37dd38604..000000000 --- a/docs/reference/classes/StorageError.md +++ /dev/null @@ -1,225 +0,0 @@ ---- -id: StorageError -title: StorageError ---- - -# Class: StorageError - -Defined in: [packages/db/src/errors.ts:546](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L546) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`SerializationError`](../SerializationError.md) -- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) - -## Constructors - -### Constructor - -```ts -new StorageError(message): StorageError; -``` - -Defined in: [packages/db/src/errors.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L547) - -#### Parameters - -##### message - -`string` - -#### Returns - -`StorageError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/StorageKeyRequiredError.md b/docs/reference/classes/StorageKeyRequiredError.md deleted file mode 100644 index 3ed1dec0b..000000000 --- a/docs/reference/classes/StorageKeyRequiredError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: StorageKeyRequiredError -title: StorageKeyRequiredError ---- - -# Class: StorageKeyRequiredError - -Defined in: [packages/db/src/errors.ts:569](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L569) - -## Extends - -- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) - -## Constructors - -### Constructor - -```ts -new StorageKeyRequiredError(): StorageKeyRequiredError; -``` - -Defined in: [packages/db/src/errors.ts:570](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L570) - -#### Returns - -`StorageKeyRequiredError` - -#### Overrides - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/SubQueryMustHaveFromClauseError.md b/docs/reference/classes/SubQueryMustHaveFromClauseError.md deleted file mode 100644 index 6783eb90b..000000000 --- a/docs/reference/classes/SubQueryMustHaveFromClauseError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: SubQueryMustHaveFromClauseError -title: SubQueryMustHaveFromClauseError ---- - -# Class: SubQueryMustHaveFromClauseError - -Defined in: [packages/db/src/errors.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L333) - -## Extends - -- [`QueryBuilderError`](../QueryBuilderError.md) - -## Constructors - -### Constructor - -```ts -new SubQueryMustHaveFromClauseError(context): SubQueryMustHaveFromClauseError; -``` - -Defined in: [packages/db/src/errors.ts:334](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L334) - -#### Parameters - -##### context - -`string` - -#### Returns - -`SubQueryMustHaveFromClauseError` - -#### Overrides - -[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/SubscriptionNotFoundError.md b/docs/reference/classes/SubscriptionNotFoundError.md deleted file mode 100644 index 53ef8e002..000000000 --- a/docs/reference/classes/SubscriptionNotFoundError.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -id: SubscriptionNotFoundError -title: SubscriptionNotFoundError ---- - -# Class: SubscriptionNotFoundError - -Defined in: [packages/db/src/errors.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L631) - -Error when a subscription cannot be found during lazy join processing. -For subqueries, aliases may be remapped (e.g., 'activeUser' → 'user'). - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new SubscriptionNotFoundError( - resolvedAlias, - originalAlias, - collectionId, - availableAliases): SubscriptionNotFoundError; -``` - -Defined in: [packages/db/src/errors.ts:632](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L632) - -#### Parameters - -##### resolvedAlias - -`string` - -##### originalAlias - -`string` - -##### collectionId - -`string` - -##### availableAliases - -`string`[] - -#### Returns - -`SubscriptionNotFoundError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncCleanupError.md b/docs/reference/classes/SyncCleanupError.md deleted file mode 100644 index 0fa3b2104..000000000 --- a/docs/reference/classes/SyncCleanupError.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: SyncCleanupError -title: SyncCleanupError ---- - -# Class: SyncCleanupError - -Defined in: [packages/db/src/errors.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L592) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Constructors - -### Constructor - -```ts -new SyncCleanupError(collectionId, error): SyncCleanupError; -``` - -Defined in: [packages/db/src/errors.ts:593](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L593) - -#### Parameters - -##### collectionId - -`string` - -##### error - -`string` | `Error` - -#### Returns - -`SyncCleanupError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncTransactionAlreadyCommittedError.md b/docs/reference/classes/SyncTransactionAlreadyCommittedError.md deleted file mode 100644 index 1b51c8402..000000000 --- a/docs/reference/classes/SyncTransactionAlreadyCommittedError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: SyncTransactionAlreadyCommittedError -title: SyncTransactionAlreadyCommittedError ---- - -# Class: SyncTransactionAlreadyCommittedError - -Defined in: [packages/db/src/errors.ts:311](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L311) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new SyncTransactionAlreadyCommittedError(): SyncTransactionAlreadyCommittedError; -``` - -Defined in: [packages/db/src/errors.ts:312](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L312) - -#### Returns - -`SyncTransactionAlreadyCommittedError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md b/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md deleted file mode 100644 index a14d05a9d..000000000 --- a/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: SyncTransactionAlreadyCommittedWriteError -title: SyncTransactionAlreadyCommittedWriteError ---- - -# Class: SyncTransactionAlreadyCommittedWriteError - -Defined in: [packages/db/src/errors.ts:297](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L297) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new SyncTransactionAlreadyCommittedWriteError(): SyncTransactionAlreadyCommittedWriteError; -``` - -Defined in: [packages/db/src/errors.ts:298](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L298) - -#### Returns - -`SyncTransactionAlreadyCommittedWriteError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TanStackDBError.md b/docs/reference/classes/TanStackDBError.md deleted file mode 100644 index dabc7ccbd..000000000 --- a/docs/reference/classes/TanStackDBError.md +++ /dev/null @@ -1,254 +0,0 @@ ---- -id: TanStackDBError -title: TanStackDBError ---- - -# Class: TanStackDBError - -Defined in: [packages/db/src/errors.ts:2](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L2) - -## Extends - -- `Error` - -## Extended by - -- [`NonRetriableError`](../NonRetriableError.md) -- [`SchemaValidationError`](../SchemaValidationError.md) -- [`DuplicateDbInstanceError`](../DuplicateDbInstanceError.md) -- [`CollectionConfigurationError`](../CollectionConfigurationError.md) -- [`CollectionStateError`](../CollectionStateError.md) -- [`CollectionOperationError`](../CollectionOperationError.md) -- [`MissingHandlerError`](../MissingHandlerError.md) -- [`TransactionError`](../TransactionError.md) -- [`QueryBuilderError`](../QueryBuilderError.md) -- [`QueryCompilationError`](../QueryCompilationError.md) -- [`JoinError`](../JoinError.md) -- [`GroupByError`](../GroupByError.md) -- [`StorageError`](../StorageError.md) -- [`SyncCleanupError`](../SyncCleanupError.md) -- [`QueryOptimizerError`](../QueryOptimizerError.md) - -## Constructors - -### Constructor - -```ts -new TanStackDBError(message): TanStackDBError; -``` - -Defined in: [packages/db/src/errors.ts:3](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L3) - -#### Parameters - -##### message - -`string` - -#### Returns - -`TanStackDBError` - -#### Overrides - -```ts -Error.constructor -``` - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -```ts -Error.cause -``` - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -```ts -Error.message -``` - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -```ts -Error.name -``` - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -```ts -Error.stack -``` - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -```ts -Error.stackTraceLimit -``` - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -```ts -Error.captureStackTrace -``` - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -```ts -Error.prepareStackTrace -``` diff --git a/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md b/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md deleted file mode 100644 index fde7154b4..000000000 --- a/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: TransactionAlreadyCompletedRollbackError -title: TransactionAlreadyCompletedRollbackError ---- - -# Class: TransactionAlreadyCompletedRollbackError - -Defined in: [packages/db/src/errors.ts:275](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L275) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new TransactionAlreadyCompletedRollbackError(): TransactionAlreadyCompletedRollbackError; -``` - -Defined in: [packages/db/src/errors.ts:276](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L276) - -#### Returns - -`TransactionAlreadyCompletedRollbackError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionError.md b/docs/reference/classes/TransactionError.md deleted file mode 100644 index aae7b1336..000000000 --- a/docs/reference/classes/TransactionError.md +++ /dev/null @@ -1,232 +0,0 @@ ---- -id: TransactionError -title: TransactionError ---- - -# Class: TransactionError - -Defined in: [packages/db/src/errors.ts:245](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L245) - -## Extends - -- [`TanStackDBError`](../TanStackDBError.md) - -## Extended by - -- [`MissingMutationFunctionError`](../MissingMutationFunctionError.md) -- [`OnMutateMustBeSynchronousError`](../OnMutateMustBeSynchronousError.md) -- [`TransactionNotPendingMutateError`](../TransactionNotPendingMutateError.md) -- [`TransactionAlreadyCompletedRollbackError`](../TransactionAlreadyCompletedRollbackError.md) -- [`TransactionNotPendingCommitError`](../TransactionNotPendingCommitError.md) -- [`NoPendingSyncTransactionWriteError`](../NoPendingSyncTransactionWriteError.md) -- [`SyncTransactionAlreadyCommittedWriteError`](../SyncTransactionAlreadyCommittedWriteError.md) -- [`NoPendingSyncTransactionCommitError`](../NoPendingSyncTransactionCommitError.md) -- [`SyncTransactionAlreadyCommittedError`](../SyncTransactionAlreadyCommittedError.md) - -## Constructors - -### Constructor - -```ts -new TransactionError(message): TransactionError; -``` - -Defined in: [packages/db/src/errors.ts:246](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L246) - -#### Parameters - -##### message - -`string` - -#### Returns - -`TransactionError` - -#### Overrides - -[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionNotPendingCommitError.md b/docs/reference/classes/TransactionNotPendingCommitError.md deleted file mode 100644 index a89cd1ae9..000000000 --- a/docs/reference/classes/TransactionNotPendingCommitError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: TransactionNotPendingCommitError -title: TransactionNotPendingCommitError ---- - -# Class: TransactionNotPendingCommitError - -Defined in: [packages/db/src/errors.ts:283](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L283) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new TransactionNotPendingCommitError(): TransactionNotPendingCommitError; -``` - -Defined in: [packages/db/src/errors.ts:284](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L284) - -#### Returns - -`TransactionNotPendingCommitError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionNotPendingMutateError.md b/docs/reference/classes/TransactionNotPendingMutateError.md deleted file mode 100644 index 88199ce3e..000000000 --- a/docs/reference/classes/TransactionNotPendingMutateError.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: TransactionNotPendingMutateError -title: TransactionNotPendingMutateError ---- - -# Class: TransactionNotPendingMutateError - -Defined in: [packages/db/src/errors.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L267) - -## Extends - -- [`TransactionError`](../TransactionError.md) - -## Constructors - -### Constructor - -```ts -new TransactionNotPendingMutateError(): TransactionNotPendingMutateError; -``` - -Defined in: [packages/db/src/errors.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L268) - -#### Returns - -`TransactionNotPendingMutateError` - -#### Overrides - -[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/UndefinedKeyError.md b/docs/reference/classes/UndefinedKeyError.md deleted file mode 100644 index 24f075ab1..000000000 --- a/docs/reference/classes/UndefinedKeyError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UndefinedKeyError -title: UndefinedKeyError ---- - -# Class: UndefinedKeyError - -Defined in: [packages/db/src/errors.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L146) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new UndefinedKeyError(item): UndefinedKeyError; -``` - -Defined in: [packages/db/src/errors.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L147) - -#### Parameters - -##### item - -`any` - -#### Returns - -`UndefinedKeyError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownExpressionTypeError.md b/docs/reference/classes/UnknownExpressionTypeError.md deleted file mode 100644 index 5eeb52f4f..000000000 --- a/docs/reference/classes/UnknownExpressionTypeError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnknownExpressionTypeError -title: UnknownExpressionTypeError ---- - -# Class: UnknownExpressionTypeError - -Defined in: [packages/db/src/errors.ts:429](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L429) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new UnknownExpressionTypeError(type): UnknownExpressionTypeError; -``` - -Defined in: [packages/db/src/errors.ts:430](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L430) - -#### Parameters - -##### type - -`string` - -#### Returns - -`UnknownExpressionTypeError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownFunctionError.md b/docs/reference/classes/UnknownFunctionError.md deleted file mode 100644 index 7b6e64991..000000000 --- a/docs/reference/classes/UnknownFunctionError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnknownFunctionError -title: UnknownFunctionError ---- - -# Class: UnknownFunctionError - -Defined in: [packages/db/src/errors.ts:441](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L441) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new UnknownFunctionError(functionName): UnknownFunctionError; -``` - -Defined in: [packages/db/src/errors.ts:442](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L442) - -#### Parameters - -##### functionName - -`string` - -#### Returns - -`UnknownFunctionError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownHavingExpressionTypeError.md b/docs/reference/classes/UnknownHavingExpressionTypeError.md deleted file mode 100644 index 7e9756cae..000000000 --- a/docs/reference/classes/UnknownHavingExpressionTypeError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnknownHavingExpressionTypeError -title: UnknownHavingExpressionTypeError ---- - -# Class: UnknownHavingExpressionTypeError - -Defined in: [packages/db/src/errors.ts:539](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L539) - -## Extends - -- [`GroupByError`](../GroupByError.md) - -## Constructors - -### Constructor - -```ts -new UnknownHavingExpressionTypeError(type): UnknownHavingExpressionTypeError; -``` - -Defined in: [packages/db/src/errors.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L540) - -#### Parameters - -##### type - -`string` - -#### Returns - -`UnknownHavingExpressionTypeError` - -#### Overrides - -[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedAggregateFunctionError.md b/docs/reference/classes/UnsupportedAggregateFunctionError.md deleted file mode 100644 index f987c691e..000000000 --- a/docs/reference/classes/UnsupportedAggregateFunctionError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnsupportedAggregateFunctionError -title: UnsupportedAggregateFunctionError ---- - -# Class: UnsupportedAggregateFunctionError - -Defined in: [packages/db/src/errors.ts:525](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L525) - -## Extends - -- [`GroupByError`](../GroupByError.md) - -## Constructors - -### Constructor - -```ts -new UnsupportedAggregateFunctionError(functionName): UnsupportedAggregateFunctionError; -``` - -Defined in: [packages/db/src/errors.ts:526](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L526) - -#### Parameters - -##### functionName - -`string` - -#### Returns - -`UnsupportedAggregateFunctionError` - -#### Overrides - -[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedFromTypeError.md b/docs/reference/classes/UnsupportedFromTypeError.md deleted file mode 100644 index 4718f35cc..000000000 --- a/docs/reference/classes/UnsupportedFromTypeError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnsupportedFromTypeError -title: UnsupportedFromTypeError ---- - -# Class: UnsupportedFromTypeError - -Defined in: [packages/db/src/errors.ts:423](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L423) - -## Extends - -- [`QueryCompilationError`](../QueryCompilationError.md) - -## Constructors - -### Constructor - -```ts -new UnsupportedFromTypeError(type): UnsupportedFromTypeError; -``` - -Defined in: [packages/db/src/errors.ts:424](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L424) - -#### Parameters - -##### type - -`string` - -#### Returns - -`UnsupportedFromTypeError` - -#### Overrides - -[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedJoinSourceTypeError.md b/docs/reference/classes/UnsupportedJoinSourceTypeError.md deleted file mode 100644 index 492d26a74..000000000 --- a/docs/reference/classes/UnsupportedJoinSourceTypeError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnsupportedJoinSourceTypeError -title: UnsupportedJoinSourceTypeError ---- - -# Class: UnsupportedJoinSourceTypeError - -Defined in: [packages/db/src/errors.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L503) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new UnsupportedJoinSourceTypeError(type): UnsupportedJoinSourceTypeError; -``` - -Defined in: [packages/db/src/errors.ts:504](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L504) - -#### Parameters - -##### type - -`string` - -#### Returns - -`UnsupportedJoinSourceTypeError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedJoinTypeError.md b/docs/reference/classes/UnsupportedJoinTypeError.md deleted file mode 100644 index 21e193861..000000000 --- a/docs/reference/classes/UnsupportedJoinTypeError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UnsupportedJoinTypeError -title: UnsupportedJoinTypeError ---- - -# Class: UnsupportedJoinTypeError - -Defined in: [packages/db/src/errors.ts:461](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L461) - -## Extends - -- [`JoinError`](../JoinError.md) - -## Constructors - -### Constructor - -```ts -new UnsupportedJoinTypeError(joinType): UnsupportedJoinTypeError; -``` - -Defined in: [packages/db/src/errors.ts:462](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L462) - -#### Parameters - -##### joinType - -`string` - -#### Returns - -`UnsupportedJoinTypeError` - -#### Overrides - -[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/UpdateKeyNotFoundError.md b/docs/reference/classes/UpdateKeyNotFoundError.md deleted file mode 100644 index 2cb718085..000000000 --- a/docs/reference/classes/UpdateKeyNotFoundError.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: UpdateKeyNotFoundError -title: UpdateKeyNotFoundError ---- - -# Class: UpdateKeyNotFoundError - -Defined in: [packages/db/src/errors.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L182) - -## Extends - -- [`CollectionOperationError`](../CollectionOperationError.md) - -## Constructors - -### Constructor - -```ts -new UpdateKeyNotFoundError(key): UpdateKeyNotFoundError; -``` - -Defined in: [packages/db/src/errors.ts:183](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L183) - -#### Parameters - -##### key - -`string` | `number` - -#### Returns - -`UpdateKeyNotFoundError` - -#### Overrides - -[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/WhereClauseConversionError.md b/docs/reference/classes/WhereClauseConversionError.md deleted file mode 100644 index e1cc1c1b5..000000000 --- a/docs/reference/classes/WhereClauseConversionError.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -id: WhereClauseConversionError -title: WhereClauseConversionError ---- - -# Class: WhereClauseConversionError - -Defined in: [packages/db/src/errors.ts:619](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L619) - -Internal error when the query optimizer fails to convert a WHERE clause to a collection filter. - -## Extends - -- [`QueryOptimizerError`](../QueryOptimizerError.md) - -## Constructors - -### Constructor - -```ts -new WhereClauseConversionError(collectionId, alias): WhereClauseConversionError; -``` - -Defined in: [packages/db/src/errors.ts:620](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L620) - -#### Parameters - -##### collectionId - -`string` - -##### alias - -`string` - -#### Returns - -`WhereClauseConversionError` - -#### Overrides - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`constructor`](../QueryOptimizerError.md#constructor) - -## Properties - -### cause? - -```ts -optional cause: unknown; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`cause`](../QueryOptimizerError.md#cause) - -*** - -### message - -```ts -message: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`message`](../QueryOptimizerError.md#message) - -*** - -### name - -```ts -name: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`name`](../QueryOptimizerError.md#name) - -*** - -### stack? - -```ts -optional stack: string; -``` - -Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`stack`](../QueryOptimizerError.md#stack) - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured _after_ the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`stackTraceLimit`](../QueryOptimizerError.md#stacktracelimit) - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack; // Similar to `new Error().stack` -``` - -The first line of the trace will be prefixed with -`${myObject.name}: ${myObject.message}`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from the user. For instance: - -```js -function a() { - b(); -} - -function b() { - c(); -} - -function c() { - // Create an error without stack trace to avoid calculating the stack trace twice. - const { stackTraceLimit } = Error; - Error.stackTraceLimit = 0; - const error = new Error(); - Error.stackTraceLimit = stackTraceLimit; - - // Capture the stack trace above function b - Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - throw error; -} - -a(); -``` - -#### Parameters - -##### targetObject - -`object` - -##### constructorOpt? - -`Function` - -#### Returns - -`void` - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`captureStackTrace`](../QueryOptimizerError.md#capturestacktrace) - -*** - -### prepareStackTrace() - -```ts -static prepareStackTrace(err, stackTraces): any; -``` - -Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 - -#### Parameters - -##### err - -`Error` - -##### stackTraces - -`CallSite`[] - -#### Returns - -`any` - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -[`QueryOptimizerError`](../QueryOptimizerError.md).[`prepareStackTrace`](../QueryOptimizerError.md#preparestacktrace) diff --git a/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md b/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md index 1bfe6b416..ed955d29a 100644 --- a/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md +++ b/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md @@ -22,7 +22,7 @@ Electric collection utilities type ## Indexable ```ts -[key: string]: Fn +[key: string]: any ``` ## Properties diff --git a/docs/reference/functions/add.md b/docs/reference/functions/add.md deleted file mode 100644 index 767e7d8d1..000000000 --- a/docs/reference/functions/add.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -id: add -title: add ---- - -# Function: add() - -```ts -function add(left, right): BinaryNumericReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L295) - -## Type Parameters - -### T1 - -`T1` *extends* `unknown` - -### T2 - -`T2` *extends* `unknown` - -## Parameters - -### left - -`T1` - -### right - -`T2` - -## Returns - -`BinaryNumericReturnType`\<`T1`, `T2`\> diff --git a/docs/reference/functions/and.md b/docs/reference/functions/and.md deleted file mode 100644 index b48e66633..000000000 --- a/docs/reference/functions/and.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -id: and -title: and ---- - -# Function: and() - -## Call Signature - -```ts -function and(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:181](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L181) - -### Parameters - -#### left - -`any` - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function and( - left, - right, ... -rest): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:185](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L185) - -### Parameters - -#### left - -`any` - -#### right - -`any` - -#### rest - -...`any`[] - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/avg.md b/docs/reference/functions/avg.md deleted file mode 100644 index 98b7f615a..000000000 --- a/docs/reference/functions/avg.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: avg -title: avg ---- - -# Function: avg() - -```ts -function avg(arg): AggregateReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:311](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L311) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/coalesce.md b/docs/reference/functions/coalesce.md deleted file mode 100644 index db59fc945..000000000 --- a/docs/reference/functions/coalesce.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: coalesce -title: coalesce ---- - -# Function: coalesce() - -```ts -function coalesce(...args): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:288](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L288) - -## Parameters - -### args - -...`any`[] - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`any`\> diff --git a/docs/reference/functions/compileQuery.md b/docs/reference/functions/compileQuery.md deleted file mode 100644 index 729b5ae39..000000000 --- a/docs/reference/functions/compileQuery.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: compileQuery -title: compileQuery ---- - -# Function: compileQuery() - -```ts -function compileQuery( - rawQuery, - inputs, - collections, - subscriptions, - callbacks, - lazySources, - optimizableOrderByCollections, - setWindowFn, - cache, - queryMapping): CompilationResult; -``` - -Defined in: [packages/db/src/query/compiler/index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/query/compiler/index.ts#L85) - -Compiles a query IR into a D2 pipeline - -## Parameters - -### rawQuery - -[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md) - -The query IR to compile - -### inputs - -`Record`\<`string`, [`KeyedStream`](../../type-aliases/KeyedStream.md)\> - -Mapping of source aliases to input streams (e.g., `{ employee: input1, manager: input2 }`) - -### collections - -`Record`\<`string`, [`Collection`](../../interfaces/Collection.md)\<`any`, `any`, `any`, `any`, `any`\>\> - -Mapping of collection IDs to Collection instances - -### subscriptions - -`Record`\<`string`, `CollectionSubscription`\> - -Mapping of source aliases to CollectionSubscription instances - -### callbacks - -`Record`\<`string`, `LazyCollectionCallbacks`\> - -Mapping of source aliases to lazy loading callbacks - -### lazySources - -`Set`\<`string`\> - -Set of source aliases that should load data lazily - -### optimizableOrderByCollections - -`Record`\<`string`, `OrderByOptimizationInfo`\> - -Map of collection IDs to order-by optimization info - -### setWindowFn - -(`windowFn`) => `void` - -### cache - -`QueryCache` = `...` - -Optional cache for compiled subqueries (used internally for recursion) - -### queryMapping - -`QueryMapping` = `...` - -Optional mapping from optimized queries to original queries - -## Returns - -`CompilationResult` - -A CompilationResult with the pipeline, source WHERE clauses, and alias metadata diff --git a/docs/reference/functions/concat.md b/docs/reference/functions/concat.md deleted file mode 100644 index 9c8edfbd6..000000000 --- a/docs/reference/functions/concat.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: concat -title: concat ---- - -# Function: concat() - -```ts -function concat(...args): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:279](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L279) - -## Parameters - -### args - -...`any`[] - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`string`\> diff --git a/docs/reference/functions/count.md b/docs/reference/functions/count.md deleted file mode 100644 index bc82fcf79..000000000 --- a/docs/reference/functions/count.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: count -title: count ---- - -# Function: count() - -```ts -function count(arg): Aggregate; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:307](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L307) - -## Parameters - -### arg - -`any` - -## Returns - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`number`\> diff --git a/docs/reference/functions/createArrayChangeProxy.md b/docs/reference/functions/createArrayChangeProxy.md deleted file mode 100644 index dd5101482..000000000 --- a/docs/reference/functions/createArrayChangeProxy.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: createArrayChangeProxy -title: createArrayChangeProxy ---- - -# Function: createArrayChangeProxy() - -```ts -function createArrayChangeProxy(targets): object; -``` - -Defined in: [packages/db/src/proxy.ts:873](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L873) - -Creates proxies for an array of objects and tracks changes to each - -## Type Parameters - -### T - -`T` *extends* `object` - -## Parameters - -### targets - -`T`[] - -Array of objects to proxy - -## Returns - -`object` - -An object containing the array of proxies and a function to get all changes - -### getChanges() - -```ts -getChanges: () => Record[]; -``` - -#### Returns - -`Record`\<`string` \| `symbol`, `unknown`\>[] - -### proxies - -```ts -proxies: T[]; -``` diff --git a/docs/reference/functions/createChangeProxy.md b/docs/reference/functions/createChangeProxy.md deleted file mode 100644 index 565b86928..000000000 --- a/docs/reference/functions/createChangeProxy.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: createChangeProxy -title: createChangeProxy ---- - -# Function: createChangeProxy() - -```ts -function createChangeProxy(target, parent?): object; -``` - -Defined in: [packages/db/src/proxy.ts:181](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L181) - -Creates a proxy that tracks changes to the target object - -## Type Parameters - -### T - -`T` *extends* `Record`\<`string` \| `symbol`, `any`\> - -## Parameters - -### target - -`T` - -The object to proxy - -### parent? - -Optional parent information - -#### prop - -`string` \| `symbol` - -#### tracker - -`ChangeTracker`\<`Record`\<`string` \| `symbol`, `unknown`\>\> - -## Returns - -`object` - -An object containing the proxy and a function to get the changes - -### getChanges() - -```ts -getChanges: () => Record; -``` - -#### Returns - -`Record`\<`string` \| `symbol`, `any`\> - -### proxy - -```ts -proxy: T; -``` diff --git a/docs/reference/functions/createCollection.md b/docs/reference/functions/createCollection.md deleted file mode 100644 index 1404c7300..000000000 --- a/docs/reference/functions/createCollection.md +++ /dev/null @@ -1,442 +0,0 @@ ---- -id: createCollection -title: createCollection ---- - -# Function: createCollection() - -## Call Signature - -```ts -function createCollection(options): Collection, TKey, TUtils, T, InferSchemaInput> & NonSingleResult; -``` - -Defined in: [packages/db/src/collection/index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L130) - -Creates a new Collection instance with the given configuration - -### Type Parameters - -#### T - -`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key for the collection - -#### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -The utilities record type - -### Parameters - -#### options - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) - -Collection options with optional utilities - -### Returns - -[`Collection`](../../interfaces/Collection.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `TUtils`, `T`, [`InferSchemaInput`](../../type-aliases/InferSchemaInput.md)\<`T`\>\> & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) - -A new Collection with utilities exposed both at top level and under .utils - -### Examples - -```ts -// Pattern 1: With operation handlers (direct collection calls) -const todos = createCollection({ - id: "todos", - getKey: (todo) => todo.id, - schema, - onInsert: async ({ transaction, collection }) => { - // Send to API - await api.createTodo(transaction.mutations[0].modified) - }, - onUpdate: async ({ transaction, collection }) => { - await api.updateTodo(transaction.mutations[0].modified) - }, - onDelete: async ({ transaction, collection }) => { - await api.deleteTodo(transaction.mutations[0].key) - }, - sync: { sync: () => {} } -}) - -// Direct usage (handlers manage transactions) -const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Pattern 2: Manual transaction management -const todos = createCollection({ - getKey: (todo) => todo.id, - schema: todoSchema, - sync: { sync: () => {} } -}) - -// Explicit transaction usage -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Handle all mutations in transaction - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - todos.insert({ id: "1", text: "Buy milk" }) - todos.update("2", draft => { draft.completed = true }) -}) - -await tx.isPersisted.promise -``` - -```ts -// Using schema for type inference (preferred as it also gives you client side validation) -const todoSchema = z.object({ - id: z.string(), - title: z.string(), - completed: z.boolean() -}) - -const todos = createCollection({ - schema: todoSchema, - getKey: (todo) => todo.id, - sync: { sync: () => {} } -}) -``` - -## Call Signature - -```ts -function createCollection(options): Collection, TKey, TUtils, T, InferSchemaInput> & SingleResult; -``` - -Defined in: [packages/db/src/collection/index.ts:143](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L143) - -Creates a new Collection instance with the given configuration - -### Type Parameters - -#### T - -`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key for the collection - -#### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -The utilities record type - -### Parameters - -#### options - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`SingleResult`](../../type-aliases/SingleResult.md) - -Collection options with optional utilities - -### Returns - -[`Collection`](../../interfaces/Collection.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `TUtils`, `T`, [`InferSchemaInput`](../../type-aliases/InferSchemaInput.md)\<`T`\>\> & [`SingleResult`](../../type-aliases/SingleResult.md) - -A new Collection with utilities exposed both at top level and under .utils - -### Examples - -```ts -// Pattern 1: With operation handlers (direct collection calls) -const todos = createCollection({ - id: "todos", - getKey: (todo) => todo.id, - schema, - onInsert: async ({ transaction, collection }) => { - // Send to API - await api.createTodo(transaction.mutations[0].modified) - }, - onUpdate: async ({ transaction, collection }) => { - await api.updateTodo(transaction.mutations[0].modified) - }, - onDelete: async ({ transaction, collection }) => { - await api.deleteTodo(transaction.mutations[0].key) - }, - sync: { sync: () => {} } -}) - -// Direct usage (handlers manage transactions) -const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Pattern 2: Manual transaction management -const todos = createCollection({ - getKey: (todo) => todo.id, - schema: todoSchema, - sync: { sync: () => {} } -}) - -// Explicit transaction usage -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Handle all mutations in transaction - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - todos.insert({ id: "1", text: "Buy milk" }) - todos.update("2", draft => { draft.completed = true }) -}) - -await tx.isPersisted.promise -``` - -```ts -// Using schema for type inference (preferred as it also gives you client side validation) -const todoSchema = z.object({ - id: z.string(), - title: z.string(), - completed: z.boolean() -}) - -const todos = createCollection({ - schema: todoSchema, - getKey: (todo) => todo.id, - sync: { sync: () => {} } -}) -``` - -## Call Signature - -```ts -function createCollection(options): Collection & NonSingleResult; -``` - -Defined in: [packages/db/src/collection/index.ts:157](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L157) - -Creates a new Collection instance with the given configuration - -### Type Parameters - -#### T - -`T` *extends* `object` - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key for the collection - -#### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -The utilities record type - -### Parameters - -#### options - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) - -Collection options with optional utilities - -### Returns - -[`Collection`](../../interfaces/Collection.md)\<`T`, `TKey`, `TUtils`, `never`, `T`\> & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) - -A new Collection with utilities exposed both at top level and under .utils - -### Examples - -```ts -// Pattern 1: With operation handlers (direct collection calls) -const todos = createCollection({ - id: "todos", - getKey: (todo) => todo.id, - schema, - onInsert: async ({ transaction, collection }) => { - // Send to API - await api.createTodo(transaction.mutations[0].modified) - }, - onUpdate: async ({ transaction, collection }) => { - await api.updateTodo(transaction.mutations[0].modified) - }, - onDelete: async ({ transaction, collection }) => { - await api.deleteTodo(transaction.mutations[0].key) - }, - sync: { sync: () => {} } -}) - -// Direct usage (handlers manage transactions) -const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Pattern 2: Manual transaction management -const todos = createCollection({ - getKey: (todo) => todo.id, - schema: todoSchema, - sync: { sync: () => {} } -}) - -// Explicit transaction usage -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Handle all mutations in transaction - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - todos.insert({ id: "1", text: "Buy milk" }) - todos.update("2", draft => { draft.completed = true }) -}) - -await tx.isPersisted.promise -``` - -```ts -// Using schema for type inference (preferred as it also gives you client side validation) -const todoSchema = z.object({ - id: z.string(), - title: z.string(), - completed: z.boolean() -}) - -const todos = createCollection({ - schema: todoSchema, - getKey: (todo) => todo.id, - sync: { sync: () => {} } -}) -``` - -## Call Signature - -```ts -function createCollection(options): Collection & SingleResult; -``` - -Defined in: [packages/db/src/collection/index.ts:170](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L170) - -Creates a new Collection instance with the given configuration - -### Type Parameters - -#### T - -`T` *extends* `object` - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key for the collection - -#### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -The utilities record type - -### Parameters - -#### options - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`SingleResult`](../../type-aliases/SingleResult.md) - -Collection options with optional utilities - -### Returns - -[`Collection`](../../interfaces/Collection.md)\<`T`, `TKey`, `TUtils`, `never`, `T`\> & [`SingleResult`](../../type-aliases/SingleResult.md) - -A new Collection with utilities exposed both at top level and under .utils - -### Examples - -```ts -// Pattern 1: With operation handlers (direct collection calls) -const todos = createCollection({ - id: "todos", - getKey: (todo) => todo.id, - schema, - onInsert: async ({ transaction, collection }) => { - // Send to API - await api.createTodo(transaction.mutations[0].modified) - }, - onUpdate: async ({ transaction, collection }) => { - await api.updateTodo(transaction.mutations[0].modified) - }, - onDelete: async ({ transaction, collection }) => { - await api.deleteTodo(transaction.mutations[0].key) - }, - sync: { sync: () => {} } -}) - -// Direct usage (handlers manage transactions) -const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Pattern 2: Manual transaction management -const todos = createCollection({ - getKey: (todo) => todo.id, - schema: todoSchema, - sync: { sync: () => {} } -}) - -// Explicit transaction usage -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Handle all mutations in transaction - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - todos.insert({ id: "1", text: "Buy milk" }) - todos.update("2", draft => { draft.completed = true }) -}) - -await tx.isPersisted.promise -``` - -```ts -// Using schema for type inference (preferred as it also gives you client side validation) -const todoSchema = z.object({ - id: z.string(), - title: z.string(), - completed: z.boolean() -}) - -const todos = createCollection({ - schema: todoSchema, - getKey: (todo) => todo.id, - sync: { sync: () => {} } -}) -``` diff --git a/docs/reference/functions/createLiveQueryCollection.md b/docs/reference/functions/createLiveQueryCollection.md deleted file mode 100644 index b35008dc4..000000000 --- a/docs/reference/functions/createLiveQueryCollection.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: createLiveQueryCollection -title: createLiveQueryCollection ---- - -# Function: createLiveQueryCollection() - -## Call Signature - -```ts -function createLiveQueryCollection(query): CollectionForContext & object; -``` - -Defined in: [packages/db/src/query/live-query-collection.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L115) - -Creates a live query collection directly - -### Type Parameters - -#### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) - -#### TResult - -`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} - -### Parameters - -#### query - -(`q`) => [`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> - -### Returns - -`CollectionForContext`\<`TContext`, `TResult`, \{ -\}\> & `object` - -### Example - -```typescript -// Minimal usage - just pass a query function -const activeUsers = createLiveQueryCollection( - (q) => q - .from({ user: usersCollection }) - .where(({ user }) => eq(user.active, true)) - .select(({ user }) => ({ id: user.id, name: user.name })) -) - -// Full configuration with custom options -const searchResults = createLiveQueryCollection({ - id: "search-results", // Custom ID (auto-generated if omitted) - query: (q) => q - .from({ post: postsCollection }) - .where(({ post }) => like(post.title, `%${searchTerm}%`)) - .select(({ post }) => ({ - id: post.id, - title: post.title, - excerpt: post.excerpt, - })), - getKey: (item) => item.id, // Custom key function (uses stream key if omitted) - utils: { - updateSearchTerm: (newTerm: string) => { - // Custom utility functions - } - } -}) -``` - -## Call Signature - -```ts -function createLiveQueryCollection(config): CollectionForContext & object; -``` - -Defined in: [packages/db/src/query/live-query-collection.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L125) - -Creates a live query collection directly - -### Type Parameters - -#### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) - -#### TResult - -`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} - -#### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = \{ -\} - -### Parameters - -#### config - -[`LiveQueryCollectionConfig`](../../interfaces/LiveQueryCollectionConfig.md)\<`TContext`, `TResult`\> & `object` - -### Returns - -`CollectionForContext`\<`TContext`, `TResult`, \{ -\}\> & `object` - -### Example - -```typescript -// Minimal usage - just pass a query function -const activeUsers = createLiveQueryCollection( - (q) => q - .from({ user: usersCollection }) - .where(({ user }) => eq(user.active, true)) - .select(({ user }) => ({ id: user.id, name: user.name })) -) - -// Full configuration with custom options -const searchResults = createLiveQueryCollection({ - id: "search-results", // Custom ID (auto-generated if omitted) - query: (q) => q - .from({ post: postsCollection }) - .where(({ post }) => like(post.title, `%${searchTerm}%`)) - .select(({ post }) => ({ - id: post.id, - title: post.title, - excerpt: post.excerpt, - })), - getKey: (item) => item.id, // Custom key function (uses stream key if omitted) - utils: { - updateSearchTerm: (newTerm: string) => { - // Custom utility functions - } - } -}) -``` diff --git a/docs/reference/functions/createOptimisticAction.md b/docs/reference/functions/createOptimisticAction.md deleted file mode 100644 index bb19c9432..000000000 --- a/docs/reference/functions/createOptimisticAction.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: createOptimisticAction -title: createOptimisticAction ---- - -# Function: createOptimisticAction() - -```ts -function createOptimisticAction(options): (variables) => Transaction; -``` - -Defined in: [packages/db/src/optimistic-action.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/optimistic-action.ts#L54) - -Creates an optimistic action function that applies local optimistic updates immediately -before executing the actual mutation on the server. - -This pattern allows for responsive UI updates while the actual mutation is in progress. -The optimistic update is applied via the `onMutate` callback, and the server mutation -is executed via the `mutationFn`. - -**Important:** Inside your `mutationFn`, you must ensure that your server writes have synced back -before you return, as the optimistic state is dropped when you return from the mutation function. -You generally use collection-specific helpers to do this, such as Query's `utils.refetch()`, -direct write APIs, or Electric's `utils.awaitTxId()`. - -## Type Parameters - -### TVariables - -`TVariables` = `unknown` - -The type of variables that will be passed to the action function - -## Parameters - -### options - -[`CreateOptimisticActionsOptions`](../../interfaces/CreateOptimisticActionsOptions.md)\<`TVariables`\> - -Configuration options for the optimistic action - -## Returns - -A function that accepts variables of type TVariables and returns a Transaction - -```ts -(variables): Transaction; -``` - -### Parameters - -#### variables - -`TVariables` - -### Returns - -[`Transaction`](../../interfaces/Transaction.md) - -## Example - -```ts -const addTodo = createOptimisticAction({ - onMutate: (text) => { - // Instantly applies local optimistic state - todoCollection.insert({ - id: uuid(), - text, - completed: false - }) - }, - mutationFn: async (text, params) => { - // Persist the todo to your backend - const response = await fetch('/api/todos', { - method: 'POST', - body: JSON.stringify({ text, completed: false }), - }) - const result = await response.json() - - // IMPORTANT: Ensure server writes have synced back before returning - // This ensures the optimistic state can be safely discarded - await todoCollection.utils.refetch() - - return result - } -}) - -// Usage -const transaction = addTodo('New Todo Item') -``` diff --git a/docs/reference/functions/createPacedMutations.md b/docs/reference/functions/createPacedMutations.md deleted file mode 100644 index 7418b828e..000000000 --- a/docs/reference/functions/createPacedMutations.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: createPacedMutations -title: createPacedMutations ---- - -# Function: createPacedMutations() - -```ts -function createPacedMutations(config): (variables) => Transaction; -``` - -Defined in: [packages/db/src/paced-mutations.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L87) - -Creates a paced mutations manager with pluggable timing strategies. - -This function provides a way to control when and how optimistic mutations -are persisted to the backend, using strategies like debouncing, queuing, -or throttling. The optimistic updates are applied immediately via `onMutate`, -and the actual persistence is controlled by the strategy. - -The returned function accepts variables of type TVariables and returns a -Transaction object that can be awaited to know when persistence completes -or to handle errors. - -## Type Parameters - -### TVariables - -`TVariables` = `unknown` - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Parameters - -### config - -[`PacedMutationsConfig`](../../interfaces/PacedMutationsConfig.md)\<`TVariables`, `T`\> - -Configuration including onMutate, mutationFn and strategy - -## Returns - -A function that accepts variables and returns a Transaction - -```ts -(variables): Transaction; -``` - -### Parameters - -#### variables - -`TVariables` - -### Returns - -[`Transaction`](../../interfaces/Transaction.md)\<`T`\> - -## Examples - -```ts -// Debounced mutations for auto-save -const updateTodo = createPacedMutations({ - onMutate: (text) => { - // Apply optimistic update immediately - collection.update(id, draft => { draft.text = text }) - }, - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: debounceStrategy({ wait: 500 }) -}) - -// Call with variables, returns a transaction -const tx = updateTodo('New text') - -// Await persistence or handle errors -await tx.isPersisted.promise -``` - -```ts -// Queue strategy for sequential processing -const addTodo = createPacedMutations<{ text: string }>({ - onMutate: ({ text }) => { - collection.insert({ id: uuid(), text, completed: false }) - }, - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: queueStrategy({ - wait: 200, - addItemsTo: 'back', - getItemsFrom: 'front' - }) -}) -``` diff --git a/docs/reference/functions/createTransaction.md b/docs/reference/functions/createTransaction.md deleted file mode 100644 index 5309fffcf..000000000 --- a/docs/reference/functions/createTransaction.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -id: createTransaction -title: createTransaction ---- - -# Function: createTransaction() - -```ts -function createTransaction(config): Transaction; -``` - -Defined in: [packages/db/src/transactions.ts:156](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L156) - -Creates a new transaction for grouping multiple collection operations - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Parameters - -### config - -[`TransactionConfig`](../../interfaces/TransactionConfig.md)\<`T`\> - -Transaction configuration with mutation function - -## Returns - -[`Transaction`](../../interfaces/Transaction.md)\<`T`\> - -A new Transaction instance - -## Examples - -```ts -// Basic transaction usage -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Send all mutations to API - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Buy milk" }) - collection.update("2", draft => { draft.completed = true }) -}) - -await tx.isPersisted.promise -``` - -```ts -// Handle transaction errors -try { - const tx = createTransaction({ - mutationFn: async () => { throw new Error("API failed") } - }) - - tx.mutate(() => { - collection.insert({ id: "1", text: "New item" }) - }) - - await tx.isPersisted.promise -} catch (error) { - console.log('Transaction failed:', error) -} -``` - -```ts -// Manual commit control -const tx = createTransaction({ - autoCommit: false, - mutationFn: async () => { - // API call - } -}) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Item" }) -}) - -// Commit later -await tx.commit() -``` diff --git a/docs/reference/functions/debounceStrategy.md b/docs/reference/functions/debounceStrategy.md deleted file mode 100644 index 44e016bee..000000000 --- a/docs/reference/functions/debounceStrategy.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: debounceStrategy -title: debounceStrategy ---- - -# Function: debounceStrategy() - -```ts -function debounceStrategy(options): DebounceStrategy; -``` - -Defined in: [packages/db/src/strategies/debounceStrategy.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/debounceStrategy.ts#L28) - -Creates a debounce strategy that delays transaction execution until after -a period of inactivity. - -Ideal for scenarios like search inputs or auto-save fields where you want -to wait for the user to stop typing before persisting changes. - -## Parameters - -### options - -[`DebounceStrategyOptions`](../../interfaces/DebounceStrategyOptions.md) - -Configuration for the debounce behavior - -## Returns - -[`DebounceStrategy`](../../interfaces/DebounceStrategy.md) - -A debounce strategy instance - -## Example - -```ts -const mutate = usePacedMutations({ - onMutate: (value) => { - collection.update(id, draft => { draft.value = value }) - }, - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: debounceStrategy({ wait: 500 }) -}) -``` diff --git a/docs/reference/functions/eq.md b/docs/reference/functions/eq.md deleted file mode 100644 index 0199b5da1..000000000 --- a/docs/reference/functions/eq.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: eq -title: eq ---- - -# Function: eq() - -## Call Signature - -```ts -function eq(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L115) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -`ComparisonOperand`\<`T`\> - -#### right - -`ComparisonOperand`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function eq(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L119) - -### Type Parameters - -#### T - -`T` *extends* `string` \| `number` \| `boolean` - -### Parameters - -#### left - -`ComparisonOperandPrimitive`\<`T`\> - -#### right - -`ComparisonOperandPrimitive`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function eq(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L123) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/getActiveTransaction.md b/docs/reference/functions/getActiveTransaction.md deleted file mode 100644 index 31ac09e1c..000000000 --- a/docs/reference/functions/getActiveTransaction.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: getActiveTransaction -title: getActiveTransaction ---- - -# Function: getActiveTransaction() - -```ts -function getActiveTransaction(): - | Transaction> - | undefined; -``` - -Defined in: [packages/db/src/transactions.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L175) - -Gets the currently active ambient transaction, if any -Used internally by collection operations to join existing transactions - -## Returns - - \| [`Transaction`](../../interfaces/Transaction.md)\<`Record`\<`string`, `unknown`\>\> - \| `undefined` - -The active transaction or undefined if none is active - -## Example - -```ts -// Check if operations will join an ambient transaction -const ambientTx = getActiveTransaction() -if (ambientTx) { - console.log('Operations will join transaction:', ambientTx.id) -} -``` diff --git a/docs/reference/functions/gt.md b/docs/reference/functions/gt.md deleted file mode 100644 index 050c7712c..000000000 --- a/docs/reference/functions/gt.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: gt -title: gt ---- - -# Function: gt() - -## Call Signature - -```ts -function gt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L128) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -`ComparisonOperand`\<`T`\> - -#### right - -`ComparisonOperand`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function gt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L132) - -### Type Parameters - -#### T - -`T` *extends* `string` \| `number` - -### Parameters - -#### left - -`ComparisonOperandPrimitive`\<`T`\> - -#### right - -`ComparisonOperandPrimitive`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function gt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:136](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L136) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/gte.md b/docs/reference/functions/gte.md deleted file mode 100644 index 7a6798a69..000000000 --- a/docs/reference/functions/gte.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: gte -title: gte ---- - -# Function: gte() - -## Call Signature - -```ts -function gte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:141](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L141) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -`ComparisonOperand`\<`T`\> - -#### right - -`ComparisonOperand`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function gte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:145](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L145) - -### Type Parameters - -#### T - -`T` *extends* `string` \| `number` - -### Parameters - -#### left - -`ComparisonOperandPrimitive`\<`T`\> - -#### right - -`ComparisonOperandPrimitive`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function gte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:149](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L149) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/ilike.md b/docs/reference/functions/ilike.md deleted file mode 100644 index 989b7e9f5..000000000 --- a/docs/reference/functions/ilike.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: ilike -title: ilike ---- - -# Function: ilike() - -```ts -function ilike(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:252](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L252) - -## Parameters - -### left - -`StringLike` - -### right - -`StringLike` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/inArray.md b/docs/reference/functions/inArray.md deleted file mode 100644 index c48e33a81..000000000 --- a/docs/reference/functions/inArray.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: inArray -title: inArray ---- - -# Function: inArray() - -```ts -function inArray(value, array): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L237) - -## Parameters - -### value - -`any` - -### array - -`any` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isNull.md b/docs/reference/functions/isNull.md deleted file mode 100644 index 704ae7f33..000000000 --- a/docs/reference/functions/isNull.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: isNull -title: isNull ---- - -# Function: isNull() - -```ts -function isNull(value): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:233](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L233) - -## Parameters - -### value - -`any` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isUndefined.md b/docs/reference/functions/isUndefined.md deleted file mode 100644 index 0862c3cc9..000000000 --- a/docs/reference/functions/isUndefined.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: isUndefined -title: isUndefined ---- - -# Function: isUndefined() - -```ts -function isUndefined(value): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L229) - -## Parameters - -### value - -`any` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/length.md b/docs/reference/functions/length.md deleted file mode 100644 index 93ae660bd..000000000 --- a/docs/reference/functions/length.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: length -title: length ---- - -# Function: length() - -```ts -function length(arg): NumericFunctionReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:273](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L273) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`NumericFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/like.md b/docs/reference/functions/like.md deleted file mode 100644 index d94a428d4..000000000 --- a/docs/reference/functions/like.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: like -title: like ---- - -# Function: like() - -```ts -function like(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:244](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L244) - -## Parameters - -### left - -`StringLike` - -### right - -`StringLike` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/liveQueryCollectionOptions.md b/docs/reference/functions/liveQueryCollectionOptions.md deleted file mode 100644 index 20b266568..000000000 --- a/docs/reference/functions/liveQueryCollectionOptions.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: liveQueryCollectionOptions -title: liveQueryCollectionOptions ---- - -# Function: liveQueryCollectionOptions() - -```ts -function liveQueryCollectionOptions(config): CollectionConfigForContext & object; -``` - -Defined in: [packages/db/src/query/live-query-collection.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L62) - -Creates live query collection options for use with createCollection - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) - -### TResult - -`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} - -## Parameters - -### config - -[`LiveQueryCollectionConfig`](../../interfaces/LiveQueryCollectionConfig.md)\<`TContext`, `TResult`\> - -Configuration options for the live query collection - -## Returns - -`CollectionConfigForContext`\<`TContext`, `TResult`, \{ -\}\> & `object` - -Collection options that can be passed to createCollection - -## Example - -```typescript -const options = liveQueryCollectionOptions({ - // id is optional - will auto-generate if not provided - query: (q) => q - .from({ post: postsCollection }) - .where(({ post }) => eq(post.published, true)) - .select(({ post }) => ({ - id: post.id, - title: post.title, - content: post.content, - })), - // getKey is optional - will use stream key if not provided -}) - -const collection = createCollection(options) -``` diff --git a/docs/reference/functions/localOnlyCollectionOptions.md b/docs/reference/functions/localOnlyCollectionOptions.md deleted file mode 100644 index f473f9599..000000000 --- a/docs/reference/functions/localOnlyCollectionOptions.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -id: localOnlyCollectionOptions -title: localOnlyCollectionOptions ---- - -# Function: localOnlyCollectionOptions() - -## Call Signature - -```ts -function localOnlyCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object & object; -``` - -Defined in: [packages/db/src/local-only.ts:149](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L149) - -Creates Local-only collection options for use with a standard Collection - -This is an in-memory collection that doesn't sync with external sources but uses a loopback sync config -that immediately "syncs" all optimistic changes to the collection, making them permanent. -Perfect for local-only data that doesn't need persistence or external synchronization. - -**Using with Manual Transactions:** - -For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` -to persist changes made during `tx.mutate()`. This is necessary because local-only collections -don't participate in the standard mutation handler flow for manual transactions. - -### Type Parameters - -#### T - -`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key returned by getKey - -### Parameters - -#### config - -[`LocalOnlyCollectionConfig`](../../interfaces/LocalOnlyCollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `T`, `TKey`\> & `object` - -Configuration options for the Local-only collection - -### Returns - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & `object` - -Collection options with utilities including acceptMutations - -### Examples - -```ts -// Basic local-only collection -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - }) -) -``` - -```ts -// Local-only collection with initial data -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - initialData: [ - { id: 1, name: 'Item 1' }, - { id: 2, name: 'Item 2' }, - ], - }) -) -``` - -```ts -// Local-only collection with mutation handlers -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - onInsert: async ({ transaction }) => { - console.log('Item inserted:', transaction.mutations[0].modified) - // Custom logic after insert - }, - }) -) -``` - -```ts -// Using with manual transactions -const localData = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - }) -) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Use local data in API call - const localMutations = transaction.mutations.filter(m => m.collection === localData) - await api.save({ metadata: localMutations[0]?.modified }) - - // Persist local-only mutations after API success - localData.utils.acceptMutations(transaction) - } -}) - -tx.mutate(() => { - localData.insert({ id: 1, data: 'metadata' }) - apiCollection.insert({ id: 2, data: 'main data' }) -}) - -await tx.commit() -``` - -## Call Signature - -```ts -function localOnlyCollectionOptions(config): CollectionConfig & object & object; -``` - -Defined in: [packages/db/src/local-only.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L162) - -Creates Local-only collection options for use with a standard Collection - -This is an in-memory collection that doesn't sync with external sources but uses a loopback sync config -that immediately "syncs" all optimistic changes to the collection, making them permanent. -Perfect for local-only data that doesn't need persistence or external synchronization. - -**Using with Manual Transactions:** - -For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` -to persist changes made during `tx.mutate()`. This is necessary because local-only collections -don't participate in the standard mutation handler flow for manual transactions. - -### Type Parameters - -#### T - -`T` *extends* `object` - -The schema type if a schema is provided, otherwise the type of items in the collection - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key returned by getKey - -### Parameters - -#### config - -[`LocalOnlyCollectionConfig`](../../interfaces/LocalOnlyCollectionConfig.md)\<`T`, `never`, `TKey`\> & `object` - -Configuration options for the Local-only collection - -### Returns - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & `object` - -Collection options with utilities including acceptMutations - -### Examples - -```ts -// Basic local-only collection -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - }) -) -``` - -```ts -// Local-only collection with initial data -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - initialData: [ - { id: 1, name: 'Item 1' }, - { id: 2, name: 'Item 2' }, - ], - }) -) -``` - -```ts -// Local-only collection with mutation handlers -const collection = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - onInsert: async ({ transaction }) => { - console.log('Item inserted:', transaction.mutations[0].modified) - // Custom logic after insert - }, - }) -) -``` - -```ts -// Using with manual transactions -const localData = createCollection( - localOnlyCollectionOptions({ - getKey: (item) => item.id, - }) -) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Use local data in API call - const localMutations = transaction.mutations.filter(m => m.collection === localData) - await api.save({ metadata: localMutations[0]?.modified }) - - // Persist local-only mutations after API success - localData.utils.acceptMutations(transaction) - } -}) - -tx.mutate(() => { - localData.insert({ id: 1, data: 'metadata' }) - apiCollection.insert({ id: 2, data: 'main data' }) -}) - -await tx.commit() -``` diff --git a/docs/reference/functions/localStorageCollectionOptions.md b/docs/reference/functions/localStorageCollectionOptions.md deleted file mode 100644 index 29b60f87f..000000000 --- a/docs/reference/functions/localStorageCollectionOptions.md +++ /dev/null @@ -1,236 +0,0 @@ ---- -id: localStorageCollectionOptions -title: localStorageCollectionOptions ---- - -# Function: localStorageCollectionOptions() - -## Call Signature - -```ts -function localStorageCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object; -``` - -Defined in: [packages/db/src/local-storage.ts:279](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L279) - -Creates localStorage collection options for use with a standard Collection - -This function creates a collection that persists data to localStorage/sessionStorage -and synchronizes changes across browser tabs using storage events. - -**Fallback Behavior:** - -When localStorage is not available (e.g., in server-side rendering environments), -this function automatically falls back to an in-memory storage implementation. -This prevents errors during module initialization and allows the collection to -work in any environment, though data will not persist across page reloads or -be shared across tabs when using the in-memory fallback. - -**Using with Manual Transactions:** - -For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` -to persist changes made during `tx.mutate()`. This is necessary because local-storage collections -don't participate in the standard mutation handler flow for manual transactions. - -### Type Parameters - -#### T - -`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### Parameters - -#### config - -[`LocalStorageCollectionConfig`](../../interfaces/LocalStorageCollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `T`, `TKey`\> & `object` - -Configuration options for the localStorage collection - -### Returns - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` - -Collection options with utilities including clearStorage, getStorageSize, and acceptMutations - -### Examples - -```ts -// Basic localStorage collection -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - getKey: (item) => item.id, - }) -) -``` - -```ts -// localStorage collection with custom storage -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - storage: window.sessionStorage, // Use sessionStorage instead - getKey: (item) => item.id, - }) -) -``` - -```ts -// localStorage collection with mutation handlers -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - getKey: (item) => item.id, - onInsert: async ({ transaction }) => { - console.log('Item inserted:', transaction.mutations[0].modified) - }, - }) -) -``` - -```ts -// Using with manual transactions -const localSettings = createCollection( - localStorageCollectionOptions({ - storageKey: 'user-settings', - getKey: (item) => item.id, - }) -) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Use settings data in API call - const settingsMutations = transaction.mutations.filter(m => m.collection === localSettings) - await api.updateUserProfile({ settings: settingsMutations[0]?.modified }) - - // Persist local-storage mutations after API success - localSettings.utils.acceptMutations(transaction) - } -}) - -tx.mutate(() => { - localSettings.insert({ id: 'theme', value: 'dark' }) - apiCollection.insert({ id: 2, data: 'profile data' }) -}) - -await tx.commit() -``` - -## Call Signature - -```ts -function localStorageCollectionOptions(config): CollectionConfig & object; -``` - -Defined in: [packages/db/src/local-storage.ts:294](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L294) - -Creates localStorage collection options for use with a standard Collection - -This function creates a collection that persists data to localStorage/sessionStorage -and synchronizes changes across browser tabs using storage events. - -**Fallback Behavior:** - -When localStorage is not available (e.g., in server-side rendering environments), -this function automatically falls back to an in-memory storage implementation. -This prevents errors during module initialization and allows the collection to -work in any environment, though data will not persist across page reloads or -be shared across tabs when using the in-memory fallback. - -**Using with Manual Transactions:** - -For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` -to persist changes made during `tx.mutate()`. This is necessary because local-storage collections -don't participate in the standard mutation handler flow for manual transactions. - -### Type Parameters - -#### T - -`T` *extends* `object` - -#### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### Parameters - -#### config - -[`LocalStorageCollectionConfig`](../../interfaces/LocalStorageCollectionConfig.md)\<`T`, `never`, `TKey`\> & `object` - -Configuration options for the localStorage collection - -### Returns - -[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` - -Collection options with utilities including clearStorage, getStorageSize, and acceptMutations - -### Examples - -```ts -// Basic localStorage collection -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - getKey: (item) => item.id, - }) -) -``` - -```ts -// localStorage collection with custom storage -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - storage: window.sessionStorage, // Use sessionStorage instead - getKey: (item) => item.id, - }) -) -``` - -```ts -// localStorage collection with mutation handlers -const collection = createCollection( - localStorageCollectionOptions({ - storageKey: 'todos', - getKey: (item) => item.id, - onInsert: async ({ transaction }) => { - console.log('Item inserted:', transaction.mutations[0].modified) - }, - }) -) -``` - -```ts -// Using with manual transactions -const localSettings = createCollection( - localStorageCollectionOptions({ - storageKey: 'user-settings', - getKey: (item) => item.id, - }) -) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Use settings data in API call - const settingsMutations = transaction.mutations.filter(m => m.collection === localSettings) - await api.updateUserProfile({ settings: settingsMutations[0]?.modified }) - - // Persist local-storage mutations after API success - localSettings.utils.acceptMutations(transaction) - } -}) - -tx.mutate(() => { - localSettings.insert({ id: 'theme', value: 'dark' }) - apiCollection.insert({ id: 2, data: 'profile data' }) -}) - -await tx.commit() -``` diff --git a/docs/reference/functions/lower.md b/docs/reference/functions/lower.md deleted file mode 100644 index a2b6c0ab8..000000000 --- a/docs/reference/functions/lower.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: lower -title: lower ---- - -# Function: lower() - -```ts -function lower(arg): StringFunctionReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L267) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`StringFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/lt.md b/docs/reference/functions/lt.md deleted file mode 100644 index b7cbe7e61..000000000 --- a/docs/reference/functions/lt.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: lt -title: lt ---- - -# Function: lt() - -## Call Signature - -```ts -function lt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L154) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -`ComparisonOperand`\<`T`\> - -#### right - -`ComparisonOperand`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function lt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:158](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L158) - -### Type Parameters - -#### T - -`T` *extends* `string` \| `number` - -### Parameters - -#### left - -`ComparisonOperandPrimitive`\<`T`\> - -#### right - -`ComparisonOperandPrimitive`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function lt(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L162) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/lte.md b/docs/reference/functions/lte.md deleted file mode 100644 index 25db4b12f..000000000 --- a/docs/reference/functions/lte.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: lte -title: lte ---- - -# Function: lte() - -## Call Signature - -```ts -function lte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:167](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L167) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -`ComparisonOperand`\<`T`\> - -#### right - -`ComparisonOperand`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function lte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:171](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L171) - -### Type Parameters - -#### T - -`T` *extends* `string` \| `number` - -### Parameters - -#### left - -`ComparisonOperandPrimitive`\<`T`\> - -#### right - -`ComparisonOperandPrimitive`\<`T`\> - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function lte(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L175) - -### Type Parameters - -#### T - -`T` - -### Parameters - -#### left - -[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/max.md b/docs/reference/functions/max.md deleted file mode 100644 index 81889962b..000000000 --- a/docs/reference/functions/max.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: max -title: max ---- - -# Function: max() - -```ts -function max(arg): AggregateReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:323](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L323) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/min.md b/docs/reference/functions/min.md deleted file mode 100644 index 6335fff82..000000000 --- a/docs/reference/functions/min.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: min -title: min ---- - -# Function: min() - -```ts -function min(arg): AggregateReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:319](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L319) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/not.md b/docs/reference/functions/not.md deleted file mode 100644 index d0bab9aff..000000000 --- a/docs/reference/functions/not.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: not -title: not ---- - -# Function: not() - -```ts -function not(value): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:224](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L224) - -## Parameters - -### value - -`any` - -## Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/or.md b/docs/reference/functions/or.md deleted file mode 100644 index 11e471f9e..000000000 --- a/docs/reference/functions/or.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -id: or -title: or ---- - -# Function: or() - -## Call Signature - -```ts -function or(left, right): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:203](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L203) - -### Parameters - -#### left - -`any` - -#### right - -`any` - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> - -## Call Signature - -```ts -function or( - left, - right, ... -rest): BasicExpression; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:207](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L207) - -### Parameters - -#### left - -`any` - -#### right - -`any` - -#### rest - -...`any`[] - -### Returns - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/queueStrategy.md b/docs/reference/functions/queueStrategy.md deleted file mode 100644 index 8752c1746..000000000 --- a/docs/reference/functions/queueStrategy.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -id: queueStrategy -title: queueStrategy ---- - -# Function: queueStrategy() - -```ts -function queueStrategy(options?): QueueStrategy; -``` - -Defined in: [packages/db/src/strategies/queueStrategy.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/queueStrategy.ts#L46) - -Creates a queue strategy that processes all mutations in order with proper serialization. - -Unlike other strategies that may drop executions, queue ensures every -mutation is processed sequentially. Each transaction commit completes before -the next one starts. Useful when data consistency is critical and -every operation must complete in order. - -## Parameters - -### options? - -[`QueueStrategyOptions`](../../interfaces/QueueStrategyOptions.md) - -Configuration for queue behavior (FIFO/LIFO, timing, size limits) - -## Returns - -[`QueueStrategy`](../../interfaces/QueueStrategy.md) - -A queue strategy instance - -## Examples - -```ts -// FIFO queue - process in order received -const mutate = usePacedMutations({ - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: queueStrategy({ - wait: 200, - addItemsTo: 'back', - getItemsFrom: 'front' - }) -}) -``` - -```ts -// LIFO queue - process most recent first -const mutate = usePacedMutations({ - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: queueStrategy({ - wait: 200, - addItemsTo: 'back', - getItemsFrom: 'back' - }) -}) -``` diff --git a/docs/reference/functions/sum.md b/docs/reference/functions/sum.md deleted file mode 100644 index 760550dff..000000000 --- a/docs/reference/functions/sum.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: sum -title: sum ---- - -# Function: sum() - -```ts -function sum(arg): AggregateReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:315](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L315) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/throttleStrategy.md b/docs/reference/functions/throttleStrategy.md deleted file mode 100644 index b9ac28644..000000000 --- a/docs/reference/functions/throttleStrategy.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: throttleStrategy -title: throttleStrategy ---- - -# Function: throttleStrategy() - -```ts -function throttleStrategy(options): ThrottleStrategy; -``` - -Defined in: [packages/db/src/strategies/throttleStrategy.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/throttleStrategy.ts#L48) - -Creates a throttle strategy that ensures transactions are evenly spaced -over time. - -Provides smooth, controlled execution patterns ideal for UI updates like -sliders, progress bars, or scroll handlers where you want consistent -execution timing. - -## Parameters - -### options - -[`ThrottleStrategyOptions`](../../interfaces/ThrottleStrategyOptions.md) - -Configuration for throttle behavior - -## Returns - -[`ThrottleStrategy`](../../interfaces/ThrottleStrategy.md) - -A throttle strategy instance - -## Examples - -```ts -// Throttle slider updates to every 200ms -const mutate = usePacedMutations({ - onMutate: (volume) => { - settingsCollection.update('volume', draft => { draft.value = volume }) - }, - mutationFn: async ({ transaction }) => { - await api.updateVolume(transaction.mutations) - }, - strategy: throttleStrategy({ wait: 200 }) -}) -``` - -```ts -// Throttle with leading and trailing execution -const mutate = usePacedMutations({ - onMutate: (data) => { - collection.update(id, draft => { Object.assign(draft, data) }) - }, - mutationFn: async ({ transaction }) => { - await api.save(transaction.mutations) - }, - strategy: throttleStrategy({ - wait: 500, - leading: true, - trailing: true - }) -}) -``` diff --git a/docs/reference/functions/upper.md b/docs/reference/functions/upper.md deleted file mode 100644 index af4652235..000000000 --- a/docs/reference/functions/upper.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: upper -title: upper ---- - -# Function: upper() - -```ts -function upper(arg): StringFunctionReturnType; -``` - -Defined in: [packages/db/src/query/builder/functions.ts:261](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L261) - -## Type Parameters - -### T - -`T` *extends* `unknown` - -## Parameters - -### arg - -`T` - -## Returns - -`StringFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/withArrayChangeTracking.md b/docs/reference/functions/withArrayChangeTracking.md deleted file mode 100644 index 07407a7d6..000000000 --- a/docs/reference/functions/withArrayChangeTracking.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -id: withArrayChangeTracking -title: withArrayChangeTracking ---- - -# Function: withArrayChangeTracking() - -```ts -function withArrayChangeTracking(targets, callback): Record[]; -``` - -Defined in: [packages/db/src/proxy.ts:914](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L914) - -Creates proxies for an array of objects, passes them to a callback function, -and returns the changes made by the callback for each object - -## Type Parameters - -### T - -`T` *extends* `object` - -## Parameters - -### targets - -`T`[] - -Array of objects to proxy - -### callback - -(`proxies`) => `void` - -Function that receives the proxies and can make changes to them - -## Returns - -`Record`\<`string` \| `symbol`, `unknown`\>[] - -Array of changes made to each object diff --git a/docs/reference/functions/withChangeTracking.md b/docs/reference/functions/withChangeTracking.md deleted file mode 100644 index 4495f328b..000000000 --- a/docs/reference/functions/withChangeTracking.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -id: withChangeTracking -title: withChangeTracking ---- - -# Function: withChangeTracking() - -```ts -function withChangeTracking(target, callback): Record; -``` - -Defined in: [packages/db/src/proxy.ts:895](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L895) - -Creates a proxy for an object, passes it to a callback function, -and returns the changes made by the callback - -## Type Parameters - -### T - -`T` *extends* `object` - -## Parameters - -### target - -`T` - -The object to proxy - -### callback - -(`proxy`) => `void` - -Function that receives the proxy and can make changes to it - -## Returns - -`Record`\<`string` \| `symbol`, `unknown`\> - -The changes made to the object diff --git a/docs/reference/index.md b/docs/reference/index.md deleted file mode 100644 index 60f6ced0f..000000000 --- a/docs/reference/index.md +++ /dev/null @@ -1,253 +0,0 @@ ---- -id: "@tanstack/db" -title: "@tanstack/db" ---- - -# @tanstack/db - -## Namespaces - -- [IR](../@tanstack/namespaces/IR/index.md) - -## Classes - -- [AggregateFunctionNotInSelectError](../classes/AggregateFunctionNotInSelectError.md) -- [AggregateNotSupportedError](../classes/AggregateNotSupportedError.md) -- [BaseIndex](../classes/BaseIndex.md) -- [BaseQueryBuilder](../classes/BaseQueryBuilder.md) -- [BTreeIndex](../classes/BTreeIndex.md) -- [CannotCombineEmptyExpressionListError](../classes/CannotCombineEmptyExpressionListError.md) -- [CollectionConfigurationError](../classes/CollectionConfigurationError.md) -- [CollectionImpl](../classes/CollectionImpl.md) -- [CollectionInErrorStateError](../classes/CollectionInErrorStateError.md) -- [CollectionInputNotFoundError](../classes/CollectionInputNotFoundError.md) -- [CollectionIsInErrorStateError](../classes/CollectionIsInErrorStateError.md) -- [CollectionOperationError](../classes/CollectionOperationError.md) -- [CollectionRequiresConfigError](../classes/CollectionRequiresConfigError.md) -- [CollectionRequiresSyncConfigError](../classes/CollectionRequiresSyncConfigError.md) -- [CollectionStateError](../classes/CollectionStateError.md) -- [DeleteKeyNotFoundError](../classes/DeleteKeyNotFoundError.md) -- [DistinctRequiresSelectError](../classes/DistinctRequiresSelectError.md) -- [DuplicateAliasInSubqueryError](../classes/DuplicateAliasInSubqueryError.md) -- [DuplicateDbInstanceError](../classes/DuplicateDbInstanceError.md) -- [DuplicateKeyError](../classes/DuplicateKeyError.md) -- [DuplicateKeySyncError](../classes/DuplicateKeySyncError.md) -- [EmptyReferencePathError](../classes/EmptyReferencePathError.md) -- [GroupByError](../classes/GroupByError.md) -- [HavingRequiresGroupByError](../classes/HavingRequiresGroupByError.md) -- [IndexProxy](../classes/IndexProxy.md) -- [InvalidCollectionStatusTransitionError](../classes/InvalidCollectionStatusTransitionError.md) -- [InvalidJoinCondition](../classes/InvalidJoinCondition.md) -- [InvalidJoinConditionLeftSourceError](../classes/InvalidJoinConditionLeftSourceError.md) -- [InvalidJoinConditionRightSourceError](../classes/InvalidJoinConditionRightSourceError.md) -- [InvalidJoinConditionSameSourceError](../classes/InvalidJoinConditionSameSourceError.md) -- [InvalidJoinConditionSourceMismatchError](../classes/InvalidJoinConditionSourceMismatchError.md) -- [InvalidSchemaError](../classes/InvalidSchemaError.md) -- [InvalidSourceError](../classes/InvalidSourceError.md) -- [InvalidStorageDataFormatError](../classes/InvalidStorageDataFormatError.md) -- [InvalidStorageObjectFormatError](../classes/InvalidStorageObjectFormatError.md) -- [JoinCollectionNotFoundError](../classes/JoinCollectionNotFoundError.md) -- [JoinConditionMustBeEqualityError](../classes/JoinConditionMustBeEqualityError.md) -- [JoinError](../classes/JoinError.md) -- [KeyUpdateNotAllowedError](../classes/KeyUpdateNotAllowedError.md) -- [LazyIndexWrapper](../classes/LazyIndexWrapper.md) -- [LimitOffsetRequireOrderByError](../classes/LimitOffsetRequireOrderByError.md) -- [LocalStorageCollectionError](../classes/LocalStorageCollectionError.md) -- [MissingAliasInputsError](../classes/MissingAliasInputsError.md) -- [MissingDeleteHandlerError](../classes/MissingDeleteHandlerError.md) -- [MissingHandlerError](../classes/MissingHandlerError.md) -- [MissingInsertHandlerError](../classes/MissingInsertHandlerError.md) -- [MissingMutationFunctionError](../classes/MissingMutationFunctionError.md) -- [MissingUpdateArgumentError](../classes/MissingUpdateArgumentError.md) -- [MissingUpdateHandlerError](../classes/MissingUpdateHandlerError.md) -- [NegativeActiveSubscribersError](../classes/NegativeActiveSubscribersError.md) -- [NoKeysPassedToDeleteError](../classes/NoKeysPassedToDeleteError.md) -- [NoKeysPassedToUpdateError](../classes/NoKeysPassedToUpdateError.md) -- [NonAggregateExpressionNotInGroupByError](../classes/NonAggregateExpressionNotInGroupByError.md) -- [NonRetriableError](../classes/NonRetriableError.md) -- [NoPendingSyncTransactionCommitError](../classes/NoPendingSyncTransactionCommitError.md) -- [NoPendingSyncTransactionWriteError](../classes/NoPendingSyncTransactionWriteError.md) -- [OnlyOneSourceAllowedError](../classes/OnlyOneSourceAllowedError.md) -- [OnMutateMustBeSynchronousError](../classes/OnMutateMustBeSynchronousError.md) -- [QueryBuilderError](../classes/QueryBuilderError.md) -- [QueryCompilationError](../classes/QueryCompilationError.md) -- [QueryMustHaveFromClauseError](../classes/QueryMustHaveFromClauseError.md) -- [QueryOptimizerError](../classes/QueryOptimizerError.md) -- [SchemaMustBeSynchronousError](../classes/SchemaMustBeSynchronousError.md) -- [SchemaValidationError](../classes/SchemaValidationError.md) -- [SerializationError](../classes/SerializationError.md) -- [SetWindowRequiresOrderByError](../classes/SetWindowRequiresOrderByError.md) -- [SortedMap](../classes/SortedMap.md) -- [StorageError](../classes/StorageError.md) -- [StorageKeyRequiredError](../classes/StorageKeyRequiredError.md) -- [SubQueryMustHaveFromClauseError](../classes/SubQueryMustHaveFromClauseError.md) -- [SubscriptionNotFoundError](../classes/SubscriptionNotFoundError.md) -- [SyncCleanupError](../classes/SyncCleanupError.md) -- [SyncTransactionAlreadyCommittedError](../classes/SyncTransactionAlreadyCommittedError.md) -- [SyncTransactionAlreadyCommittedWriteError](../classes/SyncTransactionAlreadyCommittedWriteError.md) -- [TanStackDBError](../classes/TanStackDBError.md) -- [TransactionAlreadyCompletedRollbackError](../classes/TransactionAlreadyCompletedRollbackError.md) -- [TransactionError](../classes/TransactionError.md) -- [TransactionNotPendingCommitError](../classes/TransactionNotPendingCommitError.md) -- [TransactionNotPendingMutateError](../classes/TransactionNotPendingMutateError.md) -- [UndefinedKeyError](../classes/UndefinedKeyError.md) -- [UnknownExpressionTypeError](../classes/UnknownExpressionTypeError.md) -- [UnknownFunctionError](../classes/UnknownFunctionError.md) -- [UnknownHavingExpressionTypeError](../classes/UnknownHavingExpressionTypeError.md) -- [UnsupportedAggregateFunctionError](../classes/UnsupportedAggregateFunctionError.md) -- [UnsupportedFromTypeError](../classes/UnsupportedFromTypeError.md) -- [UnsupportedJoinSourceTypeError](../classes/UnsupportedJoinSourceTypeError.md) -- [UnsupportedJoinTypeError](../classes/UnsupportedJoinTypeError.md) -- [UpdateKeyNotFoundError](../classes/UpdateKeyNotFoundError.md) -- [WhereClauseConversionError](../classes/WhereClauseConversionError.md) - -## Interfaces - -- [BaseCollectionConfig](../interfaces/BaseCollectionConfig.md) -- [BaseStrategy](../interfaces/BaseStrategy.md) -- [BTreeIndexOptions](../interfaces/BTreeIndexOptions.md) -- [ChangeMessage](../interfaces/ChangeMessage.md) -- [Collection](../interfaces/Collection.md) -- [CollectionConfig](../interfaces/CollectionConfig.md) -- [Context](../interfaces/Context.md) -- [CreateOptimisticActionsOptions](../interfaces/CreateOptimisticActionsOptions.md) -- [CurrentStateAsChangesOptions](../interfaces/CurrentStateAsChangesOptions.md) -- [DebounceStrategy](../interfaces/DebounceStrategy.md) -- [DebounceStrategyOptions](../interfaces/DebounceStrategyOptions.md) -- [IndexInterface](../interfaces/IndexInterface.md) -- [IndexOptions](../interfaces/IndexOptions.md) -- [IndexStats](../interfaces/IndexStats.md) -- [InsertConfig](../interfaces/InsertConfig.md) -- [LiveQueryCollectionConfig](../interfaces/LiveQueryCollectionConfig.md) -- [LocalOnlyCollectionConfig](../interfaces/LocalOnlyCollectionConfig.md) -- [LocalOnlyCollectionUtils](../interfaces/LocalOnlyCollectionUtils.md) -- [LocalStorageCollectionConfig](../interfaces/LocalStorageCollectionConfig.md) -- [LocalStorageCollectionUtils](../interfaces/LocalStorageCollectionUtils.md) -- [OperationConfig](../interfaces/OperationConfig.md) -- [OptimisticChangeMessage](../interfaces/OptimisticChangeMessage.md) -- [PacedMutationsConfig](../interfaces/PacedMutationsConfig.md) -- [Parser](../interfaces/Parser.md) -- [PendingMutation](../interfaces/PendingMutation.md) -- [QueueStrategy](../interfaces/QueueStrategy.md) -- [QueueStrategyOptions](../interfaces/QueueStrategyOptions.md) -- [RangeQueryOptions](../interfaces/RangeQueryOptions.md) -- [SubscribeChangesOptions](../interfaces/SubscribeChangesOptions.md) -- [SubscribeChangesSnapshotOptions](../interfaces/SubscribeChangesSnapshotOptions.md) -- [Subscription](../interfaces/Subscription.md) -- [SubscriptionStatusChangeEvent](../interfaces/SubscriptionStatusChangeEvent.md) -- [SubscriptionStatusEvent](../interfaces/SubscriptionStatusEvent.md) -- [SubscriptionUnsubscribedEvent](../interfaces/SubscriptionUnsubscribedEvent.md) -- [SyncConfig](../interfaces/SyncConfig.md) -- [ThrottleStrategy](../interfaces/ThrottleStrategy.md) -- [ThrottleStrategyOptions](../interfaces/ThrottleStrategyOptions.md) -- [Transaction](../interfaces/Transaction.md) -- [TransactionConfig](../interfaces/TransactionConfig.md) - -## Type Aliases - -- [ChangeListener](../type-aliases/ChangeListener.md) -- [ChangesPayload](../type-aliases/ChangesPayload.md) -- [CleanupFn](../type-aliases/CleanupFn.md) -- [ClearStorageFn](../type-aliases/ClearStorageFn.md) -- [CollectionConfigSingleRowOption](../type-aliases/CollectionConfigSingleRowOption.md) -- [CollectionStatus](../type-aliases/CollectionStatus.md) -- [DeleteMutationFn](../type-aliases/DeleteMutationFn.md) -- [DeleteMutationFnParams](../type-aliases/DeleteMutationFnParams.md) -- [Fn](../type-aliases/Fn.md) -- [GetResult](../type-aliases/GetResult.md) -- [GetStorageSizeFn](../type-aliases/GetStorageSizeFn.md) -- [IndexConstructor](../type-aliases/IndexConstructor.md) -- [IndexOperation](../type-aliases/IndexOperation.md) -- [IndexResolver](../type-aliases/IndexResolver.md) -- [InferResultType](../type-aliases/InferResultType.md) -- [InferSchemaInput](../type-aliases/InferSchemaInput.md) -- [InferSchemaOutput](../type-aliases/InferSchemaOutput.md) -- [InitialQueryBuilder](../type-aliases/InitialQueryBuilder.md) -- [InputRow](../type-aliases/InputRow.md) -- [InsertMutationFn](../type-aliases/InsertMutationFn.md) -- [InsertMutationFnParams](../type-aliases/InsertMutationFnParams.md) -- [KeyedNamespacedRow](../type-aliases/KeyedNamespacedRow.md) -- [KeyedStream](../type-aliases/KeyedStream.md) -- [LiveQueryCollectionUtils](../type-aliases/LiveQueryCollectionUtils.md) -- [LoadSubsetFn](../type-aliases/LoadSubsetFn.md) -- [LoadSubsetOptions](../type-aliases/LoadSubsetOptions.md) -- [MaybeSingleResult](../type-aliases/MaybeSingleResult.md) -- [MutationFn](../type-aliases/MutationFn.md) -- [MutationFnParams](../type-aliases/MutationFnParams.md) -- [NamespacedAndKeyedStream](../type-aliases/NamespacedAndKeyedStream.md) -- [NamespacedRow](../type-aliases/NamespacedRow.md) -- [NonEmptyArray](../type-aliases/NonEmptyArray.md) -- [NonSingleResult](../type-aliases/NonSingleResult.md) -- [OperationType](../type-aliases/OperationType.md) -- [QueryBuilder](../type-aliases/QueryBuilder.md) -- [Ref](../type-aliases/Ref.md) -- [ResolveTransactionChanges](../type-aliases/ResolveTransactionChanges.md) -- [ResultStream](../type-aliases/ResultStream.md) -- [Row](../type-aliases/Row.md) -- [SingleResult](../type-aliases/SingleResult.md) -- [Source](../type-aliases/Source.md) -- [StandardSchema](../type-aliases/StandardSchema.md) -- [StandardSchemaAlias](../type-aliases/StandardSchemaAlias.md) -- [StorageApi](../type-aliases/StorageApi.md) -- [StorageEventApi](../type-aliases/StorageEventApi.md) -- [Strategy](../type-aliases/Strategy.md) -- [StrategyOptions](../type-aliases/StrategyOptions.md) -- [SubscriptionEvents](../type-aliases/SubscriptionEvents.md) -- [SubscriptionStatus](../type-aliases/SubscriptionStatus.md) -- [SyncConfigRes](../type-aliases/SyncConfigRes.md) -- [SyncMode](../type-aliases/SyncMode.md) -- [TransactionState](../type-aliases/TransactionState.md) -- [TransactionWithMutations](../type-aliases/TransactionWithMutations.md) -- [UpdateMutationFn](../type-aliases/UpdateMutationFn.md) -- [UpdateMutationFnParams](../type-aliases/UpdateMutationFnParams.md) -- [UtilsRecord](../type-aliases/UtilsRecord.md) -- [WritableDeep](../type-aliases/WritableDeep.md) - -## Variables - -- [IndexOperation](../variables/IndexOperation.md) -- [Query](../variables/Query.md) - -## Functions - -- [add](../functions/add.md) -- [and](../functions/and.md) -- [avg](../functions/avg.md) -- [coalesce](../functions/coalesce.md) -- [compileQuery](../functions/compileQuery.md) -- [concat](../functions/concat.md) -- [count](../functions/count.md) -- [createArrayChangeProxy](../functions/createArrayChangeProxy.md) -- [createChangeProxy](../functions/createChangeProxy.md) -- [createCollection](../functions/createCollection.md) -- [createLiveQueryCollection](../functions/createLiveQueryCollection.md) -- [createOptimisticAction](../functions/createOptimisticAction.md) -- [createPacedMutations](../functions/createPacedMutations.md) -- [createTransaction](../functions/createTransaction.md) -- [debounceStrategy](../functions/debounceStrategy.md) -- [eq](../functions/eq.md) -- [getActiveTransaction](../functions/getActiveTransaction.md) -- [gt](../functions/gt.md) -- [gte](../functions/gte.md) -- [ilike](../functions/ilike.md) -- [inArray](../functions/inArray.md) -- [isNull](../functions/isNull.md) -- [isUndefined](../functions/isUndefined.md) -- [length](../functions/length.md) -- [like](../functions/like.md) -- [liveQueryCollectionOptions](../functions/liveQueryCollectionOptions.md) -- [localOnlyCollectionOptions](../functions/localOnlyCollectionOptions.md) -- [localStorageCollectionOptions](../functions/localStorageCollectionOptions.md) -- [lower](../functions/lower.md) -- [lt](../functions/lt.md) -- [lte](../functions/lte.md) -- [max](../functions/max.md) -- [min](../functions/min.md) -- [not](../functions/not.md) -- [or](../functions/or.md) -- [queueStrategy](../functions/queueStrategy.md) -- [sum](../functions/sum.md) -- [throttleStrategy](../functions/throttleStrategy.md) -- [upper](../functions/upper.md) -- [withArrayChangeTracking](../functions/withArrayChangeTracking.md) -- [withChangeTracking](../functions/withChangeTracking.md) diff --git a/docs/reference/interfaces/BTreeIndexOptions.md b/docs/reference/interfaces/BTreeIndexOptions.md deleted file mode 100644 index 6e6b27aa2..000000000 --- a/docs/reference/interfaces/BTreeIndexOptions.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -id: BTreeIndexOptions -title: BTreeIndexOptions ---- - -# Interface: BTreeIndexOptions - -Defined in: [packages/db/src/indexes/btree-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L11) - -Options for Ordered index - -## Properties - -### compareFn()? - -```ts -optional compareFn: (a, b) => number; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:12](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L12) - -#### Parameters - -##### a - -`any` - -##### b - -`any` - -#### Returns - -`number` - -*** - -### compareOptions? - -```ts -optional compareOptions: CompareOptions; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L13) diff --git a/docs/reference/interfaces/BaseCollectionConfig.md b/docs/reference/interfaces/BaseCollectionConfig.md deleted file mode 100644 index 15da7ae5a..000000000 --- a/docs/reference/interfaces/BaseCollectionConfig.md +++ /dev/null @@ -1,412 +0,0 @@ ---- -id: BaseCollectionConfig -title: BaseCollectionConfig ---- - -# Interface: BaseCollectionConfig\ - -Defined in: [packages/db/src/types.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L385) - -## Extended by - -- [`CollectionConfig`](../CollectionConfig.md) -- [`LocalStorageCollectionConfig`](../LocalStorageCollectionConfig.md) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -### TReturn - -`TReturn` = `any` - -## Properties - -### autoIndex? - -```ts -optional autoIndex: "eager" | "off"; -``` - -Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) - -Auto-indexing mode for the collection. -When enabled, indexes will be automatically created for simple where expressions. - -#### Default - -```ts -"eager" -``` - -#### Description - -- "off": No automatic indexing -- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) - -*** - -### compare()? - -```ts -optional compare: (x, y) => number; -``` - -Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) - -Optional function to compare two items. -This is used to order the items in the collection. - -#### Parameters - -##### x - -`T` - -The first item to compare - -##### y - -`T` - -The second item to compare - -#### Returns - -`number` - -A number indicating the order of the items - -#### Example - -```ts -// For a collection with a 'createdAt' field -compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() -``` - -*** - -### gcTime? - -```ts -optional gcTime: number; -``` - -Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) - -Time in milliseconds after which the collection will be garbage collected -when it has no active subscribers. Defaults to 5 minutes (300000ms). - -*** - -### getKey() - -```ts -getKey: (item) => TKey; -``` - -Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) - -Function to extract the ID from an object -This is required for update/delete operations which now only accept IDs - -#### Parameters - -##### item - -`T` - -The item to extract the ID from - -#### Returns - -`TKey` - -The ID string for the item - -#### Example - -```ts -// For a collection with a 'uuid' field as the primary key -getKey: (item) => item.uuid -``` - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) - -*** - -### onDelete? - -```ts -optional onDelete: DeleteMutationFn; -``` - -Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) - -Optional asynchronous handler function called before a delete operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic delete handler -onDelete: async ({ transaction, collection }) => { - const deletedKey = transaction.mutations[0].key - await api.deleteTodo(deletedKey) -} -``` - -```ts -// Delete handler with multiple items -onDelete: async ({ transaction, collection }) => { - const keysToDelete = transaction.mutations.map(m => m.key) - await api.deleteTodos(keysToDelete) -} -``` - -```ts -// Delete handler with confirmation -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const shouldDelete = await confirmDeletion(mutation.original) - if (!shouldDelete) { - throw new Error('Delete cancelled by user') - } - await api.deleteTodo(mutation.original.id) -} -``` - -```ts -// Delete handler with optimistic rollback -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.deleteTodo(mutation.original.id) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Delete failed, rolling back:', error) - throw error - } -} -``` - -*** - -### onInsert? - -```ts -optional onInsert: InsertMutationFn; -``` - -Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) - -Optional asynchronous handler function called before an insert operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic insert handler -onInsert: async ({ transaction, collection }) => { - const newItem = transaction.mutations[0].modified - await api.createTodo(newItem) -} -``` - -```ts -// Insert handler with multiple items -onInsert: async ({ transaction, collection }) => { - const items = transaction.mutations.map(m => m.modified) - await api.createTodos(items) -} -``` - -```ts -// Insert handler with error handling -onInsert: async ({ transaction, collection }) => { - try { - const newItem = transaction.mutations[0].modified - const result = await api.createTodo(newItem) - return result - } catch (error) { - console.error('Insert failed:', error) - throw error // This will cause the transaction to fail - } -} -``` - -```ts -// Insert handler with metadata -onInsert: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - await api.createTodo(mutation.modified, { - source: mutation.metadata?.source, - timestamp: mutation.createdAt - }) -} -``` - -*** - -### onUpdate? - -```ts -optional onUpdate: UpdateMutationFn; -``` - -Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) - -Optional asynchronous handler function called before an update operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic update handler -onUpdate: async ({ transaction, collection }) => { - const updatedItem = transaction.mutations[0].modified - await api.updateTodo(updatedItem.id, updatedItem) -} -``` - -```ts -// Update handler with partial updates -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const changes = mutation.changes // Only the changed fields - await api.updateTodo(mutation.original.id, changes) -} -``` - -```ts -// Update handler with multiple items -onUpdate: async ({ transaction, collection }) => { - const updates = transaction.mutations.map(m => ({ - id: m.key, - changes: m.changes - })) - await api.updateTodos(updates) -} -``` - -```ts -// Update handler with optimistic rollback -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.updateTodo(mutation.original.id, mutation.changes) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Update failed, rolling back:', error) - throw error - } -} -``` - -*** - -### schema? - -```ts -optional schema: TSchema; -``` - -Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) - -*** - -### startSync? - -```ts -optional startSync: boolean; -``` - -Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) - -Whether to eagerly start syncing on collection creation. -When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. - -Note: Even with startSync=true, collections will pause syncing when there are no active -subscribers (typically when components querying the collection unmount), resuming when new -subscribers attach. This preserves normal staleTime/gcTime behavior. - -#### Default - -```ts -false -``` - -*** - -### syncMode? - -```ts -optional syncMode: SyncMode; -``` - -Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) - -The mode of sync to use for the collection. - -#### Default - -`eager` - -#### Description - -- `eager`: syncs all data immediately on preload -- `on-demand`: syncs data in incremental snapshots when the collection is queried -The exact implementation of the sync mode is up to the sync implementation. - -*** - -### utils? - -```ts -optional utils: TUtils; -``` - -Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) diff --git a/docs/reference/interfaces/BaseStrategy.md b/docs/reference/interfaces/BaseStrategy.md deleted file mode 100644 index fdfb8354c..000000000 --- a/docs/reference/interfaces/BaseStrategy.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -id: BaseStrategy -title: BaseStrategy ---- - -# Interface: BaseStrategy\ - -Defined in: [packages/db/src/strategies/types.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L6) - -Base strategy interface that all strategy implementations must conform to - -## Extended by - -- [`DebounceStrategy`](../DebounceStrategy.md) -- [`QueueStrategy`](../QueueStrategy.md) -- [`ThrottleStrategy`](../ThrottleStrategy.md) - -## Type Parameters - -### TName - -`TName` *extends* `string` = `string` - -## Properties - -### \_type - -```ts -_type: TName; -``` - -Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) - -Type discriminator for strategy identification - -*** - -### cleanup() - -```ts -cleanup: () => void; -``` - -Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) - -Clean up any resources held by the strategy -Should be called when the strategy is no longer needed - -#### Returns - -`void` - -*** - -### execute() - -```ts -execute: (fn) => void | Promise; -``` - -Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) - -Execute a function according to the strategy's timing rules - -#### Type Parameters - -##### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -#### Parameters - -##### fn - -() => [`Transaction`](../Transaction.md)\<`T`\> - -The function to execute - -#### Returns - -`void` \| `Promise`\<`void`\> - -The result of the function execution (if applicable) diff --git a/docs/reference/interfaces/ChangeMessage.md b/docs/reference/interfaces/ChangeMessage.md deleted file mode 100644 index 81c59300d..000000000 --- a/docs/reference/interfaces/ChangeMessage.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -id: ChangeMessage -title: ChangeMessage ---- - -# Interface: ChangeMessage\ - -Defined in: [packages/db/src/types.ts:261](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L261) - -## Extended by - -- [`OptimisticChangeMessage`](../OptimisticChangeMessage.md) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Properties - -### key - -```ts -key: TKey; -``` - -Defined in: [packages/db/src/types.ts:265](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L265) - -*** - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:269](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L269) - -*** - -### previousValue? - -```ts -optional previousValue: T; -``` - -Defined in: [packages/db/src/types.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L267) - -*** - -### type - -```ts -type: OperationType; -``` - -Defined in: [packages/db/src/types.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L268) - -*** - -### value - -```ts -value: T; -``` - -Defined in: [packages/db/src/types.ts:266](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L266) diff --git a/docs/reference/interfaces/Collection.md b/docs/reference/interfaces/Collection.md deleted file mode 100644 index c2badec06..000000000 --- a/docs/reference/interfaces/Collection.md +++ /dev/null @@ -1,1584 +0,0 @@ ---- -id: Collection -title: Collection ---- - -# Interface: Collection\ - -Defined in: [packages/db/src/collection/index.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L47) - -Enhanced Collection interface that includes both data type T and utilities TUtils - -## Extends - -- [`CollectionImpl`](../../classes/CollectionImpl.md)\<`T`, `TKey`, `TUtils`, `TSchema`, `TInsertInput`\> - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -The type of items in the collection - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key for the collection - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -The utilities record type - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `StandardSchemaV1` - -### TInsertInput - -`TInsertInput` *extends* `object` = `T` - -The type for insert operations (can be different from T for schemas with defaults) - -## Properties - -### \_lifecycle - -```ts -_lifecycle: CollectionLifecycleManager; -``` - -Defined in: [packages/db/src/collection/index.ts:219](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L219) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`_lifecycle`](../../classes/CollectionImpl.md#_lifecycle) - -*** - -### \_state - -```ts -_state: CollectionStateManager; -``` - -Defined in: [packages/db/src/collection/index.ts:231](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L231) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`_state`](../../classes/CollectionImpl.md#_state) - -*** - -### \_sync - -```ts -_sync: CollectionSyncManager; -``` - -Defined in: [packages/db/src/collection/index.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L220) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`_sync`](../../classes/CollectionImpl.md#_sync) - -*** - -### config - -```ts -config: CollectionConfig; -``` - -Defined in: [packages/db/src/collection/index.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L210) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`config`](../../classes/CollectionImpl.md#config) - -*** - -### id - -```ts -id: string; -``` - -Defined in: [packages/db/src/collection/index.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L209) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`id`](../../classes/CollectionImpl.md#id) - -*** - -### singleResult? - -```ts -readonly optional singleResult: true; -``` - -Defined in: [packages/db/src/collection/index.ts:55](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L55) - -*** - -### utils - -```ts -readonly utils: TUtils; -``` - -Defined in: [packages/db/src/collection/index.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L54) - -#### Overrides - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`utils`](../../classes/CollectionImpl.md#utils) - -## Accessors - -### indexes - -#### Get Signature - -```ts -get indexes(): Map>; -``` - -Defined in: [packages/db/src/collection/index.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L496) - -Get resolved indexes for query optimization - -##### Returns - -`Map`\<`number`, [`BaseIndex`](../../classes/BaseIndex.md)\<`TKey`\>\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`indexes`](../../classes/CollectionImpl.md#indexes) - -*** - -### isLoadingSubset - -#### Get Signature - -```ts -get isLoadingSubset(): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:362](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L362) - -Check if the collection is currently loading more data - -##### Returns - -`boolean` - -true if the collection has pending load more operations, false otherwise - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`isLoadingSubset`](../../classes/CollectionImpl.md#isloadingsubset) - -*** - -### size - -#### Get Signature - -```ts -get size(): number; -``` - -Defined in: [packages/db/src/collection/index.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L399) - -Get the current size of the collection (cached) - -##### Returns - -`number` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`size`](../../classes/CollectionImpl.md#size) - -*** - -### state - -#### Get Signature - -```ts -get state(): Map; -``` - -Defined in: [packages/db/src/collection/index.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L683) - -Gets the current state of the collection as a Map - -##### Example - -```ts -const itemsMap = collection.state -console.log(`Collection has ${itemsMap.size} items`) - -for (const [key, item] of itemsMap) { - console.log(`${key}: ${item.title}`) -} - -// Check if specific item exists -if (itemsMap.has("todo-1")) { - console.log("Todo 1 exists:", itemsMap.get("todo-1")) -} -``` - -##### Returns - -`Map`\<`TKey`, `TOutput`\> - -Map containing all items in the collection, with keys as identifiers - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`state`](../../classes/CollectionImpl.md#state) - -*** - -### status - -#### Get Signature - -```ts -get status(): CollectionStatus; -``` - -Defined in: [packages/db/src/collection/index.ts:317](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L317) - -Gets the current status of the collection - -##### Returns - -[`CollectionStatus`](../../type-aliases/CollectionStatus.md) - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`status`](../../classes/CollectionImpl.md#status) - -*** - -### subscriberCount - -#### Get Signature - -```ts -get subscriberCount(): number; -``` - -Defined in: [packages/db/src/collection/index.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L324) - -Get the number of subscribers to the collection - -##### Returns - -`number` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`subscriberCount`](../../classes/CollectionImpl.md#subscribercount) - -*** - -### toArray - -#### Get Signature - -```ts -get toArray(): TOutput[]; -``` - -Defined in: [packages/db/src/collection/index.ts:712](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L712) - -Gets the current state of the collection as an Array - -##### Returns - -`TOutput`[] - -An Array containing all items in the collection - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`toArray`](../../classes/CollectionImpl.md#toarray) - -## Methods - -### \[iterator\]() - -```ts -iterator: IterableIterator<[TKey, T]>; -``` - -Defined in: [packages/db/src/collection/index.ts:427](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L427) - -Get all entries (virtual derived state) - -#### Returns - -`IterableIterator`\<\[`TKey`, `T`\]\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`[iterator]`](../../classes/CollectionImpl.md#iterator) - -*** - -### cleanup() - -```ts -cleanup(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:846](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L846) - -Clean up the collection by stopping sync and clearing data -This can be called manually or automatically by garbage collection - -#### Returns - -`Promise`\<`void`\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`cleanup`](../../classes/CollectionImpl.md#cleanup) - -*** - -### createIndex() - -```ts -createIndex(indexCallback, config): IndexProxy; -``` - -Defined in: [packages/db/src/collection/index.ts:486](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L486) - -Creates an index on a collection for faster queries. -Indexes significantly improve query performance by allowing constant time lookups -and logarithmic time range queries instead of full scans. - -#### Type Parameters - -##### TResolver - -`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> = *typeof* [`BTreeIndex`](../../classes/BTreeIndex.md) - -The type of the index resolver (constructor or async loader) - -#### Parameters - -##### indexCallback - -(`row`) => `any` - -Function that extracts the indexed value from each item - -##### config - -[`IndexOptions`](../IndexOptions.md)\<`TResolver`\> = `{}` - -Configuration including index type and type-specific options - -#### Returns - -[`IndexProxy`](../../classes/IndexProxy.md)\<`TKey`\> - -An index proxy that provides access to the index when ready - -#### Example - -```ts -// Create a default B+ tree index -const ageIndex = collection.createIndex((row) => row.age) - -// Create a ordered index with custom options -const ageIndex = collection.createIndex((row) => row.age, { - indexType: BTreeIndex, - options: { - compareFn: customComparator, - compareOptions: { direction: 'asc', nulls: 'first', stringSort: 'lexical' } - }, - name: 'age_btree' -}) - -// Create an async-loaded index -const textIndex = collection.createIndex((row) => row.content, { - indexType: async () => { - const { FullTextIndex } = await import('./indexes/fulltext.js') - return FullTextIndex - }, - options: { language: 'en' } -}) -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`createIndex`](../../classes/CollectionImpl.md#createindex) - -*** - -### currentStateAsChanges() - -```ts -currentStateAsChanges(options): - | void - | ChangeMessage[]; -``` - -Defined in: [packages/db/src/collection/index.ts:750](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L750) - -Returns the current state of the collection as an array of changes - -#### Parameters - -##### options - -[`CurrentStateAsChangesOptions`](../CurrentStateAsChangesOptions.md) = `{}` - -Options including optional where filter - -#### Returns - - \| `void` - \| [`ChangeMessage`](../ChangeMessage.md)\<`T`, `string` \| `number`\>[] - -An array of changes - -#### Example - -```ts -// Get all items as changes -const allChanges = collection.currentStateAsChanges() - -// Get only items matching a condition -const activeChanges = collection.currentStateAsChanges({ - where: (row) => row.status === 'active' -}) - -// Get only items using a pre-compiled expression -const activeChanges = collection.currentStateAsChanges({ - whereExpression: eq(row.status, 'active') -}) -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`currentStateAsChanges`](../../classes/CollectionImpl.md#currentstateaschanges) - -*** - -### delete() - -```ts -delete(keys, config?): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L660) - -Deletes one or more items from the collection - -#### Parameters - -##### keys - -Single key or array of keys to delete - -`TKey` | `TKey`[] - -##### config? - -[`OperationConfig`](../OperationConfig.md) - -Optional configuration including metadata - -#### Returns - -[`Transaction`](../Transaction.md)\<`any`\> - -A Transaction object representing the delete operation(s) - -#### Examples - -```ts -// Delete a single item -const tx = collection.delete("todo-1") -await tx.isPersisted.promise -``` - -```ts -// Delete multiple items -const tx = collection.delete(["todo-1", "todo-2"]) -await tx.isPersisted.promise -``` - -```ts -// Delete with metadata -const tx = collection.delete("todo-1", { metadata: { reason: "completed" } }) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.delete("item-1") - await tx.isPersisted.promise - console.log('Delete successful') -} catch (error) { - console.log('Delete failed:', error) -} -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`delete`](../../classes/CollectionImpl.md#delete) - -*** - -### entries() - -```ts -entries(): IterableIterator<[TKey, T]>; -``` - -Defined in: [packages/db/src/collection/index.ts:420](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L420) - -Get all entries (virtual derived state) - -#### Returns - -`IterableIterator`\<\[`TKey`, `T`\]\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`entries`](../../classes/CollectionImpl.md#entries) - -*** - -### forEach() - -```ts -forEach(callbackfn): void; -``` - -Defined in: [packages/db/src/collection/index.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L434) - -Execute a callback for each entry in the collection - -#### Parameters - -##### callbackfn - -(`value`, `key`, `index`) => `void` - -#### Returns - -`void` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`forEach`](../../classes/CollectionImpl.md#foreach) - -*** - -### get() - -```ts -get(key): T | undefined; -``` - -Defined in: [packages/db/src/collection/index.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L385) - -Get the current value for a key (virtual derived state) - -#### Parameters - -##### key - -`TKey` - -#### Returns - -`T` \| `undefined` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`get`](../../classes/CollectionImpl.md#get) - -*** - -### getKeyFromItem() - -```ts -getKeyFromItem(item): TKey; -``` - -Defined in: [packages/db/src/collection/index.ts:449](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L449) - -#### Parameters - -##### item - -`T` - -#### Returns - -`TKey` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`getKeyFromItem`](../../classes/CollectionImpl.md#getkeyfromitem) - -*** - -### has() - -```ts -has(key): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L392) - -Check if a key exists in the collection (virtual derived state) - -#### Parameters - -##### key - -`TKey` - -#### Returns - -`boolean` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`has`](../../classes/CollectionImpl.md#has) - -*** - -### insert() - -```ts -insert(data, config?): - | Transaction> -| Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L547) - -Inserts one or more items into the collection - -#### Parameters - -##### data - -`TInsertInput` | `TInsertInput`[] - -##### config? - -[`InsertConfig`](../InsertConfig.md) - -Optional configuration including metadata - -#### Returns - - \| [`Transaction`](../Transaction.md)\<`Record`\<`string`, `unknown`\>\> - \| [`Transaction`](../Transaction.md)\<`T`\> - -A Transaction object representing the insert operation(s) - -#### Throws - -If the data fails schema validation - -#### Examples - -```ts -// Insert a single todo (requires onInsert handler) -const tx = collection.insert({ id: "1", text: "Buy milk", completed: false }) -await tx.isPersisted.promise -``` - -```ts -// Insert multiple todos at once -const tx = collection.insert([ - { id: "1", text: "Buy milk", completed: false }, - { id: "2", text: "Walk dog", completed: true } -]) -await tx.isPersisted.promise -``` - -```ts -// Insert with metadata -const tx = collection.insert({ id: "1", text: "Buy groceries" }, - { metadata: { source: "mobile-app" } } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.insert({ id: "1", text: "New item" }) - await tx.isPersisted.promise - console.log('Insert successful') -} catch (error) { - console.log('Insert failed:', error) -} -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`insert`](../../classes/CollectionImpl.md#insert) - -*** - -### isReady() - -```ts -isReady(): boolean; -``` - -Defined in: [packages/db/src/collection/index.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L354) - -Check if the collection is ready for use -Returns true if the collection has been marked as ready by its sync implementation - -#### Returns - -`boolean` - -true if the collection is ready, false otherwise - -#### Example - -```ts -if (collection.isReady()) { - console.log('Collection is ready, data is available') - // Safe to access collection.state -} else { - console.log('Collection is still loading') -} -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`isReady`](../../classes/CollectionImpl.md#isready) - -*** - -### keys() - -```ts -keys(): IterableIterator; -``` - -Defined in: [packages/db/src/collection/index.ts:406](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L406) - -Get all keys (virtual derived state) - -#### Returns - -`IterableIterator`\<`TKey`\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`keys`](../../classes/CollectionImpl.md#keys) - -*** - -### map() - -```ts -map(callbackfn): U[]; -``` - -Defined in: [packages/db/src/collection/index.ts:443](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L443) - -Create a new array with the results of calling a function for each entry in the collection - -#### Type Parameters - -##### U - -`U` - -#### Parameters - -##### callbackfn - -(`value`, `key`, `index`) => `U` - -#### Returns - -`U`[] - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`map`](../../classes/CollectionImpl.md#map) - -*** - -### off() - -```ts -off(event, callback): void; -``` - -Defined in: [packages/db/src/collection/index.ts:825](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L825) - -Unsubscribe from a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -`void` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`off`](../../classes/CollectionImpl.md#off) - -*** - -### on() - -```ts -on(event, callback): () => void; -``` - -Defined in: [packages/db/src/collection/index.ts:805](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L805) - -Subscribe to a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -```ts -(): void; -``` - -##### Returns - -`void` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`on`](../../classes/CollectionImpl.md#on) - -*** - -### once() - -```ts -once(event, callback): () => void; -``` - -Defined in: [packages/db/src/collection/index.ts:815](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L815) - -Subscribe to a collection event once - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### callback - -`CollectionEventHandler`\<`T`\> - -#### Returns - -```ts -(): void; -``` - -##### Returns - -`void` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`once`](../../classes/CollectionImpl.md#once) - -*** - -### onFirstReady() - -```ts -onFirstReady(callback): void; -``` - -Defined in: [packages/db/src/collection/index.ts:338](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L338) - -Register a callback to be executed when the collection first becomes ready -Useful for preloading collections - -#### Parameters - -##### callback - -() => `void` - -Function to call when the collection first becomes ready - -#### Returns - -`void` - -#### Example - -```ts -collection.onFirstReady(() => { - console.log('Collection is ready for the first time') - // Safe to access collection.state now -}) -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`onFirstReady`](../../classes/CollectionImpl.md#onfirstready) - -*** - -### preload() - -```ts -preload(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:378](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L378) - -Preload the collection data by starting sync if not already started -Multiple concurrent calls will share the same promise - -#### Returns - -`Promise`\<`void`\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`preload`](../../classes/CollectionImpl.md#preload) - -*** - -### startSyncImmediate() - -```ts -startSyncImmediate(): void; -``` - -Defined in: [packages/db/src/collection/index.ts:370](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L370) - -Start sync immediately - internal method for compiled queries -This bypasses lazy loading for special cases like live query results - -#### Returns - -`void` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`startSyncImmediate`](../../classes/CollectionImpl.md#startsyncimmediate) - -*** - -### stateWhenReady() - -```ts -stateWhenReady(): Promise>; -``` - -Defined in: [packages/db/src/collection/index.ts:697](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L697) - -Gets the current state of the collection as a Map, but only resolves when data is available -Waits for the first sync commit to complete before resolving - -#### Returns - -`Promise`\<`Map`\<`TKey`, `T`\>\> - -Promise that resolves to a Map containing all items in the collection - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`stateWhenReady`](../../classes/CollectionImpl.md#statewhenready) - -*** - -### subscribeChanges() - -```ts -subscribeChanges(callback, options): CollectionSubscription; -``` - -Defined in: [packages/db/src/collection/index.ts:795](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L795) - -Subscribe to changes in the collection - -#### Parameters - -##### callback - -(`changes`) => `void` - -Function called when items change - -##### options - -[`SubscribeChangesOptions`](../SubscribeChangesOptions.md) = `{}` - -Subscription options including includeInitialState and where filter - -#### Returns - -`CollectionSubscription` - -Unsubscribe function - Call this to stop listening for changes - -#### Examples - -```ts -// Basic subscription -const subscription = collection.subscribeChanges((changes) => { - changes.forEach(change => { - console.log(`${change.type}: ${change.key}`, change.value) - }) -}) - -// Later: subscription.unsubscribe() -``` - -```ts -// Include current state immediately -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { includeInitialState: true }) -``` - -```ts -// Subscribe only to changes matching a condition -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { - includeInitialState: true, - where: (row) => row.status === 'active' -}) -``` - -```ts -// Subscribe using a pre-compiled expression -const subscription = collection.subscribeChanges((changes) => { - updateUI(changes) -}, { - includeInitialState: true, - whereExpression: eq(row.status, 'active') -}) -``` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`subscribeChanges`](../../classes/CollectionImpl.md#subscribechanges) - -*** - -### toArrayWhenReady() - -```ts -toArrayWhenReady(): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:722](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L722) - -Gets the current state of the collection as an Array, but only resolves when data is available -Waits for the first sync commit to complete before resolving - -#### Returns - -`Promise`\<`T`[]\> - -Promise that resolves to an Array containing all items in the collection - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`toArrayWhenReady`](../../classes/CollectionImpl.md#toarraywhenready) - -*** - -### update() - -#### Call Signature - -```ts -update(key, callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L592) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### key - -`unknown`[] - -###### callback - -(`drafts`) => `void` - -##### Returns - -[`Transaction`](../Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -##### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) - -#### Call Signature - -```ts -update( - keys, - config, - callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L598) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### keys - -`unknown`[] - -Single key or array of keys to update - -###### config - -[`OperationConfig`](../OperationConfig.md) - -###### callback - -(`drafts`) => `void` - -##### Returns - -[`Transaction`](../Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -##### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) - -#### Call Signature - -```ts -update(id, callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L605) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### id - -`unknown` - -###### callback - -(`draft`) => `void` - -##### Returns - -[`Transaction`](../Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -##### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) - -#### Call Signature - -```ts -update( - id, - config, - callback): Transaction; -``` - -Defined in: [packages/db/src/collection/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L611) - -Updates one or more items in the collection using a callback function - -##### Parameters - -###### id - -`unknown` - -###### config - -[`OperationConfig`](../OperationConfig.md) - -###### callback - -(`draft`) => `void` - -##### Returns - -[`Transaction`](../Transaction.md) - -A Transaction object representing the update operation(s) - -##### Throws - -If the updated data fails schema validation - -##### Examples - -```ts -// Update single item by key -const tx = collection.update("todo-1", (draft) => { - draft.completed = true -}) -await tx.isPersisted.promise -``` - -```ts -// Update multiple items -const tx = collection.update(["todo-1", "todo-2"], (drafts) => { - drafts.forEach(draft => { draft.completed = true }) -}) -await tx.isPersisted.promise -``` - -```ts -// Update with metadata -const tx = collection.update("todo-1", - { metadata: { reason: "user update" } }, - (draft) => { draft.text = "Updated text" } -) -await tx.isPersisted.promise -``` - -```ts -// Handle errors -try { - const tx = collection.update("item-1", draft => { draft.value = "new" }) - await tx.isPersisted.promise - console.log('Update successful') -} catch (error) { - console.log('Update failed:', error) -} -``` - -##### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) - -*** - -### validateData() - -```ts -validateData( - data, - type, - key?): T; -``` - -Defined in: [packages/db/src/collection/index.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L503) - -Validates the data against the schema - -#### Parameters - -##### data - -`unknown` - -##### type - -`"insert"` | `"update"` - -##### key? - -`TKey` - -#### Returns - -`T` - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`validateData`](../../classes/CollectionImpl.md#validatedata) - -*** - -### values() - -```ts -values(): IterableIterator; -``` - -Defined in: [packages/db/src/collection/index.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L413) - -Get all values (virtual derived state) - -#### Returns - -`IterableIterator`\<`T`\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`values`](../../classes/CollectionImpl.md#values) - -*** - -### waitFor() - -```ts -waitFor(event, timeout?): Promise; -``` - -Defined in: [packages/db/src/collection/index.ts:835](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L835) - -Wait for a collection event - -#### Type Parameters - -##### T - -`T` *extends* - \| `"status:idle"` - \| `"status:loading"` - \| `"status:ready"` - \| `"status:error"` - \| `"status:cleaned-up"` - \| `"status:change"` - \| `"subscribers:change"` - \| `"loadingSubset:change"` - -#### Parameters - -##### event - -`T` - -##### timeout? - -`number` - -#### Returns - -`Promise`\<`AllCollectionEvents`\[`T`\]\> - -#### Inherited from - -[`CollectionImpl`](../../classes/CollectionImpl.md).[`waitFor`](../../classes/CollectionImpl.md#waitfor) diff --git a/docs/reference/interfaces/CollectionConfig.md b/docs/reference/interfaces/CollectionConfig.md deleted file mode 100644 index 78702c4d3..000000000 --- a/docs/reference/interfaces/CollectionConfig.md +++ /dev/null @@ -1,465 +0,0 @@ ---- -id: CollectionConfig -title: CollectionConfig ---- - -# Interface: CollectionConfig\ - -Defined in: [packages/db/src/types.ts:588](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L588) - -## Extends - -- [`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`, `TUtils`\> - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -## Properties - -### autoIndex? - -```ts -optional autoIndex: "eager" | "off"; -``` - -Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) - -Auto-indexing mode for the collection. -When enabled, indexes will be automatically created for simple where expressions. - -#### Default - -```ts -"eager" -``` - -#### Description - -- "off": No automatic indexing -- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) - -*** - -### compare()? - -```ts -optional compare: (x, y) => number; -``` - -Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) - -Optional function to compare two items. -This is used to order the items in the collection. - -#### Parameters - -##### x - -`T` - -The first item to compare - -##### y - -`T` - -The second item to compare - -#### Returns - -`number` - -A number indicating the order of the items - -#### Example - -```ts -// For a collection with a 'createdAt' field -compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`compare`](../BaseCollectionConfig.md#compare) - -*** - -### gcTime? - -```ts -optional gcTime: number; -``` - -Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) - -Time in milliseconds after which the collection will be garbage collected -when it has no active subscribers. Defaults to 5 minutes (300000ms). - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`gcTime`](../BaseCollectionConfig.md#gctime) - -*** - -### getKey() - -```ts -getKey: (item) => TKey; -``` - -Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) - -Function to extract the ID from an object -This is required for update/delete operations which now only accept IDs - -#### Parameters - -##### item - -`T` - -The item to extract the ID from - -#### Returns - -`TKey` - -The ID string for the item - -#### Example - -```ts -// For a collection with a 'uuid' field as the primary key -getKey: (item) => item.uuid -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`getKey`](../BaseCollectionConfig.md#getkey) - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) - -*** - -### onDelete? - -```ts -optional onDelete: DeleteMutationFn; -``` - -Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) - -Optional asynchronous handler function called before a delete operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic delete handler -onDelete: async ({ transaction, collection }) => { - const deletedKey = transaction.mutations[0].key - await api.deleteTodo(deletedKey) -} -``` - -```ts -// Delete handler with multiple items -onDelete: async ({ transaction, collection }) => { - const keysToDelete = transaction.mutations.map(m => m.key) - await api.deleteTodos(keysToDelete) -} -``` - -```ts -// Delete handler with confirmation -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const shouldDelete = await confirmDeletion(mutation.original) - if (!shouldDelete) { - throw new Error('Delete cancelled by user') - } - await api.deleteTodo(mutation.original.id) -} -``` - -```ts -// Delete handler with optimistic rollback -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.deleteTodo(mutation.original.id) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Delete failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onDelete`](../BaseCollectionConfig.md#ondelete) - -*** - -### onInsert? - -```ts -optional onInsert: InsertMutationFn; -``` - -Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) - -Optional asynchronous handler function called before an insert operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic insert handler -onInsert: async ({ transaction, collection }) => { - const newItem = transaction.mutations[0].modified - await api.createTodo(newItem) -} -``` - -```ts -// Insert handler with multiple items -onInsert: async ({ transaction, collection }) => { - const items = transaction.mutations.map(m => m.modified) - await api.createTodos(items) -} -``` - -```ts -// Insert handler with error handling -onInsert: async ({ transaction, collection }) => { - try { - const newItem = transaction.mutations[0].modified - const result = await api.createTodo(newItem) - return result - } catch (error) { - console.error('Insert failed:', error) - throw error // This will cause the transaction to fail - } -} -``` - -```ts -// Insert handler with metadata -onInsert: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - await api.createTodo(mutation.modified, { - source: mutation.metadata?.source, - timestamp: mutation.createdAt - }) -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onInsert`](../BaseCollectionConfig.md#oninsert) - -*** - -### onUpdate? - -```ts -optional onUpdate: UpdateMutationFn; -``` - -Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) - -Optional asynchronous handler function called before an update operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic update handler -onUpdate: async ({ transaction, collection }) => { - const updatedItem = transaction.mutations[0].modified - await api.updateTodo(updatedItem.id, updatedItem) -} -``` - -```ts -// Update handler with partial updates -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const changes = mutation.changes // Only the changed fields - await api.updateTodo(mutation.original.id, changes) -} -``` - -```ts -// Update handler with multiple items -onUpdate: async ({ transaction, collection }) => { - const updates = transaction.mutations.map(m => ({ - id: m.key, - changes: m.changes - })) - await api.updateTodos(updates) -} -``` - -```ts -// Update handler with optimistic rollback -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.updateTodo(mutation.original.id, mutation.changes) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Update failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onUpdate`](../BaseCollectionConfig.md#onupdate) - -*** - -### schema? - -```ts -optional schema: TSchema; -``` - -Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`schema`](../BaseCollectionConfig.md#schema) - -*** - -### startSync? - -```ts -optional startSync: boolean; -``` - -Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) - -Whether to eagerly start syncing on collection creation. -When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. - -Note: Even with startSync=true, collections will pause syncing when there are no active -subscribers (typically when components querying the collection unmount), resuming when new -subscribers attach. This preserves normal staleTime/gcTime behavior. - -#### Default - -```ts -false -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`startSync`](../BaseCollectionConfig.md#startsync) - -*** - -### sync - -```ts -sync: SyncConfig; -``` - -Defined in: [packages/db/src/types.ts:594](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L594) - -*** - -### syncMode? - -```ts -optional syncMode: SyncMode; -``` - -Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) - -The mode of sync to use for the collection. - -#### Default - -`eager` - -#### Description - -- `eager`: syncs all data immediately on preload -- `on-demand`: syncs data in incremental snapshots when the collection is queried -The exact implementation of the sync mode is up to the sync implementation. - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) - -*** - -### utils? - -```ts -optional utils: TUtils; -``` - -Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`utils`](../BaseCollectionConfig.md#utils) diff --git a/docs/reference/interfaces/Context.md b/docs/reference/interfaces/Context.md deleted file mode 100644 index 246dca186..000000000 --- a/docs/reference/interfaces/Context.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -id: Context -title: Context ---- - -# Interface: Context - -Defined in: [packages/db/src/query/builder/types.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L35) - -Context - The central state container for query builder operations - -This interface tracks all the information needed to build and type-check queries: - -**Schema Management**: -- `baseSchema`: The original tables/collections from the `from()` clause -- `schema`: Current available tables (expands with joins, contracts with subqueries) - -**Query State**: -- `fromSourceName`: Which table was used in `from()` - needed for optionality logic -- `hasJoins`: Whether any joins have been added (affects result type inference) -- `joinTypes`: Maps table aliases to their join types for optionality calculations - -**Result Tracking**: -- `result`: The final shape after `select()` - undefined until select is called - -The context evolves through the query builder chain: -1. `from()` sets baseSchema and schema to the same thing -2. `join()` expands schema and sets hasJoins/joinTypes -3. `select()` sets result to the projected shape - -## Properties - -### baseSchema - -```ts -baseSchema: ContextSchema; -``` - -Defined in: [packages/db/src/query/builder/types.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L37) - -*** - -### fromSourceName - -```ts -fromSourceName: string; -``` - -Defined in: [packages/db/src/query/builder/types.ts:41](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L41) - -*** - -### hasJoins? - -```ts -optional hasJoins: boolean; -``` - -Defined in: [packages/db/src/query/builder/types.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L43) - -*** - -### joinTypes? - -```ts -optional joinTypes: Record; -``` - -Defined in: [packages/db/src/query/builder/types.ts:45](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L45) - -*** - -### result? - -```ts -optional result: any; -``` - -Defined in: [packages/db/src/query/builder/types.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L50) - -*** - -### schema - -```ts -schema: ContextSchema; -``` - -Defined in: [packages/db/src/query/builder/types.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L39) - -*** - -### singleResult? - -```ts -optional singleResult: boolean; -``` - -Defined in: [packages/db/src/query/builder/types.ts:52](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L52) diff --git a/docs/reference/interfaces/CreateOptimisticActionsOptions.md b/docs/reference/interfaces/CreateOptimisticActionsOptions.md deleted file mode 100644 index 48ae64848..000000000 --- a/docs/reference/interfaces/CreateOptimisticActionsOptions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -id: CreateOptimisticActionsOptions -title: CreateOptimisticActionsOptions ---- - -# Interface: CreateOptimisticActionsOptions\ - -Defined in: [packages/db/src/types.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L128) - -Options for the createOptimisticAction helper - -## Extends - -- `Omit`\<[`TransactionConfig`](../TransactionConfig.md)\<`T`\>, `"mutationFn"`\> - -## Type Parameters - -### TVars - -`TVars` = `unknown` - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### autoCommit? - -```ts -optional autoCommit: boolean; -``` - -Defined in: [packages/db/src/types.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L119) - -#### Inherited from - -[`TransactionConfig`](../TransactionConfig.md).[`autoCommit`](../TransactionConfig.md#autocommit) - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:117](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L117) - -Unique identifier for the transaction - -#### Inherited from - -```ts -Omit.id -``` - -*** - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L122) - -Custom metadata to associate with the transaction - -#### Inherited from - -```ts -Omit.metadata -``` - -*** - -### mutationFn() - -```ts -mutationFn: (vars, params) => Promise; -``` - -Defined in: [packages/db/src/types.ts:135](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L135) - -Function to execute the mutation on the server - -#### Parameters - -##### vars - -`TVars` - -##### params - -[`MutationFnParams`](../../type-aliases/MutationFnParams.md)\<`T`\> - -#### Returns - -`Promise`\<`any`\> - -*** - -### onMutate() - -```ts -onMutate: (vars) => void; -``` - -Defined in: [packages/db/src/types.ts:133](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L133) - -Function to apply optimistic updates locally before the mutation completes - -#### Parameters - -##### vars - -`TVars` - -#### Returns - -`void` diff --git a/docs/reference/interfaces/CurrentStateAsChangesOptions.md b/docs/reference/interfaces/CurrentStateAsChangesOptions.md deleted file mode 100644 index d54d5107b..000000000 --- a/docs/reference/interfaces/CurrentStateAsChangesOptions.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -id: CurrentStateAsChangesOptions -title: CurrentStateAsChangesOptions ---- - -# Interface: CurrentStateAsChangesOptions - -Defined in: [packages/db/src/types.ts:678](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L678) - -Options for getting current state as changes - -## Properties - -### limit? - -```ts -optional limit: number; -``` - -Defined in: [packages/db/src/types.ts:682](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L682) - -*** - -### optimizedOnly? - -```ts -optional optimizedOnly: boolean; -``` - -Defined in: [packages/db/src/types.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L683) - -*** - -### orderBy? - -```ts -optional orderBy: OrderBy; -``` - -Defined in: [packages/db/src/types.ts:681](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L681) - -*** - -### where? - -```ts -optional where: BasicExpression; -``` - -Defined in: [packages/db/src/types.ts:680](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L680) - -Pre-compiled expression for filtering the current state diff --git a/docs/reference/interfaces/DebounceStrategy.md b/docs/reference/interfaces/DebounceStrategy.md deleted file mode 100644 index f0418edc7..000000000 --- a/docs/reference/interfaces/DebounceStrategy.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -id: DebounceStrategy -title: DebounceStrategy ---- - -# Interface: DebounceStrategy - -Defined in: [packages/db/src/strategies/types.ts:42](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L42) - -Debounce strategy that delays execution until activity stops - -## Extends - -- [`BaseStrategy`](../BaseStrategy.md)\<`"debounce"`\> - -## Properties - -### \_type - -```ts -_type: "debounce"; -``` - -Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) - -Type discriminator for strategy identification - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) - -*** - -### cleanup() - -```ts -cleanup: () => void; -``` - -Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) - -Clean up any resources held by the strategy -Should be called when the strategy is no longer needed - -#### Returns - -`void` - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) - -*** - -### execute() - -```ts -execute: (fn) => void | Promise; -``` - -Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) - -Execute a function according to the strategy's timing rules - -#### Type Parameters - -##### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -#### Parameters - -##### fn - -() => [`Transaction`](../Transaction.md)\<`T`\> - -The function to execute - -#### Returns - -`void` \| `Promise`\<`void`\> - -The result of the function execution (if applicable) - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) - -*** - -### options - -```ts -options: DebounceStrategyOptions; -``` - -Defined in: [packages/db/src/strategies/types.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L43) diff --git a/docs/reference/interfaces/DebounceStrategyOptions.md b/docs/reference/interfaces/DebounceStrategyOptions.md deleted file mode 100644 index 99e5fe458..000000000 --- a/docs/reference/interfaces/DebounceStrategyOptions.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -id: DebounceStrategyOptions -title: DebounceStrategyOptions ---- - -# Interface: DebounceStrategyOptions - -Defined in: [packages/db/src/strategies/types.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L30) - -Options for debounce strategy -Delays execution until after a period of inactivity - -## Properties - -### leading? - -```ts -optional leading: boolean; -``` - -Defined in: [packages/db/src/strategies/types.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L34) - -Execute immediately on the first call - -*** - -### trailing? - -```ts -optional trailing: boolean; -``` - -Defined in: [packages/db/src/strategies/types.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L36) - -Execute after the wait period on the last call - -*** - -### wait - -```ts -wait: number; -``` - -Defined in: [packages/db/src/strategies/types.ts:32](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L32) - -Wait time in milliseconds before execution diff --git a/docs/reference/interfaces/IndexInterface.md b/docs/reference/interfaces/IndexInterface.md deleted file mode 100644 index ebb33b416..000000000 --- a/docs/reference/interfaces/IndexInterface.md +++ /dev/null @@ -1,458 +0,0 @@ ---- -id: IndexInterface -title: IndexInterface ---- - -# Interface: IndexInterface\ - -Defined in: [packages/db/src/indexes/base-index.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L28) - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Properties - -### add() - -```ts -add: (key, item) => void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:31](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L31) - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -*** - -### build() - -```ts -build: (entries) => void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L35) - -#### Parameters - -##### entries - -`Iterable`\<\[`TKey`, `any`\]\> - -#### Returns - -`void` - -*** - -### clear() - -```ts -clear: () => void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L36) - -#### Returns - -`void` - -*** - -### equalityLookup() - -```ts -equalityLookup: (value) => Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L40) - -#### Parameters - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -*** - -### getStats() - -```ts -getStats: () => IndexStats; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L70) - -#### Returns - -[`IndexStats`](../IndexStats.md) - -*** - -### inArrayLookup() - -```ts -inArrayLookup: (values) => Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:41](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L41) - -#### Parameters - -##### values - -`any`[] - -#### Returns - -`Set`\<`TKey`\> - -*** - -### lookup() - -```ts -lookup: (operation, value) => Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:38](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L38) - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -##### value - -`any` - -#### Returns - -`Set`\<`TKey`\> - -*** - -### matchesCompareOptions() - -```ts -matchesCompareOptions: (compareOptions) => boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L67) - -#### Parameters - -##### compareOptions - -`CompareOptions` - -#### Returns - -`boolean` - -*** - -### matchesDirection() - -```ts -matchesDirection: (direction) => boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:68](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L68) - -#### Parameters - -##### direction - -[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) - -#### Returns - -`boolean` - -*** - -### matchesField() - -```ts -matchesField: (fieldPath) => boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L66) - -#### Parameters - -##### fieldPath - -`string`[] - -#### Returns - -`boolean` - -*** - -### rangeQuery() - -```ts -rangeQuery: (options) => Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L43) - -#### Parameters - -##### options - -[`RangeQueryOptions`](../RangeQueryOptions.md) - -#### Returns - -`Set`\<`TKey`\> - -*** - -### rangeQueryReversed() - -```ts -rangeQueryReversed: (options) => Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:44](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L44) - -#### Parameters - -##### options - -[`RangeQueryOptions`](../RangeQueryOptions.md) - -#### Returns - -`Set`\<`TKey`\> - -*** - -### remove() - -```ts -remove: (key, item) => void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:32](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L32) - -#### Parameters - -##### key - -`TKey` - -##### item - -`any` - -#### Returns - -`void` - -*** - -### supports() - -```ts -supports: (operation) => boolean; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:64](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L64) - -#### Parameters - -##### operation - -`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` - -#### Returns - -`boolean` - -*** - -### take() - -```ts -take: (n, from?, filterFn?) => TKey[]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L46) - -#### Parameters - -##### n - -`number` - -##### from? - -`TKey` - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -*** - -### takeReversed() - -```ts -takeReversed: (n, from?, filterFn?) => TKey[]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:51](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L51) - -#### Parameters - -##### n - -`number` - -##### from? - -`TKey` - -##### filterFn? - -(`key`) => `boolean` - -#### Returns - -`TKey`[] - -*** - -### update() - -```ts -update: (key, oldItem, newItem) => void; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L33) - -#### Parameters - -##### key - -`TKey` - -##### oldItem - -`any` - -##### newItem - -`any` - -#### Returns - -`void` - -## Accessors - -### indexedKeysSet - -#### Get Signature - -```ts -get indexedKeysSet(): Set; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:61](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L61) - -##### Returns - -`Set`\<`TKey`\> - -*** - -### keyCount - -#### Get Signature - -```ts -get keyCount(): number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L57) - -##### Returns - -`number` - -*** - -### orderedEntriesArray - -#### Get Signature - -```ts -get orderedEntriesArray(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L58) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -*** - -### orderedEntriesArrayReversed - -#### Get Signature - -```ts -get orderedEntriesArrayReversed(): [any, Set][]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:59](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L59) - -##### Returns - -\[`any`, `Set`\<`TKey`\>\][] - -*** - -### valueMapData - -#### Get Signature - -```ts -get valueMapData(): Map>; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L62) - -##### Returns - -`Map`\<`any`, `Set`\<`TKey`\>\> diff --git a/docs/reference/interfaces/IndexOptions.md b/docs/reference/interfaces/IndexOptions.md deleted file mode 100644 index 8a99a578a..000000000 --- a/docs/reference/interfaces/IndexOptions.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: IndexOptions -title: IndexOptions ---- - -# Interface: IndexOptions\ - -Defined in: [packages/db/src/indexes/index-options.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L6) - -Enhanced index options that support both sync and async resolvers - -## Type Parameters - -### TResolver - -`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md) = [`IndexResolver`](../../type-aliases/IndexResolver.md) - -## Properties - -### indexType? - -```ts -optional indexType: TResolver; -``` - -Defined in: [packages/db/src/indexes/index-options.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L8) - -*** - -### name? - -```ts -optional name: string; -``` - -Defined in: [packages/db/src/indexes/index-options.ts:7](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L7) - -*** - -### options? - -```ts -optional options: TResolver extends IndexConstructor ? TResolver extends (id, expr, name?, options?) => any ? O : never : TResolver extends () => Promise ? TCtor extends (id, expr, name?, options?) => any ? O : never : never; -``` - -Defined in: [packages/db/src/indexes/index-options.ts:9](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L9) diff --git a/docs/reference/interfaces/IndexStats.md b/docs/reference/interfaces/IndexStats.md deleted file mode 100644 index ff3db9e4b..000000000 --- a/docs/reference/interfaces/IndexStats.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: IndexStats -title: IndexStats ---- - -# Interface: IndexStats - -Defined in: [packages/db/src/indexes/base-index.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L21) - -Statistics about index usage and performance - -## Properties - -### averageLookupTime - -```ts -readonly averageLookupTime: number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L24) - -*** - -### entryCount - -```ts -readonly entryCount: number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L22) - -*** - -### lastUpdated - -```ts -readonly lastUpdated: Date; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L25) - -*** - -### lookupCount - -```ts -readonly lookupCount: number; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L23) diff --git a/docs/reference/interfaces/InsertConfig.md b/docs/reference/interfaces/InsertConfig.md deleted file mode 100644 index 79b7fbda3..000000000 --- a/docs/reference/interfaces/InsertConfig.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: InsertConfig -title: InsertConfig ---- - -# Interface: InsertConfig - -Defined in: [packages/db/src/types.ts:303](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L303) - -## Properties - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:304](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L304) - -*** - -### optimistic? - -```ts -optional optimistic: boolean; -``` - -Defined in: [packages/db/src/types.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L306) - -Whether to apply optimistic updates immediately. Defaults to true. diff --git a/docs/reference/interfaces/LiveQueryCollectionConfig.md b/docs/reference/interfaces/LiveQueryCollectionConfig.md deleted file mode 100644 index ce7da1c8e..000000000 --- a/docs/reference/interfaces/LiveQueryCollectionConfig.md +++ /dev/null @@ -1,172 +0,0 @@ ---- -id: LiveQueryCollectionConfig -title: LiveQueryCollectionConfig ---- - -# Interface: LiveQueryCollectionConfig\ - -Defined in: [packages/db/src/query/live/types.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L49) - -Configuration interface for live query collection options - -## Example - -```typescript -const config: LiveQueryCollectionConfig = { - // id is optional - will auto-generate "live-query-1", "live-query-2", etc. - query: (q) => q - .from({ comment: commentsCollection }) - .join( - { user: usersCollection }, - ({ comment, user }) => eq(comment.user_id, user.id) - ) - .where(({ comment }) => eq(comment.active, true)) - .select(({ comment, user }) => ({ - id: comment.id, - content: comment.content, - authorName: user.name, - })), - // getKey is optional - defaults to using stream key - getKey: (item) => item.id, -} -``` - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../Context.md) - -### TResult - -`TResult` *extends* `object` = [`GetResult`](../../type-aliases/GetResult.md)\<`TContext`\> & `object` - -## Properties - -### gcTime? - -```ts -optional gcTime: number; -``` - -Defined in: [packages/db/src/query/live/types.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L92) - -GC time for the collection - -*** - -### getKey()? - -```ts -optional getKey: (item) => string | number; -``` - -Defined in: [packages/db/src/query/live/types.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L70) - -Function to extract the key from result items -If not provided, defaults to using the key from the D2 stream - -#### Parameters - -##### item - -`TResult` - -#### Returns - -`string` \| `number` - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/query/live/types.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L57) - -Unique identifier for the collection -If not provided, defaults to `live-query-${number}` with auto-incrementing number - -*** - -### onDelete? - -```ts -optional onDelete: DeleteMutationFn; -``` - -Defined in: [packages/db/src/query/live/types.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L82) - -*** - -### onInsert? - -```ts -optional onInsert: InsertMutationFn; -``` - -Defined in: [packages/db/src/query/live/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L80) - -Optional mutation handlers - -*** - -### onUpdate? - -```ts -optional onUpdate: UpdateMutationFn; -``` - -Defined in: [packages/db/src/query/live/types.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L81) - -*** - -### query - -```ts -query: - | QueryBuilder -| (q) => QueryBuilder; -``` - -Defined in: [packages/db/src/query/live/types.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L62) - -Query builder function that defines the live query - -*** - -### schema? - -```ts -optional schema: undefined; -``` - -Defined in: [packages/db/src/query/live/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L75) - -Optional schema for validation - -*** - -### singleResult? - -```ts -optional singleResult: true; -``` - -Defined in: [packages/db/src/query/live/types.ts:97](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L97) - -If enabled the collection will return a single object instead of an array - -*** - -### startSync? - -```ts -optional startSync: boolean; -``` - -Defined in: [packages/db/src/query/live/types.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L87) - -Start sync / the query immediately diff --git a/docs/reference/interfaces/LocalOnlyCollectionConfig.md b/docs/reference/interfaces/LocalOnlyCollectionConfig.md deleted file mode 100644 index d34d42f52..000000000 --- a/docs/reference/interfaces/LocalOnlyCollectionConfig.md +++ /dev/null @@ -1,442 +0,0 @@ ---- -id: LocalOnlyCollectionConfig -title: LocalOnlyCollectionConfig ---- - -# Interface: LocalOnlyCollectionConfig\ - -Defined in: [packages/db/src/local-only.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L22) - -Configuration interface for Local-only collection options - -## Extends - -- `Omit`\<[`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`, [`LocalOnlyCollectionUtils`](../LocalOnlyCollectionUtils.md)\>, `"gcTime"` \| `"startSync"`\> - -## Type Parameters - -### T - -`T` *extends* `object` = `object` - -The type of items in the collection - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` - -The schema type for validation - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key returned by `getKey` - -## Properties - -### autoIndex? - -```ts -optional autoIndex: "eager" | "off"; -``` - -Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) - -Auto-indexing mode for the collection. -When enabled, indexes will be automatically created for simple where expressions. - -#### Default - -```ts -"eager" -``` - -#### Description - -- "off": No automatic indexing -- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) - -*** - -### compare()? - -```ts -optional compare: (x, y) => number; -``` - -Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) - -Optional function to compare two items. -This is used to order the items in the collection. - -#### Parameters - -##### x - -`T` - -The first item to compare - -##### y - -`T` - -The second item to compare - -#### Returns - -`number` - -A number indicating the order of the items - -#### Example - -```ts -// For a collection with a 'createdAt' field -compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() -``` - -#### Inherited from - -```ts -Omit.compare -``` - -*** - -### getKey() - -```ts -getKey: (item) => TKey; -``` - -Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) - -Function to extract the ID from an object -This is required for update/delete operations which now only accept IDs - -#### Parameters - -##### item - -`T` - -The item to extract the ID from - -#### Returns - -`TKey` - -The ID string for the item - -#### Example - -```ts -// For a collection with a 'uuid' field as the primary key -getKey: (item) => item.uuid -``` - -#### Inherited from - -```ts -Omit.getKey -``` - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) - -*** - -### initialData? - -```ts -optional initialData: T[]; -``` - -Defined in: [packages/db/src/local-only.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L34) - -Optional initial data to populate the collection with on creation -This data will be applied during the initial sync process - -*** - -### onDelete? - -```ts -optional onDelete: DeleteMutationFn; -``` - -Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) - -Optional asynchronous handler function called before a delete operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic delete handler -onDelete: async ({ transaction, collection }) => { - const deletedKey = transaction.mutations[0].key - await api.deleteTodo(deletedKey) -} -``` - -```ts -// Delete handler with multiple items -onDelete: async ({ transaction, collection }) => { - const keysToDelete = transaction.mutations.map(m => m.key) - await api.deleteTodos(keysToDelete) -} -``` - -```ts -// Delete handler with confirmation -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const shouldDelete = await confirmDeletion(mutation.original) - if (!shouldDelete) { - throw new Error('Delete cancelled by user') - } - await api.deleteTodo(mutation.original.id) -} -``` - -```ts -// Delete handler with optimistic rollback -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.deleteTodo(mutation.original.id) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Delete failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -```ts -Omit.onDelete -``` - -*** - -### onInsert? - -```ts -optional onInsert: InsertMutationFn; -``` - -Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) - -Optional asynchronous handler function called before an insert operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic insert handler -onInsert: async ({ transaction, collection }) => { - const newItem = transaction.mutations[0].modified - await api.createTodo(newItem) -} -``` - -```ts -// Insert handler with multiple items -onInsert: async ({ transaction, collection }) => { - const items = transaction.mutations.map(m => m.modified) - await api.createTodos(items) -} -``` - -```ts -// Insert handler with error handling -onInsert: async ({ transaction, collection }) => { - try { - const newItem = transaction.mutations[0].modified - const result = await api.createTodo(newItem) - return result - } catch (error) { - console.error('Insert failed:', error) - throw error // This will cause the transaction to fail - } -} -``` - -```ts -// Insert handler with metadata -onInsert: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - await api.createTodo(mutation.modified, { - source: mutation.metadata?.source, - timestamp: mutation.createdAt - }) -} -``` - -#### Inherited from - -```ts -Omit.onInsert -``` - -*** - -### onUpdate? - -```ts -optional onUpdate: UpdateMutationFn; -``` - -Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) - -Optional asynchronous handler function called before an update operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic update handler -onUpdate: async ({ transaction, collection }) => { - const updatedItem = transaction.mutations[0].modified - await api.updateTodo(updatedItem.id, updatedItem) -} -``` - -```ts -// Update handler with partial updates -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const changes = mutation.changes // Only the changed fields - await api.updateTodo(mutation.original.id, changes) -} -``` - -```ts -// Update handler with multiple items -onUpdate: async ({ transaction, collection }) => { - const updates = transaction.mutations.map(m => ({ - id: m.key, - changes: m.changes - })) - await api.updateTodos(updates) -} -``` - -```ts -// Update handler with optimistic rollback -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.updateTodo(mutation.original.id, mutation.changes) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Update failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -```ts -Omit.onUpdate -``` - -*** - -### schema? - -```ts -optional schema: TSchema; -``` - -Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) - -#### Inherited from - -```ts -Omit.schema -``` - -*** - -### syncMode? - -```ts -optional syncMode: SyncMode; -``` - -Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) - -The mode of sync to use for the collection. - -#### Default - -`eager` - -#### Description - -- `eager`: syncs all data immediately on preload -- `on-demand`: syncs data in incremental snapshots when the collection is queried -The exact implementation of the sync mode is up to the sync implementation. - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) - -*** - -### utils? - -```ts -optional utils: LocalOnlyCollectionUtils; -``` - -Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) - -#### Inherited from - -```ts -Omit.utils -``` diff --git a/docs/reference/interfaces/LocalOnlyCollectionUtils.md b/docs/reference/interfaces/LocalOnlyCollectionUtils.md deleted file mode 100644 index 75d0a06ff..000000000 --- a/docs/reference/interfaces/LocalOnlyCollectionUtils.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: LocalOnlyCollectionUtils -title: LocalOnlyCollectionUtils ---- - -# Interface: LocalOnlyCollectionUtils - -Defined in: [packages/db/src/local-only.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L40) - -Local-only collection utilities type - -## Extends - -- [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -## Indexable - -```ts -[key: string]: Fn -``` - -## Properties - -### acceptMutations() - -```ts -acceptMutations: (transaction) => void; -``` - -Defined in: [packages/db/src/local-only.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L58) - -Accepts mutations from a transaction that belong to this collection and persists them. -This should be called in your transaction's mutationFn to persist local-only data. - -#### Parameters - -##### transaction - -The transaction containing mutations to accept - -###### mutations - -[`PendingMutation`](../PendingMutation.md)\<`Record`\<`string`, `unknown`\>, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`Record`\<`string`, `unknown`\>, `any`, `any`, `any`, `any`\>\>[] - -#### Returns - -`void` - -#### Example - -```ts -const localData = createCollection(localOnlyCollectionOptions({...})) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Make API call first - await api.save(...) - // Then persist local-only mutations after success - localData.utils.acceptMutations(transaction) - } -}) -``` diff --git a/docs/reference/interfaces/LocalStorageCollectionConfig.md b/docs/reference/interfaces/LocalStorageCollectionConfig.md deleted file mode 100644 index 52909c7f4..000000000 --- a/docs/reference/interfaces/LocalStorageCollectionConfig.md +++ /dev/null @@ -1,510 +0,0 @@ ---- -id: LocalStorageCollectionConfig -title: LocalStorageCollectionConfig ---- - -# Interface: LocalStorageCollectionConfig\ - -Defined in: [packages/db/src/local-storage.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L58) - -Configuration interface for localStorage collection options - -## Extends - -- [`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`\> - -## Type Parameters - -### T - -`T` *extends* `object` = `object` - -The type of items in the collection - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` - -The schema type for validation - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -The type of the key returned by `getKey` - -## Properties - -### autoIndex? - -```ts -optional autoIndex: "eager" | "off"; -``` - -Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) - -Auto-indexing mode for the collection. -When enabled, indexes will be automatically created for simple where expressions. - -#### Default - -```ts -"eager" -``` - -#### Description - -- "off": No automatic indexing -- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) - -*** - -### compare()? - -```ts -optional compare: (x, y) => number; -``` - -Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) - -Optional function to compare two items. -This is used to order the items in the collection. - -#### Parameters - -##### x - -`T` - -The first item to compare - -##### y - -`T` - -The second item to compare - -#### Returns - -`number` - -A number indicating the order of the items - -#### Example - -```ts -// For a collection with a 'createdAt' field -compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`compare`](../BaseCollectionConfig.md#compare) - -*** - -### gcTime? - -```ts -optional gcTime: number; -``` - -Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) - -Time in milliseconds after which the collection will be garbage collected -when it has no active subscribers. Defaults to 5 minutes (300000ms). - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`gcTime`](../BaseCollectionConfig.md#gctime) - -*** - -### getKey() - -```ts -getKey: (item) => TKey; -``` - -Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) - -Function to extract the ID from an object -This is required for update/delete operations which now only accept IDs - -#### Parameters - -##### item - -`T` - -The item to extract the ID from - -#### Returns - -`TKey` - -The ID string for the item - -#### Example - -```ts -// For a collection with a 'uuid' field as the primary key -getKey: (item) => item.uuid -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`getKey`](../BaseCollectionConfig.md#getkey) - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) - -*** - -### onDelete? - -```ts -optional onDelete: DeleteMutationFn; -``` - -Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) - -Optional asynchronous handler function called before a delete operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic delete handler -onDelete: async ({ transaction, collection }) => { - const deletedKey = transaction.mutations[0].key - await api.deleteTodo(deletedKey) -} -``` - -```ts -// Delete handler with multiple items -onDelete: async ({ transaction, collection }) => { - const keysToDelete = transaction.mutations.map(m => m.key) - await api.deleteTodos(keysToDelete) -} -``` - -```ts -// Delete handler with confirmation -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const shouldDelete = await confirmDeletion(mutation.original) - if (!shouldDelete) { - throw new Error('Delete cancelled by user') - } - await api.deleteTodo(mutation.original.id) -} -``` - -```ts -// Delete handler with optimistic rollback -onDelete: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.deleteTodo(mutation.original.id) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Delete failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onDelete`](../BaseCollectionConfig.md#ondelete) - -*** - -### onInsert? - -```ts -optional onInsert: InsertMutationFn; -``` - -Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) - -Optional asynchronous handler function called before an insert operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic insert handler -onInsert: async ({ transaction, collection }) => { - const newItem = transaction.mutations[0].modified - await api.createTodo(newItem) -} -``` - -```ts -// Insert handler with multiple items -onInsert: async ({ transaction, collection }) => { - const items = transaction.mutations.map(m => m.modified) - await api.createTodos(items) -} -``` - -```ts -// Insert handler with error handling -onInsert: async ({ transaction, collection }) => { - try { - const newItem = transaction.mutations[0].modified - const result = await api.createTodo(newItem) - return result - } catch (error) { - console.error('Insert failed:', error) - throw error // This will cause the transaction to fail - } -} -``` - -```ts -// Insert handler with metadata -onInsert: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - await api.createTodo(mutation.modified, { - source: mutation.metadata?.source, - timestamp: mutation.createdAt - }) -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onInsert`](../BaseCollectionConfig.md#oninsert) - -*** - -### onUpdate? - -```ts -optional onUpdate: UpdateMutationFn; -``` - -Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) - -Optional asynchronous handler function called before an update operation - -#### Param - -Object containing transaction and collection information - -#### Returns - -Promise resolving to any value - -#### Examples - -```ts -// Basic update handler -onUpdate: async ({ transaction, collection }) => { - const updatedItem = transaction.mutations[0].modified - await api.updateTodo(updatedItem.id, updatedItem) -} -``` - -```ts -// Update handler with partial updates -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - const changes = mutation.changes // Only the changed fields - await api.updateTodo(mutation.original.id, changes) -} -``` - -```ts -// Update handler with multiple items -onUpdate: async ({ transaction, collection }) => { - const updates = transaction.mutations.map(m => ({ - id: m.key, - changes: m.changes - })) - await api.updateTodos(updates) -} -``` - -```ts -// Update handler with optimistic rollback -onUpdate: async ({ transaction, collection }) => { - const mutation = transaction.mutations[0] - try { - await api.updateTodo(mutation.original.id, mutation.changes) - } catch (error) { - // Transaction will automatically rollback optimistic changes - console.error('Update failed, rolling back:', error) - throw error - } -} -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onUpdate`](../BaseCollectionConfig.md#onupdate) - -*** - -### parser? - -```ts -optional parser: Parser; -``` - -Defined in: [packages/db/src/local-storage.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L84) - -Parser to use for serializing and deserializing data to and from storage -Defaults to JSON - -*** - -### schema? - -```ts -optional schema: TSchema; -``` - -Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`schema`](../BaseCollectionConfig.md#schema) - -*** - -### startSync? - -```ts -optional startSync: boolean; -``` - -Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) - -Whether to eagerly start syncing on collection creation. -When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. - -Note: Even with startSync=true, collections will pause syncing when there are no active -subscribers (typically when components querying the collection unmount), resuming when new -subscribers attach. This preserves normal staleTime/gcTime behavior. - -#### Default - -```ts -false -``` - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`startSync`](../BaseCollectionConfig.md#startsync) - -*** - -### storage? - -```ts -optional storage: StorageApi; -``` - -Defined in: [packages/db/src/local-storage.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L72) - -Storage API to use (defaults to window.localStorage) -Can be any object that implements the Storage interface (e.g., sessionStorage) - -*** - -### storageEventApi? - -```ts -optional storageEventApi: StorageEventApi; -``` - -Defined in: [packages/db/src/local-storage.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L78) - -Storage event API to use for cross-tab synchronization (defaults to window) -Can be any object that implements addEventListener/removeEventListener for storage events - -*** - -### storageKey - -```ts -storageKey: string; -``` - -Defined in: [packages/db/src/local-storage.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L66) - -The key to use for storing the collection data in localStorage/sessionStorage - -*** - -### syncMode? - -```ts -optional syncMode: SyncMode; -``` - -Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) - -The mode of sync to use for the collection. - -#### Default - -`eager` - -#### Description - -- `eager`: syncs all data immediately on preload -- `on-demand`: syncs data in incremental snapshots when the collection is queried -The exact implementation of the sync mode is up to the sync implementation. - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) - -*** - -### utils? - -```ts -optional utils: UtilsRecord; -``` - -Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) - -#### Inherited from - -[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`utils`](../BaseCollectionConfig.md#utils) diff --git a/docs/reference/interfaces/LocalStorageCollectionUtils.md b/docs/reference/interfaces/LocalStorageCollectionUtils.md deleted file mode 100644 index 57671cfbb..000000000 --- a/docs/reference/interfaces/LocalStorageCollectionUtils.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -id: LocalStorageCollectionUtils -title: LocalStorageCollectionUtils ---- - -# Interface: LocalStorageCollectionUtils - -Defined in: [packages/db/src/local-storage.ts:100](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L100) - -LocalStorage collection utilities type - -## Extends - -- [`UtilsRecord`](../../type-aliases/UtilsRecord.md) - -## Indexable - -```ts -[key: string]: Fn -``` - -## Properties - -### acceptMutations() - -```ts -acceptMutations: (transaction) => void; -``` - -Defined in: [packages/db/src/local-storage.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L120) - -Accepts mutations from a transaction that belong to this collection and persists them to localStorage. -This should be called in your transaction's mutationFn to persist local-storage data. - -#### Parameters - -##### transaction - -The transaction containing mutations to accept - -###### mutations - -[`PendingMutation`](../PendingMutation.md)\<`Record`\<`string`, `unknown`\>, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`Record`\<`string`, `unknown`\>, `any`, `any`, `any`, `any`\>\>[] - -#### Returns - -`void` - -#### Example - -```ts -const localSettings = createCollection(localStorageCollectionOptions({...})) - -const tx = createTransaction({ - mutationFn: async ({ transaction }) => { - // Make API call first - await api.save(...) - // Then persist local-storage mutations after success - localSettings.utils.acceptMutations(transaction) - } -}) -``` - -*** - -### clearStorage - -```ts -clearStorage: ClearStorageFn; -``` - -Defined in: [packages/db/src/local-storage.ts:101](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L101) - -*** - -### getStorageSize - -```ts -getStorageSize: GetStorageSizeFn; -``` - -Defined in: [packages/db/src/local-storage.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L102) diff --git a/docs/reference/interfaces/OperationConfig.md b/docs/reference/interfaces/OperationConfig.md deleted file mode 100644 index e5c2774da..000000000 --- a/docs/reference/interfaces/OperationConfig.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: OperationConfig -title: OperationConfig ---- - -# Interface: OperationConfig - -Defined in: [packages/db/src/types.ts:297](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L297) - -## Properties - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:298](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L298) - -*** - -### optimistic? - -```ts -optional optimistic: boolean; -``` - -Defined in: [packages/db/src/types.ts:300](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L300) - -Whether to apply optimistic updates immediately. Defaults to true. diff --git a/docs/reference/interfaces/OptimisticChangeMessage.md b/docs/reference/interfaces/OptimisticChangeMessage.md deleted file mode 100644 index f0a365281..000000000 --- a/docs/reference/interfaces/OptimisticChangeMessage.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: OptimisticChangeMessage -title: OptimisticChangeMessage ---- - -# Interface: OptimisticChangeMessage\ - -Defined in: [packages/db/src/types.ts:272](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L272) - -## Extends - -- [`ChangeMessage`](../ChangeMessage.md)\<`T`\> - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### isActive? - -```ts -optional isActive: boolean; -``` - -Defined in: [packages/db/src/types.ts:276](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L276) - -*** - -### key - -```ts -key: string | number; -``` - -Defined in: [packages/db/src/types.ts:265](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L265) - -#### Inherited from - -[`ChangeMessage`](../ChangeMessage.md).[`key`](../ChangeMessage.md#key) - -*** - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:269](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L269) - -#### Inherited from - -[`ChangeMessage`](../ChangeMessage.md).[`metadata`](../ChangeMessage.md#metadata) - -*** - -### previousValue? - -```ts -optional previousValue: T; -``` - -Defined in: [packages/db/src/types.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L267) - -#### Inherited from - -[`ChangeMessage`](../ChangeMessage.md).[`previousValue`](../ChangeMessage.md#previousvalue) - -*** - -### type - -```ts -type: OperationType; -``` - -Defined in: [packages/db/src/types.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L268) - -#### Inherited from - -[`ChangeMessage`](../ChangeMessage.md).[`type`](../ChangeMessage.md#type) - -*** - -### value - -```ts -value: T; -``` - -Defined in: [packages/db/src/types.ts:266](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L266) - -#### Inherited from - -[`ChangeMessage`](../ChangeMessage.md).[`value`](../ChangeMessage.md#value) diff --git a/docs/reference/interfaces/PacedMutationsConfig.md b/docs/reference/interfaces/PacedMutationsConfig.md deleted file mode 100644 index ead589087..000000000 --- a/docs/reference/interfaces/PacedMutationsConfig.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -id: PacedMutationsConfig -title: PacedMutationsConfig ---- - -# Interface: PacedMutationsConfig\ - -Defined in: [packages/db/src/paced-mutations.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L8) - -Configuration for creating a paced mutations manager - -## Type Parameters - -### TVariables - -`TVariables` = `unknown` - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/paced-mutations.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L30) - -Custom metadata to associate with transactions - -*** - -### mutationFn - -```ts -mutationFn: MutationFn; -``` - -Defined in: [packages/db/src/paced-mutations.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L21) - -Function to execute the mutation on the server. -Receives the transaction parameters containing all merged mutations. - -*** - -### onMutate() - -```ts -onMutate: (variables) => void; -``` - -Defined in: [packages/db/src/paced-mutations.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L16) - -Callback to apply optimistic updates immediately. -Receives the variables passed to the mutate function. - -#### Parameters - -##### variables - -`TVariables` - -#### Returns - -`void` - -*** - -### strategy - -```ts -strategy: Strategy; -``` - -Defined in: [packages/db/src/paced-mutations.ts:26](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L26) - -Strategy for controlling mutation execution timing -Examples: debounceStrategy, queueStrategy, throttleStrategy diff --git a/docs/reference/interfaces/Parser.md b/docs/reference/interfaces/Parser.md deleted file mode 100644 index d1eafc24c..000000000 --- a/docs/reference/interfaces/Parser.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: Parser -title: Parser ---- - -# Interface: Parser - -Defined in: [packages/db/src/local-storage.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L47) - -## Properties - -### parse() - -```ts -parse: (data) => unknown; -``` - -Defined in: [packages/db/src/local-storage.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L48) - -#### Parameters - -##### data - -`string` - -#### Returns - -`unknown` - -*** - -### stringify() - -```ts -stringify: (data) => string; -``` - -Defined in: [packages/db/src/local-storage.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L49) - -#### Parameters - -##### data - -`unknown` - -#### Returns - -`string` diff --git a/docs/reference/interfaces/PendingMutation.md b/docs/reference/interfaces/PendingMutation.md deleted file mode 100644 index 909f848f6..000000000 --- a/docs/reference/interfaces/PendingMutation.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -id: PendingMutation -title: PendingMutation ---- - -# Interface: PendingMutation\ - -Defined in: [packages/db/src/types.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L57) - -Represents a pending mutation within a transaction -Contains information about the original and modified data, as well as metadata - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TOperation - -`TOperation` *extends* [`OperationType`](../../type-aliases/OperationType.md) = [`OperationType`](../../type-aliases/OperationType.md) - -### TCollection - -`TCollection` *extends* [`Collection`](../Collection.md)\<`T`, `any`, `any`, `any`, `any`\> = [`Collection`](../Collection.md)\<`T`, `any`, `any`, `any`, `any`\> - -## Properties - -### changes - -```ts -changes: ResolveTransactionChanges; -``` - -Defined in: [packages/db/src/types.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L74) - -*** - -### collection - -```ts -collection: TCollection; -``` - -Defined in: [packages/db/src/types.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L85) - -*** - -### createdAt - -```ts -createdAt: Date; -``` - -Defined in: [packages/db/src/types.ts:83](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L83) - -*** - -### globalKey - -```ts -globalKey: string; -``` - -Defined in: [packages/db/src/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L75) - -*** - -### key - -```ts -key: any; -``` - -Defined in: [packages/db/src/types.ts:77](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L77) - -*** - -### metadata - -```ts -metadata: unknown; -``` - -Defined in: [packages/db/src/types.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L79) - -*** - -### modified - -```ts -modified: T; -``` - -Defined in: [packages/db/src/types.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L72) - -*** - -### mutationId - -```ts -mutationId: string; -``` - -Defined in: [packages/db/src/types.ts:68](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L68) - -*** - -### optimistic - -```ts -optimistic: boolean; -``` - -Defined in: [packages/db/src/types.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L82) - -Whether this mutation should be applied optimistically (defaults to true) - -*** - -### original - -```ts -original: TOperation extends "insert" ? object : T; -``` - -Defined in: [packages/db/src/types.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L70) - -*** - -### syncMetadata - -```ts -syncMetadata: Record; -``` - -Defined in: [packages/db/src/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L80) - -*** - -### type - -```ts -type: TOperation; -``` - -Defined in: [packages/db/src/types.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L78) - -*** - -### updatedAt - -```ts -updatedAt: Date; -``` - -Defined in: [packages/db/src/types.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L84) diff --git a/docs/reference/interfaces/QueueStrategy.md b/docs/reference/interfaces/QueueStrategy.md deleted file mode 100644 index d22576848..000000000 --- a/docs/reference/interfaces/QueueStrategy.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -id: QueueStrategy -title: QueueStrategy ---- - -# Interface: QueueStrategy - -Defined in: [packages/db/src/strategies/types.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L66) - -Queue strategy that processes all executions in order -FIFO: { addItemsTo: 'back', getItemsFrom: 'front' } -LIFO: { addItemsTo: 'back', getItemsFrom: 'back' } - -## Extends - -- [`BaseStrategy`](../BaseStrategy.md)\<`"queue"`\> - -## Properties - -### \_type - -```ts -_type: "queue"; -``` - -Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) - -Type discriminator for strategy identification - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) - -*** - -### cleanup() - -```ts -cleanup: () => void; -``` - -Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) - -Clean up any resources held by the strategy -Should be called when the strategy is no longer needed - -#### Returns - -`void` - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) - -*** - -### execute() - -```ts -execute: (fn) => void | Promise; -``` - -Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) - -Execute a function according to the strategy's timing rules - -#### Type Parameters - -##### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -#### Parameters - -##### fn - -() => [`Transaction`](../Transaction.md)\<`T`\> - -The function to execute - -#### Returns - -`void` \| `Promise`\<`void`\> - -The result of the function execution (if applicable) - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) - -*** - -### options? - -```ts -optional options: QueueStrategyOptions; -``` - -Defined in: [packages/db/src/strategies/types.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L67) diff --git a/docs/reference/interfaces/QueueStrategyOptions.md b/docs/reference/interfaces/QueueStrategyOptions.md deleted file mode 100644 index cefdd24e5..000000000 --- a/docs/reference/interfaces/QueueStrategyOptions.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: QueueStrategyOptions -title: QueueStrategyOptions ---- - -# Interface: QueueStrategyOptions - -Defined in: [packages/db/src/strategies/types.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L50) - -Options for queue strategy -Processes all executions in order (FIFO/LIFO) - -## Properties - -### addItemsTo? - -```ts -optional addItemsTo: "front" | "back"; -``` - -Defined in: [packages/db/src/strategies/types.ts:56](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L56) - -Where to add new items in the queue - -*** - -### getItemsFrom? - -```ts -optional getItemsFrom: "front" | "back"; -``` - -Defined in: [packages/db/src/strategies/types.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L58) - -Where to get items from when processing - -*** - -### maxSize? - -```ts -optional maxSize: number; -``` - -Defined in: [packages/db/src/strategies/types.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L54) - -Maximum queue size (items are dropped if exceeded) - -*** - -### wait? - -```ts -optional wait: number; -``` - -Defined in: [packages/db/src/strategies/types.ts:52](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L52) - -Wait time between processing queue items (milliseconds) diff --git a/docs/reference/interfaces/RangeQueryOptions.md b/docs/reference/interfaces/RangeQueryOptions.md deleted file mode 100644 index cae26c2a6..000000000 --- a/docs/reference/interfaces/RangeQueryOptions.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: RangeQueryOptions -title: RangeQueryOptions ---- - -# Interface: RangeQueryOptions - -Defined in: [packages/db/src/indexes/btree-index.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L19) - -Options for range queries - -## Properties - -### from? - -```ts -optional from: any; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L20) - -*** - -### fromInclusive? - -```ts -optional fromInclusive: boolean; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L22) - -*** - -### to? - -```ts -optional to: any; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L21) - -*** - -### toInclusive? - -```ts -optional toInclusive: boolean; -``` - -Defined in: [packages/db/src/indexes/btree-index.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L23) diff --git a/docs/reference/interfaces/SubscribeChangesOptions.md b/docs/reference/interfaces/SubscribeChangesOptions.md deleted file mode 100644 index c453c9b5c..000000000 --- a/docs/reference/interfaces/SubscribeChangesOptions.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: SubscribeChangesOptions -title: SubscribeChangesOptions ---- - -# Interface: SubscribeChangesOptions - -Defined in: [packages/db/src/types.ts:662](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L662) - -Options for subscribing to collection changes - -## Properties - -### includeInitialState? - -```ts -optional includeInitialState: boolean; -``` - -Defined in: [packages/db/src/types.ts:664](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L664) - -Whether to include the current state as initial changes - -*** - -### whereExpression? - -```ts -optional whereExpression: BasicExpression; -``` - -Defined in: [packages/db/src/types.ts:666](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L666) - -Pre-compiled expression for filtering changes diff --git a/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md b/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md deleted file mode 100644 index b0eb573f6..000000000 --- a/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: SubscribeChangesSnapshotOptions -title: SubscribeChangesSnapshotOptions ---- - -# Interface: SubscribeChangesSnapshotOptions - -Defined in: [packages/db/src/types.ts:669](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L669) - -## Extends - -- `Omit`\<[`SubscribeChangesOptions`](../SubscribeChangesOptions.md), `"includeInitialState"`\> - -## Properties - -### limit? - -```ts -optional limit: number; -``` - -Defined in: [packages/db/src/types.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L672) - -*** - -### orderBy? - -```ts -optional orderBy: OrderBy; -``` - -Defined in: [packages/db/src/types.ts:671](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L671) - -*** - -### whereExpression? - -```ts -optional whereExpression: BasicExpression; -``` - -Defined in: [packages/db/src/types.ts:666](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L666) - -Pre-compiled expression for filtering changes - -#### Inherited from - -[`SubscribeChangesOptions`](../SubscribeChangesOptions.md).[`whereExpression`](../SubscribeChangesOptions.md#whereexpression) diff --git a/docs/reference/interfaces/Subscription.md b/docs/reference/interfaces/Subscription.md deleted file mode 100644 index 5af5857aa..000000000 --- a/docs/reference/interfaces/Subscription.md +++ /dev/null @@ -1,280 +0,0 @@ ---- -id: Subscription -title: Subscription ---- - -# Interface: Subscription - -Defined in: [packages/db/src/types.ts:201](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L201) - -Public interface for a collection subscription -Used by sync implementations to track subscription lifecycle - -## Extends - -- `EventEmitter`\<[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\> - -## Properties - -### status - -```ts -readonly status: SubscriptionStatus; -``` - -Defined in: [packages/db/src/types.ts:203](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L203) - -Current status of the subscription - -## Methods - -### clearListeners() - -```ts -protected clearListeners(): void; -``` - -Defined in: [packages/db/src/event-emitter.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L115) - -Clear all listeners - -#### Returns - -`void` - -#### Inherited from - -```ts -EventEmitter.clearListeners -``` - -*** - -### emitInner() - -```ts -protected emitInner(event, eventPayload): void; -``` - -Defined in: [packages/db/src/event-emitter.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L96) - -**`Internal`** - -Emit an event to all listeners - -#### Type Parameters - -##### T - -`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) - -#### Parameters - -##### event - -`T` - -Event name to emit - -##### eventPayload - -[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\[`T`\] - -Event payload - For use by subclasses - subclasses should wrap this with a public emit if needed - -#### Returns - -`void` - -#### Inherited from - -```ts -EventEmitter.emitInner -``` - -*** - -### off() - -```ts -off(event, callback): void; -``` - -Defined in: [packages/db/src/event-emitter.ts:53](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L53) - -Unsubscribe from an event - -#### Type Parameters - -##### T - -`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) - -#### Parameters - -##### event - -`T` - -Event name to stop listening for - -##### callback - -(`event`) => `void` - -Function to remove - -#### Returns - -`void` - -#### Inherited from - -```ts -EventEmitter.off -``` - -*** - -### on() - -```ts -on(event, callback): () => void; -``` - -Defined in: [packages/db/src/event-emitter.ts:17](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L17) - -Subscribe to an event - -#### Type Parameters - -##### T - -`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) - -#### Parameters - -##### event - -`T` - -Event name to listen for - -##### callback - -(`event`) => `void` - -Function to call when event is emitted - -#### Returns - -Unsubscribe function - -```ts -(): void; -``` - -##### Returns - -`void` - -#### Inherited from - -```ts -EventEmitter.on -``` - -*** - -### once() - -```ts -once(event, callback): () => void; -``` - -Defined in: [packages/db/src/event-emitter.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L37) - -Subscribe to an event once (automatically unsubscribes after first emission) - -#### Type Parameters - -##### T - -`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) - -#### Parameters - -##### event - -`T` - -Event name to listen for - -##### callback - -(`event`) => `void` - -Function to call when event is emitted - -#### Returns - -Unsubscribe function - -```ts -(): void; -``` - -##### Returns - -`void` - -#### Inherited from - -```ts -EventEmitter.once -``` - -*** - -### waitFor() - -```ts -waitFor(event, timeout?): Promise; -``` - -Defined in: [packages/db/src/event-emitter.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L66) - -Wait for an event to be emitted - -#### Type Parameters - -##### T - -`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) - -#### Parameters - -##### event - -`T` - -Event name to wait for - -##### timeout? - -`number` - -Optional timeout in milliseconds - -#### Returns - -`Promise`\<[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\[`T`\]\> - -Promise that resolves with the event payload - -#### Inherited from - -```ts -EventEmitter.waitFor -``` diff --git a/docs/reference/interfaces/SubscriptionStatusChangeEvent.md b/docs/reference/interfaces/SubscriptionStatusChangeEvent.md deleted file mode 100644 index ecdc7fa48..000000000 --- a/docs/reference/interfaces/SubscriptionStatusChangeEvent.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: SubscriptionStatusChangeEvent -title: SubscriptionStatusChangeEvent ---- - -# Interface: SubscriptionStatusChangeEvent - -Defined in: [packages/db/src/types.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L162) - -Event emitted when subscription status changes - -## Properties - -### previousStatus - -```ts -previousStatus: SubscriptionStatus; -``` - -Defined in: [packages/db/src/types.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L165) - -*** - -### status - -```ts -status: SubscriptionStatus; -``` - -Defined in: [packages/db/src/types.ts:166](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L166) - -*** - -### subscription - -```ts -subscription: Subscription; -``` - -Defined in: [packages/db/src/types.ts:164](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L164) - -*** - -### type - -```ts -type: "status:change"; -``` - -Defined in: [packages/db/src/types.ts:163](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L163) diff --git a/docs/reference/interfaces/SubscriptionStatusEvent.md b/docs/reference/interfaces/SubscriptionStatusEvent.md deleted file mode 100644 index e36ea1dab..000000000 --- a/docs/reference/interfaces/SubscriptionStatusEvent.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: SubscriptionStatusEvent -title: SubscriptionStatusEvent ---- - -# Interface: SubscriptionStatusEvent\ - -Defined in: [packages/db/src/types.ts:172](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L172) - -Event emitted when subscription status changes to a specific status - -## Type Parameters - -### T - -`T` *extends* [`SubscriptionStatus`](../../type-aliases/SubscriptionStatus.md) - -## Properties - -### previousStatus - -```ts -previousStatus: SubscriptionStatus; -``` - -Defined in: [packages/db/src/types.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L175) - -*** - -### status - -```ts -status: T; -``` - -Defined in: [packages/db/src/types.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L176) - -*** - -### subscription - -```ts -subscription: Subscription; -``` - -Defined in: [packages/db/src/types.ts:174](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L174) - -*** - -### type - -```ts -type: `status:${T}`; -``` - -Defined in: [packages/db/src/types.ts:173](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L173) diff --git a/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md b/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md deleted file mode 100644 index 12e3dae67..000000000 --- a/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: SubscriptionUnsubscribedEvent -title: SubscriptionUnsubscribedEvent ---- - -# Interface: SubscriptionUnsubscribedEvent - -Defined in: [packages/db/src/types.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L182) - -Event emitted when subscription is unsubscribed - -## Properties - -### subscription - -```ts -subscription: Subscription; -``` - -Defined in: [packages/db/src/types.ts:184](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L184) - -*** - -### type - -```ts -type: "unsubscribed"; -``` - -Defined in: [packages/db/src/types.ts:183](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L183) diff --git a/docs/reference/interfaces/SyncConfig.md b/docs/reference/interfaces/SyncConfig.md deleted file mode 100644 index 3db6db853..000000000 --- a/docs/reference/interfaces/SyncConfig.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: SyncConfig -title: SyncConfig ---- - -# Interface: SyncConfig\ - -Defined in: [packages/db/src/types.ts:232](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L232) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Properties - -### getSyncMetadata()? - -```ts -optional getSyncMetadata: () => Record; -``` - -Defined in: [packages/db/src/types.ts:249](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L249) - -Get the sync metadata for insert operations - -#### Returns - -`Record`\<`string`, `unknown`\> - -Record containing relation information - -*** - -### rowUpdateMode? - -```ts -optional rowUpdateMode: "full" | "partial"; -``` - -Defined in: [packages/db/src/types.ts:258](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L258) - -The row update mode used to sync to the collection. - -#### Default - -`partial` - -#### Description - -- `partial`: Updates contain only the changes to the row. -- `full`: Updates contain the entire row. - -*** - -### sync() - -```ts -sync: (params) => - | void - | CleanupFn - | SyncConfigRes; -``` - -Defined in: [packages/db/src/types.ts:236](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L236) - -#### Parameters - -##### params - -###### begin - -() => `void` - -###### collection - -[`Collection`](../Collection.md)\<`T`, `TKey`, `any`, `any`, `any`\> - -###### commit - -() => `void` - -###### markReady - -() => `void` - -###### truncate - -() => `void` - -###### write - -(`message`) => `void` - -#### Returns - - \| `void` - \| [`CleanupFn`](../../type-aliases/CleanupFn.md) - \| [`SyncConfigRes`](../../type-aliases/SyncConfigRes.md) diff --git a/docs/reference/interfaces/ThrottleStrategy.md b/docs/reference/interfaces/ThrottleStrategy.md deleted file mode 100644 index e21a6f88e..000000000 --- a/docs/reference/interfaces/ThrottleStrategy.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -id: ThrottleStrategy -title: ThrottleStrategy ---- - -# Interface: ThrottleStrategy - -Defined in: [packages/db/src/strategies/types.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L86) - -Throttle strategy that spaces executions evenly over time - -## Extends - -- [`BaseStrategy`](../BaseStrategy.md)\<`"throttle"`\> - -## Properties - -### \_type - -```ts -_type: "throttle"; -``` - -Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) - -Type discriminator for strategy identification - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) - -*** - -### cleanup() - -```ts -cleanup: () => void; -``` - -Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) - -Clean up any resources held by the strategy -Should be called when the strategy is no longer needed - -#### Returns - -`void` - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) - -*** - -### execute() - -```ts -execute: (fn) => void | Promise; -``` - -Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) - -Execute a function according to the strategy's timing rules - -#### Type Parameters - -##### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -#### Parameters - -##### fn - -() => [`Transaction`](../Transaction.md)\<`T`\> - -The function to execute - -#### Returns - -`void` \| `Promise`\<`void`\> - -The result of the function execution (if applicable) - -#### Inherited from - -[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) - -*** - -### options - -```ts -options: ThrottleStrategyOptions; -``` - -Defined in: [packages/db/src/strategies/types.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L87) diff --git a/docs/reference/interfaces/ThrottleStrategyOptions.md b/docs/reference/interfaces/ThrottleStrategyOptions.md deleted file mode 100644 index ab54fdeb0..000000000 --- a/docs/reference/interfaces/ThrottleStrategyOptions.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -id: ThrottleStrategyOptions -title: ThrottleStrategyOptions ---- - -# Interface: ThrottleStrategyOptions - -Defined in: [packages/db/src/strategies/types.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L74) - -Options for throttle strategy -Ensures executions are evenly spaced over time - -## Properties - -### leading? - -```ts -optional leading: boolean; -``` - -Defined in: [packages/db/src/strategies/types.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L78) - -Execute immediately on the first call - -*** - -### trailing? - -```ts -optional trailing: boolean; -``` - -Defined in: [packages/db/src/strategies/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L80) - -Execute on the last call after wait period - -*** - -### wait - -```ts -wait: number; -``` - -Defined in: [packages/db/src/strategies/types.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L76) - -Minimum wait time between executions (milliseconds) diff --git a/docs/reference/interfaces/Transaction.md b/docs/reference/interfaces/Transaction.md deleted file mode 100644 index 5ad434341..000000000 --- a/docs/reference/interfaces/Transaction.md +++ /dev/null @@ -1,417 +0,0 @@ ---- -id: Transaction -title: Transaction ---- - -# Interface: Transaction\ - -Defined in: [packages/db/src/transactions.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L208) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### autoCommit - -```ts -autoCommit: boolean; -``` - -Defined in: [packages/db/src/transactions.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L214) - -*** - -### createdAt - -```ts -createdAt: Date; -``` - -Defined in: [packages/db/src/transactions.ts:215](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L215) - -*** - -### error? - -```ts -optional error: object; -``` - -Defined in: [packages/db/src/transactions.ts:218](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L218) - -#### error - -```ts -error: Error; -``` - -#### message - -```ts -message: string; -``` - -*** - -### id - -```ts -id: string; -``` - -Defined in: [packages/db/src/transactions.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L209) - -*** - -### isPersisted - -```ts -isPersisted: Deferred>; -``` - -Defined in: [packages/db/src/transactions.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L213) - -*** - -### metadata - -```ts -metadata: Record; -``` - -Defined in: [packages/db/src/transactions.ts:217](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L217) - -*** - -### mutationFn - -```ts -mutationFn: MutationFn; -``` - -Defined in: [packages/db/src/transactions.ts:211](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L211) - -*** - -### mutations - -```ts -mutations: PendingMutation>[]; -``` - -Defined in: [packages/db/src/transactions.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L212) - -*** - -### sequenceNumber - -```ts -sequenceNumber: number; -``` - -Defined in: [packages/db/src/transactions.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L216) - -*** - -### state - -```ts -state: TransactionState; -``` - -Defined in: [packages/db/src/transactions.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L210) - -## Methods - -### applyMutations() - -```ts -applyMutations(mutations): void; -``` - -Defined in: [packages/db/src/transactions.ts:327](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L327) - -Apply new mutations to this transaction, intelligently merging with existing mutations - -When mutations operate on the same item (same globalKey), they are merged according to -the following rules: - -- **insert + update** → insert (merge changes, keep empty original) -- **insert + delete** → removed (mutations cancel each other out) -- **update + delete** → delete (delete dominates) -- **update + update** → update (union changes, keep first original) -- **same type** → replace with latest - -This merging reduces over-the-wire churn and keeps the optimistic local view -aligned with user intent. - -#### Parameters - -##### mutations - -[`PendingMutation`](../PendingMutation.md)\<`any`, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`any`, `any`, `any`, `any`, `any`\>\>[] - -Array of new mutations to apply - -#### Returns - -`void` - -*** - -### commit() - -```ts -commit(): Promise>; -``` - -Defined in: [packages/db/src/transactions.ts:472](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L472) - -Commit the transaction and execute the mutation function - -#### Returns - -`Promise`\<`Transaction`\<`T`\>\> - -Promise that resolves to this transaction when complete - -#### Examples - -```ts -// Manual commit (when autoCommit is false) -const tx = createTransaction({ - autoCommit: false, - mutationFn: async ({ transaction }) => { - await api.saveChanges(transaction.mutations) - } -}) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Buy milk" }) -}) - -await tx.commit() // Manually commit -``` - -```ts -// Handle commit errors -try { - const tx = createTransaction({ - mutationFn: async () => { throw new Error("API failed") } - }) - - tx.mutate(() => { - collection.insert({ id: "1", text: "Item" }) - }) - - await tx.commit() -} catch (error) { - console.log('Commit failed, transaction rolled back:', error) -} -``` - -```ts -// Check transaction state after commit -await tx.commit() -console.log(tx.state) // "completed" or "failed" -``` - -*** - -### compareCreatedAt() - -```ts -compareCreatedAt(other): number; -``` - -Defined in: [packages/db/src/transactions.ts:526](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L526) - -Compare two transactions by their createdAt time and sequence number in order -to sort them in the order they were created. - -#### Parameters - -##### other - -`Transaction`\<`any`\> - -The other transaction to compare to - -#### Returns - -`number` - --1 if this transaction was created before the other, 1 if it was created after, 0 if they were created at the same time - -*** - -### mutate() - -```ts -mutate(callback): Transaction; -``` - -Defined in: [packages/db/src/transactions.ts:287](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L287) - -Execute collection operations within this transaction - -#### Parameters - -##### callback - -() => `void` - -Function containing collection operations to group together. If the -callback returns a Promise, the transaction context will remain active until the promise -settles, allowing optimistic writes after `await` boundaries. - -#### Returns - -`Transaction`\<`T`\> - -This transaction for chaining - -#### Examples - -```ts -// Group multiple operations -const tx = createTransaction({ mutationFn: async () => { - // Send to API -}}) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Buy milk" }) - collection.update("2", draft => { draft.completed = true }) - collection.delete("3") -}) - -await tx.isPersisted.promise -``` - -```ts -// Handle mutate errors -try { - tx.mutate(() => { - collection.insert({ id: "invalid" }) // This might throw - }) -} catch (error) { - console.log('Mutation failed:', error) -} -``` - -```ts -// Manual commit control -const tx = createTransaction({ autoCommit: false, mutationFn: async () => {} }) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Item" }) -}) - -// Commit later when ready -await tx.commit() -``` - -*** - -### rollback() - -```ts -rollback(config?): Transaction; -``` - -Defined in: [packages/db/src/transactions.ts:389](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L389) - -Rollback the transaction and any conflicting transactions - -#### Parameters - -##### config? - -Configuration for rollback behavior - -###### isSecondaryRollback? - -`boolean` - -#### Returns - -`Transaction`\<`T`\> - -This transaction for chaining - -#### Examples - -```ts -// Manual rollback -const tx = createTransaction({ mutationFn: async () => { - // Send to API -}}) - -tx.mutate(() => { - collection.insert({ id: "1", text: "Buy milk" }) -}) - -// Rollback if needed -if (shouldCancel) { - tx.rollback() -} -``` - -```ts -// Handle rollback cascade (automatic) -const tx1 = createTransaction({ mutationFn: async () => {} }) -const tx2 = createTransaction({ mutationFn: async () => {} }) - -tx1.mutate(() => collection.update("1", draft => { draft.value = "A" })) -tx2.mutate(() => collection.update("1", draft => { draft.value = "B" })) // Same item - -tx1.rollback() // This will also rollback tx2 due to conflict -``` - -```ts -// Handle rollback in error scenarios -try { - await tx.isPersisted.promise -} catch (error) { - console.log('Transaction was rolled back:', error) - // Transaction automatically rolled back on mutation function failure -} -``` - -*** - -### setState() - -```ts -setState(newState): void; -``` - -Defined in: [packages/db/src/transactions.ts:238](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L238) - -#### Parameters - -##### newState - -[`TransactionState`](../../type-aliases/TransactionState.md) - -#### Returns - -`void` - -*** - -### touchCollection() - -```ts -touchCollection(): void; -``` - -Defined in: [packages/db/src/transactions.ts:417](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L417) - -#### Returns - -`void` diff --git a/docs/reference/interfaces/TransactionConfig.md b/docs/reference/interfaces/TransactionConfig.md deleted file mode 100644 index 062f78947..000000000 --- a/docs/reference/interfaces/TransactionConfig.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: TransactionConfig -title: TransactionConfig ---- - -# Interface: TransactionConfig\ - -Defined in: [packages/db/src/types.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L115) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### autoCommit? - -```ts -optional autoCommit: boolean; -``` - -Defined in: [packages/db/src/types.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L119) - -*** - -### id? - -```ts -optional id: string; -``` - -Defined in: [packages/db/src/types.ts:117](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L117) - -Unique identifier for the transaction - -*** - -### metadata? - -```ts -optional metadata: Record; -``` - -Defined in: [packages/db/src/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L122) - -Custom metadata to associate with the transaction - -*** - -### mutationFn - -```ts -mutationFn: MutationFn; -``` - -Defined in: [packages/db/src/types.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L120) diff --git a/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md b/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md deleted file mode 100644 index e06450b40..000000000 --- a/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md +++ /dev/null @@ -1,240 +0,0 @@ ---- -id: PowerSyncTransactor -title: PowerSyncTransactor ---- - -# Class: PowerSyncTransactor - -Defined in: [PowerSyncTransactor.ts:51](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L51) - -Applies mutations to the PowerSync database. This method is called automatically by the collection's -insert, update, and delete operations. You typically don't need to call this directly unless you -have special transaction requirements. - -## Example - -```typescript -// Create a collection -const collection = createCollection( - powerSyncCollectionOptions({ - database: db, - table: APP_SCHEMA.props.documents, - }) -) - -const addTx = createTransaction({ - autoCommit: false, - mutationFn: async ({ transaction }) => { - await new PowerSyncTransactor({ database: db }).applyTransaction(transaction) - }, -}) - -addTx.mutate(() => { - for (let i = 0; i < 5; i++) { - collection.insert({ id: randomUUID(), name: `tx-${i}` }) - } -}) - -await addTx.commit() -await addTx.isPersisted.promise -``` - -## Param - -The transaction containing mutations to apply - -## Constructors - -### Constructor - -```ts -new PowerSyncTransactor(options): PowerSyncTransactor; -``` - -Defined in: [PowerSyncTransactor.ts:55](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L55) - -#### Parameters - -##### options - -[`TransactorOptions`](../../type-aliases/TransactorOptions.md) - -#### Returns - -`PowerSyncTransactor` - -## Properties - -### database - -```ts -database: AbstractPowerSyncDatabase; -``` - -Defined in: [PowerSyncTransactor.ts:52](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L52) - -*** - -### pendingOperationStore - -```ts -pendingOperationStore: PendingOperationStore; -``` - -Defined in: [PowerSyncTransactor.ts:53](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L53) - -## Methods - -### applyTransaction() - -```ts -applyTransaction(transaction): Promise; -``` - -Defined in: [PowerSyncTransactor.ts:63](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L63) - -Persists a Transaction to the PowerSync SQLite database. - -#### Parameters - -##### transaction - -`Transaction`\<`any`\> - -#### Returns - -`Promise`\<`void`\> - -*** - -### handleDelete() - -```ts -protected handleDelete( - mutation, - context, -waitForCompletion): Promise; -``` - -Defined in: [PowerSyncTransactor.ts:204](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L204) - -#### Parameters - -##### mutation - -`PendingMutation`\<`any`\> - -##### context - -`LockContext` - -##### waitForCompletion - -`boolean` = `false` - -#### Returns - -`Promise`\<`PendingOperation` \| `null`\> - -*** - -### handleInsert() - -```ts -protected handleInsert( - mutation, - context, -waitForCompletion): Promise; -``` - -Defined in: [PowerSyncTransactor.ts:149](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L149) - -#### Parameters - -##### mutation - -`PendingMutation`\<`any`\> - -##### context - -`LockContext` - -##### waitForCompletion - -`boolean` = `false` - -#### Returns - -`Promise`\<`PendingOperation` \| `null`\> - -*** - -### handleOperationWithCompletion() - -```ts -protected handleOperationWithCompletion( - mutation, - context, - waitForCompletion, -handler): Promise; -``` - -Defined in: [PowerSyncTransactor.ts:232](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L232) - -Helper function which wraps a persistence operation by: -- Fetching the mutation's collection's SQLite table details -- Executing the mutation -- Returning the last pending diff operation if required - -#### Parameters - -##### mutation - -`PendingMutation`\<`any`\> - -##### context - -`LockContext` - -##### waitForCompletion - -`boolean` - -##### handler - -(`tableName`, `mutation`, `serializeValue`) => `Promise`\<`void`\> - -#### Returns - -`Promise`\<`PendingOperation` \| `null`\> - -*** - -### handleUpdate() - -```ts -protected handleUpdate( - mutation, - context, -waitForCompletion): Promise; -``` - -Defined in: [PowerSyncTransactor.ts:177](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L177) - -#### Parameters - -##### mutation - -`PendingMutation`\<`any`\> - -##### context - -`LockContext` - -##### waitForCompletion - -`boolean` = `false` - -#### Returns - -`Promise`\<`PendingOperation` \| `null`\> diff --git a/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md b/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md deleted file mode 100644 index e18eebcb9..000000000 --- a/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md +++ /dev/null @@ -1,213 +0,0 @@ ---- -id: powerSyncCollectionOptions -title: powerSyncCollectionOptions ---- - -# Function: powerSyncCollectionOptions() - -Implementation of powerSyncCollectionOptions that handles both schema and non-schema configurations. - -## Call Signature - -```ts -function powerSyncCollectionOptions(config): EnhancedPowerSyncCollectionConfig, never>; -``` - -Defined in: [powersync.ts:71](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L71) - -Creates a PowerSync collection configuration with basic default validation. -Input and Output types are the SQLite column types. - -### Type Parameters - -#### TTable - -`TTable` *extends* `Table`\<`ColumnsType`\> = `Table`\<`ColumnsType`\> - -### Parameters - -#### config - -`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `never`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` - -### Returns - -[`EnhancedPowerSyncCollectionConfig`](../../type-aliases/EnhancedPowerSyncCollectionConfig.md)\<`TTable`, `OptionalExtractedTable`\<`TTable`\>, `never`\> - -### Example - -```typescript -const APP_SCHEMA = new Schema({ - documents: new Table({ - name: column.text, - }), -}) - -type Document = (typeof APP_SCHEMA)["types"]["documents"] - -const db = new PowerSyncDatabase({ - database: { - dbFilename: "test.sqlite", - }, - schema: APP_SCHEMA, -}) - -const collection = createCollection( - powerSyncCollectionOptions({ - database: db, - table: APP_SCHEMA.props.documents - }) -) -``` - -## Call Signature - -```ts -function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, UtilsRecord> & object & object; -``` - -Defined in: [powersync.ts:128](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L128) - -Creates a PowerSync collection configuration with schema validation. - -The input types satisfy the SQLite column types. - -The output types are defined by the provided schema. This schema can enforce additional -validation or type transforms. -Arbitrary output typed mutations are encoded to SQLite for persistence. We provide a basic standard -serialization implementation to serialize column values. Custom or advanced types require providing additional -serializer specifications. Partial column overrides can be supplied to `serializer`. - -### Type Parameters - -#### TTable - -`TTable` *extends* `Table`\<`ColumnsType`\> - -#### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`OptionalExtractedTable`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> - -### Parameters - -#### config - -`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `TSchema`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` & [`SerializerConfig`](../../type-aliases/SerializerConfig.md)\<`InferOutput`\<`TSchema`\>, `ExtractedTable`\<`TTable`\>\> & `object` - -### Returns - -`CollectionConfig`\<[`InferPowerSyncOutputType`](../../type-aliases/InferPowerSyncOutputType.md)\<`TTable`, `TSchema`\>, `string`, `TSchema`, `UtilsRecord`\> & `object` & `object` - -### Example - -```typescript -import { z } from "zod" - -// The PowerSync SQLite schema -const APP_SCHEMA = new Schema({ - documents: new Table({ - name: column.text, - // Dates are stored as ISO date strings in SQLite - created_at: column.text - }), -}) - -// Advanced Zod validations. The output type of this schema -// is constrained to the SQLite schema of APP_SCHEMA -const schema = z.object({ - id: z.string(), - // Notice that `name` is not nullable (is required) here and it has additional validation - name: z.string().min(3, { message: "Should be at least 3 characters" }).nullable(), - // The input type is still the SQLite string type. While collections will output smart Date instances. - created_at: z.string().transform(val => new Date(val)) -}) - -const collection = createCollection( - powerSyncCollectionOptions({ - database: db, - table: APP_SCHEMA.props.documents, - schema, - serializer: { - // The default is toISOString, this is just to demonstrate custom overrides - created_at: (outputValue) => outputValue.toISOString(), - }, - }) -) -``` - -## Call Signature - -```ts -function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, UtilsRecord> & object & object; -``` - -Defined in: [powersync.ts:196](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L196) - -Creates a PowerSync collection configuration with schema validation. - -The input types are not linked to the internal SQLite table types. This can -give greater flexibility, e.g. by accepting rich types as input for `insert` or `update` operations. -An additional `deserializationSchema` is required in order to process incoming SQLite updates to the output type. - -The output types are defined by the provided schema. This schema can enforce additional -validation or type transforms. -Arbitrary output typed mutations are encoded to SQLite for persistence. We provide a basic standard -serialization implementation to serialize column values. Custom or advanced types require providing additional -serializer specifications. Partial column overrides can be supplied to `serializer`. - -### Type Parameters - -#### TTable - -`TTable` *extends* `Table`\<`ColumnsType`\> - -#### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`AnyTableColumnType`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> - -### Parameters - -#### config - -`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `TSchema`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` & [`SerializerConfig`](../../type-aliases/SerializerConfig.md)\<`InferOutput`\<`TSchema`\>, `ExtractedTable`\<`TTable`\>\> & `object` - -### Returns - -`CollectionConfig`\<[`InferPowerSyncOutputType`](../../type-aliases/InferPowerSyncOutputType.md)\<`TTable`, `TSchema`\>, `string`, `TSchema`, `UtilsRecord`\> & `object` & `object` - -### Example - -```typescript -import { z } from "zod" - -// The PowerSync SQLite schema -const APP_SCHEMA = new Schema({ - documents: new Table({ - name: column.text, - // Booleans are represented as integers in SQLite - is_active: column.integer - }), -}) - -// Advanced Zod validations. -// We accept boolean values as input for operations and expose Booleans in query results -const schema = z.object({ - id: z.string(), - isActive: z.boolean(), // TInput and TOutput are boolean -}) - -// The deserializationSchema converts the SQLite synced INTEGER (0/1) values to booleans. -const deserializationSchema = z.object({ - id: z.string(), - isActive: z.number().nullable().transform((val) => val == null ? true : val > 0), -}) - -const collection = createCollection( - powerSyncCollectionOptions({ - database: db, - table: APP_SCHEMA.props.documents, - schema, - deserializationSchema, - }) -) -``` diff --git a/docs/reference/powersync-db-collection/index.md b/docs/reference/powersync-db-collection/index.md deleted file mode 100644 index c0894dac0..000000000 --- a/docs/reference/powersync-db-collection/index.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: "@tanstack/powersync-db-collection" -title: "@tanstack/powersync-db-collection" ---- - -# @tanstack/powersync-db-collection - -## Classes - -- [PowerSyncTransactor](../classes/PowerSyncTransactor.md) - -## Type Aliases - -- [BasePowerSyncCollectionConfig](../type-aliases/BasePowerSyncCollectionConfig.md) -- [ConfigWithArbitraryCollectionTypes](../type-aliases/ConfigWithArbitraryCollectionTypes.md) -- [ConfigWithSQLiteInputType](../type-aliases/ConfigWithSQLiteInputType.md) -- [ConfigWithSQLiteTypes](../type-aliases/ConfigWithSQLiteTypes.md) -- [CustomSQLiteSerializer](../type-aliases/CustomSQLiteSerializer.md) -- [EnhancedPowerSyncCollectionConfig](../type-aliases/EnhancedPowerSyncCollectionConfig.md) -- [InferPowerSyncOutputType](../type-aliases/InferPowerSyncOutputType.md) -- [PowerSyncCollectionConfig](../type-aliases/PowerSyncCollectionConfig.md) -- [PowerSyncCollectionMeta](../type-aliases/PowerSyncCollectionMeta.md) -- [PowerSyncCollectionUtils](../type-aliases/PowerSyncCollectionUtils.md) -- [SerializerConfig](../type-aliases/SerializerConfig.md) -- [TransactorOptions](../type-aliases/TransactorOptions.md) - -## Variables - -- [DEFAULT\_BATCH\_SIZE](../variables/DEFAULT_BATCH_SIZE.md) - -## Functions - -- [powerSyncCollectionOptions](../functions/powerSyncCollectionOptions.md) diff --git a/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md deleted file mode 100644 index ab1d26dcc..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: BasePowerSyncCollectionConfig -title: BasePowerSyncCollectionConfig ---- - -# Type Alias: BasePowerSyncCollectionConfig\ - -```ts -type BasePowerSyncCollectionConfig = Omit, string, TSchema>, "onInsert" | "onUpdate" | "onDelete" | "getKey"> & object; -``` - -Defined in: [definitions.ts:165](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L165) - -## Type Declaration - -### database - -```ts -database: AbstractPowerSyncDatabase; -``` - -The PowerSync database instance - -### syncBatchSize? - -```ts -optional syncBatchSize: number; -``` - -The maximum number of documents to read from the SQLite table -in a single batch during the initial sync between PowerSync and the -in-memory TanStack DB collection. - -#### Remarks - -- Defaults to [DEFAULT\_BATCH\_SIZE](../../variables/DEFAULT_BATCH_SIZE.md) if not specified. -- Larger values reduce the number of round trips to the storage - engine but increase memory usage per batch. -- Smaller values may lower memory usage and allow earlier - streaming of initial results, at the cost of more query calls. - -### table - -```ts -table: TTable; -``` - -The PowerSync schema Table definition - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` = `Table` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md deleted file mode 100644 index a51250077..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: ConfigWithArbitraryCollectionTypes -title: ConfigWithArbitraryCollectionTypes ---- - -# Type Alias: ConfigWithArbitraryCollectionTypes\ - -```ts -type ConfigWithArbitraryCollectionTypes = SerializerConfig, ExtractedTable> & object; -``` - -Defined in: [definitions.ts:125](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L125) - -Config where TInput and TOutput have arbitrarily typed values. -The keys of the types need to equal the SQLite types. -Since TInput is not the SQLite types, we require a schema in order to deserialize incoming SQLite updates. The schema should validate from SQLite to TOutput. - -## Type Declaration - -### deserializationSchema - -```ts -deserializationSchema: StandardSchemaV1, StandardSchemaV1.InferOutput>; -``` - -Schema for deserializing and validating input data from the sync stream. - -This schema defines how to transform and validate data coming from SQLite types (as stored in the database) -into the desired output types (`TOutput`) expected by your application or validation logic. - -The generic parameters allow for arbitrary input and output types, so you can specify custom conversion rules -for each column. This is especially useful when your application expects richer types (e.g., Date, enums, objects) -than what SQLite natively supports. - -Use this to ensure that incoming data from the sync stream is properly converted and validated before use. - -Example: -```typescript -deserializationSchema: z.object({ - createdAt: z.preprocess((val) => new Date(val as string), z.date()), - meta: z.preprocess((val) => JSON.parse(val as string), z.object({ ... })), -}) -``` - -This enables robust type safety and validation for incoming data, bridging the gap between SQLite storage -and your application's expected types. - -### schema - -```ts -schema: TSchema; -``` - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`AnyTableColumnType`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md deleted file mode 100644 index 1d58b51a6..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: ConfigWithSQLiteInputType -title: ConfigWithSQLiteInputType ---- - -# Type Alias: ConfigWithSQLiteInputType\ - -```ts -type ConfigWithSQLiteInputType = SerializerConfig, ExtractedTable> & object; -``` - -Defined in: [definitions.ts:106](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L106) - -Config where TInput is the SQLite types while TOutput can be defined by TSchema. -We can use the same schema to validate TInput and incoming SQLite changes. - -## Type Declaration - -### schema - -```ts -schema: TSchema; -``` - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`OptionalExtractedTable`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md deleted file mode 100644 index edc414511..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: ConfigWithSQLiteTypes -title: ConfigWithSQLiteTypes ---- - -# Type Alias: ConfigWithSQLiteTypes - -```ts -type ConfigWithSQLiteTypes = object; -``` - -Defined in: [definitions.ts:100](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L100) - -Config for when TInput and TOutput are both the SQLite types. diff --git a/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md b/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md deleted file mode 100644 index 898bf6119..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: CustomSQLiteSerializer -title: CustomSQLiteSerializer ---- - -# Type Alias: CustomSQLiteSerializer\ - -```ts -type CustomSQLiteSerializer = Partial<{ [Key in keyof TOutput]: (value: TOutput[Key]) => Key extends keyof TSQLite ? TSQLite[Key] : never }>; -``` - -Defined in: [definitions.ts:52](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L52) - -A mapping type for custom serialization of object properties to SQLite-compatible values. - -This type allows you to override, for keys in the input object (`TOutput`), a function that transforms -the value to the corresponding SQLite type (`TSQLite`). Keys not specified will use the default SQLite serialization. - -## Generics -- `TOutput`: The input object type, representing the row data to be serialized. -- `TSQLite`: The target SQLite-compatible type for each property, typically inferred from the table schema. - -## Usage -Use this type to define a map of serialization functions for specific keys when you need custom handling -(e.g., converting complex objects, formatting dates, or handling enums). - -Example: -```ts -const serializer: CustomSQLiteSerializer = { - createdAt: (date) => date.toISOString(), - status: (status) => status ? 1 : 0, - meta: (meta) => JSON.stringify(meta), -}; -``` - -## Behavior -- Each key maps to a function that receives the value and returns the SQLite-compatible value. -- Used by `serializeForSQLite` to override default serialization for specific columns. - -## Type Parameters - -### TOutput - -`TOutput` *extends* `Record`\<`string`, `unknown`\> - -### TSQLite - -`TSQLite` *extends* `Record`\<`string`, `unknown`\> diff --git a/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md deleted file mode 100644 index 79c292301..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: EnhancedPowerSyncCollectionConfig -title: EnhancedPowerSyncCollectionConfig ---- - -# Type Alias: EnhancedPowerSyncCollectionConfig\ - -```ts -type EnhancedPowerSyncCollectionConfig = CollectionConfig & object; -``` - -Defined in: [definitions.ts:254](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L254) - -A CollectionConfig which includes utilities for PowerSync. - -## Type Declaration - -### id? - -```ts -optional id: string; -``` - -### schema? - -```ts -optional schema: TSchema; -``` - -### utils - -```ts -utils: PowerSyncCollectionUtils; -``` - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` - -### OutputType - -`OutputType` *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md b/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md deleted file mode 100644 index d7e31998e..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: InferPowerSyncOutputType -title: InferPowerSyncOutputType ---- - -# Type Alias: InferPowerSyncOutputType\ - -```ts -type InferPowerSyncOutputType = TSchema extends never ? ExtractedTable : InferSchemaOutput; -``` - -Defined in: [definitions.ts:20](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L20) - -Small helper which determines the output type if: -- Standard SQLite types are to be used OR -- If the provided schema should be used. - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` = `Table` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`PowerSyncRecord`\> = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md deleted file mode 100644 index d06b3d3b7..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -id: PowerSyncCollectionConfig -title: PowerSyncCollectionConfig ---- - -# Type Alias: PowerSyncCollectionConfig\ - -```ts -type PowerSyncCollectionConfig = BasePowerSyncCollectionConfig & - | ConfigWithSQLiteTypes - | ConfigWithSQLiteInputType -| ConfigWithArbitraryCollectionTypes; -``` - -Defined in: [definitions.ts:222](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L222) - -Configuration options for creating a PowerSync collection. - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` = `Table` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1`\<`any`\> = `never` - -## Example - -```typescript -const APP_SCHEMA = new Schema({ - documents: new Table({ - name: column.text, - }), -}) - -const db = new PowerSyncDatabase({ - database: { - dbFilename: "test.sqlite", - }, - schema: APP_SCHEMA, -}) - -const collection = createCollection( - powerSyncCollectionOptions({ - database: db, - table: APP_SCHEMA.props.documents - }) -) -``` diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md deleted file mode 100644 index 1fab936e6..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -id: PowerSyncCollectionMeta -title: PowerSyncCollectionMeta ---- - -# Type Alias: PowerSyncCollectionMeta\ - -```ts -type PowerSyncCollectionMeta = object; -``` - -Defined in: [definitions.ts:235](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L235) - -Metadata for the PowerSync Collection. - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` = `Table` - -## Properties - -### serializeValue() - -```ts -serializeValue: (value) => ExtractedTable; -``` - -Defined in: [definitions.ts:248](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L248) - -Serializes a collection value to the SQLite type - -#### Parameters - -##### value - -`any` - -#### Returns - -`ExtractedTable`\<`TTable`\> - -*** - -### tableName - -```ts -tableName: string; -``` - -Defined in: [definitions.ts:239](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L239) - -The SQLite table representing the collection. - -*** - -### trackedTableName - -```ts -trackedTableName: string; -``` - -Defined in: [definitions.ts:243](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L243) - -The internal table used to track diffs for the collection. diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md deleted file mode 100644 index 28ab62975..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: PowerSyncCollectionUtils -title: PowerSyncCollectionUtils ---- - -# Type Alias: PowerSyncCollectionUtils\ - -```ts -type PowerSyncCollectionUtils = object; -``` - -Defined in: [definitions.ts:267](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L267) - -Collection-level utilities for PowerSync. - -## Type Parameters - -### TTable - -`TTable` *extends* `Table` = `Table` - -## Properties - -### getMeta() - -```ts -getMeta: () => PowerSyncCollectionMeta; -``` - -Defined in: [definitions.ts:268](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L268) - -#### Returns - -[`PowerSyncCollectionMeta`](../PowerSyncCollectionMeta.md)\<`TTable`\> diff --git a/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md b/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md deleted file mode 100644 index f437cdbf2..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -id: SerializerConfig -title: SerializerConfig ---- - -# Type Alias: SerializerConfig\ - -```ts -type SerializerConfig = object; -``` - -Defined in: [definitions.ts:61](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L61) - -## Type Parameters - -### TOutput - -`TOutput` *extends* `Record`\<`string`, `unknown`\> - -### TSQLite - -`TSQLite` *extends* `Record`\<`string`, `unknown`\> - -## Properties - -### onDeserializationError() - -```ts -onDeserializationError: (error) => void; -``` - -Defined in: [definitions.ts:94](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L94) - -Application logic should ensure that incoming synced data is always valid. -Failing to deserialize and apply incoming changes results in data inconsistency - which is a fatal error. -Use this callback to react to deserialization errors. - -#### Parameters - -##### error - -`StandardSchemaV1.FailureResult` - -#### Returns - -`void` - -*** - -### serializer? - -```ts -optional serializer: CustomSQLiteSerializer; -``` - -Defined in: [definitions.ts:87](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L87) - -Optional partial serializer object for customizing how individual columns are serialized for SQLite. - -This should be a partial map of column keys to serialization functions, following the -[CustomSQLiteSerializer](../CustomSQLiteSerializer.md) type. Each function receives the column value and returns a value -compatible with SQLite storage. - -If not provided for a column, the default behavior is used: - - `TEXT`: Strings are stored as-is; Dates are converted to ISO strings; other types are JSON-stringified. - - `INTEGER`/`REAL`: Numbers are stored as-is; booleans are mapped to 1/0. - -Use this option to override serialization for specific columns, such as formatting dates, handling enums, -or serializing complex objects. - -Example: -```typescript -serializer: { - createdAt: (date) => date.getTime(), // Store as timestamp - meta: (meta) => JSON.stringify(meta), // Custom object serialization -} -``` diff --git a/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md b/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md deleted file mode 100644 index d38e7152f..000000000 --- a/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: TransactorOptions -title: TransactorOptions ---- - -# Type Alias: TransactorOptions - -```ts -type TransactorOptions = object; -``` - -Defined in: [PowerSyncTransactor.ts:12](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L12) - -## Properties - -### database - -```ts -database: AbstractPowerSyncDatabase; -``` - -Defined in: [PowerSyncTransactor.ts:13](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L13) diff --git a/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md b/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md deleted file mode 100644 index 46f9f447a..000000000 --- a/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: DEFAULT_BATCH_SIZE -title: DEFAULT_BATCH_SIZE ---- - -# Variable: DEFAULT\_BATCH\_SIZE - -```ts -const DEFAULT_BATCH_SIZE: 1000 = 1000; -``` - -Defined in: [definitions.ts:274](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L274) - -Default value for [PowerSyncCollectionConfig#syncBatchSize](../../type-aliases/BasePowerSyncCollectionConfig.md). diff --git a/docs/reference/query-db-collection/functions/queryCollectionOptions.md b/docs/reference/query-db-collection/functions/queryCollectionOptions.md index 7da3182e8..9e5c026c2 100644 --- a/docs/reference/query-db-collection/functions/queryCollectionOptions.md +++ b/docs/reference/query-db-collection/functions/queryCollectionOptions.md @@ -8,10 +8,10 @@ title: queryCollectionOptions ## Call Signature ```ts -function queryCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object; +function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:270](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L270) +Defined in: [packages/query-db-collection/src/query.ts:370](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L370) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -64,7 +64,7 @@ Configuration options for the Query collection ### Returns -`CollectionConfig`\<`InferSchemaOutput`\<`T`\>, `TKey`, `T`, `UtilsRecord`\> & `object` +`CollectionConfig`\<`InferSchemaOutput`\<`T`\>, `TKey`, `T`, [`QueryCollectionUtils`](../../interfaces/QueryCollectionUtils.md)\<`InferSchemaOutput`\<`T`\>, `TKey`, `InferSchemaInput`\<`T`\>, `TError`\>\> & `object` Collection options with utilities for direct writes and manual operations @@ -148,10 +148,10 @@ const todosCollection = createCollection( ## Call Signature ```ts -function queryCollectionOptions(config): CollectionConfig & object; +function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:300](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L300) +Defined in: [packages/query-db-collection/src/query.ts:405](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L405) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -204,7 +204,7 @@ Configuration options for the Query collection ### Returns -`CollectionConfig`\<`T`, `TKey`, `never`, `UtilsRecord`\> & `object` +`CollectionConfig`\<`T`, `TKey`, `never`, [`QueryCollectionUtils`](../../interfaces/QueryCollectionUtils.md)\<`T`, `TKey`, `T`, `TError`\>\> & `object` Collection options with utilities for direct writes and manual operations @@ -288,10 +288,10 @@ const todosCollection = createCollection( ## Call Signature ```ts -function queryCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object; +function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:328](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L328) +Defined in: [packages/query-db-collection/src/query.ts:438](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L438) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -336,7 +336,7 @@ Configuration options for the Query collection ### Returns -`CollectionConfig`\<`InferSchemaOutput`\<`T`\>, `TKey`, `T`, `UtilsRecord`\> & `object` +`CollectionConfig`\<`InferSchemaOutput`\<`T`\>, `TKey`, `T`, [`QueryCollectionUtils`](../../interfaces/QueryCollectionUtils.md)\<`InferSchemaOutput`\<`T`\>, `TKey`, `InferSchemaInput`\<`T`\>, `TError`\>\> & `object` Collection options with utilities for direct writes and manual operations @@ -420,10 +420,10 @@ const todosCollection = createCollection( ## Call Signature ```ts -function queryCollectionOptions(config): CollectionConfig & object; +function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:357](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L357) +Defined in: [packages/query-db-collection/src/query.ts:472](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L472) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -468,7 +468,7 @@ Configuration options for the Query collection ### Returns -`CollectionConfig`\<`T`, `TKey`, `never`, `UtilsRecord`\> & `object` +`CollectionConfig`\<`T`, `TKey`, `never`, [`QueryCollectionUtils`](../../interfaces/QueryCollectionUtils.md)\<`T`, `TKey`, `T`, `TError`\>\> & `object` Collection options with utilities for direct writes and manual operations diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md index a65cd4221..5f599e3de 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md @@ -43,7 +43,7 @@ The type of errors that can occur during queries ## Indexable ```ts -[key: string]: Fn +[key: string]: any ``` ## Properties @@ -54,7 +54,7 @@ The type of errors that can occur during queries clearError: () => Promise; ``` -Defined in: [packages/query-db-collection/src/query.ts:181](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L181) +Defined in: [packages/query-db-collection/src/query.ts:194](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L194) Clear the error state and trigger a refetch of the query @@ -70,52 +70,100 @@ Error if the refetch fails *** -### errorCount() +### dataUpdatedAt ```ts -errorCount: () => number; +dataUpdatedAt: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:175](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L175) +Defined in: [packages/query-db-collection/src/query.ts:185](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L185) + +Get timestamp of last successful data update (in milliseconds) + +*** + +### errorCount + +```ts +errorCount: number; +``` + +Defined in: [packages/query-db-collection/src/query.ts:177](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L177) Get the number of consecutive sync failures. Incremented only when query fails completely (not per retry attempt); reset on success. -#### Returns +*** -`number` +### fetchStatus + +```ts +fetchStatus: "idle" | "fetching" | "paused"; +``` + +Defined in: [packages/query-db-collection/src/query.ts:187](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L187) + +Get current fetch status *** -### isError() +### isError ```ts -isError: () => boolean; +isError: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:170](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L170) +Defined in: [packages/query-db-collection/src/query.ts:172](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L172) Check if the collection is in an error state -#### Returns +*** + +### isFetching -`boolean` +```ts +isFetching: boolean; +``` + +Defined in: [packages/query-db-collection/src/query.ts:179](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L179) + +Check if query is currently fetching (initial or background) *** -### lastError() +### isLoading ```ts -lastError: () => TError | undefined; +isLoading: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:168](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L168) +Defined in: [packages/query-db-collection/src/query.ts:183](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L183) -Get the last error encountered by the query (if any); reset on success +Check if query is loading for the first time (no data yet) -#### Returns +*** + +### isRefetching + +```ts +isRefetching: boolean; +``` + +Defined in: [packages/query-db-collection/src/query.ts:181](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L181) -`TError` \| `undefined` +Check if query is refetching in background (not initial fetch) + +*** + +### lastError + +```ts +lastError: TError | undefined; +``` + +Defined in: [packages/query-db-collection/src/query.ts:170](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L170) + +Get the last error encountered by the query (if any); reset on success *** diff --git a/docs/reference/type-aliases/ChangeListener.md b/docs/reference/type-aliases/ChangeListener.md deleted file mode 100644 index 7fb302ac4..000000000 --- a/docs/reference/type-aliases/ChangeListener.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -id: ChangeListener -title: ChangeListener ---- - -# Type Alias: ChangeListener()\ - -```ts -type ChangeListener = (changes) => void; -``` - -Defined in: [packages/db/src/types.ts:717](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L717) - -Function type for listening to collection changes - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Parameters - -### changes - -[`ChangeMessage`](../../interfaces/ChangeMessage.md)\<`T`, `TKey`\>[] - -Array of change messages describing what happened - -## Returns - -`void` - -## Examples - -```ts -// Basic change listener -const listener: ChangeListener = (changes) => { - changes.forEach(change => { - console.log(`${change.type}: ${change.key}`, change.value) - }) -} - -collection.subscribeChanges(listener) -``` - -```ts -// Handle different change types -const listener: ChangeListener = (changes) => { - for (const change of changes) { - switch (change.type) { - case 'insert': - addToUI(change.value) - break - case 'update': - updateInUI(change.key, change.value, change.previousValue) - break - case 'delete': - removeFromUI(change.key) - break - } - } -} -``` diff --git a/docs/reference/type-aliases/ChangesPayload.md b/docs/reference/type-aliases/ChangesPayload.md deleted file mode 100644 index 92f1f161c..000000000 --- a/docs/reference/type-aliases/ChangesPayload.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: ChangesPayload -title: ChangesPayload ---- - -# Type Alias: ChangesPayload\ - -```ts -type ChangesPayload = ChangeMessage[]; -``` - -Defined in: [packages/db/src/types.ts:620](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L620) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> diff --git a/docs/reference/type-aliases/CleanupFn.md b/docs/reference/type-aliases/CleanupFn.md deleted file mode 100644 index 71ba43416..000000000 --- a/docs/reference/type-aliases/CleanupFn.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -id: CleanupFn -title: CleanupFn ---- - -# Type Alias: CleanupFn() - -```ts -type CleanupFn = () => void; -``` - -Defined in: [packages/db/src/types.ts:226](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L226) - -## Returns - -`void` diff --git a/docs/reference/type-aliases/ClearStorageFn.md b/docs/reference/type-aliases/ClearStorageFn.md deleted file mode 100644 index 05751d091..000000000 --- a/docs/reference/type-aliases/ClearStorageFn.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: ClearStorageFn -title: ClearStorageFn ---- - -# Type Alias: ClearStorageFn() - -```ts -type ClearStorageFn = () => void; -``` - -Defined in: [packages/db/src/local-storage.ts:90](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L90) - -Type for the clear utility function - -## Returns - -`void` diff --git a/docs/reference/type-aliases/CollectionConfigSingleRowOption.md b/docs/reference/type-aliases/CollectionConfigSingleRowOption.md deleted file mode 100644 index c498f5aec..000000000 --- a/docs/reference/type-aliases/CollectionConfigSingleRowOption.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: CollectionConfigSingleRowOption -title: CollectionConfigSingleRowOption ---- - -# Type Alias: CollectionConfigSingleRowOption\ - -```ts -type CollectionConfigSingleRowOption = CollectionConfig & MaybeSingleResult; -``` - -Defined in: [packages/db/src/types.ts:613](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L613) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TSchema - -`TSchema` *extends* `StandardSchemaV1` = `never` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = \{ -\} diff --git a/docs/reference/type-aliases/CollectionStatus.md b/docs/reference/type-aliases/CollectionStatus.md deleted file mode 100644 index d4d9e4443..000000000 --- a/docs/reference/type-aliases/CollectionStatus.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: CollectionStatus -title: CollectionStatus ---- - -# Type Alias: CollectionStatus - -```ts -type CollectionStatus = "idle" | "loading" | "ready" | "error" | "cleaned-up"; -``` - -Defined in: [packages/db/src/types.ts:371](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L371) - -Collection status values for lifecycle management - -## Examples - -```ts -// Check collection status -if (collection.status === "loading") { - console.log("Collection is loading initial data") -} else if (collection.status === "ready") { - console.log("Collection is ready for use") -} -``` - -```ts -// Status transitions -// idle → loading → ready (when markReady() is called) -// Any status can transition to → error or cleaned-up -``` diff --git a/docs/reference/type-aliases/DeleteMutationFn.md b/docs/reference/type-aliases/DeleteMutationFn.md deleted file mode 100644 index ef9da1116..000000000 --- a/docs/reference/type-aliases/DeleteMutationFn.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: DeleteMutationFn -title: DeleteMutationFn ---- - -# Type Alias: DeleteMutationFn()\ - -```ts -type DeleteMutationFn = (params) => Promise; -``` - -Defined in: [packages/db/src/types.ts:349](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L349) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -### TReturn - -`TReturn` = `any` - -## Parameters - -### params - -[`DeleteMutationFnParams`](../DeleteMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> - -## Returns - -`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/DeleteMutationFnParams.md b/docs/reference/type-aliases/DeleteMutationFnParams.md deleted file mode 100644 index 949b12bd3..000000000 --- a/docs/reference/type-aliases/DeleteMutationFnParams.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: DeleteMutationFnParams -title: DeleteMutationFnParams ---- - -# Type Alias: DeleteMutationFnParams\ - -```ts -type DeleteMutationFnParams = object; -``` - -Defined in: [packages/db/src/types.ts:326](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L326) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -## Properties - -### collection - -```ts -collection: Collection; -``` - -Defined in: [packages/db/src/types.ts:332](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L332) - -*** - -### transaction - -```ts -transaction: TransactionWithMutations; -``` - -Defined in: [packages/db/src/types.ts:331](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L331) diff --git a/docs/reference/type-aliases/Fn.md b/docs/reference/type-aliases/Fn.md deleted file mode 100644 index 208899f6b..000000000 --- a/docs/reference/type-aliases/Fn.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: Fn -title: Fn ---- - -# Type Alias: Fn() - -```ts -type Fn = (...args) => any; -``` - -Defined in: [packages/db/src/types.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L35) - -Represents a utility function that can be attached to a collection - -## Parameters - -### args - -...`any`[] - -## Returns - -`any` diff --git a/docs/reference/type-aliases/GetResult.md b/docs/reference/type-aliases/GetResult.md deleted file mode 100644 index 390412903..000000000 --- a/docs/reference/type-aliases/GetResult.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -id: GetResult -title: GetResult ---- - -# Type Alias: GetResult\ - -```ts -type GetResult = Prettify; -``` - -Defined in: [packages/db/src/query/builder/types.ts:661](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L661) - -GetResult - Determines the final result type of a query - -This type implements the logic for what a query returns based on its current state: - -**Priority Order**: -1. **Explicit Result**: If `select()` was called, use the projected type -2. **Join Query**: If joins exist, return all tables with proper optionality -3. **Single Table**: Return just the main table from `from()` - -**Examples**: -```typescript -// Single table query: -from({ users }).where(...) // → User[] - -// Join query without select: -from({ users }).leftJoin({ orders }, ...) // → { users: User, orders: Order | undefined }[] - -// Query with select: -from({ users }).select({ id: users.id, name: users.name }) // → { id: number, name: string }[] -``` - -The `Prettify` wrapper ensures clean type display in IDEs by flattening -complex intersection types into readable object types. - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/GetStorageSizeFn.md b/docs/reference/type-aliases/GetStorageSizeFn.md deleted file mode 100644 index 2008fbbd6..000000000 --- a/docs/reference/type-aliases/GetStorageSizeFn.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: GetStorageSizeFn -title: GetStorageSizeFn ---- - -# Type Alias: GetStorageSizeFn() - -```ts -type GetStorageSizeFn = () => number; -``` - -Defined in: [packages/db/src/local-storage.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L95) - -Type for the getStorageSize utility function - -## Returns - -`number` diff --git a/docs/reference/type-aliases/IndexConstructor.md b/docs/reference/type-aliases/IndexConstructor.md deleted file mode 100644 index fa3e2d37b..000000000 --- a/docs/reference/type-aliases/IndexConstructor.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -id: IndexConstructor -title: IndexConstructor ---- - -# Type Alias: IndexConstructor()\ - -```ts -type IndexConstructor = (id, expression, name?, options?) => BaseIndex; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:201](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L201) - -Type for index constructor - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -## Parameters - -### id - -`number` - -### expression - -[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) - -### name? - -`string` - -### options? - -`any` - -## Returns - -[`BaseIndex`](../../classes/BaseIndex.md)\<`TKey`\> diff --git a/docs/reference/type-aliases/IndexOperation.md b/docs/reference/type-aliases/IndexOperation.md deleted file mode 100644 index 3dbce14d1..000000000 --- a/docs/reference/type-aliases/IndexOperation.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: IndexOperation -title: IndexOperation ---- - -# Type Alias: IndexOperation - -```ts -type IndexOperation = typeof comparisonFunctions[number]; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L11) - -Type for index operation values diff --git a/docs/reference/type-aliases/IndexResolver.md b/docs/reference/type-aliases/IndexResolver.md deleted file mode 100644 index 8dcd5c3e5..000000000 --- a/docs/reference/type-aliases/IndexResolver.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: IndexResolver -title: IndexResolver ---- - -# Type Alias: IndexResolver\ - -```ts -type IndexResolver = - | IndexConstructor -| () => Promise>; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L212) - -Index resolver can be either a class constructor or async loader - -## Type Parameters - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` diff --git a/docs/reference/type-aliases/InferResultType.md b/docs/reference/type-aliases/InferResultType.md deleted file mode 100644 index cb1dceaa3..000000000 --- a/docs/reference/type-aliases/InferResultType.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -id: InferResultType -title: InferResultType ---- - -# Type Alias: InferResultType\ - -```ts -type InferResultType = TContext extends SingleResult ? GetResult | undefined : GetResult[]; -``` - -Defined in: [packages/db/src/query/builder/types.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L631) - -Utility type to infer the query result size (single row or an array) - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/InferSchemaInput.md b/docs/reference/type-aliases/InferSchemaInput.md deleted file mode 100644 index 57dc50542..000000000 --- a/docs/reference/type-aliases/InferSchemaInput.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: InferSchemaInput -title: InferSchemaInput ---- - -# Type Alias: InferSchemaInput\ - -```ts -type InferSchemaInput = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record; -``` - -Defined in: [packages/db/src/types.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L24) - -**`Internal`** - -Helper type to extract the input type from a standard schema - - This is used for collection insert type inference - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/type-aliases/InferSchemaOutput.md b/docs/reference/type-aliases/InferSchemaOutput.md deleted file mode 100644 index 5bb8ccc91..000000000 --- a/docs/reference/type-aliases/InferSchemaOutput.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: InferSchemaOutput -title: InferSchemaOutput ---- - -# Type Alias: InferSchemaOutput\ - -```ts -type InferSchemaOutput = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record; -``` - -Defined in: [packages/db/src/types.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L13) - -**`Internal`** - -Helper type to extract the output type from a standard schema - - This is used by the type resolution system - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/type-aliases/InitialQueryBuilder.md b/docs/reference/type-aliases/InitialQueryBuilder.md deleted file mode 100644 index 0c3b8349b..000000000 --- a/docs/reference/type-aliases/InitialQueryBuilder.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: InitialQueryBuilder -title: InitialQueryBuilder ---- - -# Type Alias: InitialQueryBuilder - -```ts -type InitialQueryBuilder = Pick, "from">; -``` - -Defined in: [packages/db/src/query/builder/index.ts:820](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L820) diff --git a/docs/reference/type-aliases/InputRow.md b/docs/reference/type-aliases/InputRow.md deleted file mode 100644 index 950b9af2f..000000000 --- a/docs/reference/type-aliases/InputRow.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: InputRow -title: InputRow ---- - -# Type Alias: InputRow - -```ts -type InputRow = [unknown, Record]; -``` - -Defined in: [packages/db/src/types.ts:627](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L627) - -An input row from a collection diff --git a/docs/reference/type-aliases/InsertMutationFn.md b/docs/reference/type-aliases/InsertMutationFn.md deleted file mode 100644 index 62c812d71..000000000 --- a/docs/reference/type-aliases/InsertMutationFn.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: InsertMutationFn -title: InsertMutationFn ---- - -# Type Alias: InsertMutationFn()\ - -```ts -type InsertMutationFn = (params) => Promise; -``` - -Defined in: [packages/db/src/types.ts:335](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L335) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -### TReturn - -`TReturn` = `any` - -## Parameters - -### params - -[`InsertMutationFnParams`](../InsertMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> - -## Returns - -`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/InsertMutationFnParams.md b/docs/reference/type-aliases/InsertMutationFnParams.md deleted file mode 100644 index e17032a45..000000000 --- a/docs/reference/type-aliases/InsertMutationFnParams.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: InsertMutationFnParams -title: InsertMutationFnParams ---- - -# Type Alias: InsertMutationFnParams\ - -```ts -type InsertMutationFnParams = object; -``` - -Defined in: [packages/db/src/types.ts:318](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L318) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -## Properties - -### collection - -```ts -collection: Collection; -``` - -Defined in: [packages/db/src/types.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L324) - -*** - -### transaction - -```ts -transaction: TransactionWithMutations; -``` - -Defined in: [packages/db/src/types.ts:323](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L323) diff --git a/docs/reference/type-aliases/KeyedNamespacedRow.md b/docs/reference/type-aliases/KeyedNamespacedRow.md deleted file mode 100644 index 01348ec06..000000000 --- a/docs/reference/type-aliases/KeyedNamespacedRow.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -id: KeyedNamespacedRow -title: KeyedNamespacedRow ---- - -# Type Alias: KeyedNamespacedRow - -```ts -type KeyedNamespacedRow = [unknown, NamespacedRow]; -``` - -Defined in: [packages/db/src/types.ts:650](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L650) - -A keyed namespaced row is a row with a key and a namespaced row -This is the main representation of a row in a query pipeline diff --git a/docs/reference/type-aliases/KeyedStream.md b/docs/reference/type-aliases/KeyedStream.md deleted file mode 100644 index a979f48f5..000000000 --- a/docs/reference/type-aliases/KeyedStream.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -id: KeyedStream -title: KeyedStream ---- - -# Type Alias: KeyedStream - -```ts -type KeyedStream = IStreamBuilder; -``` - -Defined in: [packages/db/src/types.ts:633](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L633) - -A keyed stream is a stream of rows -This is used as the inputs from a collection to a query diff --git a/docs/reference/type-aliases/LiveQueryCollectionUtils.md b/docs/reference/type-aliases/LiveQueryCollectionUtils.md deleted file mode 100644 index f9dc2690d..000000000 --- a/docs/reference/type-aliases/LiveQueryCollectionUtils.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -id: LiveQueryCollectionUtils -title: LiveQueryCollectionUtils ---- - -# Type Alias: LiveQueryCollectionUtils - -```ts -type LiveQueryCollectionUtils = UtilsRecord & object; -``` - -Defined in: [packages/db/src/query/live/collection-config-builder.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/collection-config-builder.ts#L36) - -## Type Declaration - -### getBuilder() - -```ts -getBuilder: () => CollectionConfigBuilder; -``` - -#### Returns - -`CollectionConfigBuilder`\<`any`, `any`\> - -### getRunCount() - -```ts -getRunCount: () => number; -``` - -#### Returns - -`number` - -### getWindow() - -```ts -getWindow: () => - | { - limit: number; - offset: number; -} - | undefined; -``` - -Gets the current window (offset and limit) for an ordered query. - -#### Returns - - \| \{ - `limit`: `number`; - `offset`: `number`; -\} - \| `undefined` - -The current window settings, or `undefined` if the query is not windowed - -### setWindow() - -```ts -setWindow: (options) => true | Promise; -``` - -Sets the offset and limit of an ordered query. -Is a no-op if the query is not ordered. - -#### Parameters - -##### options - -`WindowOptions` - -#### Returns - -`true` \| `Promise`\<`void`\> - -`true` if no subset loading was triggered, or `Promise` that resolves when the subset has been loaded diff --git a/docs/reference/type-aliases/LoadSubsetFn.md b/docs/reference/type-aliases/LoadSubsetFn.md deleted file mode 100644 index 672b10849..000000000 --- a/docs/reference/type-aliases/LoadSubsetFn.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: LoadSubsetFn -title: LoadSubsetFn ---- - -# Type Alias: LoadSubsetFn() - -```ts -type LoadSubsetFn = (options) => true | Promise; -``` - -Defined in: [packages/db/src/types.ts:224](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L224) - -## Parameters - -### options - -[`LoadSubsetOptions`](../LoadSubsetOptions.md) - -## Returns - -`true` \| `Promise`\<`void`\> diff --git a/docs/reference/type-aliases/LoadSubsetOptions.md b/docs/reference/type-aliases/LoadSubsetOptions.md deleted file mode 100644 index 68130510e..000000000 --- a/docs/reference/type-aliases/LoadSubsetOptions.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -id: LoadSubsetOptions -title: LoadSubsetOptions ---- - -# Type Alias: LoadSubsetOptions - -```ts -type LoadSubsetOptions = object; -``` - -Defined in: [packages/db/src/types.ts:206](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L206) - -## Properties - -### limit? - -```ts -optional limit: number; -``` - -Defined in: [packages/db/src/types.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L212) - -The limit of the data to load - -*** - -### orderBy? - -```ts -optional orderBy: OrderBy; -``` - -Defined in: [packages/db/src/types.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L210) - -The order by clause to sort the data - -*** - -### subscription? - -```ts -optional subscription: Subscription; -``` - -Defined in: [packages/db/src/types.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L221) - -The subscription that triggered the load. -Advanced sync implementations can use this for: -- LRU caching keyed by subscription -- Reference counting to track active subscriptions -- Subscribing to subscription events (e.g., finalization/unsubscribe) - -#### Optional - -Available when called from CollectionSubscription, may be undefined for direct calls - -*** - -### where? - -```ts -optional where: BasicExpression; -``` - -Defined in: [packages/db/src/types.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L208) - -The where expression to filter the data diff --git a/docs/reference/type-aliases/MaybeSingleResult.md b/docs/reference/type-aliases/MaybeSingleResult.md deleted file mode 100644 index 7760f69d5..000000000 --- a/docs/reference/type-aliases/MaybeSingleResult.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: MaybeSingleResult -title: MaybeSingleResult ---- - -# Type Alias: MaybeSingleResult - -```ts -type MaybeSingleResult = object; -``` - -Defined in: [packages/db/src/types.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L605) - -## Properties - -### singleResult? - -```ts -optional singleResult: true; -``` - -Defined in: [packages/db/src/types.ts:609](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L609) - -If enabled the collection will return a single object instead of an array diff --git a/docs/reference/type-aliases/MutationFn.md b/docs/reference/type-aliases/MutationFn.md deleted file mode 100644 index 3e5d48e9e..000000000 --- a/docs/reference/type-aliases/MutationFn.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: MutationFn -title: MutationFn ---- - -# Type Alias: MutationFn()\ - -```ts -type MutationFn = (params) => Promise; -``` - -Defined in: [packages/db/src/types.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L95) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Parameters - -### params - -[`MutationFnParams`](../MutationFnParams.md)\<`T`\> - -## Returns - -`Promise`\<`any`\> diff --git a/docs/reference/type-aliases/MutationFnParams.md b/docs/reference/type-aliases/MutationFnParams.md deleted file mode 100644 index ed423fdbf..000000000 --- a/docs/reference/type-aliases/MutationFnParams.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: MutationFnParams -title: MutationFnParams ---- - -# Type Alias: MutationFnParams\ - -```ts -type MutationFnParams = object; -``` - -Defined in: [packages/db/src/types.ts:91](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L91) - -Configuration options for creating a new transaction - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -## Properties - -### transaction - -```ts -transaction: TransactionWithMutations; -``` - -Defined in: [packages/db/src/types.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L92) diff --git a/docs/reference/type-aliases/NamespacedAndKeyedStream.md b/docs/reference/type-aliases/NamespacedAndKeyedStream.md deleted file mode 100644 index c6aa2fb4d..000000000 --- a/docs/reference/type-aliases/NamespacedAndKeyedStream.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -id: NamespacedAndKeyedStream -title: NamespacedAndKeyedStream ---- - -# Type Alias: NamespacedAndKeyedStream - -```ts -type NamespacedAndKeyedStream = IStreamBuilder; -``` - -Defined in: [packages/db/src/types.ts:657](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L657) - -A namespaced and keyed stream is a stream of rows -This is used throughout a query pipeline and as the output from a query without -a `select` clause. diff --git a/docs/reference/type-aliases/NamespacedRow.md b/docs/reference/type-aliases/NamespacedRow.md deleted file mode 100644 index 6dceb7967..000000000 --- a/docs/reference/type-aliases/NamespacedRow.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: NamespacedRow -title: NamespacedRow ---- - -# Type Alias: NamespacedRow - -```ts -type NamespacedRow = Record>; -``` - -Defined in: [packages/db/src/types.ts:644](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L644) - -A namespaced row is a row withing a pipeline that had each table wrapped in its alias diff --git a/docs/reference/type-aliases/NonEmptyArray.md b/docs/reference/type-aliases/NonEmptyArray.md deleted file mode 100644 index 85f886519..000000000 --- a/docs/reference/type-aliases/NonEmptyArray.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -id: NonEmptyArray -title: NonEmptyArray ---- - -# Type Alias: NonEmptyArray\ - -```ts -type NonEmptyArray = [T, ...T[]]; -``` - -Defined in: [packages/db/src/types.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L102) - -Represents a non-empty array (at least one element) - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/type-aliases/NonSingleResult.md b/docs/reference/type-aliases/NonSingleResult.md deleted file mode 100644 index 18472c3c5..000000000 --- a/docs/reference/type-aliases/NonSingleResult.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: NonSingleResult -title: NonSingleResult ---- - -# Type Alias: NonSingleResult - -```ts -type NonSingleResult = object; -``` - -Defined in: [packages/db/src/types.ts:601](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L601) - -## Properties - -### singleResult? - -```ts -optional singleResult: never; -``` - -Defined in: [packages/db/src/types.ts:602](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L602) diff --git a/docs/reference/type-aliases/OperationType.md b/docs/reference/type-aliases/OperationType.md deleted file mode 100644 index 43893ca58..000000000 --- a/docs/reference/type-aliases/OperationType.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: OperationType -title: OperationType ---- - -# Type Alias: OperationType - -```ts -type OperationType = "insert" | "update" | "delete"; -``` - -Defined in: [packages/db/src/types.ts:152](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L152) diff --git a/docs/reference/type-aliases/QueryBuilder.md b/docs/reference/type-aliases/QueryBuilder.md deleted file mode 100644 index 95b56855d..000000000 --- a/docs/reference/type-aliases/QueryBuilder.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: QueryBuilder -title: QueryBuilder ---- - -# Type Alias: QueryBuilder\ - -```ts -type QueryBuilder = Omit, "from" | "_getQuery">; -``` - -Defined in: [packages/db/src/query/builder/index.ts:824](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L824) - -## Type Parameters - -### TContext - -`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/Ref.md b/docs/reference/type-aliases/Ref.md deleted file mode 100644 index 1340dc750..000000000 --- a/docs/reference/type-aliases/Ref.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -id: Ref -title: Ref ---- - -# Type Alias: Ref\ - -```ts -type Ref = { [K in keyof T]: IsNonExactOptional extends true ? IsNonExactNullable extends true ? IsPlainObject> extends true ? Ref> | undefined : RefLeaf> | undefined : IsPlainObject> extends true ? Ref> | undefined : RefLeaf> | undefined : IsNonExactNullable extends true ? IsPlainObject> extends true ? Ref> | null : RefLeaf> | null : IsPlainObject extends true ? Ref : RefLeaf } & RefLeaf; -``` - -Defined in: [packages/db/src/query/builder/types.ts:493](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L493) - -Ref - The user-facing ref interface for the query builder - -This is a clean type that represents a reference to a value in the query, -designed for optimal IDE experience without internal implementation details. -It provides a recursive interface that allows nested property access while -preserving optionality and nullability correctly. - -When spread in select clauses, it correctly produces the underlying data type -without Ref wrappers, enabling clean spread operations. - -Example usage: -```typescript -// Clean interface - no internal properties visible -const users: Ref<{ id: number; profile?: { bio: string } }> = { ... } -users.id // Ref - clean display -users.profile?.bio // Ref - nested optional access works - -// Spread operations work cleanly: -select(({ user }) => ({ ...user })) // Returns User type, not Ref types -``` - -## Type Parameters - -### T - -`T` = `any` diff --git a/docs/reference/type-aliases/ResolveTransactionChanges.md b/docs/reference/type-aliases/ResolveTransactionChanges.md deleted file mode 100644 index cbf36e6f8..000000000 --- a/docs/reference/type-aliases/ResolveTransactionChanges.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: ResolveTransactionChanges -title: ResolveTransactionChanges ---- - -# Type Alias: ResolveTransactionChanges\ - -```ts -type ResolveTransactionChanges = TOperation extends "delete" ? T : Partial; -``` - -Defined in: [packages/db/src/types.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L48) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TOperation - -`TOperation` *extends* [`OperationType`](../OperationType.md) = [`OperationType`](../OperationType.md) - -## Remarks - -`update` and `insert` are both represented as `Partial`, but changes for `insert` could me made more precise by inferring the schema input type. In practice, this has almost 0 real world impact so it's not worth the added type complexity. - -## See - -https://github.com/TanStack/db/pull/209#issuecomment-3053001206 diff --git a/docs/reference/type-aliases/ResultStream.md b/docs/reference/type-aliases/ResultStream.md deleted file mode 100644 index f61b629ac..000000000 --- a/docs/reference/type-aliases/ResultStream.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -id: ResultStream -title: ResultStream ---- - -# Type Alias: ResultStream - -```ts -type ResultStream = IStreamBuilder<[unknown, [any, string | undefined]]>; -``` - -Defined in: [packages/db/src/types.ts:639](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L639) - -Result stream type representing the output of compiled queries -Always returns [key, [result, orderByIndex]] where orderByIndex is undefined for unordered queries diff --git a/docs/reference/type-aliases/Row.md b/docs/reference/type-aliases/Row.md deleted file mode 100644 index 4473d7712..000000000 --- a/docs/reference/type-aliases/Row.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: Row -title: Row ---- - -# Type Alias: Row\ - -```ts -type Row = Record>; -``` - -Defined in: [packages/db/src/types.ts:150](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L150) - -## Type Parameters - -### TExtensions - -`TExtensions` = `never` diff --git a/docs/reference/type-aliases/SingleResult.md b/docs/reference/type-aliases/SingleResult.md deleted file mode 100644 index 5d7a47e42..000000000 --- a/docs/reference/type-aliases/SingleResult.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -id: SingleResult -title: SingleResult ---- - -# Type Alias: SingleResult - -```ts -type SingleResult = object; -``` - -Defined in: [packages/db/src/types.ts:597](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L597) - -## Properties - -### singleResult - -```ts -singleResult: true; -``` - -Defined in: [packages/db/src/types.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L598) diff --git a/docs/reference/type-aliases/Source.md b/docs/reference/type-aliases/Source.md deleted file mode 100644 index 3d5b59b01..000000000 --- a/docs/reference/type-aliases/Source.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: Source -title: Source ---- - -# Type Alias: Source - -```ts -type Source = object; -``` - -Defined in: [packages/db/src/query/builder/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L75) - -Source - Input definition for query builder `from()` clause - -Maps table aliases to either: -- `CollectionImpl`: A database collection/table -- `QueryBuilder`: A subquery that can be used as a table - -Example: `{ users: usersCollection, orders: ordersCollection }` - -## Index Signature - -```ts -[alias: string]: - | CollectionImpl, any> -| QueryBuilder -``` diff --git a/docs/reference/type-aliases/StandardSchema.md b/docs/reference/type-aliases/StandardSchema.md deleted file mode 100644 index fcdf7607c..000000000 --- a/docs/reference/type-aliases/StandardSchema.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -id: StandardSchema -title: StandardSchema ---- - -# Type Alias: StandardSchema\ - -```ts -type StandardSchema = StandardSchemaV1 & object; -``` - -Defined in: [packages/db/src/types.ts:283](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L283) - -The Standard Schema interface. -This follows the standard-schema specification: https://github.com/standard-schema/standard-schema - -## Type Declaration - -### ~standard - -```ts -~standard: object; -``` - -#### ~standard.types? - -```ts -optional types: object; -``` - -#### ~standard.types.input - -```ts -input: T; -``` - -#### ~standard.types.output - -```ts -output: T; -``` - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/type-aliases/StandardSchemaAlias.md b/docs/reference/type-aliases/StandardSchemaAlias.md deleted file mode 100644 index 7551f9bdb..000000000 --- a/docs/reference/type-aliases/StandardSchemaAlias.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -id: StandardSchemaAlias -title: StandardSchemaAlias ---- - -# Type Alias: StandardSchemaAlias\ - -```ts -type StandardSchemaAlias = StandardSchema; -``` - -Defined in: [packages/db/src/types.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L295) - -Type alias for StandardSchema - -## Type Parameters - -### T - -`T` = `unknown` diff --git a/docs/reference/type-aliases/StorageApi.md b/docs/reference/type-aliases/StorageApi.md deleted file mode 100644 index fde4dcad5..000000000 --- a/docs/reference/type-aliases/StorageApi.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: StorageApi -title: StorageApi ---- - -# Type Alias: StorageApi - -```ts -type StorageApi = Pick; -``` - -Defined in: [packages/db/src/local-storage.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L23) - -Storage API interface - subset of DOM Storage that we need diff --git a/docs/reference/type-aliases/StorageEventApi.md b/docs/reference/type-aliases/StorageEventApi.md deleted file mode 100644 index 4e3d8f10a..000000000 --- a/docs/reference/type-aliases/StorageEventApi.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: StorageEventApi -title: StorageEventApi ---- - -# Type Alias: StorageEventApi - -```ts -type StorageEventApi = object; -``` - -Defined in: [packages/db/src/local-storage.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L28) - -Storage event API - subset of Window for 'storage' events only - -## Properties - -### addEventListener() - -```ts -addEventListener: (type, listener) => void; -``` - -Defined in: [packages/db/src/local-storage.ts:29](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L29) - -#### Parameters - -##### type - -`"storage"` - -##### listener - -(`event`) => `void` - -#### Returns - -`void` - -*** - -### removeEventListener() - -```ts -removeEventListener: (type, listener) => void; -``` - -Defined in: [packages/db/src/local-storage.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L33) - -#### Parameters - -##### type - -`"storage"` - -##### listener - -(`event`) => `void` - -#### Returns - -`void` diff --git a/docs/reference/type-aliases/Strategy.md b/docs/reference/type-aliases/Strategy.md deleted file mode 100644 index 561cefb37..000000000 --- a/docs/reference/type-aliases/Strategy.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: Strategy -title: Strategy ---- - -# Type Alias: Strategy - -```ts -type Strategy = - | DebounceStrategy - | QueueStrategy - | ThrottleStrategy - | BatchStrategy; -``` - -Defined in: [packages/db/src/strategies/types.ts:113](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L113) - -Union type of all available strategies diff --git a/docs/reference/type-aliases/StrategyOptions.md b/docs/reference/type-aliases/StrategyOptions.md deleted file mode 100644 index e4b212030..000000000 --- a/docs/reference/type-aliases/StrategyOptions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -id: StrategyOptions -title: StrategyOptions ---- - -# Type Alias: StrategyOptions\ - -```ts -type StrategyOptions = T extends DebounceStrategy ? DebounceStrategyOptions : T extends QueueStrategy ? QueueStrategyOptions : T extends ThrottleStrategy ? ThrottleStrategyOptions : T extends BatchStrategy ? BatchStrategyOptions : never; -``` - -Defined in: [packages/db/src/strategies/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L122) - -Extract the options type from a strategy - -## Type Parameters - -### T - -`T` *extends* [`Strategy`](../Strategy.md) diff --git a/docs/reference/type-aliases/SubscriptionEvents.md b/docs/reference/type-aliases/SubscriptionEvents.md deleted file mode 100644 index 224829d18..000000000 --- a/docs/reference/type-aliases/SubscriptionEvents.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: SubscriptionEvents -title: SubscriptionEvents ---- - -# Type Alias: SubscriptionEvents - -```ts -type SubscriptionEvents = object; -``` - -Defined in: [packages/db/src/types.ts:190](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L190) - -All subscription events - -## Properties - -### status:change - -```ts -status:change: SubscriptionStatusChangeEvent; -``` - -Defined in: [packages/db/src/types.ts:191](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L191) - -*** - -### status:loadingSubset - -```ts -status:loadingSubset: SubscriptionStatusEvent<"loadingSubset">; -``` - -Defined in: [packages/db/src/types.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L193) - -*** - -### status:ready - -```ts -status:ready: SubscriptionStatusEvent<"ready">; -``` - -Defined in: [packages/db/src/types.ts:192](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L192) - -*** - -### unsubscribed - -```ts -unsubscribed: SubscriptionUnsubscribedEvent; -``` - -Defined in: [packages/db/src/types.ts:194](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L194) diff --git a/docs/reference/type-aliases/SubscriptionStatus.md b/docs/reference/type-aliases/SubscriptionStatus.md deleted file mode 100644 index 179b3e5dc..000000000 --- a/docs/reference/type-aliases/SubscriptionStatus.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: SubscriptionStatus -title: SubscriptionStatus ---- - -# Type Alias: SubscriptionStatus - -```ts -type SubscriptionStatus = "ready" | "loadingSubset"; -``` - -Defined in: [packages/db/src/types.ts:157](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L157) - -Subscription status values diff --git a/docs/reference/type-aliases/SyncConfigRes.md b/docs/reference/type-aliases/SyncConfigRes.md deleted file mode 100644 index 87c58dbce..000000000 --- a/docs/reference/type-aliases/SyncConfigRes.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: SyncConfigRes -title: SyncConfigRes ---- - -# Type Alias: SyncConfigRes - -```ts -type SyncConfigRes = object; -``` - -Defined in: [packages/db/src/types.ts:228](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L228) - -## Properties - -### cleanup? - -```ts -optional cleanup: CleanupFn; -``` - -Defined in: [packages/db/src/types.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L229) - -*** - -### loadSubset? - -```ts -optional loadSubset: LoadSubsetFn; -``` - -Defined in: [packages/db/src/types.ts:230](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L230) diff --git a/docs/reference/type-aliases/SyncMode.md b/docs/reference/type-aliases/SyncMode.md deleted file mode 100644 index 1f9614a96..000000000 --- a/docs/reference/type-aliases/SyncMode.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: SyncMode -title: SyncMode ---- - -# Type Alias: SyncMode - -```ts -type SyncMode = "eager" | "on-demand"; -``` - -Defined in: [packages/db/src/types.ts:383](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L383) diff --git a/docs/reference/type-aliases/TransactionState.md b/docs/reference/type-aliases/TransactionState.md deleted file mode 100644 index 9fb9ed6b2..000000000 --- a/docs/reference/type-aliases/TransactionState.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: TransactionState -title: TransactionState ---- - -# Type Alias: TransactionState - -```ts -type TransactionState = "pending" | "persisting" | "completed" | "failed"; -``` - -Defined in: [packages/db/src/types.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L30) diff --git a/docs/reference/type-aliases/TransactionWithMutations.md b/docs/reference/type-aliases/TransactionWithMutations.md deleted file mode 100644 index f442f136d..000000000 --- a/docs/reference/type-aliases/TransactionWithMutations.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: TransactionWithMutations -title: TransactionWithMutations ---- - -# Type Alias: TransactionWithMutations\ - -```ts -type TransactionWithMutations = Transaction & object; -``` - -Defined in: [packages/db/src/types.ts:108](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L108) - -Utility type for a Transaction with at least one mutation -This is used internally by the Transaction.commit method - -## Type Declaration - -### mutations - -```ts -mutations: NonEmptyArray>; -``` - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TOperation - -`TOperation` *extends* [`OperationType`](../OperationType.md) = [`OperationType`](../OperationType.md) diff --git a/docs/reference/type-aliases/UpdateMutationFn.md b/docs/reference/type-aliases/UpdateMutationFn.md deleted file mode 100644 index f58d1c6f4..000000000 --- a/docs/reference/type-aliases/UpdateMutationFn.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: UpdateMutationFn -title: UpdateMutationFn ---- - -# Type Alias: UpdateMutationFn()\ - -```ts -type UpdateMutationFn = (params) => Promise; -``` - -Defined in: [packages/db/src/types.ts:342](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L342) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -### TReturn - -`TReturn` = `any` - -## Parameters - -### params - -[`UpdateMutationFnParams`](../UpdateMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> - -## Returns - -`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/UpdateMutationFnParams.md b/docs/reference/type-aliases/UpdateMutationFnParams.md deleted file mode 100644 index 9fafe2e43..000000000 --- a/docs/reference/type-aliases/UpdateMutationFnParams.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: UpdateMutationFnParams -title: UpdateMutationFnParams ---- - -# Type Alias: UpdateMutationFnParams\ - -```ts -type UpdateMutationFnParams = object; -``` - -Defined in: [packages/db/src/types.ts:309](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L309) - -## Type Parameters - -### T - -`T` *extends* `object` = `Record`\<`string`, `unknown`\> - -### TKey - -`TKey` *extends* `string` \| `number` = `string` \| `number` - -### TUtils - -`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) - -## Properties - -### collection - -```ts -collection: Collection; -``` - -Defined in: [packages/db/src/types.ts:315](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L315) - -*** - -### transaction - -```ts -transaction: TransactionWithMutations; -``` - -Defined in: [packages/db/src/types.ts:314](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L314) diff --git a/docs/reference/type-aliases/UtilsRecord.md b/docs/reference/type-aliases/UtilsRecord.md deleted file mode 100644 index 9b694c349..000000000 --- a/docs/reference/type-aliases/UtilsRecord.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: UtilsRecord -title: UtilsRecord ---- - -# Type Alias: UtilsRecord - -```ts -type UtilsRecord = Record; -``` - -Defined in: [packages/db/src/types.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L40) - -A record of utility functions that can be attached to a collection diff --git a/docs/reference/type-aliases/WritableDeep.md b/docs/reference/type-aliases/WritableDeep.md deleted file mode 100644 index 342aea753..000000000 --- a/docs/reference/type-aliases/WritableDeep.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: WritableDeep -title: WritableDeep ---- - -# Type Alias: WritableDeep\ - -```ts -type WritableDeep = T extends BuiltIns ? T : T extends (...arguments_) => unknown ? object extends WritableObjectDeep ? T : HasMultipleCallSignatures extends true ? T : (...arguments_) => ReturnType & WritableObjectDeep : T extends ReadonlyMap ? WritableMapDeep : T extends ReadonlySet ? WritableSetDeep : T extends ReadonlyArray ? WritableArrayDeep : T extends object ? WritableObjectDeep : unknown; -``` - -Defined in: [packages/db/src/types.ts:777](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L777) - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/variables/IndexOperation.md b/docs/reference/variables/IndexOperation.md deleted file mode 100644 index e0ec16ffa..000000000 --- a/docs/reference/variables/IndexOperation.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: IndexOperation -title: IndexOperation ---- - -# Variable: IndexOperation - -```ts -const IndexOperation: readonly ["eq", "gt", "gte", "lt", "lte", "in", "like", "ilike"] = comparisonFunctions; -``` - -Defined in: [packages/db/src/indexes/base-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L11) - -Operations that indexes can support, imported from available comparison functions diff --git a/docs/reference/variables/Query.md b/docs/reference/variables/Query.md deleted file mode 100644 index 949fecdb5..000000000 --- a/docs/reference/variables/Query.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: Query -title: Query ---- - -# Variable: Query - -```ts -const Query: InitialQueryBuilderConstructor = BaseQueryBuilder; -``` - -Defined in: [packages/db/src/query/builder/index.ts:831](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L831) From 09be8e2caae6e8c967d11c963f4abc677c451155 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 5 Nov 2025 08:56:46 -0700 Subject: [PATCH 4/5] chore: Re-generate documentation after build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regenerated all documentation files after running full build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../namespaces/IR/classes/Aggregate.md | 104 ++ .../namespaces/IR/classes/CollectionRef.md | 98 + .../@tanstack/namespaces/IR/classes/Func.md | 104 ++ .../namespaces/IR/classes/PropRef.md | 90 + .../namespaces/IR/classes/QueryRef.md | 98 + .../@tanstack/namespaces/IR/classes/Value.md | 90 + .../IR/functions/createResidualWhere.md | 24 + .../namespaces/IR/functions/followRef.md | 47 + .../IR/functions/getHavingExpression.md | 28 + .../IR/functions/getWhereExpression.md | 24 + .../IR/functions/isExpressionLike.md | 25 + .../IR/functions/isResidualWhere.md | 24 + .../@tanstack/namespaces/IR/index.md | 44 + .../namespaces/IR/interfaces/JoinClause.md | 50 + .../namespaces/IR/interfaces/QueryIR.md | 178 ++ .../IR/type-aliases/BasicExpression.md | 21 + .../namespaces/IR/type-aliases/From.md | 14 + .../namespaces/IR/type-aliases/GroupBy.md | 12 + .../namespaces/IR/type-aliases/Having.md | 12 + .../namespaces/IR/type-aliases/Join.md | 12 + .../namespaces/IR/type-aliases/Limit.md | 12 + .../namespaces/IR/type-aliases/Offset.md | 12 + .../namespaces/IR/type-aliases/OrderBy.md | 12 + .../IR/type-aliases/OrderByClause.md | 32 + .../IR/type-aliases/OrderByDirection.md | 12 + .../namespaces/IR/type-aliases/Select.md | 21 + .../namespaces/IR/type-aliases/Where.md | 17 + .../AggregateFunctionNotInSelectError.md | 220 +++ .../classes/AggregateNotSupportedError.md | 216 +++ docs/reference/classes/BTreeIndex.md | 848 +++++++++ docs/reference/classes/BaseIndex.md | 760 ++++++++ docs/reference/classes/BaseQueryBuilder.md | 884 +++++++++ .../CannotCombineEmptyExpressionListError.md | 214 +++ .../classes/CollectionConfigurationError.md | 227 +++ docs/reference/classes/CollectionImpl.md | 1421 +++++++++++++++ .../classes/CollectionInErrorStateError.md | 224 +++ .../classes/CollectionInputNotFoundError.md | 234 +++ .../classes/CollectionIsInErrorStateError.md | 214 +++ .../classes/CollectionOperationError.md | 232 +++ .../classes/CollectionRequiresConfigError.md | 214 +++ .../CollectionRequiresSyncConfigError.md | 214 +++ .../reference/classes/CollectionStateError.md | 227 +++ .../classes/DeleteKeyNotFoundError.md | 220 +++ .../classes/DistinctRequiresSelectError.md | 214 +++ .../classes/DuplicateAliasInSubqueryError.md | 228 +++ .../classes/DuplicateDbInstanceError.md | 214 +++ docs/reference/classes/DuplicateKeyError.md | 220 +++ .../classes/DuplicateKeySyncError.md | 224 +++ .../classes/EmptyReferencePathError.md | 214 +++ docs/reference/classes/GroupByError.md | 227 +++ .../classes/HavingRequiresGroupByError.md | 214 +++ docs/reference/classes/IndexProxy.md | 346 ++++ .../InvalidCollectionStatusTransitionError.md | 231 +++ .../reference/classes/InvalidJoinCondition.md | 214 +++ .../InvalidJoinConditionLeftSourceError.md | 220 +++ .../InvalidJoinConditionRightSourceError.md | 220 +++ .../InvalidJoinConditionSameSourceError.md | 220 +++ ...InvalidJoinConditionSourceMismatchError.md | 214 +++ docs/reference/classes/InvalidSchemaError.md | 214 +++ docs/reference/classes/InvalidSourceError.md | 220 +++ .../classes/InvalidStorageDataFormatError.md | 224 +++ .../InvalidStorageObjectFormatError.md | 220 +++ .../classes/JoinCollectionNotFoundError.md | 220 +++ .../JoinConditionMustBeEqualityError.md | 214 +++ docs/reference/classes/JoinError.md | 230 +++ .../classes/KeyUpdateNotAllowedError.md | 224 +++ docs/reference/classes/LazyIndexWrapper.md | 158 ++ .../classes/LimitOffsetRequireOrderByError.md | 214 +++ .../classes/LocalStorageCollectionError.md | 226 +++ .../classes/MissingAliasInputsError.md | 223 +++ .../classes/MissingDeleteHandlerError.md | 214 +++ docs/reference/classes/MissingHandlerError.md | 226 +++ .../classes/MissingInsertHandlerError.md | 214 +++ .../classes/MissingMutationFunctionError.md | 214 +++ .../classes/MissingUpdateArgumentError.md | 214 +++ .../classes/MissingUpdateHandlerError.md | 214 +++ .../classes/NegativeActiveSubscribersError.md | 214 +++ .../classes/NoKeysPassedToDeleteError.md | 214 +++ .../classes/NoKeysPassedToUpdateError.md | 214 +++ .../NoPendingSyncTransactionCommitError.md | 214 +++ .../NoPendingSyncTransactionWriteError.md | 214 +++ ...NonAggregateExpressionNotInGroupByError.md | 220 +++ docs/reference/classes/NonRetriableError.md | 220 +++ .../classes/OnMutateMustBeSynchronousError.md | 214 +++ .../classes/OnlyOneSourceAllowedError.md | 220 +++ docs/reference/classes/QueryBuilderError.md | 228 +++ .../classes/QueryCompilationError.md | 237 +++ .../classes/QueryMustHaveFromClauseError.md | 214 +++ docs/reference/classes/QueryOptimizerError.md | 225 +++ .../classes/SchemaMustBeSynchronousError.md | 214 +++ .../classes/SchemaValidationError.md | 251 +++ docs/reference/classes/SerializationError.md | 224 +++ .../classes/SetWindowRequiresOrderByError.md | 216 +++ docs/reference/classes/SortedMap.md | 288 +++ docs/reference/classes/StorageError.md | 225 +++ .../classes/StorageKeyRequiredError.md | 214 +++ .../SubQueryMustHaveFromClauseError.md | 220 +++ .../classes/SubscriptionNotFoundError.md | 239 +++ docs/reference/classes/SyncCleanupError.md | 224 +++ .../SyncTransactionAlreadyCommittedError.md | 214 +++ ...ncTransactionAlreadyCommittedWriteError.md | 214 +++ docs/reference/classes/TanStackDBError.md | 254 +++ ...ransactionAlreadyCompletedRollbackError.md | 214 +++ docs/reference/classes/TransactionError.md | 232 +++ .../TransactionNotPendingCommitError.md | 214 +++ .../TransactionNotPendingMutateError.md | 214 +++ docs/reference/classes/UndefinedKeyError.md | 220 +++ .../classes/UnknownExpressionTypeError.md | 220 +++ .../reference/classes/UnknownFunctionError.md | 220 +++ .../UnknownHavingExpressionTypeError.md | 220 +++ .../UnsupportedAggregateFunctionError.md | 220 +++ .../classes/UnsupportedFromTypeError.md | 220 +++ .../classes/UnsupportedJoinSourceTypeError.md | 220 +++ .../classes/UnsupportedJoinTypeError.md | 220 +++ .../classes/UpdateKeyNotFoundError.md | 220 +++ .../classes/WhereClauseConversionError.md | 226 +++ docs/reference/functions/add.md | 36 + docs/reference/functions/and.md | 57 + docs/reference/functions/avg.md | 28 + docs/reference/functions/coalesce.md | 22 + docs/reference/functions/compileQuery.md | 90 + docs/reference/functions/concat.md | 22 + docs/reference/functions/count.md | 22 + .../functions/createArrayChangeProxy.md | 50 + docs/reference/functions/createChangeProxy.md | 62 + docs/reference/functions/createCollection.md | 442 +++++ .../functions/createLiveQueryCollection.md | 137 ++ .../functions/createOptimisticAction.md | 90 + .../functions/createPacedMutations.md | 98 + docs/reference/functions/createTransaction.md | 87 + docs/reference/functions/debounceStrategy.md | 46 + docs/reference/functions/eq.md | 90 + .../functions/getActiveTransaction.md | 34 + docs/reference/functions/gt.md | 90 + docs/reference/functions/gte.md | 90 + docs/reference/functions/ilike.md | 26 + docs/reference/functions/inArray.md | 26 + docs/reference/functions/isNull.md | 22 + docs/reference/functions/isUndefined.md | 22 + docs/reference/functions/length.md | 28 + docs/reference/functions/like.md | 26 + .../functions/liveQueryCollectionOptions.md | 59 + .../functions/localOnlyCollectionOptions.md | 230 +++ .../localStorageCollectionOptions.md | 236 +++ docs/reference/functions/lower.md | 28 + docs/reference/functions/lt.md | 90 + docs/reference/functions/lte.md | 90 + docs/reference/functions/max.md | 28 + docs/reference/functions/min.md | 28 + docs/reference/functions/not.md | 22 + docs/reference/functions/or.md | 57 + docs/reference/functions/queueStrategy.md | 63 + docs/reference/functions/sum.md | 28 + docs/reference/functions/throttleStrategy.md | 65 + docs/reference/functions/upper.md | 28 + .../functions/withArrayChangeTracking.md | 41 + .../reference/functions/withChangeTracking.md | 41 + docs/reference/index.md | 253 +++ .../reference/interfaces/BTreeIndexOptions.md | 44 + .../interfaces/BaseCollectionConfig.md | 412 +++++ docs/reference/interfaces/BaseStrategy.md | 83 + docs/reference/interfaces/ChangeMessage.md | 72 + docs/reference/interfaces/Collection.md | 1584 +++++++++++++++++ docs/reference/interfaces/CollectionConfig.md | 465 +++++ docs/reference/interfaces/Context.md | 99 ++ .../CreateOptimisticActionsOptions.md | 122 ++ .../CurrentStateAsChangesOptions.md | 52 + docs/reference/interfaces/DebounceStrategy.md | 97 + .../interfaces/DebounceStrategyOptions.md | 47 + docs/reference/interfaces/IndexInterface.md | 458 +++++ docs/reference/interfaces/IndexOptions.md | 46 + docs/reference/interfaces/IndexStats.md | 50 + docs/reference/interfaces/InsertConfig.md | 30 + .../interfaces/LiveQueryCollectionConfig.md | 172 ++ .../interfaces/LocalOnlyCollectionConfig.md | 442 +++++ .../interfaces/LocalOnlyCollectionUtils.md | 62 + .../LocalStorageCollectionConfig.md | 510 ++++++ .../interfaces/LocalStorageCollectionUtils.md | 82 + docs/reference/interfaces/OperationConfig.md | 30 + .../interfaces/OptimisticChangeMessage.md | 98 + .../interfaces/PacedMutationsConfig.md | 81 + docs/reference/interfaces/Parser.md | 48 + docs/reference/interfaces/PendingMutation.md | 157 ++ docs/reference/interfaces/QueueStrategy.md | 99 ++ .../interfaces/QueueStrategyOptions.md | 59 + .../reference/interfaces/RangeQueryOptions.md | 50 + .../interfaces/SubscribeChangesOptions.md | 34 + .../SubscribeChangesSnapshotOptions.md | 48 + docs/reference/interfaces/Subscription.md | 280 +++ .../SubscriptionStatusChangeEvent.md | 50 + .../interfaces/SubscriptionStatusEvent.md | 56 + .../SubscriptionUnsubscribedEvent.md | 30 + docs/reference/interfaces/SyncConfig.md | 104 ++ docs/reference/interfaces/ThrottleStrategy.md | 97 + .../interfaces/ThrottleStrategyOptions.md | 47 + docs/reference/interfaces/Transaction.md | 417 +++++ .../reference/interfaces/TransactionConfig.md | 58 + .../classes/PowerSyncTransactor.md | 240 +++ .../functions/powerSyncCollectionOptions.md | 213 +++ .../powersync-db-collection/index.md | 33 + .../BasePowerSyncCollectionConfig.md | 58 + .../ConfigWithArbitraryCollectionTypes.md | 62 + .../type-aliases/ConfigWithSQLiteInputType.md | 33 + .../type-aliases/ConfigWithSQLiteTypes.md | 14 + .../type-aliases/CustomSQLiteSerializer.md | 48 + .../EnhancedPowerSyncCollectionConfig.md | 48 + .../type-aliases/InferPowerSyncOutputType.md | 26 + .../type-aliases/PowerSyncCollectionConfig.md | 51 + .../type-aliases/PowerSyncCollectionMeta.md | 66 + .../type-aliases/PowerSyncCollectionUtils.md | 34 + .../type-aliases/SerializerConfig.md | 77 + .../type-aliases/TransactorOptions.md | 22 + .../variables/DEFAULT_BATCH_SIZE.md | 14 + docs/reference/type-aliases/ChangeListener.md | 68 + docs/reference/type-aliases/ChangesPayload.md | 18 + docs/reference/type-aliases/CleanupFn.md | 16 + docs/reference/type-aliases/ClearStorageFn.md | 18 + .../CollectionConfigSingleRowOption.md | 31 + .../type-aliases/CollectionStatus.md | 31 + .../type-aliases/DeleteMutationFn.md | 40 + .../type-aliases/DeleteMutationFnParams.md | 46 + docs/reference/type-aliases/Fn.md | 24 + docs/reference/type-aliases/GetResult.md | 42 + .../type-aliases/GetStorageSizeFn.md | 18 + .../type-aliases/IndexConstructor.md | 42 + docs/reference/type-aliases/IndexOperation.md | 14 + docs/reference/type-aliases/IndexResolver.md | 22 + .../reference/type-aliases/InferResultType.md | 20 + .../type-aliases/InferSchemaInput.md | 24 + .../type-aliases/InferSchemaOutput.md | 24 + .../type-aliases/InitialQueryBuilder.md | 12 + docs/reference/type-aliases/InputRow.md | 14 + .../type-aliases/InsertMutationFn.md | 40 + .../type-aliases/InsertMutationFnParams.md | 46 + .../type-aliases/KeyedNamespacedRow.md | 15 + docs/reference/type-aliases/KeyedStream.md | 15 + .../type-aliases/LiveQueryCollectionUtils.md | 78 + docs/reference/type-aliases/LoadSubsetFn.md | 22 + .../type-aliases/LoadSubsetOptions.md | 68 + .../type-aliases/MaybeSingleResult.md | 24 + docs/reference/type-aliases/MutationFn.md | 28 + .../type-aliases/MutationFnParams.md | 30 + .../type-aliases/NamespacedAndKeyedStream.md | 16 + docs/reference/type-aliases/NamespacedRow.md | 14 + docs/reference/type-aliases/NonEmptyArray.md | 20 + .../reference/type-aliases/NonSingleResult.md | 22 + docs/reference/type-aliases/OperationType.md | 12 + docs/reference/type-aliases/QueryBuilder.md | 18 + docs/reference/type-aliases/Ref.md | 39 + .../type-aliases/ResolveTransactionChanges.md | 30 + docs/reference/type-aliases/ResultStream.md | 15 + docs/reference/type-aliases/Row.md | 18 + docs/reference/type-aliases/SingleResult.md | 22 + docs/reference/type-aliases/Source.md | 29 + docs/reference/type-aliases/StandardSchema.md | 47 + .../type-aliases/StandardSchemaAlias.md | 20 + docs/reference/type-aliases/StorageApi.md | 14 + .../reference/type-aliases/StorageEventApi.md | 62 + docs/reference/type-aliases/Strategy.md | 18 + .../reference/type-aliases/StrategyOptions.md | 20 + .../type-aliases/SubscriptionEvents.md | 54 + .../type-aliases/SubscriptionStatus.md | 14 + docs/reference/type-aliases/SyncConfigRes.md | 32 + docs/reference/type-aliases/SyncMode.md | 12 + .../type-aliases/TransactionState.md | 12 + .../type-aliases/TransactionWithMutations.md | 33 + .../type-aliases/UpdateMutationFn.md | 40 + .../type-aliases/UpdateMutationFnParams.md | 46 + docs/reference/type-aliases/UtilsRecord.md | 14 + docs/reference/type-aliases/WritableDeep.md | 18 + docs/reference/variables/IndexOperation.md | 14 + docs/reference/variables/Query.md | 12 + 272 files changed, 36582 insertions(+) create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Func.md create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/PropRef.md create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md create mode 100644 docs/reference/@tanstack/namespaces/IR/classes/Value.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/followRef.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md create mode 100644 docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md create mode 100644 docs/reference/@tanstack/namespaces/IR/index.md create mode 100644 docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md create mode 100644 docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/From.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md create mode 100644 docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md create mode 100644 docs/reference/classes/AggregateFunctionNotInSelectError.md create mode 100644 docs/reference/classes/AggregateNotSupportedError.md create mode 100644 docs/reference/classes/BTreeIndex.md create mode 100644 docs/reference/classes/BaseIndex.md create mode 100644 docs/reference/classes/BaseQueryBuilder.md create mode 100644 docs/reference/classes/CannotCombineEmptyExpressionListError.md create mode 100644 docs/reference/classes/CollectionConfigurationError.md create mode 100644 docs/reference/classes/CollectionImpl.md create mode 100644 docs/reference/classes/CollectionInErrorStateError.md create mode 100644 docs/reference/classes/CollectionInputNotFoundError.md create mode 100644 docs/reference/classes/CollectionIsInErrorStateError.md create mode 100644 docs/reference/classes/CollectionOperationError.md create mode 100644 docs/reference/classes/CollectionRequiresConfigError.md create mode 100644 docs/reference/classes/CollectionRequiresSyncConfigError.md create mode 100644 docs/reference/classes/CollectionStateError.md create mode 100644 docs/reference/classes/DeleteKeyNotFoundError.md create mode 100644 docs/reference/classes/DistinctRequiresSelectError.md create mode 100644 docs/reference/classes/DuplicateAliasInSubqueryError.md create mode 100644 docs/reference/classes/DuplicateDbInstanceError.md create mode 100644 docs/reference/classes/DuplicateKeyError.md create mode 100644 docs/reference/classes/DuplicateKeySyncError.md create mode 100644 docs/reference/classes/EmptyReferencePathError.md create mode 100644 docs/reference/classes/GroupByError.md create mode 100644 docs/reference/classes/HavingRequiresGroupByError.md create mode 100644 docs/reference/classes/IndexProxy.md create mode 100644 docs/reference/classes/InvalidCollectionStatusTransitionError.md create mode 100644 docs/reference/classes/InvalidJoinCondition.md create mode 100644 docs/reference/classes/InvalidJoinConditionLeftSourceError.md create mode 100644 docs/reference/classes/InvalidJoinConditionRightSourceError.md create mode 100644 docs/reference/classes/InvalidJoinConditionSameSourceError.md create mode 100644 docs/reference/classes/InvalidJoinConditionSourceMismatchError.md create mode 100644 docs/reference/classes/InvalidSchemaError.md create mode 100644 docs/reference/classes/InvalidSourceError.md create mode 100644 docs/reference/classes/InvalidStorageDataFormatError.md create mode 100644 docs/reference/classes/InvalidStorageObjectFormatError.md create mode 100644 docs/reference/classes/JoinCollectionNotFoundError.md create mode 100644 docs/reference/classes/JoinConditionMustBeEqualityError.md create mode 100644 docs/reference/classes/JoinError.md create mode 100644 docs/reference/classes/KeyUpdateNotAllowedError.md create mode 100644 docs/reference/classes/LazyIndexWrapper.md create mode 100644 docs/reference/classes/LimitOffsetRequireOrderByError.md create mode 100644 docs/reference/classes/LocalStorageCollectionError.md create mode 100644 docs/reference/classes/MissingAliasInputsError.md create mode 100644 docs/reference/classes/MissingDeleteHandlerError.md create mode 100644 docs/reference/classes/MissingHandlerError.md create mode 100644 docs/reference/classes/MissingInsertHandlerError.md create mode 100644 docs/reference/classes/MissingMutationFunctionError.md create mode 100644 docs/reference/classes/MissingUpdateArgumentError.md create mode 100644 docs/reference/classes/MissingUpdateHandlerError.md create mode 100644 docs/reference/classes/NegativeActiveSubscribersError.md create mode 100644 docs/reference/classes/NoKeysPassedToDeleteError.md create mode 100644 docs/reference/classes/NoKeysPassedToUpdateError.md create mode 100644 docs/reference/classes/NoPendingSyncTransactionCommitError.md create mode 100644 docs/reference/classes/NoPendingSyncTransactionWriteError.md create mode 100644 docs/reference/classes/NonAggregateExpressionNotInGroupByError.md create mode 100644 docs/reference/classes/NonRetriableError.md create mode 100644 docs/reference/classes/OnMutateMustBeSynchronousError.md create mode 100644 docs/reference/classes/OnlyOneSourceAllowedError.md create mode 100644 docs/reference/classes/QueryBuilderError.md create mode 100644 docs/reference/classes/QueryCompilationError.md create mode 100644 docs/reference/classes/QueryMustHaveFromClauseError.md create mode 100644 docs/reference/classes/QueryOptimizerError.md create mode 100644 docs/reference/classes/SchemaMustBeSynchronousError.md create mode 100644 docs/reference/classes/SchemaValidationError.md create mode 100644 docs/reference/classes/SerializationError.md create mode 100644 docs/reference/classes/SetWindowRequiresOrderByError.md create mode 100644 docs/reference/classes/SortedMap.md create mode 100644 docs/reference/classes/StorageError.md create mode 100644 docs/reference/classes/StorageKeyRequiredError.md create mode 100644 docs/reference/classes/SubQueryMustHaveFromClauseError.md create mode 100644 docs/reference/classes/SubscriptionNotFoundError.md create mode 100644 docs/reference/classes/SyncCleanupError.md create mode 100644 docs/reference/classes/SyncTransactionAlreadyCommittedError.md create mode 100644 docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md create mode 100644 docs/reference/classes/TanStackDBError.md create mode 100644 docs/reference/classes/TransactionAlreadyCompletedRollbackError.md create mode 100644 docs/reference/classes/TransactionError.md create mode 100644 docs/reference/classes/TransactionNotPendingCommitError.md create mode 100644 docs/reference/classes/TransactionNotPendingMutateError.md create mode 100644 docs/reference/classes/UndefinedKeyError.md create mode 100644 docs/reference/classes/UnknownExpressionTypeError.md create mode 100644 docs/reference/classes/UnknownFunctionError.md create mode 100644 docs/reference/classes/UnknownHavingExpressionTypeError.md create mode 100644 docs/reference/classes/UnsupportedAggregateFunctionError.md create mode 100644 docs/reference/classes/UnsupportedFromTypeError.md create mode 100644 docs/reference/classes/UnsupportedJoinSourceTypeError.md create mode 100644 docs/reference/classes/UnsupportedJoinTypeError.md create mode 100644 docs/reference/classes/UpdateKeyNotFoundError.md create mode 100644 docs/reference/classes/WhereClauseConversionError.md create mode 100644 docs/reference/functions/add.md create mode 100644 docs/reference/functions/and.md create mode 100644 docs/reference/functions/avg.md create mode 100644 docs/reference/functions/coalesce.md create mode 100644 docs/reference/functions/compileQuery.md create mode 100644 docs/reference/functions/concat.md create mode 100644 docs/reference/functions/count.md create mode 100644 docs/reference/functions/createArrayChangeProxy.md create mode 100644 docs/reference/functions/createChangeProxy.md create mode 100644 docs/reference/functions/createCollection.md create mode 100644 docs/reference/functions/createLiveQueryCollection.md create mode 100644 docs/reference/functions/createOptimisticAction.md create mode 100644 docs/reference/functions/createPacedMutations.md create mode 100644 docs/reference/functions/createTransaction.md create mode 100644 docs/reference/functions/debounceStrategy.md create mode 100644 docs/reference/functions/eq.md create mode 100644 docs/reference/functions/getActiveTransaction.md create mode 100644 docs/reference/functions/gt.md create mode 100644 docs/reference/functions/gte.md create mode 100644 docs/reference/functions/ilike.md create mode 100644 docs/reference/functions/inArray.md create mode 100644 docs/reference/functions/isNull.md create mode 100644 docs/reference/functions/isUndefined.md create mode 100644 docs/reference/functions/length.md create mode 100644 docs/reference/functions/like.md create mode 100644 docs/reference/functions/liveQueryCollectionOptions.md create mode 100644 docs/reference/functions/localOnlyCollectionOptions.md create mode 100644 docs/reference/functions/localStorageCollectionOptions.md create mode 100644 docs/reference/functions/lower.md create mode 100644 docs/reference/functions/lt.md create mode 100644 docs/reference/functions/lte.md create mode 100644 docs/reference/functions/max.md create mode 100644 docs/reference/functions/min.md create mode 100644 docs/reference/functions/not.md create mode 100644 docs/reference/functions/or.md create mode 100644 docs/reference/functions/queueStrategy.md create mode 100644 docs/reference/functions/sum.md create mode 100644 docs/reference/functions/throttleStrategy.md create mode 100644 docs/reference/functions/upper.md create mode 100644 docs/reference/functions/withArrayChangeTracking.md create mode 100644 docs/reference/functions/withChangeTracking.md create mode 100644 docs/reference/index.md create mode 100644 docs/reference/interfaces/BTreeIndexOptions.md create mode 100644 docs/reference/interfaces/BaseCollectionConfig.md create mode 100644 docs/reference/interfaces/BaseStrategy.md create mode 100644 docs/reference/interfaces/ChangeMessage.md create mode 100644 docs/reference/interfaces/Collection.md create mode 100644 docs/reference/interfaces/CollectionConfig.md create mode 100644 docs/reference/interfaces/Context.md create mode 100644 docs/reference/interfaces/CreateOptimisticActionsOptions.md create mode 100644 docs/reference/interfaces/CurrentStateAsChangesOptions.md create mode 100644 docs/reference/interfaces/DebounceStrategy.md create mode 100644 docs/reference/interfaces/DebounceStrategyOptions.md create mode 100644 docs/reference/interfaces/IndexInterface.md create mode 100644 docs/reference/interfaces/IndexOptions.md create mode 100644 docs/reference/interfaces/IndexStats.md create mode 100644 docs/reference/interfaces/InsertConfig.md create mode 100644 docs/reference/interfaces/LiveQueryCollectionConfig.md create mode 100644 docs/reference/interfaces/LocalOnlyCollectionConfig.md create mode 100644 docs/reference/interfaces/LocalOnlyCollectionUtils.md create mode 100644 docs/reference/interfaces/LocalStorageCollectionConfig.md create mode 100644 docs/reference/interfaces/LocalStorageCollectionUtils.md create mode 100644 docs/reference/interfaces/OperationConfig.md create mode 100644 docs/reference/interfaces/OptimisticChangeMessage.md create mode 100644 docs/reference/interfaces/PacedMutationsConfig.md create mode 100644 docs/reference/interfaces/Parser.md create mode 100644 docs/reference/interfaces/PendingMutation.md create mode 100644 docs/reference/interfaces/QueueStrategy.md create mode 100644 docs/reference/interfaces/QueueStrategyOptions.md create mode 100644 docs/reference/interfaces/RangeQueryOptions.md create mode 100644 docs/reference/interfaces/SubscribeChangesOptions.md create mode 100644 docs/reference/interfaces/SubscribeChangesSnapshotOptions.md create mode 100644 docs/reference/interfaces/Subscription.md create mode 100644 docs/reference/interfaces/SubscriptionStatusChangeEvent.md create mode 100644 docs/reference/interfaces/SubscriptionStatusEvent.md create mode 100644 docs/reference/interfaces/SubscriptionUnsubscribedEvent.md create mode 100644 docs/reference/interfaces/SyncConfig.md create mode 100644 docs/reference/interfaces/ThrottleStrategy.md create mode 100644 docs/reference/interfaces/ThrottleStrategyOptions.md create mode 100644 docs/reference/interfaces/Transaction.md create mode 100644 docs/reference/interfaces/TransactionConfig.md create mode 100644 docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md create mode 100644 docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md create mode 100644 docs/reference/powersync-db-collection/index.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md create mode 100644 docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md create mode 100644 docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md create mode 100644 docs/reference/type-aliases/ChangeListener.md create mode 100644 docs/reference/type-aliases/ChangesPayload.md create mode 100644 docs/reference/type-aliases/CleanupFn.md create mode 100644 docs/reference/type-aliases/ClearStorageFn.md create mode 100644 docs/reference/type-aliases/CollectionConfigSingleRowOption.md create mode 100644 docs/reference/type-aliases/CollectionStatus.md create mode 100644 docs/reference/type-aliases/DeleteMutationFn.md create mode 100644 docs/reference/type-aliases/DeleteMutationFnParams.md create mode 100644 docs/reference/type-aliases/Fn.md create mode 100644 docs/reference/type-aliases/GetResult.md create mode 100644 docs/reference/type-aliases/GetStorageSizeFn.md create mode 100644 docs/reference/type-aliases/IndexConstructor.md create mode 100644 docs/reference/type-aliases/IndexOperation.md create mode 100644 docs/reference/type-aliases/IndexResolver.md create mode 100644 docs/reference/type-aliases/InferResultType.md create mode 100644 docs/reference/type-aliases/InferSchemaInput.md create mode 100644 docs/reference/type-aliases/InferSchemaOutput.md create mode 100644 docs/reference/type-aliases/InitialQueryBuilder.md create mode 100644 docs/reference/type-aliases/InputRow.md create mode 100644 docs/reference/type-aliases/InsertMutationFn.md create mode 100644 docs/reference/type-aliases/InsertMutationFnParams.md create mode 100644 docs/reference/type-aliases/KeyedNamespacedRow.md create mode 100644 docs/reference/type-aliases/KeyedStream.md create mode 100644 docs/reference/type-aliases/LiveQueryCollectionUtils.md create mode 100644 docs/reference/type-aliases/LoadSubsetFn.md create mode 100644 docs/reference/type-aliases/LoadSubsetOptions.md create mode 100644 docs/reference/type-aliases/MaybeSingleResult.md create mode 100644 docs/reference/type-aliases/MutationFn.md create mode 100644 docs/reference/type-aliases/MutationFnParams.md create mode 100644 docs/reference/type-aliases/NamespacedAndKeyedStream.md create mode 100644 docs/reference/type-aliases/NamespacedRow.md create mode 100644 docs/reference/type-aliases/NonEmptyArray.md create mode 100644 docs/reference/type-aliases/NonSingleResult.md create mode 100644 docs/reference/type-aliases/OperationType.md create mode 100644 docs/reference/type-aliases/QueryBuilder.md create mode 100644 docs/reference/type-aliases/Ref.md create mode 100644 docs/reference/type-aliases/ResolveTransactionChanges.md create mode 100644 docs/reference/type-aliases/ResultStream.md create mode 100644 docs/reference/type-aliases/Row.md create mode 100644 docs/reference/type-aliases/SingleResult.md create mode 100644 docs/reference/type-aliases/Source.md create mode 100644 docs/reference/type-aliases/StandardSchema.md create mode 100644 docs/reference/type-aliases/StandardSchemaAlias.md create mode 100644 docs/reference/type-aliases/StorageApi.md create mode 100644 docs/reference/type-aliases/StorageEventApi.md create mode 100644 docs/reference/type-aliases/Strategy.md create mode 100644 docs/reference/type-aliases/StrategyOptions.md create mode 100644 docs/reference/type-aliases/SubscriptionEvents.md create mode 100644 docs/reference/type-aliases/SubscriptionStatus.md create mode 100644 docs/reference/type-aliases/SyncConfigRes.md create mode 100644 docs/reference/type-aliases/SyncMode.md create mode 100644 docs/reference/type-aliases/TransactionState.md create mode 100644 docs/reference/type-aliases/TransactionWithMutations.md create mode 100644 docs/reference/type-aliases/UpdateMutationFn.md create mode 100644 docs/reference/type-aliases/UpdateMutationFnParams.md create mode 100644 docs/reference/type-aliases/UtilsRecord.md create mode 100644 docs/reference/type-aliases/WritableDeep.md create mode 100644 docs/reference/variables/IndexOperation.md create mode 100644 docs/reference/variables/Query.md diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md b/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md new file mode 100644 index 000000000..7a9758d72 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/Aggregate.md @@ -0,0 +1,104 @@ +--- +id: Aggregate +title: Aggregate +--- + +# Class: Aggregate\ + +Defined in: [packages/db/src/query/ir.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L125) + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new Aggregate(name, args): Aggregate; +``` + +Defined in: [packages/db/src/query/ir.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L127) + +#### Parameters + +##### name + +`string` + +##### args + +[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\>[] + +#### Returns + +`Aggregate`\<`T`\> + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: T; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### args + +```ts +args: BasicExpression[]; +``` + +Defined in: [packages/db/src/query/ir.ts:129](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L129) + +*** + +### name + +```ts +name: string; +``` + +Defined in: [packages/db/src/query/ir.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L128) + +*** + +### type + +```ts +type: "agg"; +``` + +Defined in: [packages/db/src/query/ir.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L126) + +#### Overrides + +```ts +BaseExpression.type +``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md b/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md new file mode 100644 index 000000000..0d820a8b1 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/CollectionRef.md @@ -0,0 +1,98 @@ +--- +id: CollectionRef +title: CollectionRef +--- + +# Class: CollectionRef + +Defined in: [packages/db/src/query/ir.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L72) + +## Extends + +- `BaseExpression` + +## Constructors + +### Constructor + +```ts +new CollectionRef(collection, alias): CollectionRef; +``` + +Defined in: [packages/db/src/query/ir.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L74) + +#### Parameters + +##### collection + +[`CollectionImpl`](../../../../../classes/CollectionImpl.md) + +##### alias + +`string` + +#### Returns + +`CollectionRef` + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: any; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### alias + +```ts +alias: string; +``` + +Defined in: [packages/db/src/query/ir.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L76) + +*** + +### collection + +```ts +collection: CollectionImpl; +``` + +Defined in: [packages/db/src/query/ir.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L75) + +*** + +### type + +```ts +type: "collectionRef"; +``` + +Defined in: [packages/db/src/query/ir.ts:73](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L73) + +#### Overrides + +```ts +BaseExpression.type +``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Func.md b/docs/reference/@tanstack/namespaces/IR/classes/Func.md new file mode 100644 index 000000000..3550d8362 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/Func.md @@ -0,0 +1,104 @@ +--- +id: Func +title: Func +--- + +# Class: Func\ + +Defined in: [packages/db/src/query/ir.ts:110](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L110) + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new Func(name, args): Func; +``` + +Defined in: [packages/db/src/query/ir.ts:112](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L112) + +#### Parameters + +##### name + +`string` + +##### args + +[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\>[] + +#### Returns + +`Func`\<`T`\> + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: T; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### args + +```ts +args: BasicExpression[]; +``` + +Defined in: [packages/db/src/query/ir.ts:114](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L114) + +*** + +### name + +```ts +name: string; +``` + +Defined in: [packages/db/src/query/ir.ts:113](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L113) + +*** + +### type + +```ts +type: "func"; +``` + +Defined in: [packages/db/src/query/ir.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L111) + +#### Overrides + +```ts +BaseExpression.type +``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md b/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md new file mode 100644 index 000000000..ac7bfd418 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/PropRef.md @@ -0,0 +1,90 @@ +--- +id: PropRef +title: PropRef +--- + +# Class: PropRef\ + +Defined in: [packages/db/src/query/ir.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L92) + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new PropRef(path): PropRef; +``` + +Defined in: [packages/db/src/query/ir.ts:94](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L94) + +#### Parameters + +##### path + +`string`[] + +#### Returns + +`PropRef`\<`T`\> + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: T; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### path + +```ts +path: string[]; +``` + +Defined in: [packages/db/src/query/ir.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L95) + +*** + +### type + +```ts +type: "ref"; +``` + +Defined in: [packages/db/src/query/ir.ts:93](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L93) + +#### Overrides + +```ts +BaseExpression.type +``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md b/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md new file mode 100644 index 000000000..6650b0389 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/QueryRef.md @@ -0,0 +1,98 @@ +--- +id: QueryRef +title: QueryRef +--- + +# Class: QueryRef + +Defined in: [packages/db/src/query/ir.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L82) + +## Extends + +- `BaseExpression` + +## Constructors + +### Constructor + +```ts +new QueryRef(query, alias): QueryRef; +``` + +Defined in: [packages/db/src/query/ir.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L84) + +#### Parameters + +##### query + +[`QueryIR`](../../interfaces/QueryIR.md) + +##### alias + +`string` + +#### Returns + +`QueryRef` + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: any; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### alias + +```ts +alias: string; +``` + +Defined in: [packages/db/src/query/ir.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L86) + +*** + +### query + +```ts +query: QueryIR; +``` + +Defined in: [packages/db/src/query/ir.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L85) + +*** + +### type + +```ts +type: "queryRef"; +``` + +Defined in: [packages/db/src/query/ir.ts:83](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L83) + +#### Overrides + +```ts +BaseExpression.type +``` diff --git a/docs/reference/@tanstack/namespaces/IR/classes/Value.md b/docs/reference/@tanstack/namespaces/IR/classes/Value.md new file mode 100644 index 000000000..448308304 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/classes/Value.md @@ -0,0 +1,90 @@ +--- +id: Value +title: Value +--- + +# Class: Value\ + +Defined in: [packages/db/src/query/ir.ts:101](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L101) + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new Value(value): Value; +``` + +Defined in: [packages/db/src/query/ir.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L103) + +#### Parameters + +##### value + +`T` + +#### Returns + +`Value`\<`T`\> + +#### Overrides + +```ts +BaseExpression.constructor +``` + +## Properties + +### \_\_returnType + +```ts +readonly __returnType: T; +``` + +Defined in: [packages/db/src/query/ir.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L69) + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### type + +```ts +type: "val"; +``` + +Defined in: [packages/db/src/query/ir.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L102) + +#### Overrides + +```ts +BaseExpression.type +``` + +*** + +### value + +```ts +value: T; +``` + +Defined in: [packages/db/src/query/ir.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L104) diff --git a/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md b/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md new file mode 100644 index 000000000..05ed3ea3d --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/createResidualWhere.md @@ -0,0 +1,24 @@ +--- +id: createResidualWhere +title: createResidualWhere +--- + +# Function: createResidualWhere() + +```ts +function createResidualWhere(expression): Where; +``` + +Defined in: [packages/db/src/query/ir.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L187) + +Create a residual Where clause from an expression + +## Parameters + +### expression + +[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`boolean`\> + +## Returns + +[`Where`](../../type-aliases/Where.md) diff --git a/docs/reference/@tanstack/namespaces/IR/functions/followRef.md b/docs/reference/@tanstack/namespaces/IR/functions/followRef.md new file mode 100644 index 000000000..8b1fca465 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/followRef.md @@ -0,0 +1,47 @@ +--- +id: followRef +title: followRef +--- + +# Function: followRef() + +```ts +function followRef( + query, + ref, + collection): + | void + | { + collection: Collection; + path: string[]; +}; +``` + +Defined in: [packages/db/src/query/ir.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L213) + +Follows the given reference in a query +until its finds the root field the reference points to. + +## Parameters + +### query + +[`QueryIR`](../../interfaces/QueryIR.md) + +### ref + +[`PropRef`](../../classes/PropRef.md)\<`any`\> + +### collection + +[`Collection`](../../../../../interfaces/Collection.md) + +## Returns + + \| `void` + \| \{ + `collection`: [`Collection`](../../../../../interfaces/Collection.md); + `path`: `string`[]; +\} + +The collection, its alias, and the path to the root field in this collection diff --git a/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md b/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md new file mode 100644 index 000000000..0fe5ee30c --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/getHavingExpression.md @@ -0,0 +1,28 @@ +--- +id: getHavingExpression +title: getHavingExpression +--- + +# Function: getHavingExpression() + +```ts +function getHavingExpression(having): + | Aggregate +| BasicExpression; +``` + +Defined in: [packages/db/src/query/ir.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L165) + +Extract the expression from a HAVING clause +HAVING clauses can contain aggregates, unlike regular WHERE clauses + +## Parameters + +### having + +[`Where`](../../type-aliases/Where.md) + +## Returns + + \| [`Aggregate`](../../classes/Aggregate.md)\<`any`\> + \| [`BasicExpression`](../../type-aliases/BasicExpression.md)\<`any`\> diff --git a/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md b/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md new file mode 100644 index 000000000..fbc8b9808 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/getWhereExpression.md @@ -0,0 +1,24 @@ +--- +id: getWhereExpression +title: getWhereExpression +--- + +# Function: getWhereExpression() + +```ts +function getWhereExpression(where): BasicExpression; +``` + +Defined in: [packages/db/src/query/ir.ts:155](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L155) + +Extract the expression from a Where clause + +## Parameters + +### where + +[`Where`](../../type-aliases/Where.md) + +## Returns + +[`BasicExpression`](../../type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md b/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md new file mode 100644 index 000000000..a9e580e1a --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/isExpressionLike.md @@ -0,0 +1,25 @@ +--- +id: isExpressionLike +title: isExpressionLike +--- + +# Function: isExpressionLike() + +```ts +function isExpressionLike(value): boolean; +``` + +Defined in: [packages/db/src/query/ir.ts:139](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L139) + +Runtime helper to detect IR expression-like objects. +Prefer this over ad-hoc local implementations to keep behavior consistent. + +## Parameters + +### value + +`any` + +## Returns + +`boolean` diff --git a/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md b/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md new file mode 100644 index 000000000..3b433feff --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/functions/isResidualWhere.md @@ -0,0 +1,24 @@ +--- +id: isResidualWhere +title: isResidualWhere +--- + +# Function: isResidualWhere() + +```ts +function isResidualWhere(where): boolean; +``` + +Defined in: [packages/db/src/query/ir.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L176) + +Check if a Where clause is marked as residual + +## Parameters + +### where + +[`Where`](../../type-aliases/Where.md) + +## Returns + +`boolean` diff --git a/docs/reference/@tanstack/namespaces/IR/index.md b/docs/reference/@tanstack/namespaces/IR/index.md new file mode 100644 index 000000000..e1937961e --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/index.md @@ -0,0 +1,44 @@ +--- +id: IR +title: IR +--- + +# IR + +## Classes + +- [Aggregate](../classes/Aggregate.md) +- [CollectionRef](../classes/CollectionRef.md) +- [Func](../classes/Func.md) +- [PropRef](../classes/PropRef.md) +- [QueryRef](../classes/QueryRef.md) +- [Value](../classes/Value.md) + +## Interfaces + +- [JoinClause](../interfaces/JoinClause.md) +- [QueryIR](../interfaces/QueryIR.md) + +## Type Aliases + +- [BasicExpression](../type-aliases/BasicExpression.md) +- [From](../type-aliases/From.md) +- [GroupBy](../type-aliases/GroupBy.md) +- [Having](../type-aliases/Having.md) +- [Join](../type-aliases/Join.md) +- [Limit](../type-aliases/Limit.md) +- [Offset](../type-aliases/Offset.md) +- [OrderBy](../type-aliases/OrderBy.md) +- [OrderByClause](../type-aliases/OrderByClause.md) +- [OrderByDirection](../type-aliases/OrderByDirection.md) +- [Select](../type-aliases/Select.md) +- [Where](../type-aliases/Where.md) + +## Functions + +- [createResidualWhere](../functions/createResidualWhere.md) +- [followRef](../functions/followRef.md) +- [getHavingExpression](../functions/getHavingExpression.md) +- [getWhereExpression](../functions/getWhereExpression.md) +- [isExpressionLike](../functions/isExpressionLike.md) +- [isResidualWhere](../functions/isResidualWhere.md) diff --git a/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md b/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md new file mode 100644 index 000000000..0ba211c77 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/interfaces/JoinClause.md @@ -0,0 +1,50 @@ +--- +id: JoinClause +title: JoinClause +--- + +# Interface: JoinClause + +Defined in: [packages/db/src/query/ir.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L36) + +## Properties + +### from + +```ts +from: + | CollectionRef + | QueryRef; +``` + +Defined in: [packages/db/src/query/ir.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L37) + +*** + +### left + +```ts +left: BasicExpression; +``` + +Defined in: [packages/db/src/query/ir.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L39) + +*** + +### right + +```ts +right: BasicExpression; +``` + +Defined in: [packages/db/src/query/ir.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L40) + +*** + +### type + +```ts +type: "inner" | "left" | "right" | "full" | "outer" | "cross"; +``` + +Defined in: [packages/db/src/query/ir.ts:38](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L38) diff --git a/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md b/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md new file mode 100644 index 000000000..835f2b562 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/interfaces/QueryIR.md @@ -0,0 +1,178 @@ +--- +id: QueryIR +title: QueryIR +--- + +# Interface: QueryIR + +Defined in: [packages/db/src/query/ir.ts:9](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L9) + +## Properties + +### distinct? + +```ts +optional distinct: true; +``` + +Defined in: [packages/db/src/query/ir.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L19) + +*** + +### fnHaving? + +```ts +optional fnHaving: (row) => any[]; +``` + +Defined in: [packages/db/src/query/ir.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L25) + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### fnSelect()? + +```ts +optional fnSelect: (row) => any; +``` + +Defined in: [packages/db/src/query/ir.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L23) + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### fnWhere? + +```ts +optional fnWhere: (row) => any[]; +``` + +Defined in: [packages/db/src/query/ir.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L24) + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### from + +```ts +from: From; +``` + +Defined in: [packages/db/src/query/ir.ts:10](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L10) + +*** + +### groupBy? + +```ts +optional groupBy: GroupBy; +``` + +Defined in: [packages/db/src/query/ir.ts:14](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L14) + +*** + +### having? + +```ts +optional having: Where[]; +``` + +Defined in: [packages/db/src/query/ir.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L15) + +*** + +### join? + +```ts +optional join: Join; +``` + +Defined in: [packages/db/src/query/ir.ts:12](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L12) + +*** + +### limit? + +```ts +optional limit: number; +``` + +Defined in: [packages/db/src/query/ir.ts:17](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L17) + +*** + +### offset? + +```ts +optional offset: number; +``` + +Defined in: [packages/db/src/query/ir.ts:18](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L18) + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: [packages/db/src/query/ir.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L16) + +*** + +### select? + +```ts +optional select: Select; +``` + +Defined in: [packages/db/src/query/ir.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L11) + +*** + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: [packages/db/src/query/ir.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L20) + +*** + +### where? + +```ts +optional where: Where[]; +``` + +Defined in: [packages/db/src/query/ir.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L13) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md new file mode 100644 index 000000000..8621d0743 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/BasicExpression.md @@ -0,0 +1,21 @@ +--- +id: BasicExpression +title: BasicExpression +--- + +# Type Alias: BasicExpression\ + +```ts +type BasicExpression = + | PropRef + | Value +| Func; +``` + +Defined in: [packages/db/src/query/ir.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L123) + +## Type Parameters + +### T + +`T` = `any` diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md new file mode 100644 index 000000000..53396c221 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/From.md @@ -0,0 +1,14 @@ +--- +id: From +title: From +--- + +# Type Alias: From + +```ts +type From = + | CollectionRef + | QueryRef; +``` + +Defined in: [packages/db/src/query/ir.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L28) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md new file mode 100644 index 000000000..71426706e --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/GroupBy.md @@ -0,0 +1,12 @@ +--- +id: GroupBy +title: GroupBy +--- + +# Type Alias: GroupBy + +```ts +type GroupBy = BasicExpression[]; +``` + +Defined in: [packages/db/src/query/ir.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L47) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md new file mode 100644 index 000000000..7c101b514 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Having.md @@ -0,0 +1,12 @@ +--- +id: Having +title: Having +--- + +# Type Alias: Having + +```ts +type Having = Where; +``` + +Defined in: [packages/db/src/query/ir.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L49) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md new file mode 100644 index 000000000..f05df96fd --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Join.md @@ -0,0 +1,12 @@ +--- +id: Join +title: Join +--- + +# Type Alias: Join + +```ts +type Join = JoinClause[]; +``` + +Defined in: [packages/db/src/query/ir.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L34) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md new file mode 100644 index 000000000..fd93855d3 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Limit.md @@ -0,0 +1,12 @@ +--- +id: Limit +title: Limit +--- + +# Type Alias: Limit + +```ts +type Limit = number; +``` + +Defined in: [packages/db/src/query/ir.ts:60](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L60) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md new file mode 100644 index 000000000..eeb67a560 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Offset.md @@ -0,0 +1,12 @@ +--- +id: Offset +title: Offset +--- + +# Type Alias: Offset + +```ts +type Offset = number; +``` + +Defined in: [packages/db/src/query/ir.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L62) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md new file mode 100644 index 000000000..af3fac551 --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderBy.md @@ -0,0 +1,12 @@ +--- +id: OrderBy +title: OrderBy +--- + +# Type Alias: OrderBy + +```ts +type OrderBy = OrderByClause[]; +``` + +Defined in: [packages/db/src/query/ir.ts:51](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L51) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md new file mode 100644 index 000000000..98ea1969e --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByClause.md @@ -0,0 +1,32 @@ +--- +id: OrderByClause +title: OrderByClause +--- + +# Type Alias: OrderByClause + +```ts +type OrderByClause = object; +``` + +Defined in: [packages/db/src/query/ir.ts:53](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L53) + +## Properties + +### compareOptions + +```ts +compareOptions: CompareOptions; +``` + +Defined in: [packages/db/src/query/ir.ts:55](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L55) + +*** + +### expression + +```ts +expression: BasicExpression; +``` + +Defined in: [packages/db/src/query/ir.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L54) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md new file mode 100644 index 000000000..043ef946d --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/OrderByDirection.md @@ -0,0 +1,12 @@ +--- +id: OrderByDirection +title: OrderByDirection +--- + +# Type Alias: OrderByDirection + +```ts +type OrderByDirection = "asc" | "desc"; +``` + +Defined in: [packages/db/src/query/ir.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L58) diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md new file mode 100644 index 000000000..1bf77381f --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Select.md @@ -0,0 +1,21 @@ +--- +id: Select +title: Select +--- + +# Type Alias: Select + +```ts +type Select = object; +``` + +Defined in: [packages/db/src/query/ir.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L30) + +## Index Signature + +```ts +[alias: string]: + | Aggregate + | BasicExpression + | Select +``` diff --git a/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md b/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md new file mode 100644 index 000000000..ac22debbd --- /dev/null +++ b/docs/reference/@tanstack/namespaces/IR/type-aliases/Where.md @@ -0,0 +1,17 @@ +--- +id: Where +title: Where +--- + +# Type Alias: Where + +```ts +type Where = + | BasicExpression + | { + expression: BasicExpression; + residual?: boolean; +}; +``` + +Defined in: [packages/db/src/query/ir.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/query/ir.ts#L43) diff --git a/docs/reference/classes/AggregateFunctionNotInSelectError.md b/docs/reference/classes/AggregateFunctionNotInSelectError.md new file mode 100644 index 000000000..eca7c6447 --- /dev/null +++ b/docs/reference/classes/AggregateFunctionNotInSelectError.md @@ -0,0 +1,220 @@ +--- +id: AggregateFunctionNotInSelectError +title: AggregateFunctionNotInSelectError +--- + +# Class: AggregateFunctionNotInSelectError + +Defined in: [packages/db/src/errors.ts:531](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L531) + +## Extends + +- [`GroupByError`](../GroupByError.md) + +## Constructors + +### Constructor + +```ts +new AggregateFunctionNotInSelectError(functionName): AggregateFunctionNotInSelectError; +``` + +Defined in: [packages/db/src/errors.ts:532](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L532) + +#### Parameters + +##### functionName + +`string` + +#### Returns + +`AggregateFunctionNotInSelectError` + +#### Overrides + +[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/AggregateNotSupportedError.md b/docs/reference/classes/AggregateNotSupportedError.md new file mode 100644 index 000000000..4d20a59b3 --- /dev/null +++ b/docs/reference/classes/AggregateNotSupportedError.md @@ -0,0 +1,216 @@ +--- +id: AggregateNotSupportedError +title: AggregateNotSupportedError +--- + +# Class: AggregateNotSupportedError + +Defined in: [packages/db/src/errors.ts:647](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L647) + +Error thrown when aggregate expressions are used outside of a GROUP BY context. + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new AggregateNotSupportedError(): AggregateNotSupportedError; +``` + +Defined in: [packages/db/src/errors.ts:648](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L648) + +#### Returns + +`AggregateNotSupportedError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/BTreeIndex.md b/docs/reference/classes/BTreeIndex.md new file mode 100644 index 000000000..fe55cef10 --- /dev/null +++ b/docs/reference/classes/BTreeIndex.md @@ -0,0 +1,848 @@ +--- +id: BTreeIndex +title: BTreeIndex +--- + +# Class: BTreeIndex\ + +Defined in: [packages/db/src/indexes/btree-index.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L30) + +B+Tree index for sorted data with range queries +This maintains items in sorted order and provides efficient range operations + +## Extends + +- [`BaseIndex`](../BaseIndex.md)\<`TKey`\> + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Constructors + +### Constructor + +```ts +new BTreeIndex( + id, + expression, + name?, +options?): BTreeIndex; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L50) + +#### Parameters + +##### id + +`number` + +##### expression + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +##### name? + +`string` + +##### options? + +`any` + +#### Returns + +`BTreeIndex`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`constructor`](../BaseIndex.md#constructor) + +## Properties + +### compareOptions + +```ts +protected compareOptions: CompareOptions; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L87) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`compareOptions`](../BaseIndex.md#compareoptions) + +*** + +### expression + +```ts +readonly expression: BasicExpression; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L81) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`expression`](../BaseIndex.md#expression) + +*** + +### id + +```ts +readonly id: number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L79) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`id`](../BaseIndex.md#id) + +*** + +### lastUpdated + +```ts +protected lastUpdated: Date; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L86) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`lastUpdated`](../BaseIndex.md#lastupdated) + +*** + +### lookupCount + +```ts +protected lookupCount: number = 0; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L84) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`lookupCount`](../BaseIndex.md#lookupcount) + +*** + +### name? + +```ts +readonly optional name: string; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L80) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`name`](../BaseIndex.md#name) + +*** + +### supportedOperations + +```ts +readonly supportedOperations: Set<"eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "ilike">; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L33) + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`supportedOperations`](../BaseIndex.md#supportedoperations) + +*** + +### totalLookupTime + +```ts +protected totalLookupTime: number = 0; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L85) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`totalLookupTime`](../BaseIndex.md#totallookuptime) + +## Accessors + +### indexedKeysSet + +#### Get Signature + +```ts +get indexedKeysSet(): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L333) + +##### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`indexedKeysSet`](../BaseIndex.md#indexedkeysset) + +*** + +### keyCount + +#### Get Signature + +```ts +get keyCount(): number; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L199) + +Gets the number of indexed keys + +##### Returns + +`number` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`keyCount`](../BaseIndex.md#keycount) + +*** + +### orderedEntriesArray + +#### Get Signature + +```ts +get orderedEntriesArray(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:337](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L337) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`orderedEntriesArray`](../BaseIndex.md#orderedentriesarray) + +*** + +### orderedEntriesArrayReversed + +#### Get Signature + +```ts +get orderedEntriesArrayReversed(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:343](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L343) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`orderedEntriesArrayReversed`](../BaseIndex.md#orderedentriesarrayreversed) + +*** + +### valueMapData + +#### Get Signature + +```ts +get valueMapData(): Map>; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:350](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L350) + +##### Returns + +`Map`\<`any`, `Set`\<`TKey`\>\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`valueMapData`](../BaseIndex.md#valuemapdata) + +## Methods + +### add() + +```ts +add(key, item): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L69) + +Adds a value to the index + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`add`](../BaseIndex.md#add) + +*** + +### build() + +```ts +build(entries): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:143](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L143) + +Builds the index from a collection of entries + +#### Parameters + +##### entries + +`Iterable`\<\[`TKey`, `any`\]\> + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`build`](../BaseIndex.md#build) + +*** + +### clear() + +```ts +clear(): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L154) + +Clears all data from the index + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`clear`](../BaseIndex.md#clear) + +*** + +### equalityLookup() + +```ts +equalityLookup(value): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L208) + +Performs an equality lookup + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`equalityLookup`](../BaseIndex.md#equalitylookup) + +*** + +### evaluateIndexExpression() + +```ts +protected evaluateIndexExpression(item): any; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L182) + +#### Parameters + +##### item + +`any` + +#### Returns + +`any` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`evaluateIndexExpression`](../BaseIndex.md#evaluateindexexpression) + +*** + +### getStats() + +```ts +getStats(): IndexStats; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:169](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L169) + +#### Returns + +[`IndexStats`](../../interfaces/IndexStats.md) + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`getStats`](../BaseIndex.md#getstats) + +*** + +### inArrayLookup() + +```ts +inArrayLookup(values): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:318](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L318) + +Performs an IN array lookup + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`inArrayLookup`](../BaseIndex.md#inarraylookup) + +*** + +### initialize() + +```ts +protected initialize(_options?): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:64](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L64) + +#### Parameters + +##### \_options? + +[`BTreeIndexOptions`](../../interfaces/BTreeIndexOptions.md) + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`initialize`](../BaseIndex.md#initialize) + +*** + +### lookup() + +```ts +lookup(operation, value): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:164](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L164) + +Performs a lookup operation + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`lookup`](../BaseIndex.md#lookup) + +*** + +### matchesCompareOptions() + +```ts +matchesCompareOptions(compareOptions): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L146) + +Checks if the compare options match the index's compare options. +The direction is ignored because the index can be reversed if the direction is different. + +#### Parameters + +##### compareOptions + +`CompareOptions` + +#### Returns + +`boolean` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`matchesCompareOptions`](../BaseIndex.md#matchescompareoptions) + +*** + +### matchesDirection() + +```ts +matchesDirection(direction): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L165) + +Checks if the index matches the provided direction. + +#### Parameters + +##### direction + +[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) + +#### Returns + +`boolean` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`matchesDirection`](../BaseIndex.md#matchesdirection) + +*** + +### matchesField() + +```ts +matchesField(fieldPath): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:134](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L134) + +#### Parameters + +##### fieldPath + +`string`[] + +#### Returns + +`boolean` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`matchesField`](../BaseIndex.md#matchesfield) + +*** + +### rangeQuery() + +```ts +rangeQuery(options): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:217](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L217) + +Performs a range query with options +This is more efficient for compound queries like "WHERE a > 5 AND a < 10" + +#### Parameters + +##### options + +[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) = `{}` + +#### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`rangeQuery`](../BaseIndex.md#rangequery) + +*** + +### rangeQueryReversed() + +```ts +rangeQueryReversed(options): Set; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:250](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L250) + +Performs a reversed range query + +#### Parameters + +##### options + +[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) = `{}` + +#### Returns + +`Set`\<`TKey`\> + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`rangeQueryReversed`](../BaseIndex.md#rangequeryreversed) + +*** + +### remove() + +```ts +remove(key, item): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:100](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L100) + +Removes a value from the index + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`remove`](../BaseIndex.md#remove) + +*** + +### supports() + +```ts +supports(operation): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L130) + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +#### Returns + +`boolean` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`supports`](../BaseIndex.md#supports) + +*** + +### take() + +```ts +take( + n, + from?, + filterFn?): TKey[]; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L295) + +Returns the next n items after the provided item or the first n items if no from item is provided. + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### from? + +`any` + +The item to start from (exclusive). Starts from the smallest item (inclusive) if not provided. + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +The next n items after the provided key. Returns the first n items if no from item is provided. + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`take`](../BaseIndex.md#take) + +*** + +### takeReversed() + +```ts +takeReversed( + n, + from?, + filterFn?): TKey[]; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L306) + +Returns the next n items **before** the provided item (in descending order) or the last n items if no from item is provided. + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### from? + +`any` + +The item to start from (exclusive). Starts from the largest item (inclusive) if not provided. + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +The next n items **before** the provided key. Returns the last n items if no from item is provided. + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`takeReversed`](../BaseIndex.md#takereversed) + +*** + +### trackLookup() + +```ts +protected trackLookup(startTime): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L187) + +#### Parameters + +##### startTime + +`number` + +#### Returns + +`void` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`trackLookup`](../BaseIndex.md#tracklookup) + +*** + +### update() + +```ts +update( + key, + oldItem, + newItem): void; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:135](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L135) + +Updates a value in the index + +#### Parameters + +##### key + +`TKey` + +##### oldItem + +`any` + +##### newItem + +`any` + +#### Returns + +`void` + +#### Overrides + +[`BaseIndex`](../BaseIndex.md).[`update`](../BaseIndex.md#update) + +*** + +### updateTimestamp() + +```ts +protected updateTimestamp(): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L193) + +#### Returns + +`void` + +#### Inherited from + +[`BaseIndex`](../BaseIndex.md).[`updateTimestamp`](../BaseIndex.md#updatetimestamp) diff --git a/docs/reference/classes/BaseIndex.md b/docs/reference/classes/BaseIndex.md new file mode 100644 index 000000000..a1a6434c5 --- /dev/null +++ b/docs/reference/classes/BaseIndex.md @@ -0,0 +1,760 @@ +--- +id: BaseIndex +title: BaseIndex +--- + +# Abstract Class: BaseIndex\ + +Defined in: [packages/db/src/indexes/base-index.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L76) + +Base abstract class that all index types extend + +## Extended by + +- [`BTreeIndex`](../BTreeIndex.md) + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Implements + +- [`IndexInterface`](../../interfaces/IndexInterface.md)\<`TKey`\> + +## Constructors + +### Constructor + +```ts +new BaseIndex( + id, + expression, + name?, +options?): BaseIndex; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:89](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L89) + +#### Parameters + +##### id + +`number` + +##### expression + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +##### name? + +`string` + +##### options? + +`any` + +#### Returns + +`BaseIndex`\<`TKey`\> + +## Properties + +### compareOptions + +```ts +protected compareOptions: CompareOptions; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L87) + +*** + +### expression + +```ts +readonly expression: BasicExpression; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L81) + +*** + +### id + +```ts +readonly id: number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L79) + +*** + +### lastUpdated + +```ts +protected lastUpdated: Date; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L86) + +*** + +### lookupCount + +```ts +protected lookupCount: number = 0; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L84) + +*** + +### name? + +```ts +readonly optional name: string; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L80) + +*** + +### supportedOperations + +```ts +abstract readonly supportedOperations: Set<"eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "ilike">; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L82) + +*** + +### totalLookupTime + +```ts +protected totalLookupTime: number = 0; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L85) + +## Accessors + +### indexedKeysSet + +#### Get Signature + +```ts +get abstract indexedKeysSet(): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L126) + +##### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`indexedKeysSet`](../../interfaces/IndexInterface.md#indexedkeysset) + +*** + +### keyCount + +#### Get Signature + +```ts +get abstract keyCount(): number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L119) + +##### Returns + +`number` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`keyCount`](../../interfaces/IndexInterface.md#keycount) + +*** + +### orderedEntriesArray + +#### Get Signature + +```ts +get abstract orderedEntriesArray(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:124](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L124) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`orderedEntriesArray`](../../interfaces/IndexInterface.md#orderedentriesarray) + +*** + +### orderedEntriesArrayReversed + +#### Get Signature + +```ts +get abstract orderedEntriesArrayReversed(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L125) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`orderedEntriesArrayReversed`](../../interfaces/IndexInterface.md#orderedentriesarrayreversed) + +*** + +### valueMapData + +#### Get Signature + +```ts +get abstract valueMapData(): Map>; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L127) + +##### Returns + +`Map`\<`any`, `Set`\<`TKey`\>\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`valueMapData`](../../interfaces/IndexInterface.md#valuemapdata) + +## Methods + +### add() + +```ts +abstract add(key, item): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L103) + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`add`](../../interfaces/IndexInterface.md#add) + +*** + +### build() + +```ts +abstract build(entries): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:106](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L106) + +#### Parameters + +##### entries + +`Iterable`\<\[`TKey`, `any`\]\> + +#### Returns + +`void` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`build`](../../interfaces/IndexInterface.md#build) + +*** + +### clear() + +```ts +abstract clear(): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:107](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L107) + +#### Returns + +`void` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`clear`](../../interfaces/IndexInterface.md#clear) + +*** + +### equalityLookup() + +```ts +abstract equalityLookup(value): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L120) + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`equalityLookup`](../../interfaces/IndexInterface.md#equalitylookup) + +*** + +### evaluateIndexExpression() + +```ts +protected evaluateIndexExpression(item): any; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L182) + +#### Parameters + +##### item + +`any` + +#### Returns + +`any` + +*** + +### getStats() + +```ts +getStats(): IndexStats; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:169](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L169) + +#### Returns + +[`IndexStats`](../../interfaces/IndexStats.md) + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`getStats`](../../interfaces/IndexInterface.md#getstats) + +*** + +### inArrayLookup() + +```ts +abstract inArrayLookup(values): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:121](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L121) + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`inArrayLookup`](../../interfaces/IndexInterface.md#inarraylookup) + +*** + +### initialize() + +```ts +abstract protected initialize(options?): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:180](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L180) + +#### Parameters + +##### options? + +`any` + +#### Returns + +`void` + +*** + +### lookup() + +```ts +abstract lookup(operation, value): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:108](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L108) + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`lookup`](../../interfaces/IndexInterface.md#lookup) + +*** + +### matchesCompareOptions() + +```ts +matchesCompareOptions(compareOptions): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L146) + +Checks if the compare options match the index's compare options. +The direction is ignored because the index can be reversed if the direction is different. + +#### Parameters + +##### compareOptions + +`CompareOptions` + +#### Returns + +`boolean` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesCompareOptions`](../../interfaces/IndexInterface.md#matchescompareoptions) + +*** + +### matchesDirection() + +```ts +matchesDirection(direction): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L165) + +Checks if the index matches the provided direction. + +#### Parameters + +##### direction + +[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) + +#### Returns + +`boolean` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesDirection`](../../interfaces/IndexInterface.md#matchesdirection) + +*** + +### matchesField() + +```ts +matchesField(fieldPath): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:134](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L134) + +#### Parameters + +##### fieldPath + +`string`[] + +#### Returns + +`boolean` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`matchesField`](../../interfaces/IndexInterface.md#matchesfield) + +*** + +### rangeQuery() + +```ts +abstract rangeQuery(options): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L122) + +#### Parameters + +##### options + +[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`rangeQuery`](../../interfaces/IndexInterface.md#rangequery) + +*** + +### rangeQueryReversed() + +```ts +abstract rangeQueryReversed(options): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L123) + +#### Parameters + +##### options + +[`RangeQueryOptions`](../../interfaces/RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`rangeQueryReversed`](../../interfaces/IndexInterface.md#rangequeryreversed) + +*** + +### remove() + +```ts +abstract remove(key, item): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L104) + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`remove`](../../interfaces/IndexInterface.md#remove) + +*** + +### supports() + +```ts +supports(operation): boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L130) + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +#### Returns + +`boolean` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`supports`](../../interfaces/IndexInterface.md#supports) + +*** + +### take() + +```ts +abstract take( + n, + from?, + filterFn?): TKey[]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:109](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L109) + +#### Parameters + +##### n + +`number` + +##### from? + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`take`](../../interfaces/IndexInterface.md#take) + +*** + +### takeReversed() + +```ts +abstract takeReversed( + n, + from?, + filterFn?): TKey[]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:114](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L114) + +#### Parameters + +##### n + +`number` + +##### from? + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`takeReversed`](../../interfaces/IndexInterface.md#takereversed) + +*** + +### trackLookup() + +```ts +protected trackLookup(startTime): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:187](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L187) + +#### Parameters + +##### startTime + +`number` + +#### Returns + +`void` + +*** + +### update() + +```ts +abstract update( + key, + oldItem, + newItem): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:105](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L105) + +#### Parameters + +##### key + +`TKey` + +##### oldItem + +`any` + +##### newItem + +`any` + +#### Returns + +`void` + +#### Implementation of + +[`IndexInterface`](../../interfaces/IndexInterface.md).[`update`](../../interfaces/IndexInterface.md#update) + +*** + +### updateTimestamp() + +```ts +protected updateTimestamp(): void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L193) + +#### Returns + +`void` diff --git a/docs/reference/classes/BaseQueryBuilder.md b/docs/reference/classes/BaseQueryBuilder.md new file mode 100644 index 000000000..6ce3d07b2 --- /dev/null +++ b/docs/reference/classes/BaseQueryBuilder.md @@ -0,0 +1,884 @@ +--- +id: BaseQueryBuilder +title: BaseQueryBuilder +--- + +# Class: BaseQueryBuilder\ + +Defined in: [packages/db/src/query/builder/index.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L46) + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) = [`Context`](../../interfaces/Context.md) + +## Constructors + +### Constructor + +```ts +new BaseQueryBuilder(query): BaseQueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L49) + +#### Parameters + +##### query + +`Partial`\<[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md)\> = `{}` + +#### Returns + +`BaseQueryBuilder`\<`TContext`\> + +## Accessors + +### fn + +#### Get Signature + +```ts +get fn(): object; +``` + +Defined in: [packages/db/src/query/builder/index.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L672) + +Functional variants of the query builder +These are imperative function that are called for ery row. +Warning: that these cannot be optimized by the query compiler, and may prevent +some type of optimizations being possible. + +##### Example + +```ts +q.fn.select((row) => ({ + name: row.user.name.toUpperCase(), + age: row.user.age + 1, +})) +``` + +##### Returns + +###### having() + +```ts +having(callback): QueryBuilder; +``` + +Filter grouped rows using a function that operates on each aggregated row +Warning: This cannot be optimized by the query compiler + +###### Parameters + +###### callback + +(`row`) => `any` + +A function that receives an aggregated row and returns a boolean + +###### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with functional having filter applied + +###### Example + +```ts +// Functional having (not optimized) +query + .from({ posts: postsCollection }) + .groupBy(({posts}) => posts.userId) + .fn.having(row => row.count > 5) +``` + +###### select() + +```ts +select(callback): QueryBuilder>; +``` + +Select fields using a function that operates on each row +Warning: This cannot be optimized by the query compiler + +###### Type Parameters + +###### TFuncSelectResult + +`TFuncSelectResult` + +###### Parameters + +###### callback + +(`row`) => `TFuncSelectResult` + +A function that receives a row and returns the selected value + +###### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`WithResult`\<`TContext`, `TFuncSelectResult`\>\> + +A QueryBuilder with functional selection applied + +###### Example + +```ts +// Functional select (not optimized) +query + .from({ users: usersCollection }) + .fn.select(row => ({ + name: row.users.name.toUpperCase(), + age: row.users.age + 1, + })) +``` + +###### where() + +```ts +where(callback): QueryBuilder; +``` + +Filter rows using a function that operates on each row +Warning: This cannot be optimized by the query compiler + +###### Parameters + +###### callback + +(`row`) => `any` + +A function that receives a row and returns a boolean + +###### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with functional filtering applied + +###### Example + +```ts +// Functional where (not optimized) +query + .from({ users: usersCollection }) + .fn.where(row => row.users.name.startsWith('A')) +``` + +## Methods + +### \_getQuery() + +```ts +_getQuery(): QueryIR; +``` + +Defined in: [packages/db/src/query/builder/index.ts:758](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L758) + +#### Returns + +[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md) + +*** + +### distinct() + +```ts +distinct(): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L611) + +Specify that the query should return distinct rows. +Deduplicates rows based on the selected columns. + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with distinct enabled + +#### Example + +```ts +// Get countries our users are from +query + .from({ users: usersCollection }) + .select(({users}) => users.country) + .distinct() +``` + +*** + +### findOne() + +```ts +findOne(): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L631) + +Specify that the query should return a single result + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext` & [`SingleResult`](../../type-aliases/SingleResult.md)\> + +A QueryBuilder that returns the first result + +#### Example + +```ts +// Get the user matching the query +query + .from({ users: usersCollection }) + .where(({users}) => eq(users.id, 1)) + .findOne() +``` + +*** + +### from() + +```ts +from(source): QueryBuilder<{ + baseSchema: SchemaFromSource; + fromSourceName: keyof TSource & string; + hasJoins: false; + schema: SchemaFromSource; +}>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L103) + +Specify the source table or subquery for the query + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<\{ + `baseSchema`: `SchemaFromSource`\<`TSource`\>; + `fromSourceName`: keyof `TSource` & `string`; + `hasJoins`: `false`; + `schema`: `SchemaFromSource`\<`TSource`\>; +\}\> + +A QueryBuilder with the specified source + +#### Example + +```ts +// Query from a collection +query.from({ users: usersCollection }) + +// Query from a subquery +const activeUsers = query.from({ u: usersCollection }).where(({u}) => u.active) +query.from({ activeUsers }) +``` + +*** + +### fullJoin() + +```ts +fullJoin(source, onCallback): QueryBuilder, "full">>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:294](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L294) + +Perform a FULL JOIN with another table or subquery + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +##### onCallback + +`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> + +A function that receives table references and returns the join condition + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"full"`\>\> + +A QueryBuilder with the full joined table available + +#### Example + +```ts +// Full join users with posts +query + .from({ users: usersCollection }) + .fullJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) +``` + +*** + +### groupBy() + +```ts +groupBy(callback): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:533](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L533) + +Group rows by one or more columns for aggregation + +#### Parameters + +##### callback + +`GroupByCallback`\<`TContext`\> + +A function that receives table references and returns the field(s) to group by + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with grouping applied (enables aggregate functions in SELECT and HAVING) + +#### Example + +```ts +// Group by a single column +query + .from({ posts: postsCollection }) + .groupBy(({posts}) => posts.userId) + .select(({posts, count}) => ({ + userId: posts.userId, + postCount: count() + })) + +// Group by multiple columns +query + .from({ sales: salesCollection }) + .groupBy(({sales}) => [sales.region, sales.category]) + .select(({sales, sum}) => ({ + region: sales.region, + category: sales.category, + totalSales: sum(sales.amount) + })) +``` + +*** + +### having() + +```ts +having(callback): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:374](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L374) + +Filter grouped rows based on aggregate conditions + +#### Parameters + +##### callback + +`WhereCallback`\<`TContext`\> + +A function that receives table references and returns an expression + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with the having condition applied + +#### Example + +```ts +// Filter groups by count +query + .from({ posts: postsCollection }) + .groupBy(({posts}) => posts.userId) + .having(({posts}) => gt(count(posts.id), 5)) + +// Filter by average +query + .from({ orders: ordersCollection }) + .groupBy(({orders}) => orders.customerId) + .having(({orders}) => gt(avg(orders.total), 100)) + +// Multiple having calls are ANDed together +query + .from({ orders: ordersCollection }) + .groupBy(({orders}) => orders.customerId) + .having(({orders}) => gt(count(orders.id), 5)) + .having(({orders}) => gt(avg(orders.total), 100)) +``` + +*** + +### innerJoin() + +```ts +innerJoin(source, onCallback): QueryBuilder, "inner">>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L268) + +Perform an INNER JOIN with another table or subquery + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +##### onCallback + +`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> + +A function that receives table references and returns the join condition + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"inner"`\>\> + +A QueryBuilder with the inner joined table available + +#### Example + +```ts +// Inner join users with posts +query + .from({ users: usersCollection }) + .innerJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) +``` + +*** + +### join() + +```ts +join( + source, + onCallback, +type): QueryBuilder, TJoinType>>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L146) + +Join another table or subquery to the current query + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +##### TJoinType + +`TJoinType` *extends* `"inner"` \| `"left"` \| `"right"` \| `"full"` = `"left"` + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +##### onCallback + +`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> + +A function that receives table references and returns the join condition + +##### type + +`TJoinType` = `...` + +The type of join: 'inner', 'left', 'right', or 'full' (defaults to 'left') + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `TJoinType`\>\> + +A QueryBuilder with the joined table available + +#### Example + +```ts +// Left join users with posts +query + .from({ users: usersCollection }) + .join({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) + +// Inner join with explicit type +query + .from({ u: usersCollection }) + .join({ p: postsCollection }, ({u, p}) => eq(u.id, p.userId), 'inner') +``` + +// Join with a subquery +const activeUsers = query.from({ u: usersCollection }).where(({u}) => u.active) +query + .from({ activeUsers }) + .join({ p: postsCollection }, ({u, p}) => eq(u.id, p.userId)) + +*** + +### leftJoin() + +```ts +leftJoin(source, onCallback): QueryBuilder, "left">>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L216) + +Perform a LEFT JOIN with another table or subquery + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +##### onCallback + +`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> + +A function that receives table references and returns the join condition + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"left"`\>\> + +A QueryBuilder with the left joined table available + +#### Example + +```ts +// Left join users with posts +query + .from({ users: usersCollection }) + .leftJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) +``` + +*** + +### limit() + +```ts +limit(count): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:566](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L566) + +Limit the number of rows returned by the query +`orderBy` is required for `limit` + +#### Parameters + +##### count + +`number` + +Maximum number of rows to return + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with the limit applied + +#### Example + +```ts +// Get top 5 posts by likes +query + .from({ posts: postsCollection }) + .orderBy(({posts}) => posts.likes, 'desc') + .limit(5) +``` + +*** + +### offset() + +```ts +offset(count): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:590](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L590) + +Skip a number of rows before returning results +`orderBy` is required for `offset` + +#### Parameters + +##### count + +`number` + +Number of rows to skip + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with the offset applied + +#### Example + +```ts +// Get second page of results +query + .from({ posts: postsCollection }) + .orderBy(({posts}) => posts.createdAt, 'desc') + .offset(page * pageSize) + .limit(pageSize) +``` + +*** + +### orderBy() + +```ts +orderBy(callback, options): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:462](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L462) + +Sort the query results by one or more columns + +#### Parameters + +##### callback + +`OrderByCallback`\<`TContext`\> + +A function that receives table references and returns the field to sort by + +##### options + +[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) | `OrderByOptions` + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with the ordering applied + +#### Example + +```ts +// Sort by a single column +query + .from({ users: usersCollection }) + .orderBy(({users}) => users.name) + +// Sort descending +query + .from({ users: usersCollection }) + .orderBy(({users}) => users.createdAt, 'desc') + +// Multiple sorts (chain orderBy calls) +query + .from({ users: usersCollection }) + .orderBy(({users}) => users.lastName) + .orderBy(({users}) => users.firstName) +``` + +*** + +### rightJoin() + +```ts +rightJoin(source, onCallback): QueryBuilder, "right">>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:242](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L242) + +Perform a RIGHT JOIN with another table or subquery + +#### Type Parameters + +##### TSource + +`TSource` *extends* [`Source`](../../type-aliases/Source.md) + +#### Parameters + +##### source + +`TSource` + +An object with a single key-value pair where the key is the table alias and the value is a Collection or subquery + +##### onCallback + +`JoinOnCallback`\<`MergeContextForJoinCallback`\<`TContext`, \{ \[K in string \| number \| symbol\]: \{ \[K in string \| number \| symbol\]: TSource\[K\] extends CollectionImpl\ ? InferCollectionType\ : TSource\[K\] extends QueryBuilder\ ? \{ \[K in string \| number \| symbol\]: ((...)\[(...)\] extends object ? any\[any\] : (...) extends (...) ? (...) : (...))\[K\] \} : never \}\[K\] \}\>\> + +A function that receives table references and returns the join condition + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`MergeContextWithJoinType`\<`TContext`, `SchemaFromSource`\<`TSource`\>, `"right"`\>\> + +A QueryBuilder with the right joined table available + +#### Example + +```ts +// Right join users with posts +query + .from({ users: usersCollection }) + .rightJoin({ posts: postsCollection }, ({users, posts}) => eq(users.id, posts.userId)) +``` + +*** + +### select() + +```ts +select(callback): QueryBuilder>>; +``` + +Defined in: [packages/db/src/query/builder/index.ts:421](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L421) + +Select specific columns or computed values from the query + +#### Type Parameters + +##### TSelectObject + +`TSelectObject` *extends* `SelectShape` + +#### Parameters + +##### callback + +(`refs`) => `TSelectObject` + +A function that receives table references and returns an object with selected fields or expressions + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`WithResult`\<`TContext`, `ResultTypeFromSelect`\<`TSelectObject`\>\>\> + +A QueryBuilder that returns only the selected fields + +#### Example + +```ts +// Select specific columns +query + .from({ users: usersCollection }) + .select(({users}) => ({ + name: users.name, + email: users.email + })) + +// Select with computed values +query + .from({ users: usersCollection }) + .select(({users}) => ({ + fullName: concat(users.firstName, ' ', users.lastName), + ageInMonths: mul(users.age, 12) + })) + +// Select with aggregates (requires GROUP BY) +query + .from({ posts: postsCollection }) + .groupBy(({posts}) => posts.userId) + .select(({posts, count}) => ({ + userId: posts.userId, + postCount: count(posts.id) + })) +``` + +*** + +### where() + +```ts +where(callback): QueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L333) + +Filter rows based on a condition + +#### Parameters + +##### callback + +`WhereCallback`\<`TContext`\> + +A function that receives table references and returns an expression + +#### Returns + +[`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +A QueryBuilder with the where condition applied + +#### Example + +```ts +// Simple condition +query + .from({ users: usersCollection }) + .where(({users}) => gt(users.age, 18)) + +// Multiple conditions +query + .from({ users: usersCollection }) + .where(({users}) => and( + gt(users.age, 18), + eq(users.active, true) + )) + +// Multiple where calls are ANDed together +query + .from({ users: usersCollection }) + .where(({users}) => gt(users.age, 18)) + .where(({users}) => eq(users.active, true)) +``` diff --git a/docs/reference/classes/CannotCombineEmptyExpressionListError.md b/docs/reference/classes/CannotCombineEmptyExpressionListError.md new file mode 100644 index 000000000..9a1ca6b0f --- /dev/null +++ b/docs/reference/classes/CannotCombineEmptyExpressionListError.md @@ -0,0 +1,214 @@ +--- +id: CannotCombineEmptyExpressionListError +title: CannotCombineEmptyExpressionListError +--- + +# Class: CannotCombineEmptyExpressionListError + +Defined in: [packages/db/src/errors.ts:610](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L610) + +## Extends + +- [`QueryOptimizerError`](../QueryOptimizerError.md) + +## Constructors + +### Constructor + +```ts +new CannotCombineEmptyExpressionListError(): CannotCombineEmptyExpressionListError; +``` + +Defined in: [packages/db/src/errors.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L611) + +#### Returns + +`CannotCombineEmptyExpressionListError` + +#### Overrides + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`constructor`](../QueryOptimizerError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`cause`](../QueryOptimizerError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`message`](../QueryOptimizerError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`name`](../QueryOptimizerError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`stack`](../QueryOptimizerError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`stackTraceLimit`](../QueryOptimizerError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`captureStackTrace`](../QueryOptimizerError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`prepareStackTrace`](../QueryOptimizerError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionConfigurationError.md b/docs/reference/classes/CollectionConfigurationError.md new file mode 100644 index 000000000..2a1d4274f --- /dev/null +++ b/docs/reference/classes/CollectionConfigurationError.md @@ -0,0 +1,227 @@ +--- +id: CollectionConfigurationError +title: CollectionConfigurationError +--- + +# Class: CollectionConfigurationError + +Defined in: [packages/db/src/errors.ts:71](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L71) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`CollectionRequiresConfigError`](../CollectionRequiresConfigError.md) +- [`CollectionRequiresSyncConfigError`](../CollectionRequiresSyncConfigError.md) +- [`InvalidSchemaError`](../InvalidSchemaError.md) +- [`SchemaMustBeSynchronousError`](../SchemaMustBeSynchronousError.md) + +## Constructors + +### Constructor + +```ts +new CollectionConfigurationError(message): CollectionConfigurationError; +``` + +Defined in: [packages/db/src/errors.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L72) + +#### Parameters + +##### message + +`string` + +#### Returns + +`CollectionConfigurationError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionImpl.md b/docs/reference/classes/CollectionImpl.md new file mode 100644 index 000000000..216db731a --- /dev/null +++ b/docs/reference/classes/CollectionImpl.md @@ -0,0 +1,1421 @@ +--- +id: CollectionImpl +title: CollectionImpl +--- + +# Class: CollectionImpl\ + +Defined in: [packages/db/src/collection/index.ts:202](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L202) + +## Extended by + +- [`Collection`](../../interfaces/Collection.md) + +## Type Parameters + +### TOutput + +`TOutput` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = \{ +\} + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `StandardSchemaV1` + +### TInput + +`TInput` *extends* `object` = `TOutput` + +## Constructors + +### Constructor + +```ts +new CollectionImpl(config): CollectionImpl; +``` + +Defined in: [packages/db/src/collection/index.ts:239](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L239) + +Creates a new Collection instance + +#### Parameters + +##### config + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`TOutput`, `TKey`, `TSchema`\> + +Configuration object for the collection + +#### Returns + +`CollectionImpl`\<`TOutput`, `TKey`, `TUtils`, `TSchema`, `TInput`\> + +#### Throws + +Error if sync config is missing + +## Properties + +### \_lifecycle + +```ts +_lifecycle: CollectionLifecycleManager; +``` + +Defined in: [packages/db/src/collection/index.ts:219](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L219) + +*** + +### \_state + +```ts +_state: CollectionStateManager; +``` + +Defined in: [packages/db/src/collection/index.ts:231](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L231) + +*** + +### \_sync + +```ts +_sync: CollectionSyncManager; +``` + +Defined in: [packages/db/src/collection/index.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L220) + +*** + +### config + +```ts +config: CollectionConfig; +``` + +Defined in: [packages/db/src/collection/index.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L210) + +*** + +### id + +```ts +id: string; +``` + +Defined in: [packages/db/src/collection/index.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L209) + +*** + +### utils + +```ts +utils: Record = {}; +``` + +Defined in: [packages/db/src/collection/index.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L214) + +## Accessors + +### indexes + +#### Get Signature + +```ts +get indexes(): Map>; +``` + +Defined in: [packages/db/src/collection/index.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L496) + +Get resolved indexes for query optimization + +##### Returns + +`Map`\<`number`, [`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> + +*** + +### isLoadingSubset + +#### Get Signature + +```ts +get isLoadingSubset(): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:362](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L362) + +Check if the collection is currently loading more data + +##### Returns + +`boolean` + +true if the collection has pending load more operations, false otherwise + +*** + +### size + +#### Get Signature + +```ts +get size(): number; +``` + +Defined in: [packages/db/src/collection/index.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L399) + +Get the current size of the collection (cached) + +##### Returns + +`number` + +*** + +### state + +#### Get Signature + +```ts +get state(): Map; +``` + +Defined in: [packages/db/src/collection/index.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L683) + +Gets the current state of the collection as a Map + +##### Example + +```ts +const itemsMap = collection.state +console.log(`Collection has ${itemsMap.size} items`) + +for (const [key, item] of itemsMap) { + console.log(`${key}: ${item.title}`) +} + +// Check if specific item exists +if (itemsMap.has("todo-1")) { + console.log("Todo 1 exists:", itemsMap.get("todo-1")) +} +``` + +##### Returns + +`Map`\<`TKey`, `TOutput`\> + +Map containing all items in the collection, with keys as identifiers + +*** + +### status + +#### Get Signature + +```ts +get status(): CollectionStatus; +``` + +Defined in: [packages/db/src/collection/index.ts:317](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L317) + +Gets the current status of the collection + +##### Returns + +[`CollectionStatus`](../../type-aliases/CollectionStatus.md) + +*** + +### subscriberCount + +#### Get Signature + +```ts +get subscriberCount(): number; +``` + +Defined in: [packages/db/src/collection/index.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L324) + +Get the number of subscribers to the collection + +##### Returns + +`number` + +*** + +### toArray + +#### Get Signature + +```ts +get toArray(): TOutput[]; +``` + +Defined in: [packages/db/src/collection/index.ts:712](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L712) + +Gets the current state of the collection as an Array + +##### Returns + +`TOutput`[] + +An Array containing all items in the collection + +## Methods + +### \[iterator\]() + +```ts +iterator: IterableIterator<[TKey, TOutput]>; +``` + +Defined in: [packages/db/src/collection/index.ts:427](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L427) + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `TOutput`\]\> + +*** + +### cleanup() + +```ts +cleanup(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:846](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L846) + +Clean up the collection by stopping sync and clearing data +This can be called manually or automatically by garbage collection + +#### Returns + +`Promise`\<`void`\> + +*** + +### createIndex() + +```ts +createIndex(indexCallback, config): IndexProxy; +``` + +Defined in: [packages/db/src/collection/index.ts:486](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L486) + +Creates an index on a collection for faster queries. +Indexes significantly improve query performance by allowing constant time lookups +and logarithmic time range queries instead of full scans. + +#### Type Parameters + +##### TResolver + +`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> = *typeof* [`BTreeIndex`](../BTreeIndex.md) + +The type of the index resolver (constructor or async loader) + +#### Parameters + +##### indexCallback + +(`row`) => `any` + +Function that extracts the indexed value from each item + +##### config + +[`IndexOptions`](../../interfaces/IndexOptions.md)\<`TResolver`\> = `{}` + +Configuration including index type and type-specific options + +#### Returns + +[`IndexProxy`](../IndexProxy.md)\<`TKey`\> + +An index proxy that provides access to the index when ready + +#### Example + +```ts +// Create a default B+ tree index +const ageIndex = collection.createIndex((row) => row.age) + +// Create a ordered index with custom options +const ageIndex = collection.createIndex((row) => row.age, { + indexType: BTreeIndex, + options: { + compareFn: customComparator, + compareOptions: { direction: 'asc', nulls: 'first', stringSort: 'lexical' } + }, + name: 'age_btree' +}) + +// Create an async-loaded index +const textIndex = collection.createIndex((row) => row.content, { + indexType: async () => { + const { FullTextIndex } = await import('./indexes/fulltext.js') + return FullTextIndex + }, + options: { language: 'en' } +}) +``` + +*** + +### currentStateAsChanges() + +```ts +currentStateAsChanges(options): + | void + | ChangeMessage[]; +``` + +Defined in: [packages/db/src/collection/index.ts:750](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L750) + +Returns the current state of the collection as an array of changes + +#### Parameters + +##### options + +[`CurrentStateAsChangesOptions`](../../interfaces/CurrentStateAsChangesOptions.md) = `{}` + +Options including optional where filter + +#### Returns + + \| `void` + \| [`ChangeMessage`](../../interfaces/ChangeMessage.md)\<`TOutput`, `string` \| `number`\>[] + +An array of changes + +#### Example + +```ts +// Get all items as changes +const allChanges = collection.currentStateAsChanges() + +// Get only items matching a condition +const activeChanges = collection.currentStateAsChanges({ + where: (row) => row.status === 'active' +}) + +// Get only items using a pre-compiled expression +const activeChanges = collection.currentStateAsChanges({ + whereExpression: eq(row.status, 'active') +}) +``` + +*** + +### delete() + +```ts +delete(keys, config?): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L660) + +Deletes one or more items from the collection + +#### Parameters + +##### keys + +Single key or array of keys to delete + +`TKey` | `TKey`[] + +##### config? + +[`OperationConfig`](../../interfaces/OperationConfig.md) + +Optional configuration including metadata + +#### Returns + +[`Transaction`](../../interfaces/Transaction.md)\<`any`\> + +A Transaction object representing the delete operation(s) + +#### Examples + +```ts +// Delete a single item +const tx = collection.delete("todo-1") +await tx.isPersisted.promise +``` + +```ts +// Delete multiple items +const tx = collection.delete(["todo-1", "todo-2"]) +await tx.isPersisted.promise +``` + +```ts +// Delete with metadata +const tx = collection.delete("todo-1", { metadata: { reason: "completed" } }) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.delete("item-1") + await tx.isPersisted.promise + console.log('Delete successful') +} catch (error) { + console.log('Delete failed:', error) +} +``` + +*** + +### entries() + +```ts +entries(): IterableIterator<[TKey, TOutput]>; +``` + +Defined in: [packages/db/src/collection/index.ts:420](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L420) + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `TOutput`\]\> + +*** + +### forEach() + +```ts +forEach(callbackfn): void; +``` + +Defined in: [packages/db/src/collection/index.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L434) + +Execute a callback for each entry in the collection + +#### Parameters + +##### callbackfn + +(`value`, `key`, `index`) => `void` + +#### Returns + +`void` + +*** + +### get() + +```ts +get(key): TOutput | undefined; +``` + +Defined in: [packages/db/src/collection/index.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L385) + +Get the current value for a key (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`TOutput` \| `undefined` + +*** + +### getKeyFromItem() + +```ts +getKeyFromItem(item): TKey; +``` + +Defined in: [packages/db/src/collection/index.ts:449](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L449) + +#### Parameters + +##### item + +`TOutput` + +#### Returns + +`TKey` + +*** + +### has() + +```ts +has(key): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L392) + +Check if a key exists in the collection (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`boolean` + +*** + +### insert() + +```ts +insert(data, config?): + | Transaction> +| Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L547) + +Inserts one or more items into the collection + +#### Parameters + +##### data + +`TInput` | `TInput`[] + +##### config? + +[`InsertConfig`](../../interfaces/InsertConfig.md) + +Optional configuration including metadata + +#### Returns + + \| [`Transaction`](../../interfaces/Transaction.md)\<`Record`\<`string`, `unknown`\>\> + \| [`Transaction`](../../interfaces/Transaction.md)\<`TOutput`\> + +A Transaction object representing the insert operation(s) + +#### Throws + +If the data fails schema validation + +#### Examples + +```ts +// Insert a single todo (requires onInsert handler) +const tx = collection.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Insert multiple todos at once +const tx = collection.insert([ + { id: "1", text: "Buy milk", completed: false }, + { id: "2", text: "Walk dog", completed: true } +]) +await tx.isPersisted.promise +``` + +```ts +// Insert with metadata +const tx = collection.insert({ id: "1", text: "Buy groceries" }, + { metadata: { source: "mobile-app" } } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.insert({ id: "1", text: "New item" }) + await tx.isPersisted.promise + console.log('Insert successful') +} catch (error) { + console.log('Insert failed:', error) +} +``` + +*** + +### isReady() + +```ts +isReady(): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L354) + +Check if the collection is ready for use +Returns true if the collection has been marked as ready by its sync implementation + +#### Returns + +`boolean` + +true if the collection is ready, false otherwise + +#### Example + +```ts +if (collection.isReady()) { + console.log('Collection is ready, data is available') + // Safe to access collection.state +} else { + console.log('Collection is still loading') +} +``` + +*** + +### keys() + +```ts +keys(): IterableIterator; +``` + +Defined in: [packages/db/src/collection/index.ts:406](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L406) + +Get all keys (virtual derived state) + +#### Returns + +`IterableIterator`\<`TKey`\> + +*** + +### map() + +```ts +map(callbackfn): U[]; +``` + +Defined in: [packages/db/src/collection/index.ts:443](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L443) + +Create a new array with the results of calling a function for each entry in the collection + +#### Type Parameters + +##### U + +`U` + +#### Parameters + +##### callbackfn + +(`value`, `key`, `index`) => `U` + +#### Returns + +`U`[] + +*** + +### off() + +```ts +off(event, callback): void; +``` + +Defined in: [packages/db/src/collection/index.ts:825](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L825) + +Unsubscribe from a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +`void` + +*** + +### on() + +```ts +on(event, callback): () => void; +``` + +Defined in: [packages/db/src/collection/index.ts:805](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L805) + +Subscribe to a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +```ts +(): void; +``` + +##### Returns + +`void` + +*** + +### once() + +```ts +once(event, callback): () => void; +``` + +Defined in: [packages/db/src/collection/index.ts:815](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L815) + +Subscribe to a collection event once + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +```ts +(): void; +``` + +##### Returns + +`void` + +*** + +### onFirstReady() + +```ts +onFirstReady(callback): void; +``` + +Defined in: [packages/db/src/collection/index.ts:338](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L338) + +Register a callback to be executed when the collection first becomes ready +Useful for preloading collections + +#### Parameters + +##### callback + +() => `void` + +Function to call when the collection first becomes ready + +#### Returns + +`void` + +#### Example + +```ts +collection.onFirstReady(() => { + console.log('Collection is ready for the first time') + // Safe to access collection.state now +}) +``` + +*** + +### preload() + +```ts +preload(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:378](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L378) + +Preload the collection data by starting sync if not already started +Multiple concurrent calls will share the same promise + +#### Returns + +`Promise`\<`void`\> + +*** + +### startSyncImmediate() + +```ts +startSyncImmediate(): void; +``` + +Defined in: [packages/db/src/collection/index.ts:370](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L370) + +Start sync immediately - internal method for compiled queries +This bypasses lazy loading for special cases like live query results + +#### Returns + +`void` + +*** + +### stateWhenReady() + +```ts +stateWhenReady(): Promise>; +``` + +Defined in: [packages/db/src/collection/index.ts:697](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L697) + +Gets the current state of the collection as a Map, but only resolves when data is available +Waits for the first sync commit to complete before resolving + +#### Returns + +`Promise`\<`Map`\<`TKey`, `TOutput`\>\> + +Promise that resolves to a Map containing all items in the collection + +*** + +### subscribeChanges() + +```ts +subscribeChanges(callback, options): CollectionSubscription; +``` + +Defined in: [packages/db/src/collection/index.ts:795](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L795) + +Subscribe to changes in the collection + +#### Parameters + +##### callback + +(`changes`) => `void` + +Function called when items change + +##### options + +[`SubscribeChangesOptions`](../../interfaces/SubscribeChangesOptions.md) = `{}` + +Subscription options including includeInitialState and where filter + +#### Returns + +`CollectionSubscription` + +Unsubscribe function - Call this to stop listening for changes + +#### Examples + +```ts +// Basic subscription +const subscription = collection.subscribeChanges((changes) => { + changes.forEach(change => { + console.log(`${change.type}: ${change.key}`, change.value) + }) +}) + +// Later: subscription.unsubscribe() +``` + +```ts +// Include current state immediately +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { includeInitialState: true }) +``` + +```ts +// Subscribe only to changes matching a condition +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + where: (row) => row.status === 'active' +}) +``` + +```ts +// Subscribe using a pre-compiled expression +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + whereExpression: eq(row.status, 'active') +}) +``` + +*** + +### toArrayWhenReady() + +```ts +toArrayWhenReady(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:722](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L722) + +Gets the current state of the collection as an Array, but only resolves when data is available +Waits for the first sync commit to complete before resolving + +#### Returns + +`Promise`\<`TOutput`[]\> + +Promise that resolves to an Array containing all items in the collection + +*** + +### update() + +#### Call Signature + +```ts +update(key, callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L592) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### key + +`unknown`[] + +###### callback + +(`drafts`) => `void` + +##### Returns + +[`Transaction`](../../interfaces/Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +#### Call Signature + +```ts +update( + keys, + config, + callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L598) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### keys + +`unknown`[] + +Single key or array of keys to update + +###### config + +[`OperationConfig`](../../interfaces/OperationConfig.md) + +###### callback + +(`drafts`) => `void` + +##### Returns + +[`Transaction`](../../interfaces/Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +#### Call Signature + +```ts +update(id, callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L605) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### id + +`unknown` + +###### callback + +(`draft`) => `void` + +##### Returns + +[`Transaction`](../../interfaces/Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +#### Call Signature + +```ts +update( + id, + config, + callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L611) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### id + +`unknown` + +###### config + +[`OperationConfig`](../../interfaces/OperationConfig.md) + +###### callback + +(`draft`) => `void` + +##### Returns + +[`Transaction`](../../interfaces/Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +*** + +### validateData() + +```ts +validateData( + data, + type, + key?): TOutput; +``` + +Defined in: [packages/db/src/collection/index.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L503) + +Validates the data against the schema + +#### Parameters + +##### data + +`unknown` + +##### type + +`"insert"` | `"update"` + +##### key? + +`TKey` + +#### Returns + +`TOutput` + +*** + +### values() + +```ts +values(): IterableIterator; +``` + +Defined in: [packages/db/src/collection/index.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L413) + +Get all values (virtual derived state) + +#### Returns + +`IterableIterator`\<`TOutput`\> + +*** + +### waitFor() + +```ts +waitFor(event, timeout?): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:835](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L835) + +Wait for a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### timeout? + +`number` + +#### Returns + +`Promise`\<`AllCollectionEvents`\[`T`\]\> diff --git a/docs/reference/classes/CollectionInErrorStateError.md b/docs/reference/classes/CollectionInErrorStateError.md new file mode 100644 index 000000000..6a0da4bd1 --- /dev/null +++ b/docs/reference/classes/CollectionInErrorStateError.md @@ -0,0 +1,224 @@ +--- +id: CollectionInErrorStateError +title: CollectionInErrorStateError +--- + +# Class: CollectionInErrorStateError + +Defined in: [packages/db/src/errors.ts:110](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L110) + +## Extends + +- [`CollectionStateError`](../CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new CollectionInErrorStateError(operation, collectionId): CollectionInErrorStateError; +``` + +Defined in: [packages/db/src/errors.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L111) + +#### Parameters + +##### operation + +`string` + +##### collectionId + +`string` + +#### Returns + +`CollectionInErrorStateError` + +#### Overrides + +[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionInputNotFoundError.md b/docs/reference/classes/CollectionInputNotFoundError.md new file mode 100644 index 000000000..d9efb03a5 --- /dev/null +++ b/docs/reference/classes/CollectionInputNotFoundError.md @@ -0,0 +1,234 @@ +--- +id: CollectionInputNotFoundError +title: CollectionInputNotFoundError +--- + +# Class: CollectionInputNotFoundError + +Defined in: [packages/db/src/errors.ts:391](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L391) + +Error thrown when a collection input stream is not found during query compilation. +In self-joins, each alias (e.g., 'employee', 'manager') requires its own input stream. + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new CollectionInputNotFoundError( + alias, + collectionId?, + availableKeys?): CollectionInputNotFoundError; +``` + +Defined in: [packages/db/src/errors.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L392) + +#### Parameters + +##### alias + +`string` + +##### collectionId? + +`string` + +##### availableKeys? + +`string`[] + +#### Returns + +`CollectionInputNotFoundError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionIsInErrorStateError.md b/docs/reference/classes/CollectionIsInErrorStateError.md new file mode 100644 index 000000000..a116584a7 --- /dev/null +++ b/docs/reference/classes/CollectionIsInErrorStateError.md @@ -0,0 +1,214 @@ +--- +id: CollectionIsInErrorStateError +title: CollectionIsInErrorStateError +--- + +# Class: CollectionIsInErrorStateError + +Defined in: [packages/db/src/errors.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L126) + +## Extends + +- [`CollectionStateError`](../CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new CollectionIsInErrorStateError(): CollectionIsInErrorStateError; +``` + +Defined in: [packages/db/src/errors.ts:127](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L127) + +#### Returns + +`CollectionIsInErrorStateError` + +#### Overrides + +[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionOperationError.md b/docs/reference/classes/CollectionOperationError.md new file mode 100644 index 000000000..e9ce186b1 --- /dev/null +++ b/docs/reference/classes/CollectionOperationError.md @@ -0,0 +1,232 @@ +--- +id: CollectionOperationError +title: CollectionOperationError +--- + +# Class: CollectionOperationError + +Defined in: [packages/db/src/errors.ts:139](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L139) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`UndefinedKeyError`](../UndefinedKeyError.md) +- [`DuplicateKeyError`](../DuplicateKeyError.md) +- [`DuplicateKeySyncError`](../DuplicateKeySyncError.md) +- [`MissingUpdateArgumentError`](../MissingUpdateArgumentError.md) +- [`NoKeysPassedToUpdateError`](../NoKeysPassedToUpdateError.md) +- [`UpdateKeyNotFoundError`](../UpdateKeyNotFoundError.md) +- [`KeyUpdateNotAllowedError`](../KeyUpdateNotAllowedError.md) +- [`NoKeysPassedToDeleteError`](../NoKeysPassedToDeleteError.md) +- [`DeleteKeyNotFoundError`](../DeleteKeyNotFoundError.md) + +## Constructors + +### Constructor + +```ts +new CollectionOperationError(message): CollectionOperationError; +``` + +Defined in: [packages/db/src/errors.ts:140](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L140) + +#### Parameters + +##### message + +`string` + +#### Returns + +`CollectionOperationError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionRequiresConfigError.md b/docs/reference/classes/CollectionRequiresConfigError.md new file mode 100644 index 000000000..86db7e06d --- /dev/null +++ b/docs/reference/classes/CollectionRequiresConfigError.md @@ -0,0 +1,214 @@ +--- +id: CollectionRequiresConfigError +title: CollectionRequiresConfigError +--- + +# Class: CollectionRequiresConfigError + +Defined in: [packages/db/src/errors.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L78) + +## Extends + +- [`CollectionConfigurationError`](../CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new CollectionRequiresConfigError(): CollectionRequiresConfigError; +``` + +Defined in: [packages/db/src/errors.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L79) + +#### Returns + +`CollectionRequiresConfigError` + +#### Overrides + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionRequiresSyncConfigError.md b/docs/reference/classes/CollectionRequiresSyncConfigError.md new file mode 100644 index 000000000..8a2a57092 --- /dev/null +++ b/docs/reference/classes/CollectionRequiresSyncConfigError.md @@ -0,0 +1,214 @@ +--- +id: CollectionRequiresSyncConfigError +title: CollectionRequiresSyncConfigError +--- + +# Class: CollectionRequiresSyncConfigError + +Defined in: [packages/db/src/errors.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L84) + +## Extends + +- [`CollectionConfigurationError`](../CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new CollectionRequiresSyncConfigError(): CollectionRequiresSyncConfigError; +``` + +Defined in: [packages/db/src/errors.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L85) + +#### Returns + +`CollectionRequiresSyncConfigError` + +#### Overrides + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/CollectionStateError.md b/docs/reference/classes/CollectionStateError.md new file mode 100644 index 000000000..891c5b4db --- /dev/null +++ b/docs/reference/classes/CollectionStateError.md @@ -0,0 +1,227 @@ +--- +id: CollectionStateError +title: CollectionStateError +--- + +# Class: CollectionStateError + +Defined in: [packages/db/src/errors.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L103) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`CollectionInErrorStateError`](../CollectionInErrorStateError.md) +- [`InvalidCollectionStatusTransitionError`](../InvalidCollectionStatusTransitionError.md) +- [`CollectionIsInErrorStateError`](../CollectionIsInErrorStateError.md) +- [`NegativeActiveSubscribersError`](../NegativeActiveSubscribersError.md) + +## Constructors + +### Constructor + +```ts +new CollectionStateError(message): CollectionStateError; +``` + +Defined in: [packages/db/src/errors.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L104) + +#### Parameters + +##### message + +`string` + +#### Returns + +`CollectionStateError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/DeleteKeyNotFoundError.md b/docs/reference/classes/DeleteKeyNotFoundError.md new file mode 100644 index 000000000..61a6600cc --- /dev/null +++ b/docs/reference/classes/DeleteKeyNotFoundError.md @@ -0,0 +1,220 @@ +--- +id: DeleteKeyNotFoundError +title: DeleteKeyNotFoundError +--- + +# Class: DeleteKeyNotFoundError + +Defined in: [packages/db/src/errors.ts:204](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L204) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DeleteKeyNotFoundError(key): DeleteKeyNotFoundError; +``` + +Defined in: [packages/db/src/errors.ts:205](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L205) + +#### Parameters + +##### key + +`string` | `number` + +#### Returns + +`DeleteKeyNotFoundError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/DistinctRequiresSelectError.md b/docs/reference/classes/DistinctRequiresSelectError.md new file mode 100644 index 000000000..42ff98187 --- /dev/null +++ b/docs/reference/classes/DistinctRequiresSelectError.md @@ -0,0 +1,214 @@ +--- +id: DistinctRequiresSelectError +title: DistinctRequiresSelectError +--- + +# Class: DistinctRequiresSelectError + +Defined in: [packages/db/src/errors.ts:367](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L367) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new DistinctRequiresSelectError(): DistinctRequiresSelectError; +``` + +Defined in: [packages/db/src/errors.ts:368](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L368) + +#### Returns + +`DistinctRequiresSelectError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateAliasInSubqueryError.md b/docs/reference/classes/DuplicateAliasInSubqueryError.md new file mode 100644 index 000000000..d951c456c --- /dev/null +++ b/docs/reference/classes/DuplicateAliasInSubqueryError.md @@ -0,0 +1,228 @@ +--- +id: DuplicateAliasInSubqueryError +title: DuplicateAliasInSubqueryError +--- + +# Class: DuplicateAliasInSubqueryError + +Defined in: [packages/db/src/errors.ts:412](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L412) + +Error thrown when a subquery uses the same alias as its parent query. +This causes issues because parent and subquery would share the same input streams, +leading to empty results or incorrect data (aggregation cross-leaking). + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateAliasInSubqueryError(alias, parentAliases): DuplicateAliasInSubqueryError; +``` + +Defined in: [packages/db/src/errors.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L413) + +#### Parameters + +##### alias + +`string` + +##### parentAliases + +`string`[] + +#### Returns + +`DuplicateAliasInSubqueryError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateDbInstanceError.md b/docs/reference/classes/DuplicateDbInstanceError.md new file mode 100644 index 000000000..2d292ae10 --- /dev/null +++ b/docs/reference/classes/DuplicateDbInstanceError.md @@ -0,0 +1,214 @@ +--- +id: DuplicateDbInstanceError +title: DuplicateDbInstanceError +--- + +# Class: DuplicateDbInstanceError + +Defined in: [packages/db/src/errors.ts:45](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L45) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateDbInstanceError(): DuplicateDbInstanceError; +``` + +Defined in: [packages/db/src/errors.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L46) + +#### Returns + +`DuplicateDbInstanceError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateKeyError.md b/docs/reference/classes/DuplicateKeyError.md new file mode 100644 index 000000000..35d674b3f --- /dev/null +++ b/docs/reference/classes/DuplicateKeyError.md @@ -0,0 +1,220 @@ +--- +id: DuplicateKeyError +title: DuplicateKeyError +--- + +# Class: DuplicateKeyError + +Defined in: [packages/db/src/errors.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L154) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateKeyError(key): DuplicateKeyError; +``` + +Defined in: [packages/db/src/errors.ts:155](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L155) + +#### Parameters + +##### key + +`string` | `number` + +#### Returns + +`DuplicateKeyError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/DuplicateKeySyncError.md b/docs/reference/classes/DuplicateKeySyncError.md new file mode 100644 index 000000000..6d31e7271 --- /dev/null +++ b/docs/reference/classes/DuplicateKeySyncError.md @@ -0,0 +1,224 @@ +--- +id: DuplicateKeySyncError +title: DuplicateKeySyncError +--- + +# Class: DuplicateKeySyncError + +Defined in: [packages/db/src/errors.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L162) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateKeySyncError(key, collectionId): DuplicateKeySyncError; +``` + +Defined in: [packages/db/src/errors.ts:163](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L163) + +#### Parameters + +##### key + +`string` | `number` + +##### collectionId + +`string` + +#### Returns + +`DuplicateKeySyncError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/EmptyReferencePathError.md b/docs/reference/classes/EmptyReferencePathError.md new file mode 100644 index 000000000..c630e7a50 --- /dev/null +++ b/docs/reference/classes/EmptyReferencePathError.md @@ -0,0 +1,214 @@ +--- +id: EmptyReferencePathError +title: EmptyReferencePathError +--- + +# Class: EmptyReferencePathError + +Defined in: [packages/db/src/errors.ts:435](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L435) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new EmptyReferencePathError(): EmptyReferencePathError; +``` + +Defined in: [packages/db/src/errors.ts:436](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L436) + +#### Returns + +`EmptyReferencePathError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/GroupByError.md b/docs/reference/classes/GroupByError.md new file mode 100644 index 000000000..58bf920e5 --- /dev/null +++ b/docs/reference/classes/GroupByError.md @@ -0,0 +1,227 @@ +--- +id: GroupByError +title: GroupByError +--- + +# Class: GroupByError + +Defined in: [packages/db/src/errors.ts:510](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L510) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`NonAggregateExpressionNotInGroupByError`](../NonAggregateExpressionNotInGroupByError.md) +- [`UnsupportedAggregateFunctionError`](../UnsupportedAggregateFunctionError.md) +- [`AggregateFunctionNotInSelectError`](../AggregateFunctionNotInSelectError.md) +- [`UnknownHavingExpressionTypeError`](../UnknownHavingExpressionTypeError.md) + +## Constructors + +### Constructor + +```ts +new GroupByError(message): GroupByError; +``` + +Defined in: [packages/db/src/errors.ts:511](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L511) + +#### Parameters + +##### message + +`string` + +#### Returns + +`GroupByError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/HavingRequiresGroupByError.md b/docs/reference/classes/HavingRequiresGroupByError.md new file mode 100644 index 000000000..a97da0785 --- /dev/null +++ b/docs/reference/classes/HavingRequiresGroupByError.md @@ -0,0 +1,214 @@ +--- +id: HavingRequiresGroupByError +title: HavingRequiresGroupByError +--- + +# Class: HavingRequiresGroupByError + +Defined in: [packages/db/src/errors.ts:373](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L373) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new HavingRequiresGroupByError(): HavingRequiresGroupByError; +``` + +Defined in: [packages/db/src/errors.ts:374](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L374) + +#### Returns + +`HavingRequiresGroupByError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/IndexProxy.md b/docs/reference/classes/IndexProxy.md new file mode 100644 index 000000000..0ff7dff72 --- /dev/null +++ b/docs/reference/classes/IndexProxy.md @@ -0,0 +1,346 @@ +--- +id: IndexProxy +title: IndexProxy +--- + +# Class: IndexProxy\ + +Defined in: [packages/db/src/indexes/lazy-index.ts:131](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L131) + +Proxy that provides synchronous interface while index loads asynchronously + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Constructors + +### Constructor + +```ts +new IndexProxy(indexId, lazyIndex): IndexProxy; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L132) + +#### Parameters + +##### indexId + +`number` + +##### lazyIndex + +[`LazyIndexWrapper`](../LazyIndexWrapper.md)\<`TKey`\> + +#### Returns + +`IndexProxy`\<`TKey`\> + +## Accessors + +### expression + +#### Get Signature + +```ts +get expression(): BasicExpression; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:178](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L178) + +Get the index expression (available immediately) + +##### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +*** + +### id + +#### Get Signature + +```ts +get id(): number; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:161](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L161) + +Get the index ID + +##### Returns + +`number` + +*** + +### index + +#### Get Signature + +```ts +get index(): BaseIndex; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:140](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L140) + +Get the resolved index (throws if not ready) + +##### Returns + +[`BaseIndex`](../BaseIndex.md)\<`TKey`\> + +*** + +### indexedKeysSet + +#### Get Signature + +```ts +get indexedKeysSet(): Set; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L216) + +##### Returns + +`Set`\<`TKey`\> + +*** + +### isReady + +#### Get Signature + +```ts +get isReady(): boolean; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L147) + +Check if index is ready + +##### Returns + +`boolean` + +*** + +### keyCount + +#### Get Signature + +```ts +get keyCount(): number; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:211](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L211) + +Get the key count (throws if not ready) + +##### Returns + +`number` + +*** + +### name + +#### Get Signature + +```ts +get name(): string | undefined; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:168](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L168) + +Get the index name (throws if not ready) + +##### Returns + +`string` \| `undefined` + +*** + +### orderedEntriesArray + +#### Get Signature + +```ts +get orderedEntriesArray(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L221) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### valueMapData + +#### Get Signature + +```ts +get valueMapData(): Map>; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:226](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L226) + +##### Returns + +`Map`\<`any`, `Set`\<`TKey`\>\> + +## Methods + +### \_getLazyWrapper() + +```ts +_getLazyWrapper(): LazyIndexWrapper; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:248](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L248) + +#### Returns + +[`LazyIndexWrapper`](../LazyIndexWrapper.md)\<`TKey`\> + +*** + +### equalityLookup() + +```ts +equalityLookup(value): Set; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:232](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L232) + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### getStats() + +```ts +getStats(): IndexStats; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:192](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L192) + +Get index statistics (throws if not ready) + +#### Returns + +[`IndexStats`](../../interfaces/IndexStats.md) + +*** + +### inArrayLookup() + +```ts +inArrayLookup(values): Set; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:242](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L242) + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +*** + +### matchesField() + +```ts +matchesField(fieldPath): boolean; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L199) + +Check if index matches a field path (available immediately) + +#### Parameters + +##### fieldPath + +`string`[] + +#### Returns + +`boolean` + +*** + +### rangeQuery() + +```ts +rangeQuery(options): Set; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L237) + +#### Parameters + +##### options + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### supports() + +```ts +supports(operation): boolean; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:185](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L185) + +Check if index supports an operation (throws if not ready) + +#### Parameters + +##### operation + +`any` + +#### Returns + +`boolean` + +*** + +### whenReady() + +```ts +whenReady(): Promise>; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L154) + +Wait for index to be ready + +#### Returns + +`Promise`\<[`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> diff --git a/docs/reference/classes/InvalidCollectionStatusTransitionError.md b/docs/reference/classes/InvalidCollectionStatusTransitionError.md new file mode 100644 index 000000000..81c1a3d0c --- /dev/null +++ b/docs/reference/classes/InvalidCollectionStatusTransitionError.md @@ -0,0 +1,231 @@ +--- +id: InvalidCollectionStatusTransitionError +title: InvalidCollectionStatusTransitionError +--- + +# Class: InvalidCollectionStatusTransitionError + +Defined in: [packages/db/src/errors.ts:118](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L118) + +## Extends + +- [`CollectionStateError`](../CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new InvalidCollectionStatusTransitionError( + from, + to, + collectionId): InvalidCollectionStatusTransitionError; +``` + +Defined in: [packages/db/src/errors.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L119) + +#### Parameters + +##### from + +`string` + +##### to + +`string` + +##### collectionId + +`string` + +#### Returns + +`InvalidCollectionStatusTransitionError` + +#### Overrides + +[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinCondition.md b/docs/reference/classes/InvalidJoinCondition.md new file mode 100644 index 000000000..a859dc2de --- /dev/null +++ b/docs/reference/classes/InvalidJoinCondition.md @@ -0,0 +1,214 @@ +--- +id: InvalidJoinCondition +title: InvalidJoinCondition +--- + +# Class: InvalidJoinCondition + +Defined in: [packages/db/src/errors.ts:497](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L497) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinCondition(): InvalidJoinCondition; +``` + +Defined in: [packages/db/src/errors.ts:498](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L498) + +#### Returns + +`InvalidJoinCondition` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionLeftSourceError.md b/docs/reference/classes/InvalidJoinConditionLeftSourceError.md new file mode 100644 index 000000000..ffd4e1ab6 --- /dev/null +++ b/docs/reference/classes/InvalidJoinConditionLeftSourceError.md @@ -0,0 +1,220 @@ +--- +id: InvalidJoinConditionLeftSourceError +title: InvalidJoinConditionLeftSourceError +--- + +# Class: InvalidJoinConditionLeftSourceError + +Defined in: [packages/db/src/errors.ts:481](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L481) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionLeftSourceError(sourceAlias): InvalidJoinConditionLeftSourceError; +``` + +Defined in: [packages/db/src/errors.ts:482](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L482) + +#### Parameters + +##### sourceAlias + +`string` + +#### Returns + +`InvalidJoinConditionLeftSourceError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionRightSourceError.md b/docs/reference/classes/InvalidJoinConditionRightSourceError.md new file mode 100644 index 000000000..323433486 --- /dev/null +++ b/docs/reference/classes/InvalidJoinConditionRightSourceError.md @@ -0,0 +1,220 @@ +--- +id: InvalidJoinConditionRightSourceError +title: InvalidJoinConditionRightSourceError +--- + +# Class: InvalidJoinConditionRightSourceError + +Defined in: [packages/db/src/errors.ts:489](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L489) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionRightSourceError(sourceAlias): InvalidJoinConditionRightSourceError; +``` + +Defined in: [packages/db/src/errors.ts:490](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L490) + +#### Parameters + +##### sourceAlias + +`string` + +#### Returns + +`InvalidJoinConditionRightSourceError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionSameSourceError.md b/docs/reference/classes/InvalidJoinConditionSameSourceError.md new file mode 100644 index 000000000..0915736d7 --- /dev/null +++ b/docs/reference/classes/InvalidJoinConditionSameSourceError.md @@ -0,0 +1,220 @@ +--- +id: InvalidJoinConditionSameSourceError +title: InvalidJoinConditionSameSourceError +--- + +# Class: InvalidJoinConditionSameSourceError + +Defined in: [packages/db/src/errors.ts:467](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L467) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionSameSourceError(sourceAlias): InvalidJoinConditionSameSourceError; +``` + +Defined in: [packages/db/src/errors.ts:468](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L468) + +#### Parameters + +##### sourceAlias + +`string` + +#### Returns + +`InvalidJoinConditionSameSourceError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md b/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md new file mode 100644 index 000000000..da3e0ca47 --- /dev/null +++ b/docs/reference/classes/InvalidJoinConditionSourceMismatchError.md @@ -0,0 +1,214 @@ +--- +id: InvalidJoinConditionSourceMismatchError +title: InvalidJoinConditionSourceMismatchError +--- + +# Class: InvalidJoinConditionSourceMismatchError + +Defined in: [packages/db/src/errors.ts:475](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L475) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionSourceMismatchError(): InvalidJoinConditionSourceMismatchError; +``` + +Defined in: [packages/db/src/errors.ts:476](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L476) + +#### Returns + +`InvalidJoinConditionSourceMismatchError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidSchemaError.md b/docs/reference/classes/InvalidSchemaError.md new file mode 100644 index 000000000..a98453c36 --- /dev/null +++ b/docs/reference/classes/InvalidSchemaError.md @@ -0,0 +1,214 @@ +--- +id: InvalidSchemaError +title: InvalidSchemaError +--- + +# Class: InvalidSchemaError + +Defined in: [packages/db/src/errors.ts:90](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L90) + +## Extends + +- [`CollectionConfigurationError`](../CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new InvalidSchemaError(): InvalidSchemaError; +``` + +Defined in: [packages/db/src/errors.ts:91](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L91) + +#### Returns + +`InvalidSchemaError` + +#### Overrides + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidSourceError.md b/docs/reference/classes/InvalidSourceError.md new file mode 100644 index 000000000..23fea4c1d --- /dev/null +++ b/docs/reference/classes/InvalidSourceError.md @@ -0,0 +1,220 @@ +--- +id: InvalidSourceError +title: InvalidSourceError +--- + +# Class: InvalidSourceError + +Defined in: [packages/db/src/errors.ts:339](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L339) + +## Extends + +- [`QueryBuilderError`](../QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new InvalidSourceError(alias): InvalidSourceError; +``` + +Defined in: [packages/db/src/errors.ts:340](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L340) + +#### Parameters + +##### alias + +`string` + +#### Returns + +`InvalidSourceError` + +#### Overrides + +[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidStorageDataFormatError.md b/docs/reference/classes/InvalidStorageDataFormatError.md new file mode 100644 index 000000000..ab6c2eeaa --- /dev/null +++ b/docs/reference/classes/InvalidStorageDataFormatError.md @@ -0,0 +1,224 @@ +--- +id: InvalidStorageDataFormatError +title: InvalidStorageDataFormatError +--- + +# Class: InvalidStorageDataFormatError + +Defined in: [packages/db/src/errors.ts:575](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L575) + +## Extends + +- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new InvalidStorageDataFormatError(storageKey, key): InvalidStorageDataFormatError; +``` + +Defined in: [packages/db/src/errors.ts:576](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L576) + +#### Parameters + +##### storageKey + +`string` + +##### key + +`string` + +#### Returns + +`InvalidStorageDataFormatError` + +#### Overrides + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/InvalidStorageObjectFormatError.md b/docs/reference/classes/InvalidStorageObjectFormatError.md new file mode 100644 index 000000000..a08dbf47b --- /dev/null +++ b/docs/reference/classes/InvalidStorageObjectFormatError.md @@ -0,0 +1,220 @@ +--- +id: InvalidStorageObjectFormatError +title: InvalidStorageObjectFormatError +--- + +# Class: InvalidStorageObjectFormatError + +Defined in: [packages/db/src/errors.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L583) + +## Extends + +- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new InvalidStorageObjectFormatError(storageKey): InvalidStorageObjectFormatError; +``` + +Defined in: [packages/db/src/errors.ts:584](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L584) + +#### Parameters + +##### storageKey + +`string` + +#### Returns + +`InvalidStorageObjectFormatError` + +#### Overrides + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinCollectionNotFoundError.md b/docs/reference/classes/JoinCollectionNotFoundError.md new file mode 100644 index 000000000..931a5016f --- /dev/null +++ b/docs/reference/classes/JoinCollectionNotFoundError.md @@ -0,0 +1,220 @@ +--- +id: JoinCollectionNotFoundError +title: JoinCollectionNotFoundError +--- + +# Class: JoinCollectionNotFoundError + +Defined in: [packages/db/src/errors.ts:447](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L447) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new JoinCollectionNotFoundError(collectionId): JoinCollectionNotFoundError; +``` + +Defined in: [packages/db/src/errors.ts:448](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L448) + +#### Parameters + +##### collectionId + +`string` + +#### Returns + +`JoinCollectionNotFoundError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinConditionMustBeEqualityError.md b/docs/reference/classes/JoinConditionMustBeEqualityError.md new file mode 100644 index 000000000..2a843bbfe --- /dev/null +++ b/docs/reference/classes/JoinConditionMustBeEqualityError.md @@ -0,0 +1,214 @@ +--- +id: JoinConditionMustBeEqualityError +title: JoinConditionMustBeEqualityError +--- + +# Class: JoinConditionMustBeEqualityError + +Defined in: [packages/db/src/errors.ts:347](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L347) + +## Extends + +- [`QueryBuilderError`](../QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new JoinConditionMustBeEqualityError(): JoinConditionMustBeEqualityError; +``` + +Defined in: [packages/db/src/errors.ts:348](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L348) + +#### Returns + +`JoinConditionMustBeEqualityError` + +#### Overrides + +[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/JoinError.md b/docs/reference/classes/JoinError.md new file mode 100644 index 000000000..ce0a159fa --- /dev/null +++ b/docs/reference/classes/JoinError.md @@ -0,0 +1,230 @@ +--- +id: JoinError +title: JoinError +--- + +# Class: JoinError + +Defined in: [packages/db/src/errors.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L454) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`UnsupportedJoinTypeError`](../UnsupportedJoinTypeError.md) +- [`InvalidJoinConditionSameSourceError`](../InvalidJoinConditionSameSourceError.md) +- [`InvalidJoinConditionSourceMismatchError`](../InvalidJoinConditionSourceMismatchError.md) +- [`InvalidJoinConditionLeftSourceError`](../InvalidJoinConditionLeftSourceError.md) +- [`InvalidJoinConditionRightSourceError`](../InvalidJoinConditionRightSourceError.md) +- [`InvalidJoinCondition`](../InvalidJoinCondition.md) +- [`UnsupportedJoinSourceTypeError`](../UnsupportedJoinSourceTypeError.md) + +## Constructors + +### Constructor + +```ts +new JoinError(message): JoinError; +``` + +Defined in: [packages/db/src/errors.ts:455](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L455) + +#### Parameters + +##### message + +`string` + +#### Returns + +`JoinError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/KeyUpdateNotAllowedError.md b/docs/reference/classes/KeyUpdateNotAllowedError.md new file mode 100644 index 000000000..269bb3572 --- /dev/null +++ b/docs/reference/classes/KeyUpdateNotAllowedError.md @@ -0,0 +1,224 @@ +--- +id: KeyUpdateNotAllowedError +title: KeyUpdateNotAllowedError +--- + +# Class: KeyUpdateNotAllowedError + +Defined in: [packages/db/src/errors.ts:190](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L190) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new KeyUpdateNotAllowedError(originalKey, newKey): KeyUpdateNotAllowedError; +``` + +Defined in: [packages/db/src/errors.ts:191](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L191) + +#### Parameters + +##### originalKey + +`string` | `number` + +##### newKey + +`string` | `number` + +#### Returns + +`KeyUpdateNotAllowedError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/LazyIndexWrapper.md b/docs/reference/classes/LazyIndexWrapper.md new file mode 100644 index 000000000..45592142b --- /dev/null +++ b/docs/reference/classes/LazyIndexWrapper.md @@ -0,0 +1,158 @@ +--- +id: LazyIndexWrapper +title: LazyIndexWrapper +--- + +# Class: LazyIndexWrapper\ + +Defined in: [packages/db/src/indexes/lazy-index.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L39) + +Wrapper that defers index creation until first sync + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Constructors + +### Constructor + +```ts +new LazyIndexWrapper( + id, + expression, + name, + resolver, + options, +collectionEntries?): LazyIndexWrapper; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L43) + +#### Parameters + +##### id + +`number` + +##### expression + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +##### name + +`string` | `undefined` + +##### resolver + +[`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> + +##### options + +`any` + +##### collectionEntries? + +`Iterable`\<\[`TKey`, `any`\], `any`, `any`\> + +#### Returns + +`LazyIndexWrapper`\<`TKey`\> + +## Methods + +### getExpression() + +```ts +getExpression(): BasicExpression; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:118](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L118) + +Get the index expression + +#### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +*** + +### getId() + +```ts +getId(): number; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:104](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L104) + +Get the index ID + +#### Returns + +`number` + +*** + +### getName() + +```ts +getName(): string | undefined; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:111](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L111) + +Get the index name + +#### Returns + +`string` \| `undefined` + +*** + +### getResolved() + +```ts +getResolved(): BaseIndex; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L92) + +Get resolved index (throws if not ready) + +#### Returns + +[`BaseIndex`](../BaseIndex.md)\<`TKey`\> + +*** + +### isResolved() + +```ts +isResolved(): boolean; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L85) + +Check if already resolved + +#### Returns + +`boolean` + +*** + +### resolve() + +```ts +resolve(): Promise>; +``` + +Defined in: [packages/db/src/indexes/lazy-index.ts:69](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/lazy-index.ts#L69) + +Resolve the actual index + +#### Returns + +`Promise`\<[`BaseIndex`](../BaseIndex.md)\<`TKey`\>\> diff --git a/docs/reference/classes/LimitOffsetRequireOrderByError.md b/docs/reference/classes/LimitOffsetRequireOrderByError.md new file mode 100644 index 000000000..60d20a51a --- /dev/null +++ b/docs/reference/classes/LimitOffsetRequireOrderByError.md @@ -0,0 +1,214 @@ +--- +id: LimitOffsetRequireOrderByError +title: LimitOffsetRequireOrderByError +--- + +# Class: LimitOffsetRequireOrderByError + +Defined in: [packages/db/src/errors.ts:379](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L379) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new LimitOffsetRequireOrderByError(): LimitOffsetRequireOrderByError; +``` + +Defined in: [packages/db/src/errors.ts:380](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L380) + +#### Returns + +`LimitOffsetRequireOrderByError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/LocalStorageCollectionError.md b/docs/reference/classes/LocalStorageCollectionError.md new file mode 100644 index 000000000..851ef7f60 --- /dev/null +++ b/docs/reference/classes/LocalStorageCollectionError.md @@ -0,0 +1,226 @@ +--- +id: LocalStorageCollectionError +title: LocalStorageCollectionError +--- + +# Class: LocalStorageCollectionError + +Defined in: [packages/db/src/errors.ts:562](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L562) + +## Extends + +- [`StorageError`](../StorageError.md) + +## Extended by + +- [`StorageKeyRequiredError`](../StorageKeyRequiredError.md) +- [`InvalidStorageDataFormatError`](../InvalidStorageDataFormatError.md) +- [`InvalidStorageObjectFormatError`](../InvalidStorageObjectFormatError.md) + +## Constructors + +### Constructor + +```ts +new LocalStorageCollectionError(message): LocalStorageCollectionError; +``` + +Defined in: [packages/db/src/errors.ts:563](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L563) + +#### Parameters + +##### message + +`string` + +#### Returns + +`LocalStorageCollectionError` + +#### Overrides + +[`StorageError`](../StorageError.md).[`constructor`](../StorageError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`cause`](../StorageError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`message`](../StorageError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`name`](../StorageError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`stack`](../StorageError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`StorageError`](../StorageError.md).[`stackTraceLimit`](../StorageError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`StorageError`](../StorageError.md).[`captureStackTrace`](../StorageError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`StorageError`](../StorageError.md).[`prepareStackTrace`](../StorageError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingAliasInputsError.md b/docs/reference/classes/MissingAliasInputsError.md new file mode 100644 index 000000000..daf6f21ef --- /dev/null +++ b/docs/reference/classes/MissingAliasInputsError.md @@ -0,0 +1,223 @@ +--- +id: MissingAliasInputsError +title: MissingAliasInputsError +--- + +# Class: MissingAliasInputsError + +Defined in: [packages/db/src/errors.ts:659](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L659) + +Internal error when the compiler returns aliases that don't have corresponding input streams. +This should never happen since all aliases come from user declarations. + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new MissingAliasInputsError(missingAliases): MissingAliasInputsError; +``` + +Defined in: [packages/db/src/errors.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L660) + +#### Parameters + +##### missingAliases + +`string`[] + +#### Returns + +`MissingAliasInputsError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingDeleteHandlerError.md b/docs/reference/classes/MissingDeleteHandlerError.md new file mode 100644 index 000000000..9c2a9075f --- /dev/null +++ b/docs/reference/classes/MissingDeleteHandlerError.md @@ -0,0 +1,214 @@ +--- +id: MissingDeleteHandlerError +title: MissingDeleteHandlerError +--- + +# Class: MissingDeleteHandlerError + +Defined in: [packages/db/src/errors.ts:236](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L236) + +## Extends + +- [`MissingHandlerError`](../MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingDeleteHandlerError(): MissingDeleteHandlerError; +``` + +Defined in: [packages/db/src/errors.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L237) + +#### Returns + +`MissingDeleteHandlerError` + +#### Overrides + +[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingHandlerError.md b/docs/reference/classes/MissingHandlerError.md new file mode 100644 index 000000000..f5c9c14d5 --- /dev/null +++ b/docs/reference/classes/MissingHandlerError.md @@ -0,0 +1,226 @@ +--- +id: MissingHandlerError +title: MissingHandlerError +--- + +# Class: MissingHandlerError + +Defined in: [packages/db/src/errors.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L213) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`MissingInsertHandlerError`](../MissingInsertHandlerError.md) +- [`MissingUpdateHandlerError`](../MissingUpdateHandlerError.md) +- [`MissingDeleteHandlerError`](../MissingDeleteHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingHandlerError(message): MissingHandlerError; +``` + +Defined in: [packages/db/src/errors.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L214) + +#### Parameters + +##### message + +`string` + +#### Returns + +`MissingHandlerError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingInsertHandlerError.md b/docs/reference/classes/MissingInsertHandlerError.md new file mode 100644 index 000000000..234ae6450 --- /dev/null +++ b/docs/reference/classes/MissingInsertHandlerError.md @@ -0,0 +1,214 @@ +--- +id: MissingInsertHandlerError +title: MissingInsertHandlerError +--- + +# Class: MissingInsertHandlerError + +Defined in: [packages/db/src/errors.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L220) + +## Extends + +- [`MissingHandlerError`](../MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingInsertHandlerError(): MissingInsertHandlerError; +``` + +Defined in: [packages/db/src/errors.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L221) + +#### Returns + +`MissingInsertHandlerError` + +#### Overrides + +[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingMutationFunctionError.md b/docs/reference/classes/MissingMutationFunctionError.md new file mode 100644 index 000000000..53c895268 --- /dev/null +++ b/docs/reference/classes/MissingMutationFunctionError.md @@ -0,0 +1,214 @@ +--- +id: MissingMutationFunctionError +title: MissingMutationFunctionError +--- + +# Class: MissingMutationFunctionError + +Defined in: [packages/db/src/errors.ts:252](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L252) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new MissingMutationFunctionError(): MissingMutationFunctionError; +``` + +Defined in: [packages/db/src/errors.ts:253](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L253) + +#### Returns + +`MissingMutationFunctionError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingUpdateArgumentError.md b/docs/reference/classes/MissingUpdateArgumentError.md new file mode 100644 index 000000000..6382787b1 --- /dev/null +++ b/docs/reference/classes/MissingUpdateArgumentError.md @@ -0,0 +1,214 @@ +--- +id: MissingUpdateArgumentError +title: MissingUpdateArgumentError +--- + +# Class: MissingUpdateArgumentError + +Defined in: [packages/db/src/errors.ts:170](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L170) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new MissingUpdateArgumentError(): MissingUpdateArgumentError; +``` + +Defined in: [packages/db/src/errors.ts:171](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L171) + +#### Returns + +`MissingUpdateArgumentError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/MissingUpdateHandlerError.md b/docs/reference/classes/MissingUpdateHandlerError.md new file mode 100644 index 000000000..dddb7d4c0 --- /dev/null +++ b/docs/reference/classes/MissingUpdateHandlerError.md @@ -0,0 +1,214 @@ +--- +id: MissingUpdateHandlerError +title: MissingUpdateHandlerError +--- + +# Class: MissingUpdateHandlerError + +Defined in: [packages/db/src/errors.ts:228](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L228) + +## Extends + +- [`MissingHandlerError`](../MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingUpdateHandlerError(): MissingUpdateHandlerError; +``` + +Defined in: [packages/db/src/errors.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L229) + +#### Returns + +`MissingUpdateHandlerError` + +#### Overrides + +[`MissingHandlerError`](../MissingHandlerError.md).[`constructor`](../MissingHandlerError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`cause`](../MissingHandlerError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`message`](../MissingHandlerError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`name`](../MissingHandlerError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stack`](../MissingHandlerError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`stackTraceLimit`](../MissingHandlerError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`captureStackTrace`](../MissingHandlerError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`MissingHandlerError`](../MissingHandlerError.md).[`prepareStackTrace`](../MissingHandlerError.md#preparestacktrace) diff --git a/docs/reference/classes/NegativeActiveSubscribersError.md b/docs/reference/classes/NegativeActiveSubscribersError.md new file mode 100644 index 000000000..cd3b1cc36 --- /dev/null +++ b/docs/reference/classes/NegativeActiveSubscribersError.md @@ -0,0 +1,214 @@ +--- +id: NegativeActiveSubscribersError +title: NegativeActiveSubscribersError +--- + +# Class: NegativeActiveSubscribersError + +Defined in: [packages/db/src/errors.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L132) + +## Extends + +- [`CollectionStateError`](../CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new NegativeActiveSubscribersError(): NegativeActiveSubscribersError; +``` + +Defined in: [packages/db/src/errors.ts:133](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L133) + +#### Returns + +`NegativeActiveSubscribersError` + +#### Overrides + +[`CollectionStateError`](../CollectionStateError.md).[`constructor`](../CollectionStateError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`cause`](../CollectionStateError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`message`](../CollectionStateError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`name`](../CollectionStateError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stack`](../CollectionStateError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`stackTraceLimit`](../CollectionStateError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`captureStackTrace`](../CollectionStateError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionStateError`](../CollectionStateError.md).[`prepareStackTrace`](../CollectionStateError.md#preparestacktrace) diff --git a/docs/reference/classes/NoKeysPassedToDeleteError.md b/docs/reference/classes/NoKeysPassedToDeleteError.md new file mode 100644 index 000000000..25270764b --- /dev/null +++ b/docs/reference/classes/NoKeysPassedToDeleteError.md @@ -0,0 +1,214 @@ +--- +id: NoKeysPassedToDeleteError +title: NoKeysPassedToDeleteError +--- + +# Class: NoKeysPassedToDeleteError + +Defined in: [packages/db/src/errors.ts:198](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L198) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new NoKeysPassedToDeleteError(): NoKeysPassedToDeleteError; +``` + +Defined in: [packages/db/src/errors.ts:199](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L199) + +#### Returns + +`NoKeysPassedToDeleteError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/NoKeysPassedToUpdateError.md b/docs/reference/classes/NoKeysPassedToUpdateError.md new file mode 100644 index 000000000..f9548e768 --- /dev/null +++ b/docs/reference/classes/NoKeysPassedToUpdateError.md @@ -0,0 +1,214 @@ +--- +id: NoKeysPassedToUpdateError +title: NoKeysPassedToUpdateError +--- + +# Class: NoKeysPassedToUpdateError + +Defined in: [packages/db/src/errors.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L176) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new NoKeysPassedToUpdateError(): NoKeysPassedToUpdateError; +``` + +Defined in: [packages/db/src/errors.ts:177](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L177) + +#### Returns + +`NoKeysPassedToUpdateError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/NoPendingSyncTransactionCommitError.md b/docs/reference/classes/NoPendingSyncTransactionCommitError.md new file mode 100644 index 000000000..830f3f3d9 --- /dev/null +++ b/docs/reference/classes/NoPendingSyncTransactionCommitError.md @@ -0,0 +1,214 @@ +--- +id: NoPendingSyncTransactionCommitError +title: NoPendingSyncTransactionCommitError +--- + +# Class: NoPendingSyncTransactionCommitError + +Defined in: [packages/db/src/errors.ts:305](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L305) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new NoPendingSyncTransactionCommitError(): NoPendingSyncTransactionCommitError; +``` + +Defined in: [packages/db/src/errors.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L306) + +#### Returns + +`NoPendingSyncTransactionCommitError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/NoPendingSyncTransactionWriteError.md b/docs/reference/classes/NoPendingSyncTransactionWriteError.md new file mode 100644 index 000000000..53260bfa4 --- /dev/null +++ b/docs/reference/classes/NoPendingSyncTransactionWriteError.md @@ -0,0 +1,214 @@ +--- +id: NoPendingSyncTransactionWriteError +title: NoPendingSyncTransactionWriteError +--- + +# Class: NoPendingSyncTransactionWriteError + +Defined in: [packages/db/src/errors.ts:291](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L291) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new NoPendingSyncTransactionWriteError(): NoPendingSyncTransactionWriteError; +``` + +Defined in: [packages/db/src/errors.ts:292](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L292) + +#### Returns + +`NoPendingSyncTransactionWriteError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md b/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md new file mode 100644 index 000000000..a8b5b02bb --- /dev/null +++ b/docs/reference/classes/NonAggregateExpressionNotInGroupByError.md @@ -0,0 +1,220 @@ +--- +id: NonAggregateExpressionNotInGroupByError +title: NonAggregateExpressionNotInGroupByError +--- + +# Class: NonAggregateExpressionNotInGroupByError + +Defined in: [packages/db/src/errors.ts:517](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L517) + +## Extends + +- [`GroupByError`](../GroupByError.md) + +## Constructors + +### Constructor + +```ts +new NonAggregateExpressionNotInGroupByError(alias): NonAggregateExpressionNotInGroupByError; +``` + +Defined in: [packages/db/src/errors.ts:518](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L518) + +#### Parameters + +##### alias + +`string` + +#### Returns + +`NonAggregateExpressionNotInGroupByError` + +#### Overrides + +[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/NonRetriableError.md b/docs/reference/classes/NonRetriableError.md new file mode 100644 index 000000000..c048829fd --- /dev/null +++ b/docs/reference/classes/NonRetriableError.md @@ -0,0 +1,220 @@ +--- +id: NonRetriableError +title: NonRetriableError +--- + +# Class: NonRetriableError + +Defined in: [packages/db/src/errors.ts:10](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L10) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new NonRetriableError(message): NonRetriableError; +``` + +Defined in: [packages/db/src/errors.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L11) + +#### Parameters + +##### message + +`string` + +#### Returns + +`NonRetriableError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/OnMutateMustBeSynchronousError.md b/docs/reference/classes/OnMutateMustBeSynchronousError.md new file mode 100644 index 000000000..f227a2ccb --- /dev/null +++ b/docs/reference/classes/OnMutateMustBeSynchronousError.md @@ -0,0 +1,214 @@ +--- +id: OnMutateMustBeSynchronousError +title: OnMutateMustBeSynchronousError +--- + +# Class: OnMutateMustBeSynchronousError + +Defined in: [packages/db/src/errors.ts:258](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L258) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new OnMutateMustBeSynchronousError(): OnMutateMustBeSynchronousError; +``` + +Defined in: [packages/db/src/errors.ts:259](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L259) + +#### Returns + +`OnMutateMustBeSynchronousError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/OnlyOneSourceAllowedError.md b/docs/reference/classes/OnlyOneSourceAllowedError.md new file mode 100644 index 000000000..a834bbe02 --- /dev/null +++ b/docs/reference/classes/OnlyOneSourceAllowedError.md @@ -0,0 +1,220 @@ +--- +id: OnlyOneSourceAllowedError +title: OnlyOneSourceAllowedError +--- + +# Class: OnlyOneSourceAllowedError + +Defined in: [packages/db/src/errors.ts:327](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L327) + +## Extends + +- [`QueryBuilderError`](../QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new OnlyOneSourceAllowedError(context): OnlyOneSourceAllowedError; +``` + +Defined in: [packages/db/src/errors.ts:328](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L328) + +#### Parameters + +##### context + +`string` + +#### Returns + +`OnlyOneSourceAllowedError` + +#### Overrides + +[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryBuilderError.md b/docs/reference/classes/QueryBuilderError.md new file mode 100644 index 000000000..088ac876e --- /dev/null +++ b/docs/reference/classes/QueryBuilderError.md @@ -0,0 +1,228 @@ +--- +id: QueryBuilderError +title: QueryBuilderError +--- + +# Class: QueryBuilderError + +Defined in: [packages/db/src/errors.ts:320](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L320) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`OnlyOneSourceAllowedError`](../OnlyOneSourceAllowedError.md) +- [`SubQueryMustHaveFromClauseError`](../SubQueryMustHaveFromClauseError.md) +- [`InvalidSourceError`](../InvalidSourceError.md) +- [`JoinConditionMustBeEqualityError`](../JoinConditionMustBeEqualityError.md) +- [`QueryMustHaveFromClauseError`](../QueryMustHaveFromClauseError.md) + +## Constructors + +### Constructor + +```ts +new QueryBuilderError(message): QueryBuilderError; +``` + +Defined in: [packages/db/src/errors.ts:321](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L321) + +#### Parameters + +##### message + +`string` + +#### Returns + +`QueryBuilderError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryCompilationError.md b/docs/reference/classes/QueryCompilationError.md new file mode 100644 index 000000000..8b6542c43 --- /dev/null +++ b/docs/reference/classes/QueryCompilationError.md @@ -0,0 +1,237 @@ +--- +id: QueryCompilationError +title: QueryCompilationError +--- + +# Class: QueryCompilationError + +Defined in: [packages/db/src/errors.ts:360](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L360) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`DistinctRequiresSelectError`](../DistinctRequiresSelectError.md) +- [`HavingRequiresGroupByError`](../HavingRequiresGroupByError.md) +- [`LimitOffsetRequireOrderByError`](../LimitOffsetRequireOrderByError.md) +- [`CollectionInputNotFoundError`](../CollectionInputNotFoundError.md) +- [`DuplicateAliasInSubqueryError`](../DuplicateAliasInSubqueryError.md) +- [`UnsupportedFromTypeError`](../UnsupportedFromTypeError.md) +- [`UnknownExpressionTypeError`](../UnknownExpressionTypeError.md) +- [`EmptyReferencePathError`](../EmptyReferencePathError.md) +- [`UnknownFunctionError`](../UnknownFunctionError.md) +- [`JoinCollectionNotFoundError`](../JoinCollectionNotFoundError.md) +- [`SubscriptionNotFoundError`](../SubscriptionNotFoundError.md) +- [`AggregateNotSupportedError`](../AggregateNotSupportedError.md) +- [`MissingAliasInputsError`](../MissingAliasInputsError.md) +- [`SetWindowRequiresOrderByError`](../SetWindowRequiresOrderByError.md) + +## Constructors + +### Constructor + +```ts +new QueryCompilationError(message): QueryCompilationError; +``` + +Defined in: [packages/db/src/errors.ts:361](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L361) + +#### Parameters + +##### message + +`string` + +#### Returns + +`QueryCompilationError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryMustHaveFromClauseError.md b/docs/reference/classes/QueryMustHaveFromClauseError.md new file mode 100644 index 000000000..4d0b6b6a4 --- /dev/null +++ b/docs/reference/classes/QueryMustHaveFromClauseError.md @@ -0,0 +1,214 @@ +--- +id: QueryMustHaveFromClauseError +title: QueryMustHaveFromClauseError +--- + +# Class: QueryMustHaveFromClauseError + +Defined in: [packages/db/src/errors.ts:353](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L353) + +## Extends + +- [`QueryBuilderError`](../QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new QueryMustHaveFromClauseError(): QueryMustHaveFromClauseError; +``` + +Defined in: [packages/db/src/errors.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L354) + +#### Returns + +`QueryMustHaveFromClauseError` + +#### Overrides + +[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/QueryOptimizerError.md b/docs/reference/classes/QueryOptimizerError.md new file mode 100644 index 000000000..54608cc22 --- /dev/null +++ b/docs/reference/classes/QueryOptimizerError.md @@ -0,0 +1,225 @@ +--- +id: QueryOptimizerError +title: QueryOptimizerError +--- + +# Class: QueryOptimizerError + +Defined in: [packages/db/src/errors.ts:603](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L603) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`CannotCombineEmptyExpressionListError`](../CannotCombineEmptyExpressionListError.md) +- [`WhereClauseConversionError`](../WhereClauseConversionError.md) + +## Constructors + +### Constructor + +```ts +new QueryOptimizerError(message): QueryOptimizerError; +``` + +Defined in: [packages/db/src/errors.ts:604](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L604) + +#### Parameters + +##### message + +`string` + +#### Returns + +`QueryOptimizerError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SchemaMustBeSynchronousError.md b/docs/reference/classes/SchemaMustBeSynchronousError.md new file mode 100644 index 000000000..85d06e5fa --- /dev/null +++ b/docs/reference/classes/SchemaMustBeSynchronousError.md @@ -0,0 +1,214 @@ +--- +id: SchemaMustBeSynchronousError +title: SchemaMustBeSynchronousError +--- + +# Class: SchemaMustBeSynchronousError + +Defined in: [packages/db/src/errors.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L96) + +## Extends + +- [`CollectionConfigurationError`](../CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new SchemaMustBeSynchronousError(): SchemaMustBeSynchronousError; +``` + +Defined in: [packages/db/src/errors.ts:97](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L97) + +#### Returns + +`SchemaMustBeSynchronousError` + +#### Overrides + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`constructor`](../CollectionConfigurationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`cause`](../CollectionConfigurationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`message`](../CollectionConfigurationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`name`](../CollectionConfigurationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stack`](../CollectionConfigurationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`stackTraceLimit`](../CollectionConfigurationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`captureStackTrace`](../CollectionConfigurationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionConfigurationError`](../CollectionConfigurationError.md).[`prepareStackTrace`](../CollectionConfigurationError.md#preparestacktrace) diff --git a/docs/reference/classes/SchemaValidationError.md b/docs/reference/classes/SchemaValidationError.md new file mode 100644 index 000000000..fecd17ffa --- /dev/null +++ b/docs/reference/classes/SchemaValidationError.md @@ -0,0 +1,251 @@ +--- +id: SchemaValidationError +title: SchemaValidationError +--- + +# Class: SchemaValidationError + +Defined in: [packages/db/src/errors.ts:18](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L18) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new SchemaValidationError( + type, + issues, + message?): SchemaValidationError; +``` + +Defined in: [packages/db/src/errors.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L25) + +#### Parameters + +##### type + +`"insert"` | `"update"` + +##### issues + +readonly `object`[] + +##### message? + +`string` + +#### Returns + +`SchemaValidationError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### issues + +```ts +issues: readonly object[]; +``` + +Defined in: [packages/db/src/errors.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L20) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### type + +```ts +type: "insert" | "update"; +``` + +Defined in: [packages/db/src/errors.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L19) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SerializationError.md b/docs/reference/classes/SerializationError.md new file mode 100644 index 000000000..0723d29c1 --- /dev/null +++ b/docs/reference/classes/SerializationError.md @@ -0,0 +1,224 @@ +--- +id: SerializationError +title: SerializationError +--- + +# Class: SerializationError + +Defined in: [packages/db/src/errors.ts:553](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L553) + +## Extends + +- [`StorageError`](../StorageError.md) + +## Constructors + +### Constructor + +```ts +new SerializationError(operation, originalError): SerializationError; +``` + +Defined in: [packages/db/src/errors.ts:554](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L554) + +#### Parameters + +##### operation + +`string` + +##### originalError + +`string` + +#### Returns + +`SerializationError` + +#### Overrides + +[`StorageError`](../StorageError.md).[`constructor`](../StorageError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`cause`](../StorageError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`message`](../StorageError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`name`](../StorageError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`StorageError`](../StorageError.md).[`stack`](../StorageError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`StorageError`](../StorageError.md).[`stackTraceLimit`](../StorageError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`StorageError`](../StorageError.md).[`captureStackTrace`](../StorageError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`StorageError`](../StorageError.md).[`prepareStackTrace`](../StorageError.md#preparestacktrace) diff --git a/docs/reference/classes/SetWindowRequiresOrderByError.md b/docs/reference/classes/SetWindowRequiresOrderByError.md new file mode 100644 index 000000000..cdcb797dd --- /dev/null +++ b/docs/reference/classes/SetWindowRequiresOrderByError.md @@ -0,0 +1,216 @@ +--- +id: SetWindowRequiresOrderByError +title: SetWindowRequiresOrderByError +--- + +# Class: SetWindowRequiresOrderByError + +Defined in: [packages/db/src/errors.ts:671](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L671) + +Error thrown when setWindow is called on a collection without an ORDER BY clause. + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new SetWindowRequiresOrderByError(): SetWindowRequiresOrderByError; +``` + +Defined in: [packages/db/src/errors.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L672) + +#### Returns + +`SetWindowRequiresOrderByError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/SortedMap.md b/docs/reference/classes/SortedMap.md new file mode 100644 index 000000000..9b81f77cf --- /dev/null +++ b/docs/reference/classes/SortedMap.md @@ -0,0 +1,288 @@ +--- +id: SortedMap +title: SortedMap +--- + +# Class: SortedMap\ + +Defined in: [packages/db/src/SortedMap.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L6) + +A Map implementation that keeps its entries sorted based on a comparator function + +## Type Parameters + +### TKey + +`TKey` + +The type of keys in the map + +### TValue + +`TValue` + +The type of values in the map + +## Constructors + +### Constructor + +```ts +new SortedMap(comparator?): SortedMap; +``` + +Defined in: [packages/db/src/SortedMap.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L16) + +Creates a new SortedMap instance + +#### Parameters + +##### comparator? + +(`a`, `b`) => `number` + +Optional function to compare values for sorting + +#### Returns + +`SortedMap`\<`TKey`, `TValue`\> + +## Accessors + +### size + +#### Get Signature + +```ts +get size(): number; +``` + +Defined in: [packages/db/src/SortedMap.ts:138](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L138) + +Gets the number of key-value pairs in the map + +##### Returns + +`number` + +## Methods + +### \[iterator\]() + +```ts +iterator: IterableIterator<[TKey, TValue]>; +``` + +Defined in: [packages/db/src/SortedMap.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L147) + +Default iterator that returns entries in sorted order + +#### Returns + +`IterableIterator`\<\[`TKey`, `TValue`\]\> + +An iterator for the map's entries + +*** + +### clear() + +```ts +clear(): void; +``` + +Defined in: [packages/db/src/SortedMap.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L130) + +Removes all key-value pairs from the map + +#### Returns + +`void` + +*** + +### delete() + +```ts +delete(key): boolean; +``` + +Defined in: [packages/db/src/SortedMap.ts:106](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L106) + +Removes a key-value pair from the map + +#### Parameters + +##### key + +`TKey` + +The key to remove + +#### Returns + +`boolean` + +True if the key was found and removed, false otherwise + +*** + +### entries() + +```ts +entries(): IterableIterator<[TKey, TValue]>; +``` + +Defined in: [packages/db/src/SortedMap.ts:158](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L158) + +Returns an iterator for the map's entries in sorted order + +#### Returns + +`IterableIterator`\<\[`TKey`, `TValue`\]\> + +An iterator for the map's entries + +*** + +### forEach() + +```ts +forEach(callbackfn): void; +``` + +Defined in: [packages/db/src/SortedMap.ts:189](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L189) + +Executes a callback function for each key-value pair in the map in sorted order + +#### Parameters + +##### callbackfn + +(`value`, `key`, `map`) => `void` + +Function to execute for each entry + +#### Returns + +`void` + +*** + +### get() + +```ts +get(key): TValue | undefined; +``` + +Defined in: [packages/db/src/SortedMap.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L96) + +Gets a value by its key + +#### Parameters + +##### key + +`TKey` + +The key to look up + +#### Returns + +`TValue` \| `undefined` + +The value associated with the key, or undefined if not found + +*** + +### has() + +```ts +has(key): boolean; +``` + +Defined in: [packages/db/src/SortedMap.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L123) + +Checks if a key exists in the map + +#### Parameters + +##### key + +`TKey` + +The key to check + +#### Returns + +`boolean` + +True if the key exists, false otherwise + +*** + +### keys() + +```ts +keys(): IterableIterator; +``` + +Defined in: [packages/db/src/SortedMap.ts:167](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L167) + +Returns an iterator for the map's keys in sorted order + +#### Returns + +`IterableIterator`\<`TKey`\> + +An iterator for the map's keys + +*** + +### set() + +```ts +set(key, value): this; +``` + +Defined in: [packages/db/src/SortedMap.ts:73](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L73) + +Sets a key-value pair in the map and maintains sort order + +#### Parameters + +##### key + +`TKey` + +The key to set + +##### value + +`TValue` + +The value to associate with the key + +#### Returns + +`this` + +This SortedMap instance for chaining + +*** + +### values() + +```ts +values(): IterableIterator; +``` + +Defined in: [packages/db/src/SortedMap.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/SortedMap.ts#L176) + +Returns an iterator for the map's values in sorted order + +#### Returns + +`IterableIterator`\<`TValue`\> + +An iterator for the map's values diff --git a/docs/reference/classes/StorageError.md b/docs/reference/classes/StorageError.md new file mode 100644 index 000000000..37dd38604 --- /dev/null +++ b/docs/reference/classes/StorageError.md @@ -0,0 +1,225 @@ +--- +id: StorageError +title: StorageError +--- + +# Class: StorageError + +Defined in: [packages/db/src/errors.ts:546](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L546) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`SerializationError`](../SerializationError.md) +- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new StorageError(message): StorageError; +``` + +Defined in: [packages/db/src/errors.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L547) + +#### Parameters + +##### message + +`string` + +#### Returns + +`StorageError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/StorageKeyRequiredError.md b/docs/reference/classes/StorageKeyRequiredError.md new file mode 100644 index 000000000..3ed1dec0b --- /dev/null +++ b/docs/reference/classes/StorageKeyRequiredError.md @@ -0,0 +1,214 @@ +--- +id: StorageKeyRequiredError +title: StorageKeyRequiredError +--- + +# Class: StorageKeyRequiredError + +Defined in: [packages/db/src/errors.ts:569](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L569) + +## Extends + +- [`LocalStorageCollectionError`](../LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new StorageKeyRequiredError(): StorageKeyRequiredError; +``` + +Defined in: [packages/db/src/errors.ts:570](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L570) + +#### Returns + +`StorageKeyRequiredError` + +#### Overrides + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`constructor`](../LocalStorageCollectionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`cause`](../LocalStorageCollectionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`message`](../LocalStorageCollectionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`name`](../LocalStorageCollectionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stack`](../LocalStorageCollectionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`stackTraceLimit`](../LocalStorageCollectionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`captureStackTrace`](../LocalStorageCollectionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`LocalStorageCollectionError`](../LocalStorageCollectionError.md).[`prepareStackTrace`](../LocalStorageCollectionError.md#preparestacktrace) diff --git a/docs/reference/classes/SubQueryMustHaveFromClauseError.md b/docs/reference/classes/SubQueryMustHaveFromClauseError.md new file mode 100644 index 000000000..6783eb90b --- /dev/null +++ b/docs/reference/classes/SubQueryMustHaveFromClauseError.md @@ -0,0 +1,220 @@ +--- +id: SubQueryMustHaveFromClauseError +title: SubQueryMustHaveFromClauseError +--- + +# Class: SubQueryMustHaveFromClauseError + +Defined in: [packages/db/src/errors.ts:333](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L333) + +## Extends + +- [`QueryBuilderError`](../QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new SubQueryMustHaveFromClauseError(context): SubQueryMustHaveFromClauseError; +``` + +Defined in: [packages/db/src/errors.ts:334](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L334) + +#### Parameters + +##### context + +`string` + +#### Returns + +`SubQueryMustHaveFromClauseError` + +#### Overrides + +[`QueryBuilderError`](../QueryBuilderError.md).[`constructor`](../QueryBuilderError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`cause`](../QueryBuilderError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`message`](../QueryBuilderError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`name`](../QueryBuilderError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stack`](../QueryBuilderError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`stackTraceLimit`](../QueryBuilderError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`captureStackTrace`](../QueryBuilderError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryBuilderError`](../QueryBuilderError.md).[`prepareStackTrace`](../QueryBuilderError.md#preparestacktrace) diff --git a/docs/reference/classes/SubscriptionNotFoundError.md b/docs/reference/classes/SubscriptionNotFoundError.md new file mode 100644 index 000000000..53ef8e002 --- /dev/null +++ b/docs/reference/classes/SubscriptionNotFoundError.md @@ -0,0 +1,239 @@ +--- +id: SubscriptionNotFoundError +title: SubscriptionNotFoundError +--- + +# Class: SubscriptionNotFoundError + +Defined in: [packages/db/src/errors.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L631) + +Error when a subscription cannot be found during lazy join processing. +For subqueries, aliases may be remapped (e.g., 'activeUser' → 'user'). + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new SubscriptionNotFoundError( + resolvedAlias, + originalAlias, + collectionId, + availableAliases): SubscriptionNotFoundError; +``` + +Defined in: [packages/db/src/errors.ts:632](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L632) + +#### Parameters + +##### resolvedAlias + +`string` + +##### originalAlias + +`string` + +##### collectionId + +`string` + +##### availableAliases + +`string`[] + +#### Returns + +`SubscriptionNotFoundError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncCleanupError.md b/docs/reference/classes/SyncCleanupError.md new file mode 100644 index 000000000..0fa3b2104 --- /dev/null +++ b/docs/reference/classes/SyncCleanupError.md @@ -0,0 +1,224 @@ +--- +id: SyncCleanupError +title: SyncCleanupError +--- + +# Class: SyncCleanupError + +Defined in: [packages/db/src/errors.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L592) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new SyncCleanupError(collectionId, error): SyncCleanupError; +``` + +Defined in: [packages/db/src/errors.ts:593](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L593) + +#### Parameters + +##### collectionId + +`string` + +##### error + +`string` | `Error` + +#### Returns + +`SyncCleanupError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncTransactionAlreadyCommittedError.md b/docs/reference/classes/SyncTransactionAlreadyCommittedError.md new file mode 100644 index 000000000..1b51c8402 --- /dev/null +++ b/docs/reference/classes/SyncTransactionAlreadyCommittedError.md @@ -0,0 +1,214 @@ +--- +id: SyncTransactionAlreadyCommittedError +title: SyncTransactionAlreadyCommittedError +--- + +# Class: SyncTransactionAlreadyCommittedError + +Defined in: [packages/db/src/errors.ts:311](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L311) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new SyncTransactionAlreadyCommittedError(): SyncTransactionAlreadyCommittedError; +``` + +Defined in: [packages/db/src/errors.ts:312](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L312) + +#### Returns + +`SyncTransactionAlreadyCommittedError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md b/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md new file mode 100644 index 000000000..a14d05a9d --- /dev/null +++ b/docs/reference/classes/SyncTransactionAlreadyCommittedWriteError.md @@ -0,0 +1,214 @@ +--- +id: SyncTransactionAlreadyCommittedWriteError +title: SyncTransactionAlreadyCommittedWriteError +--- + +# Class: SyncTransactionAlreadyCommittedWriteError + +Defined in: [packages/db/src/errors.ts:297](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L297) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new SyncTransactionAlreadyCommittedWriteError(): SyncTransactionAlreadyCommittedWriteError; +``` + +Defined in: [packages/db/src/errors.ts:298](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L298) + +#### Returns + +`SyncTransactionAlreadyCommittedWriteError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TanStackDBError.md b/docs/reference/classes/TanStackDBError.md new file mode 100644 index 000000000..dabc7ccbd --- /dev/null +++ b/docs/reference/classes/TanStackDBError.md @@ -0,0 +1,254 @@ +--- +id: TanStackDBError +title: TanStackDBError +--- + +# Class: TanStackDBError + +Defined in: [packages/db/src/errors.ts:2](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L2) + +## Extends + +- `Error` + +## Extended by + +- [`NonRetriableError`](../NonRetriableError.md) +- [`SchemaValidationError`](../SchemaValidationError.md) +- [`DuplicateDbInstanceError`](../DuplicateDbInstanceError.md) +- [`CollectionConfigurationError`](../CollectionConfigurationError.md) +- [`CollectionStateError`](../CollectionStateError.md) +- [`CollectionOperationError`](../CollectionOperationError.md) +- [`MissingHandlerError`](../MissingHandlerError.md) +- [`TransactionError`](../TransactionError.md) +- [`QueryBuilderError`](../QueryBuilderError.md) +- [`QueryCompilationError`](../QueryCompilationError.md) +- [`JoinError`](../JoinError.md) +- [`GroupByError`](../GroupByError.md) +- [`StorageError`](../StorageError.md) +- [`SyncCleanupError`](../SyncCleanupError.md) +- [`QueryOptimizerError`](../QueryOptimizerError.md) + +## Constructors + +### Constructor + +```ts +new TanStackDBError(message): TanStackDBError; +``` + +Defined in: [packages/db/src/errors.ts:3](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L3) + +#### Parameters + +##### message + +`string` + +#### Returns + +`TanStackDBError` + +#### Overrides + +```ts +Error.constructor +``` + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +```ts +Error.cause +``` + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +```ts +Error.message +``` + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +```ts +Error.name +``` + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +```ts +Error.stack +``` + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +```ts +Error.stackTraceLimit +``` + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +```ts +Error.captureStackTrace +``` + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +```ts +Error.prepareStackTrace +``` diff --git a/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md b/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md new file mode 100644 index 000000000..fde7154b4 --- /dev/null +++ b/docs/reference/classes/TransactionAlreadyCompletedRollbackError.md @@ -0,0 +1,214 @@ +--- +id: TransactionAlreadyCompletedRollbackError +title: TransactionAlreadyCompletedRollbackError +--- + +# Class: TransactionAlreadyCompletedRollbackError + +Defined in: [packages/db/src/errors.ts:275](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L275) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionAlreadyCompletedRollbackError(): TransactionAlreadyCompletedRollbackError; +``` + +Defined in: [packages/db/src/errors.ts:276](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L276) + +#### Returns + +`TransactionAlreadyCompletedRollbackError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionError.md b/docs/reference/classes/TransactionError.md new file mode 100644 index 000000000..aae7b1336 --- /dev/null +++ b/docs/reference/classes/TransactionError.md @@ -0,0 +1,232 @@ +--- +id: TransactionError +title: TransactionError +--- + +# Class: TransactionError + +Defined in: [packages/db/src/errors.ts:245](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L245) + +## Extends + +- [`TanStackDBError`](../TanStackDBError.md) + +## Extended by + +- [`MissingMutationFunctionError`](../MissingMutationFunctionError.md) +- [`OnMutateMustBeSynchronousError`](../OnMutateMustBeSynchronousError.md) +- [`TransactionNotPendingMutateError`](../TransactionNotPendingMutateError.md) +- [`TransactionAlreadyCompletedRollbackError`](../TransactionAlreadyCompletedRollbackError.md) +- [`TransactionNotPendingCommitError`](../TransactionNotPendingCommitError.md) +- [`NoPendingSyncTransactionWriteError`](../NoPendingSyncTransactionWriteError.md) +- [`SyncTransactionAlreadyCommittedWriteError`](../SyncTransactionAlreadyCommittedWriteError.md) +- [`NoPendingSyncTransactionCommitError`](../NoPendingSyncTransactionCommitError.md) +- [`SyncTransactionAlreadyCommittedError`](../SyncTransactionAlreadyCommittedError.md) + +## Constructors + +### Constructor + +```ts +new TransactionError(message): TransactionError; +``` + +Defined in: [packages/db/src/errors.ts:246](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L246) + +#### Parameters + +##### message + +`string` + +#### Returns + +`TransactionError` + +#### Overrides + +[`TanStackDBError`](../TanStackDBError.md).[`constructor`](../TanStackDBError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`cause`](../TanStackDBError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`message`](../TanStackDBError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`name`](../TanStackDBError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stack`](../TanStackDBError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`stackTraceLimit`](../TanStackDBError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`captureStackTrace`](../TanStackDBError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TanStackDBError`](../TanStackDBError.md).[`prepareStackTrace`](../TanStackDBError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionNotPendingCommitError.md b/docs/reference/classes/TransactionNotPendingCommitError.md new file mode 100644 index 000000000..a89cd1ae9 --- /dev/null +++ b/docs/reference/classes/TransactionNotPendingCommitError.md @@ -0,0 +1,214 @@ +--- +id: TransactionNotPendingCommitError +title: TransactionNotPendingCommitError +--- + +# Class: TransactionNotPendingCommitError + +Defined in: [packages/db/src/errors.ts:283](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L283) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionNotPendingCommitError(): TransactionNotPendingCommitError; +``` + +Defined in: [packages/db/src/errors.ts:284](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L284) + +#### Returns + +`TransactionNotPendingCommitError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/TransactionNotPendingMutateError.md b/docs/reference/classes/TransactionNotPendingMutateError.md new file mode 100644 index 000000000..88199ce3e --- /dev/null +++ b/docs/reference/classes/TransactionNotPendingMutateError.md @@ -0,0 +1,214 @@ +--- +id: TransactionNotPendingMutateError +title: TransactionNotPendingMutateError +--- + +# Class: TransactionNotPendingMutateError + +Defined in: [packages/db/src/errors.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L267) + +## Extends + +- [`TransactionError`](../TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionNotPendingMutateError(): TransactionNotPendingMutateError; +``` + +Defined in: [packages/db/src/errors.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L268) + +#### Returns + +`TransactionNotPendingMutateError` + +#### Overrides + +[`TransactionError`](../TransactionError.md).[`constructor`](../TransactionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`cause`](../TransactionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`message`](../TransactionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`name`](../TransactionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stack`](../TransactionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`stackTraceLimit`](../TransactionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`captureStackTrace`](../TransactionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`TransactionError`](../TransactionError.md).[`prepareStackTrace`](../TransactionError.md#preparestacktrace) diff --git a/docs/reference/classes/UndefinedKeyError.md b/docs/reference/classes/UndefinedKeyError.md new file mode 100644 index 000000000..24f075ab1 --- /dev/null +++ b/docs/reference/classes/UndefinedKeyError.md @@ -0,0 +1,220 @@ +--- +id: UndefinedKeyError +title: UndefinedKeyError +--- + +# Class: UndefinedKeyError + +Defined in: [packages/db/src/errors.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L146) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new UndefinedKeyError(item): UndefinedKeyError; +``` + +Defined in: [packages/db/src/errors.ts:147](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L147) + +#### Parameters + +##### item + +`any` + +#### Returns + +`UndefinedKeyError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownExpressionTypeError.md b/docs/reference/classes/UnknownExpressionTypeError.md new file mode 100644 index 000000000..5eeb52f4f --- /dev/null +++ b/docs/reference/classes/UnknownExpressionTypeError.md @@ -0,0 +1,220 @@ +--- +id: UnknownExpressionTypeError +title: UnknownExpressionTypeError +--- + +# Class: UnknownExpressionTypeError + +Defined in: [packages/db/src/errors.ts:429](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L429) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnknownExpressionTypeError(type): UnknownExpressionTypeError; +``` + +Defined in: [packages/db/src/errors.ts:430](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L430) + +#### Parameters + +##### type + +`string` + +#### Returns + +`UnknownExpressionTypeError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownFunctionError.md b/docs/reference/classes/UnknownFunctionError.md new file mode 100644 index 000000000..7b6e64991 --- /dev/null +++ b/docs/reference/classes/UnknownFunctionError.md @@ -0,0 +1,220 @@ +--- +id: UnknownFunctionError +title: UnknownFunctionError +--- + +# Class: UnknownFunctionError + +Defined in: [packages/db/src/errors.ts:441](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L441) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnknownFunctionError(functionName): UnknownFunctionError; +``` + +Defined in: [packages/db/src/errors.ts:442](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L442) + +#### Parameters + +##### functionName + +`string` + +#### Returns + +`UnknownFunctionError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnknownHavingExpressionTypeError.md b/docs/reference/classes/UnknownHavingExpressionTypeError.md new file mode 100644 index 000000000..7e9756cae --- /dev/null +++ b/docs/reference/classes/UnknownHavingExpressionTypeError.md @@ -0,0 +1,220 @@ +--- +id: UnknownHavingExpressionTypeError +title: UnknownHavingExpressionTypeError +--- + +# Class: UnknownHavingExpressionTypeError + +Defined in: [packages/db/src/errors.ts:539](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L539) + +## Extends + +- [`GroupByError`](../GroupByError.md) + +## Constructors + +### Constructor + +```ts +new UnknownHavingExpressionTypeError(type): UnknownHavingExpressionTypeError; +``` + +Defined in: [packages/db/src/errors.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L540) + +#### Parameters + +##### type + +`string` + +#### Returns + +`UnknownHavingExpressionTypeError` + +#### Overrides + +[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedAggregateFunctionError.md b/docs/reference/classes/UnsupportedAggregateFunctionError.md new file mode 100644 index 000000000..f987c691e --- /dev/null +++ b/docs/reference/classes/UnsupportedAggregateFunctionError.md @@ -0,0 +1,220 @@ +--- +id: UnsupportedAggregateFunctionError +title: UnsupportedAggregateFunctionError +--- + +# Class: UnsupportedAggregateFunctionError + +Defined in: [packages/db/src/errors.ts:525](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L525) + +## Extends + +- [`GroupByError`](../GroupByError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedAggregateFunctionError(functionName): UnsupportedAggregateFunctionError; +``` + +Defined in: [packages/db/src/errors.ts:526](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L526) + +#### Parameters + +##### functionName + +`string` + +#### Returns + +`UnsupportedAggregateFunctionError` + +#### Overrides + +[`GroupByError`](../GroupByError.md).[`constructor`](../GroupByError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`cause`](../GroupByError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`message`](../GroupByError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`name`](../GroupByError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stack`](../GroupByError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`stackTraceLimit`](../GroupByError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`captureStackTrace`](../GroupByError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`GroupByError`](../GroupByError.md).[`prepareStackTrace`](../GroupByError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedFromTypeError.md b/docs/reference/classes/UnsupportedFromTypeError.md new file mode 100644 index 000000000..4718f35cc --- /dev/null +++ b/docs/reference/classes/UnsupportedFromTypeError.md @@ -0,0 +1,220 @@ +--- +id: UnsupportedFromTypeError +title: UnsupportedFromTypeError +--- + +# Class: UnsupportedFromTypeError + +Defined in: [packages/db/src/errors.ts:423](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L423) + +## Extends + +- [`QueryCompilationError`](../QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedFromTypeError(type): UnsupportedFromTypeError; +``` + +Defined in: [packages/db/src/errors.ts:424](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L424) + +#### Parameters + +##### type + +`string` + +#### Returns + +`UnsupportedFromTypeError` + +#### Overrides + +[`QueryCompilationError`](../QueryCompilationError.md).[`constructor`](../QueryCompilationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`cause`](../QueryCompilationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`message`](../QueryCompilationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`name`](../QueryCompilationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stack`](../QueryCompilationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`stackTraceLimit`](../QueryCompilationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`captureStackTrace`](../QueryCompilationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCompilationError`](../QueryCompilationError.md).[`prepareStackTrace`](../QueryCompilationError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedJoinSourceTypeError.md b/docs/reference/classes/UnsupportedJoinSourceTypeError.md new file mode 100644 index 000000000..492d26a74 --- /dev/null +++ b/docs/reference/classes/UnsupportedJoinSourceTypeError.md @@ -0,0 +1,220 @@ +--- +id: UnsupportedJoinSourceTypeError +title: UnsupportedJoinSourceTypeError +--- + +# Class: UnsupportedJoinSourceTypeError + +Defined in: [packages/db/src/errors.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L503) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedJoinSourceTypeError(type): UnsupportedJoinSourceTypeError; +``` + +Defined in: [packages/db/src/errors.ts:504](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L504) + +#### Parameters + +##### type + +`string` + +#### Returns + +`UnsupportedJoinSourceTypeError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/UnsupportedJoinTypeError.md b/docs/reference/classes/UnsupportedJoinTypeError.md new file mode 100644 index 000000000..21e193861 --- /dev/null +++ b/docs/reference/classes/UnsupportedJoinTypeError.md @@ -0,0 +1,220 @@ +--- +id: UnsupportedJoinTypeError +title: UnsupportedJoinTypeError +--- + +# Class: UnsupportedJoinTypeError + +Defined in: [packages/db/src/errors.ts:461](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L461) + +## Extends + +- [`JoinError`](../JoinError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedJoinTypeError(joinType): UnsupportedJoinTypeError; +``` + +Defined in: [packages/db/src/errors.ts:462](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L462) + +#### Parameters + +##### joinType + +`string` + +#### Returns + +`UnsupportedJoinTypeError` + +#### Overrides + +[`JoinError`](../JoinError.md).[`constructor`](../JoinError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`cause`](../JoinError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`message`](../JoinError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`name`](../JoinError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stack`](../JoinError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`JoinError`](../JoinError.md).[`stackTraceLimit`](../JoinError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`JoinError`](../JoinError.md).[`captureStackTrace`](../JoinError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`JoinError`](../JoinError.md).[`prepareStackTrace`](../JoinError.md#preparestacktrace) diff --git a/docs/reference/classes/UpdateKeyNotFoundError.md b/docs/reference/classes/UpdateKeyNotFoundError.md new file mode 100644 index 000000000..2cb718085 --- /dev/null +++ b/docs/reference/classes/UpdateKeyNotFoundError.md @@ -0,0 +1,220 @@ +--- +id: UpdateKeyNotFoundError +title: UpdateKeyNotFoundError +--- + +# Class: UpdateKeyNotFoundError + +Defined in: [packages/db/src/errors.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L182) + +## Extends + +- [`CollectionOperationError`](../CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new UpdateKeyNotFoundError(key): UpdateKeyNotFoundError; +``` + +Defined in: [packages/db/src/errors.ts:183](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L183) + +#### Parameters + +##### key + +`string` | `number` + +#### Returns + +`UpdateKeyNotFoundError` + +#### Overrides + +[`CollectionOperationError`](../CollectionOperationError.md).[`constructor`](../CollectionOperationError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`cause`](../CollectionOperationError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`message`](../CollectionOperationError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`name`](../CollectionOperationError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stack`](../CollectionOperationError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`stackTraceLimit`](../CollectionOperationError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`captureStackTrace`](../CollectionOperationError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`CollectionOperationError`](../CollectionOperationError.md).[`prepareStackTrace`](../CollectionOperationError.md#preparestacktrace) diff --git a/docs/reference/classes/WhereClauseConversionError.md b/docs/reference/classes/WhereClauseConversionError.md new file mode 100644 index 000000000..e1cc1c1b5 --- /dev/null +++ b/docs/reference/classes/WhereClauseConversionError.md @@ -0,0 +1,226 @@ +--- +id: WhereClauseConversionError +title: WhereClauseConversionError +--- + +# Class: WhereClauseConversionError + +Defined in: [packages/db/src/errors.ts:619](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L619) + +Internal error when the query optimizer fails to convert a WHERE clause to a collection filter. + +## Extends + +- [`QueryOptimizerError`](../QueryOptimizerError.md) + +## Constructors + +### Constructor + +```ts +new WhereClauseConversionError(collectionId, alias): WhereClauseConversionError; +``` + +Defined in: [packages/db/src/errors.ts:620](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L620) + +#### Parameters + +##### collectionId + +`string` + +##### alias + +`string` + +#### Returns + +`WhereClauseConversionError` + +#### Overrides + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`constructor`](../QueryOptimizerError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`cause`](../QueryOptimizerError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`message`](../QueryOptimizerError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`name`](../QueryOptimizerError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`stack`](../QueryOptimizerError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:68 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`stackTraceLimit`](../QueryOptimizerError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:52 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`captureStackTrace`](../QueryOptimizerError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@24.7.0/node\_modules/@types/node/globals.d.ts:56 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryOptimizerError`](../QueryOptimizerError.md).[`prepareStackTrace`](../QueryOptimizerError.md#preparestacktrace) diff --git a/docs/reference/functions/add.md b/docs/reference/functions/add.md new file mode 100644 index 000000000..767e7d8d1 --- /dev/null +++ b/docs/reference/functions/add.md @@ -0,0 +1,36 @@ +--- +id: add +title: add +--- + +# Function: add() + +```ts +function add(left, right): BinaryNumericReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L295) + +## Type Parameters + +### T1 + +`T1` *extends* `unknown` + +### T2 + +`T2` *extends* `unknown` + +## Parameters + +### left + +`T1` + +### right + +`T2` + +## Returns + +`BinaryNumericReturnType`\<`T1`, `T2`\> diff --git a/docs/reference/functions/and.md b/docs/reference/functions/and.md new file mode 100644 index 000000000..b48e66633 --- /dev/null +++ b/docs/reference/functions/and.md @@ -0,0 +1,57 @@ +--- +id: and +title: and +--- + +# Function: and() + +## Call Signature + +```ts +function and(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:181](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L181) + +### Parameters + +#### left + +`any` + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function and( + left, + right, ... +rest): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:185](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L185) + +### Parameters + +#### left + +`any` + +#### right + +`any` + +#### rest + +...`any`[] + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/avg.md b/docs/reference/functions/avg.md new file mode 100644 index 000000000..98b7f615a --- /dev/null +++ b/docs/reference/functions/avg.md @@ -0,0 +1,28 @@ +--- +id: avg +title: avg +--- + +# Function: avg() + +```ts +function avg(arg): AggregateReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:311](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L311) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/coalesce.md b/docs/reference/functions/coalesce.md new file mode 100644 index 000000000..db59fc945 --- /dev/null +++ b/docs/reference/functions/coalesce.md @@ -0,0 +1,22 @@ +--- +id: coalesce +title: coalesce +--- + +# Function: coalesce() + +```ts +function coalesce(...args): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:288](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L288) + +## Parameters + +### args + +...`any`[] + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`any`\> diff --git a/docs/reference/functions/compileQuery.md b/docs/reference/functions/compileQuery.md new file mode 100644 index 000000000..729b5ae39 --- /dev/null +++ b/docs/reference/functions/compileQuery.md @@ -0,0 +1,90 @@ +--- +id: compileQuery +title: compileQuery +--- + +# Function: compileQuery() + +```ts +function compileQuery( + rawQuery, + inputs, + collections, + subscriptions, + callbacks, + lazySources, + optimizableOrderByCollections, + setWindowFn, + cache, + queryMapping): CompilationResult; +``` + +Defined in: [packages/db/src/query/compiler/index.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/query/compiler/index.ts#L85) + +Compiles a query IR into a D2 pipeline + +## Parameters + +### rawQuery + +[`QueryIR`](../../@tanstack/namespaces/IR/interfaces/QueryIR.md) + +The query IR to compile + +### inputs + +`Record`\<`string`, [`KeyedStream`](../../type-aliases/KeyedStream.md)\> + +Mapping of source aliases to input streams (e.g., `{ employee: input1, manager: input2 }`) + +### collections + +`Record`\<`string`, [`Collection`](../../interfaces/Collection.md)\<`any`, `any`, `any`, `any`, `any`\>\> + +Mapping of collection IDs to Collection instances + +### subscriptions + +`Record`\<`string`, `CollectionSubscription`\> + +Mapping of source aliases to CollectionSubscription instances + +### callbacks + +`Record`\<`string`, `LazyCollectionCallbacks`\> + +Mapping of source aliases to lazy loading callbacks + +### lazySources + +`Set`\<`string`\> + +Set of source aliases that should load data lazily + +### optimizableOrderByCollections + +`Record`\<`string`, `OrderByOptimizationInfo`\> + +Map of collection IDs to order-by optimization info + +### setWindowFn + +(`windowFn`) => `void` + +### cache + +`QueryCache` = `...` + +Optional cache for compiled subqueries (used internally for recursion) + +### queryMapping + +`QueryMapping` = `...` + +Optional mapping from optimized queries to original queries + +## Returns + +`CompilationResult` + +A CompilationResult with the pipeline, source WHERE clauses, and alias metadata diff --git a/docs/reference/functions/concat.md b/docs/reference/functions/concat.md new file mode 100644 index 000000000..9c8edfbd6 --- /dev/null +++ b/docs/reference/functions/concat.md @@ -0,0 +1,22 @@ +--- +id: concat +title: concat +--- + +# Function: concat() + +```ts +function concat(...args): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:279](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L279) + +## Parameters + +### args + +...`any`[] + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`string`\> diff --git a/docs/reference/functions/count.md b/docs/reference/functions/count.md new file mode 100644 index 000000000..bc82fcf79 --- /dev/null +++ b/docs/reference/functions/count.md @@ -0,0 +1,22 @@ +--- +id: count +title: count +--- + +# Function: count() + +```ts +function count(arg): Aggregate; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:307](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L307) + +## Parameters + +### arg + +`any` + +## Returns + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`number`\> diff --git a/docs/reference/functions/createArrayChangeProxy.md b/docs/reference/functions/createArrayChangeProxy.md new file mode 100644 index 000000000..dd5101482 --- /dev/null +++ b/docs/reference/functions/createArrayChangeProxy.md @@ -0,0 +1,50 @@ +--- +id: createArrayChangeProxy +title: createArrayChangeProxy +--- + +# Function: createArrayChangeProxy() + +```ts +function createArrayChangeProxy(targets): object; +``` + +Defined in: [packages/db/src/proxy.ts:873](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L873) + +Creates proxies for an array of objects and tracks changes to each + +## Type Parameters + +### T + +`T` *extends* `object` + +## Parameters + +### targets + +`T`[] + +Array of objects to proxy + +## Returns + +`object` + +An object containing the array of proxies and a function to get all changes + +### getChanges() + +```ts +getChanges: () => Record[]; +``` + +#### Returns + +`Record`\<`string` \| `symbol`, `unknown`\>[] + +### proxies + +```ts +proxies: T[]; +``` diff --git a/docs/reference/functions/createChangeProxy.md b/docs/reference/functions/createChangeProxy.md new file mode 100644 index 000000000..565b86928 --- /dev/null +++ b/docs/reference/functions/createChangeProxy.md @@ -0,0 +1,62 @@ +--- +id: createChangeProxy +title: createChangeProxy +--- + +# Function: createChangeProxy() + +```ts +function createChangeProxy(target, parent?): object; +``` + +Defined in: [packages/db/src/proxy.ts:181](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L181) + +Creates a proxy that tracks changes to the target object + +## Type Parameters + +### T + +`T` *extends* `Record`\<`string` \| `symbol`, `any`\> + +## Parameters + +### target + +`T` + +The object to proxy + +### parent? + +Optional parent information + +#### prop + +`string` \| `symbol` + +#### tracker + +`ChangeTracker`\<`Record`\<`string` \| `symbol`, `unknown`\>\> + +## Returns + +`object` + +An object containing the proxy and a function to get the changes + +### getChanges() + +```ts +getChanges: () => Record; +``` + +#### Returns + +`Record`\<`string` \| `symbol`, `any`\> + +### proxy + +```ts +proxy: T; +``` diff --git a/docs/reference/functions/createCollection.md b/docs/reference/functions/createCollection.md new file mode 100644 index 000000000..1404c7300 --- /dev/null +++ b/docs/reference/functions/createCollection.md @@ -0,0 +1,442 @@ +--- +id: createCollection +title: createCollection +--- + +# Function: createCollection() + +## Call Signature + +```ts +function createCollection(options): Collection, TKey, TUtils, T, InferSchemaInput> & NonSingleResult; +``` + +Defined in: [packages/db/src/collection/index.ts:130](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L130) + +Creates a new Collection instance with the given configuration + +### Type Parameters + +#### T + +`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) + +Collection options with optional utilities + +### Returns + +[`Collection`](../../interfaces/Collection.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `TUtils`, `T`, [`InferSchemaInput`](../../type-aliases/InferSchemaInput.md)\<`T`\>\> & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) + +A new Collection with utilities exposed both at top level and under .utils + +### Examples + +```ts +// Pattern 1: With operation handlers (direct collection calls) +const todos = createCollection({ + id: "todos", + getKey: (todo) => todo.id, + schema, + onInsert: async ({ transaction, collection }) => { + // Send to API + await api.createTodo(transaction.mutations[0].modified) + }, + onUpdate: async ({ transaction, collection }) => { + await api.updateTodo(transaction.mutations[0].modified) + }, + onDelete: async ({ transaction, collection }) => { + await api.deleteTodo(transaction.mutations[0].key) + }, + sync: { sync: () => {} } +}) + +// Direct usage (handlers manage transactions) +const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Pattern 2: Manual transaction management +const todos = createCollection({ + getKey: (todo) => todo.id, + schema: todoSchema, + sync: { sync: () => {} } +}) + +// Explicit transaction usage +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Handle all mutations in transaction + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + todos.insert({ id: "1", text: "Buy milk" }) + todos.update("2", draft => { draft.completed = true }) +}) + +await tx.isPersisted.promise +``` + +```ts +// Using schema for type inference (preferred as it also gives you client side validation) +const todoSchema = z.object({ + id: z.string(), + title: z.string(), + completed: z.boolean() +}) + +const todos = createCollection({ + schema: todoSchema, + getKey: (todo) => todo.id, + sync: { sync: () => {} } +}) +``` + +## Call Signature + +```ts +function createCollection(options): Collection, TKey, TUtils, T, InferSchemaInput> & SingleResult; +``` + +Defined in: [packages/db/src/collection/index.ts:143](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L143) + +Creates a new Collection instance with the given configuration + +### Type Parameters + +#### T + +`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`SingleResult`](../../type-aliases/SingleResult.md) + +Collection options with optional utilities + +### Returns + +[`Collection`](../../interfaces/Collection.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `TUtils`, `T`, [`InferSchemaInput`](../../type-aliases/InferSchemaInput.md)\<`T`\>\> & [`SingleResult`](../../type-aliases/SingleResult.md) + +A new Collection with utilities exposed both at top level and under .utils + +### Examples + +```ts +// Pattern 1: With operation handlers (direct collection calls) +const todos = createCollection({ + id: "todos", + getKey: (todo) => todo.id, + schema, + onInsert: async ({ transaction, collection }) => { + // Send to API + await api.createTodo(transaction.mutations[0].modified) + }, + onUpdate: async ({ transaction, collection }) => { + await api.updateTodo(transaction.mutations[0].modified) + }, + onDelete: async ({ transaction, collection }) => { + await api.deleteTodo(transaction.mutations[0].key) + }, + sync: { sync: () => {} } +}) + +// Direct usage (handlers manage transactions) +const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Pattern 2: Manual transaction management +const todos = createCollection({ + getKey: (todo) => todo.id, + schema: todoSchema, + sync: { sync: () => {} } +}) + +// Explicit transaction usage +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Handle all mutations in transaction + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + todos.insert({ id: "1", text: "Buy milk" }) + todos.update("2", draft => { draft.completed = true }) +}) + +await tx.isPersisted.promise +``` + +```ts +// Using schema for type inference (preferred as it also gives you client side validation) +const todoSchema = z.object({ + id: z.string(), + title: z.string(), + completed: z.boolean() +}) + +const todos = createCollection({ + schema: todoSchema, + getKey: (todo) => todo.id, + sync: { sync: () => {} } +}) +``` + +## Call Signature + +```ts +function createCollection(options): Collection & NonSingleResult; +``` + +Defined in: [packages/db/src/collection/index.ts:157](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L157) + +Creates a new Collection instance with the given configuration + +### Type Parameters + +#### T + +`T` *extends* `object` + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) + +Collection options with optional utilities + +### Returns + +[`Collection`](../../interfaces/Collection.md)\<`T`, `TKey`, `TUtils`, `never`, `T`\> & [`NonSingleResult`](../../type-aliases/NonSingleResult.md) + +A new Collection with utilities exposed both at top level and under .utils + +### Examples + +```ts +// Pattern 1: With operation handlers (direct collection calls) +const todos = createCollection({ + id: "todos", + getKey: (todo) => todo.id, + schema, + onInsert: async ({ transaction, collection }) => { + // Send to API + await api.createTodo(transaction.mutations[0].modified) + }, + onUpdate: async ({ transaction, collection }) => { + await api.updateTodo(transaction.mutations[0].modified) + }, + onDelete: async ({ transaction, collection }) => { + await api.deleteTodo(transaction.mutations[0].key) + }, + sync: { sync: () => {} } +}) + +// Direct usage (handlers manage transactions) +const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Pattern 2: Manual transaction management +const todos = createCollection({ + getKey: (todo) => todo.id, + schema: todoSchema, + sync: { sync: () => {} } +}) + +// Explicit transaction usage +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Handle all mutations in transaction + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + todos.insert({ id: "1", text: "Buy milk" }) + todos.update("2", draft => { draft.completed = true }) +}) + +await tx.isPersisted.promise +``` + +```ts +// Using schema for type inference (preferred as it also gives you client side validation) +const todoSchema = z.object({ + id: z.string(), + title: z.string(), + completed: z.boolean() +}) + +const todos = createCollection({ + schema: todoSchema, + getKey: (todo) => todo.id, + sync: { sync: () => {} } +}) +``` + +## Call Signature + +```ts +function createCollection(options): Collection & SingleResult; +``` + +Defined in: [packages/db/src/collection/index.ts:170](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L170) + +Creates a new Collection instance with the given configuration + +### Type Parameters + +#### T + +`T` *extends* `object` + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & [`SingleResult`](../../type-aliases/SingleResult.md) + +Collection options with optional utilities + +### Returns + +[`Collection`](../../interfaces/Collection.md)\<`T`, `TKey`, `TUtils`, `never`, `T`\> & [`SingleResult`](../../type-aliases/SingleResult.md) + +A new Collection with utilities exposed both at top level and under .utils + +### Examples + +```ts +// Pattern 1: With operation handlers (direct collection calls) +const todos = createCollection({ + id: "todos", + getKey: (todo) => todo.id, + schema, + onInsert: async ({ transaction, collection }) => { + // Send to API + await api.createTodo(transaction.mutations[0].modified) + }, + onUpdate: async ({ transaction, collection }) => { + await api.updateTodo(transaction.mutations[0].modified) + }, + onDelete: async ({ transaction, collection }) => { + await api.deleteTodo(transaction.mutations[0].key) + }, + sync: { sync: () => {} } +}) + +// Direct usage (handlers manage transactions) +const tx = todos.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Pattern 2: Manual transaction management +const todos = createCollection({ + getKey: (todo) => todo.id, + schema: todoSchema, + sync: { sync: () => {} } +}) + +// Explicit transaction usage +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Handle all mutations in transaction + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + todos.insert({ id: "1", text: "Buy milk" }) + todos.update("2", draft => { draft.completed = true }) +}) + +await tx.isPersisted.promise +``` + +```ts +// Using schema for type inference (preferred as it also gives you client side validation) +const todoSchema = z.object({ + id: z.string(), + title: z.string(), + completed: z.boolean() +}) + +const todos = createCollection({ + schema: todoSchema, + getKey: (todo) => todo.id, + sync: { sync: () => {} } +}) +``` diff --git a/docs/reference/functions/createLiveQueryCollection.md b/docs/reference/functions/createLiveQueryCollection.md new file mode 100644 index 000000000..b35008dc4 --- /dev/null +++ b/docs/reference/functions/createLiveQueryCollection.md @@ -0,0 +1,137 @@ +--- +id: createLiveQueryCollection +title: createLiveQueryCollection +--- + +# Function: createLiveQueryCollection() + +## Call Signature + +```ts +function createLiveQueryCollection(query): CollectionForContext & object; +``` + +Defined in: [packages/db/src/query/live-query-collection.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L115) + +Creates a live query collection directly + +### Type Parameters + +#### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) + +#### TResult + +`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} + +### Parameters + +#### query + +(`q`) => [`QueryBuilder`](../../type-aliases/QueryBuilder.md)\<`TContext`\> + +### Returns + +`CollectionForContext`\<`TContext`, `TResult`, \{ +\}\> & `object` + +### Example + +```typescript +// Minimal usage - just pass a query function +const activeUsers = createLiveQueryCollection( + (q) => q + .from({ user: usersCollection }) + .where(({ user }) => eq(user.active, true)) + .select(({ user }) => ({ id: user.id, name: user.name })) +) + +// Full configuration with custom options +const searchResults = createLiveQueryCollection({ + id: "search-results", // Custom ID (auto-generated if omitted) + query: (q) => q + .from({ post: postsCollection }) + .where(({ post }) => like(post.title, `%${searchTerm}%`)) + .select(({ post }) => ({ + id: post.id, + title: post.title, + excerpt: post.excerpt, + })), + getKey: (item) => item.id, // Custom key function (uses stream key if omitted) + utils: { + updateSearchTerm: (newTerm: string) => { + // Custom utility functions + } + } +}) +``` + +## Call Signature + +```ts +function createLiveQueryCollection(config): CollectionForContext & object; +``` + +Defined in: [packages/db/src/query/live-query-collection.ts:125](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L125) + +Creates a live query collection directly + +### Type Parameters + +#### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) + +#### TResult + +`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = \{ +\} + +### Parameters + +#### config + +[`LiveQueryCollectionConfig`](../../interfaces/LiveQueryCollectionConfig.md)\<`TContext`, `TResult`\> & `object` + +### Returns + +`CollectionForContext`\<`TContext`, `TResult`, \{ +\}\> & `object` + +### Example + +```typescript +// Minimal usage - just pass a query function +const activeUsers = createLiveQueryCollection( + (q) => q + .from({ user: usersCollection }) + .where(({ user }) => eq(user.active, true)) + .select(({ user }) => ({ id: user.id, name: user.name })) +) + +// Full configuration with custom options +const searchResults = createLiveQueryCollection({ + id: "search-results", // Custom ID (auto-generated if omitted) + query: (q) => q + .from({ post: postsCollection }) + .where(({ post }) => like(post.title, `%${searchTerm}%`)) + .select(({ post }) => ({ + id: post.id, + title: post.title, + excerpt: post.excerpt, + })), + getKey: (item) => item.id, // Custom key function (uses stream key if omitted) + utils: { + updateSearchTerm: (newTerm: string) => { + // Custom utility functions + } + } +}) +``` diff --git a/docs/reference/functions/createOptimisticAction.md b/docs/reference/functions/createOptimisticAction.md new file mode 100644 index 000000000..bb19c9432 --- /dev/null +++ b/docs/reference/functions/createOptimisticAction.md @@ -0,0 +1,90 @@ +--- +id: createOptimisticAction +title: createOptimisticAction +--- + +# Function: createOptimisticAction() + +```ts +function createOptimisticAction(options): (variables) => Transaction; +``` + +Defined in: [packages/db/src/optimistic-action.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/optimistic-action.ts#L54) + +Creates an optimistic action function that applies local optimistic updates immediately +before executing the actual mutation on the server. + +This pattern allows for responsive UI updates while the actual mutation is in progress. +The optimistic update is applied via the `onMutate` callback, and the server mutation +is executed via the `mutationFn`. + +**Important:** Inside your `mutationFn`, you must ensure that your server writes have synced back +before you return, as the optimistic state is dropped when you return from the mutation function. +You generally use collection-specific helpers to do this, such as Query's `utils.refetch()`, +direct write APIs, or Electric's `utils.awaitTxId()`. + +## Type Parameters + +### TVariables + +`TVariables` = `unknown` + +The type of variables that will be passed to the action function + +## Parameters + +### options + +[`CreateOptimisticActionsOptions`](../../interfaces/CreateOptimisticActionsOptions.md)\<`TVariables`\> + +Configuration options for the optimistic action + +## Returns + +A function that accepts variables of type TVariables and returns a Transaction + +```ts +(variables): Transaction; +``` + +### Parameters + +#### variables + +`TVariables` + +### Returns + +[`Transaction`](../../interfaces/Transaction.md) + +## Example + +```ts +const addTodo = createOptimisticAction({ + onMutate: (text) => { + // Instantly applies local optimistic state + todoCollection.insert({ + id: uuid(), + text, + completed: false + }) + }, + mutationFn: async (text, params) => { + // Persist the todo to your backend + const response = await fetch('/api/todos', { + method: 'POST', + body: JSON.stringify({ text, completed: false }), + }) + const result = await response.json() + + // IMPORTANT: Ensure server writes have synced back before returning + // This ensures the optimistic state can be safely discarded + await todoCollection.utils.refetch() + + return result + } +}) + +// Usage +const transaction = addTodo('New Todo Item') +``` diff --git a/docs/reference/functions/createPacedMutations.md b/docs/reference/functions/createPacedMutations.md new file mode 100644 index 000000000..7418b828e --- /dev/null +++ b/docs/reference/functions/createPacedMutations.md @@ -0,0 +1,98 @@ +--- +id: createPacedMutations +title: createPacedMutations +--- + +# Function: createPacedMutations() + +```ts +function createPacedMutations(config): (variables) => Transaction; +``` + +Defined in: [packages/db/src/paced-mutations.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L87) + +Creates a paced mutations manager with pluggable timing strategies. + +This function provides a way to control when and how optimistic mutations +are persisted to the backend, using strategies like debouncing, queuing, +or throttling. The optimistic updates are applied immediately via `onMutate`, +and the actual persistence is controlled by the strategy. + +The returned function accepts variables of type TVariables and returns a +Transaction object that can be awaited to know when persistence completes +or to handle errors. + +## Type Parameters + +### TVariables + +`TVariables` = `unknown` + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Parameters + +### config + +[`PacedMutationsConfig`](../../interfaces/PacedMutationsConfig.md)\<`TVariables`, `T`\> + +Configuration including onMutate, mutationFn and strategy + +## Returns + +A function that accepts variables and returns a Transaction + +```ts +(variables): Transaction; +``` + +### Parameters + +#### variables + +`TVariables` + +### Returns + +[`Transaction`](../../interfaces/Transaction.md)\<`T`\> + +## Examples + +```ts +// Debounced mutations for auto-save +const updateTodo = createPacedMutations({ + onMutate: (text) => { + // Apply optimistic update immediately + collection.update(id, draft => { draft.text = text }) + }, + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: debounceStrategy({ wait: 500 }) +}) + +// Call with variables, returns a transaction +const tx = updateTodo('New text') + +// Await persistence or handle errors +await tx.isPersisted.promise +``` + +```ts +// Queue strategy for sequential processing +const addTodo = createPacedMutations<{ text: string }>({ + onMutate: ({ text }) => { + collection.insert({ id: uuid(), text, completed: false }) + }, + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: queueStrategy({ + wait: 200, + addItemsTo: 'back', + getItemsFrom: 'front' + }) +}) +``` diff --git a/docs/reference/functions/createTransaction.md b/docs/reference/functions/createTransaction.md new file mode 100644 index 000000000..5309fffcf --- /dev/null +++ b/docs/reference/functions/createTransaction.md @@ -0,0 +1,87 @@ +--- +id: createTransaction +title: createTransaction +--- + +# Function: createTransaction() + +```ts +function createTransaction(config): Transaction; +``` + +Defined in: [packages/db/src/transactions.ts:156](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L156) + +Creates a new transaction for grouping multiple collection operations + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Parameters + +### config + +[`TransactionConfig`](../../interfaces/TransactionConfig.md)\<`T`\> + +Transaction configuration with mutation function + +## Returns + +[`Transaction`](../../interfaces/Transaction.md)\<`T`\> + +A new Transaction instance + +## Examples + +```ts +// Basic transaction usage +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Send all mutations to API + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Buy milk" }) + collection.update("2", draft => { draft.completed = true }) +}) + +await tx.isPersisted.promise +``` + +```ts +// Handle transaction errors +try { + const tx = createTransaction({ + mutationFn: async () => { throw new Error("API failed") } + }) + + tx.mutate(() => { + collection.insert({ id: "1", text: "New item" }) + }) + + await tx.isPersisted.promise +} catch (error) { + console.log('Transaction failed:', error) +} +``` + +```ts +// Manual commit control +const tx = createTransaction({ + autoCommit: false, + mutationFn: async () => { + // API call + } +}) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Item" }) +}) + +// Commit later +await tx.commit() +``` diff --git a/docs/reference/functions/debounceStrategy.md b/docs/reference/functions/debounceStrategy.md new file mode 100644 index 000000000..44e016bee --- /dev/null +++ b/docs/reference/functions/debounceStrategy.md @@ -0,0 +1,46 @@ +--- +id: debounceStrategy +title: debounceStrategy +--- + +# Function: debounceStrategy() + +```ts +function debounceStrategy(options): DebounceStrategy; +``` + +Defined in: [packages/db/src/strategies/debounceStrategy.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/debounceStrategy.ts#L28) + +Creates a debounce strategy that delays transaction execution until after +a period of inactivity. + +Ideal for scenarios like search inputs or auto-save fields where you want +to wait for the user to stop typing before persisting changes. + +## Parameters + +### options + +[`DebounceStrategyOptions`](../../interfaces/DebounceStrategyOptions.md) + +Configuration for the debounce behavior + +## Returns + +[`DebounceStrategy`](../../interfaces/DebounceStrategy.md) + +A debounce strategy instance + +## Example + +```ts +const mutate = usePacedMutations({ + onMutate: (value) => { + collection.update(id, draft => { draft.value = value }) + }, + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: debounceStrategy({ wait: 500 }) +}) +``` diff --git a/docs/reference/functions/eq.md b/docs/reference/functions/eq.md new file mode 100644 index 000000000..0199b5da1 --- /dev/null +++ b/docs/reference/functions/eq.md @@ -0,0 +1,90 @@ +--- +id: eq +title: eq +--- + +# Function: eq() + +## Call Signature + +```ts +function eq(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L115) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +`ComparisonOperand`\<`T`\> + +#### right + +`ComparisonOperand`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function eq(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L119) + +### Type Parameters + +#### T + +`T` *extends* `string` \| `number` \| `boolean` + +### Parameters + +#### left + +`ComparisonOperandPrimitive`\<`T`\> + +#### right + +`ComparisonOperandPrimitive`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function eq(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L123) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/getActiveTransaction.md b/docs/reference/functions/getActiveTransaction.md new file mode 100644 index 000000000..31ac09e1c --- /dev/null +++ b/docs/reference/functions/getActiveTransaction.md @@ -0,0 +1,34 @@ +--- +id: getActiveTransaction +title: getActiveTransaction +--- + +# Function: getActiveTransaction() + +```ts +function getActiveTransaction(): + | Transaction> + | undefined; +``` + +Defined in: [packages/db/src/transactions.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L175) + +Gets the currently active ambient transaction, if any +Used internally by collection operations to join existing transactions + +## Returns + + \| [`Transaction`](../../interfaces/Transaction.md)\<`Record`\<`string`, `unknown`\>\> + \| `undefined` + +The active transaction or undefined if none is active + +## Example + +```ts +// Check if operations will join an ambient transaction +const ambientTx = getActiveTransaction() +if (ambientTx) { + console.log('Operations will join transaction:', ambientTx.id) +} +``` diff --git a/docs/reference/functions/gt.md b/docs/reference/functions/gt.md new file mode 100644 index 000000000..050c7712c --- /dev/null +++ b/docs/reference/functions/gt.md @@ -0,0 +1,90 @@ +--- +id: gt +title: gt +--- + +# Function: gt() + +## Call Signature + +```ts +function gt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L128) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +`ComparisonOperand`\<`T`\> + +#### right + +`ComparisonOperand`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function gt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L132) + +### Type Parameters + +#### T + +`T` *extends* `string` \| `number` + +### Parameters + +#### left + +`ComparisonOperandPrimitive`\<`T`\> + +#### right + +`ComparisonOperandPrimitive`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function gt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:136](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L136) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/gte.md b/docs/reference/functions/gte.md new file mode 100644 index 000000000..7a6798a69 --- /dev/null +++ b/docs/reference/functions/gte.md @@ -0,0 +1,90 @@ +--- +id: gte +title: gte +--- + +# Function: gte() + +## Call Signature + +```ts +function gte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:141](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L141) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +`ComparisonOperand`\<`T`\> + +#### right + +`ComparisonOperand`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function gte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:145](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L145) + +### Type Parameters + +#### T + +`T` *extends* `string` \| `number` + +### Parameters + +#### left + +`ComparisonOperandPrimitive`\<`T`\> + +#### right + +`ComparisonOperandPrimitive`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function gte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:149](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L149) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/ilike.md b/docs/reference/functions/ilike.md new file mode 100644 index 000000000..989b7e9f5 --- /dev/null +++ b/docs/reference/functions/ilike.md @@ -0,0 +1,26 @@ +--- +id: ilike +title: ilike +--- + +# Function: ilike() + +```ts +function ilike(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:252](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L252) + +## Parameters + +### left + +`StringLike` + +### right + +`StringLike` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/inArray.md b/docs/reference/functions/inArray.md new file mode 100644 index 000000000..c48e33a81 --- /dev/null +++ b/docs/reference/functions/inArray.md @@ -0,0 +1,26 @@ +--- +id: inArray +title: inArray +--- + +# Function: inArray() + +```ts +function inArray(value, array): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:237](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L237) + +## Parameters + +### value + +`any` + +### array + +`any` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isNull.md b/docs/reference/functions/isNull.md new file mode 100644 index 000000000..704ae7f33 --- /dev/null +++ b/docs/reference/functions/isNull.md @@ -0,0 +1,22 @@ +--- +id: isNull +title: isNull +--- + +# Function: isNull() + +```ts +function isNull(value): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:233](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L233) + +## Parameters + +### value + +`any` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isUndefined.md b/docs/reference/functions/isUndefined.md new file mode 100644 index 000000000..0862c3cc9 --- /dev/null +++ b/docs/reference/functions/isUndefined.md @@ -0,0 +1,22 @@ +--- +id: isUndefined +title: isUndefined +--- + +# Function: isUndefined() + +```ts +function isUndefined(value): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L229) + +## Parameters + +### value + +`any` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/length.md b/docs/reference/functions/length.md new file mode 100644 index 000000000..93ae660bd --- /dev/null +++ b/docs/reference/functions/length.md @@ -0,0 +1,28 @@ +--- +id: length +title: length +--- + +# Function: length() + +```ts +function length(arg): NumericFunctionReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:273](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L273) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`NumericFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/like.md b/docs/reference/functions/like.md new file mode 100644 index 000000000..d94a428d4 --- /dev/null +++ b/docs/reference/functions/like.md @@ -0,0 +1,26 @@ +--- +id: like +title: like +--- + +# Function: like() + +```ts +function like(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:244](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L244) + +## Parameters + +### left + +`StringLike` + +### right + +`StringLike` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/liveQueryCollectionOptions.md b/docs/reference/functions/liveQueryCollectionOptions.md new file mode 100644 index 000000000..20b266568 --- /dev/null +++ b/docs/reference/functions/liveQueryCollectionOptions.md @@ -0,0 +1,59 @@ +--- +id: liveQueryCollectionOptions +title: liveQueryCollectionOptions +--- + +# Function: liveQueryCollectionOptions() + +```ts +function liveQueryCollectionOptions(config): CollectionConfigForContext & object; +``` + +Defined in: [packages/db/src/query/live-query-collection.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/live-query-collection.ts#L62) + +Creates live query collection options for use with createCollection + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) + +### TResult + +`TResult` *extends* `object` = \{ \[K in string \| number \| symbol\]: (TContext\["result"\] extends object ? any\[any\] : TContext\["hasJoins"\] extends true ? TContext\["schema"\] : TContext\["schema"\]\[TContext\["fromSourceName"\]\])\[K\] \} + +## Parameters + +### config + +[`LiveQueryCollectionConfig`](../../interfaces/LiveQueryCollectionConfig.md)\<`TContext`, `TResult`\> + +Configuration options for the live query collection + +## Returns + +`CollectionConfigForContext`\<`TContext`, `TResult`, \{ +\}\> & `object` + +Collection options that can be passed to createCollection + +## Example + +```typescript +const options = liveQueryCollectionOptions({ + // id is optional - will auto-generate if not provided + query: (q) => q + .from({ post: postsCollection }) + .where(({ post }) => eq(post.published, true)) + .select(({ post }) => ({ + id: post.id, + title: post.title, + content: post.content, + })), + // getKey is optional - will use stream key if not provided +}) + +const collection = createCollection(options) +``` diff --git a/docs/reference/functions/localOnlyCollectionOptions.md b/docs/reference/functions/localOnlyCollectionOptions.md new file mode 100644 index 000000000..f473f9599 --- /dev/null +++ b/docs/reference/functions/localOnlyCollectionOptions.md @@ -0,0 +1,230 @@ +--- +id: localOnlyCollectionOptions +title: localOnlyCollectionOptions +--- + +# Function: localOnlyCollectionOptions() + +## Call Signature + +```ts +function localOnlyCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object & object; +``` + +Defined in: [packages/db/src/local-only.ts:149](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L149) + +Creates Local-only collection options for use with a standard Collection + +This is an in-memory collection that doesn't sync with external sources but uses a loopback sync config +that immediately "syncs" all optimistic changes to the collection, making them permanent. +Perfect for local-only data that doesn't need persistence or external synchronization. + +**Using with Manual Transactions:** + +For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` +to persist changes made during `tx.mutate()`. This is necessary because local-only collections +don't participate in the standard mutation handler flow for manual transactions. + +### Type Parameters + +#### T + +`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key returned by getKey + +### Parameters + +#### config + +[`LocalOnlyCollectionConfig`](../../interfaces/LocalOnlyCollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `T`, `TKey`\> & `object` + +Configuration options for the Local-only collection + +### Returns + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & `object` + +Collection options with utilities including acceptMutations + +### Examples + +```ts +// Basic local-only collection +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + }) +) +``` + +```ts +// Local-only collection with initial data +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + initialData: [ + { id: 1, name: 'Item 1' }, + { id: 2, name: 'Item 2' }, + ], + }) +) +``` + +```ts +// Local-only collection with mutation handlers +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + onInsert: async ({ transaction }) => { + console.log('Item inserted:', transaction.mutations[0].modified) + // Custom logic after insert + }, + }) +) +``` + +```ts +// Using with manual transactions +const localData = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + }) +) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Use local data in API call + const localMutations = transaction.mutations.filter(m => m.collection === localData) + await api.save({ metadata: localMutations[0]?.modified }) + + // Persist local-only mutations after API success + localData.utils.acceptMutations(transaction) + } +}) + +tx.mutate(() => { + localData.insert({ id: 1, data: 'metadata' }) + apiCollection.insert({ id: 2, data: 'main data' }) +}) + +await tx.commit() +``` + +## Call Signature + +```ts +function localOnlyCollectionOptions(config): CollectionConfig & object & object; +``` + +Defined in: [packages/db/src/local-only.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L162) + +Creates Local-only collection options for use with a standard Collection + +This is an in-memory collection that doesn't sync with external sources but uses a loopback sync config +that immediately "syncs" all optimistic changes to the collection, making them permanent. +Perfect for local-only data that doesn't need persistence or external synchronization. + +**Using with Manual Transactions:** + +For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` +to persist changes made during `tx.mutate()`. This is necessary because local-only collections +don't participate in the standard mutation handler flow for manual transactions. + +### Type Parameters + +#### T + +`T` *extends* `object` + +The schema type if a schema is provided, otherwise the type of items in the collection + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key returned by getKey + +### Parameters + +#### config + +[`LocalOnlyCollectionConfig`](../../interfaces/LocalOnlyCollectionConfig.md)\<`T`, `never`, `TKey`\> & `object` + +Configuration options for the Local-only collection + +### Returns + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` & `object` + +Collection options with utilities including acceptMutations + +### Examples + +```ts +// Basic local-only collection +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + }) +) +``` + +```ts +// Local-only collection with initial data +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + initialData: [ + { id: 1, name: 'Item 1' }, + { id: 2, name: 'Item 2' }, + ], + }) +) +``` + +```ts +// Local-only collection with mutation handlers +const collection = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + onInsert: async ({ transaction }) => { + console.log('Item inserted:', transaction.mutations[0].modified) + // Custom logic after insert + }, + }) +) +``` + +```ts +// Using with manual transactions +const localData = createCollection( + localOnlyCollectionOptions({ + getKey: (item) => item.id, + }) +) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Use local data in API call + const localMutations = transaction.mutations.filter(m => m.collection === localData) + await api.save({ metadata: localMutations[0]?.modified }) + + // Persist local-only mutations after API success + localData.utils.acceptMutations(transaction) + } +}) + +tx.mutate(() => { + localData.insert({ id: 1, data: 'metadata' }) + apiCollection.insert({ id: 2, data: 'main data' }) +}) + +await tx.commit() +``` diff --git a/docs/reference/functions/localStorageCollectionOptions.md b/docs/reference/functions/localStorageCollectionOptions.md new file mode 100644 index 000000000..29b60f87f --- /dev/null +++ b/docs/reference/functions/localStorageCollectionOptions.md @@ -0,0 +1,236 @@ +--- +id: localStorageCollectionOptions +title: localStorageCollectionOptions +--- + +# Function: localStorageCollectionOptions() + +## Call Signature + +```ts +function localStorageCollectionOptions(config): CollectionConfig, TKey, T, UtilsRecord> & object; +``` + +Defined in: [packages/db/src/local-storage.ts:279](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L279) + +Creates localStorage collection options for use with a standard Collection + +This function creates a collection that persists data to localStorage/sessionStorage +and synchronizes changes across browser tabs using storage events. + +**Fallback Behavior:** + +When localStorage is not available (e.g., in server-side rendering environments), +this function automatically falls back to an in-memory storage implementation. +This prevents errors during module initialization and allows the collection to +work in any environment, though data will not persist across page reloads or +be shared across tabs when using the in-memory fallback. + +**Using with Manual Transactions:** + +For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` +to persist changes made during `tx.mutate()`. This is necessary because local-storage collections +don't participate in the standard mutation handler flow for manual transactions. + +### Type Parameters + +#### T + +`T` *extends* `StandardSchemaV1`\<`unknown`, `unknown`\> + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### Parameters + +#### config + +[`LocalStorageCollectionConfig`](../../interfaces/LocalStorageCollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `T`, `TKey`\> & `object` + +Configuration options for the localStorage collection + +### Returns + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` + +Collection options with utilities including clearStorage, getStorageSize, and acceptMutations + +### Examples + +```ts +// Basic localStorage collection +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + getKey: (item) => item.id, + }) +) +``` + +```ts +// localStorage collection with custom storage +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + storage: window.sessionStorage, // Use sessionStorage instead + getKey: (item) => item.id, + }) +) +``` + +```ts +// localStorage collection with mutation handlers +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + getKey: (item) => item.id, + onInsert: async ({ transaction }) => { + console.log('Item inserted:', transaction.mutations[0].modified) + }, + }) +) +``` + +```ts +// Using with manual transactions +const localSettings = createCollection( + localStorageCollectionOptions({ + storageKey: 'user-settings', + getKey: (item) => item.id, + }) +) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Use settings data in API call + const settingsMutations = transaction.mutations.filter(m => m.collection === localSettings) + await api.updateUserProfile({ settings: settingsMutations[0]?.modified }) + + // Persist local-storage mutations after API success + localSettings.utils.acceptMutations(transaction) + } +}) + +tx.mutate(() => { + localSettings.insert({ id: 'theme', value: 'dark' }) + apiCollection.insert({ id: 2, data: 'profile data' }) +}) + +await tx.commit() +``` + +## Call Signature + +```ts +function localStorageCollectionOptions(config): CollectionConfig & object; +``` + +Defined in: [packages/db/src/local-storage.ts:294](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L294) + +Creates localStorage collection options for use with a standard Collection + +This function creates a collection that persists data to localStorage/sessionStorage +and synchronizes changes across browser tabs using storage events. + +**Fallback Behavior:** + +When localStorage is not available (e.g., in server-side rendering environments), +this function automatically falls back to an in-memory storage implementation. +This prevents errors during module initialization and allows the collection to +work in any environment, though data will not persist across page reloads or +be shared across tabs when using the in-memory fallback. + +**Using with Manual Transactions:** + +For manual transactions, you must call `utils.acceptMutations()` in your transaction's `mutationFn` +to persist changes made during `tx.mutate()`. This is necessary because local-storage collections +don't participate in the standard mutation handler flow for manual transactions. + +### Type Parameters + +#### T + +`T` *extends* `object` + +#### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### Parameters + +#### config + +[`LocalStorageCollectionConfig`](../../interfaces/LocalStorageCollectionConfig.md)\<`T`, `never`, `TKey`\> & `object` + +Configuration options for the localStorage collection + +### Returns + +[`CollectionConfig`](../../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, [`UtilsRecord`](../../type-aliases/UtilsRecord.md)\> & `object` + +Collection options with utilities including clearStorage, getStorageSize, and acceptMutations + +### Examples + +```ts +// Basic localStorage collection +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + getKey: (item) => item.id, + }) +) +``` + +```ts +// localStorage collection with custom storage +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + storage: window.sessionStorage, // Use sessionStorage instead + getKey: (item) => item.id, + }) +) +``` + +```ts +// localStorage collection with mutation handlers +const collection = createCollection( + localStorageCollectionOptions({ + storageKey: 'todos', + getKey: (item) => item.id, + onInsert: async ({ transaction }) => { + console.log('Item inserted:', transaction.mutations[0].modified) + }, + }) +) +``` + +```ts +// Using with manual transactions +const localSettings = createCollection( + localStorageCollectionOptions({ + storageKey: 'user-settings', + getKey: (item) => item.id, + }) +) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Use settings data in API call + const settingsMutations = transaction.mutations.filter(m => m.collection === localSettings) + await api.updateUserProfile({ settings: settingsMutations[0]?.modified }) + + // Persist local-storage mutations after API success + localSettings.utils.acceptMutations(transaction) + } +}) + +tx.mutate(() => { + localSettings.insert({ id: 'theme', value: 'dark' }) + apiCollection.insert({ id: 2, data: 'profile data' }) +}) + +await tx.commit() +``` diff --git a/docs/reference/functions/lower.md b/docs/reference/functions/lower.md new file mode 100644 index 000000000..a2b6c0ab8 --- /dev/null +++ b/docs/reference/functions/lower.md @@ -0,0 +1,28 @@ +--- +id: lower +title: lower +--- + +# Function: lower() + +```ts +function lower(arg): StringFunctionReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L267) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`StringFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/lt.md b/docs/reference/functions/lt.md new file mode 100644 index 000000000..b7cbe7e61 --- /dev/null +++ b/docs/reference/functions/lt.md @@ -0,0 +1,90 @@ +--- +id: lt +title: lt +--- + +# Function: lt() + +## Call Signature + +```ts +function lt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:154](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L154) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +`ComparisonOperand`\<`T`\> + +#### right + +`ComparisonOperand`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function lt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:158](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L158) + +### Type Parameters + +#### T + +`T` *extends* `string` \| `number` + +### Parameters + +#### left + +`ComparisonOperandPrimitive`\<`T`\> + +#### right + +`ComparisonOperandPrimitive`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function lt(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L162) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/lte.md b/docs/reference/functions/lte.md new file mode 100644 index 000000000..25db4b12f --- /dev/null +++ b/docs/reference/functions/lte.md @@ -0,0 +1,90 @@ +--- +id: lte +title: lte +--- + +# Function: lte() + +## Call Signature + +```ts +function lte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:167](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L167) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +`ComparisonOperand`\<`T`\> + +#### right + +`ComparisonOperand`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function lte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:171](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L171) + +### Type Parameters + +#### T + +`T` *extends* `string` \| `number` + +### Parameters + +#### left + +`ComparisonOperandPrimitive`\<`T`\> + +#### right + +`ComparisonOperandPrimitive`\<`T`\> + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function lte(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L175) + +### Type Parameters + +#### T + +`T` + +### Parameters + +#### left + +[`Aggregate`](../../@tanstack/namespaces/IR/classes/Aggregate.md)\<`T`\> + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/max.md b/docs/reference/functions/max.md new file mode 100644 index 000000000..81889962b --- /dev/null +++ b/docs/reference/functions/max.md @@ -0,0 +1,28 @@ +--- +id: max +title: max +--- + +# Function: max() + +```ts +function max(arg): AggregateReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:323](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L323) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/min.md b/docs/reference/functions/min.md new file mode 100644 index 000000000..6335fff82 --- /dev/null +++ b/docs/reference/functions/min.md @@ -0,0 +1,28 @@ +--- +id: min +title: min +--- + +# Function: min() + +```ts +function min(arg): AggregateReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:319](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L319) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/not.md b/docs/reference/functions/not.md new file mode 100644 index 000000000..d0bab9aff --- /dev/null +++ b/docs/reference/functions/not.md @@ -0,0 +1,22 @@ +--- +id: not +title: not +--- + +# Function: not() + +```ts +function not(value): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:224](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L224) + +## Parameters + +### value + +`any` + +## Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/or.md b/docs/reference/functions/or.md new file mode 100644 index 000000000..11e471f9e --- /dev/null +++ b/docs/reference/functions/or.md @@ -0,0 +1,57 @@ +--- +id: or +title: or +--- + +# Function: or() + +## Call Signature + +```ts +function or(left, right): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:203](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L203) + +### Parameters + +#### left + +`any` + +#### right + +`any` + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +## Call Signature + +```ts +function or( + left, + right, ... +rest): BasicExpression; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:207](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L207) + +### Parameters + +#### left + +`any` + +#### right + +`any` + +#### rest + +...`any`[] + +### Returns + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/queueStrategy.md b/docs/reference/functions/queueStrategy.md new file mode 100644 index 000000000..8752c1746 --- /dev/null +++ b/docs/reference/functions/queueStrategy.md @@ -0,0 +1,63 @@ +--- +id: queueStrategy +title: queueStrategy +--- + +# Function: queueStrategy() + +```ts +function queueStrategy(options?): QueueStrategy; +``` + +Defined in: [packages/db/src/strategies/queueStrategy.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/queueStrategy.ts#L46) + +Creates a queue strategy that processes all mutations in order with proper serialization. + +Unlike other strategies that may drop executions, queue ensures every +mutation is processed sequentially. Each transaction commit completes before +the next one starts. Useful when data consistency is critical and +every operation must complete in order. + +## Parameters + +### options? + +[`QueueStrategyOptions`](../../interfaces/QueueStrategyOptions.md) + +Configuration for queue behavior (FIFO/LIFO, timing, size limits) + +## Returns + +[`QueueStrategy`](../../interfaces/QueueStrategy.md) + +A queue strategy instance + +## Examples + +```ts +// FIFO queue - process in order received +const mutate = usePacedMutations({ + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: queueStrategy({ + wait: 200, + addItemsTo: 'back', + getItemsFrom: 'front' + }) +}) +``` + +```ts +// LIFO queue - process most recent first +const mutate = usePacedMutations({ + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: queueStrategy({ + wait: 200, + addItemsTo: 'back', + getItemsFrom: 'back' + }) +}) +``` diff --git a/docs/reference/functions/sum.md b/docs/reference/functions/sum.md new file mode 100644 index 000000000..760550dff --- /dev/null +++ b/docs/reference/functions/sum.md @@ -0,0 +1,28 @@ +--- +id: sum +title: sum +--- + +# Function: sum() + +```ts +function sum(arg): AggregateReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:315](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L315) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/throttleStrategy.md b/docs/reference/functions/throttleStrategy.md new file mode 100644 index 000000000..b9ac28644 --- /dev/null +++ b/docs/reference/functions/throttleStrategy.md @@ -0,0 +1,65 @@ +--- +id: throttleStrategy +title: throttleStrategy +--- + +# Function: throttleStrategy() + +```ts +function throttleStrategy(options): ThrottleStrategy; +``` + +Defined in: [packages/db/src/strategies/throttleStrategy.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/throttleStrategy.ts#L48) + +Creates a throttle strategy that ensures transactions are evenly spaced +over time. + +Provides smooth, controlled execution patterns ideal for UI updates like +sliders, progress bars, or scroll handlers where you want consistent +execution timing. + +## Parameters + +### options + +[`ThrottleStrategyOptions`](../../interfaces/ThrottleStrategyOptions.md) + +Configuration for throttle behavior + +## Returns + +[`ThrottleStrategy`](../../interfaces/ThrottleStrategy.md) + +A throttle strategy instance + +## Examples + +```ts +// Throttle slider updates to every 200ms +const mutate = usePacedMutations({ + onMutate: (volume) => { + settingsCollection.update('volume', draft => { draft.value = volume }) + }, + mutationFn: async ({ transaction }) => { + await api.updateVolume(transaction.mutations) + }, + strategy: throttleStrategy({ wait: 200 }) +}) +``` + +```ts +// Throttle with leading and trailing execution +const mutate = usePacedMutations({ + onMutate: (data) => { + collection.update(id, draft => { Object.assign(draft, data) }) + }, + mutationFn: async ({ transaction }) => { + await api.save(transaction.mutations) + }, + strategy: throttleStrategy({ + wait: 500, + leading: true, + trailing: true + }) +}) +``` diff --git a/docs/reference/functions/upper.md b/docs/reference/functions/upper.md new file mode 100644 index 000000000..af4652235 --- /dev/null +++ b/docs/reference/functions/upper.md @@ -0,0 +1,28 @@ +--- +id: upper +title: upper +--- + +# Function: upper() + +```ts +function upper(arg): StringFunctionReturnType; +``` + +Defined in: [packages/db/src/query/builder/functions.ts:261](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/functions.ts#L261) + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`StringFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/withArrayChangeTracking.md b/docs/reference/functions/withArrayChangeTracking.md new file mode 100644 index 000000000..07407a7d6 --- /dev/null +++ b/docs/reference/functions/withArrayChangeTracking.md @@ -0,0 +1,41 @@ +--- +id: withArrayChangeTracking +title: withArrayChangeTracking +--- + +# Function: withArrayChangeTracking() + +```ts +function withArrayChangeTracking(targets, callback): Record[]; +``` + +Defined in: [packages/db/src/proxy.ts:914](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L914) + +Creates proxies for an array of objects, passes them to a callback function, +and returns the changes made by the callback for each object + +## Type Parameters + +### T + +`T` *extends* `object` + +## Parameters + +### targets + +`T`[] + +Array of objects to proxy + +### callback + +(`proxies`) => `void` + +Function that receives the proxies and can make changes to them + +## Returns + +`Record`\<`string` \| `symbol`, `unknown`\>[] + +Array of changes made to each object diff --git a/docs/reference/functions/withChangeTracking.md b/docs/reference/functions/withChangeTracking.md new file mode 100644 index 000000000..4495f328b --- /dev/null +++ b/docs/reference/functions/withChangeTracking.md @@ -0,0 +1,41 @@ +--- +id: withChangeTracking +title: withChangeTracking +--- + +# Function: withChangeTracking() + +```ts +function withChangeTracking(target, callback): Record; +``` + +Defined in: [packages/db/src/proxy.ts:895](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L895) + +Creates a proxy for an object, passes it to a callback function, +and returns the changes made by the callback + +## Type Parameters + +### T + +`T` *extends* `object` + +## Parameters + +### target + +`T` + +The object to proxy + +### callback + +(`proxy`) => `void` + +Function that receives the proxy and can make changes to it + +## Returns + +`Record`\<`string` \| `symbol`, `unknown`\> + +The changes made to the object diff --git a/docs/reference/index.md b/docs/reference/index.md new file mode 100644 index 000000000..60f6ced0f --- /dev/null +++ b/docs/reference/index.md @@ -0,0 +1,253 @@ +--- +id: "@tanstack/db" +title: "@tanstack/db" +--- + +# @tanstack/db + +## Namespaces + +- [IR](../@tanstack/namespaces/IR/index.md) + +## Classes + +- [AggregateFunctionNotInSelectError](../classes/AggregateFunctionNotInSelectError.md) +- [AggregateNotSupportedError](../classes/AggregateNotSupportedError.md) +- [BaseIndex](../classes/BaseIndex.md) +- [BaseQueryBuilder](../classes/BaseQueryBuilder.md) +- [BTreeIndex](../classes/BTreeIndex.md) +- [CannotCombineEmptyExpressionListError](../classes/CannotCombineEmptyExpressionListError.md) +- [CollectionConfigurationError](../classes/CollectionConfigurationError.md) +- [CollectionImpl](../classes/CollectionImpl.md) +- [CollectionInErrorStateError](../classes/CollectionInErrorStateError.md) +- [CollectionInputNotFoundError](../classes/CollectionInputNotFoundError.md) +- [CollectionIsInErrorStateError](../classes/CollectionIsInErrorStateError.md) +- [CollectionOperationError](../classes/CollectionOperationError.md) +- [CollectionRequiresConfigError](../classes/CollectionRequiresConfigError.md) +- [CollectionRequiresSyncConfigError](../classes/CollectionRequiresSyncConfigError.md) +- [CollectionStateError](../classes/CollectionStateError.md) +- [DeleteKeyNotFoundError](../classes/DeleteKeyNotFoundError.md) +- [DistinctRequiresSelectError](../classes/DistinctRequiresSelectError.md) +- [DuplicateAliasInSubqueryError](../classes/DuplicateAliasInSubqueryError.md) +- [DuplicateDbInstanceError](../classes/DuplicateDbInstanceError.md) +- [DuplicateKeyError](../classes/DuplicateKeyError.md) +- [DuplicateKeySyncError](../classes/DuplicateKeySyncError.md) +- [EmptyReferencePathError](../classes/EmptyReferencePathError.md) +- [GroupByError](../classes/GroupByError.md) +- [HavingRequiresGroupByError](../classes/HavingRequiresGroupByError.md) +- [IndexProxy](../classes/IndexProxy.md) +- [InvalidCollectionStatusTransitionError](../classes/InvalidCollectionStatusTransitionError.md) +- [InvalidJoinCondition](../classes/InvalidJoinCondition.md) +- [InvalidJoinConditionLeftSourceError](../classes/InvalidJoinConditionLeftSourceError.md) +- [InvalidJoinConditionRightSourceError](../classes/InvalidJoinConditionRightSourceError.md) +- [InvalidJoinConditionSameSourceError](../classes/InvalidJoinConditionSameSourceError.md) +- [InvalidJoinConditionSourceMismatchError](../classes/InvalidJoinConditionSourceMismatchError.md) +- [InvalidSchemaError](../classes/InvalidSchemaError.md) +- [InvalidSourceError](../classes/InvalidSourceError.md) +- [InvalidStorageDataFormatError](../classes/InvalidStorageDataFormatError.md) +- [InvalidStorageObjectFormatError](../classes/InvalidStorageObjectFormatError.md) +- [JoinCollectionNotFoundError](../classes/JoinCollectionNotFoundError.md) +- [JoinConditionMustBeEqualityError](../classes/JoinConditionMustBeEqualityError.md) +- [JoinError](../classes/JoinError.md) +- [KeyUpdateNotAllowedError](../classes/KeyUpdateNotAllowedError.md) +- [LazyIndexWrapper](../classes/LazyIndexWrapper.md) +- [LimitOffsetRequireOrderByError](../classes/LimitOffsetRequireOrderByError.md) +- [LocalStorageCollectionError](../classes/LocalStorageCollectionError.md) +- [MissingAliasInputsError](../classes/MissingAliasInputsError.md) +- [MissingDeleteHandlerError](../classes/MissingDeleteHandlerError.md) +- [MissingHandlerError](../classes/MissingHandlerError.md) +- [MissingInsertHandlerError](../classes/MissingInsertHandlerError.md) +- [MissingMutationFunctionError](../classes/MissingMutationFunctionError.md) +- [MissingUpdateArgumentError](../classes/MissingUpdateArgumentError.md) +- [MissingUpdateHandlerError](../classes/MissingUpdateHandlerError.md) +- [NegativeActiveSubscribersError](../classes/NegativeActiveSubscribersError.md) +- [NoKeysPassedToDeleteError](../classes/NoKeysPassedToDeleteError.md) +- [NoKeysPassedToUpdateError](../classes/NoKeysPassedToUpdateError.md) +- [NonAggregateExpressionNotInGroupByError](../classes/NonAggregateExpressionNotInGroupByError.md) +- [NonRetriableError](../classes/NonRetriableError.md) +- [NoPendingSyncTransactionCommitError](../classes/NoPendingSyncTransactionCommitError.md) +- [NoPendingSyncTransactionWriteError](../classes/NoPendingSyncTransactionWriteError.md) +- [OnlyOneSourceAllowedError](../classes/OnlyOneSourceAllowedError.md) +- [OnMutateMustBeSynchronousError](../classes/OnMutateMustBeSynchronousError.md) +- [QueryBuilderError](../classes/QueryBuilderError.md) +- [QueryCompilationError](../classes/QueryCompilationError.md) +- [QueryMustHaveFromClauseError](../classes/QueryMustHaveFromClauseError.md) +- [QueryOptimizerError](../classes/QueryOptimizerError.md) +- [SchemaMustBeSynchronousError](../classes/SchemaMustBeSynchronousError.md) +- [SchemaValidationError](../classes/SchemaValidationError.md) +- [SerializationError](../classes/SerializationError.md) +- [SetWindowRequiresOrderByError](../classes/SetWindowRequiresOrderByError.md) +- [SortedMap](../classes/SortedMap.md) +- [StorageError](../classes/StorageError.md) +- [StorageKeyRequiredError](../classes/StorageKeyRequiredError.md) +- [SubQueryMustHaveFromClauseError](../classes/SubQueryMustHaveFromClauseError.md) +- [SubscriptionNotFoundError](../classes/SubscriptionNotFoundError.md) +- [SyncCleanupError](../classes/SyncCleanupError.md) +- [SyncTransactionAlreadyCommittedError](../classes/SyncTransactionAlreadyCommittedError.md) +- [SyncTransactionAlreadyCommittedWriteError](../classes/SyncTransactionAlreadyCommittedWriteError.md) +- [TanStackDBError](../classes/TanStackDBError.md) +- [TransactionAlreadyCompletedRollbackError](../classes/TransactionAlreadyCompletedRollbackError.md) +- [TransactionError](../classes/TransactionError.md) +- [TransactionNotPendingCommitError](../classes/TransactionNotPendingCommitError.md) +- [TransactionNotPendingMutateError](../classes/TransactionNotPendingMutateError.md) +- [UndefinedKeyError](../classes/UndefinedKeyError.md) +- [UnknownExpressionTypeError](../classes/UnknownExpressionTypeError.md) +- [UnknownFunctionError](../classes/UnknownFunctionError.md) +- [UnknownHavingExpressionTypeError](../classes/UnknownHavingExpressionTypeError.md) +- [UnsupportedAggregateFunctionError](../classes/UnsupportedAggregateFunctionError.md) +- [UnsupportedFromTypeError](../classes/UnsupportedFromTypeError.md) +- [UnsupportedJoinSourceTypeError](../classes/UnsupportedJoinSourceTypeError.md) +- [UnsupportedJoinTypeError](../classes/UnsupportedJoinTypeError.md) +- [UpdateKeyNotFoundError](../classes/UpdateKeyNotFoundError.md) +- [WhereClauseConversionError](../classes/WhereClauseConversionError.md) + +## Interfaces + +- [BaseCollectionConfig](../interfaces/BaseCollectionConfig.md) +- [BaseStrategy](../interfaces/BaseStrategy.md) +- [BTreeIndexOptions](../interfaces/BTreeIndexOptions.md) +- [ChangeMessage](../interfaces/ChangeMessage.md) +- [Collection](../interfaces/Collection.md) +- [CollectionConfig](../interfaces/CollectionConfig.md) +- [Context](../interfaces/Context.md) +- [CreateOptimisticActionsOptions](../interfaces/CreateOptimisticActionsOptions.md) +- [CurrentStateAsChangesOptions](../interfaces/CurrentStateAsChangesOptions.md) +- [DebounceStrategy](../interfaces/DebounceStrategy.md) +- [DebounceStrategyOptions](../interfaces/DebounceStrategyOptions.md) +- [IndexInterface](../interfaces/IndexInterface.md) +- [IndexOptions](../interfaces/IndexOptions.md) +- [IndexStats](../interfaces/IndexStats.md) +- [InsertConfig](../interfaces/InsertConfig.md) +- [LiveQueryCollectionConfig](../interfaces/LiveQueryCollectionConfig.md) +- [LocalOnlyCollectionConfig](../interfaces/LocalOnlyCollectionConfig.md) +- [LocalOnlyCollectionUtils](../interfaces/LocalOnlyCollectionUtils.md) +- [LocalStorageCollectionConfig](../interfaces/LocalStorageCollectionConfig.md) +- [LocalStorageCollectionUtils](../interfaces/LocalStorageCollectionUtils.md) +- [OperationConfig](../interfaces/OperationConfig.md) +- [OptimisticChangeMessage](../interfaces/OptimisticChangeMessage.md) +- [PacedMutationsConfig](../interfaces/PacedMutationsConfig.md) +- [Parser](../interfaces/Parser.md) +- [PendingMutation](../interfaces/PendingMutation.md) +- [QueueStrategy](../interfaces/QueueStrategy.md) +- [QueueStrategyOptions](../interfaces/QueueStrategyOptions.md) +- [RangeQueryOptions](../interfaces/RangeQueryOptions.md) +- [SubscribeChangesOptions](../interfaces/SubscribeChangesOptions.md) +- [SubscribeChangesSnapshotOptions](../interfaces/SubscribeChangesSnapshotOptions.md) +- [Subscription](../interfaces/Subscription.md) +- [SubscriptionStatusChangeEvent](../interfaces/SubscriptionStatusChangeEvent.md) +- [SubscriptionStatusEvent](../interfaces/SubscriptionStatusEvent.md) +- [SubscriptionUnsubscribedEvent](../interfaces/SubscriptionUnsubscribedEvent.md) +- [SyncConfig](../interfaces/SyncConfig.md) +- [ThrottleStrategy](../interfaces/ThrottleStrategy.md) +- [ThrottleStrategyOptions](../interfaces/ThrottleStrategyOptions.md) +- [Transaction](../interfaces/Transaction.md) +- [TransactionConfig](../interfaces/TransactionConfig.md) + +## Type Aliases + +- [ChangeListener](../type-aliases/ChangeListener.md) +- [ChangesPayload](../type-aliases/ChangesPayload.md) +- [CleanupFn](../type-aliases/CleanupFn.md) +- [ClearStorageFn](../type-aliases/ClearStorageFn.md) +- [CollectionConfigSingleRowOption](../type-aliases/CollectionConfigSingleRowOption.md) +- [CollectionStatus](../type-aliases/CollectionStatus.md) +- [DeleteMutationFn](../type-aliases/DeleteMutationFn.md) +- [DeleteMutationFnParams](../type-aliases/DeleteMutationFnParams.md) +- [Fn](../type-aliases/Fn.md) +- [GetResult](../type-aliases/GetResult.md) +- [GetStorageSizeFn](../type-aliases/GetStorageSizeFn.md) +- [IndexConstructor](../type-aliases/IndexConstructor.md) +- [IndexOperation](../type-aliases/IndexOperation.md) +- [IndexResolver](../type-aliases/IndexResolver.md) +- [InferResultType](../type-aliases/InferResultType.md) +- [InferSchemaInput](../type-aliases/InferSchemaInput.md) +- [InferSchemaOutput](../type-aliases/InferSchemaOutput.md) +- [InitialQueryBuilder](../type-aliases/InitialQueryBuilder.md) +- [InputRow](../type-aliases/InputRow.md) +- [InsertMutationFn](../type-aliases/InsertMutationFn.md) +- [InsertMutationFnParams](../type-aliases/InsertMutationFnParams.md) +- [KeyedNamespacedRow](../type-aliases/KeyedNamespacedRow.md) +- [KeyedStream](../type-aliases/KeyedStream.md) +- [LiveQueryCollectionUtils](../type-aliases/LiveQueryCollectionUtils.md) +- [LoadSubsetFn](../type-aliases/LoadSubsetFn.md) +- [LoadSubsetOptions](../type-aliases/LoadSubsetOptions.md) +- [MaybeSingleResult](../type-aliases/MaybeSingleResult.md) +- [MutationFn](../type-aliases/MutationFn.md) +- [MutationFnParams](../type-aliases/MutationFnParams.md) +- [NamespacedAndKeyedStream](../type-aliases/NamespacedAndKeyedStream.md) +- [NamespacedRow](../type-aliases/NamespacedRow.md) +- [NonEmptyArray](../type-aliases/NonEmptyArray.md) +- [NonSingleResult](../type-aliases/NonSingleResult.md) +- [OperationType](../type-aliases/OperationType.md) +- [QueryBuilder](../type-aliases/QueryBuilder.md) +- [Ref](../type-aliases/Ref.md) +- [ResolveTransactionChanges](../type-aliases/ResolveTransactionChanges.md) +- [ResultStream](../type-aliases/ResultStream.md) +- [Row](../type-aliases/Row.md) +- [SingleResult](../type-aliases/SingleResult.md) +- [Source](../type-aliases/Source.md) +- [StandardSchema](../type-aliases/StandardSchema.md) +- [StandardSchemaAlias](../type-aliases/StandardSchemaAlias.md) +- [StorageApi](../type-aliases/StorageApi.md) +- [StorageEventApi](../type-aliases/StorageEventApi.md) +- [Strategy](../type-aliases/Strategy.md) +- [StrategyOptions](../type-aliases/StrategyOptions.md) +- [SubscriptionEvents](../type-aliases/SubscriptionEvents.md) +- [SubscriptionStatus](../type-aliases/SubscriptionStatus.md) +- [SyncConfigRes](../type-aliases/SyncConfigRes.md) +- [SyncMode](../type-aliases/SyncMode.md) +- [TransactionState](../type-aliases/TransactionState.md) +- [TransactionWithMutations](../type-aliases/TransactionWithMutations.md) +- [UpdateMutationFn](../type-aliases/UpdateMutationFn.md) +- [UpdateMutationFnParams](../type-aliases/UpdateMutationFnParams.md) +- [UtilsRecord](../type-aliases/UtilsRecord.md) +- [WritableDeep](../type-aliases/WritableDeep.md) + +## Variables + +- [IndexOperation](../variables/IndexOperation.md) +- [Query](../variables/Query.md) + +## Functions + +- [add](../functions/add.md) +- [and](../functions/and.md) +- [avg](../functions/avg.md) +- [coalesce](../functions/coalesce.md) +- [compileQuery](../functions/compileQuery.md) +- [concat](../functions/concat.md) +- [count](../functions/count.md) +- [createArrayChangeProxy](../functions/createArrayChangeProxy.md) +- [createChangeProxy](../functions/createChangeProxy.md) +- [createCollection](../functions/createCollection.md) +- [createLiveQueryCollection](../functions/createLiveQueryCollection.md) +- [createOptimisticAction](../functions/createOptimisticAction.md) +- [createPacedMutations](../functions/createPacedMutations.md) +- [createTransaction](../functions/createTransaction.md) +- [debounceStrategy](../functions/debounceStrategy.md) +- [eq](../functions/eq.md) +- [getActiveTransaction](../functions/getActiveTransaction.md) +- [gt](../functions/gt.md) +- [gte](../functions/gte.md) +- [ilike](../functions/ilike.md) +- [inArray](../functions/inArray.md) +- [isNull](../functions/isNull.md) +- [isUndefined](../functions/isUndefined.md) +- [length](../functions/length.md) +- [like](../functions/like.md) +- [liveQueryCollectionOptions](../functions/liveQueryCollectionOptions.md) +- [localOnlyCollectionOptions](../functions/localOnlyCollectionOptions.md) +- [localStorageCollectionOptions](../functions/localStorageCollectionOptions.md) +- [lower](../functions/lower.md) +- [lt](../functions/lt.md) +- [lte](../functions/lte.md) +- [max](../functions/max.md) +- [min](../functions/min.md) +- [not](../functions/not.md) +- [or](../functions/or.md) +- [queueStrategy](../functions/queueStrategy.md) +- [sum](../functions/sum.md) +- [throttleStrategy](../functions/throttleStrategy.md) +- [upper](../functions/upper.md) +- [withArrayChangeTracking](../functions/withArrayChangeTracking.md) +- [withChangeTracking](../functions/withChangeTracking.md) diff --git a/docs/reference/interfaces/BTreeIndexOptions.md b/docs/reference/interfaces/BTreeIndexOptions.md new file mode 100644 index 000000000..6e6b27aa2 --- /dev/null +++ b/docs/reference/interfaces/BTreeIndexOptions.md @@ -0,0 +1,44 @@ +--- +id: BTreeIndexOptions +title: BTreeIndexOptions +--- + +# Interface: BTreeIndexOptions + +Defined in: [packages/db/src/indexes/btree-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L11) + +Options for Ordered index + +## Properties + +### compareFn()? + +```ts +optional compareFn: (a, b) => number; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:12](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L12) + +#### Parameters + +##### a + +`any` + +##### b + +`any` + +#### Returns + +`number` + +*** + +### compareOptions? + +```ts +optional compareOptions: CompareOptions; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L13) diff --git a/docs/reference/interfaces/BaseCollectionConfig.md b/docs/reference/interfaces/BaseCollectionConfig.md new file mode 100644 index 000000000..15da7ae5a --- /dev/null +++ b/docs/reference/interfaces/BaseCollectionConfig.md @@ -0,0 +1,412 @@ +--- +id: BaseCollectionConfig +title: BaseCollectionConfig +--- + +# Interface: BaseCollectionConfig\ + +Defined in: [packages/db/src/types.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L385) + +## Extended by + +- [`CollectionConfig`](../CollectionConfig.md) +- [`LocalStorageCollectionConfig`](../LocalStorageCollectionConfig.md) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +### TReturn + +`TReturn` = `any` + +## Properties + +### autoIndex? + +```ts +optional autoIndex: "eager" | "off"; +``` + +Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) + +Auto-indexing mode for the collection. +When enabled, indexes will be automatically created for simple where expressions. + +#### Default + +```ts +"eager" +``` + +#### Description + +- "off": No automatic indexing +- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) + +*** + +### compare()? + +```ts +optional compare: (x, y) => number; +``` + +Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) + +Optional function to compare two items. +This is used to order the items in the collection. + +#### Parameters + +##### x + +`T` + +The first item to compare + +##### y + +`T` + +The second item to compare + +#### Returns + +`number` + +A number indicating the order of the items + +#### Example + +```ts +// For a collection with a 'createdAt' field +compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() +``` + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) + +Time in milliseconds after which the collection will be garbage collected +when it has no active subscribers. Defaults to 5 minutes (300000ms). + +*** + +### getKey() + +```ts +getKey: (item) => TKey; +``` + +Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) + +Function to extract the ID from an object +This is required for update/delete operations which now only accept IDs + +#### Parameters + +##### item + +`T` + +The item to extract the ID from + +#### Returns + +`TKey` + +The ID string for the item + +#### Example + +```ts +// For a collection with a 'uuid' field as the primary key +getKey: (item) => item.uuid +``` + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) + +Optional asynchronous handler function called before a delete operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic delete handler +onDelete: async ({ transaction, collection }) => { + const deletedKey = transaction.mutations[0].key + await api.deleteTodo(deletedKey) +} +``` + +```ts +// Delete handler with multiple items +onDelete: async ({ transaction, collection }) => { + const keysToDelete = transaction.mutations.map(m => m.key) + await api.deleteTodos(keysToDelete) +} +``` + +```ts +// Delete handler with confirmation +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const shouldDelete = await confirmDeletion(mutation.original) + if (!shouldDelete) { + throw new Error('Delete cancelled by user') + } + await api.deleteTodo(mutation.original.id) +} +``` + +```ts +// Delete handler with optimistic rollback +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.deleteTodo(mutation.original.id) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Delete failed, rolling back:', error) + throw error + } +} +``` + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) + +Optional asynchronous handler function called before an insert operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic insert handler +onInsert: async ({ transaction, collection }) => { + const newItem = transaction.mutations[0].modified + await api.createTodo(newItem) +} +``` + +```ts +// Insert handler with multiple items +onInsert: async ({ transaction, collection }) => { + const items = transaction.mutations.map(m => m.modified) + await api.createTodos(items) +} +``` + +```ts +// Insert handler with error handling +onInsert: async ({ transaction, collection }) => { + try { + const newItem = transaction.mutations[0].modified + const result = await api.createTodo(newItem) + return result + } catch (error) { + console.error('Insert failed:', error) + throw error // This will cause the transaction to fail + } +} +``` + +```ts +// Insert handler with metadata +onInsert: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + await api.createTodo(mutation.modified, { + source: mutation.metadata?.source, + timestamp: mutation.createdAt + }) +} +``` + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) + +Optional asynchronous handler function called before an update operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic update handler +onUpdate: async ({ transaction, collection }) => { + const updatedItem = transaction.mutations[0].modified + await api.updateTodo(updatedItem.id, updatedItem) +} +``` + +```ts +// Update handler with partial updates +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const changes = mutation.changes // Only the changed fields + await api.updateTodo(mutation.original.id, changes) +} +``` + +```ts +// Update handler with multiple items +onUpdate: async ({ transaction, collection }) => { + const updates = transaction.mutations.map(m => ({ + id: m.key, + changes: m.changes + })) + await api.updateTodos(updates) +} +``` + +```ts +// Update handler with optimistic rollback +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.updateTodo(mutation.original.id, mutation.changes) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Update failed, rolling back:', error) + throw error + } +} +``` + +*** + +### schema? + +```ts +optional schema: TSchema; +``` + +Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) + +Whether to eagerly start syncing on collection creation. +When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. + +Note: Even with startSync=true, collections will pause syncing when there are no active +subscribers (typically when components querying the collection unmount), resuming when new +subscribers attach. This preserves normal staleTime/gcTime behavior. + +#### Default + +```ts +false +``` + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) + +The mode of sync to use for the collection. + +#### Default + +`eager` + +#### Description + +- `eager`: syncs all data immediately on preload +- `on-demand`: syncs data in incremental snapshots when the collection is queried +The exact implementation of the sync mode is up to the sync implementation. + +*** + +### utils? + +```ts +optional utils: TUtils; +``` + +Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) diff --git a/docs/reference/interfaces/BaseStrategy.md b/docs/reference/interfaces/BaseStrategy.md new file mode 100644 index 000000000..fdfb8354c --- /dev/null +++ b/docs/reference/interfaces/BaseStrategy.md @@ -0,0 +1,83 @@ +--- +id: BaseStrategy +title: BaseStrategy +--- + +# Interface: BaseStrategy\ + +Defined in: [packages/db/src/strategies/types.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L6) + +Base strategy interface that all strategy implementations must conform to + +## Extended by + +- [`DebounceStrategy`](../DebounceStrategy.md) +- [`QueueStrategy`](../QueueStrategy.md) +- [`ThrottleStrategy`](../ThrottleStrategy.md) + +## Type Parameters + +### TName + +`TName` *extends* `string` = `string` + +## Properties + +### \_type + +```ts +_type: TName; +``` + +Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) + +Type discriminator for strategy identification + +*** + +### cleanup() + +```ts +cleanup: () => void; +``` + +Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) + +Clean up any resources held by the strategy +Should be called when the strategy is no longer needed + +#### Returns + +`void` + +*** + +### execute() + +```ts +execute: (fn) => void | Promise; +``` + +Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) + +Execute a function according to the strategy's timing rules + +#### Type Parameters + +##### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +#### Parameters + +##### fn + +() => [`Transaction`](../Transaction.md)\<`T`\> + +The function to execute + +#### Returns + +`void` \| `Promise`\<`void`\> + +The result of the function execution (if applicable) diff --git a/docs/reference/interfaces/ChangeMessage.md b/docs/reference/interfaces/ChangeMessage.md new file mode 100644 index 000000000..81c59300d --- /dev/null +++ b/docs/reference/interfaces/ChangeMessage.md @@ -0,0 +1,72 @@ +--- +id: ChangeMessage +title: ChangeMessage +--- + +# Interface: ChangeMessage\ + +Defined in: [packages/db/src/types.ts:261](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L261) + +## Extended by + +- [`OptimisticChangeMessage`](../OptimisticChangeMessage.md) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Properties + +### key + +```ts +key: TKey; +``` + +Defined in: [packages/db/src/types.ts:265](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L265) + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:269](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L269) + +*** + +### previousValue? + +```ts +optional previousValue: T; +``` + +Defined in: [packages/db/src/types.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L267) + +*** + +### type + +```ts +type: OperationType; +``` + +Defined in: [packages/db/src/types.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L268) + +*** + +### value + +```ts +value: T; +``` + +Defined in: [packages/db/src/types.ts:266](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L266) diff --git a/docs/reference/interfaces/Collection.md b/docs/reference/interfaces/Collection.md new file mode 100644 index 000000000..c2badec06 --- /dev/null +++ b/docs/reference/interfaces/Collection.md @@ -0,0 +1,1584 @@ +--- +id: Collection +title: Collection +--- + +# Interface: Collection\ + +Defined in: [packages/db/src/collection/index.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L47) + +Enhanced Collection interface that includes both data type T and utilities TUtils + +## Extends + +- [`CollectionImpl`](../../classes/CollectionImpl.md)\<`T`, `TKey`, `TUtils`, `TSchema`, `TInsertInput`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +The type of items in the collection + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key for the collection + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +The utilities record type + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `StandardSchemaV1` + +### TInsertInput + +`TInsertInput` *extends* `object` = `T` + +The type for insert operations (can be different from T for schemas with defaults) + +## Properties + +### \_lifecycle + +```ts +_lifecycle: CollectionLifecycleManager; +``` + +Defined in: [packages/db/src/collection/index.ts:219](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L219) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`_lifecycle`](../../classes/CollectionImpl.md#_lifecycle) + +*** + +### \_state + +```ts +_state: CollectionStateManager; +``` + +Defined in: [packages/db/src/collection/index.ts:231](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L231) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`_state`](../../classes/CollectionImpl.md#_state) + +*** + +### \_sync + +```ts +_sync: CollectionSyncManager; +``` + +Defined in: [packages/db/src/collection/index.ts:220](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L220) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`_sync`](../../classes/CollectionImpl.md#_sync) + +*** + +### config + +```ts +config: CollectionConfig; +``` + +Defined in: [packages/db/src/collection/index.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L210) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`config`](../../classes/CollectionImpl.md#config) + +*** + +### id + +```ts +id: string; +``` + +Defined in: [packages/db/src/collection/index.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L209) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`id`](../../classes/CollectionImpl.md#id) + +*** + +### singleResult? + +```ts +readonly optional singleResult: true; +``` + +Defined in: [packages/db/src/collection/index.ts:55](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L55) + +*** + +### utils + +```ts +readonly utils: TUtils; +``` + +Defined in: [packages/db/src/collection/index.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L54) + +#### Overrides + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`utils`](../../classes/CollectionImpl.md#utils) + +## Accessors + +### indexes + +#### Get Signature + +```ts +get indexes(): Map>; +``` + +Defined in: [packages/db/src/collection/index.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L496) + +Get resolved indexes for query optimization + +##### Returns + +`Map`\<`number`, [`BaseIndex`](../../classes/BaseIndex.md)\<`TKey`\>\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`indexes`](../../classes/CollectionImpl.md#indexes) + +*** + +### isLoadingSubset + +#### Get Signature + +```ts +get isLoadingSubset(): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:362](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L362) + +Check if the collection is currently loading more data + +##### Returns + +`boolean` + +true if the collection has pending load more operations, false otherwise + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`isLoadingSubset`](../../classes/CollectionImpl.md#isloadingsubset) + +*** + +### size + +#### Get Signature + +```ts +get size(): number; +``` + +Defined in: [packages/db/src/collection/index.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L399) + +Get the current size of the collection (cached) + +##### Returns + +`number` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`size`](../../classes/CollectionImpl.md#size) + +*** + +### state + +#### Get Signature + +```ts +get state(): Map; +``` + +Defined in: [packages/db/src/collection/index.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L683) + +Gets the current state of the collection as a Map + +##### Example + +```ts +const itemsMap = collection.state +console.log(`Collection has ${itemsMap.size} items`) + +for (const [key, item] of itemsMap) { + console.log(`${key}: ${item.title}`) +} + +// Check if specific item exists +if (itemsMap.has("todo-1")) { + console.log("Todo 1 exists:", itemsMap.get("todo-1")) +} +``` + +##### Returns + +`Map`\<`TKey`, `TOutput`\> + +Map containing all items in the collection, with keys as identifiers + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`state`](../../classes/CollectionImpl.md#state) + +*** + +### status + +#### Get Signature + +```ts +get status(): CollectionStatus; +``` + +Defined in: [packages/db/src/collection/index.ts:317](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L317) + +Gets the current status of the collection + +##### Returns + +[`CollectionStatus`](../../type-aliases/CollectionStatus.md) + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`status`](../../classes/CollectionImpl.md#status) + +*** + +### subscriberCount + +#### Get Signature + +```ts +get subscriberCount(): number; +``` + +Defined in: [packages/db/src/collection/index.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L324) + +Get the number of subscribers to the collection + +##### Returns + +`number` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`subscriberCount`](../../classes/CollectionImpl.md#subscribercount) + +*** + +### toArray + +#### Get Signature + +```ts +get toArray(): TOutput[]; +``` + +Defined in: [packages/db/src/collection/index.ts:712](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L712) + +Gets the current state of the collection as an Array + +##### Returns + +`TOutput`[] + +An Array containing all items in the collection + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`toArray`](../../classes/CollectionImpl.md#toarray) + +## Methods + +### \[iterator\]() + +```ts +iterator: IterableIterator<[TKey, T]>; +``` + +Defined in: [packages/db/src/collection/index.ts:427](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L427) + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `T`\]\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`[iterator]`](../../classes/CollectionImpl.md#iterator) + +*** + +### cleanup() + +```ts +cleanup(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:846](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L846) + +Clean up the collection by stopping sync and clearing data +This can be called manually or automatically by garbage collection + +#### Returns + +`Promise`\<`void`\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`cleanup`](../../classes/CollectionImpl.md#cleanup) + +*** + +### createIndex() + +```ts +createIndex(indexCallback, config): IndexProxy; +``` + +Defined in: [packages/db/src/collection/index.ts:486](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L486) + +Creates an index on a collection for faster queries. +Indexes significantly improve query performance by allowing constant time lookups +and logarithmic time range queries instead of full scans. + +#### Type Parameters + +##### TResolver + +`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md)\<`TKey`\> = *typeof* [`BTreeIndex`](../../classes/BTreeIndex.md) + +The type of the index resolver (constructor or async loader) + +#### Parameters + +##### indexCallback + +(`row`) => `any` + +Function that extracts the indexed value from each item + +##### config + +[`IndexOptions`](../IndexOptions.md)\<`TResolver`\> = `{}` + +Configuration including index type and type-specific options + +#### Returns + +[`IndexProxy`](../../classes/IndexProxy.md)\<`TKey`\> + +An index proxy that provides access to the index when ready + +#### Example + +```ts +// Create a default B+ tree index +const ageIndex = collection.createIndex((row) => row.age) + +// Create a ordered index with custom options +const ageIndex = collection.createIndex((row) => row.age, { + indexType: BTreeIndex, + options: { + compareFn: customComparator, + compareOptions: { direction: 'asc', nulls: 'first', stringSort: 'lexical' } + }, + name: 'age_btree' +}) + +// Create an async-loaded index +const textIndex = collection.createIndex((row) => row.content, { + indexType: async () => { + const { FullTextIndex } = await import('./indexes/fulltext.js') + return FullTextIndex + }, + options: { language: 'en' } +}) +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`createIndex`](../../classes/CollectionImpl.md#createindex) + +*** + +### currentStateAsChanges() + +```ts +currentStateAsChanges(options): + | void + | ChangeMessage[]; +``` + +Defined in: [packages/db/src/collection/index.ts:750](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L750) + +Returns the current state of the collection as an array of changes + +#### Parameters + +##### options + +[`CurrentStateAsChangesOptions`](../CurrentStateAsChangesOptions.md) = `{}` + +Options including optional where filter + +#### Returns + + \| `void` + \| [`ChangeMessage`](../ChangeMessage.md)\<`T`, `string` \| `number`\>[] + +An array of changes + +#### Example + +```ts +// Get all items as changes +const allChanges = collection.currentStateAsChanges() + +// Get only items matching a condition +const activeChanges = collection.currentStateAsChanges({ + where: (row) => row.status === 'active' +}) + +// Get only items using a pre-compiled expression +const activeChanges = collection.currentStateAsChanges({ + whereExpression: eq(row.status, 'active') +}) +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`currentStateAsChanges`](../../classes/CollectionImpl.md#currentstateaschanges) + +*** + +### delete() + +```ts +delete(keys, config?): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:660](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L660) + +Deletes one or more items from the collection + +#### Parameters + +##### keys + +Single key or array of keys to delete + +`TKey` | `TKey`[] + +##### config? + +[`OperationConfig`](../OperationConfig.md) + +Optional configuration including metadata + +#### Returns + +[`Transaction`](../Transaction.md)\<`any`\> + +A Transaction object representing the delete operation(s) + +#### Examples + +```ts +// Delete a single item +const tx = collection.delete("todo-1") +await tx.isPersisted.promise +``` + +```ts +// Delete multiple items +const tx = collection.delete(["todo-1", "todo-2"]) +await tx.isPersisted.promise +``` + +```ts +// Delete with metadata +const tx = collection.delete("todo-1", { metadata: { reason: "completed" } }) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.delete("item-1") + await tx.isPersisted.promise + console.log('Delete successful') +} catch (error) { + console.log('Delete failed:', error) +} +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`delete`](../../classes/CollectionImpl.md#delete) + +*** + +### entries() + +```ts +entries(): IterableIterator<[TKey, T]>; +``` + +Defined in: [packages/db/src/collection/index.ts:420](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L420) + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `T`\]\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`entries`](../../classes/CollectionImpl.md#entries) + +*** + +### forEach() + +```ts +forEach(callbackfn): void; +``` + +Defined in: [packages/db/src/collection/index.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L434) + +Execute a callback for each entry in the collection + +#### Parameters + +##### callbackfn + +(`value`, `key`, `index`) => `void` + +#### Returns + +`void` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`forEach`](../../classes/CollectionImpl.md#foreach) + +*** + +### get() + +```ts +get(key): T | undefined; +``` + +Defined in: [packages/db/src/collection/index.ts:385](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L385) + +Get the current value for a key (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`T` \| `undefined` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`get`](../../classes/CollectionImpl.md#get) + +*** + +### getKeyFromItem() + +```ts +getKeyFromItem(item): TKey; +``` + +Defined in: [packages/db/src/collection/index.ts:449](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L449) + +#### Parameters + +##### item + +`T` + +#### Returns + +`TKey` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`getKeyFromItem`](../../classes/CollectionImpl.md#getkeyfromitem) + +*** + +### has() + +```ts +has(key): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:392](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L392) + +Check if a key exists in the collection (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`boolean` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`has`](../../classes/CollectionImpl.md#has) + +*** + +### insert() + +```ts +insert(data, config?): + | Transaction> +| Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:547](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L547) + +Inserts one or more items into the collection + +#### Parameters + +##### data + +`TInsertInput` | `TInsertInput`[] + +##### config? + +[`InsertConfig`](../InsertConfig.md) + +Optional configuration including metadata + +#### Returns + + \| [`Transaction`](../Transaction.md)\<`Record`\<`string`, `unknown`\>\> + \| [`Transaction`](../Transaction.md)\<`T`\> + +A Transaction object representing the insert operation(s) + +#### Throws + +If the data fails schema validation + +#### Examples + +```ts +// Insert a single todo (requires onInsert handler) +const tx = collection.insert({ id: "1", text: "Buy milk", completed: false }) +await tx.isPersisted.promise +``` + +```ts +// Insert multiple todos at once +const tx = collection.insert([ + { id: "1", text: "Buy milk", completed: false }, + { id: "2", text: "Walk dog", completed: true } +]) +await tx.isPersisted.promise +``` + +```ts +// Insert with metadata +const tx = collection.insert({ id: "1", text: "Buy groceries" }, + { metadata: { source: "mobile-app" } } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.insert({ id: "1", text: "New item" }) + await tx.isPersisted.promise + console.log('Insert successful') +} catch (error) { + console.log('Insert failed:', error) +} +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`insert`](../../classes/CollectionImpl.md#insert) + +*** + +### isReady() + +```ts +isReady(): boolean; +``` + +Defined in: [packages/db/src/collection/index.ts:354](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L354) + +Check if the collection is ready for use +Returns true if the collection has been marked as ready by its sync implementation + +#### Returns + +`boolean` + +true if the collection is ready, false otherwise + +#### Example + +```ts +if (collection.isReady()) { + console.log('Collection is ready, data is available') + // Safe to access collection.state +} else { + console.log('Collection is still loading') +} +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`isReady`](../../classes/CollectionImpl.md#isready) + +*** + +### keys() + +```ts +keys(): IterableIterator; +``` + +Defined in: [packages/db/src/collection/index.ts:406](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L406) + +Get all keys (virtual derived state) + +#### Returns + +`IterableIterator`\<`TKey`\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`keys`](../../classes/CollectionImpl.md#keys) + +*** + +### map() + +```ts +map(callbackfn): U[]; +``` + +Defined in: [packages/db/src/collection/index.ts:443](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L443) + +Create a new array with the results of calling a function for each entry in the collection + +#### Type Parameters + +##### U + +`U` + +#### Parameters + +##### callbackfn + +(`value`, `key`, `index`) => `U` + +#### Returns + +`U`[] + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`map`](../../classes/CollectionImpl.md#map) + +*** + +### off() + +```ts +off(event, callback): void; +``` + +Defined in: [packages/db/src/collection/index.ts:825](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L825) + +Unsubscribe from a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +`void` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`off`](../../classes/CollectionImpl.md#off) + +*** + +### on() + +```ts +on(event, callback): () => void; +``` + +Defined in: [packages/db/src/collection/index.ts:805](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L805) + +Subscribe to a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +```ts +(): void; +``` + +##### Returns + +`void` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`on`](../../classes/CollectionImpl.md#on) + +*** + +### once() + +```ts +once(event, callback): () => void; +``` + +Defined in: [packages/db/src/collection/index.ts:815](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L815) + +Subscribe to a collection event once + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +```ts +(): void; +``` + +##### Returns + +`void` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`once`](../../classes/CollectionImpl.md#once) + +*** + +### onFirstReady() + +```ts +onFirstReady(callback): void; +``` + +Defined in: [packages/db/src/collection/index.ts:338](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L338) + +Register a callback to be executed when the collection first becomes ready +Useful for preloading collections + +#### Parameters + +##### callback + +() => `void` + +Function to call when the collection first becomes ready + +#### Returns + +`void` + +#### Example + +```ts +collection.onFirstReady(() => { + console.log('Collection is ready for the first time') + // Safe to access collection.state now +}) +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`onFirstReady`](../../classes/CollectionImpl.md#onfirstready) + +*** + +### preload() + +```ts +preload(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:378](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L378) + +Preload the collection data by starting sync if not already started +Multiple concurrent calls will share the same promise + +#### Returns + +`Promise`\<`void`\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`preload`](../../classes/CollectionImpl.md#preload) + +*** + +### startSyncImmediate() + +```ts +startSyncImmediate(): void; +``` + +Defined in: [packages/db/src/collection/index.ts:370](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L370) + +Start sync immediately - internal method for compiled queries +This bypasses lazy loading for special cases like live query results + +#### Returns + +`void` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`startSyncImmediate`](../../classes/CollectionImpl.md#startsyncimmediate) + +*** + +### stateWhenReady() + +```ts +stateWhenReady(): Promise>; +``` + +Defined in: [packages/db/src/collection/index.ts:697](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L697) + +Gets the current state of the collection as a Map, but only resolves when data is available +Waits for the first sync commit to complete before resolving + +#### Returns + +`Promise`\<`Map`\<`TKey`, `T`\>\> + +Promise that resolves to a Map containing all items in the collection + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`stateWhenReady`](../../classes/CollectionImpl.md#statewhenready) + +*** + +### subscribeChanges() + +```ts +subscribeChanges(callback, options): CollectionSubscription; +``` + +Defined in: [packages/db/src/collection/index.ts:795](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L795) + +Subscribe to changes in the collection + +#### Parameters + +##### callback + +(`changes`) => `void` + +Function called when items change + +##### options + +[`SubscribeChangesOptions`](../SubscribeChangesOptions.md) = `{}` + +Subscription options including includeInitialState and where filter + +#### Returns + +`CollectionSubscription` + +Unsubscribe function - Call this to stop listening for changes + +#### Examples + +```ts +// Basic subscription +const subscription = collection.subscribeChanges((changes) => { + changes.forEach(change => { + console.log(`${change.type}: ${change.key}`, change.value) + }) +}) + +// Later: subscription.unsubscribe() +``` + +```ts +// Include current state immediately +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { includeInitialState: true }) +``` + +```ts +// Subscribe only to changes matching a condition +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + where: (row) => row.status === 'active' +}) +``` + +```ts +// Subscribe using a pre-compiled expression +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + whereExpression: eq(row.status, 'active') +}) +``` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`subscribeChanges`](../../classes/CollectionImpl.md#subscribechanges) + +*** + +### toArrayWhenReady() + +```ts +toArrayWhenReady(): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:722](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L722) + +Gets the current state of the collection as an Array, but only resolves when data is available +Waits for the first sync commit to complete before resolving + +#### Returns + +`Promise`\<`T`[]\> + +Promise that resolves to an Array containing all items in the collection + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`toArrayWhenReady`](../../classes/CollectionImpl.md#toarraywhenready) + +*** + +### update() + +#### Call Signature + +```ts +update(key, callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:592](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L592) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### key + +`unknown`[] + +###### callback + +(`drafts`) => `void` + +##### Returns + +[`Transaction`](../Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +##### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) + +#### Call Signature + +```ts +update( + keys, + config, + callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L598) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### keys + +`unknown`[] + +Single key or array of keys to update + +###### config + +[`OperationConfig`](../OperationConfig.md) + +###### callback + +(`drafts`) => `void` + +##### Returns + +[`Transaction`](../Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +##### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) + +#### Call Signature + +```ts +update(id, callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L605) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### id + +`unknown` + +###### callback + +(`draft`) => `void` + +##### Returns + +[`Transaction`](../Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +##### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) + +#### Call Signature + +```ts +update( + id, + config, + callback): Transaction; +``` + +Defined in: [packages/db/src/collection/index.ts:611](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L611) + +Updates one or more items in the collection using a callback function + +##### Parameters + +###### id + +`unknown` + +###### config + +[`OperationConfig`](../OperationConfig.md) + +###### callback + +(`draft`) => `void` + +##### Returns + +[`Transaction`](../Transaction.md) + +A Transaction object representing the update operation(s) + +##### Throws + +If the updated data fails schema validation + +##### Examples + +```ts +// Update single item by key +const tx = collection.update("todo-1", (draft) => { + draft.completed = true +}) +await tx.isPersisted.promise +``` + +```ts +// Update multiple items +const tx = collection.update(["todo-1", "todo-2"], (drafts) => { + drafts.forEach(draft => { draft.completed = true }) +}) +await tx.isPersisted.promise +``` + +```ts +// Update with metadata +const tx = collection.update("todo-1", + { metadata: { reason: "user update" } }, + (draft) => { draft.text = "Updated text" } +) +await tx.isPersisted.promise +``` + +```ts +// Handle errors +try { + const tx = collection.update("item-1", draft => { draft.value = "new" }) + await tx.isPersisted.promise + console.log('Update successful') +} catch (error) { + console.log('Update failed:', error) +} +``` + +##### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`update`](../../classes/CollectionImpl.md#update) + +*** + +### validateData() + +```ts +validateData( + data, + type, + key?): T; +``` + +Defined in: [packages/db/src/collection/index.ts:503](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L503) + +Validates the data against the schema + +#### Parameters + +##### data + +`unknown` + +##### type + +`"insert"` | `"update"` + +##### key? + +`TKey` + +#### Returns + +`T` + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`validateData`](../../classes/CollectionImpl.md#validatedata) + +*** + +### values() + +```ts +values(): IterableIterator; +``` + +Defined in: [packages/db/src/collection/index.ts:413](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L413) + +Get all values (virtual derived state) + +#### Returns + +`IterableIterator`\<`T`\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`values`](../../classes/CollectionImpl.md#values) + +*** + +### waitFor() + +```ts +waitFor(event, timeout?): Promise; +``` + +Defined in: [packages/db/src/collection/index.ts:835](https://github.com/TanStack/db/blob/main/packages/db/src/collection/index.ts#L835) + +Wait for a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:error"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + +#### Parameters + +##### event + +`T` + +##### timeout? + +`number` + +#### Returns + +`Promise`\<`AllCollectionEvents`\[`T`\]\> + +#### Inherited from + +[`CollectionImpl`](../../classes/CollectionImpl.md).[`waitFor`](../../classes/CollectionImpl.md#waitfor) diff --git a/docs/reference/interfaces/CollectionConfig.md b/docs/reference/interfaces/CollectionConfig.md new file mode 100644 index 000000000..78702c4d3 --- /dev/null +++ b/docs/reference/interfaces/CollectionConfig.md @@ -0,0 +1,465 @@ +--- +id: CollectionConfig +title: CollectionConfig +--- + +# Interface: CollectionConfig\ + +Defined in: [packages/db/src/types.ts:588](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L588) + +## Extends + +- [`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`, `TUtils`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../../type-aliases/UtilsRecord.md) = [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +## Properties + +### autoIndex? + +```ts +optional autoIndex: "eager" | "off"; +``` + +Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) + +Auto-indexing mode for the collection. +When enabled, indexes will be automatically created for simple where expressions. + +#### Default + +```ts +"eager" +``` + +#### Description + +- "off": No automatic indexing +- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) + +*** + +### compare()? + +```ts +optional compare: (x, y) => number; +``` + +Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) + +Optional function to compare two items. +This is used to order the items in the collection. + +#### Parameters + +##### x + +`T` + +The first item to compare + +##### y + +`T` + +The second item to compare + +#### Returns + +`number` + +A number indicating the order of the items + +#### Example + +```ts +// For a collection with a 'createdAt' field +compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`compare`](../BaseCollectionConfig.md#compare) + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) + +Time in milliseconds after which the collection will be garbage collected +when it has no active subscribers. Defaults to 5 minutes (300000ms). + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`gcTime`](../BaseCollectionConfig.md#gctime) + +*** + +### getKey() + +```ts +getKey: (item) => TKey; +``` + +Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) + +Function to extract the ID from an object +This is required for update/delete operations which now only accept IDs + +#### Parameters + +##### item + +`T` + +The item to extract the ID from + +#### Returns + +`TKey` + +The ID string for the item + +#### Example + +```ts +// For a collection with a 'uuid' field as the primary key +getKey: (item) => item.uuid +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`getKey`](../BaseCollectionConfig.md#getkey) + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) + +Optional asynchronous handler function called before a delete operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic delete handler +onDelete: async ({ transaction, collection }) => { + const deletedKey = transaction.mutations[0].key + await api.deleteTodo(deletedKey) +} +``` + +```ts +// Delete handler with multiple items +onDelete: async ({ transaction, collection }) => { + const keysToDelete = transaction.mutations.map(m => m.key) + await api.deleteTodos(keysToDelete) +} +``` + +```ts +// Delete handler with confirmation +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const shouldDelete = await confirmDeletion(mutation.original) + if (!shouldDelete) { + throw new Error('Delete cancelled by user') + } + await api.deleteTodo(mutation.original.id) +} +``` + +```ts +// Delete handler with optimistic rollback +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.deleteTodo(mutation.original.id) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Delete failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onDelete`](../BaseCollectionConfig.md#ondelete) + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) + +Optional asynchronous handler function called before an insert operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic insert handler +onInsert: async ({ transaction, collection }) => { + const newItem = transaction.mutations[0].modified + await api.createTodo(newItem) +} +``` + +```ts +// Insert handler with multiple items +onInsert: async ({ transaction, collection }) => { + const items = transaction.mutations.map(m => m.modified) + await api.createTodos(items) +} +``` + +```ts +// Insert handler with error handling +onInsert: async ({ transaction, collection }) => { + try { + const newItem = transaction.mutations[0].modified + const result = await api.createTodo(newItem) + return result + } catch (error) { + console.error('Insert failed:', error) + throw error // This will cause the transaction to fail + } +} +``` + +```ts +// Insert handler with metadata +onInsert: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + await api.createTodo(mutation.modified, { + source: mutation.metadata?.source, + timestamp: mutation.createdAt + }) +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onInsert`](../BaseCollectionConfig.md#oninsert) + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) + +Optional asynchronous handler function called before an update operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic update handler +onUpdate: async ({ transaction, collection }) => { + const updatedItem = transaction.mutations[0].modified + await api.updateTodo(updatedItem.id, updatedItem) +} +``` + +```ts +// Update handler with partial updates +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const changes = mutation.changes // Only the changed fields + await api.updateTodo(mutation.original.id, changes) +} +``` + +```ts +// Update handler with multiple items +onUpdate: async ({ transaction, collection }) => { + const updates = transaction.mutations.map(m => ({ + id: m.key, + changes: m.changes + })) + await api.updateTodos(updates) +} +``` + +```ts +// Update handler with optimistic rollback +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.updateTodo(mutation.original.id, mutation.changes) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Update failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onUpdate`](../BaseCollectionConfig.md#onupdate) + +*** + +### schema? + +```ts +optional schema: TSchema; +``` + +Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`schema`](../BaseCollectionConfig.md#schema) + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) + +Whether to eagerly start syncing on collection creation. +When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. + +Note: Even with startSync=true, collections will pause syncing when there are no active +subscribers (typically when components querying the collection unmount), resuming when new +subscribers attach. This preserves normal staleTime/gcTime behavior. + +#### Default + +```ts +false +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`startSync`](../BaseCollectionConfig.md#startsync) + +*** + +### sync + +```ts +sync: SyncConfig; +``` + +Defined in: [packages/db/src/types.ts:594](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L594) + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) + +The mode of sync to use for the collection. + +#### Default + +`eager` + +#### Description + +- `eager`: syncs all data immediately on preload +- `on-demand`: syncs data in incremental snapshots when the collection is queried +The exact implementation of the sync mode is up to the sync implementation. + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) + +*** + +### utils? + +```ts +optional utils: TUtils; +``` + +Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`utils`](../BaseCollectionConfig.md#utils) diff --git a/docs/reference/interfaces/Context.md b/docs/reference/interfaces/Context.md new file mode 100644 index 000000000..246dca186 --- /dev/null +++ b/docs/reference/interfaces/Context.md @@ -0,0 +1,99 @@ +--- +id: Context +title: Context +--- + +# Interface: Context + +Defined in: [packages/db/src/query/builder/types.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L35) + +Context - The central state container for query builder operations + +This interface tracks all the information needed to build and type-check queries: + +**Schema Management**: +- `baseSchema`: The original tables/collections from the `from()` clause +- `schema`: Current available tables (expands with joins, contracts with subqueries) + +**Query State**: +- `fromSourceName`: Which table was used in `from()` - needed for optionality logic +- `hasJoins`: Whether any joins have been added (affects result type inference) +- `joinTypes`: Maps table aliases to their join types for optionality calculations + +**Result Tracking**: +- `result`: The final shape after `select()` - undefined until select is called + +The context evolves through the query builder chain: +1. `from()` sets baseSchema and schema to the same thing +2. `join()` expands schema and sets hasJoins/joinTypes +3. `select()` sets result to the projected shape + +## Properties + +### baseSchema + +```ts +baseSchema: ContextSchema; +``` + +Defined in: [packages/db/src/query/builder/types.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L37) + +*** + +### fromSourceName + +```ts +fromSourceName: string; +``` + +Defined in: [packages/db/src/query/builder/types.ts:41](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L41) + +*** + +### hasJoins? + +```ts +optional hasJoins: boolean; +``` + +Defined in: [packages/db/src/query/builder/types.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L43) + +*** + +### joinTypes? + +```ts +optional joinTypes: Record; +``` + +Defined in: [packages/db/src/query/builder/types.ts:45](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L45) + +*** + +### result? + +```ts +optional result: any; +``` + +Defined in: [packages/db/src/query/builder/types.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L50) + +*** + +### schema + +```ts +schema: ContextSchema; +``` + +Defined in: [packages/db/src/query/builder/types.ts:39](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L39) + +*** + +### singleResult? + +```ts +optional singleResult: boolean; +``` + +Defined in: [packages/db/src/query/builder/types.ts:52](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L52) diff --git a/docs/reference/interfaces/CreateOptimisticActionsOptions.md b/docs/reference/interfaces/CreateOptimisticActionsOptions.md new file mode 100644 index 000000000..48ae64848 --- /dev/null +++ b/docs/reference/interfaces/CreateOptimisticActionsOptions.md @@ -0,0 +1,122 @@ +--- +id: CreateOptimisticActionsOptions +title: CreateOptimisticActionsOptions +--- + +# Interface: CreateOptimisticActionsOptions\ + +Defined in: [packages/db/src/types.ts:128](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L128) + +Options for the createOptimisticAction helper + +## Extends + +- `Omit`\<[`TransactionConfig`](../TransactionConfig.md)\<`T`\>, `"mutationFn"`\> + +## Type Parameters + +### TVars + +`TVars` = `unknown` + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### autoCommit? + +```ts +optional autoCommit: boolean; +``` + +Defined in: [packages/db/src/types.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L119) + +#### Inherited from + +[`TransactionConfig`](../TransactionConfig.md).[`autoCommit`](../TransactionConfig.md#autocommit) + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:117](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L117) + +Unique identifier for the transaction + +#### Inherited from + +```ts +Omit.id +``` + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L122) + +Custom metadata to associate with the transaction + +#### Inherited from + +```ts +Omit.metadata +``` + +*** + +### mutationFn() + +```ts +mutationFn: (vars, params) => Promise; +``` + +Defined in: [packages/db/src/types.ts:135](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L135) + +Function to execute the mutation on the server + +#### Parameters + +##### vars + +`TVars` + +##### params + +[`MutationFnParams`](../../type-aliases/MutationFnParams.md)\<`T`\> + +#### Returns + +`Promise`\<`any`\> + +*** + +### onMutate() + +```ts +onMutate: (vars) => void; +``` + +Defined in: [packages/db/src/types.ts:133](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L133) + +Function to apply optimistic updates locally before the mutation completes + +#### Parameters + +##### vars + +`TVars` + +#### Returns + +`void` diff --git a/docs/reference/interfaces/CurrentStateAsChangesOptions.md b/docs/reference/interfaces/CurrentStateAsChangesOptions.md new file mode 100644 index 000000000..d54d5107b --- /dev/null +++ b/docs/reference/interfaces/CurrentStateAsChangesOptions.md @@ -0,0 +1,52 @@ +--- +id: CurrentStateAsChangesOptions +title: CurrentStateAsChangesOptions +--- + +# Interface: CurrentStateAsChangesOptions + +Defined in: [packages/db/src/types.ts:678](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L678) + +Options for getting current state as changes + +## Properties + +### limit? + +```ts +optional limit: number; +``` + +Defined in: [packages/db/src/types.ts:682](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L682) + +*** + +### optimizedOnly? + +```ts +optional optimizedOnly: boolean; +``` + +Defined in: [packages/db/src/types.ts:683](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L683) + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: [packages/db/src/types.ts:681](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L681) + +*** + +### where? + +```ts +optional where: BasicExpression; +``` + +Defined in: [packages/db/src/types.ts:680](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L680) + +Pre-compiled expression for filtering the current state diff --git a/docs/reference/interfaces/DebounceStrategy.md b/docs/reference/interfaces/DebounceStrategy.md new file mode 100644 index 000000000..f0418edc7 --- /dev/null +++ b/docs/reference/interfaces/DebounceStrategy.md @@ -0,0 +1,97 @@ +--- +id: DebounceStrategy +title: DebounceStrategy +--- + +# Interface: DebounceStrategy + +Defined in: [packages/db/src/strategies/types.ts:42](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L42) + +Debounce strategy that delays execution until activity stops + +## Extends + +- [`BaseStrategy`](../BaseStrategy.md)\<`"debounce"`\> + +## Properties + +### \_type + +```ts +_type: "debounce"; +``` + +Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) + +Type discriminator for strategy identification + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) + +*** + +### cleanup() + +```ts +cleanup: () => void; +``` + +Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) + +Clean up any resources held by the strategy +Should be called when the strategy is no longer needed + +#### Returns + +`void` + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) + +*** + +### execute() + +```ts +execute: (fn) => void | Promise; +``` + +Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) + +Execute a function according to the strategy's timing rules + +#### Type Parameters + +##### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +#### Parameters + +##### fn + +() => [`Transaction`](../Transaction.md)\<`T`\> + +The function to execute + +#### Returns + +`void` \| `Promise`\<`void`\> + +The result of the function execution (if applicable) + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) + +*** + +### options + +```ts +options: DebounceStrategyOptions; +``` + +Defined in: [packages/db/src/strategies/types.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L43) diff --git a/docs/reference/interfaces/DebounceStrategyOptions.md b/docs/reference/interfaces/DebounceStrategyOptions.md new file mode 100644 index 000000000..99e5fe458 --- /dev/null +++ b/docs/reference/interfaces/DebounceStrategyOptions.md @@ -0,0 +1,47 @@ +--- +id: DebounceStrategyOptions +title: DebounceStrategyOptions +--- + +# Interface: DebounceStrategyOptions + +Defined in: [packages/db/src/strategies/types.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L30) + +Options for debounce strategy +Delays execution until after a period of inactivity + +## Properties + +### leading? + +```ts +optional leading: boolean; +``` + +Defined in: [packages/db/src/strategies/types.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L34) + +Execute immediately on the first call + +*** + +### trailing? + +```ts +optional trailing: boolean; +``` + +Defined in: [packages/db/src/strategies/types.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L36) + +Execute after the wait period on the last call + +*** + +### wait + +```ts +wait: number; +``` + +Defined in: [packages/db/src/strategies/types.ts:32](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L32) + +Wait time in milliseconds before execution diff --git a/docs/reference/interfaces/IndexInterface.md b/docs/reference/interfaces/IndexInterface.md new file mode 100644 index 000000000..ebb33b416 --- /dev/null +++ b/docs/reference/interfaces/IndexInterface.md @@ -0,0 +1,458 @@ +--- +id: IndexInterface +title: IndexInterface +--- + +# Interface: IndexInterface\ + +Defined in: [packages/db/src/indexes/base-index.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L28) + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Properties + +### add() + +```ts +add: (key, item) => void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:31](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L31) + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +*** + +### build() + +```ts +build: (entries) => void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L35) + +#### Parameters + +##### entries + +`Iterable`\<\[`TKey`, `any`\]\> + +#### Returns + +`void` + +*** + +### clear() + +```ts +clear: () => void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L36) + +#### Returns + +`void` + +*** + +### equalityLookup() + +```ts +equalityLookup: (value) => Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L40) + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### getStats() + +```ts +getStats: () => IndexStats; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L70) + +#### Returns + +[`IndexStats`](../IndexStats.md) + +*** + +### inArrayLookup() + +```ts +inArrayLookup: (values) => Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:41](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L41) + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +*** + +### lookup() + +```ts +lookup: (operation, value) => Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:38](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L38) + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### matchesCompareOptions() + +```ts +matchesCompareOptions: (compareOptions) => boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L67) + +#### Parameters + +##### compareOptions + +`CompareOptions` + +#### Returns + +`boolean` + +*** + +### matchesDirection() + +```ts +matchesDirection: (direction) => boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:68](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L68) + +#### Parameters + +##### direction + +[`OrderByDirection`](../../@tanstack/namespaces/IR/type-aliases/OrderByDirection.md) + +#### Returns + +`boolean` + +*** + +### matchesField() + +```ts +matchesField: (fieldPath) => boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L66) + +#### Parameters + +##### fieldPath + +`string`[] + +#### Returns + +`boolean` + +*** + +### rangeQuery() + +```ts +rangeQuery: (options) => Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:43](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L43) + +#### Parameters + +##### options + +[`RangeQueryOptions`](../RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +*** + +### rangeQueryReversed() + +```ts +rangeQueryReversed: (options) => Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:44](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L44) + +#### Parameters + +##### options + +[`RangeQueryOptions`](../RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +*** + +### remove() + +```ts +remove: (key, item) => void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:32](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L32) + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +*** + +### supports() + +```ts +supports: (operation) => boolean; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:64](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L64) + +#### Parameters + +##### operation + +`"eq"` | `"gt"` | `"gte"` | `"lt"` | `"lte"` | `"in"` | `"like"` | `"ilike"` + +#### Returns + +`boolean` + +*** + +### take() + +```ts +take: (n, from?, filterFn?) => TKey[]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:46](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L46) + +#### Parameters + +##### n + +`number` + +##### from? + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### takeReversed() + +```ts +takeReversed: (n, from?, filterFn?) => TKey[]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:51](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L51) + +#### Parameters + +##### n + +`number` + +##### from? + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### update() + +```ts +update: (key, oldItem, newItem) => void; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L33) + +#### Parameters + +##### key + +`TKey` + +##### oldItem + +`any` + +##### newItem + +`any` + +#### Returns + +`void` + +## Accessors + +### indexedKeysSet + +#### Get Signature + +```ts +get indexedKeysSet(): Set; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:61](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L61) + +##### Returns + +`Set`\<`TKey`\> + +*** + +### keyCount + +#### Get Signature + +```ts +get keyCount(): number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L57) + +##### Returns + +`number` + +*** + +### orderedEntriesArray + +#### Get Signature + +```ts +get orderedEntriesArray(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L58) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### orderedEntriesArrayReversed + +#### Get Signature + +```ts +get orderedEntriesArrayReversed(): [any, Set][]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:59](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L59) + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### valueMapData + +#### Get Signature + +```ts +get valueMapData(): Map>; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L62) + +##### Returns + +`Map`\<`any`, `Set`\<`TKey`\>\> diff --git a/docs/reference/interfaces/IndexOptions.md b/docs/reference/interfaces/IndexOptions.md new file mode 100644 index 000000000..8a99a578a --- /dev/null +++ b/docs/reference/interfaces/IndexOptions.md @@ -0,0 +1,46 @@ +--- +id: IndexOptions +title: IndexOptions +--- + +# Interface: IndexOptions\ + +Defined in: [packages/db/src/indexes/index-options.ts:6](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L6) + +Enhanced index options that support both sync and async resolvers + +## Type Parameters + +### TResolver + +`TResolver` *extends* [`IndexResolver`](../../type-aliases/IndexResolver.md) = [`IndexResolver`](../../type-aliases/IndexResolver.md) + +## Properties + +### indexType? + +```ts +optional indexType: TResolver; +``` + +Defined in: [packages/db/src/indexes/index-options.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L8) + +*** + +### name? + +```ts +optional name: string; +``` + +Defined in: [packages/db/src/indexes/index-options.ts:7](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L7) + +*** + +### options? + +```ts +optional options: TResolver extends IndexConstructor ? TResolver extends (id, expr, name?, options?) => any ? O : never : TResolver extends () => Promise ? TCtor extends (id, expr, name?, options?) => any ? O : never : never; +``` + +Defined in: [packages/db/src/indexes/index-options.ts:9](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/index-options.ts#L9) diff --git a/docs/reference/interfaces/IndexStats.md b/docs/reference/interfaces/IndexStats.md new file mode 100644 index 000000000..ff3db9e4b --- /dev/null +++ b/docs/reference/interfaces/IndexStats.md @@ -0,0 +1,50 @@ +--- +id: IndexStats +title: IndexStats +--- + +# Interface: IndexStats + +Defined in: [packages/db/src/indexes/base-index.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L21) + +Statistics about index usage and performance + +## Properties + +### averageLookupTime + +```ts +readonly averageLookupTime: number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L24) + +*** + +### entryCount + +```ts +readonly entryCount: number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L22) + +*** + +### lastUpdated + +```ts +readonly lastUpdated: Date; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L25) + +*** + +### lookupCount + +```ts +readonly lookupCount: number; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L23) diff --git a/docs/reference/interfaces/InsertConfig.md b/docs/reference/interfaces/InsertConfig.md new file mode 100644 index 000000000..79b7fbda3 --- /dev/null +++ b/docs/reference/interfaces/InsertConfig.md @@ -0,0 +1,30 @@ +--- +id: InsertConfig +title: InsertConfig +--- + +# Interface: InsertConfig + +Defined in: [packages/db/src/types.ts:303](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L303) + +## Properties + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:304](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L304) + +*** + +### optimistic? + +```ts +optional optimistic: boolean; +``` + +Defined in: [packages/db/src/types.ts:306](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L306) + +Whether to apply optimistic updates immediately. Defaults to true. diff --git a/docs/reference/interfaces/LiveQueryCollectionConfig.md b/docs/reference/interfaces/LiveQueryCollectionConfig.md new file mode 100644 index 000000000..ce7da1c8e --- /dev/null +++ b/docs/reference/interfaces/LiveQueryCollectionConfig.md @@ -0,0 +1,172 @@ +--- +id: LiveQueryCollectionConfig +title: LiveQueryCollectionConfig +--- + +# Interface: LiveQueryCollectionConfig\ + +Defined in: [packages/db/src/query/live/types.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L49) + +Configuration interface for live query collection options + +## Example + +```typescript +const config: LiveQueryCollectionConfig = { + // id is optional - will auto-generate "live-query-1", "live-query-2", etc. + query: (q) => q + .from({ comment: commentsCollection }) + .join( + { user: usersCollection }, + ({ comment, user }) => eq(comment.user_id, user.id) + ) + .where(({ comment }) => eq(comment.active, true)) + .select(({ comment, user }) => ({ + id: comment.id, + content: comment.content, + authorName: user.name, + })), + // getKey is optional - defaults to using stream key + getKey: (item) => item.id, +} +``` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../Context.md) + +### TResult + +`TResult` *extends* `object` = [`GetResult`](../../type-aliases/GetResult.md)\<`TContext`\> & `object` + +## Properties + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: [packages/db/src/query/live/types.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L92) + +GC time for the collection + +*** + +### getKey()? + +```ts +optional getKey: (item) => string | number; +``` + +Defined in: [packages/db/src/query/live/types.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L70) + +Function to extract the key from result items +If not provided, defaults to using the key from the D2 stream + +#### Parameters + +##### item + +`TResult` + +#### Returns + +`string` \| `number` + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/query/live/types.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L57) + +Unique identifier for the collection +If not provided, defaults to `live-query-${number}` with auto-incrementing number + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: [packages/db/src/query/live/types.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L82) + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: [packages/db/src/query/live/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L80) + +Optional mutation handlers + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: [packages/db/src/query/live/types.ts:81](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L81) + +*** + +### query + +```ts +query: + | QueryBuilder +| (q) => QueryBuilder; +``` + +Defined in: [packages/db/src/query/live/types.ts:62](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L62) + +Query builder function that defines the live query + +*** + +### schema? + +```ts +optional schema: undefined; +``` + +Defined in: [packages/db/src/query/live/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L75) + +Optional schema for validation + +*** + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: [packages/db/src/query/live/types.ts:97](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L97) + +If enabled the collection will return a single object instead of an array + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: [packages/db/src/query/live/types.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/types.ts#L87) + +Start sync / the query immediately diff --git a/docs/reference/interfaces/LocalOnlyCollectionConfig.md b/docs/reference/interfaces/LocalOnlyCollectionConfig.md new file mode 100644 index 000000000..d34d42f52 --- /dev/null +++ b/docs/reference/interfaces/LocalOnlyCollectionConfig.md @@ -0,0 +1,442 @@ +--- +id: LocalOnlyCollectionConfig +title: LocalOnlyCollectionConfig +--- + +# Interface: LocalOnlyCollectionConfig\ + +Defined in: [packages/db/src/local-only.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L22) + +Configuration interface for Local-only collection options + +## Extends + +- `Omit`\<[`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`, [`LocalOnlyCollectionUtils`](../LocalOnlyCollectionUtils.md)\>, `"gcTime"` \| `"startSync"`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `object` + +The type of items in the collection + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` + +The schema type for validation + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key returned by `getKey` + +## Properties + +### autoIndex? + +```ts +optional autoIndex: "eager" | "off"; +``` + +Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) + +Auto-indexing mode for the collection. +When enabled, indexes will be automatically created for simple where expressions. + +#### Default + +```ts +"eager" +``` + +#### Description + +- "off": No automatic indexing +- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) + +*** + +### compare()? + +```ts +optional compare: (x, y) => number; +``` + +Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) + +Optional function to compare two items. +This is used to order the items in the collection. + +#### Parameters + +##### x + +`T` + +The first item to compare + +##### y + +`T` + +The second item to compare + +#### Returns + +`number` + +A number indicating the order of the items + +#### Example + +```ts +// For a collection with a 'createdAt' field +compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() +``` + +#### Inherited from + +```ts +Omit.compare +``` + +*** + +### getKey() + +```ts +getKey: (item) => TKey; +``` + +Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) + +Function to extract the ID from an object +This is required for update/delete operations which now only accept IDs + +#### Parameters + +##### item + +`T` + +The item to extract the ID from + +#### Returns + +`TKey` + +The ID string for the item + +#### Example + +```ts +// For a collection with a 'uuid' field as the primary key +getKey: (item) => item.uuid +``` + +#### Inherited from + +```ts +Omit.getKey +``` + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) + +*** + +### initialData? + +```ts +optional initialData: T[]; +``` + +Defined in: [packages/db/src/local-only.ts:34](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L34) + +Optional initial data to populate the collection with on creation +This data will be applied during the initial sync process + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) + +Optional asynchronous handler function called before a delete operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic delete handler +onDelete: async ({ transaction, collection }) => { + const deletedKey = transaction.mutations[0].key + await api.deleteTodo(deletedKey) +} +``` + +```ts +// Delete handler with multiple items +onDelete: async ({ transaction, collection }) => { + const keysToDelete = transaction.mutations.map(m => m.key) + await api.deleteTodos(keysToDelete) +} +``` + +```ts +// Delete handler with confirmation +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const shouldDelete = await confirmDeletion(mutation.original) + if (!shouldDelete) { + throw new Error('Delete cancelled by user') + } + await api.deleteTodo(mutation.original.id) +} +``` + +```ts +// Delete handler with optimistic rollback +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.deleteTodo(mutation.original.id) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Delete failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +```ts +Omit.onDelete +``` + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) + +Optional asynchronous handler function called before an insert operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic insert handler +onInsert: async ({ transaction, collection }) => { + const newItem = transaction.mutations[0].modified + await api.createTodo(newItem) +} +``` + +```ts +// Insert handler with multiple items +onInsert: async ({ transaction, collection }) => { + const items = transaction.mutations.map(m => m.modified) + await api.createTodos(items) +} +``` + +```ts +// Insert handler with error handling +onInsert: async ({ transaction, collection }) => { + try { + const newItem = transaction.mutations[0].modified + const result = await api.createTodo(newItem) + return result + } catch (error) { + console.error('Insert failed:', error) + throw error // This will cause the transaction to fail + } +} +``` + +```ts +// Insert handler with metadata +onInsert: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + await api.createTodo(mutation.modified, { + source: mutation.metadata?.source, + timestamp: mutation.createdAt + }) +} +``` + +#### Inherited from + +```ts +Omit.onInsert +``` + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) + +Optional asynchronous handler function called before an update operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic update handler +onUpdate: async ({ transaction, collection }) => { + const updatedItem = transaction.mutations[0].modified + await api.updateTodo(updatedItem.id, updatedItem) +} +``` + +```ts +// Update handler with partial updates +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const changes = mutation.changes // Only the changed fields + await api.updateTodo(mutation.original.id, changes) +} +``` + +```ts +// Update handler with multiple items +onUpdate: async ({ transaction, collection }) => { + const updates = transaction.mutations.map(m => ({ + id: m.key, + changes: m.changes + })) + await api.updateTodos(updates) +} +``` + +```ts +// Update handler with optimistic rollback +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.updateTodo(mutation.original.id, mutation.changes) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Update failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +```ts +Omit.onUpdate +``` + +*** + +### schema? + +```ts +optional schema: TSchema; +``` + +Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) + +#### Inherited from + +```ts +Omit.schema +``` + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) + +The mode of sync to use for the collection. + +#### Default + +`eager` + +#### Description + +- `eager`: syncs all data immediately on preload +- `on-demand`: syncs data in incremental snapshots when the collection is queried +The exact implementation of the sync mode is up to the sync implementation. + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) + +*** + +### utils? + +```ts +optional utils: LocalOnlyCollectionUtils; +``` + +Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) + +#### Inherited from + +```ts +Omit.utils +``` diff --git a/docs/reference/interfaces/LocalOnlyCollectionUtils.md b/docs/reference/interfaces/LocalOnlyCollectionUtils.md new file mode 100644 index 000000000..75d3e41ce --- /dev/null +++ b/docs/reference/interfaces/LocalOnlyCollectionUtils.md @@ -0,0 +1,62 @@ +--- +id: LocalOnlyCollectionUtils +title: LocalOnlyCollectionUtils +--- + +# Interface: LocalOnlyCollectionUtils + +Defined in: [packages/db/src/local-only.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L40) + +Local-only collection utilities type + +## Extends + +- [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +## Indexable + +```ts +[key: string]: any +``` + +## Properties + +### acceptMutations() + +```ts +acceptMutations: (transaction) => void; +``` + +Defined in: [packages/db/src/local-only.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/local-only.ts#L58) + +Accepts mutations from a transaction that belong to this collection and persists them. +This should be called in your transaction's mutationFn to persist local-only data. + +#### Parameters + +##### transaction + +The transaction containing mutations to accept + +###### mutations + +[`PendingMutation`](../PendingMutation.md)\<`Record`\<`string`, `unknown`\>, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`Record`\<`string`, `unknown`\>, `any`, `any`, `any`, `any`\>\>[] + +#### Returns + +`void` + +#### Example + +```ts +const localData = createCollection(localOnlyCollectionOptions({...})) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Make API call first + await api.save(...) + // Then persist local-only mutations after success + localData.utils.acceptMutations(transaction) + } +}) +``` diff --git a/docs/reference/interfaces/LocalStorageCollectionConfig.md b/docs/reference/interfaces/LocalStorageCollectionConfig.md new file mode 100644 index 000000000..52909c7f4 --- /dev/null +++ b/docs/reference/interfaces/LocalStorageCollectionConfig.md @@ -0,0 +1,510 @@ +--- +id: LocalStorageCollectionConfig +title: LocalStorageCollectionConfig +--- + +# Interface: LocalStorageCollectionConfig\ + +Defined in: [packages/db/src/local-storage.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L58) + +Configuration interface for localStorage collection options + +## Extends + +- [`BaseCollectionConfig`](../BaseCollectionConfig.md)\<`T`, `TKey`, `TSchema`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `object` + +The type of items in the collection + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` + +The schema type for validation + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +The type of the key returned by `getKey` + +## Properties + +### autoIndex? + +```ts +optional autoIndex: "eager" | "off"; +``` + +Defined in: [packages/db/src/types.ts:434](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L434) + +Auto-indexing mode for the collection. +When enabled, indexes will be automatically created for simple where expressions. + +#### Default + +```ts +"eager" +``` + +#### Description + +- "off": No automatic indexing +- "eager": Automatically create indexes for simple where expressions in subscribeChanges (default) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`autoIndex`](../BaseCollectionConfig.md#autoindex) + +*** + +### compare()? + +```ts +optional compare: (x, y) => number; +``` + +Defined in: [packages/db/src/types.ts:445](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L445) + +Optional function to compare two items. +This is used to order the items in the collection. + +#### Parameters + +##### x + +`T` + +The first item to compare + +##### y + +`T` + +The second item to compare + +#### Returns + +`number` + +A number indicating the order of the items + +#### Example + +```ts +// For a collection with a 'createdAt' field +compare: (x, y) => x.createdAt.getTime() - y.createdAt.getTime() +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`compare`](../BaseCollectionConfig.md#compare) + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: [packages/db/src/types.ts:414](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L414) + +Time in milliseconds after which the collection will be garbage collected +when it has no active subscribers. Defaults to 5 minutes (300000ms). + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`gcTime`](../BaseCollectionConfig.md#gctime) + +*** + +### getKey() + +```ts +getKey: (item) => TKey; +``` + +Defined in: [packages/db/src/types.ts:409](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L409) + +Function to extract the ID from an object +This is required for update/delete operations which now only accept IDs + +#### Parameters + +##### item + +`T` + +The item to extract the ID from + +#### Returns + +`TKey` + +The ID string for the item + +#### Example + +```ts +// For a collection with a 'uuid' field as the primary key +getKey: (item) => item.uuid +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`getKey`](../BaseCollectionConfig.md#getkey) + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:398](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L398) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`id`](../BaseCollectionConfig.md#id) + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: [packages/db/src/types.ts:583](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L583) + +Optional asynchronous handler function called before a delete operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic delete handler +onDelete: async ({ transaction, collection }) => { + const deletedKey = transaction.mutations[0].key + await api.deleteTodo(deletedKey) +} +``` + +```ts +// Delete handler with multiple items +onDelete: async ({ transaction, collection }) => { + const keysToDelete = transaction.mutations.map(m => m.key) + await api.deleteTodos(keysToDelete) +} +``` + +```ts +// Delete handler with confirmation +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const shouldDelete = await confirmDeletion(mutation.original) + if (!shouldDelete) { + throw new Error('Delete cancelled by user') + } + await api.deleteTodo(mutation.original.id) +} +``` + +```ts +// Delete handler with optimistic rollback +onDelete: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.deleteTodo(mutation.original.id) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Delete failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onDelete`](../BaseCollectionConfig.md#ondelete) + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: [packages/db/src/types.ts:496](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L496) + +Optional asynchronous handler function called before an insert operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic insert handler +onInsert: async ({ transaction, collection }) => { + const newItem = transaction.mutations[0].modified + await api.createTodo(newItem) +} +``` + +```ts +// Insert handler with multiple items +onInsert: async ({ transaction, collection }) => { + const items = transaction.mutations.map(m => m.modified) + await api.createTodos(items) +} +``` + +```ts +// Insert handler with error handling +onInsert: async ({ transaction, collection }) => { + try { + const newItem = transaction.mutations[0].modified + const result = await api.createTodo(newItem) + return result + } catch (error) { + console.error('Insert failed:', error) + throw error // This will cause the transaction to fail + } +} +``` + +```ts +// Insert handler with metadata +onInsert: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + await api.createTodo(mutation.modified, { + source: mutation.metadata?.source, + timestamp: mutation.createdAt + }) +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onInsert`](../BaseCollectionConfig.md#oninsert) + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: [packages/db/src/types.ts:540](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L540) + +Optional asynchronous handler function called before an update operation + +#### Param + +Object containing transaction and collection information + +#### Returns + +Promise resolving to any value + +#### Examples + +```ts +// Basic update handler +onUpdate: async ({ transaction, collection }) => { + const updatedItem = transaction.mutations[0].modified + await api.updateTodo(updatedItem.id, updatedItem) +} +``` + +```ts +// Update handler with partial updates +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + const changes = mutation.changes // Only the changed fields + await api.updateTodo(mutation.original.id, changes) +} +``` + +```ts +// Update handler with multiple items +onUpdate: async ({ transaction, collection }) => { + const updates = transaction.mutations.map(m => ({ + id: m.key, + changes: m.changes + })) + await api.updateTodos(updates) +} +``` + +```ts +// Update handler with optimistic rollback +onUpdate: async ({ transaction, collection }) => { + const mutation = transaction.mutations[0] + try { + await api.updateTodo(mutation.original.id, mutation.changes) + } catch (error) { + // Transaction will automatically rollback optimistic changes + console.error('Update failed, rolling back:', error) + throw error + } +} +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`onUpdate`](../BaseCollectionConfig.md#onupdate) + +*** + +### parser? + +```ts +optional parser: Parser; +``` + +Defined in: [packages/db/src/local-storage.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L84) + +Parser to use for serializing and deserializing data to and from storage +Defaults to JSON + +*** + +### schema? + +```ts +optional schema: TSchema; +``` + +Defined in: [packages/db/src/types.ts:399](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L399) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`schema`](../BaseCollectionConfig.md#schema) + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425) + +Whether to eagerly start syncing on collection creation. +When true, syncing begins immediately. When false, syncing starts when the first subscriber attaches. + +Note: Even with startSync=true, collections will pause syncing when there are no active +subscribers (typically when components querying the collection unmount), resuming when new +subscribers attach. This preserves normal staleTime/gcTime behavior. + +#### Default + +```ts +false +``` + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`startSync`](../BaseCollectionConfig.md#startsync) + +*** + +### storage? + +```ts +optional storage: StorageApi; +``` + +Defined in: [packages/db/src/local-storage.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L72) + +Storage API to use (defaults to window.localStorage) +Can be any object that implements the Storage interface (e.g., sessionStorage) + +*** + +### storageEventApi? + +```ts +optional storageEventApi: StorageEventApi; +``` + +Defined in: [packages/db/src/local-storage.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L78) + +Storage event API to use for cross-tab synchronization (defaults to window) +Can be any object that implements addEventListener/removeEventListener for storage events + +*** + +### storageKey + +```ts +storageKey: string; +``` + +Defined in: [packages/db/src/local-storage.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L66) + +The key to use for storing the collection data in localStorage/sessionStorage + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: [packages/db/src/types.ts:454](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L454) + +The mode of sync to use for the collection. + +#### Default + +`eager` + +#### Description + +- `eager`: syncs all data immediately on preload +- `on-demand`: syncs data in incremental snapshots when the collection is queried +The exact implementation of the sync mode is up to the sync implementation. + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`syncMode`](../BaseCollectionConfig.md#syncmode) + +*** + +### utils? + +```ts +optional utils: UtilsRecord; +``` + +Defined in: [packages/db/src/types.ts:585](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L585) + +#### Inherited from + +[`BaseCollectionConfig`](../BaseCollectionConfig.md).[`utils`](../BaseCollectionConfig.md#utils) diff --git a/docs/reference/interfaces/LocalStorageCollectionUtils.md b/docs/reference/interfaces/LocalStorageCollectionUtils.md new file mode 100644 index 000000000..9b35e540d --- /dev/null +++ b/docs/reference/interfaces/LocalStorageCollectionUtils.md @@ -0,0 +1,82 @@ +--- +id: LocalStorageCollectionUtils +title: LocalStorageCollectionUtils +--- + +# Interface: LocalStorageCollectionUtils + +Defined in: [packages/db/src/local-storage.ts:100](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L100) + +LocalStorage collection utilities type + +## Extends + +- [`UtilsRecord`](../../type-aliases/UtilsRecord.md) + +## Indexable + +```ts +[key: string]: any +``` + +## Properties + +### acceptMutations() + +```ts +acceptMutations: (transaction) => void; +``` + +Defined in: [packages/db/src/local-storage.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L120) + +Accepts mutations from a transaction that belong to this collection and persists them to localStorage. +This should be called in your transaction's mutationFn to persist local-storage data. + +#### Parameters + +##### transaction + +The transaction containing mutations to accept + +###### mutations + +[`PendingMutation`](../PendingMutation.md)\<`Record`\<`string`, `unknown`\>, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`Record`\<`string`, `unknown`\>, `any`, `any`, `any`, `any`\>\>[] + +#### Returns + +`void` + +#### Example + +```ts +const localSettings = createCollection(localStorageCollectionOptions({...})) + +const tx = createTransaction({ + mutationFn: async ({ transaction }) => { + // Make API call first + await api.save(...) + // Then persist local-storage mutations after success + localSettings.utils.acceptMutations(transaction) + } +}) +``` + +*** + +### clearStorage + +```ts +clearStorage: ClearStorageFn; +``` + +Defined in: [packages/db/src/local-storage.ts:101](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L101) + +*** + +### getStorageSize + +```ts +getStorageSize: GetStorageSizeFn; +``` + +Defined in: [packages/db/src/local-storage.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L102) diff --git a/docs/reference/interfaces/OperationConfig.md b/docs/reference/interfaces/OperationConfig.md new file mode 100644 index 000000000..e5c2774da --- /dev/null +++ b/docs/reference/interfaces/OperationConfig.md @@ -0,0 +1,30 @@ +--- +id: OperationConfig +title: OperationConfig +--- + +# Interface: OperationConfig + +Defined in: [packages/db/src/types.ts:297](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L297) + +## Properties + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:298](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L298) + +*** + +### optimistic? + +```ts +optional optimistic: boolean; +``` + +Defined in: [packages/db/src/types.ts:300](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L300) + +Whether to apply optimistic updates immediately. Defaults to true. diff --git a/docs/reference/interfaces/OptimisticChangeMessage.md b/docs/reference/interfaces/OptimisticChangeMessage.md new file mode 100644 index 000000000..f0a365281 --- /dev/null +++ b/docs/reference/interfaces/OptimisticChangeMessage.md @@ -0,0 +1,98 @@ +--- +id: OptimisticChangeMessage +title: OptimisticChangeMessage +--- + +# Interface: OptimisticChangeMessage\ + +Defined in: [packages/db/src/types.ts:272](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L272) + +## Extends + +- [`ChangeMessage`](../ChangeMessage.md)\<`T`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### isActive? + +```ts +optional isActive: boolean; +``` + +Defined in: [packages/db/src/types.ts:276](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L276) + +*** + +### key + +```ts +key: string | number; +``` + +Defined in: [packages/db/src/types.ts:265](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L265) + +#### Inherited from + +[`ChangeMessage`](../ChangeMessage.md).[`key`](../ChangeMessage.md#key) + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:269](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L269) + +#### Inherited from + +[`ChangeMessage`](../ChangeMessage.md).[`metadata`](../ChangeMessage.md#metadata) + +*** + +### previousValue? + +```ts +optional previousValue: T; +``` + +Defined in: [packages/db/src/types.ts:267](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L267) + +#### Inherited from + +[`ChangeMessage`](../ChangeMessage.md).[`previousValue`](../ChangeMessage.md#previousvalue) + +*** + +### type + +```ts +type: OperationType; +``` + +Defined in: [packages/db/src/types.ts:268](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L268) + +#### Inherited from + +[`ChangeMessage`](../ChangeMessage.md).[`type`](../ChangeMessage.md#type) + +*** + +### value + +```ts +value: T; +``` + +Defined in: [packages/db/src/types.ts:266](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L266) + +#### Inherited from + +[`ChangeMessage`](../ChangeMessage.md).[`value`](../ChangeMessage.md#value) diff --git a/docs/reference/interfaces/PacedMutationsConfig.md b/docs/reference/interfaces/PacedMutationsConfig.md new file mode 100644 index 000000000..ead589087 --- /dev/null +++ b/docs/reference/interfaces/PacedMutationsConfig.md @@ -0,0 +1,81 @@ +--- +id: PacedMutationsConfig +title: PacedMutationsConfig +--- + +# Interface: PacedMutationsConfig\ + +Defined in: [packages/db/src/paced-mutations.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L8) + +Configuration for creating a paced mutations manager + +## Type Parameters + +### TVariables + +`TVariables` = `unknown` + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/paced-mutations.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L30) + +Custom metadata to associate with transactions + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: [packages/db/src/paced-mutations.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L21) + +Function to execute the mutation on the server. +Receives the transaction parameters containing all merged mutations. + +*** + +### onMutate() + +```ts +onMutate: (variables) => void; +``` + +Defined in: [packages/db/src/paced-mutations.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L16) + +Callback to apply optimistic updates immediately. +Receives the variables passed to the mutate function. + +#### Parameters + +##### variables + +`TVariables` + +#### Returns + +`void` + +*** + +### strategy + +```ts +strategy: Strategy; +``` + +Defined in: [packages/db/src/paced-mutations.ts:26](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L26) + +Strategy for controlling mutation execution timing +Examples: debounceStrategy, queueStrategy, throttleStrategy diff --git a/docs/reference/interfaces/Parser.md b/docs/reference/interfaces/Parser.md new file mode 100644 index 000000000..d1eafc24c --- /dev/null +++ b/docs/reference/interfaces/Parser.md @@ -0,0 +1,48 @@ +--- +id: Parser +title: Parser +--- + +# Interface: Parser + +Defined in: [packages/db/src/local-storage.ts:47](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L47) + +## Properties + +### parse() + +```ts +parse: (data) => unknown; +``` + +Defined in: [packages/db/src/local-storage.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L48) + +#### Parameters + +##### data + +`string` + +#### Returns + +`unknown` + +*** + +### stringify() + +```ts +stringify: (data) => string; +``` + +Defined in: [packages/db/src/local-storage.ts:49](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L49) + +#### Parameters + +##### data + +`unknown` + +#### Returns + +`string` diff --git a/docs/reference/interfaces/PendingMutation.md b/docs/reference/interfaces/PendingMutation.md new file mode 100644 index 000000000..909f848f6 --- /dev/null +++ b/docs/reference/interfaces/PendingMutation.md @@ -0,0 +1,157 @@ +--- +id: PendingMutation +title: PendingMutation +--- + +# Interface: PendingMutation\ + +Defined in: [packages/db/src/types.ts:57](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L57) + +Represents a pending mutation within a transaction +Contains information about the original and modified data, as well as metadata + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TOperation + +`TOperation` *extends* [`OperationType`](../../type-aliases/OperationType.md) = [`OperationType`](../../type-aliases/OperationType.md) + +### TCollection + +`TCollection` *extends* [`Collection`](../Collection.md)\<`T`, `any`, `any`, `any`, `any`\> = [`Collection`](../Collection.md)\<`T`, `any`, `any`, `any`, `any`\> + +## Properties + +### changes + +```ts +changes: ResolveTransactionChanges; +``` + +Defined in: [packages/db/src/types.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L74) + +*** + +### collection + +```ts +collection: TCollection; +``` + +Defined in: [packages/db/src/types.ts:85](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L85) + +*** + +### createdAt + +```ts +createdAt: Date; +``` + +Defined in: [packages/db/src/types.ts:83](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L83) + +*** + +### globalKey + +```ts +globalKey: string; +``` + +Defined in: [packages/db/src/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L75) + +*** + +### key + +```ts +key: any; +``` + +Defined in: [packages/db/src/types.ts:77](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L77) + +*** + +### metadata + +```ts +metadata: unknown; +``` + +Defined in: [packages/db/src/types.ts:79](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L79) + +*** + +### modified + +```ts +modified: T; +``` + +Defined in: [packages/db/src/types.ts:72](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L72) + +*** + +### mutationId + +```ts +mutationId: string; +``` + +Defined in: [packages/db/src/types.ts:68](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L68) + +*** + +### optimistic + +```ts +optimistic: boolean; +``` + +Defined in: [packages/db/src/types.ts:82](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L82) + +Whether this mutation should be applied optimistically (defaults to true) + +*** + +### original + +```ts +original: TOperation extends "insert" ? object : T; +``` + +Defined in: [packages/db/src/types.ts:70](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L70) + +*** + +### syncMetadata + +```ts +syncMetadata: Record; +``` + +Defined in: [packages/db/src/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L80) + +*** + +### type + +```ts +type: TOperation; +``` + +Defined in: [packages/db/src/types.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L78) + +*** + +### updatedAt + +```ts +updatedAt: Date; +``` + +Defined in: [packages/db/src/types.ts:84](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L84) diff --git a/docs/reference/interfaces/QueueStrategy.md b/docs/reference/interfaces/QueueStrategy.md new file mode 100644 index 000000000..d22576848 --- /dev/null +++ b/docs/reference/interfaces/QueueStrategy.md @@ -0,0 +1,99 @@ +--- +id: QueueStrategy +title: QueueStrategy +--- + +# Interface: QueueStrategy + +Defined in: [packages/db/src/strategies/types.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L66) + +Queue strategy that processes all executions in order +FIFO: { addItemsTo: 'back', getItemsFrom: 'front' } +LIFO: { addItemsTo: 'back', getItemsFrom: 'back' } + +## Extends + +- [`BaseStrategy`](../BaseStrategy.md)\<`"queue"`\> + +## Properties + +### \_type + +```ts +_type: "queue"; +``` + +Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) + +Type discriminator for strategy identification + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) + +*** + +### cleanup() + +```ts +cleanup: () => void; +``` + +Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) + +Clean up any resources held by the strategy +Should be called when the strategy is no longer needed + +#### Returns + +`void` + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) + +*** + +### execute() + +```ts +execute: (fn) => void | Promise; +``` + +Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) + +Execute a function according to the strategy's timing rules + +#### Type Parameters + +##### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +#### Parameters + +##### fn + +() => [`Transaction`](../Transaction.md)\<`T`\> + +The function to execute + +#### Returns + +`void` \| `Promise`\<`void`\> + +The result of the function execution (if applicable) + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) + +*** + +### options? + +```ts +optional options: QueueStrategyOptions; +``` + +Defined in: [packages/db/src/strategies/types.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L67) diff --git a/docs/reference/interfaces/QueueStrategyOptions.md b/docs/reference/interfaces/QueueStrategyOptions.md new file mode 100644 index 000000000..cefdd24e5 --- /dev/null +++ b/docs/reference/interfaces/QueueStrategyOptions.md @@ -0,0 +1,59 @@ +--- +id: QueueStrategyOptions +title: QueueStrategyOptions +--- + +# Interface: QueueStrategyOptions + +Defined in: [packages/db/src/strategies/types.ts:50](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L50) + +Options for queue strategy +Processes all executions in order (FIFO/LIFO) + +## Properties + +### addItemsTo? + +```ts +optional addItemsTo: "front" | "back"; +``` + +Defined in: [packages/db/src/strategies/types.ts:56](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L56) + +Where to add new items in the queue + +*** + +### getItemsFrom? + +```ts +optional getItemsFrom: "front" | "back"; +``` + +Defined in: [packages/db/src/strategies/types.ts:58](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L58) + +Where to get items from when processing + +*** + +### maxSize? + +```ts +optional maxSize: number; +``` + +Defined in: [packages/db/src/strategies/types.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L54) + +Maximum queue size (items are dropped if exceeded) + +*** + +### wait? + +```ts +optional wait: number; +``` + +Defined in: [packages/db/src/strategies/types.ts:52](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L52) + +Wait time between processing queue items (milliseconds) diff --git a/docs/reference/interfaces/RangeQueryOptions.md b/docs/reference/interfaces/RangeQueryOptions.md new file mode 100644 index 000000000..cae26c2a6 --- /dev/null +++ b/docs/reference/interfaces/RangeQueryOptions.md @@ -0,0 +1,50 @@ +--- +id: RangeQueryOptions +title: RangeQueryOptions +--- + +# Interface: RangeQueryOptions + +Defined in: [packages/db/src/indexes/btree-index.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L19) + +Options for range queries + +## Properties + +### from? + +```ts +optional from: any; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L20) + +*** + +### fromInclusive? + +```ts +optional fromInclusive: boolean; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L22) + +*** + +### to? + +```ts +optional to: any; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L21) + +*** + +### toInclusive? + +```ts +optional toInclusive: boolean; +``` + +Defined in: [packages/db/src/indexes/btree-index.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/btree-index.ts#L23) diff --git a/docs/reference/interfaces/SubscribeChangesOptions.md b/docs/reference/interfaces/SubscribeChangesOptions.md new file mode 100644 index 000000000..c453c9b5c --- /dev/null +++ b/docs/reference/interfaces/SubscribeChangesOptions.md @@ -0,0 +1,34 @@ +--- +id: SubscribeChangesOptions +title: SubscribeChangesOptions +--- + +# Interface: SubscribeChangesOptions + +Defined in: [packages/db/src/types.ts:662](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L662) + +Options for subscribing to collection changes + +## Properties + +### includeInitialState? + +```ts +optional includeInitialState: boolean; +``` + +Defined in: [packages/db/src/types.ts:664](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L664) + +Whether to include the current state as initial changes + +*** + +### whereExpression? + +```ts +optional whereExpression: BasicExpression; +``` + +Defined in: [packages/db/src/types.ts:666](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L666) + +Pre-compiled expression for filtering changes diff --git a/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md b/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md new file mode 100644 index 000000000..b0eb573f6 --- /dev/null +++ b/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md @@ -0,0 +1,48 @@ +--- +id: SubscribeChangesSnapshotOptions +title: SubscribeChangesSnapshotOptions +--- + +# Interface: SubscribeChangesSnapshotOptions + +Defined in: [packages/db/src/types.ts:669](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L669) + +## Extends + +- `Omit`\<[`SubscribeChangesOptions`](../SubscribeChangesOptions.md), `"includeInitialState"`\> + +## Properties + +### limit? + +```ts +optional limit: number; +``` + +Defined in: [packages/db/src/types.ts:672](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L672) + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: [packages/db/src/types.ts:671](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L671) + +*** + +### whereExpression? + +```ts +optional whereExpression: BasicExpression; +``` + +Defined in: [packages/db/src/types.ts:666](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L666) + +Pre-compiled expression for filtering changes + +#### Inherited from + +[`SubscribeChangesOptions`](../SubscribeChangesOptions.md).[`whereExpression`](../SubscribeChangesOptions.md#whereexpression) diff --git a/docs/reference/interfaces/Subscription.md b/docs/reference/interfaces/Subscription.md new file mode 100644 index 000000000..5af5857aa --- /dev/null +++ b/docs/reference/interfaces/Subscription.md @@ -0,0 +1,280 @@ +--- +id: Subscription +title: Subscription +--- + +# Interface: Subscription + +Defined in: [packages/db/src/types.ts:201](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L201) + +Public interface for a collection subscription +Used by sync implementations to track subscription lifecycle + +## Extends + +- `EventEmitter`\<[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\> + +## Properties + +### status + +```ts +readonly status: SubscriptionStatus; +``` + +Defined in: [packages/db/src/types.ts:203](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L203) + +Current status of the subscription + +## Methods + +### clearListeners() + +```ts +protected clearListeners(): void; +``` + +Defined in: [packages/db/src/event-emitter.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L115) + +Clear all listeners + +#### Returns + +`void` + +#### Inherited from + +```ts +EventEmitter.clearListeners +``` + +*** + +### emitInner() + +```ts +protected emitInner(event, eventPayload): void; +``` + +Defined in: [packages/db/src/event-emitter.ts:96](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L96) + +**`Internal`** + +Emit an event to all listeners + +#### Type Parameters + +##### T + +`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) + +#### Parameters + +##### event + +`T` + +Event name to emit + +##### eventPayload + +[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\[`T`\] + +Event payload + For use by subclasses - subclasses should wrap this with a public emit if needed + +#### Returns + +`void` + +#### Inherited from + +```ts +EventEmitter.emitInner +``` + +*** + +### off() + +```ts +off(event, callback): void; +``` + +Defined in: [packages/db/src/event-emitter.ts:53](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L53) + +Unsubscribe from an event + +#### Type Parameters + +##### T + +`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) + +#### Parameters + +##### event + +`T` + +Event name to stop listening for + +##### callback + +(`event`) => `void` + +Function to remove + +#### Returns + +`void` + +#### Inherited from + +```ts +EventEmitter.off +``` + +*** + +### on() + +```ts +on(event, callback): () => void; +``` + +Defined in: [packages/db/src/event-emitter.ts:17](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L17) + +Subscribe to an event + +#### Type Parameters + +##### T + +`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) + +#### Parameters + +##### event + +`T` + +Event name to listen for + +##### callback + +(`event`) => `void` + +Function to call when event is emitted + +#### Returns + +Unsubscribe function + +```ts +(): void; +``` + +##### Returns + +`void` + +#### Inherited from + +```ts +EventEmitter.on +``` + +*** + +### once() + +```ts +once(event, callback): () => void; +``` + +Defined in: [packages/db/src/event-emitter.ts:37](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L37) + +Subscribe to an event once (automatically unsubscribes after first emission) + +#### Type Parameters + +##### T + +`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) + +#### Parameters + +##### event + +`T` + +Event name to listen for + +##### callback + +(`event`) => `void` + +Function to call when event is emitted + +#### Returns + +Unsubscribe function + +```ts +(): void; +``` + +##### Returns + +`void` + +#### Inherited from + +```ts +EventEmitter.once +``` + +*** + +### waitFor() + +```ts +waitFor(event, timeout?): Promise; +``` + +Defined in: [packages/db/src/event-emitter.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/event-emitter.ts#L66) + +Wait for an event to be emitted + +#### Type Parameters + +##### T + +`T` *extends* keyof [`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md) + +#### Parameters + +##### event + +`T` + +Event name to wait for + +##### timeout? + +`number` + +Optional timeout in milliseconds + +#### Returns + +`Promise`\<[`SubscriptionEvents`](../../type-aliases/SubscriptionEvents.md)\[`T`\]\> + +Promise that resolves with the event payload + +#### Inherited from + +```ts +EventEmitter.waitFor +``` diff --git a/docs/reference/interfaces/SubscriptionStatusChangeEvent.md b/docs/reference/interfaces/SubscriptionStatusChangeEvent.md new file mode 100644 index 000000000..ecdc7fa48 --- /dev/null +++ b/docs/reference/interfaces/SubscriptionStatusChangeEvent.md @@ -0,0 +1,50 @@ +--- +id: SubscriptionStatusChangeEvent +title: SubscriptionStatusChangeEvent +--- + +# Interface: SubscriptionStatusChangeEvent + +Defined in: [packages/db/src/types.ts:162](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L162) + +Event emitted when subscription status changes + +## Properties + +### previousStatus + +```ts +previousStatus: SubscriptionStatus; +``` + +Defined in: [packages/db/src/types.ts:165](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L165) + +*** + +### status + +```ts +status: SubscriptionStatus; +``` + +Defined in: [packages/db/src/types.ts:166](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L166) + +*** + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: [packages/db/src/types.ts:164](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L164) + +*** + +### type + +```ts +type: "status:change"; +``` + +Defined in: [packages/db/src/types.ts:163](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L163) diff --git a/docs/reference/interfaces/SubscriptionStatusEvent.md b/docs/reference/interfaces/SubscriptionStatusEvent.md new file mode 100644 index 000000000..e36ea1dab --- /dev/null +++ b/docs/reference/interfaces/SubscriptionStatusEvent.md @@ -0,0 +1,56 @@ +--- +id: SubscriptionStatusEvent +title: SubscriptionStatusEvent +--- + +# Interface: SubscriptionStatusEvent\ + +Defined in: [packages/db/src/types.ts:172](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L172) + +Event emitted when subscription status changes to a specific status + +## Type Parameters + +### T + +`T` *extends* [`SubscriptionStatus`](../../type-aliases/SubscriptionStatus.md) + +## Properties + +### previousStatus + +```ts +previousStatus: SubscriptionStatus; +``` + +Defined in: [packages/db/src/types.ts:175](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L175) + +*** + +### status + +```ts +status: T; +``` + +Defined in: [packages/db/src/types.ts:176](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L176) + +*** + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: [packages/db/src/types.ts:174](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L174) + +*** + +### type + +```ts +type: `status:${T}`; +``` + +Defined in: [packages/db/src/types.ts:173](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L173) diff --git a/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md b/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md new file mode 100644 index 000000000..12e3dae67 --- /dev/null +++ b/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md @@ -0,0 +1,30 @@ +--- +id: SubscriptionUnsubscribedEvent +title: SubscriptionUnsubscribedEvent +--- + +# Interface: SubscriptionUnsubscribedEvent + +Defined in: [packages/db/src/types.ts:182](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L182) + +Event emitted when subscription is unsubscribed + +## Properties + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: [packages/db/src/types.ts:184](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L184) + +*** + +### type + +```ts +type: "unsubscribed"; +``` + +Defined in: [packages/db/src/types.ts:183](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L183) diff --git a/docs/reference/interfaces/SyncConfig.md b/docs/reference/interfaces/SyncConfig.md new file mode 100644 index 000000000..3db6db853 --- /dev/null +++ b/docs/reference/interfaces/SyncConfig.md @@ -0,0 +1,104 @@ +--- +id: SyncConfig +title: SyncConfig +--- + +# Interface: SyncConfig\ + +Defined in: [packages/db/src/types.ts:232](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L232) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Properties + +### getSyncMetadata()? + +```ts +optional getSyncMetadata: () => Record; +``` + +Defined in: [packages/db/src/types.ts:249](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L249) + +Get the sync metadata for insert operations + +#### Returns + +`Record`\<`string`, `unknown`\> + +Record containing relation information + +*** + +### rowUpdateMode? + +```ts +optional rowUpdateMode: "full" | "partial"; +``` + +Defined in: [packages/db/src/types.ts:258](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L258) + +The row update mode used to sync to the collection. + +#### Default + +`partial` + +#### Description + +- `partial`: Updates contain only the changes to the row. +- `full`: Updates contain the entire row. + +*** + +### sync() + +```ts +sync: (params) => + | void + | CleanupFn + | SyncConfigRes; +``` + +Defined in: [packages/db/src/types.ts:236](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L236) + +#### Parameters + +##### params + +###### begin + +() => `void` + +###### collection + +[`Collection`](../Collection.md)\<`T`, `TKey`, `any`, `any`, `any`\> + +###### commit + +() => `void` + +###### markReady + +() => `void` + +###### truncate + +() => `void` + +###### write + +(`message`) => `void` + +#### Returns + + \| `void` + \| [`CleanupFn`](../../type-aliases/CleanupFn.md) + \| [`SyncConfigRes`](../../type-aliases/SyncConfigRes.md) diff --git a/docs/reference/interfaces/ThrottleStrategy.md b/docs/reference/interfaces/ThrottleStrategy.md new file mode 100644 index 000000000..e21a6f88e --- /dev/null +++ b/docs/reference/interfaces/ThrottleStrategy.md @@ -0,0 +1,97 @@ +--- +id: ThrottleStrategy +title: ThrottleStrategy +--- + +# Interface: ThrottleStrategy + +Defined in: [packages/db/src/strategies/types.ts:86](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L86) + +Throttle strategy that spaces executions evenly over time + +## Extends + +- [`BaseStrategy`](../BaseStrategy.md)\<`"throttle"`\> + +## Properties + +### \_type + +```ts +_type: "throttle"; +``` + +Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8) + +Type discriminator for strategy identification + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`_type`](../BaseStrategy.md#_type) + +*** + +### cleanup() + +```ts +cleanup: () => void; +``` + +Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23) + +Clean up any resources held by the strategy +Should be called when the strategy is no longer needed + +#### Returns + +`void` + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`cleanup`](../BaseStrategy.md#cleanup) + +*** + +### execute() + +```ts +execute: (fn) => void | Promise; +``` + +Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15) + +Execute a function according to the strategy's timing rules + +#### Type Parameters + +##### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +#### Parameters + +##### fn + +() => [`Transaction`](../Transaction.md)\<`T`\> + +The function to execute + +#### Returns + +`void` \| `Promise`\<`void`\> + +The result of the function execution (if applicable) + +#### Inherited from + +[`BaseStrategy`](../BaseStrategy.md).[`execute`](../BaseStrategy.md#execute) + +*** + +### options + +```ts +options: ThrottleStrategyOptions; +``` + +Defined in: [packages/db/src/strategies/types.ts:87](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L87) diff --git a/docs/reference/interfaces/ThrottleStrategyOptions.md b/docs/reference/interfaces/ThrottleStrategyOptions.md new file mode 100644 index 000000000..ab54fdeb0 --- /dev/null +++ b/docs/reference/interfaces/ThrottleStrategyOptions.md @@ -0,0 +1,47 @@ +--- +id: ThrottleStrategyOptions +title: ThrottleStrategyOptions +--- + +# Interface: ThrottleStrategyOptions + +Defined in: [packages/db/src/strategies/types.ts:74](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L74) + +Options for throttle strategy +Ensures executions are evenly spaced over time + +## Properties + +### leading? + +```ts +optional leading: boolean; +``` + +Defined in: [packages/db/src/strategies/types.ts:78](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L78) + +Execute immediately on the first call + +*** + +### trailing? + +```ts +optional trailing: boolean; +``` + +Defined in: [packages/db/src/strategies/types.ts:80](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L80) + +Execute on the last call after wait period + +*** + +### wait + +```ts +wait: number; +``` + +Defined in: [packages/db/src/strategies/types.ts:76](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L76) + +Minimum wait time between executions (milliseconds) diff --git a/docs/reference/interfaces/Transaction.md b/docs/reference/interfaces/Transaction.md new file mode 100644 index 000000000..5ad434341 --- /dev/null +++ b/docs/reference/interfaces/Transaction.md @@ -0,0 +1,417 @@ +--- +id: Transaction +title: Transaction +--- + +# Interface: Transaction\ + +Defined in: [packages/db/src/transactions.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L208) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### autoCommit + +```ts +autoCommit: boolean; +``` + +Defined in: [packages/db/src/transactions.ts:214](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L214) + +*** + +### createdAt + +```ts +createdAt: Date; +``` + +Defined in: [packages/db/src/transactions.ts:215](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L215) + +*** + +### error? + +```ts +optional error: object; +``` + +Defined in: [packages/db/src/transactions.ts:218](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L218) + +#### error + +```ts +error: Error; +``` + +#### message + +```ts +message: string; +``` + +*** + +### id + +```ts +id: string; +``` + +Defined in: [packages/db/src/transactions.ts:209](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L209) + +*** + +### isPersisted + +```ts +isPersisted: Deferred>; +``` + +Defined in: [packages/db/src/transactions.ts:213](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L213) + +*** + +### metadata + +```ts +metadata: Record; +``` + +Defined in: [packages/db/src/transactions.ts:217](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L217) + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: [packages/db/src/transactions.ts:211](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L211) + +*** + +### mutations + +```ts +mutations: PendingMutation>[]; +``` + +Defined in: [packages/db/src/transactions.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L212) + +*** + +### sequenceNumber + +```ts +sequenceNumber: number; +``` + +Defined in: [packages/db/src/transactions.ts:216](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L216) + +*** + +### state + +```ts +state: TransactionState; +``` + +Defined in: [packages/db/src/transactions.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L210) + +## Methods + +### applyMutations() + +```ts +applyMutations(mutations): void; +``` + +Defined in: [packages/db/src/transactions.ts:327](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L327) + +Apply new mutations to this transaction, intelligently merging with existing mutations + +When mutations operate on the same item (same globalKey), they are merged according to +the following rules: + +- **insert + update** → insert (merge changes, keep empty original) +- **insert + delete** → removed (mutations cancel each other out) +- **update + delete** → delete (delete dominates) +- **update + update** → update (union changes, keep first original) +- **same type** → replace with latest + +This merging reduces over-the-wire churn and keeps the optimistic local view +aligned with user intent. + +#### Parameters + +##### mutations + +[`PendingMutation`](../PendingMutation.md)\<`any`, [`OperationType`](../../type-aliases/OperationType.md), [`Collection`](../Collection.md)\<`any`, `any`, `any`, `any`, `any`\>\>[] + +Array of new mutations to apply + +#### Returns + +`void` + +*** + +### commit() + +```ts +commit(): Promise>; +``` + +Defined in: [packages/db/src/transactions.ts:472](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L472) + +Commit the transaction and execute the mutation function + +#### Returns + +`Promise`\<`Transaction`\<`T`\>\> + +Promise that resolves to this transaction when complete + +#### Examples + +```ts +// Manual commit (when autoCommit is false) +const tx = createTransaction({ + autoCommit: false, + mutationFn: async ({ transaction }) => { + await api.saveChanges(transaction.mutations) + } +}) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Buy milk" }) +}) + +await tx.commit() // Manually commit +``` + +```ts +// Handle commit errors +try { + const tx = createTransaction({ + mutationFn: async () => { throw new Error("API failed") } + }) + + tx.mutate(() => { + collection.insert({ id: "1", text: "Item" }) + }) + + await tx.commit() +} catch (error) { + console.log('Commit failed, transaction rolled back:', error) +} +``` + +```ts +// Check transaction state after commit +await tx.commit() +console.log(tx.state) // "completed" or "failed" +``` + +*** + +### compareCreatedAt() + +```ts +compareCreatedAt(other): number; +``` + +Defined in: [packages/db/src/transactions.ts:526](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L526) + +Compare two transactions by their createdAt time and sequence number in order +to sort them in the order they were created. + +#### Parameters + +##### other + +`Transaction`\<`any`\> + +The other transaction to compare to + +#### Returns + +`number` + +-1 if this transaction was created before the other, 1 if it was created after, 0 if they were created at the same time + +*** + +### mutate() + +```ts +mutate(callback): Transaction; +``` + +Defined in: [packages/db/src/transactions.ts:287](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L287) + +Execute collection operations within this transaction + +#### Parameters + +##### callback + +() => `void` + +Function containing collection operations to group together. If the +callback returns a Promise, the transaction context will remain active until the promise +settles, allowing optimistic writes after `await` boundaries. + +#### Returns + +`Transaction`\<`T`\> + +This transaction for chaining + +#### Examples + +```ts +// Group multiple operations +const tx = createTransaction({ mutationFn: async () => { + // Send to API +}}) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Buy milk" }) + collection.update("2", draft => { draft.completed = true }) + collection.delete("3") +}) + +await tx.isPersisted.promise +``` + +```ts +// Handle mutate errors +try { + tx.mutate(() => { + collection.insert({ id: "invalid" }) // This might throw + }) +} catch (error) { + console.log('Mutation failed:', error) +} +``` + +```ts +// Manual commit control +const tx = createTransaction({ autoCommit: false, mutationFn: async () => {} }) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Item" }) +}) + +// Commit later when ready +await tx.commit() +``` + +*** + +### rollback() + +```ts +rollback(config?): Transaction; +``` + +Defined in: [packages/db/src/transactions.ts:389](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L389) + +Rollback the transaction and any conflicting transactions + +#### Parameters + +##### config? + +Configuration for rollback behavior + +###### isSecondaryRollback? + +`boolean` + +#### Returns + +`Transaction`\<`T`\> + +This transaction for chaining + +#### Examples + +```ts +// Manual rollback +const tx = createTransaction({ mutationFn: async () => { + // Send to API +}}) + +tx.mutate(() => { + collection.insert({ id: "1", text: "Buy milk" }) +}) + +// Rollback if needed +if (shouldCancel) { + tx.rollback() +} +``` + +```ts +// Handle rollback cascade (automatic) +const tx1 = createTransaction({ mutationFn: async () => {} }) +const tx2 = createTransaction({ mutationFn: async () => {} }) + +tx1.mutate(() => collection.update("1", draft => { draft.value = "A" })) +tx2.mutate(() => collection.update("1", draft => { draft.value = "B" })) // Same item + +tx1.rollback() // This will also rollback tx2 due to conflict +``` + +```ts +// Handle rollback in error scenarios +try { + await tx.isPersisted.promise +} catch (error) { + console.log('Transaction was rolled back:', error) + // Transaction automatically rolled back on mutation function failure +} +``` + +*** + +### setState() + +```ts +setState(newState): void; +``` + +Defined in: [packages/db/src/transactions.ts:238](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L238) + +#### Parameters + +##### newState + +[`TransactionState`](../../type-aliases/TransactionState.md) + +#### Returns + +`void` + +*** + +### touchCollection() + +```ts +touchCollection(): void; +``` + +Defined in: [packages/db/src/transactions.ts:417](https://github.com/TanStack/db/blob/main/packages/db/src/transactions.ts#L417) + +#### Returns + +`void` diff --git a/docs/reference/interfaces/TransactionConfig.md b/docs/reference/interfaces/TransactionConfig.md new file mode 100644 index 000000000..062f78947 --- /dev/null +++ b/docs/reference/interfaces/TransactionConfig.md @@ -0,0 +1,58 @@ +--- +id: TransactionConfig +title: TransactionConfig +--- + +# Interface: TransactionConfig\ + +Defined in: [packages/db/src/types.ts:115](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L115) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### autoCommit? + +```ts +optional autoCommit: boolean; +``` + +Defined in: [packages/db/src/types.ts:119](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L119) + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: [packages/db/src/types.ts:117](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L117) + +Unique identifier for the transaction + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [packages/db/src/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L122) + +Custom metadata to associate with the transaction + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: [packages/db/src/types.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L120) diff --git a/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md b/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md new file mode 100644 index 000000000..e06450b40 --- /dev/null +++ b/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md @@ -0,0 +1,240 @@ +--- +id: PowerSyncTransactor +title: PowerSyncTransactor +--- + +# Class: PowerSyncTransactor + +Defined in: [PowerSyncTransactor.ts:51](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L51) + +Applies mutations to the PowerSync database. This method is called automatically by the collection's +insert, update, and delete operations. You typically don't need to call this directly unless you +have special transaction requirements. + +## Example + +```typescript +// Create a collection +const collection = createCollection( + powerSyncCollectionOptions({ + database: db, + table: APP_SCHEMA.props.documents, + }) +) + +const addTx = createTransaction({ + autoCommit: false, + mutationFn: async ({ transaction }) => { + await new PowerSyncTransactor({ database: db }).applyTransaction(transaction) + }, +}) + +addTx.mutate(() => { + for (let i = 0; i < 5; i++) { + collection.insert({ id: randomUUID(), name: `tx-${i}` }) + } +}) + +await addTx.commit() +await addTx.isPersisted.promise +``` + +## Param + +The transaction containing mutations to apply + +## Constructors + +### Constructor + +```ts +new PowerSyncTransactor(options): PowerSyncTransactor; +``` + +Defined in: [PowerSyncTransactor.ts:55](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L55) + +#### Parameters + +##### options + +[`TransactorOptions`](../../type-aliases/TransactorOptions.md) + +#### Returns + +`PowerSyncTransactor` + +## Properties + +### database + +```ts +database: AbstractPowerSyncDatabase; +``` + +Defined in: [PowerSyncTransactor.ts:52](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L52) + +*** + +### pendingOperationStore + +```ts +pendingOperationStore: PendingOperationStore; +``` + +Defined in: [PowerSyncTransactor.ts:53](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L53) + +## Methods + +### applyTransaction() + +```ts +applyTransaction(transaction): Promise; +``` + +Defined in: [PowerSyncTransactor.ts:63](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L63) + +Persists a Transaction to the PowerSync SQLite database. + +#### Parameters + +##### transaction + +`Transaction`\<`any`\> + +#### Returns + +`Promise`\<`void`\> + +*** + +### handleDelete() + +```ts +protected handleDelete( + mutation, + context, +waitForCompletion): Promise; +``` + +Defined in: [PowerSyncTransactor.ts:204](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L204) + +#### Parameters + +##### mutation + +`PendingMutation`\<`any`\> + +##### context + +`LockContext` + +##### waitForCompletion + +`boolean` = `false` + +#### Returns + +`Promise`\<`PendingOperation` \| `null`\> + +*** + +### handleInsert() + +```ts +protected handleInsert( + mutation, + context, +waitForCompletion): Promise; +``` + +Defined in: [PowerSyncTransactor.ts:149](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L149) + +#### Parameters + +##### mutation + +`PendingMutation`\<`any`\> + +##### context + +`LockContext` + +##### waitForCompletion + +`boolean` = `false` + +#### Returns + +`Promise`\<`PendingOperation` \| `null`\> + +*** + +### handleOperationWithCompletion() + +```ts +protected handleOperationWithCompletion( + mutation, + context, + waitForCompletion, +handler): Promise; +``` + +Defined in: [PowerSyncTransactor.ts:232](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L232) + +Helper function which wraps a persistence operation by: +- Fetching the mutation's collection's SQLite table details +- Executing the mutation +- Returning the last pending diff operation if required + +#### Parameters + +##### mutation + +`PendingMutation`\<`any`\> + +##### context + +`LockContext` + +##### waitForCompletion + +`boolean` + +##### handler + +(`tableName`, `mutation`, `serializeValue`) => `Promise`\<`void`\> + +#### Returns + +`Promise`\<`PendingOperation` \| `null`\> + +*** + +### handleUpdate() + +```ts +protected handleUpdate( + mutation, + context, +waitForCompletion): Promise; +``` + +Defined in: [PowerSyncTransactor.ts:177](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L177) + +#### Parameters + +##### mutation + +`PendingMutation`\<`any`\> + +##### context + +`LockContext` + +##### waitForCompletion + +`boolean` = `false` + +#### Returns + +`Promise`\<`PendingOperation` \| `null`\> diff --git a/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md b/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md new file mode 100644 index 000000000..e18eebcb9 --- /dev/null +++ b/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md @@ -0,0 +1,213 @@ +--- +id: powerSyncCollectionOptions +title: powerSyncCollectionOptions +--- + +# Function: powerSyncCollectionOptions() + +Implementation of powerSyncCollectionOptions that handles both schema and non-schema configurations. + +## Call Signature + +```ts +function powerSyncCollectionOptions(config): EnhancedPowerSyncCollectionConfig, never>; +``` + +Defined in: [powersync.ts:71](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L71) + +Creates a PowerSync collection configuration with basic default validation. +Input and Output types are the SQLite column types. + +### Type Parameters + +#### TTable + +`TTable` *extends* `Table`\<`ColumnsType`\> = `Table`\<`ColumnsType`\> + +### Parameters + +#### config + +`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `never`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` + +### Returns + +[`EnhancedPowerSyncCollectionConfig`](../../type-aliases/EnhancedPowerSyncCollectionConfig.md)\<`TTable`, `OptionalExtractedTable`\<`TTable`\>, `never`\> + +### Example + +```typescript +const APP_SCHEMA = new Schema({ + documents: new Table({ + name: column.text, + }), +}) + +type Document = (typeof APP_SCHEMA)["types"]["documents"] + +const db = new PowerSyncDatabase({ + database: { + dbFilename: "test.sqlite", + }, + schema: APP_SCHEMA, +}) + +const collection = createCollection( + powerSyncCollectionOptions({ + database: db, + table: APP_SCHEMA.props.documents + }) +) +``` + +## Call Signature + +```ts +function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, UtilsRecord> & object & object; +``` + +Defined in: [powersync.ts:128](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L128) + +Creates a PowerSync collection configuration with schema validation. + +The input types satisfy the SQLite column types. + +The output types are defined by the provided schema. This schema can enforce additional +validation or type transforms. +Arbitrary output typed mutations are encoded to SQLite for persistence. We provide a basic standard +serialization implementation to serialize column values. Custom or advanced types require providing additional +serializer specifications. Partial column overrides can be supplied to `serializer`. + +### Type Parameters + +#### TTable + +`TTable` *extends* `Table`\<`ColumnsType`\> + +#### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`OptionalExtractedTable`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> + +### Parameters + +#### config + +`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `TSchema`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` & [`SerializerConfig`](../../type-aliases/SerializerConfig.md)\<`InferOutput`\<`TSchema`\>, `ExtractedTable`\<`TTable`\>\> & `object` + +### Returns + +`CollectionConfig`\<[`InferPowerSyncOutputType`](../../type-aliases/InferPowerSyncOutputType.md)\<`TTable`, `TSchema`\>, `string`, `TSchema`, `UtilsRecord`\> & `object` & `object` + +### Example + +```typescript +import { z } from "zod" + +// The PowerSync SQLite schema +const APP_SCHEMA = new Schema({ + documents: new Table({ + name: column.text, + // Dates are stored as ISO date strings in SQLite + created_at: column.text + }), +}) + +// Advanced Zod validations. The output type of this schema +// is constrained to the SQLite schema of APP_SCHEMA +const schema = z.object({ + id: z.string(), + // Notice that `name` is not nullable (is required) here and it has additional validation + name: z.string().min(3, { message: "Should be at least 3 characters" }).nullable(), + // The input type is still the SQLite string type. While collections will output smart Date instances. + created_at: z.string().transform(val => new Date(val)) +}) + +const collection = createCollection( + powerSyncCollectionOptions({ + database: db, + table: APP_SCHEMA.props.documents, + schema, + serializer: { + // The default is toISOString, this is just to demonstrate custom overrides + created_at: (outputValue) => outputValue.toISOString(), + }, + }) +) +``` + +## Call Signature + +```ts +function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, UtilsRecord> & object & object; +``` + +Defined in: [powersync.ts:196](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L196) + +Creates a PowerSync collection configuration with schema validation. + +The input types are not linked to the internal SQLite table types. This can +give greater flexibility, e.g. by accepting rich types as input for `insert` or `update` operations. +An additional `deserializationSchema` is required in order to process incoming SQLite updates to the output type. + +The output types are defined by the provided schema. This schema can enforce additional +validation or type transforms. +Arbitrary output typed mutations are encoded to SQLite for persistence. We provide a basic standard +serialization implementation to serialize column values. Custom or advanced types require providing additional +serializer specifications. Partial column overrides can be supplied to `serializer`. + +### Type Parameters + +#### TTable + +`TTable` *extends* `Table`\<`ColumnsType`\> + +#### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`AnyTableColumnType`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> + +### Parameters + +#### config + +`Omit`\<`BaseCollectionConfig`\<`ExtractedTable`\<`TTable`\>, `string`, `TSchema`, `UtilsRecord`, `any`\>, `"onInsert"` \| `"onUpdate"` \| `"onDelete"` \| `"getKey"`\> & `object` & [`SerializerConfig`](../../type-aliases/SerializerConfig.md)\<`InferOutput`\<`TSchema`\>, `ExtractedTable`\<`TTable`\>\> & `object` + +### Returns + +`CollectionConfig`\<[`InferPowerSyncOutputType`](../../type-aliases/InferPowerSyncOutputType.md)\<`TTable`, `TSchema`\>, `string`, `TSchema`, `UtilsRecord`\> & `object` & `object` + +### Example + +```typescript +import { z } from "zod" + +// The PowerSync SQLite schema +const APP_SCHEMA = new Schema({ + documents: new Table({ + name: column.text, + // Booleans are represented as integers in SQLite + is_active: column.integer + }), +}) + +// Advanced Zod validations. +// We accept boolean values as input for operations and expose Booleans in query results +const schema = z.object({ + id: z.string(), + isActive: z.boolean(), // TInput and TOutput are boolean +}) + +// The deserializationSchema converts the SQLite synced INTEGER (0/1) values to booleans. +const deserializationSchema = z.object({ + id: z.string(), + isActive: z.number().nullable().transform((val) => val == null ? true : val > 0), +}) + +const collection = createCollection( + powerSyncCollectionOptions({ + database: db, + table: APP_SCHEMA.props.documents, + schema, + deserializationSchema, + }) +) +``` diff --git a/docs/reference/powersync-db-collection/index.md b/docs/reference/powersync-db-collection/index.md new file mode 100644 index 000000000..c0894dac0 --- /dev/null +++ b/docs/reference/powersync-db-collection/index.md @@ -0,0 +1,33 @@ +--- +id: "@tanstack/powersync-db-collection" +title: "@tanstack/powersync-db-collection" +--- + +# @tanstack/powersync-db-collection + +## Classes + +- [PowerSyncTransactor](../classes/PowerSyncTransactor.md) + +## Type Aliases + +- [BasePowerSyncCollectionConfig](../type-aliases/BasePowerSyncCollectionConfig.md) +- [ConfigWithArbitraryCollectionTypes](../type-aliases/ConfigWithArbitraryCollectionTypes.md) +- [ConfigWithSQLiteInputType](../type-aliases/ConfigWithSQLiteInputType.md) +- [ConfigWithSQLiteTypes](../type-aliases/ConfigWithSQLiteTypes.md) +- [CustomSQLiteSerializer](../type-aliases/CustomSQLiteSerializer.md) +- [EnhancedPowerSyncCollectionConfig](../type-aliases/EnhancedPowerSyncCollectionConfig.md) +- [InferPowerSyncOutputType](../type-aliases/InferPowerSyncOutputType.md) +- [PowerSyncCollectionConfig](../type-aliases/PowerSyncCollectionConfig.md) +- [PowerSyncCollectionMeta](../type-aliases/PowerSyncCollectionMeta.md) +- [PowerSyncCollectionUtils](../type-aliases/PowerSyncCollectionUtils.md) +- [SerializerConfig](../type-aliases/SerializerConfig.md) +- [TransactorOptions](../type-aliases/TransactorOptions.md) + +## Variables + +- [DEFAULT\_BATCH\_SIZE](../variables/DEFAULT_BATCH_SIZE.md) + +## Functions + +- [powerSyncCollectionOptions](../functions/powerSyncCollectionOptions.md) diff --git a/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md new file mode 100644 index 000000000..ab1d26dcc --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md @@ -0,0 +1,58 @@ +--- +id: BasePowerSyncCollectionConfig +title: BasePowerSyncCollectionConfig +--- + +# Type Alias: BasePowerSyncCollectionConfig\ + +```ts +type BasePowerSyncCollectionConfig = Omit, string, TSchema>, "onInsert" | "onUpdate" | "onDelete" | "getKey"> & object; +``` + +Defined in: [definitions.ts:165](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L165) + +## Type Declaration + +### database + +```ts +database: AbstractPowerSyncDatabase; +``` + +The PowerSync database instance + +### syncBatchSize? + +```ts +optional syncBatchSize: number; +``` + +The maximum number of documents to read from the SQLite table +in a single batch during the initial sync between PowerSync and the +in-memory TanStack DB collection. + +#### Remarks + +- Defaults to [DEFAULT\_BATCH\_SIZE](../../variables/DEFAULT_BATCH_SIZE.md) if not specified. +- Larger values reduce the number of round trips to the storage + engine but increase memory usage per batch. +- Smaller values may lower memory usage and allow earlier + streaming of initial results, at the cost of more query calls. + +### table + +```ts +table: TTable; +``` + +The PowerSync schema Table definition + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` = `Table` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md new file mode 100644 index 000000000..a51250077 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md @@ -0,0 +1,62 @@ +--- +id: ConfigWithArbitraryCollectionTypes +title: ConfigWithArbitraryCollectionTypes +--- + +# Type Alias: ConfigWithArbitraryCollectionTypes\ + +```ts +type ConfigWithArbitraryCollectionTypes = SerializerConfig, ExtractedTable> & object; +``` + +Defined in: [definitions.ts:125](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L125) + +Config where TInput and TOutput have arbitrarily typed values. +The keys of the types need to equal the SQLite types. +Since TInput is not the SQLite types, we require a schema in order to deserialize incoming SQLite updates. The schema should validate from SQLite to TOutput. + +## Type Declaration + +### deserializationSchema + +```ts +deserializationSchema: StandardSchemaV1, StandardSchemaV1.InferOutput>; +``` + +Schema for deserializing and validating input data from the sync stream. + +This schema defines how to transform and validate data coming from SQLite types (as stored in the database) +into the desired output types (`TOutput`) expected by your application or validation logic. + +The generic parameters allow for arbitrary input and output types, so you can specify custom conversion rules +for each column. This is especially useful when your application expects richer types (e.g., Date, enums, objects) +than what SQLite natively supports. + +Use this to ensure that incoming data from the sync stream is properly converted and validated before use. + +Example: +```typescript +deserializationSchema: z.object({ + createdAt: z.preprocess((val) => new Date(val as string), z.date()), + meta: z.preprocess((val) => JSON.parse(val as string), z.object({ ... })), +}) +``` + +This enables robust type safety and validation for incoming data, bridging the gap between SQLite storage +and your application's expected types. + +### schema + +```ts +schema: TSchema; +``` + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`AnyTableColumnType`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md new file mode 100644 index 000000000..1d58b51a6 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md @@ -0,0 +1,33 @@ +--- +id: ConfigWithSQLiteInputType +title: ConfigWithSQLiteInputType +--- + +# Type Alias: ConfigWithSQLiteInputType\ + +```ts +type ConfigWithSQLiteInputType = SerializerConfig, ExtractedTable> & object; +``` + +Defined in: [definitions.ts:106](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L106) + +Config where TInput is the SQLite types while TOutput can be defined by TSchema. +We can use the same schema to validate TInput and incoming SQLite changes. + +## Type Declaration + +### schema + +```ts +schema: TSchema; +``` + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`OptionalExtractedTable`\<`TTable`\>, `AnyTableColumnType`\<`TTable`\>\> diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md new file mode 100644 index 000000000..edc414511 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md @@ -0,0 +1,14 @@ +--- +id: ConfigWithSQLiteTypes +title: ConfigWithSQLiteTypes +--- + +# Type Alias: ConfigWithSQLiteTypes + +```ts +type ConfigWithSQLiteTypes = object; +``` + +Defined in: [definitions.ts:100](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L100) + +Config for when TInput and TOutput are both the SQLite types. diff --git a/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md b/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md new file mode 100644 index 000000000..898bf6119 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md @@ -0,0 +1,48 @@ +--- +id: CustomSQLiteSerializer +title: CustomSQLiteSerializer +--- + +# Type Alias: CustomSQLiteSerializer\ + +```ts +type CustomSQLiteSerializer = Partial<{ [Key in keyof TOutput]: (value: TOutput[Key]) => Key extends keyof TSQLite ? TSQLite[Key] : never }>; +``` + +Defined in: [definitions.ts:52](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L52) + +A mapping type for custom serialization of object properties to SQLite-compatible values. + +This type allows you to override, for keys in the input object (`TOutput`), a function that transforms +the value to the corresponding SQLite type (`TSQLite`). Keys not specified will use the default SQLite serialization. + +## Generics +- `TOutput`: The input object type, representing the row data to be serialized. +- `TSQLite`: The target SQLite-compatible type for each property, typically inferred from the table schema. + +## Usage +Use this type to define a map of serialization functions for specific keys when you need custom handling +(e.g., converting complex objects, formatting dates, or handling enums). + +Example: +```ts +const serializer: CustomSQLiteSerializer = { + createdAt: (date) => date.toISOString(), + status: (status) => status ? 1 : 0, + meta: (meta) => JSON.stringify(meta), +}; +``` + +## Behavior +- Each key maps to a function that receives the value and returns the SQLite-compatible value. +- Used by `serializeForSQLite` to override default serialization for specific columns. + +## Type Parameters + +### TOutput + +`TOutput` *extends* `Record`\<`string`, `unknown`\> + +### TSQLite + +`TSQLite` *extends* `Record`\<`string`, `unknown`\> diff --git a/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md new file mode 100644 index 000000000..79c292301 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md @@ -0,0 +1,48 @@ +--- +id: EnhancedPowerSyncCollectionConfig +title: EnhancedPowerSyncCollectionConfig +--- + +# Type Alias: EnhancedPowerSyncCollectionConfig\ + +```ts +type EnhancedPowerSyncCollectionConfig = CollectionConfig & object; +``` + +Defined in: [definitions.ts:254](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L254) + +A CollectionConfig which includes utilities for PowerSync. + +## Type Declaration + +### id? + +```ts +optional id: string; +``` + +### schema? + +```ts +optional schema: TSchema; +``` + +### utils + +```ts +utils: PowerSyncCollectionUtils; +``` + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` + +### OutputType + +`OutputType` *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md b/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md new file mode 100644 index 000000000..d7e31998e --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md @@ -0,0 +1,26 @@ +--- +id: InferPowerSyncOutputType +title: InferPowerSyncOutputType +--- + +# Type Alias: InferPowerSyncOutputType\ + +```ts +type InferPowerSyncOutputType = TSchema extends never ? ExtractedTable : InferSchemaOutput; +``` + +Defined in: [definitions.ts:20](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L20) + +Small helper which determines the output type if: +- Standard SQLite types are to be used OR +- If the provided schema should be used. + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` = `Table` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`PowerSyncRecord`\> = `never` diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md new file mode 100644 index 000000000..d06b3d3b7 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md @@ -0,0 +1,51 @@ +--- +id: PowerSyncCollectionConfig +title: PowerSyncCollectionConfig +--- + +# Type Alias: PowerSyncCollectionConfig\ + +```ts +type PowerSyncCollectionConfig = BasePowerSyncCollectionConfig & + | ConfigWithSQLiteTypes + | ConfigWithSQLiteInputType +| ConfigWithArbitraryCollectionTypes; +``` + +Defined in: [definitions.ts:222](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L222) + +Configuration options for creating a PowerSync collection. + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` = `Table` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1`\<`any`\> = `never` + +## Example + +```typescript +const APP_SCHEMA = new Schema({ + documents: new Table({ + name: column.text, + }), +}) + +const db = new PowerSyncDatabase({ + database: { + dbFilename: "test.sqlite", + }, + schema: APP_SCHEMA, +}) + +const collection = createCollection( + powerSyncCollectionOptions({ + database: db, + table: APP_SCHEMA.props.documents + }) +) +``` diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md new file mode 100644 index 000000000..1fab936e6 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md @@ -0,0 +1,66 @@ +--- +id: PowerSyncCollectionMeta +title: PowerSyncCollectionMeta +--- + +# Type Alias: PowerSyncCollectionMeta\ + +```ts +type PowerSyncCollectionMeta = object; +``` + +Defined in: [definitions.ts:235](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L235) + +Metadata for the PowerSync Collection. + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` = `Table` + +## Properties + +### serializeValue() + +```ts +serializeValue: (value) => ExtractedTable; +``` + +Defined in: [definitions.ts:248](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L248) + +Serializes a collection value to the SQLite type + +#### Parameters + +##### value + +`any` + +#### Returns + +`ExtractedTable`\<`TTable`\> + +*** + +### tableName + +```ts +tableName: string; +``` + +Defined in: [definitions.ts:239](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L239) + +The SQLite table representing the collection. + +*** + +### trackedTableName + +```ts +trackedTableName: string; +``` + +Defined in: [definitions.ts:243](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L243) + +The internal table used to track diffs for the collection. diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md new file mode 100644 index 000000000..28ab62975 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md @@ -0,0 +1,34 @@ +--- +id: PowerSyncCollectionUtils +title: PowerSyncCollectionUtils +--- + +# Type Alias: PowerSyncCollectionUtils\ + +```ts +type PowerSyncCollectionUtils = object; +``` + +Defined in: [definitions.ts:267](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L267) + +Collection-level utilities for PowerSync. + +## Type Parameters + +### TTable + +`TTable` *extends* `Table` = `Table` + +## Properties + +### getMeta() + +```ts +getMeta: () => PowerSyncCollectionMeta; +``` + +Defined in: [definitions.ts:268](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L268) + +#### Returns + +[`PowerSyncCollectionMeta`](../PowerSyncCollectionMeta.md)\<`TTable`\> diff --git a/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md b/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md new file mode 100644 index 000000000..f437cdbf2 --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md @@ -0,0 +1,77 @@ +--- +id: SerializerConfig +title: SerializerConfig +--- + +# Type Alias: SerializerConfig\ + +```ts +type SerializerConfig = object; +``` + +Defined in: [definitions.ts:61](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L61) + +## Type Parameters + +### TOutput + +`TOutput` *extends* `Record`\<`string`, `unknown`\> + +### TSQLite + +`TSQLite` *extends* `Record`\<`string`, `unknown`\> + +## Properties + +### onDeserializationError() + +```ts +onDeserializationError: (error) => void; +``` + +Defined in: [definitions.ts:94](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L94) + +Application logic should ensure that incoming synced data is always valid. +Failing to deserialize and apply incoming changes results in data inconsistency - which is a fatal error. +Use this callback to react to deserialization errors. + +#### Parameters + +##### error + +`StandardSchemaV1.FailureResult` + +#### Returns + +`void` + +*** + +### serializer? + +```ts +optional serializer: CustomSQLiteSerializer; +``` + +Defined in: [definitions.ts:87](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L87) + +Optional partial serializer object for customizing how individual columns are serialized for SQLite. + +This should be a partial map of column keys to serialization functions, following the +[CustomSQLiteSerializer](../CustomSQLiteSerializer.md) type. Each function receives the column value and returns a value +compatible with SQLite storage. + +If not provided for a column, the default behavior is used: + - `TEXT`: Strings are stored as-is; Dates are converted to ISO strings; other types are JSON-stringified. + - `INTEGER`/`REAL`: Numbers are stored as-is; booleans are mapped to 1/0. + +Use this option to override serialization for specific columns, such as formatting dates, handling enums, +or serializing complex objects. + +Example: +```typescript +serializer: { + createdAt: (date) => date.getTime(), // Store as timestamp + meta: (meta) => JSON.stringify(meta), // Custom object serialization +} +``` diff --git a/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md b/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md new file mode 100644 index 000000000..d38e7152f --- /dev/null +++ b/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md @@ -0,0 +1,22 @@ +--- +id: TransactorOptions +title: TransactorOptions +--- + +# Type Alias: TransactorOptions + +```ts +type TransactorOptions = object; +``` + +Defined in: [PowerSyncTransactor.ts:12](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L12) + +## Properties + +### database + +```ts +database: AbstractPowerSyncDatabase; +``` + +Defined in: [PowerSyncTransactor.ts:13](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L13) diff --git a/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md b/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md new file mode 100644 index 000000000..46f9f447a --- /dev/null +++ b/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md @@ -0,0 +1,14 @@ +--- +id: DEFAULT_BATCH_SIZE +title: DEFAULT_BATCH_SIZE +--- + +# Variable: DEFAULT\_BATCH\_SIZE + +```ts +const DEFAULT_BATCH_SIZE: 1000 = 1000; +``` + +Defined in: [definitions.ts:274](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L274) + +Default value for [PowerSyncCollectionConfig#syncBatchSize](../../type-aliases/BasePowerSyncCollectionConfig.md). diff --git a/docs/reference/type-aliases/ChangeListener.md b/docs/reference/type-aliases/ChangeListener.md new file mode 100644 index 000000000..7fb302ac4 --- /dev/null +++ b/docs/reference/type-aliases/ChangeListener.md @@ -0,0 +1,68 @@ +--- +id: ChangeListener +title: ChangeListener +--- + +# Type Alias: ChangeListener()\ + +```ts +type ChangeListener = (changes) => void; +``` + +Defined in: [packages/db/src/types.ts:717](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L717) + +Function type for listening to collection changes + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Parameters + +### changes + +[`ChangeMessage`](../../interfaces/ChangeMessage.md)\<`T`, `TKey`\>[] + +Array of change messages describing what happened + +## Returns + +`void` + +## Examples + +```ts +// Basic change listener +const listener: ChangeListener = (changes) => { + changes.forEach(change => { + console.log(`${change.type}: ${change.key}`, change.value) + }) +} + +collection.subscribeChanges(listener) +``` + +```ts +// Handle different change types +const listener: ChangeListener = (changes) => { + for (const change of changes) { + switch (change.type) { + case 'insert': + addToUI(change.value) + break + case 'update': + updateInUI(change.key, change.value, change.previousValue) + break + case 'delete': + removeFromUI(change.key) + break + } + } +} +``` diff --git a/docs/reference/type-aliases/ChangesPayload.md b/docs/reference/type-aliases/ChangesPayload.md new file mode 100644 index 000000000..92f1f161c --- /dev/null +++ b/docs/reference/type-aliases/ChangesPayload.md @@ -0,0 +1,18 @@ +--- +id: ChangesPayload +title: ChangesPayload +--- + +# Type Alias: ChangesPayload\ + +```ts +type ChangesPayload = ChangeMessage[]; +``` + +Defined in: [packages/db/src/types.ts:620](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L620) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> diff --git a/docs/reference/type-aliases/CleanupFn.md b/docs/reference/type-aliases/CleanupFn.md new file mode 100644 index 000000000..71ba43416 --- /dev/null +++ b/docs/reference/type-aliases/CleanupFn.md @@ -0,0 +1,16 @@ +--- +id: CleanupFn +title: CleanupFn +--- + +# Type Alias: CleanupFn() + +```ts +type CleanupFn = () => void; +``` + +Defined in: [packages/db/src/types.ts:226](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L226) + +## Returns + +`void` diff --git a/docs/reference/type-aliases/ClearStorageFn.md b/docs/reference/type-aliases/ClearStorageFn.md new file mode 100644 index 000000000..05751d091 --- /dev/null +++ b/docs/reference/type-aliases/ClearStorageFn.md @@ -0,0 +1,18 @@ +--- +id: ClearStorageFn +title: ClearStorageFn +--- + +# Type Alias: ClearStorageFn() + +```ts +type ClearStorageFn = () => void; +``` + +Defined in: [packages/db/src/local-storage.ts:90](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L90) + +Type for the clear utility function + +## Returns + +`void` diff --git a/docs/reference/type-aliases/CollectionConfigSingleRowOption.md b/docs/reference/type-aliases/CollectionConfigSingleRowOption.md new file mode 100644 index 000000000..c498f5aec --- /dev/null +++ b/docs/reference/type-aliases/CollectionConfigSingleRowOption.md @@ -0,0 +1,31 @@ +--- +id: CollectionConfigSingleRowOption +title: CollectionConfigSingleRowOption +--- + +# Type Alias: CollectionConfigSingleRowOption\ + +```ts +type CollectionConfigSingleRowOption = CollectionConfig & MaybeSingleResult; +``` + +Defined in: [packages/db/src/types.ts:613](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L613) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TSchema + +`TSchema` *extends* `StandardSchemaV1` = `never` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = \{ +\} diff --git a/docs/reference/type-aliases/CollectionStatus.md b/docs/reference/type-aliases/CollectionStatus.md new file mode 100644 index 000000000..d4d9e4443 --- /dev/null +++ b/docs/reference/type-aliases/CollectionStatus.md @@ -0,0 +1,31 @@ +--- +id: CollectionStatus +title: CollectionStatus +--- + +# Type Alias: CollectionStatus + +```ts +type CollectionStatus = "idle" | "loading" | "ready" | "error" | "cleaned-up"; +``` + +Defined in: [packages/db/src/types.ts:371](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L371) + +Collection status values for lifecycle management + +## Examples + +```ts +// Check collection status +if (collection.status === "loading") { + console.log("Collection is loading initial data") +} else if (collection.status === "ready") { + console.log("Collection is ready for use") +} +``` + +```ts +// Status transitions +// idle → loading → ready (when markReady() is called) +// Any status can transition to → error or cleaned-up +``` diff --git a/docs/reference/type-aliases/DeleteMutationFn.md b/docs/reference/type-aliases/DeleteMutationFn.md new file mode 100644 index 000000000..ef9da1116 --- /dev/null +++ b/docs/reference/type-aliases/DeleteMutationFn.md @@ -0,0 +1,40 @@ +--- +id: DeleteMutationFn +title: DeleteMutationFn +--- + +# Type Alias: DeleteMutationFn()\ + +```ts +type DeleteMutationFn = (params) => Promise; +``` + +Defined in: [packages/db/src/types.ts:349](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L349) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +### TReturn + +`TReturn` = `any` + +## Parameters + +### params + +[`DeleteMutationFnParams`](../DeleteMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> + +## Returns + +`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/DeleteMutationFnParams.md b/docs/reference/type-aliases/DeleteMutationFnParams.md new file mode 100644 index 000000000..949b12bd3 --- /dev/null +++ b/docs/reference/type-aliases/DeleteMutationFnParams.md @@ -0,0 +1,46 @@ +--- +id: DeleteMutationFnParams +title: DeleteMutationFnParams +--- + +# Type Alias: DeleteMutationFnParams\ + +```ts +type DeleteMutationFnParams = object; +``` + +Defined in: [packages/db/src/types.ts:326](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L326) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +## Properties + +### collection + +```ts +collection: Collection; +``` + +Defined in: [packages/db/src/types.ts:332](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L332) + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: [packages/db/src/types.ts:331](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L331) diff --git a/docs/reference/type-aliases/Fn.md b/docs/reference/type-aliases/Fn.md new file mode 100644 index 000000000..208899f6b --- /dev/null +++ b/docs/reference/type-aliases/Fn.md @@ -0,0 +1,24 @@ +--- +id: Fn +title: Fn +--- + +# Type Alias: Fn() + +```ts +type Fn = (...args) => any; +``` + +Defined in: [packages/db/src/types.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L35) + +Represents a utility function that can be attached to a collection + +## Parameters + +### args + +...`any`[] + +## Returns + +`any` diff --git a/docs/reference/type-aliases/GetResult.md b/docs/reference/type-aliases/GetResult.md new file mode 100644 index 000000000..390412903 --- /dev/null +++ b/docs/reference/type-aliases/GetResult.md @@ -0,0 +1,42 @@ +--- +id: GetResult +title: GetResult +--- + +# Type Alias: GetResult\ + +```ts +type GetResult = Prettify; +``` + +Defined in: [packages/db/src/query/builder/types.ts:661](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L661) + +GetResult - Determines the final result type of a query + +This type implements the logic for what a query returns based on its current state: + +**Priority Order**: +1. **Explicit Result**: If `select()` was called, use the projected type +2. **Join Query**: If joins exist, return all tables with proper optionality +3. **Single Table**: Return just the main table from `from()` + +**Examples**: +```typescript +// Single table query: +from({ users }).where(...) // → User[] + +// Join query without select: +from({ users }).leftJoin({ orders }, ...) // → { users: User, orders: Order | undefined }[] + +// Query with select: +from({ users }).select({ id: users.id, name: users.name }) // → { id: number, name: string }[] +``` + +The `Prettify` wrapper ensures clean type display in IDEs by flattening +complex intersection types into readable object types. + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/GetStorageSizeFn.md b/docs/reference/type-aliases/GetStorageSizeFn.md new file mode 100644 index 000000000..2008fbbd6 --- /dev/null +++ b/docs/reference/type-aliases/GetStorageSizeFn.md @@ -0,0 +1,18 @@ +--- +id: GetStorageSizeFn +title: GetStorageSizeFn +--- + +# Type Alias: GetStorageSizeFn() + +```ts +type GetStorageSizeFn = () => number; +``` + +Defined in: [packages/db/src/local-storage.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L95) + +Type for the getStorageSize utility function + +## Returns + +`number` diff --git a/docs/reference/type-aliases/IndexConstructor.md b/docs/reference/type-aliases/IndexConstructor.md new file mode 100644 index 000000000..fa3e2d37b --- /dev/null +++ b/docs/reference/type-aliases/IndexConstructor.md @@ -0,0 +1,42 @@ +--- +id: IndexConstructor +title: IndexConstructor +--- + +# Type Alias: IndexConstructor()\ + +```ts +type IndexConstructor = (id, expression, name?, options?) => BaseIndex; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:201](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L201) + +Type for index constructor + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Parameters + +### id + +`number` + +### expression + +[`BasicExpression`](../../@tanstack/namespaces/IR/type-aliases/BasicExpression.md) + +### name? + +`string` + +### options? + +`any` + +## Returns + +[`BaseIndex`](../../classes/BaseIndex.md)\<`TKey`\> diff --git a/docs/reference/type-aliases/IndexOperation.md b/docs/reference/type-aliases/IndexOperation.md new file mode 100644 index 000000000..3dbce14d1 --- /dev/null +++ b/docs/reference/type-aliases/IndexOperation.md @@ -0,0 +1,14 @@ +--- +id: IndexOperation +title: IndexOperation +--- + +# Type Alias: IndexOperation + +```ts +type IndexOperation = typeof comparisonFunctions[number]; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L11) + +Type for index operation values diff --git a/docs/reference/type-aliases/IndexResolver.md b/docs/reference/type-aliases/IndexResolver.md new file mode 100644 index 000000000..8dcd5c3e5 --- /dev/null +++ b/docs/reference/type-aliases/IndexResolver.md @@ -0,0 +1,22 @@ +--- +id: IndexResolver +title: IndexResolver +--- + +# Type Alias: IndexResolver\ + +```ts +type IndexResolver = + | IndexConstructor +| () => Promise>; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L212) + +Index resolver can be either a class constructor or async loader + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` diff --git a/docs/reference/type-aliases/InferResultType.md b/docs/reference/type-aliases/InferResultType.md new file mode 100644 index 000000000..cb1dceaa3 --- /dev/null +++ b/docs/reference/type-aliases/InferResultType.md @@ -0,0 +1,20 @@ +--- +id: InferResultType +title: InferResultType +--- + +# Type Alias: InferResultType\ + +```ts +type InferResultType = TContext extends SingleResult ? GetResult | undefined : GetResult[]; +``` + +Defined in: [packages/db/src/query/builder/types.ts:631](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L631) + +Utility type to infer the query result size (single row or an array) + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/InferSchemaInput.md b/docs/reference/type-aliases/InferSchemaInput.md new file mode 100644 index 000000000..57dc50542 --- /dev/null +++ b/docs/reference/type-aliases/InferSchemaInput.md @@ -0,0 +1,24 @@ +--- +id: InferSchemaInput +title: InferSchemaInput +--- + +# Type Alias: InferSchemaInput\ + +```ts +type InferSchemaInput = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record; +``` + +Defined in: [packages/db/src/types.ts:24](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L24) + +**`Internal`** + +Helper type to extract the input type from a standard schema + + This is used for collection insert type inference + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/InferSchemaOutput.md b/docs/reference/type-aliases/InferSchemaOutput.md new file mode 100644 index 000000000..5bb8ccc91 --- /dev/null +++ b/docs/reference/type-aliases/InferSchemaOutput.md @@ -0,0 +1,24 @@ +--- +id: InferSchemaOutput +title: InferSchemaOutput +--- + +# Type Alias: InferSchemaOutput\ + +```ts +type InferSchemaOutput = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record; +``` + +Defined in: [packages/db/src/types.ts:13](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L13) + +**`Internal`** + +Helper type to extract the output type from a standard schema + + This is used by the type resolution system + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/InitialQueryBuilder.md b/docs/reference/type-aliases/InitialQueryBuilder.md new file mode 100644 index 000000000..0c3b8349b --- /dev/null +++ b/docs/reference/type-aliases/InitialQueryBuilder.md @@ -0,0 +1,12 @@ +--- +id: InitialQueryBuilder +title: InitialQueryBuilder +--- + +# Type Alias: InitialQueryBuilder + +```ts +type InitialQueryBuilder = Pick, "from">; +``` + +Defined in: [packages/db/src/query/builder/index.ts:820](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L820) diff --git a/docs/reference/type-aliases/InputRow.md b/docs/reference/type-aliases/InputRow.md new file mode 100644 index 000000000..950b9af2f --- /dev/null +++ b/docs/reference/type-aliases/InputRow.md @@ -0,0 +1,14 @@ +--- +id: InputRow +title: InputRow +--- + +# Type Alias: InputRow + +```ts +type InputRow = [unknown, Record]; +``` + +Defined in: [packages/db/src/types.ts:627](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L627) + +An input row from a collection diff --git a/docs/reference/type-aliases/InsertMutationFn.md b/docs/reference/type-aliases/InsertMutationFn.md new file mode 100644 index 000000000..62c812d71 --- /dev/null +++ b/docs/reference/type-aliases/InsertMutationFn.md @@ -0,0 +1,40 @@ +--- +id: InsertMutationFn +title: InsertMutationFn +--- + +# Type Alias: InsertMutationFn()\ + +```ts +type InsertMutationFn = (params) => Promise; +``` + +Defined in: [packages/db/src/types.ts:335](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L335) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +### TReturn + +`TReturn` = `any` + +## Parameters + +### params + +[`InsertMutationFnParams`](../InsertMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> + +## Returns + +`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/InsertMutationFnParams.md b/docs/reference/type-aliases/InsertMutationFnParams.md new file mode 100644 index 000000000..e17032a45 --- /dev/null +++ b/docs/reference/type-aliases/InsertMutationFnParams.md @@ -0,0 +1,46 @@ +--- +id: InsertMutationFnParams +title: InsertMutationFnParams +--- + +# Type Alias: InsertMutationFnParams\ + +```ts +type InsertMutationFnParams = object; +``` + +Defined in: [packages/db/src/types.ts:318](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L318) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +## Properties + +### collection + +```ts +collection: Collection; +``` + +Defined in: [packages/db/src/types.ts:324](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L324) + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: [packages/db/src/types.ts:323](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L323) diff --git a/docs/reference/type-aliases/KeyedNamespacedRow.md b/docs/reference/type-aliases/KeyedNamespacedRow.md new file mode 100644 index 000000000..01348ec06 --- /dev/null +++ b/docs/reference/type-aliases/KeyedNamespacedRow.md @@ -0,0 +1,15 @@ +--- +id: KeyedNamespacedRow +title: KeyedNamespacedRow +--- + +# Type Alias: KeyedNamespacedRow + +```ts +type KeyedNamespacedRow = [unknown, NamespacedRow]; +``` + +Defined in: [packages/db/src/types.ts:650](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L650) + +A keyed namespaced row is a row with a key and a namespaced row +This is the main representation of a row in a query pipeline diff --git a/docs/reference/type-aliases/KeyedStream.md b/docs/reference/type-aliases/KeyedStream.md new file mode 100644 index 000000000..a979f48f5 --- /dev/null +++ b/docs/reference/type-aliases/KeyedStream.md @@ -0,0 +1,15 @@ +--- +id: KeyedStream +title: KeyedStream +--- + +# Type Alias: KeyedStream + +```ts +type KeyedStream = IStreamBuilder; +``` + +Defined in: [packages/db/src/types.ts:633](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L633) + +A keyed stream is a stream of rows +This is used as the inputs from a collection to a query diff --git a/docs/reference/type-aliases/LiveQueryCollectionUtils.md b/docs/reference/type-aliases/LiveQueryCollectionUtils.md new file mode 100644 index 000000000..f9dc2690d --- /dev/null +++ b/docs/reference/type-aliases/LiveQueryCollectionUtils.md @@ -0,0 +1,78 @@ +--- +id: LiveQueryCollectionUtils +title: LiveQueryCollectionUtils +--- + +# Type Alias: LiveQueryCollectionUtils + +```ts +type LiveQueryCollectionUtils = UtilsRecord & object; +``` + +Defined in: [packages/db/src/query/live/collection-config-builder.ts:36](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/collection-config-builder.ts#L36) + +## Type Declaration + +### getBuilder() + +```ts +getBuilder: () => CollectionConfigBuilder; +``` + +#### Returns + +`CollectionConfigBuilder`\<`any`, `any`\> + +### getRunCount() + +```ts +getRunCount: () => number; +``` + +#### Returns + +`number` + +### getWindow() + +```ts +getWindow: () => + | { + limit: number; + offset: number; +} + | undefined; +``` + +Gets the current window (offset and limit) for an ordered query. + +#### Returns + + \| \{ + `limit`: `number`; + `offset`: `number`; +\} + \| `undefined` + +The current window settings, or `undefined` if the query is not windowed + +### setWindow() + +```ts +setWindow: (options) => true | Promise; +``` + +Sets the offset and limit of an ordered query. +Is a no-op if the query is not ordered. + +#### Parameters + +##### options + +`WindowOptions` + +#### Returns + +`true` \| `Promise`\<`void`\> + +`true` if no subset loading was triggered, or `Promise` that resolves when the subset has been loaded diff --git a/docs/reference/type-aliases/LoadSubsetFn.md b/docs/reference/type-aliases/LoadSubsetFn.md new file mode 100644 index 000000000..672b10849 --- /dev/null +++ b/docs/reference/type-aliases/LoadSubsetFn.md @@ -0,0 +1,22 @@ +--- +id: LoadSubsetFn +title: LoadSubsetFn +--- + +# Type Alias: LoadSubsetFn() + +```ts +type LoadSubsetFn = (options) => true | Promise; +``` + +Defined in: [packages/db/src/types.ts:224](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L224) + +## Parameters + +### options + +[`LoadSubsetOptions`](../LoadSubsetOptions.md) + +## Returns + +`true` \| `Promise`\<`void`\> diff --git a/docs/reference/type-aliases/LoadSubsetOptions.md b/docs/reference/type-aliases/LoadSubsetOptions.md new file mode 100644 index 000000000..68130510e --- /dev/null +++ b/docs/reference/type-aliases/LoadSubsetOptions.md @@ -0,0 +1,68 @@ +--- +id: LoadSubsetOptions +title: LoadSubsetOptions +--- + +# Type Alias: LoadSubsetOptions + +```ts +type LoadSubsetOptions = object; +``` + +Defined in: [packages/db/src/types.ts:206](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L206) + +## Properties + +### limit? + +```ts +optional limit: number; +``` + +Defined in: [packages/db/src/types.ts:212](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L212) + +The limit of the data to load + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: [packages/db/src/types.ts:210](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L210) + +The order by clause to sort the data + +*** + +### subscription? + +```ts +optional subscription: Subscription; +``` + +Defined in: [packages/db/src/types.ts:221](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L221) + +The subscription that triggered the load. +Advanced sync implementations can use this for: +- LRU caching keyed by subscription +- Reference counting to track active subscriptions +- Subscribing to subscription events (e.g., finalization/unsubscribe) + +#### Optional + +Available when called from CollectionSubscription, may be undefined for direct calls + +*** + +### where? + +```ts +optional where: BasicExpression; +``` + +Defined in: [packages/db/src/types.ts:208](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L208) + +The where expression to filter the data diff --git a/docs/reference/type-aliases/MaybeSingleResult.md b/docs/reference/type-aliases/MaybeSingleResult.md new file mode 100644 index 000000000..7760f69d5 --- /dev/null +++ b/docs/reference/type-aliases/MaybeSingleResult.md @@ -0,0 +1,24 @@ +--- +id: MaybeSingleResult +title: MaybeSingleResult +--- + +# Type Alias: MaybeSingleResult + +```ts +type MaybeSingleResult = object; +``` + +Defined in: [packages/db/src/types.ts:605](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L605) + +## Properties + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: [packages/db/src/types.ts:609](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L609) + +If enabled the collection will return a single object instead of an array diff --git a/docs/reference/type-aliases/MutationFn.md b/docs/reference/type-aliases/MutationFn.md new file mode 100644 index 000000000..3e5d48e9e --- /dev/null +++ b/docs/reference/type-aliases/MutationFn.md @@ -0,0 +1,28 @@ +--- +id: MutationFn +title: MutationFn +--- + +# Type Alias: MutationFn()\ + +```ts +type MutationFn = (params) => Promise; +``` + +Defined in: [packages/db/src/types.ts:95](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L95) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Parameters + +### params + +[`MutationFnParams`](../MutationFnParams.md)\<`T`\> + +## Returns + +`Promise`\<`any`\> diff --git a/docs/reference/type-aliases/MutationFnParams.md b/docs/reference/type-aliases/MutationFnParams.md new file mode 100644 index 000000000..ed423fdbf --- /dev/null +++ b/docs/reference/type-aliases/MutationFnParams.md @@ -0,0 +1,30 @@ +--- +id: MutationFnParams +title: MutationFnParams +--- + +# Type Alias: MutationFnParams\ + +```ts +type MutationFnParams = object; +``` + +Defined in: [packages/db/src/types.ts:91](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L91) + +Configuration options for creating a new transaction + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: [packages/db/src/types.ts:92](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L92) diff --git a/docs/reference/type-aliases/NamespacedAndKeyedStream.md b/docs/reference/type-aliases/NamespacedAndKeyedStream.md new file mode 100644 index 000000000..c6aa2fb4d --- /dev/null +++ b/docs/reference/type-aliases/NamespacedAndKeyedStream.md @@ -0,0 +1,16 @@ +--- +id: NamespacedAndKeyedStream +title: NamespacedAndKeyedStream +--- + +# Type Alias: NamespacedAndKeyedStream + +```ts +type NamespacedAndKeyedStream = IStreamBuilder; +``` + +Defined in: [packages/db/src/types.ts:657](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L657) + +A namespaced and keyed stream is a stream of rows +This is used throughout a query pipeline and as the output from a query without +a `select` clause. diff --git a/docs/reference/type-aliases/NamespacedRow.md b/docs/reference/type-aliases/NamespacedRow.md new file mode 100644 index 000000000..6dceb7967 --- /dev/null +++ b/docs/reference/type-aliases/NamespacedRow.md @@ -0,0 +1,14 @@ +--- +id: NamespacedRow +title: NamespacedRow +--- + +# Type Alias: NamespacedRow + +```ts +type NamespacedRow = Record>; +``` + +Defined in: [packages/db/src/types.ts:644](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L644) + +A namespaced row is a row withing a pipeline that had each table wrapped in its alias diff --git a/docs/reference/type-aliases/NonEmptyArray.md b/docs/reference/type-aliases/NonEmptyArray.md new file mode 100644 index 000000000..85f886519 --- /dev/null +++ b/docs/reference/type-aliases/NonEmptyArray.md @@ -0,0 +1,20 @@ +--- +id: NonEmptyArray +title: NonEmptyArray +--- + +# Type Alias: NonEmptyArray\ + +```ts +type NonEmptyArray = [T, ...T[]]; +``` + +Defined in: [packages/db/src/types.ts:102](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L102) + +Represents a non-empty array (at least one element) + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/NonSingleResult.md b/docs/reference/type-aliases/NonSingleResult.md new file mode 100644 index 000000000..18472c3c5 --- /dev/null +++ b/docs/reference/type-aliases/NonSingleResult.md @@ -0,0 +1,22 @@ +--- +id: NonSingleResult +title: NonSingleResult +--- + +# Type Alias: NonSingleResult + +```ts +type NonSingleResult = object; +``` + +Defined in: [packages/db/src/types.ts:601](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L601) + +## Properties + +### singleResult? + +```ts +optional singleResult: never; +``` + +Defined in: [packages/db/src/types.ts:602](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L602) diff --git a/docs/reference/type-aliases/OperationType.md b/docs/reference/type-aliases/OperationType.md new file mode 100644 index 000000000..43893ca58 --- /dev/null +++ b/docs/reference/type-aliases/OperationType.md @@ -0,0 +1,12 @@ +--- +id: OperationType +title: OperationType +--- + +# Type Alias: OperationType + +```ts +type OperationType = "insert" | "update" | "delete"; +``` + +Defined in: [packages/db/src/types.ts:152](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L152) diff --git a/docs/reference/type-aliases/QueryBuilder.md b/docs/reference/type-aliases/QueryBuilder.md new file mode 100644 index 000000000..95b56855d --- /dev/null +++ b/docs/reference/type-aliases/QueryBuilder.md @@ -0,0 +1,18 @@ +--- +id: QueryBuilder +title: QueryBuilder +--- + +# Type Alias: QueryBuilder\ + +```ts +type QueryBuilder = Omit, "from" | "_getQuery">; +``` + +Defined in: [packages/db/src/query/builder/index.ts:824](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L824) + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../../interfaces/Context.md) diff --git a/docs/reference/type-aliases/Ref.md b/docs/reference/type-aliases/Ref.md new file mode 100644 index 000000000..1340dc750 --- /dev/null +++ b/docs/reference/type-aliases/Ref.md @@ -0,0 +1,39 @@ +--- +id: Ref +title: Ref +--- + +# Type Alias: Ref\ + +```ts +type Ref = { [K in keyof T]: IsNonExactOptional extends true ? IsNonExactNullable extends true ? IsPlainObject> extends true ? Ref> | undefined : RefLeaf> | undefined : IsPlainObject> extends true ? Ref> | undefined : RefLeaf> | undefined : IsNonExactNullable extends true ? IsPlainObject> extends true ? Ref> | null : RefLeaf> | null : IsPlainObject extends true ? Ref : RefLeaf } & RefLeaf; +``` + +Defined in: [packages/db/src/query/builder/types.ts:493](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L493) + +Ref - The user-facing ref interface for the query builder + +This is a clean type that represents a reference to a value in the query, +designed for optimal IDE experience without internal implementation details. +It provides a recursive interface that allows nested property access while +preserving optionality and nullability correctly. + +When spread in select clauses, it correctly produces the underlying data type +without Ref wrappers, enabling clean spread operations. + +Example usage: +```typescript +// Clean interface - no internal properties visible +const users: Ref<{ id: number; profile?: { bio: string } }> = { ... } +users.id // Ref - clean display +users.profile?.bio // Ref - nested optional access works + +// Spread operations work cleanly: +select(({ user }) => ({ ...user })) // Returns User type, not Ref types +``` + +## Type Parameters + +### T + +`T` = `any` diff --git a/docs/reference/type-aliases/ResolveTransactionChanges.md b/docs/reference/type-aliases/ResolveTransactionChanges.md new file mode 100644 index 000000000..cbf36e6f8 --- /dev/null +++ b/docs/reference/type-aliases/ResolveTransactionChanges.md @@ -0,0 +1,30 @@ +--- +id: ResolveTransactionChanges +title: ResolveTransactionChanges +--- + +# Type Alias: ResolveTransactionChanges\ + +```ts +type ResolveTransactionChanges = TOperation extends "delete" ? T : Partial; +``` + +Defined in: [packages/db/src/types.ts:48](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L48) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TOperation + +`TOperation` *extends* [`OperationType`](../OperationType.md) = [`OperationType`](../OperationType.md) + +## Remarks + +`update` and `insert` are both represented as `Partial`, but changes for `insert` could me made more precise by inferring the schema input type. In practice, this has almost 0 real world impact so it's not worth the added type complexity. + +## See + +https://github.com/TanStack/db/pull/209#issuecomment-3053001206 diff --git a/docs/reference/type-aliases/ResultStream.md b/docs/reference/type-aliases/ResultStream.md new file mode 100644 index 000000000..f61b629ac --- /dev/null +++ b/docs/reference/type-aliases/ResultStream.md @@ -0,0 +1,15 @@ +--- +id: ResultStream +title: ResultStream +--- + +# Type Alias: ResultStream + +```ts +type ResultStream = IStreamBuilder<[unknown, [any, string | undefined]]>; +``` + +Defined in: [packages/db/src/types.ts:639](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L639) + +Result stream type representing the output of compiled queries +Always returns [key, [result, orderByIndex]] where orderByIndex is undefined for unordered queries diff --git a/docs/reference/type-aliases/Row.md b/docs/reference/type-aliases/Row.md new file mode 100644 index 000000000..4473d7712 --- /dev/null +++ b/docs/reference/type-aliases/Row.md @@ -0,0 +1,18 @@ +--- +id: Row +title: Row +--- + +# Type Alias: Row\ + +```ts +type Row = Record>; +``` + +Defined in: [packages/db/src/types.ts:150](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L150) + +## Type Parameters + +### TExtensions + +`TExtensions` = `never` diff --git a/docs/reference/type-aliases/SingleResult.md b/docs/reference/type-aliases/SingleResult.md new file mode 100644 index 000000000..5d7a47e42 --- /dev/null +++ b/docs/reference/type-aliases/SingleResult.md @@ -0,0 +1,22 @@ +--- +id: SingleResult +title: SingleResult +--- + +# Type Alias: SingleResult + +```ts +type SingleResult = object; +``` + +Defined in: [packages/db/src/types.ts:597](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L597) + +## Properties + +### singleResult + +```ts +singleResult: true; +``` + +Defined in: [packages/db/src/types.ts:598](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L598) diff --git a/docs/reference/type-aliases/Source.md b/docs/reference/type-aliases/Source.md new file mode 100644 index 000000000..3d5b59b01 --- /dev/null +++ b/docs/reference/type-aliases/Source.md @@ -0,0 +1,29 @@ +--- +id: Source +title: Source +--- + +# Type Alias: Source + +```ts +type Source = object; +``` + +Defined in: [packages/db/src/query/builder/types.ts:75](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/types.ts#L75) + +Source - Input definition for query builder `from()` clause + +Maps table aliases to either: +- `CollectionImpl`: A database collection/table +- `QueryBuilder`: A subquery that can be used as a table + +Example: `{ users: usersCollection, orders: ordersCollection }` + +## Index Signature + +```ts +[alias: string]: + | CollectionImpl, any> +| QueryBuilder +``` diff --git a/docs/reference/type-aliases/StandardSchema.md b/docs/reference/type-aliases/StandardSchema.md new file mode 100644 index 000000000..fcdf7607c --- /dev/null +++ b/docs/reference/type-aliases/StandardSchema.md @@ -0,0 +1,47 @@ +--- +id: StandardSchema +title: StandardSchema +--- + +# Type Alias: StandardSchema\ + +```ts +type StandardSchema = StandardSchemaV1 & object; +``` + +Defined in: [packages/db/src/types.ts:283](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L283) + +The Standard Schema interface. +This follows the standard-schema specification: https://github.com/standard-schema/standard-schema + +## Type Declaration + +### ~standard + +```ts +~standard: object; +``` + +#### ~standard.types? + +```ts +optional types: object; +``` + +#### ~standard.types.input + +```ts +input: T; +``` + +#### ~standard.types.output + +```ts +output: T; +``` + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/StandardSchemaAlias.md b/docs/reference/type-aliases/StandardSchemaAlias.md new file mode 100644 index 000000000..7551f9bdb --- /dev/null +++ b/docs/reference/type-aliases/StandardSchemaAlias.md @@ -0,0 +1,20 @@ +--- +id: StandardSchemaAlias +title: StandardSchemaAlias +--- + +# Type Alias: StandardSchemaAlias\ + +```ts +type StandardSchemaAlias = StandardSchema; +``` + +Defined in: [packages/db/src/types.ts:295](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L295) + +Type alias for StandardSchema + +## Type Parameters + +### T + +`T` = `unknown` diff --git a/docs/reference/type-aliases/StorageApi.md b/docs/reference/type-aliases/StorageApi.md new file mode 100644 index 000000000..fde4dcad5 --- /dev/null +++ b/docs/reference/type-aliases/StorageApi.md @@ -0,0 +1,14 @@ +--- +id: StorageApi +title: StorageApi +--- + +# Type Alias: StorageApi + +```ts +type StorageApi = Pick; +``` + +Defined in: [packages/db/src/local-storage.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L23) + +Storage API interface - subset of DOM Storage that we need diff --git a/docs/reference/type-aliases/StorageEventApi.md b/docs/reference/type-aliases/StorageEventApi.md new file mode 100644 index 000000000..4e3d8f10a --- /dev/null +++ b/docs/reference/type-aliases/StorageEventApi.md @@ -0,0 +1,62 @@ +--- +id: StorageEventApi +title: StorageEventApi +--- + +# Type Alias: StorageEventApi + +```ts +type StorageEventApi = object; +``` + +Defined in: [packages/db/src/local-storage.ts:28](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L28) + +Storage event API - subset of Window for 'storage' events only + +## Properties + +### addEventListener() + +```ts +addEventListener: (type, listener) => void; +``` + +Defined in: [packages/db/src/local-storage.ts:29](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L29) + +#### Parameters + +##### type + +`"storage"` + +##### listener + +(`event`) => `void` + +#### Returns + +`void` + +*** + +### removeEventListener() + +```ts +removeEventListener: (type, listener) => void; +``` + +Defined in: [packages/db/src/local-storage.ts:33](https://github.com/TanStack/db/blob/main/packages/db/src/local-storage.ts#L33) + +#### Parameters + +##### type + +`"storage"` + +##### listener + +(`event`) => `void` + +#### Returns + +`void` diff --git a/docs/reference/type-aliases/Strategy.md b/docs/reference/type-aliases/Strategy.md new file mode 100644 index 000000000..561cefb37 --- /dev/null +++ b/docs/reference/type-aliases/Strategy.md @@ -0,0 +1,18 @@ +--- +id: Strategy +title: Strategy +--- + +# Type Alias: Strategy + +```ts +type Strategy = + | DebounceStrategy + | QueueStrategy + | ThrottleStrategy + | BatchStrategy; +``` + +Defined in: [packages/db/src/strategies/types.ts:113](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L113) + +Union type of all available strategies diff --git a/docs/reference/type-aliases/StrategyOptions.md b/docs/reference/type-aliases/StrategyOptions.md new file mode 100644 index 000000000..e4b212030 --- /dev/null +++ b/docs/reference/type-aliases/StrategyOptions.md @@ -0,0 +1,20 @@ +--- +id: StrategyOptions +title: StrategyOptions +--- + +# Type Alias: StrategyOptions\ + +```ts +type StrategyOptions = T extends DebounceStrategy ? DebounceStrategyOptions : T extends QueueStrategy ? QueueStrategyOptions : T extends ThrottleStrategy ? ThrottleStrategyOptions : T extends BatchStrategy ? BatchStrategyOptions : never; +``` + +Defined in: [packages/db/src/strategies/types.ts:122](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L122) + +Extract the options type from a strategy + +## Type Parameters + +### T + +`T` *extends* [`Strategy`](../Strategy.md) diff --git a/docs/reference/type-aliases/SubscriptionEvents.md b/docs/reference/type-aliases/SubscriptionEvents.md new file mode 100644 index 000000000..224829d18 --- /dev/null +++ b/docs/reference/type-aliases/SubscriptionEvents.md @@ -0,0 +1,54 @@ +--- +id: SubscriptionEvents +title: SubscriptionEvents +--- + +# Type Alias: SubscriptionEvents + +```ts +type SubscriptionEvents = object; +``` + +Defined in: [packages/db/src/types.ts:190](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L190) + +All subscription events + +## Properties + +### status:change + +```ts +status:change: SubscriptionStatusChangeEvent; +``` + +Defined in: [packages/db/src/types.ts:191](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L191) + +*** + +### status:loadingSubset + +```ts +status:loadingSubset: SubscriptionStatusEvent<"loadingSubset">; +``` + +Defined in: [packages/db/src/types.ts:193](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L193) + +*** + +### status:ready + +```ts +status:ready: SubscriptionStatusEvent<"ready">; +``` + +Defined in: [packages/db/src/types.ts:192](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L192) + +*** + +### unsubscribed + +```ts +unsubscribed: SubscriptionUnsubscribedEvent; +``` + +Defined in: [packages/db/src/types.ts:194](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L194) diff --git a/docs/reference/type-aliases/SubscriptionStatus.md b/docs/reference/type-aliases/SubscriptionStatus.md new file mode 100644 index 000000000..179b3e5dc --- /dev/null +++ b/docs/reference/type-aliases/SubscriptionStatus.md @@ -0,0 +1,14 @@ +--- +id: SubscriptionStatus +title: SubscriptionStatus +--- + +# Type Alias: SubscriptionStatus + +```ts +type SubscriptionStatus = "ready" | "loadingSubset"; +``` + +Defined in: [packages/db/src/types.ts:157](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L157) + +Subscription status values diff --git a/docs/reference/type-aliases/SyncConfigRes.md b/docs/reference/type-aliases/SyncConfigRes.md new file mode 100644 index 000000000..87c58dbce --- /dev/null +++ b/docs/reference/type-aliases/SyncConfigRes.md @@ -0,0 +1,32 @@ +--- +id: SyncConfigRes +title: SyncConfigRes +--- + +# Type Alias: SyncConfigRes + +```ts +type SyncConfigRes = object; +``` + +Defined in: [packages/db/src/types.ts:228](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L228) + +## Properties + +### cleanup? + +```ts +optional cleanup: CleanupFn; +``` + +Defined in: [packages/db/src/types.ts:229](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L229) + +*** + +### loadSubset? + +```ts +optional loadSubset: LoadSubsetFn; +``` + +Defined in: [packages/db/src/types.ts:230](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L230) diff --git a/docs/reference/type-aliases/SyncMode.md b/docs/reference/type-aliases/SyncMode.md new file mode 100644 index 000000000..1f9614a96 --- /dev/null +++ b/docs/reference/type-aliases/SyncMode.md @@ -0,0 +1,12 @@ +--- +id: SyncMode +title: SyncMode +--- + +# Type Alias: SyncMode + +```ts +type SyncMode = "eager" | "on-demand"; +``` + +Defined in: [packages/db/src/types.ts:383](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L383) diff --git a/docs/reference/type-aliases/TransactionState.md b/docs/reference/type-aliases/TransactionState.md new file mode 100644 index 000000000..9fb9ed6b2 --- /dev/null +++ b/docs/reference/type-aliases/TransactionState.md @@ -0,0 +1,12 @@ +--- +id: TransactionState +title: TransactionState +--- + +# Type Alias: TransactionState + +```ts +type TransactionState = "pending" | "persisting" | "completed" | "failed"; +``` + +Defined in: [packages/db/src/types.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L30) diff --git a/docs/reference/type-aliases/TransactionWithMutations.md b/docs/reference/type-aliases/TransactionWithMutations.md new file mode 100644 index 000000000..f442f136d --- /dev/null +++ b/docs/reference/type-aliases/TransactionWithMutations.md @@ -0,0 +1,33 @@ +--- +id: TransactionWithMutations +title: TransactionWithMutations +--- + +# Type Alias: TransactionWithMutations\ + +```ts +type TransactionWithMutations = Transaction & object; +``` + +Defined in: [packages/db/src/types.ts:108](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L108) + +Utility type for a Transaction with at least one mutation +This is used internally by the Transaction.commit method + +## Type Declaration + +### mutations + +```ts +mutations: NonEmptyArray>; +``` + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TOperation + +`TOperation` *extends* [`OperationType`](../OperationType.md) = [`OperationType`](../OperationType.md) diff --git a/docs/reference/type-aliases/UpdateMutationFn.md b/docs/reference/type-aliases/UpdateMutationFn.md new file mode 100644 index 000000000..f58d1c6f4 --- /dev/null +++ b/docs/reference/type-aliases/UpdateMutationFn.md @@ -0,0 +1,40 @@ +--- +id: UpdateMutationFn +title: UpdateMutationFn +--- + +# Type Alias: UpdateMutationFn()\ + +```ts +type UpdateMutationFn = (params) => Promise; +``` + +Defined in: [packages/db/src/types.ts:342](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L342) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +### TReturn + +`TReturn` = `any` + +## Parameters + +### params + +[`UpdateMutationFnParams`](../UpdateMutationFnParams.md)\<`T`, `TKey`, `TUtils`\> + +## Returns + +`Promise`\<`TReturn`\> diff --git a/docs/reference/type-aliases/UpdateMutationFnParams.md b/docs/reference/type-aliases/UpdateMutationFnParams.md new file mode 100644 index 000000000..9fafe2e43 --- /dev/null +++ b/docs/reference/type-aliases/UpdateMutationFnParams.md @@ -0,0 +1,46 @@ +--- +id: UpdateMutationFnParams +title: UpdateMutationFnParams +--- + +# Type Alias: UpdateMutationFnParams\ + +```ts +type UpdateMutationFnParams = object; +``` + +Defined in: [packages/db/src/types.ts:309](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L309) + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +### TUtils + +`TUtils` *extends* [`UtilsRecord`](../UtilsRecord.md) = [`UtilsRecord`](../UtilsRecord.md) + +## Properties + +### collection + +```ts +collection: Collection; +``` + +Defined in: [packages/db/src/types.ts:315](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L315) + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: [packages/db/src/types.ts:314](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L314) diff --git a/docs/reference/type-aliases/UtilsRecord.md b/docs/reference/type-aliases/UtilsRecord.md new file mode 100644 index 000000000..309a1cfd9 --- /dev/null +++ b/docs/reference/type-aliases/UtilsRecord.md @@ -0,0 +1,14 @@ +--- +id: UtilsRecord +title: UtilsRecord +--- + +# Type Alias: UtilsRecord + +```ts +type UtilsRecord = Record; +``` + +Defined in: [packages/db/src/types.ts:40](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L40) + +A record of utilities (functions or getters) that can be attached to a collection diff --git a/docs/reference/type-aliases/WritableDeep.md b/docs/reference/type-aliases/WritableDeep.md new file mode 100644 index 000000000..342aea753 --- /dev/null +++ b/docs/reference/type-aliases/WritableDeep.md @@ -0,0 +1,18 @@ +--- +id: WritableDeep +title: WritableDeep +--- + +# Type Alias: WritableDeep\ + +```ts +type WritableDeep = T extends BuiltIns ? T : T extends (...arguments_) => unknown ? object extends WritableObjectDeep ? T : HasMultipleCallSignatures extends true ? T : (...arguments_) => ReturnType & WritableObjectDeep : T extends ReadonlyMap ? WritableMapDeep : T extends ReadonlySet ? WritableSetDeep : T extends ReadonlyArray ? WritableArrayDeep : T extends object ? WritableObjectDeep : unknown; +``` + +Defined in: [packages/db/src/types.ts:777](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L777) + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/variables/IndexOperation.md b/docs/reference/variables/IndexOperation.md new file mode 100644 index 000000000..e0ec16ffa --- /dev/null +++ b/docs/reference/variables/IndexOperation.md @@ -0,0 +1,14 @@ +--- +id: IndexOperation +title: IndexOperation +--- + +# Variable: IndexOperation + +```ts +const IndexOperation: readonly ["eq", "gt", "gte", "lt", "lte", "in", "like", "ilike"] = comparisonFunctions; +``` + +Defined in: [packages/db/src/indexes/base-index.ts:11](https://github.com/TanStack/db/blob/main/packages/db/src/indexes/base-index.ts#L11) + +Operations that indexes can support, imported from available comparison functions diff --git a/docs/reference/variables/Query.md b/docs/reference/variables/Query.md new file mode 100644 index 000000000..949fecdb5 --- /dev/null +++ b/docs/reference/variables/Query.md @@ -0,0 +1,12 @@ +--- +id: Query +title: Query +--- + +# Variable: Query + +```ts +const Query: InitialQueryBuilderConstructor = BaseQueryBuilder; +``` + +Defined in: [packages/db/src/query/builder/index.ts:831](https://github.com/TanStack/db/blob/main/packages/db/src/query/builder/index.ts#L831) From 50c5d1a50eea853875c51037aacbd66bfe405c29 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 5 Nov 2025 10:26:37 -0700 Subject: [PATCH 5/5] docs: Fix outdated comment about closure usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update QueryCollectionUtilsImpl class comment to accurately reflect that it now uses explicit dependency injection instead of closure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/query-db-collection/src/query.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/query-db-collection/src/query.ts b/packages/query-db-collection/src/query.ts index 2913e305c..73bcdf43b 100644 --- a/packages/query-db-collection/src/query.ts +++ b/packages/query-db-collection/src/query.ts @@ -207,8 +207,8 @@ interface QueryCollectionState { } /** - * Implementation class for QueryCollectionUtils that maintains proper closure - * and compatibility with testing frameworks + * Implementation class for QueryCollectionUtils with explicit dependency injection + * for better testability and architectural clarity */ class QueryCollectionUtilsImpl { private state: QueryCollectionState