diff --git a/docs/framework/angular/reference/functions/injectLiveQuery.md b/docs/framework/angular/reference/functions/injectLiveQuery.md index 46a9a35fb..ab24eb0b9 100644 --- a/docs/framework/angular/reference/functions/injectLiveQuery.md +++ b/docs/framework/angular/reference/functions/injectLiveQuery.md @@ -11,7 +11,7 @@ title: injectLiveQuery function injectLiveQuery(options): InjectLiveQueryResult<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>; ``` -Defined in: [index.ts:51](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L51) +Defined in: index.ts:51 ### Type Parameters @@ -45,7 +45,7 @@ Defined in: [index.ts:51](https://github.com/TanStack/db/blob/main/packages/angu function injectLiveQuery(options): InjectLiveQueryResult<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>; ``` -Defined in: [index.ts:61](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L61) +Defined in: index.ts:61 ### Type Parameters @@ -79,7 +79,7 @@ Defined in: [index.ts:61](https://github.com/TanStack/db/blob/main/packages/angu function injectLiveQuery(queryFn): InjectLiveQueryResult<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>; ``` -Defined in: [index.ts:71](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L71) +Defined in: index.ts:71 ### Type Parameters @@ -103,7 +103,7 @@ Defined in: [index.ts:71](https://github.com/TanStack/db/blob/main/packages/angu function injectLiveQuery(queryFn): InjectLiveQueryResult<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>; ``` -Defined in: [index.ts:74](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L74) +Defined in: index.ts:74 ### Type Parameters @@ -127,7 +127,7 @@ Defined in: [index.ts:74](https://github.com/TanStack/db/blob/main/packages/angu function injectLiveQuery(config): InjectLiveQueryResult<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>; ``` -Defined in: [index.ts:79](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L79) +Defined in: index.ts:79 ### Type Parameters @@ -151,7 +151,7 @@ Defined in: [index.ts:79](https://github.com/TanStack/db/blob/main/packages/angu function injectLiveQuery(liveQueryCollection): InjectLiveQueryResult; ``` -Defined in: [index.ts:82](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L82) +Defined in: index.ts:82 ### Type Parameters diff --git a/docs/framework/angular/reference/interfaces/InjectLiveQueryResult.md b/docs/framework/angular/reference/interfaces/InjectLiveQueryResult.md index 2e00287c2..10989dc04 100644 --- a/docs/framework/angular/reference/interfaces/InjectLiveQueryResult.md +++ b/docs/framework/angular/reference/interfaces/InjectLiveQueryResult.md @@ -5,7 +5,7 @@ title: InjectLiveQueryResult # Interface: InjectLiveQueryResult\ -Defined in: [index.ts:26](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L26) +Defined in: index.ts:26 The result of calling `injectLiveQuery`. Contains reactive signals for the query state and data. @@ -35,7 +35,7 @@ collection: Signal< | null>; ``` -Defined in: [index.ts:36](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L36) +Defined in: index.ts:36 A signal containing the underlying collection instance (null for disabled queries) @@ -47,7 +47,7 @@ A signal containing the underlying collection instance (null for disabled querie data: Signal; ``` -Defined in: [index.ts:34](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L34) +Defined in: index.ts:34 A signal containing the results as an array @@ -59,7 +59,7 @@ A signal containing the results as an array isCleanedUp: Signal; ``` -Defined in: [index.ts:48](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L48) +Defined in: index.ts:48 A signal indicating whether the collection has been cleaned up @@ -71,7 +71,7 @@ A signal indicating whether the collection has been cleaned up isError: Signal; ``` -Defined in: [index.ts:46](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L46) +Defined in: index.ts:46 A signal indicating whether the collection has an error @@ -83,7 +83,7 @@ A signal indicating whether the collection has an error isIdle: Signal; ``` -Defined in: [index.ts:44](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L44) +Defined in: index.ts:44 A signal indicating whether the collection is idle @@ -95,7 +95,7 @@ A signal indicating whether the collection is idle isLoading: Signal; ``` -Defined in: [index.ts:40](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L40) +Defined in: index.ts:40 A signal indicating whether the collection is currently loading @@ -107,7 +107,7 @@ A signal indicating whether the collection is currently loading isReady: Signal; ``` -Defined in: [index.ts:42](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L42) +Defined in: index.ts:42 A signal indicating whether the collection is ready @@ -119,7 +119,7 @@ A signal indicating whether the collection is ready state: Signal>; ``` -Defined in: [index.ts:32](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L32) +Defined in: index.ts:32 A signal containing the complete state map of results keyed by their ID @@ -131,6 +131,6 @@ A signal containing the complete state map of results keyed by their ID status: Signal; ``` -Defined in: [index.ts:38](https://github.com/TanStack/db/blob/main/packages/angular-db/src/index.ts#L38) +Defined in: index.ts:38 A signal containing the current status of the collection diff --git a/docs/framework/react/reference/functions/useLiveInfiniteQuery.md b/docs/framework/react/reference/functions/useLiveInfiniteQuery.md index 8fe91f730..310b6887c 100644 --- a/docs/framework/react/reference/functions/useLiveInfiniteQuery.md +++ b/docs/framework/react/reference/functions/useLiveInfiniteQuery.md @@ -11,7 +11,7 @@ title: useLiveInfiniteQuery function useLiveInfiniteQuery(liveQueryCollection, config): UseLiveInfiniteQueryReturn; ``` -Defined in: [useLiveInfiniteQuery.ts:113](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L113) +Defined in: useLiveInfiniteQuery.ts:113 Create an infinite query using a query function with live updates @@ -118,7 +118,7 @@ function useLiveInfiniteQuery( deps?): UseLiveInfiniteQueryReturn; ``` -Defined in: [useLiveInfiniteQuery.ts:123](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L123) +Defined in: useLiveInfiniteQuery.ts:123 Create an infinite query using a query function with live updates diff --git a/docs/framework/react/reference/functions/useLiveQuery.md b/docs/framework/react/reference/functions/useLiveQuery.md index 84162b674..de66f87df 100644 --- a/docs/framework/react/reference/functions/useLiveQuery.md +++ b/docs/framework/react/reference/functions/useLiveQuery.md @@ -11,7 +11,7 @@ title: useLiveQuery function useLiveQuery(queryFn, deps?): object; ``` -Defined in: [useLiveQuery.ts:84](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L84) +Defined in: useLiveQuery.ts:84 Create a live query using a query function @@ -168,7 +168,7 @@ return ( function useLiveQuery(queryFn, deps?): object; ``` -Defined in: [useLiveQuery.ts:101](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L101) +Defined in: useLiveQuery.ts:101 Create a live query using a query function @@ -329,7 +329,7 @@ return ( function useLiveQuery(queryFn, deps?): object; ``` -Defined in: [useLiveQuery.ts:120](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L120) +Defined in: useLiveQuery.ts:120 Create a live query using a query function @@ -493,7 +493,7 @@ return ( function useLiveQuery(queryFn, deps?): object; ``` -Defined in: [useLiveQuery.ts:139](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L139) +Defined in: useLiveQuery.ts:139 Create a live query using a query function @@ -662,7 +662,7 @@ return ( function useLiveQuery(queryFn, deps?): object; ``` -Defined in: [useLiveQuery.ts:162](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L162) +Defined in: useLiveQuery.ts:162 Create a live query using a query function @@ -842,7 +842,7 @@ return ( function useLiveQuery(config, deps?): object; ``` -Defined in: [useLiveQuery.ts:230](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L230) +Defined in: useLiveQuery.ts:230 Create a live query using configuration object @@ -972,7 +972,7 @@ return
{data.length} items loaded
function useLiveQuery(liveQueryCollection): object; ``` -Defined in: [useLiveQuery.ts:276](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L276) +Defined in: useLiveQuery.ts:276 Subscribe to an existing live query collection @@ -1100,7 +1100,7 @@ return
{data.map(item => )}
function useLiveQuery(liveQueryCollection): object; ``` -Defined in: [useLiveQuery.ts:296](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L296) +Defined in: useLiveQuery.ts:296 Create a live query using a query function diff --git a/docs/framework/react/reference/functions/useLiveSuspenseQuery.md b/docs/framework/react/reference/functions/useLiveSuspenseQuery.md index 94c00a9fd..38279df29 100644 --- a/docs/framework/react/reference/functions/useLiveSuspenseQuery.md +++ b/docs/framework/react/reference/functions/useLiveSuspenseQuery.md @@ -11,7 +11,7 @@ title: useLiveSuspenseQuery function useLiveSuspenseQuery(queryFn, deps?): object; ``` -Defined in: [useLiveSuspenseQuery.ts:109](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L109) +Defined in: useLiveSuspenseQuery.ts:109 Create a live query with React Suspense support @@ -167,7 +167,7 @@ const { data, isEnabled } = useLiveQuery( function useLiveSuspenseQuery(config, deps?): object; ``` -Defined in: [useLiveSuspenseQuery.ts:119](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L119) +Defined in: useLiveSuspenseQuery.ts:119 Create a live query with React Suspense support @@ -321,7 +321,7 @@ const { data, isEnabled } = useLiveQuery( function useLiveSuspenseQuery(liveQueryCollection): object; ``` -Defined in: [useLiveSuspenseQuery.ts:129](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L129) +Defined in: useLiveSuspenseQuery.ts:129 Create a live query with React Suspense support @@ -476,7 +476,7 @@ const { data, isEnabled } = useLiveQuery( function useLiveSuspenseQuery(liveQueryCollection): object; ``` -Defined in: [useLiveSuspenseQuery.ts:142](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveSuspenseQuery.ts#L142) +Defined in: useLiveSuspenseQuery.ts:142 Create a live query with React Suspense support diff --git a/docs/framework/react/reference/functions/usePacedMutations.md b/docs/framework/react/reference/functions/usePacedMutations.md index 4f50b0411..d4c610b10 100644 --- a/docs/framework/react/reference/functions/usePacedMutations.md +++ b/docs/framework/react/reference/functions/usePacedMutations.md @@ -9,7 +9,7 @@ title: usePacedMutations function usePacedMutations(config): (variables) => Transaction; ``` -Defined in: [usePacedMutations.ts:93](https://github.com/TanStack/db/blob/main/packages/react-db/src/usePacedMutations.ts#L93) +Defined in: usePacedMutations.ts:93 React hook for managing paced mutations with timing strategies. diff --git a/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryConfig.md b/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryConfig.md index c0a4ad638..dd0f76c99 100644 --- a/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryConfig.md +++ b/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryConfig.md @@ -9,7 +9,7 @@ title: UseLiveInfiniteQueryConfig type UseLiveInfiniteQueryConfig = object; ``` -Defined in: [useLiveInfiniteQuery.ts:23](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L23) +Defined in: useLiveInfiniteQuery.ts:23 ## Type Parameters @@ -25,7 +25,7 @@ Defined in: [useLiveInfiniteQuery.ts:23](https://github.com/TanStack/db/blob/mai getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => number | undefined; ``` -Defined in: [useLiveInfiniteQuery.ts:26](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L26) +Defined in: useLiveInfiniteQuery.ts:26 #### Parameters @@ -57,7 +57,7 @@ Defined in: [useLiveInfiniteQuery.ts:26](https://github.com/TanStack/db/blob/mai optional initialPageParam: number; ``` -Defined in: [useLiveInfiniteQuery.ts:25](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L25) +Defined in: useLiveInfiniteQuery.ts:25 *** @@ -67,4 +67,4 @@ Defined in: [useLiveInfiniteQuery.ts:25](https://github.com/TanStack/db/blob/mai optional pageSize: number; ``` -Defined in: [useLiveInfiniteQuery.ts:24](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L24) +Defined in: useLiveInfiniteQuery.ts:24 diff --git a/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryReturn.md b/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryReturn.md index b7d68849d..a50b86e5e 100644 --- a/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryReturn.md +++ b/docs/framework/react/reference/type-aliases/UseLiveInfiniteQueryReturn.md @@ -9,7 +9,7 @@ title: UseLiveInfiniteQueryReturn type UseLiveInfiniteQueryReturn = Omit, "data"> & object; ``` -Defined in: [useLiveInfiniteQuery.ts:34](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L34) +Defined in: useLiveInfiniteQuery.ts:34 ## Type Declaration diff --git a/docs/framework/react/reference/type-aliases/UseLiveQueryStatus.md b/docs/framework/react/reference/type-aliases/UseLiveQueryStatus.md index 93bbcd634..b141ae7d3 100644 --- a/docs/framework/react/reference/type-aliases/UseLiveQueryStatus.md +++ b/docs/framework/react/reference/type-aliases/UseLiveQueryStatus.md @@ -9,4 +9,4 @@ title: UseLiveQueryStatus type UseLiveQueryStatus = CollectionStatus | "disabled"; ``` -Defined in: [useLiveQuery.ts:23](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveQuery.ts#L23) +Defined in: useLiveQuery.ts:23 diff --git a/docs/framework/solid/reference/functions/useLiveQuery.md b/docs/framework/solid/reference/functions/useLiveQuery.md index 74044531d..60eb787cb 100644 --- a/docs/framework/solid/reference/functions/useLiveQuery.md +++ b/docs/framework/solid/reference/functions/useLiveQuery.md @@ -11,7 +11,7 @@ title: useLiveQuery function useLiveQuery(queryFn): Accessor<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }[]> & object; ``` -Defined in: [useLiveQuery.ts:98](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L98) +Defined in: useLiveQuery.ts:98 Create a live query using a query function @@ -111,7 +111,7 @@ return ( function useLiveQuery(queryFn): Accessor<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }[]> & object; ``` -Defined in: [useLiveQuery.ts:117](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L117) +Defined in: useLiveQuery.ts:117 Create a live query using a query function @@ -211,7 +211,7 @@ return ( function useLiveQuery(config): Accessor<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }[]> & object; ``` -Defined in: [useLiveQuery.ts:178](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L178) +Defined in: useLiveQuery.ts:178 Create a live query using configuration object @@ -280,7 +280,7 @@ return ( function useLiveQuery(liveQueryCollection): Accessor & object; ``` -Defined in: [useLiveQuery.ts:232](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L232) +Defined in: useLiveQuery.ts:232 Subscribe to an existing live query collection diff --git a/docs/framework/svelte/reference/functions/useLiveQuery.md b/docs/framework/svelte/reference/functions/useLiveQuery.md index 74b6534f4..803e2e85a 100644 --- a/docs/framework/svelte/reference/functions/useLiveQuery.md +++ b/docs/framework/svelte/reference/functions/useLiveQuery.md @@ -11,7 +11,7 @@ title: useLiveQuery function useLiveQuery(queryFn, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }, InferResultType>; ``` -Defined in: [useLiveQuery.svelte.ts:160](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L160) +Defined in: useLiveQuery.svelte.ts:160 Create a live query using a query function @@ -137,7 +137,7 @@ const todosQuery = useLiveQuery((q) => function useLiveQuery(queryFn, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }, InferResultType | undefined>; ``` -Defined in: [useLiveQuery.svelte.ts:166](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L166) +Defined in: useLiveQuery.svelte.ts:166 Create a live query using a query function @@ -263,7 +263,7 @@ const todosQuery = useLiveQuery((q) => function useLiveQuery(config, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }, InferResultType>; ``` -Defined in: [useLiveQuery.svelte.ts:214](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L214) +Defined in: useLiveQuery.svelte.ts:214 Create a live query using configuration object @@ -336,7 +336,7 @@ const itemsQuery = useLiveQuery({ function useLiveQuery(liveQueryCollection): UseLiveQueryReturnWithCollection; ``` -Defined in: [useLiveQuery.svelte.ts:263](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L263) +Defined in: useLiveQuery.svelte.ts:263 Subscribe to an existing query collection (can be reactive) @@ -419,7 +419,7 @@ const queryResult = useLiveQuery(sharedQuery) function useLiveQuery(liveQueryCollection): UseLiveQueryReturnWithCollection; ``` -Defined in: [useLiveQuery.svelte.ts:274](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L274) +Defined in: useLiveQuery.svelte.ts:274 Create a live query using a query function diff --git a/docs/framework/svelte/reference/interfaces/UseLiveQueryReturn.md b/docs/framework/svelte/reference/interfaces/UseLiveQueryReturn.md index 714736f4b..1072ba012 100644 --- a/docs/framework/svelte/reference/interfaces/UseLiveQueryReturn.md +++ b/docs/framework/svelte/reference/interfaces/UseLiveQueryReturn.md @@ -5,7 +5,7 @@ title: UseLiveQueryReturn # Interface: UseLiveQueryReturn\ -Defined in: [useLiveQuery.svelte.ts:33](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L33) +Defined in: useLiveQuery.svelte.ts:33 Return type for useLiveQuery hook @@ -28,7 +28,7 @@ collection: Collection; ``` -Defined in: [useLiveQuery.svelte.ts:36](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L36) +Defined in: useLiveQuery.svelte.ts:36 The underlying query collection instance @@ -40,7 +40,7 @@ The underlying query collection instance data: TData; ``` -Defined in: [useLiveQuery.svelte.ts:35](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L35) +Defined in: useLiveQuery.svelte.ts:35 Reactive array of query results in order, or single item when using findOne() @@ -52,7 +52,7 @@ Reactive array of query results in order, or single item when using findOne() isCleanedUp: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:42](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L42) +Defined in: useLiveQuery.svelte.ts:42 True when query has been cleaned up @@ -64,7 +64,7 @@ True when query has been cleaned up isError: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:41](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L41) +Defined in: useLiveQuery.svelte.ts:41 True when query encountered an error @@ -76,7 +76,7 @@ True when query encountered an error isIdle: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:40](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L40) +Defined in: useLiveQuery.svelte.ts:40 True when query hasn't started yet @@ -88,7 +88,7 @@ True when query hasn't started yet isLoading: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:38](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L38) +Defined in: useLiveQuery.svelte.ts:38 True while initial query data is loading @@ -100,7 +100,7 @@ True while initial query data is loading isReady: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:39](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L39) +Defined in: useLiveQuery.svelte.ts:39 True when query has received first data and is ready @@ -112,7 +112,7 @@ True when query has received first data and is ready state: Map; ``` -Defined in: [useLiveQuery.svelte.ts:34](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L34) +Defined in: useLiveQuery.svelte.ts:34 Reactive Map of query results (key → item) @@ -124,6 +124,6 @@ Reactive Map of query results (key → item) status: CollectionStatus; ``` -Defined in: [useLiveQuery.svelte.ts:37](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L37) +Defined in: useLiveQuery.svelte.ts:37 Current query status diff --git a/docs/framework/svelte/reference/interfaces/UseLiveQueryReturnWithCollection.md b/docs/framework/svelte/reference/interfaces/UseLiveQueryReturnWithCollection.md index 0d62c7ae8..05f14f983 100644 --- a/docs/framework/svelte/reference/interfaces/UseLiveQueryReturnWithCollection.md +++ b/docs/framework/svelte/reference/interfaces/UseLiveQueryReturnWithCollection.md @@ -5,7 +5,7 @@ title: UseLiveQueryReturnWithCollection # Interface: UseLiveQueryReturnWithCollection\ -Defined in: [useLiveQuery.svelte.ts:45](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L45) +Defined in: useLiveQuery.svelte.ts:45 ## Type Parameters @@ -33,7 +33,7 @@ Defined in: [useLiveQuery.svelte.ts:45](https://github.com/TanStack/db/blob/main collection: Collection; ``` -Defined in: [useLiveQuery.svelte.ts:53](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L53) +Defined in: useLiveQuery.svelte.ts:53 *** @@ -43,7 +43,7 @@ Defined in: [useLiveQuery.svelte.ts:53](https://github.com/TanStack/db/blob/main data: TData; ``` -Defined in: [useLiveQuery.svelte.ts:52](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L52) +Defined in: useLiveQuery.svelte.ts:52 *** @@ -53,7 +53,7 @@ Defined in: [useLiveQuery.svelte.ts:52](https://github.com/TanStack/db/blob/main isCleanedUp: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:59](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L59) +Defined in: useLiveQuery.svelte.ts:59 *** @@ -63,7 +63,7 @@ Defined in: [useLiveQuery.svelte.ts:59](https://github.com/TanStack/db/blob/main isError: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:58](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L58) +Defined in: useLiveQuery.svelte.ts:58 *** @@ -73,7 +73,7 @@ Defined in: [useLiveQuery.svelte.ts:58](https://github.com/TanStack/db/blob/main isIdle: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:57](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L57) +Defined in: useLiveQuery.svelte.ts:57 *** @@ -83,7 +83,7 @@ Defined in: [useLiveQuery.svelte.ts:57](https://github.com/TanStack/db/blob/main isLoading: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:55](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L55) +Defined in: useLiveQuery.svelte.ts:55 *** @@ -93,7 +93,7 @@ Defined in: [useLiveQuery.svelte.ts:55](https://github.com/TanStack/db/blob/main isReady: boolean; ``` -Defined in: [useLiveQuery.svelte.ts:56](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L56) +Defined in: useLiveQuery.svelte.ts:56 *** @@ -103,7 +103,7 @@ Defined in: [useLiveQuery.svelte.ts:56](https://github.com/TanStack/db/blob/main state: Map; ``` -Defined in: [useLiveQuery.svelte.ts:51](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L51) +Defined in: useLiveQuery.svelte.ts:51 *** @@ -113,4 +113,4 @@ Defined in: [useLiveQuery.svelte.ts:51](https://github.com/TanStack/db/blob/main status: CollectionStatus; ``` -Defined in: [useLiveQuery.svelte.ts:54](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L54) +Defined in: useLiveQuery.svelte.ts:54 diff --git a/docs/framework/vue/reference/functions/useLiveQuery.md b/docs/framework/vue/reference/functions/useLiveQuery.md index 71c717e54..e6d6bbb84 100644 --- a/docs/framework/vue/reference/functions/useLiveQuery.md +++ b/docs/framework/vue/reference/functions/useLiveQuery.md @@ -11,7 +11,7 @@ title: useLiveQuery function useLiveQuery(queryFn, deps?): UseLiveQueryReturn; ``` -Defined in: [useLiveQuery.ts:134](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L134) +Defined in: useLiveQuery.ts:134 Create a live query using a query function @@ -97,7 +97,7 @@ const { data, isLoading, isError, status } = useLiveQuery((q) => function useLiveQuery(queryFn, deps?): UseLiveQueryReturn; ``` -Defined in: [useLiveQuery.ts:140](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L140) +Defined in: useLiveQuery.ts:140 Create a live query using a query function @@ -183,7 +183,7 @@ const { data, isLoading, isError, status } = useLiveQuery((q) => function useLiveQuery(config, deps?): UseLiveQueryReturn; ``` -Defined in: [useLiveQuery.ts:180](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L180) +Defined in: useLiveQuery.ts:180 Create a live query using configuration object @@ -251,7 +251,7 @@ const { data, isLoading, isReady, isError } = useLiveQuery({ function useLiveQuery(liveQueryCollection): UseLiveQueryReturnWithCollection; ``` -Defined in: [useLiveQuery.ts:225](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L225) +Defined in: useLiveQuery.ts:225 Subscribe to an existing query collection (can be reactive) @@ -330,7 +330,7 @@ const { data, isLoading, isError } = useLiveQuery(sharedQuery) function useLiveQuery(liveQueryCollection): UseLiveQueryReturnWithSingleResultCollection; ``` -Defined in: [useLiveQuery.ts:236](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L236) +Defined in: useLiveQuery.ts:236 Create a live query using a query function diff --git a/docs/framework/vue/reference/interfaces/UseLiveQueryReturn.md b/docs/framework/vue/reference/interfaces/UseLiveQueryReturn.md index 90a8e7299..c0ddd61fe 100644 --- a/docs/framework/vue/reference/interfaces/UseLiveQueryReturn.md +++ b/docs/framework/vue/reference/interfaces/UseLiveQueryReturn.md @@ -5,7 +5,7 @@ title: UseLiveQueryReturn # Interface: UseLiveQueryReturn\ -Defined in: [useLiveQuery.ts:40](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L40) +Defined in: useLiveQuery.ts:40 Return type for useLiveQuery hook @@ -24,7 +24,7 @@ collection: ComputedRef, { [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }>>; ``` -Defined in: [useLiveQuery.ts:43](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L43) +Defined in: useLiveQuery.ts:43 The underlying query collection instance @@ -36,7 +36,7 @@ The underlying query collection instance data: ComputedRef>; ``` -Defined in: [useLiveQuery.ts:42](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L42) +Defined in: useLiveQuery.ts:42 Reactive array of query results in order, or single result for findOne queries @@ -48,7 +48,7 @@ Reactive array of query results in order, or single result for findOne queries isCleanedUp: ComputedRef; ``` -Defined in: [useLiveQuery.ts:49](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L49) +Defined in: useLiveQuery.ts:49 True when query has been cleaned up @@ -60,7 +60,7 @@ True when query has been cleaned up isError: ComputedRef; ``` -Defined in: [useLiveQuery.ts:48](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L48) +Defined in: useLiveQuery.ts:48 True when query encountered an error @@ -72,7 +72,7 @@ True when query encountered an error isIdle: ComputedRef; ``` -Defined in: [useLiveQuery.ts:47](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L47) +Defined in: useLiveQuery.ts:47 True when query hasn't started yet @@ -84,7 +84,7 @@ True when query hasn't started yet isLoading: ComputedRef; ``` -Defined in: [useLiveQuery.ts:45](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L45) +Defined in: useLiveQuery.ts:45 True while initial query data is loading @@ -96,7 +96,7 @@ True while initial query data is loading isReady: ComputedRef; ``` -Defined in: [useLiveQuery.ts:46](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L46) +Defined in: useLiveQuery.ts:46 True when query has received first data and is ready @@ -108,7 +108,7 @@ True when query has received first data and is ready state: ComputedRef>; ``` -Defined in: [useLiveQuery.ts:41](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L41) +Defined in: useLiveQuery.ts:41 Reactive Map of query results (key → item) @@ -120,6 +120,6 @@ Reactive Map of query results (key → item) status: ComputedRef; ``` -Defined in: [useLiveQuery.ts:44](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L44) +Defined in: useLiveQuery.ts:44 Current query status diff --git a/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithCollection.md b/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithCollection.md index 8f63d9314..8abd0f1bf 100644 --- a/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithCollection.md +++ b/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithCollection.md @@ -5,7 +5,7 @@ title: UseLiveQueryReturnWithCollection # Interface: UseLiveQueryReturnWithCollection\ -Defined in: [useLiveQuery.ts:52](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L52) +Defined in: useLiveQuery.ts:52 ## Type Parameters @@ -29,7 +29,7 @@ Defined in: [useLiveQuery.ts:52](https://github.com/TanStack/db/blob/main/packag collection: ComputedRef, T>>; ``` -Defined in: [useLiveQuery.ts:59](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L59) +Defined in: useLiveQuery.ts:59 *** @@ -39,7 +39,7 @@ Defined in: [useLiveQuery.ts:59](https://github.com/TanStack/db/blob/main/packag data: ComputedRef; ``` -Defined in: [useLiveQuery.ts:58](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L58) +Defined in: useLiveQuery.ts:58 *** @@ -49,7 +49,7 @@ Defined in: [useLiveQuery.ts:58](https://github.com/TanStack/db/blob/main/packag isCleanedUp: ComputedRef; ``` -Defined in: [useLiveQuery.ts:65](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L65) +Defined in: useLiveQuery.ts:65 *** @@ -59,7 +59,7 @@ Defined in: [useLiveQuery.ts:65](https://github.com/TanStack/db/blob/main/packag isError: ComputedRef; ``` -Defined in: [useLiveQuery.ts:64](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L64) +Defined in: useLiveQuery.ts:64 *** @@ -69,7 +69,7 @@ Defined in: [useLiveQuery.ts:64](https://github.com/TanStack/db/blob/main/packag isIdle: ComputedRef; ``` -Defined in: [useLiveQuery.ts:63](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L63) +Defined in: useLiveQuery.ts:63 *** @@ -79,7 +79,7 @@ Defined in: [useLiveQuery.ts:63](https://github.com/TanStack/db/blob/main/packag isLoading: ComputedRef; ``` -Defined in: [useLiveQuery.ts:61](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L61) +Defined in: useLiveQuery.ts:61 *** @@ -89,7 +89,7 @@ Defined in: [useLiveQuery.ts:61](https://github.com/TanStack/db/blob/main/packag isReady: ComputedRef; ``` -Defined in: [useLiveQuery.ts:62](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L62) +Defined in: useLiveQuery.ts:62 *** @@ -99,7 +99,7 @@ Defined in: [useLiveQuery.ts:62](https://github.com/TanStack/db/blob/main/packag state: ComputedRef>; ``` -Defined in: [useLiveQuery.ts:57](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L57) +Defined in: useLiveQuery.ts:57 *** @@ -109,4 +109,4 @@ Defined in: [useLiveQuery.ts:57](https://github.com/TanStack/db/blob/main/packag status: ComputedRef; ``` -Defined in: [useLiveQuery.ts:60](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L60) +Defined in: useLiveQuery.ts:60 diff --git a/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithSingleResultCollection.md b/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithSingleResultCollection.md index 5b9502a97..90631a2a7 100644 --- a/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithSingleResultCollection.md +++ b/docs/framework/vue/reference/interfaces/UseLiveQueryReturnWithSingleResultCollection.md @@ -5,7 +5,7 @@ title: UseLiveQueryReturnWithSingleResultCollection # Interface: UseLiveQueryReturnWithSingleResultCollection\ -Defined in: [useLiveQuery.ts:68](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L68) +Defined in: useLiveQuery.ts:68 ## Type Parameters @@ -29,7 +29,7 @@ Defined in: [useLiveQuery.ts:68](https://github.com/TanStack/db/blob/main/packag collection: ComputedRef, T> & SingleResult>; ``` -Defined in: [useLiveQuery.ts:75](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L75) +Defined in: useLiveQuery.ts:75 *** @@ -39,7 +39,7 @@ Defined in: [useLiveQuery.ts:75](https://github.com/TanStack/db/blob/main/packag data: ComputedRef; ``` -Defined in: [useLiveQuery.ts:74](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L74) +Defined in: useLiveQuery.ts:74 *** @@ -49,7 +49,7 @@ Defined in: [useLiveQuery.ts:74](https://github.com/TanStack/db/blob/main/packag isCleanedUp: ComputedRef; ``` -Defined in: [useLiveQuery.ts:81](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L81) +Defined in: useLiveQuery.ts:81 *** @@ -59,7 +59,7 @@ Defined in: [useLiveQuery.ts:81](https://github.com/TanStack/db/blob/main/packag isError: ComputedRef; ``` -Defined in: [useLiveQuery.ts:80](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L80) +Defined in: useLiveQuery.ts:80 *** @@ -69,7 +69,7 @@ Defined in: [useLiveQuery.ts:80](https://github.com/TanStack/db/blob/main/packag isIdle: ComputedRef; ``` -Defined in: [useLiveQuery.ts:79](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L79) +Defined in: useLiveQuery.ts:79 *** @@ -79,7 +79,7 @@ Defined in: [useLiveQuery.ts:79](https://github.com/TanStack/db/blob/main/packag isLoading: ComputedRef; ``` -Defined in: [useLiveQuery.ts:77](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L77) +Defined in: useLiveQuery.ts:77 *** @@ -89,7 +89,7 @@ Defined in: [useLiveQuery.ts:77](https://github.com/TanStack/db/blob/main/packag isReady: ComputedRef; ``` -Defined in: [useLiveQuery.ts:78](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L78) +Defined in: useLiveQuery.ts:78 *** @@ -99,7 +99,7 @@ Defined in: [useLiveQuery.ts:78](https://github.com/TanStack/db/blob/main/packag state: ComputedRef>; ``` -Defined in: [useLiveQuery.ts:73](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L73) +Defined in: useLiveQuery.ts:73 *** @@ -109,4 +109,4 @@ Defined in: [useLiveQuery.ts:73](https://github.com/TanStack/db/blob/main/packag status: ComputedRef; ``` -Defined in: [useLiveQuery.ts:76](https://github.com/TanStack/db/blob/main/packages/vue-db/src/useLiveQuery.ts#L76) +Defined in: useLiveQuery.ts:76 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..d5041e10a --- /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 + +## 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 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### args + +```ts +args: BasicExpression[]; +``` + +Defined in: packages/db/src/query/ir.ts:129 + +*** + +### name + +```ts +name: string; +``` + +Defined in: packages/db/src/query/ir.ts:128 + +*** + +### type + +```ts +type: "agg"; +``` + +Defined in: packages/db/src/query/ir.ts:126 + +#### 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..c06efee96 --- /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 + +## Extends + +- `BaseExpression` + +## Constructors + +### Constructor + +```ts +new CollectionRef(collection, alias): CollectionRef; +``` + +Defined in: packages/db/src/query/ir.ts:74 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### alias + +```ts +alias: string; +``` + +Defined in: packages/db/src/query/ir.ts:76 + +*** + +### collection + +```ts +collection: CollectionImpl; +``` + +Defined in: packages/db/src/query/ir.ts:75 + +*** + +### type + +```ts +type: "collectionRef"; +``` + +Defined in: packages/db/src/query/ir.ts:73 + +#### 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..84592ed8a --- /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 + +## 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 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### args + +```ts +args: BasicExpression[]; +``` + +Defined in: packages/db/src/query/ir.ts:114 + +*** + +### name + +```ts +name: string; +``` + +Defined in: packages/db/src/query/ir.ts:113 + +*** + +### type + +```ts +type: "func"; +``` + +Defined in: packages/db/src/query/ir.ts:111 + +#### 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..34f8ca57f --- /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 + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new PropRef(path): PropRef; +``` + +Defined in: packages/db/src/query/ir.ts:94 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### path + +```ts +path: string[]; +``` + +Defined in: packages/db/src/query/ir.ts:95 + +*** + +### type + +```ts +type: "ref"; +``` + +Defined in: packages/db/src/query/ir.ts:93 + +#### 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..bfc5ee702 --- /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 + +## Extends + +- `BaseExpression` + +## Constructors + +### Constructor + +```ts +new QueryRef(query, alias): QueryRef; +``` + +Defined in: packages/db/src/query/ir.ts:84 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### alias + +```ts +alias: string; +``` + +Defined in: packages/db/src/query/ir.ts:86 + +*** + +### query + +```ts +query: QueryIR; +``` + +Defined in: packages/db/src/query/ir.ts:85 + +*** + +### type + +```ts +type: "queryRef"; +``` + +Defined in: packages/db/src/query/ir.ts:83 + +#### 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..8a614cea8 --- /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 + +## Extends + +- `BaseExpression`\<`T`\> + +## Type Parameters + +### T + +`T` = `any` + +## Constructors + +### Constructor + +```ts +new Value(value): Value; +``` + +Defined in: packages/db/src/query/ir.ts:103 + +#### 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 + +**`Internal`** + +- Type brand for TypeScript inference + +#### Inherited from + +```ts +BaseExpression.__returnType +``` + +*** + +### type + +```ts +type: "val"; +``` + +Defined in: packages/db/src/query/ir.ts:102 + +#### Overrides + +```ts +BaseExpression.type +``` + +*** + +### value + +```ts +value: T; +``` + +Defined in: packages/db/src/query/ir.ts:104 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..45962c429 --- /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 + +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..933be5660 --- /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 + +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..1961a7aa3 --- /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): + | BasicExpression +| Aggregate; +``` + +Defined in: packages/db/src/query/ir.ts:165 + +Extract the expression from a HAVING clause +HAVING clauses can contain aggregates, unlike regular WHERE clauses + +## Parameters + +### having + +[`Where`](../type-aliases/Where.md) + +## Returns + + \| [`BasicExpression`](../type-aliases/BasicExpression.md)\<`any`\> + \| [`Aggregate`](../classes/Aggregate.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..9dea75c42 --- /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 + +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..e2b9f512b --- /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 + +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..e91850202 --- /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 + +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..2e6b180ed --- /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..a11d7db00 --- /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 + +## Properties + +### from + +```ts +from: + | CollectionRef + | QueryRef; +``` + +Defined in: packages/db/src/query/ir.ts:37 + +*** + +### left + +```ts +left: BasicExpression; +``` + +Defined in: packages/db/src/query/ir.ts:39 + +*** + +### right + +```ts +right: BasicExpression; +``` + +Defined in: packages/db/src/query/ir.ts:40 + +*** + +### type + +```ts +type: "inner" | "left" | "right" | "full" | "outer" | "cross"; +``` + +Defined in: packages/db/src/query/ir.ts:38 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..f127ee481 --- /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 + +## Properties + +### distinct? + +```ts +optional distinct: true; +``` + +Defined in: packages/db/src/query/ir.ts:19 + +*** + +### fnHaving? + +```ts +optional fnHaving: (row) => any[]; +``` + +Defined in: packages/db/src/query/ir.ts:25 + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### fnSelect()? + +```ts +optional fnSelect: (row) => any; +``` + +Defined in: packages/db/src/query/ir.ts:23 + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### fnWhere? + +```ts +optional fnWhere: (row) => any[]; +``` + +Defined in: packages/db/src/query/ir.ts:24 + +#### Parameters + +##### row + +[`NamespacedRow`](../../../../type-aliases/NamespacedRow.md) + +#### Returns + +`any` + +*** + +### from + +```ts +from: From; +``` + +Defined in: packages/db/src/query/ir.ts:10 + +*** + +### groupBy? + +```ts +optional groupBy: GroupBy; +``` + +Defined in: packages/db/src/query/ir.ts:14 + +*** + +### having? + +```ts +optional having: Where[]; +``` + +Defined in: packages/db/src/query/ir.ts:15 + +*** + +### join? + +```ts +optional join: Join; +``` + +Defined in: packages/db/src/query/ir.ts:12 + +*** + +### limit? + +```ts +optional limit: number; +``` + +Defined in: packages/db/src/query/ir.ts:17 + +*** + +### offset? + +```ts +optional offset: number; +``` + +Defined in: packages/db/src/query/ir.ts:18 + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: packages/db/src/query/ir.ts:16 + +*** + +### select? + +```ts +optional select: Select; +``` + +Defined in: packages/db/src/query/ir.ts:11 + +*** + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: packages/db/src/query/ir.ts:20 + +*** + +### where? + +```ts +optional where: Where[]; +``` + +Defined in: packages/db/src/query/ir.ts:13 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..9d5c2aa00 --- /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 + +## 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..01e962ab7 --- /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 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..e8b9865ea --- /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 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..b02cd5c83 --- /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 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..62623afb6 --- /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 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..c0984bc3e --- /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 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..0ca642359 --- /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 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..beb4bc32f --- /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 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..8576dfa00 --- /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 + +## Properties + +### compareOptions + +```ts +compareOptions: CompareOptions; +``` + +Defined in: packages/db/src/query/ir.ts:55 + +*** + +### expression + +```ts +expression: BasicExpression; +``` + +Defined in: packages/db/src/query/ir.ts:54 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..b8f4fe340 --- /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 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..c451c360d --- /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 + +## Index Signature + +```ts +[alias: string]: + | BasicExpression + | Aggregate + | 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..053216b25 --- /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 diff --git a/docs/reference/classes/AggregateFunctionNotInSelectError.md b/docs/reference/classes/AggregateFunctionNotInSelectError.md new file mode 100644 index 000000000..b523c10a3 --- /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:594 + +## Extends + +- [`GroupByError`](GroupByError.md) + +## Constructors + +### Constructor + +```ts +new AggregateFunctionNotInSelectError(functionName): AggregateFunctionNotInSelectError; +``` + +Defined in: packages/db/src/errors.ts:595 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..7c573abd9 --- /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:710 + +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:711 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..25acdb884 --- /dev/null +++ b/docs/reference/classes/BTreeIndex.md @@ -0,0 +1,920 @@ +--- +id: BTreeIndex +title: BTreeIndex +--- + +# Class: BTreeIndex\ + +Defined in: packages/db/src/indexes/btree-index.ts:35 + +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` \| `undefined` = `string` \| `number` \| `undefined` + +## Constructors + +### Constructor + +```ts +new BTreeIndex( + id, + expression, + name?, +options?): BTreeIndex; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:55 + +#### 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:92 + +#### Inherited from + +[`BaseIndex`](BaseIndex.md).[`compareOptions`](BaseIndex.md#compareoptions) + +*** + +### expression + +```ts +readonly expression: BasicExpression; +``` + +Defined in: packages/db/src/indexes/base-index.ts:86 + +#### Inherited from + +[`BaseIndex`](BaseIndex.md).[`expression`](BaseIndex.md#expression) + +*** + +### id + +```ts +readonly id: number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:84 + +#### Inherited from + +[`BaseIndex`](BaseIndex.md).[`id`](BaseIndex.md#id) + +*** + +### lastUpdated + +```ts +protected lastUpdated: Date; +``` + +Defined in: packages/db/src/indexes/base-index.ts:91 + +#### Inherited from + +[`BaseIndex`](BaseIndex.md).[`lastUpdated`](BaseIndex.md#lastupdated) + +*** + +### lookupCount + +```ts +protected lookupCount: number = 0; +``` + +Defined in: packages/db/src/indexes/base-index.ts:89 + +#### Inherited from + +[`BaseIndex`](BaseIndex.md).[`lookupCount`](BaseIndex.md#lookupcount) + +*** + +### name? + +```ts +readonly optional name: string; +``` + +Defined in: packages/db/src/indexes/base-index.ts:85 + +#### 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:38 + +#### Overrides + +[`BaseIndex`](BaseIndex.md).[`supportedOperations`](BaseIndex.md#supportedoperations) + +*** + +### totalLookupTime + +```ts +protected totalLookupTime: number = 0; +``` + +Defined in: packages/db/src/indexes/base-index.ts:90 + +#### 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:400 + +##### 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:213 + +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:404 + +##### 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:413 + +##### 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:420 + +##### 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:83 + +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:157 + +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:168 + +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:222 + +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:195 + +#### 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:182 + +#### 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:385 + +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:78 + +#### 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:178 + +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:159 + +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:178 + +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:147 + +#### 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:231 + +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:269 + +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:114 + +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:143 + +#### 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:331 + +Returns the next n items after the provided item. + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### from + +`any` + +The item to start from (exclusive). + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +The next n items after the provided key. + +#### Overrides + +[`BaseIndex`](BaseIndex.md).[`take`](BaseIndex.md#take) + +*** + +### takeFromStart() + +```ts +takeFromStart(n, filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:344 + +Returns the first n items from the beginning. + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### filterFn? + +(`key`) => `boolean` + +Optional filter function + +#### Returns + +`TKey`[] + +The first n items + +#### Overrides + +[`BaseIndex`](BaseIndex.md).[`takeFromStart`](BaseIndex.md#takefromstart) + +*** + +### takeReversed() + +```ts +takeReversed( + n, + from, + filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:356 + +Returns the next n items **before** the provided item (in descending order). + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### from + +`any` + +The item to start from (exclusive). Required. + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +The next n items **before** the provided key. + +#### Overrides + +[`BaseIndex`](BaseIndex.md).[`takeReversed`](BaseIndex.md#takereversed) + +*** + +### takeReversedFromEnd() + +```ts +takeReversedFromEnd(n, filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:373 + +Returns the last n items from the end. + +#### Parameters + +##### n + +`number` + +The number of items to return + +##### filterFn? + +(`key`) => `boolean` + +Optional filter function + +#### Returns + +`TKey`[] + +The last n items + +#### Overrides + +[`BaseIndex`](BaseIndex.md).[`takeReversedFromEnd`](BaseIndex.md#takereversedfromend) + +*** + +### trackLookup() + +```ts +protected trackLookup(startTime): void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:200 + +#### 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:149 + +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:206 + +#### 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..db1ed4035 --- /dev/null +++ b/docs/reference/classes/BaseIndex.md @@ -0,0 +1,816 @@ +--- +id: BaseIndex +title: BaseIndex +--- + +# Abstract Class: BaseIndex\ + +Defined in: packages/db/src/indexes/base-index.ts:81 + +Base abstract class that all index types extend + +## Extended by + +- [`BTreeIndex`](BTreeIndex.md) + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` \| `undefined` = `string` \| `number` \| `undefined` + +## 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:94 + +#### 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:92 + +*** + +### expression + +```ts +readonly expression: BasicExpression; +``` + +Defined in: packages/db/src/indexes/base-index.ts:86 + +*** + +### id + +```ts +readonly id: number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:84 + +*** + +### lastUpdated + +```ts +protected lastUpdated: Date; +``` + +Defined in: packages/db/src/indexes/base-index.ts:91 + +*** + +### lookupCount + +```ts +protected lookupCount: number = 0; +``` + +Defined in: packages/db/src/indexes/base-index.ts:89 + +*** + +### name? + +```ts +readonly optional name: string; +``` + +Defined in: packages/db/src/indexes/base-index.ts:85 + +*** + +### supportedOperations + +```ts +abstract readonly supportedOperations: Set<"eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "ilike">; +``` + +Defined in: packages/db/src/indexes/base-index.ts:87 + +*** + +### totalLookupTime + +```ts +protected totalLookupTime: number = 0; +``` + +Defined in: packages/db/src/indexes/base-index.ts:90 + +## Accessors + +### indexedKeysSet + +#### Get Signature + +```ts +get abstract indexedKeysSet(): Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:139 + +##### 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:132 + +##### 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:137 + +##### 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:138 + +##### 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:140 + +##### 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:108 + +#### 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:111 + +#### 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:112 + +#### 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:133 + +#### 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:195 + +#### Parameters + +##### item + +`any` + +#### Returns + +`any` + +*** + +### getStats() + +```ts +getStats(): IndexStats; +``` + +Defined in: packages/db/src/indexes/base-index.ts:182 + +#### 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:134 + +#### 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:193 + +#### Parameters + +##### options? + +`any` + +#### Returns + +`void` + +*** + +### lookup() + +```ts +abstract lookup(operation, value): Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:113 + +#### 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:159 + +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:178 + +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:147 + +#### 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:135 + +#### 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:136 + +#### 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:109 + +#### 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:143 + +#### 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:114 + +#### Parameters + +##### n + +`number` + +##### from + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../interfaces/IndexInterface.md).[`take`](../interfaces/IndexInterface.md#take) + +*** + +### takeFromStart() + +```ts +abstract takeFromStart(n, filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:119 + +#### Parameters + +##### n + +`number` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../interfaces/IndexInterface.md).[`takeFromStart`](../interfaces/IndexInterface.md#takefromstart) + +*** + +### takeReversed() + +```ts +abstract takeReversed( + n, + from, + filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:123 + +#### Parameters + +##### n + +`number` + +##### from + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../interfaces/IndexInterface.md).[`takeReversed`](../interfaces/IndexInterface.md#takereversed) + +*** + +### takeReversedFromEnd() + +```ts +abstract takeReversedFromEnd(n, filterFn?): TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:128 + +#### Parameters + +##### n + +`number` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +#### Implementation of + +[`IndexInterface`](../interfaces/IndexInterface.md).[`takeReversedFromEnd`](../interfaces/IndexInterface.md#takereversedfromend) + +*** + +### trackLookup() + +```ts +protected trackLookup(startTime): void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:200 + +#### Parameters + +##### startTime + +`number` + +#### Returns + +`void` + +*** + +### update() + +```ts +abstract update( + key, + oldItem, + newItem): void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:110 + +#### 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:206 + +#### Returns + +`void` diff --git a/docs/reference/classes/BaseQueryBuilder.md b/docs/reference/classes/BaseQueryBuilder.md new file mode 100644 index 000000000..b834a3876 --- /dev/null +++ b/docs/reference/classes/BaseQueryBuilder.md @@ -0,0 +1,885 @@ +--- +id: BaseQueryBuilder +title: BaseQueryBuilder +--- + +# Class: BaseQueryBuilder\ + +Defined in: packages/db/src/query/builder/index.ts:54 + +## 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:57 + +#### 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:729 + +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 (with $selected when select() was called) 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) + .select(({posts}) => ({ userId: posts.userId, count: count(posts.id) })) + .fn.having(({ $selected }) => $selected.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`](../type-aliases/WithResult.md)\<`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:816 + +#### Returns + +[`QueryIR`](../@tanstack/namespaces/IR/interfaces/QueryIR.md) + +*** + +### distinct() + +```ts +distinct(): QueryBuilder; +``` + +Defined in: packages/db/src/query/builder/index.ts:668 + +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:688 + +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:136 + +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`](../type-aliases/SchemaFromSource.md)\<`TSource`\>; + `fromSourceName`: keyof `TSource` & `string`; + `hasJoins`: `false`; + `schema`: [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:327 + +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`](../type-aliases/JoinOnCallback.md)\<[`MergeContextForJoinCallback`](../type-aliases/MergeContextForJoinCallback.md)\<`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`](../type-aliases/MergeContextWithJoinType.md)\<`TContext`, [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:590 + +Group rows by one or more columns for aggregation + +#### Parameters + +##### callback + +[`GroupByCallback`](../type-aliases/GroupByCallback.md)\<`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:414 + +Filter grouped rows based on aggregate conditions + +#### Parameters + +##### callback + +[`WhereCallback`](../type-aliases/WhereCallback.md)\<`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:301 + +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`](../type-aliases/JoinOnCallback.md)\<[`MergeContextForJoinCallback`](../type-aliases/MergeContextForJoinCallback.md)\<`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`](../type-aliases/MergeContextWithJoinType.md)\<`TContext`, [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:179 + +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`](../type-aliases/JoinOnCallback.md)\<[`MergeContextForJoinCallback`](../type-aliases/MergeContextForJoinCallback.md)\<`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`](../type-aliases/MergeContextWithJoinType.md)\<`TContext`, [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:249 + +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`](../type-aliases/JoinOnCallback.md)\<[`MergeContextForJoinCallback`](../type-aliases/MergeContextForJoinCallback.md)\<`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`](../type-aliases/MergeContextWithJoinType.md)\<`TContext`, [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:623 + +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:647 + +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:514 + +Sort the query results by one or more columns + +#### Parameters + +##### callback + +[`OrderByCallback`](../type-aliases/OrderByCallback.md)\<`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:275 + +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`](../type-aliases/JoinOnCallback.md)\<[`MergeContextForJoinCallback`](../type-aliases/MergeContextForJoinCallback.md)\<`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`](../type-aliases/MergeContextWithJoinType.md)\<`TContext`, [`SchemaFromSource`](../type-aliases/SchemaFromSource.md)\<`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:473 + +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`](../type-aliases/WithResult.md)\<`TContext`, [`ResultTypeFromSelect`](../type-aliases/ResultTypeFromSelect.md)\<`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:366 + +Filter rows based on a condition + +#### Parameters + +##### callback + +[`WhereCallback`](../type-aliases/WhereCallback.md)\<`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..faa7a247c --- /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:673 + +## Extends + +- [`QueryOptimizerError`](QueryOptimizerError.md) + +## Constructors + +### Constructor + +```ts +new CannotCombineEmptyExpressionListError(): CannotCombineEmptyExpressionListError; +``` + +Defined in: packages/db/src/errors.ts:674 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..afa115e83 --- /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 + +## 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 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..da0cec817 --- /dev/null +++ b/docs/reference/classes/CollectionImpl.md @@ -0,0 +1,1441 @@ +--- +id: CollectionImpl +title: CollectionImpl +--- + +# Class: CollectionImpl\ + +Defined in: packages/db/src/collection/index.ts:266 + +## 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:305 + +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:283 + +*** + +### \_state + +```ts +_state: CollectionStateManager; +``` + +Defined in: packages/db/src/collection/index.ts:295 + +*** + +### \_sync + +```ts +_sync: CollectionSyncManager; +``` + +Defined in: packages/db/src/collection/index.ts:284 + +*** + +### config + +```ts +config: CollectionConfig; +``` + +Defined in: packages/db/src/collection/index.ts:274 + +*** + +### id + +```ts +id: string; +``` + +Defined in: packages/db/src/collection/index.ts:273 + +*** + +### utils + +```ts +utils: Record = {}; +``` + +Defined in: packages/db/src/collection/index.ts:278 + +## Accessors + +### compareOptions + +#### Get Signature + +```ts +get compareOptions(): StringCollationConfig; +``` + +Defined in: packages/db/src/collection/index.ts:580 + +##### Returns + +[`StringCollationConfig`](../type-aliases/StringCollationConfig.md) + +*** + +### indexes + +#### Get Signature + +```ts +get indexes(): Map>; +``` + +Defined in: packages/db/src/collection/index.ts:565 + +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:431 + +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:468 + +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:757 + +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:386 + +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:393 + +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:786 + +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:496 + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `TOutput`\]\> + +*** + +### cleanup() + +```ts +cleanup(): Promise; +``` + +Defined in: packages/db/src/collection/index.ts:923 + +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:555 + +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:824 + +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:734 + +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:489 + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `TOutput`\]\> + +*** + +### forEach() + +```ts +forEach(callbackfn): void; +``` + +Defined in: packages/db/src/collection/index.ts:503 + +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:454 + +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:518 + +#### Parameters + +##### item + +`TOutput` + +#### Returns + +`TKey` + +*** + +### has() + +```ts +has(key): boolean; +``` + +Defined in: packages/db/src/collection/index.ts:461 + +Check if a key exists in the collection (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`boolean` + +*** + +### insert() + +```ts +insert(data, config?): Transaction>; +``` + +Defined in: packages/db/src/collection/index.ts:621 + +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`\>\> + +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:423 + +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:475 + +Get all keys (virtual derived state) + +#### Returns + +`IterableIterator`\<`TKey`\> + +*** + +### map() + +```ts +map(callbackfn): U[]; +``` + +Defined in: packages/db/src/collection/index.ts:512 + +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:902 + +Unsubscribe from a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +`void` + +*** + +### on() + +```ts +on(event, callback): () => void; +``` + +Defined in: packages/db/src/collection/index.ts:882 + +Subscribe to a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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:892 + +Subscribe to a collection event once + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### Parameters + +##### event + +`T` + +##### callback + +`CollectionEventHandler`\<`T`\> + +#### Returns + +```ts +(): void; +``` + +##### Returns + +`void` + +*** + +### onFirstReady() + +```ts +onFirstReady(callback): void; +``` + +Defined in: packages/db/src/collection/index.ts:407 + +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:447 + +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:439 + +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:771 + +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:872 + +Subscribe to changes in the collection + +#### Parameters + +##### callback + +(`changes`) => `void` + +Function called when items change + +##### options + +[`SubscribeChangesOptions`](../interfaces/SubscribeChangesOptions.md)\<`TOutput`\> = `{}` + +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 using where callback +import { eq } from "@tanstack/db" + +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + where: (row) => eq(row.status, "active") +}) +``` + +```ts +// Using multiple conditions with and() +import { and, eq, gt } from "@tanstack/db" + +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + where: (row) => and(eq(row.status, "active"), gt(row.priority, 5)) +}) +``` + +*** + +### toArrayWhenReady() + +```ts +toArrayWhenReady(): Promise; +``` + +Defined in: packages/db/src/collection/index.ts:796 + +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:666 + +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:672 + +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:679 + +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:685 + +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:572 + +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:482 + +Get all values (virtual derived state) + +#### Returns + +`IterableIterator`\<`TOutput`\> + +*** + +### waitFor() + +```ts +waitFor(event, timeout?): Promise; +``` + +Defined in: packages/db/src/collection/index.ts:912 + +Wait for a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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..c4dede109 --- /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 + +## Extends + +- [`CollectionStateError`](CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new CollectionInErrorStateError(operation, collectionId): CollectionInErrorStateError; +``` + +Defined in: packages/db/src/errors.ts:111 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..302c8a501 --- /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:454 + +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:455 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..7374e908c --- /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 + +## Extends + +- [`CollectionStateError`](CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new CollectionIsInErrorStateError(): CollectionIsInErrorStateError; +``` + +Defined in: packages/db/src/errors.ts:127 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4adde906c --- /dev/null +++ b/docs/reference/classes/CollectionOperationError.md @@ -0,0 +1,233 @@ +--- +id: CollectionOperationError +title: CollectionOperationError +--- + +# Class: CollectionOperationError + +Defined in: packages/db/src/errors.ts:139 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Extended by + +- [`UndefinedKeyError`](UndefinedKeyError.md) +- [`InvalidKeyError`](InvalidKeyError.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 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..e397aba13 --- /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 + +## Extends + +- [`CollectionConfigurationError`](CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new CollectionRequiresConfigError(): CollectionRequiresConfigError; +``` + +Defined in: packages/db/src/errors.ts:79 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..286e2e0a8 --- /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 + +## Extends + +- [`CollectionConfigurationError`](CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new CollectionRequiresSyncConfigError(): CollectionRequiresSyncConfigError; +``` + +Defined in: packages/db/src/errors.ts:85 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..c1dbf083e --- /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 + +## 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 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/DeduplicatedLoadSubset.md b/docs/reference/classes/DeduplicatedLoadSubset.md new file mode 100644 index 000000000..948e21c18 --- /dev/null +++ b/docs/reference/classes/DeduplicatedLoadSubset.md @@ -0,0 +1,120 @@ +--- +id: DeduplicatedLoadSubset +title: DeduplicatedLoadSubset +--- + +# Class: DeduplicatedLoadSubset + +Defined in: packages/db/src/query/subset-dedupe.ts:34 + +Deduplicated wrapper for a loadSubset function. +Tracks what data has been loaded and avoids redundant calls by applying +subset logic to predicates. + +## Param + +The options for the DeduplicatedLoadSubset + +## Param + +The underlying loadSubset function to wrap + +## Param + +An optional callback function that is invoked when a loadSubset call is deduplicated. + If the call is deduplicated because the requested data is being loaded by an inflight request, + then this callback is invoked when the inflight request completes successfully and the data is fully loaded. + This callback is useful if you need to track rows per query, in which case you can't ignore deduplicated calls + because you need to know which rows were loaded for each query. + +## Example + +```ts +const dedupe = new DeduplicatedLoadSubset({ loadSubset: myLoadSubset, onDeduplicate: (opts) => console.log(`Call was deduplicated:`, opts) }) + +// First call - fetches data +await dedupe.loadSubset({ where: gt(ref('age'), val(10)) }) + +// Second call - subset of first, returns true immediately +await dedupe.loadSubset({ where: gt(ref('age'), val(20)) }) + +// Clear state to start fresh +dedupe.reset() +``` + +## Constructors + +### Constructor + +```ts +new DeduplicatedLoadSubset(opts): DeduplicatedLoadSubset; +``` + +Defined in: packages/db/src/query/subset-dedupe.ts:67 + +#### Parameters + +##### opts + +###### loadSubset + +(`options`) => `true` \| `Promise`\<`void`\> + +###### onDeduplicate? + +(`options`) => `void` + +#### Returns + +`DeduplicatedLoadSubset` + +## Methods + +### loadSubset() + +```ts +loadSubset(options): true | Promise; +``` + +Defined in: packages/db/src/query/subset-dedupe.ts:85 + +Load a subset of data, with automatic deduplication based on previously +loaded predicates and in-flight requests. + +This method is auto-bound, so it can be safely passed as a callback without +losing its `this` context (e.g., `loadSubset: dedupe.loadSubset` in a sync config). + +#### Parameters + +##### options + +[`LoadSubsetOptions`](../type-aliases/LoadSubsetOptions.md) + +The predicate options (where, orderBy, limit) + +#### Returns + +`true` \| `Promise`\<`void`\> + +true if data is already loaded, or a Promise that resolves when data is loaded + +*** + +### reset() + +```ts +reset(): void; +``` + +Defined in: packages/db/src/query/subset-dedupe.ts:198 + +Reset all tracking state. +Clears the history of loaded predicates and in-flight calls. +Use this when you want to start fresh, for example after clearing the underlying data store. + +Note: Any in-flight requests will still complete, but they will not update the tracking +state after the reset. This prevents old requests from repopulating cleared state. + +#### Returns + +`void` diff --git a/docs/reference/classes/DeleteKeyNotFoundError.md b/docs/reference/classes/DeleteKeyNotFoundError.md new file mode 100644 index 000000000..bf54fc364 --- /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:245 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DeleteKeyNotFoundError(key): DeleteKeyNotFoundError; +``` + +Defined in: packages/db/src/errors.ts:246 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..b647c11db --- /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:430 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new DistinctRequiresSelectError(): DistinctRequiresSelectError; +``` + +Defined in: packages/db/src/errors.ts:431 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..239116a4e --- /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:475 + +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:476 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4befb347f --- /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 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateDbInstanceError(): DuplicateDbInstanceError; +``` + +Defined in: packages/db/src/errors.ts:46 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..e26cf03a7 --- /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:163 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateKeyError(key): DuplicateKeyError; +``` + +Defined in: packages/db/src/errors.ts:164 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..89e79e2f9 --- /dev/null +++ b/docs/reference/classes/DuplicateKeySyncError.md @@ -0,0 +1,241 @@ +--- +id: DuplicateKeySyncError +title: DuplicateKeySyncError +--- + +# Class: DuplicateKeySyncError + +Defined in: packages/db/src/errors.ts:171 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new DuplicateKeySyncError( + key, + collectionId, + options?): DuplicateKeySyncError; +``` + +Defined in: packages/db/src/errors.ts:172 + +#### Parameters + +##### key + +`string` | `number` + +##### collectionId + +`string` + +##### options? + +###### hasCustomGetKey? + +`boolean` + +###### hasDistinct? + +`boolean` + +###### hasJoins? + +`boolean` + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a4c19f45f --- /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:498 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new EmptyReferencePathError(): EmptyReferencePathError; +``` + +Defined in: packages/db/src/errors.ts:499 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..2aaebd1b2 --- /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:573 + +## 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:574 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..ce0aca895 --- /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:436 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new HavingRequiresGroupByError(): HavingRequiresGroupByError; +``` + +Defined in: packages/db/src/errors.ts:437 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..6eee037bd --- /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 + +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 + +#### 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 + +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 + +Get the index ID + +##### Returns + +`number` + +*** + +### index + +#### Get Signature + +```ts +get index(): BaseIndex; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:140 + +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 + +##### Returns + +`Set`\<`TKey`\> + +*** + +### isReady + +#### Get Signature + +```ts +get isReady(): boolean; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:147 + +Check if index is ready + +##### Returns + +`boolean` + +*** + +### keyCount + +#### Get Signature + +```ts +get keyCount(): number; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:211 + +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 + +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 + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### valueMapData + +#### Get Signature + +```ts +get valueMapData(): Map>; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:226 + +##### Returns + +`Map`\<`any`, `Set`\<`TKey`\>\> + +## Methods + +### \_getLazyWrapper() + +```ts +_getLazyWrapper(): LazyIndexWrapper; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:248 + +#### Returns + +[`LazyIndexWrapper`](LazyIndexWrapper.md)\<`TKey`\> + +*** + +### equalityLookup() + +```ts +equalityLookup(value): Set; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:232 + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### getStats() + +```ts +getStats(): IndexStats; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:192 + +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 + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +*** + +### matchesField() + +```ts +matchesField(fieldPath): boolean; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:199 + +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 + +#### Parameters + +##### options + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### supports() + +```ts +supports(operation): boolean; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:185 + +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 + +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..7d7e59cd8 --- /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 + +## Extends + +- [`CollectionStateError`](CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new InvalidCollectionStatusTransitionError( + from, + to, + collectionId): InvalidCollectionStatusTransitionError; +``` + +Defined in: packages/db/src/errors.ts:119 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..d49ae4986 --- /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:560 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinCondition(): InvalidJoinCondition; +``` + +Defined in: packages/db/src/errors.ts:561 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..455be9bb3 --- /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:544 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionLeftSourceError(sourceAlias): InvalidJoinConditionLeftSourceError; +``` + +Defined in: packages/db/src/errors.ts:545 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..51a198ed6 --- /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:552 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionRightSourceError(sourceAlias): InvalidJoinConditionRightSourceError; +``` + +Defined in: packages/db/src/errors.ts:553 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..7e2aa26f8 --- /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:530 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionSameSourceError(sourceAlias): InvalidJoinConditionSameSourceError; +``` + +Defined in: packages/db/src/errors.ts:531 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..b4c7c423b --- /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:538 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new InvalidJoinConditionSourceMismatchError(): InvalidJoinConditionSourceMismatchError; +``` + +Defined in: packages/db/src/errors.ts:539 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/InvalidKeyError.md b/docs/reference/classes/InvalidKeyError.md new file mode 100644 index 000000000..b9594a3bc --- /dev/null +++ b/docs/reference/classes/InvalidKeyError.md @@ -0,0 +1,224 @@ +--- +id: InvalidKeyError +title: InvalidKeyError +--- + +# Class: InvalidKeyError + +Defined in: packages/db/src/errors.ts:154 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new InvalidKeyError(key, item): InvalidKeyError; +``` + +Defined in: packages/db/src/errors.ts:155 + +#### Parameters + +##### key + +`unknown` + +##### item + +`unknown` + +#### Returns + +`InvalidKeyError` + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/InvalidSchemaError.md b/docs/reference/classes/InvalidSchemaError.md new file mode 100644 index 000000000..6c46a9841 --- /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 + +## Extends + +- [`CollectionConfigurationError`](CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new InvalidSchemaError(): InvalidSchemaError; +``` + +Defined in: packages/db/src/errors.ts:91 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..be2c55529 --- /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:380 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new InvalidSourceError(alias): InvalidSourceError; +``` + +Defined in: packages/db/src/errors.ts:381 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/InvalidSourceTypeError.md b/docs/reference/classes/InvalidSourceTypeError.md new file mode 100644 index 000000000..57dff6d39 --- /dev/null +++ b/docs/reference/classes/InvalidSourceTypeError.md @@ -0,0 +1,224 @@ +--- +id: InvalidSourceTypeError +title: InvalidSourceTypeError +--- + +# Class: InvalidSourceTypeError + +Defined in: packages/db/src/errors.ts:388 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new InvalidSourceTypeError(context, type): InvalidSourceTypeError; +``` + +Defined in: packages/db/src/errors.ts:389 + +#### Parameters + +##### context + +`string` + +##### type + +`string` + +#### Returns + +`InvalidSourceTypeError` + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..9b8a318e0 --- /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:638 + +## Extends + +- [`LocalStorageCollectionError`](LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new InvalidStorageDataFormatError(storageKey, key): InvalidStorageDataFormatError; +``` + +Defined in: packages/db/src/errors.ts:639 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..43600216a --- /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:646 + +## Extends + +- [`LocalStorageCollectionError`](LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new InvalidStorageObjectFormatError(storageKey): InvalidStorageObjectFormatError; +``` + +Defined in: packages/db/src/errors.ts:647 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/InvalidWhereExpressionError.md b/docs/reference/classes/InvalidWhereExpressionError.md new file mode 100644 index 000000000..cbf1c596c --- /dev/null +++ b/docs/reference/classes/InvalidWhereExpressionError.md @@ -0,0 +1,220 @@ +--- +id: InvalidWhereExpressionError +title: InvalidWhereExpressionError +--- + +# Class: InvalidWhereExpressionError + +Defined in: packages/db/src/errors.ts:409 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new InvalidWhereExpressionError(valueType): InvalidWhereExpressionError; +``` + +Defined in: packages/db/src/errors.ts:410 + +#### Parameters + +##### valueType + +`string` + +#### Returns + +`InvalidWhereExpressionError` + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/JoinCollectionNotFoundError.md b/docs/reference/classes/JoinCollectionNotFoundError.md new file mode 100644 index 000000000..f1196683f --- /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:510 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new JoinCollectionNotFoundError(collectionId): JoinCollectionNotFoundError; +``` + +Defined in: packages/db/src/errors.ts:511 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..73d8b490e --- /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:397 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new JoinConditionMustBeEqualityError(): JoinConditionMustBeEqualityError; +``` + +Defined in: packages/db/src/errors.ts:398 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..2e84b5220 --- /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:517 + +## 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:518 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4618e8a40 --- /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:231 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new KeyUpdateNotAllowedError(originalKey, newKey): KeyUpdateNotAllowedError; +``` + +Defined in: packages/db/src/errors.ts:232 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..e9d08265d --- /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 + +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 + +#### 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 + +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 + +Get the index ID + +#### Returns + +`number` + +*** + +### getName() + +```ts +getName(): string | undefined; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:111 + +Get the index name + +#### Returns + +`string` \| `undefined` + +*** + +### getResolved() + +```ts +getResolved(): BaseIndex; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:92 + +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 + +Check if already resolved + +#### Returns + +`boolean` + +*** + +### resolve() + +```ts +resolve(): Promise>; +``` + +Defined in: packages/db/src/indexes/lazy-index.ts:69 + +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..da487382e --- /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:442 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new LimitOffsetRequireOrderByError(): LimitOffsetRequireOrderByError; +``` + +Defined in: packages/db/src/errors.ts:443 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..d5aa05b8f --- /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:625 + +## 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:626 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..68ed7c5ea --- /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:722 + +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:723 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..41a857657 --- /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:277 + +## Extends + +- [`MissingHandlerError`](MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingDeleteHandlerError(): MissingDeleteHandlerError; +``` + +Defined in: packages/db/src/errors.ts:278 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..b709f8609 --- /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:254 + +## 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:255 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..88c3f5f13 --- /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:261 + +## Extends + +- [`MissingHandlerError`](MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingInsertHandlerError(): MissingInsertHandlerError; +``` + +Defined in: packages/db/src/errors.ts:262 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..423657b28 --- /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:293 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new MissingMutationFunctionError(): MissingMutationFunctionError; +``` + +Defined in: packages/db/src/errors.ts:294 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a68b695da --- /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:211 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new MissingUpdateArgumentError(): MissingUpdateArgumentError; +``` + +Defined in: packages/db/src/errors.ts:212 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..0f8715637 --- /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:269 + +## Extends + +- [`MissingHandlerError`](MissingHandlerError.md) + +## Constructors + +### Constructor + +```ts +new MissingUpdateHandlerError(): MissingUpdateHandlerError; +``` + +Defined in: packages/db/src/errors.ts:270 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a7d190b64 --- /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 + +## Extends + +- [`CollectionStateError`](CollectionStateError.md) + +## Constructors + +### Constructor + +```ts +new NegativeActiveSubscribersError(): NegativeActiveSubscribersError; +``` + +Defined in: packages/db/src/errors.ts:133 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..160e055ad --- /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:239 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new NoKeysPassedToDeleteError(): NoKeysPassedToDeleteError; +``` + +Defined in: packages/db/src/errors.ts:240 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..9c84841f7 --- /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:217 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new NoKeysPassedToUpdateError(): NoKeysPassedToUpdateError; +``` + +Defined in: packages/db/src/errors.ts:218 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..9427f3973 --- /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:346 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new NoPendingSyncTransactionCommitError(): NoPendingSyncTransactionCommitError; +``` + +Defined in: packages/db/src/errors.ts:347 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..5b0d935ae --- /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:332 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new NoPendingSyncTransactionWriteError(): NoPendingSyncTransactionWriteError; +``` + +Defined in: packages/db/src/errors.ts:333 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..b36a6244a --- /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:580 + +## Extends + +- [`GroupByError`](GroupByError.md) + +## Constructors + +### Constructor + +```ts +new NonAggregateExpressionNotInGroupByError(alias): NonAggregateExpressionNotInGroupByError; +``` + +Defined in: packages/db/src/errors.ts:581 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..3b9cb4ffa --- /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 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new NonRetriableError(message): NonRetriableError; +``` + +Defined in: packages/db/src/errors.ts:11 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..8da662363 --- /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:299 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new OnMutateMustBeSynchronousError(): OnMutateMustBeSynchronousError; +``` + +Defined in: packages/db/src/errors.ts:300 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..8318a014b --- /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:368 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new OnlyOneSourceAllowedError(context): OnlyOneSourceAllowedError; +``` + +Defined in: packages/db/src/errors.ts:369 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..9ec67e720 --- /dev/null +++ b/docs/reference/classes/QueryBuilderError.md @@ -0,0 +1,230 @@ +--- +id: QueryBuilderError +title: QueryBuilderError +--- + +# Class: QueryBuilderError + +Defined in: packages/db/src/errors.ts:361 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Extended by + +- [`OnlyOneSourceAllowedError`](OnlyOneSourceAllowedError.md) +- [`SubQueryMustHaveFromClauseError`](SubQueryMustHaveFromClauseError.md) +- [`InvalidSourceError`](InvalidSourceError.md) +- [`InvalidSourceTypeError`](InvalidSourceTypeError.md) +- [`JoinConditionMustBeEqualityError`](JoinConditionMustBeEqualityError.md) +- [`QueryMustHaveFromClauseError`](QueryMustHaveFromClauseError.md) +- [`InvalidWhereExpressionError`](InvalidWhereExpressionError.md) + +## Constructors + +### Constructor + +```ts +new QueryBuilderError(message): QueryBuilderError; +``` + +Defined in: packages/db/src/errors.ts:362 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..7587bf867 --- /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:423 + +## 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:424 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..5d48a4b1d --- /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:403 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new QueryMustHaveFromClauseError(): QueryMustHaveFromClauseError; +``` + +Defined in: packages/db/src/errors.ts:404 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..6954c99d6 --- /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:666 + +## 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:667 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..b3533422b --- /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 + +## Extends + +- [`CollectionConfigurationError`](CollectionConfigurationError.md) + +## Constructors + +### Constructor + +```ts +new SchemaMustBeSynchronousError(): SchemaMustBeSynchronousError; +``` + +Defined in: packages/db/src/errors.ts:97 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..39222bdba --- /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 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new SchemaValidationError( + type, + issues, + message?): SchemaValidationError; +``` + +Defined in: packages/db/src/errors.ts:25 + +#### 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 + +*** + +### 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 + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..58b7ba118 --- /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:616 + +## Extends + +- [`StorageError`](StorageError.md) + +## Constructors + +### Constructor + +```ts +new SerializationError(operation, originalError): SerializationError; +``` + +Defined in: packages/db/src/errors.ts:617 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4155ddb22 --- /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:734 + +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:735 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..ff1c0141e --- /dev/null +++ b/docs/reference/classes/SortedMap.md @@ -0,0 +1,289 @@ +--- +id: SortedMap +title: SortedMap +--- + +# Class: SortedMap\ + +Defined in: packages/db/src/SortedMap.ts:8 + +A Map implementation that keeps its entries sorted based on a comparator function + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` + +The type of keys in the map (must be string | number) + +### TValue + +`TValue` + +The type of values in the map + +## Constructors + +### Constructor + +```ts +new SortedMap(comparator?): SortedMap; +``` + +Defined in: packages/db/src/SortedMap.ts:19 + +Creates a new SortedMap instance + +#### Parameters + +##### comparator? + +(`a`, `b`) => `number` + +Optional function to compare values for sorting. + If not provided, entries are sorted by key only. + +#### Returns + +`SortedMap`\<`TKey`, `TValue`\> + +## Accessors + +### size + +#### Get Signature + +```ts +get size(): number; +``` + +Defined in: packages/db/src/SortedMap.ts:157 + +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:166 + +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:149 + +Removes all key-value pairs from the map + +#### Returns + +`void` + +*** + +### delete() + +```ts +delete(key): boolean; +``` + +Defined in: packages/db/src/SortedMap.ts:125 + +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:177 + +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:208 + +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:115 + +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:142 + +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:186 + +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:92 + +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:195 + +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..9c8bcf181 --- /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:609 + +## 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:610 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..aaa2d6dab --- /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:632 + +## Extends + +- [`LocalStorageCollectionError`](LocalStorageCollectionError.md) + +## Constructors + +### Constructor + +```ts +new StorageKeyRequiredError(): StorageKeyRequiredError; +``` + +Defined in: packages/db/src/errors.ts:633 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..8d61bc6a2 --- /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:374 + +## Extends + +- [`QueryBuilderError`](QueryBuilderError.md) + +## Constructors + +### Constructor + +```ts +new SubQueryMustHaveFromClauseError(context): SubQueryMustHaveFromClauseError; +``` + +Defined in: packages/db/src/errors.ts:375 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..36aa7e4ed --- /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:694 + +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:695 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..6d2cca99f --- /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:655 + +## Extends + +- [`TanStackDBError`](TanStackDBError.md) + +## Constructors + +### Constructor + +```ts +new SyncCleanupError(collectionId, error): SyncCleanupError; +``` + +Defined in: packages/db/src/errors.ts:656 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..731908cd4 --- /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:352 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new SyncTransactionAlreadyCommittedError(): SyncTransactionAlreadyCommittedError; +``` + +Defined in: packages/db/src/errors.ts:353 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..ad52126d5 --- /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:338 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new SyncTransactionAlreadyCommittedWriteError(): SyncTransactionAlreadyCommittedWriteError; +``` + +Defined in: packages/db/src/errors.ts:339 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..aaa254479 --- /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 + +## 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 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..6c83d73f7 --- /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:316 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionAlreadyCompletedRollbackError(): TransactionAlreadyCompletedRollbackError; +``` + +Defined in: packages/db/src/errors.ts:317 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a6fd042f5 --- /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:286 + +## 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:287 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4388c7ed5 --- /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:324 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionNotPendingCommitError(): TransactionNotPendingCommitError; +``` + +Defined in: packages/db/src/errors.ts:325 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a19240a53 --- /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:308 + +## Extends + +- [`TransactionError`](TransactionError.md) + +## Constructors + +### Constructor + +```ts +new TransactionNotPendingMutateError(): TransactionNotPendingMutateError; +``` + +Defined in: packages/db/src/errors.ts:309 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..0147342a6 --- /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 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new UndefinedKeyError(item): UndefinedKeyError; +``` + +Defined in: packages/db/src/errors.ts:147 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..34bb1f036 --- /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:492 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnknownExpressionTypeError(type): UnknownExpressionTypeError; +``` + +Defined in: packages/db/src/errors.ts:493 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..c4fd5b52c --- /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:504 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnknownFunctionError(functionName): UnknownFunctionError; +``` + +Defined in: packages/db/src/errors.ts:505 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..3b465f183 --- /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:602 + +## Extends + +- [`GroupByError`](GroupByError.md) + +## Constructors + +### Constructor + +```ts +new UnknownHavingExpressionTypeError(type): UnknownHavingExpressionTypeError; +``` + +Defined in: packages/db/src/errors.ts:603 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..60ed47076 --- /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:588 + +## Extends + +- [`GroupByError`](GroupByError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedAggregateFunctionError(functionName): UnsupportedAggregateFunctionError; +``` + +Defined in: packages/db/src/errors.ts:589 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..4434c90f7 --- /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:486 + +## Extends + +- [`QueryCompilationError`](QueryCompilationError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedFromTypeError(type): UnsupportedFromTypeError; +``` + +Defined in: packages/db/src/errors.ts:487 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..3cba4c6c0 --- /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:566 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedJoinSourceTypeError(type): UnsupportedJoinSourceTypeError; +``` + +Defined in: packages/db/src/errors.ts:567 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..93de0854e --- /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:524 + +## Extends + +- [`JoinError`](JoinError.md) + +## Constructors + +### Constructor + +```ts +new UnsupportedJoinTypeError(joinType): UnsupportedJoinTypeError; +``` + +Defined in: packages/db/src/errors.ts:525 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..a8f21af46 --- /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:223 + +## Extends + +- [`CollectionOperationError`](CollectionOperationError.md) + +## Constructors + +### Constructor + +```ts +new UpdateKeyNotFoundError(key): UpdateKeyNotFoundError; +``` + +Defined in: packages/db/src/errors.ts:224 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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..450c1fcc2 --- /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:682 + +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:683 + +#### 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@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +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@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### 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/classes/ElectricDBCollectionError.md b/docs/reference/electric-db-collection/classes/ElectricDBCollectionError.md index 73f7cb2ea..7207ac380 100644 --- a/docs/reference/electric-db-collection/classes/ElectricDBCollectionError.md +++ b/docs/reference/electric-db-collection/classes/ElectricDBCollectionError.md @@ -5,7 +5,7 @@ title: ElectricDBCollectionError # Class: ElectricDBCollectionError -Defined in: [packages/electric-db-collection/src/errors.ts:4](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L4) +Defined in: packages/electric-db-collection/src/errors.ts:4 ## Extends @@ -26,7 +26,7 @@ Defined in: [packages/electric-db-collection/src/errors.ts:4](https://github.com new ElectricDBCollectionError(message, collectionId?): ElectricDBCollectionError; ``` -Defined in: [packages/electric-db-collection/src/errors.ts:5](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L5) +Defined in: packages/electric-db-collection/src/errors.ts:5 #### Parameters diff --git a/docs/reference/electric-db-collection/classes/ExpectedNumberInAwaitTxIdError.md b/docs/reference/electric-db-collection/classes/ExpectedNumberInAwaitTxIdError.md index fe9032923..596cd19fc 100644 --- a/docs/reference/electric-db-collection/classes/ExpectedNumberInAwaitTxIdError.md +++ b/docs/reference/electric-db-collection/classes/ExpectedNumberInAwaitTxIdError.md @@ -5,7 +5,7 @@ title: ExpectedNumberInAwaitTxIdError # Class: ExpectedNumberInAwaitTxIdError -Defined in: [packages/electric-db-collection/src/errors.ts:11](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L11) +Defined in: packages/electric-db-collection/src/errors.ts:11 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/electric-db-collection/src/errors.ts:11](https://github.co new ExpectedNumberInAwaitTxIdError(txIdType, collectionId?): ExpectedNumberInAwaitTxIdError; ``` -Defined in: [packages/electric-db-collection/src/errors.ts:12](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L12) +Defined in: packages/electric-db-collection/src/errors.ts:12 #### Parameters diff --git a/docs/reference/electric-db-collection/classes/StreamAbortedError.md b/docs/reference/electric-db-collection/classes/StreamAbortedError.md index 95cf6b31a..47e2aecfe 100644 --- a/docs/reference/electric-db-collection/classes/StreamAbortedError.md +++ b/docs/reference/electric-db-collection/classes/StreamAbortedError.md @@ -5,7 +5,7 @@ title: StreamAbortedError # Class: StreamAbortedError -Defined in: [packages/electric-db-collection/src/errors.ts:32](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L32) +Defined in: packages/electric-db-collection/src/errors.ts:32 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/electric-db-collection/src/errors.ts:32](https://github.co new StreamAbortedError(collectionId?): StreamAbortedError; ``` -Defined in: [packages/electric-db-collection/src/errors.ts:33](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L33) +Defined in: packages/electric-db-collection/src/errors.ts:33 #### Parameters diff --git a/docs/reference/electric-db-collection/classes/TimeoutWaitingForMatchError.md b/docs/reference/electric-db-collection/classes/TimeoutWaitingForMatchError.md index 9d5a519a0..144d3e139 100644 --- a/docs/reference/electric-db-collection/classes/TimeoutWaitingForMatchError.md +++ b/docs/reference/electric-db-collection/classes/TimeoutWaitingForMatchError.md @@ -5,7 +5,7 @@ title: TimeoutWaitingForMatchError # Class: TimeoutWaitingForMatchError -Defined in: [packages/electric-db-collection/src/errors.ts:25](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L25) +Defined in: packages/electric-db-collection/src/errors.ts:25 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/electric-db-collection/src/errors.ts:25](https://github.co new TimeoutWaitingForMatchError(collectionId?): TimeoutWaitingForMatchError; ``` -Defined in: [packages/electric-db-collection/src/errors.ts:26](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L26) +Defined in: packages/electric-db-collection/src/errors.ts:26 #### Parameters diff --git a/docs/reference/electric-db-collection/classes/TimeoutWaitingForTxIdError.md b/docs/reference/electric-db-collection/classes/TimeoutWaitingForTxIdError.md index e233d874e..89991d97b 100644 --- a/docs/reference/electric-db-collection/classes/TimeoutWaitingForTxIdError.md +++ b/docs/reference/electric-db-collection/classes/TimeoutWaitingForTxIdError.md @@ -5,7 +5,7 @@ title: TimeoutWaitingForTxIdError # Class: TimeoutWaitingForTxIdError -Defined in: [packages/electric-db-collection/src/errors.ts:18](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L18) +Defined in: packages/electric-db-collection/src/errors.ts:18 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/electric-db-collection/src/errors.ts:18](https://github.co new TimeoutWaitingForTxIdError(txId, collectionId?): TimeoutWaitingForTxIdError; ``` -Defined in: [packages/electric-db-collection/src/errors.ts:19](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/errors.ts#L19) +Defined in: packages/electric-db-collection/src/errors.ts:19 #### Parameters diff --git a/docs/reference/electric-db-collection/functions/electricCollectionOptions.md b/docs/reference/electric-db-collection/functions/electricCollectionOptions.md index ff7eb715f..a229857ef 100644 --- a/docs/reference/electric-db-collection/functions/electricCollectionOptions.md +++ b/docs/reference/electric-db-collection/functions/electricCollectionOptions.md @@ -11,7 +11,7 @@ title: electricCollectionOptions function electricCollectionOptions(config): Omit, string | number, T, UtilsRecord>, "utils" | "onInsert" | "onUpdate" | "onDelete"> & Pick, T>, "onInsert" | "onUpdate" | "onDelete"> & object; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:529](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L529) +Defined in: packages/electric-db-collection/src/electric.ts:529 Creates Electric collection options for use with a standard Collection @@ -43,7 +43,7 @@ Collection options with utilities function electricCollectionOptions(config): Omit, "utils" | "onInsert" | "onUpdate" | "onDelete"> & Pick, "onInsert" | "onUpdate" | "onDelete"> & object; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:547](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L547) +Defined in: packages/electric-db-collection/src/electric.ts:547 Creates Electric collection options for use with a standard Collection diff --git a/docs/reference/electric-db-collection/interfaces/ElectricCollectionConfig.md b/docs/reference/electric-db-collection/interfaces/ElectricCollectionConfig.md index dfa78a9d0..59918757c 100644 --- a/docs/reference/electric-db-collection/interfaces/ElectricCollectionConfig.md +++ b/docs/reference/electric-db-collection/interfaces/ElectricCollectionConfig.md @@ -5,7 +5,7 @@ title: ElectricCollectionConfig # Interface: ElectricCollectionConfig\ -Defined in: [packages/electric-db-collection/src/electric.ts:141](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L141) +Defined in: packages/electric-db-collection/src/electric.ts:141 Configuration interface for Electric collection options @@ -35,7 +35,7 @@ The schema type for validation optional [ELECTRIC_TEST_HOOKS]: ElectricTestHooks; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:164](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L164) +Defined in: packages/electric-db-collection/src/electric.ts:164 Internal test hooks (for testing only) Hidden via Symbol to prevent accidental usage in production @@ -48,7 +48,7 @@ Hidden via Symbol to prevent accidental usage in production optional onDelete: (params) => Promise; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:281](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L281) +Defined in: packages/electric-db-collection/src/electric.ts:281 Optional asynchronous handler function called before a delete operation @@ -100,7 +100,7 @@ onDelete: async ({ transaction, collection }) => { optional onInsert: (params) => Promise; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:212](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L212) +Defined in: packages/electric-db-collection/src/electric.ts:212 Optional asynchronous handler function called before an insert operation @@ -174,7 +174,7 @@ onInsert: async ({ transaction, collection }) => { optional onUpdate: (params) => Promise; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:247](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L247) +Defined in: packages/electric-db-collection/src/electric.ts:247 Optional asynchronous handler function called before an update operation @@ -227,7 +227,7 @@ onUpdate: async ({ transaction, collection }) => { shapeOptions: ShapeStreamOptions>; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:157](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L157) +Defined in: packages/electric-db-collection/src/electric.ts:157 Configuration options for the ElectricSQL ShapeStream @@ -239,4 +239,4 @@ Configuration options for the ElectricSQL ShapeStream optional syncMode: ElectricSyncMode; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:158](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L158) +Defined in: packages/electric-db-collection/src/electric.ts:158 diff --git a/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md b/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md index f91cbe8da..c715436b6 100644 --- a/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md +++ b/docs/reference/electric-db-collection/interfaces/ElectricCollectionUtils.md @@ -5,7 +5,7 @@ title: ElectricCollectionUtils # Interface: ElectricCollectionUtils\ -Defined in: [packages/electric-db-collection/src/electric.ts:511](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L511) +Defined in: packages/electric-db-collection/src/electric.ts:511 Electric collection utilities type @@ -33,7 +33,7 @@ Electric collection utilities type awaitMatch: AwaitMatchFn; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:515](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L515) +Defined in: packages/electric-db-collection/src/electric.ts:515 *** @@ -43,4 +43,4 @@ Defined in: [packages/electric-db-collection/src/electric.ts:515](https://github awaitTxId: AwaitTxIdFn; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:514](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L514) +Defined in: packages/electric-db-collection/src/electric.ts:514 diff --git a/docs/reference/electric-db-collection/type-aliases/AwaitTxIdFn.md b/docs/reference/electric-db-collection/type-aliases/AwaitTxIdFn.md index a5ebc225d..9ce673bab 100644 --- a/docs/reference/electric-db-collection/type-aliases/AwaitTxIdFn.md +++ b/docs/reference/electric-db-collection/type-aliases/AwaitTxIdFn.md @@ -9,7 +9,7 @@ title: AwaitTxIdFn type AwaitTxIdFn = (txId, timeout?) => Promise; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:498](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L498) +Defined in: packages/electric-db-collection/src/electric.ts:498 Type for the awaitTxId utility function diff --git a/docs/reference/electric-db-collection/type-aliases/Txid.md b/docs/reference/electric-db-collection/type-aliases/Txid.md index 2133770f8..d2b4b33b9 100644 --- a/docs/reference/electric-db-collection/type-aliases/Txid.md +++ b/docs/reference/electric-db-collection/type-aliases/Txid.md @@ -9,6 +9,6 @@ title: Txid type Txid = number; ``` -Defined in: [packages/electric-db-collection/src/electric.ts:79](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/src/electric.ts#L79) +Defined in: packages/electric-db-collection/src/electric.ts:79 Type representing a transaction ID in ElectricSQL diff --git a/docs/reference/functions/add.md b/docs/reference/functions/add.md new file mode 100644 index 000000000..aeee8894c --- /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 + +## 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..b21fcfbc7 --- /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 + +### 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 + +### 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..164dcfc2d --- /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 + +## 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..52e988db7 --- /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 + +## 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..d503b8172 --- /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 + +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..d1463b1aa --- /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 + +## 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..acf734285 --- /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 + +## 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..54d866425 --- /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:1130 + +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..52fae42ba --- /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:628 + +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..c980e127f --- /dev/null +++ b/docs/reference/functions/createCollection.md @@ -0,0 +1,878 @@ +--- +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:134 + +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` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +`Omit`\<[`CollectionConfig`](../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, `TUtils`\>, `"utils"`\> & `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, Exclude, T, InferSchemaInput> & NonSingleResult; +``` + +Defined in: packages/db/src/collection/index.ts:151 + +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` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, `TUtils`\> & `object` & [`NonSingleResult`](../type-aliases/NonSingleResult.md) + +Collection options with optional utilities + +### Returns + +[`Collection`](../interfaces/Collection.md)\<[`InferSchemaOutput`](../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `Exclude`\<`TUtils`, `undefined`\>, `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:169 + +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` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +`Omit`\<[`CollectionConfig`](../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, `TUtils`\>, `"utils"`\> & `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, TKey, TUtils, T, InferSchemaInput> & SingleResult; +``` + +Defined in: packages/db/src/collection/index.ts:185 + +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` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +[`CollectionConfig`](../interfaces/CollectionConfig.md)\<[`InferSchemaOutput`](../type-aliases/InferSchemaOutput.md)\<`T`\>, `TKey`, `T`, `TUtils`\> & `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:198 + +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` + +The type of the key for the collection + +#### TUtils + +`TUtils` *extends* [`UtilsRecord`](../type-aliases/UtilsRecord.md) + +The utilities record type + +### Parameters + +#### options + +`Omit`\<[`CollectionConfig`](../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, `TUtils`\>, `"utils"`\> & `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 & NonSingleResult; +``` + +Defined in: packages/db/src/collection/index.ts:211 + +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`, `TUtils`\> & `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:223 + +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 + +`Omit`\<[`CollectionConfig`](../interfaces/CollectionConfig.md)\<`T`, `TKey`, `never`, `TUtils`\>, `"utils"`\> & `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: () => {} } +}) +``` + +## Call Signature + +```ts +function createCollection(options): Collection & SingleResult; +``` + +Defined in: packages/db/src/collection/index.ts:236 + +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`, `TUtils`\> & `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..8d4961937 --- /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 + +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 + +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..dcc99d791 --- /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 + +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..f5282d993 --- /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 + +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..4fdfbbead --- /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 + +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..22c1d9ee0 --- /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 + +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/deepEquals.md b/docs/reference/functions/deepEquals.md new file mode 100644 index 000000000..6c9690bea --- /dev/null +++ b/docs/reference/functions/deepEquals.md @@ -0,0 +1,45 @@ +--- +id: deepEquals +title: deepEquals +--- + +# Function: deepEquals() + +```ts +function deepEquals(a, b): boolean; +``` + +Defined in: packages/db/src/utils.ts:29 + +Deep equality function that compares two values recursively +Handles primitives, objects, arrays, Date, RegExp, Map, Set, TypedArrays, and Temporal objects + +## Parameters + +### a + +`any` + +First value to compare + +### b + +`any` + +Second value to compare + +## Returns + +`boolean` + +True if the values are deeply equal, false otherwise + +## Example + +```typescript +deepEquals({ a: 1, b: 2 }, { b: 2, a: 1 }) // true (property order doesn't matter) +deepEquals([1, { x: 2 }], [1, { x: 2 }]) // true +deepEquals({ a: 1 }, { a: 2 }) // false +deepEquals(new Date('2023-01-01'), new Date('2023-01-01')) // true +deepEquals(new Map([['a', 1]]), new Map([['a', 1]])) // true +``` diff --git a/docs/reference/functions/eq.md b/docs/reference/functions/eq.md new file mode 100644 index 000000000..9e71b2a2f --- /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 + +### 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 + +### 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 + +### 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/extractFieldPath.md b/docs/reference/functions/extractFieldPath.md new file mode 100644 index 000000000..3aabf36e7 --- /dev/null +++ b/docs/reference/functions/extractFieldPath.md @@ -0,0 +1,36 @@ +--- +id: extractFieldPath +title: extractFieldPath +--- + +# Function: extractFieldPath() + +```ts +function extractFieldPath(expr): FieldPath | null; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:107 + +Extracts the field path from a PropRef expression. +Returns null for non-ref expressions. + +## Parameters + +### expr + +`BasicExpression` + +The expression to extract from + +## Returns + +[`FieldPath`](../type-aliases/FieldPath.md) \| `null` + +The field path array, or null + +## Example + +```typescript +const field = extractFieldPath(someExpression) +// Returns: ['product', 'category'] +``` diff --git a/docs/reference/functions/extractSimpleComparisons.md b/docs/reference/functions/extractSimpleComparisons.md new file mode 100644 index 000000000..426c1ca8f --- /dev/null +++ b/docs/reference/functions/extractSimpleComparisons.md @@ -0,0 +1,50 @@ +--- +id: extractSimpleComparisons +title: extractSimpleComparisons +--- + +# Function: extractSimpleComparisons() + +```ts +function extractSimpleComparisons(expr): SimpleComparison[]; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:327 + +Extracts all simple comparisons from a WHERE expression. +This is useful for simple APIs that only support basic filters. + +Note: This only works for simple AND-ed conditions and NOT-wrapped comparisons. +Throws an error if it encounters unsupported operations like OR or complex nested expressions. + +NOT operators are flattened by prefixing the operator name (e.g., `not(eq(...))` becomes `not_eq`). + +## Parameters + +### expr + +The WHERE expression to parse + +`BasicExpression`\<`boolean`\> | `null` | `undefined` + +## Returns + +[`SimpleComparison`](../interfaces/SimpleComparison.md)[] + +Array of simple comparisons + +## Throws + +Error if expression contains OR or other unsupported operations + +## Example + +```typescript +const comparisons = extractSimpleComparisons(where) +// Returns: [ +// { field: ['category'], operator: 'eq', value: 'electronics' }, +// { field: ['price'], operator: 'lt', value: 100 }, +// { field: ['email'], operator: 'isNull' }, // No value for null checks +// { field: ['status'], operator: 'not_eq', value: 'archived' } +// ] +``` diff --git a/docs/reference/functions/extractValue.md b/docs/reference/functions/extractValue.md new file mode 100644 index 000000000..aa47ab40a --- /dev/null +++ b/docs/reference/functions/extractValue.md @@ -0,0 +1,36 @@ +--- +id: extractValue +title: extractValue +--- + +# Function: extractValue() + +```ts +function extractValue(expr): any; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:127 + +Extracts the value from a Value expression. +Returns undefined for non-value expressions. + +## Parameters + +### expr + +`BasicExpression` + +The expression to extract from + +## Returns + +`any` + +The extracted value + +## Example + +```typescript +const val = extractValue(someExpression) +// Returns: 'electronics' +``` diff --git a/docs/reference/functions/getActiveTransaction.md b/docs/reference/functions/getActiveTransaction.md new file mode 100644 index 000000000..11b47a55b --- /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 + +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..ae49f59a0 --- /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 + +### 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 + +### 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 + +### 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..bc37f946c --- /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 + +### 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 + +### 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 + +### 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..66661ca23 --- /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 + +## 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..3660f21c7 --- /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 + +## Parameters + +### value + +`any` + +### array + +`any` + +## Returns + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isLimitSubset.md b/docs/reference/functions/isLimitSubset.md new file mode 100644 index 000000000..b313ca74b --- /dev/null +++ b/docs/reference/functions/isLimitSubset.md @@ -0,0 +1,46 @@ +--- +id: isLimitSubset +title: isLimitSubset +--- + +# Function: isLimitSubset() + +```ts +function isLimitSubset(subset, superset): boolean; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:773 + +Check if one limit is a subset of another. +Returns true if the subset limit requirements are satisfied by the superset limit. + +Note: This function does NOT consider offset. For offset-aware subset checking, +use `isOffsetLimitSubset` instead. + +## Parameters + +### subset + +The limit requirement to check + +`number` | `undefined` + +### superset + +The limit that might satisfy the requirement + +`number` | `undefined` + +## Returns + +`boolean` + +true if subset is satisfied by superset + +## Example + +```ts +isLimitSubset(10, 20) // true (requesting 10 items when 20 are available) +isLimitSubset(20, 10) // false (requesting 20 items when only 10 are available) +isLimitSubset(10, undefined) // true (requesting 10 items when unlimited are available) +``` diff --git a/docs/reference/functions/isNull.md b/docs/reference/functions/isNull.md new file mode 100644 index 000000000..8876833f7 --- /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 + +## Parameters + +### value + +`any` + +## Returns + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isOffsetLimitSubset.md b/docs/reference/functions/isOffsetLimitSubset.md new file mode 100644 index 000000000..af0013bfe --- /dev/null +++ b/docs/reference/functions/isOffsetLimitSubset.md @@ -0,0 +1,63 @@ +--- +id: isOffsetLimitSubset +title: isOffsetLimitSubset +--- + +# Function: isOffsetLimitSubset() + +```ts +function isOffsetLimitSubset(subset, superset): boolean; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:813 + +Check if one offset+limit range is a subset of another. +Returns true if the subset range is fully contained within the superset range. + +A query with `{limit: 10, offset: 0}` loads rows [0, 10). +A query with `{limit: 10, offset: 20}` loads rows [20, 30). + +For subset to be satisfied by superset: +- Superset must start at or before subset (superset.offset <= subset.offset) +- Superset must end at or after subset (superset.offset + superset.limit >= subset.offset + subset.limit) + +## Parameters + +### subset + +The offset+limit requirements to check + +#### limit? + +`number` + +#### offset? + +`number` + +### superset + +The offset+limit that might satisfy the requirements + +#### limit? + +`number` + +#### offset? + +`number` + +## Returns + +`boolean` + +true if subset range is fully contained within superset range + +## Example + +```ts +isOffsetLimitSubset({ offset: 0, limit: 5 }, { offset: 0, limit: 10 }) // true +isOffsetLimitSubset({ offset: 5, limit: 5 }, { offset: 0, limit: 10 }) // true (rows 5-9 within 0-9) +isOffsetLimitSubset({ offset: 5, limit: 10 }, { offset: 0, limit: 10 }) // false (rows 5-14 exceed 0-9) +isOffsetLimitSubset({ offset: 20, limit: 10 }, { offset: 0, limit: 10 }) // false (rows 20-29 outside 0-9) +``` diff --git a/docs/reference/functions/isOrderBySubset.md b/docs/reference/functions/isOrderBySubset.md new file mode 100644 index 000000000..a121dfda3 --- /dev/null +++ b/docs/reference/functions/isOrderBySubset.md @@ -0,0 +1,42 @@ +--- +id: isOrderBySubset +title: isOrderBySubset +--- + +# Function: isOrderBySubset() + +```ts +function isOrderBySubset(subset, superset): boolean; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:715 + +Check if one orderBy clause is a subset of another. +Returns true if the subset ordering requirements are satisfied by the superset ordering. + +## Parameters + +### subset + +The ordering requirements to check + +[`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md) | `undefined` + +### superset + +The ordering that might satisfy the requirements + +[`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md) | `undefined` + +## Returns + +`boolean` + +true if subset is satisfied by superset + +## Example + +```ts +// Subset is prefix of superset +isOrderBySubset([{expr: age, asc}], [{expr: age, asc}, {expr: name, desc}]) // true +``` diff --git a/docs/reference/functions/isPredicateSubset.md b/docs/reference/functions/isPredicateSubset.md new file mode 100644 index 000000000..27d82ca64 --- /dev/null +++ b/docs/reference/functions/isPredicateSubset.md @@ -0,0 +1,44 @@ +--- +id: isPredicateSubset +title: isPredicateSubset +--- + +# Function: isPredicateSubset() + +```ts +function isPredicateSubset(subset, superset): boolean; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:856 + +Check if one predicate (where + orderBy + limit + offset) is a subset of another. +Returns true if all aspects of the subset predicate are satisfied by the superset. + +## Parameters + +### subset + +[`LoadSubsetOptions`](../type-aliases/LoadSubsetOptions.md) + +The predicate requirements to check + +### superset + +[`LoadSubsetOptions`](../type-aliases/LoadSubsetOptions.md) + +The predicate that might satisfy the requirements + +## Returns + +`boolean` + +true if subset is satisfied by superset + +## Example + +```ts +isPredicateSubset( + { where: gt(ref('age'), val(20)), limit: 10 }, + { where: gt(ref('age'), val(10)), limit: 20 } +) // true +``` diff --git a/docs/reference/functions/isUndefined.md b/docs/reference/functions/isUndefined.md new file mode 100644 index 000000000..a88a57709 --- /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 + +## Parameters + +### value + +`any` + +## Returns + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/isWhereSubset.md b/docs/reference/functions/isWhereSubset.md new file mode 100644 index 000000000..d244fc167 --- /dev/null +++ b/docs/reference/functions/isWhereSubset.md @@ -0,0 +1,47 @@ +--- +id: isWhereSubset +title: isWhereSubset +--- + +# Function: isWhereSubset() + +```ts +function isWhereSubset(subset, superset): boolean; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:21 + +Check if one where clause is a logical subset of another. +Returns true if the subset predicate is more restrictive than (or equal to) the superset predicate. + +## Parameters + +### subset + +The potentially more restrictive predicate + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> | `undefined` + +### superset + +The potentially less restrictive predicate + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> | `undefined` + +## Returns + +`boolean` + +true if subset logically implies superset + +## Examples + +```ts +// age > 20 is subset of age > 10 (more restrictive) +isWhereSubset(gt(ref('age'), val(20)), gt(ref('age'), val(10))) // true +``` + +```ts +// age > 10 AND name = 'X' is subset of age > 10 (more conditions) +isWhereSubset(and(gt(ref('age'), val(10)), eq(ref('name'), val('X'))), gt(ref('age'), val(10))) // true +``` diff --git a/docs/reference/functions/length.md b/docs/reference/functions/length.md new file mode 100644 index 000000000..734414cad --- /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 + +## 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..61b20d5d8 --- /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 + +## 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..c7b396104 --- /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 + +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..0fcfd4bf3 --- /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, LocalOnlyCollectionUtils> & object & object; +``` + +Defined in: packages/db/src/local-only.ts:149 + +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`, [`LocalOnlyCollectionUtils`](../interfaces/LocalOnlyCollectionUtils.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 + +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`, [`LocalOnlyCollectionUtils`](../interfaces/LocalOnlyCollectionUtils.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..ace8385c9 --- /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, LocalStorageCollectionUtils> & object; +``` + +Defined in: packages/db/src/local-storage.ts:316 + +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`, [`LocalStorageCollectionUtils`](../interfaces/LocalStorageCollectionUtils.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:336 + +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`, [`LocalStorageCollectionUtils`](../interfaces/LocalStorageCollectionUtils.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..f8f4c5444 --- /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 + +## 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..3189bbdee --- /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 + +### 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 + +### 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 + +### 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..4d62e3f6d --- /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 + +### 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 + +### 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 + +### 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..ebd6aea92 --- /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 + +## 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..98ca44f05 --- /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 + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`AggregateReturnType`\<`T`\> diff --git a/docs/reference/functions/minusWherePredicates.md b/docs/reference/functions/minusWherePredicates.md new file mode 100644 index 000000000..413993515 --- /dev/null +++ b/docs/reference/functions/minusWherePredicates.md @@ -0,0 +1,73 @@ +--- +id: minusWherePredicates +title: minusWherePredicates +--- + +# Function: minusWherePredicates() + +```ts +function minusWherePredicates(fromPredicate, subtractPredicate): + | BasicExpression + | null; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:340 + +Compute the difference between two where predicates: `fromPredicate AND NOT(subtractPredicate)`. +Returns the simplified predicate, or null if the difference cannot be simplified +(in which case the caller should fetch the full fromPredicate). + +## Parameters + +### fromPredicate + +The predicate to subtract from + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> | `undefined` + +### subtractPredicate + +The predicate to subtract + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> | `undefined` + +## Returns + + \| [`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + \| `null` + +The simplified difference, or null if cannot be simplified + +## Examples + +```ts +// Range difference +minusWherePredicates( + gt(ref('age'), val(10)), // age > 10 + gt(ref('age'), val(20)) // age > 20 +) // → age > 10 AND age <= 20 +``` + +```ts +// Set difference +minusWherePredicates( + inOp(ref('status'), ['A', 'B', 'C', 'D']), // status IN ['A','B','C','D'] + inOp(ref('status'), ['B', 'C']) // status IN ['B','C'] +) // → status IN ['A', 'D'] +``` + +```ts +// Common conditions +minusWherePredicates( + and(gt(ref('age'), val(10)), eq(ref('status'), val('active'))), // age > 10 AND status = 'active' + and(gt(ref('age'), val(20)), eq(ref('status'), val('active'))) // age > 20 AND status = 'active' +) // → age > 10 AND age <= 20 AND status = 'active' +``` + +```ts +// Complete overlap - empty result +minusWherePredicates( + gt(ref('age'), val(20)), // age > 20 + gt(ref('age'), val(10)) // age > 10 +) // → {type: 'val', value: false} (empty set) +``` diff --git a/docs/reference/functions/not.md b/docs/reference/functions/not.md new file mode 100644 index 000000000..b2bf46f5e --- /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 + +## 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..332bc852c --- /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 + +### 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 + +### Parameters + +#### left + +`any` + +#### right + +`any` + +#### rest + +...`any`[] + +### Returns + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> diff --git a/docs/reference/functions/parseLoadSubsetOptions.md b/docs/reference/functions/parseLoadSubsetOptions.md new file mode 100644 index 000000000..2bce25667 --- /dev/null +++ b/docs/reference/functions/parseLoadSubsetOptions.md @@ -0,0 +1,68 @@ +--- +id: parseLoadSubsetOptions +title: parseLoadSubsetOptions +--- + +# Function: parseLoadSubsetOptions() + +```ts +function parseLoadSubsetOptions(options): object; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:499 + +Convenience function to get all LoadSubsetOptions in a pre-parsed format. +Good starting point for simple use cases. + +## Parameters + +### options + +The LoadSubsetOptions from ctx.meta + +\{ +`limit?`: `number`; +`orderBy?`: [`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md); +`where?`: `BasicExpression`\<`boolean`\>; +\} | `null` | `undefined` + +## Returns + +`object` + +Pre-parsed filters, sorts, and limit + +### filters + +```ts +filters: SimpleComparison[]; +``` + +### limit? + +```ts +optional limit: number; +``` + +### sorts + +```ts +sorts: ParsedOrderBy[]; +``` + +## Example + +```typescript +queryFn: async (ctx) => { + const parsed = parseLoadSubsetOptions(ctx.meta?.loadSubsetOptions) + + // Convert to your API format + return api.getProducts({ + ...Object.fromEntries( + parsed.filters.map(f => [`${f.field.join('.')}_${f.operator}`, f.value]) + ), + sort: parsed.sorts.map(s => `${s.field.join('.')}:${s.direction}`).join(','), + limit: parsed.limit + }) +} +``` diff --git a/docs/reference/functions/parseOrderByExpression.md b/docs/reference/functions/parseOrderByExpression.md new file mode 100644 index 000000000..cd4eafddb --- /dev/null +++ b/docs/reference/functions/parseOrderByExpression.md @@ -0,0 +1,38 @@ +--- +id: parseOrderByExpression +title: parseOrderByExpression +--- + +# Function: parseOrderByExpression() + +```ts +function parseOrderByExpression(orderBy): ParsedOrderBy[]; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:265 + +Parses an ORDER BY expression into a simple array of sort specifications. + +## Parameters + +### orderBy + +The ORDER BY expression array + +[`OrderBy`](../@tanstack/namespaces/IR/type-aliases/OrderBy.md) | `null` | `undefined` + +## Returns + +[`ParsedOrderBy`](../interfaces/ParsedOrderBy.md)[] + +Array of parsed order by specifications + +## Example + +```typescript +const sorts = parseOrderByExpression(orderBy) +// Returns: [ +// { field: ['category'], direction: 'asc', nulls: 'last' }, +// { field: ['price'], direction: 'desc', nulls: 'last' } +// ] +``` diff --git a/docs/reference/functions/parseWhereExpression.md b/docs/reference/functions/parseWhereExpression.md new file mode 100644 index 000000000..54c1e0463 --- /dev/null +++ b/docs/reference/functions/parseWhereExpression.md @@ -0,0 +1,71 @@ +--- +id: parseWhereExpression +title: parseWhereExpression +--- + +# Function: parseWhereExpression() + +```ts +function parseWhereExpression(expr, options): T | null; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:201 + +Parses a WHERE expression into a custom format using provided handlers. + +This is the main helper for converting TanStack DB where clauses into your API's filter format. +You provide handlers for each operator, and this function traverses the expression tree +and calls the appropriate handlers. + +## Type Parameters + +### T + +`T` = `any` + +## Parameters + +### expr + +The WHERE expression to parse + +`BasicExpression`\<`boolean`\> | `null` | `undefined` + +### options + +[`ParseWhereOptions`](../interfaces/ParseWhereOptions.md)\<`T`\> + +Configuration with handler functions for each operator + +## Returns + +`T` \| `null` + +The parsed result in your custom format + +## Examples + +```typescript +// REST API with query parameters +const filters = parseWhereExpression(where, { + handlers: { + eq: (field, value) => ({ [field.join('.')]: value }), + lt: (field, value) => ({ [`${field.join('.')}_lt`]: value }), + gt: (field, value) => ({ [`${field.join('.')}_gt`]: value }), + and: (...filters) => Object.assign({}, ...filters), + or: (...filters) => ({ $or: filters }) + } +}) +// Returns: { category: 'electronics', price_lt: 100 } +``` + +```typescript +// GraphQL where clause +const where = parseWhereExpression(whereExpr, { + handlers: { + eq: (field, value) => ({ [field.join('_')]: { _eq: value } }), + lt: (field, value) => ({ [field.join('_')]: { _lt: value } }), + and: (...filters) => ({ _and: filters }) + } +}) +``` diff --git a/docs/reference/functions/queueStrategy.md b/docs/reference/functions/queueStrategy.md new file mode 100644 index 000000000..56deb648d --- /dev/null +++ b/docs/reference/functions/queueStrategy.md @@ -0,0 +1,69 @@ +--- +id: queueStrategy +title: queueStrategy +--- + +# Function: queueStrategy() + +```ts +function queueStrategy(options?): QueueStrategy; +``` + +Defined in: packages/db/src/strategies/queueStrategy.ts:52 + +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 attempted sequentially. Each transaction commit completes before +the next one starts. Useful when data consistency is critical and +every operation must be attempted in order. + +**Error handling behavior:** +- If a mutation fails, it is NOT automatically retried - the transaction transitions to "failed" state +- Failed mutations surface their error via `transaction.isPersisted.promise` (which will reject) +- Subsequent mutations continue processing - a single failure does not block the queue +- Each mutation is independent; there is no all-or-nothing transaction semantics + +## 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..66f2d6f12 --- /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 + +## 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..1d5226564 --- /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 + +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/unionWherePredicates.md b/docs/reference/functions/unionWherePredicates.md new file mode 100644 index 000000000..6c6465f07 --- /dev/null +++ b/docs/reference/functions/unionWherePredicates.md @@ -0,0 +1,42 @@ +--- +id: unionWherePredicates +title: unionWherePredicates +--- + +# Function: unionWherePredicates() + +```ts +function unionWherePredicates(predicates): BasicExpression; +``` + +Defined in: packages/db/src/query/predicate-utils.ts:297 + +Combine multiple where predicates with OR logic (union). +Returns a predicate that is satisfied when any input predicate is satisfied. +Simplifies when possible (e.g., age > 10 OR age > 20 → age > 10). + +## Parameters + +### predicates + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\>[] + +Array of where predicates to union + +## Returns + +[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)\<`boolean`\> + +Combined predicate representing the union + +## Examples + +```ts +// Take least restrictive +unionWherePredicates([gt(ref('age'), val(10)), gt(ref('age'), val(20))]) // age > 10 +``` + +```ts +// Combine equals into IN +unionWherePredicates([eq(ref('age'), val(5)), eq(ref('age'), val(10))]) // age IN [5, 10] +``` diff --git a/docs/reference/functions/upper.md b/docs/reference/functions/upper.md new file mode 100644 index 000000000..85d8a9ff8 --- /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 + +## Type Parameters + +### T + +`T` *extends* `unknown` + +## Parameters + +### arg + +`T` + +## Returns + +`StringFunctionReturnType`\<`T`\> diff --git a/docs/reference/functions/walkExpression.md b/docs/reference/functions/walkExpression.md new file mode 100644 index 000000000..e2dfb623c --- /dev/null +++ b/docs/reference/functions/walkExpression.md @@ -0,0 +1,43 @@ +--- +id: walkExpression +title: walkExpression +--- + +# Function: walkExpression() + +```ts +function walkExpression(expr, visitor): void; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:150 + +Generic expression tree walker that visits each node in the expression. +Useful for implementing custom parsing logic. + +## Parameters + +### expr + +The expression to walk + +`BasicExpression`\<`any`\> | `null` | `undefined` + +### visitor + +(`node`) => `void` + +Visitor function called for each node + +## Returns + +`void` + +## Example + +```typescript +walkExpression(whereExpr, (node) => { + if (node.type === 'func' && node.name === 'eq') { + console.log('Found equality comparison') + } +}) +``` diff --git a/docs/reference/functions/withArrayChangeTracking.md b/docs/reference/functions/withArrayChangeTracking.md new file mode 100644 index 000000000..72dc704fb --- /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:1171 + +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..163f53c6e --- /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:1152 + +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..d2387c6e3 --- /dev/null +++ b/docs/reference/index.md @@ -0,0 +1,303 @@ +--- +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) +- [DeduplicatedLoadSubset](classes/DeduplicatedLoadSubset.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) +- [InvalidKeyError](classes/InvalidKeyError.md) +- [InvalidSchemaError](classes/InvalidSchemaError.md) +- [InvalidSourceError](classes/InvalidSourceError.md) +- [InvalidSourceTypeError](classes/InvalidSourceTypeError.md) +- [InvalidStorageDataFormatError](classes/InvalidStorageDataFormatError.md) +- [InvalidStorageObjectFormatError](classes/InvalidStorageObjectFormatError.md) +- [InvalidWhereExpressionError](classes/InvalidWhereExpressionError.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) +- [CollectionLike](interfaces/CollectionLike.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) +- [PacedMutationsConfig](interfaces/PacedMutationsConfig.md) +- [ParsedOrderBy](interfaces/ParsedOrderBy.md) +- [Parser](interfaces/Parser.md) +- [ParseWhereOptions](interfaces/ParseWhereOptions.md) +- [PendingMutation](interfaces/PendingMutation.md) +- [QueueStrategy](interfaces/QueueStrategy.md) +- [QueueStrategyOptions](interfaces/QueueStrategyOptions.md) +- [RangeQueryOptions](interfaces/RangeQueryOptions.md) +- [SimpleComparison](interfaces/SimpleComparison.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 + +- [ApplyJoinOptionalityToMergedSchema](type-aliases/ApplyJoinOptionalityToMergedSchema.md) +- [ChangeListener](type-aliases/ChangeListener.md) +- [ChangeMessageOrDeleteKeyMessage](type-aliases/ChangeMessageOrDeleteKeyMessage.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) +- [ContextSchema](type-aliases/ContextSchema.md) +- [CursorExpressions](type-aliases/CursorExpressions.md) +- [DeleteKeyMessage](type-aliases/DeleteKeyMessage.md) +- [DeleteMutationFn](type-aliases/DeleteMutationFn.md) +- [DeleteMutationFnParams](type-aliases/DeleteMutationFnParams.md) +- [ExtractContext](type-aliases/ExtractContext.md) +- [FieldPath](type-aliases/FieldPath.md) +- [Fn](type-aliases/Fn.md) +- [FunctionalHavingRow](type-aliases/FunctionalHavingRow.md) +- [GetResult](type-aliases/GetResult.md) +- [GetStorageSizeFn](type-aliases/GetStorageSizeFn.md) +- [GroupByCallback](type-aliases/GroupByCallback.md) +- [IndexConstructor](type-aliases/IndexConstructor.md) +- [IndexOperation](type-aliases/IndexOperation.md) +- [IndexResolver](type-aliases/IndexResolver.md) +- [InferCollectionType](type-aliases/InferCollectionType.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) +- [JoinOnCallback](type-aliases/JoinOnCallback.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) +- [MakeOptional](type-aliases/MakeOptional.md) +- [MaybeSingleResult](type-aliases/MaybeSingleResult.md) +- [MergeContextForJoinCallback](type-aliases/MergeContextForJoinCallback.md) +- [MergeContextWithJoinType](type-aliases/MergeContextWithJoinType.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) +- [OperatorName](type-aliases/OperatorName.md) +- [OptimisticChangeMessage](type-aliases/OptimisticChangeMessage.md) +- [OrderByCallback](type-aliases/OrderByCallback.md) +- [Prettify](type-aliases/Prettify.md) +- [QueryBuilder](type-aliases/QueryBuilder.md) +- [QueryResult](type-aliases/QueryResult.md) +- [Ref](type-aliases/Ref.md) +- [RefsForContext](type-aliases/RefsForContext.md) +- [ResolveTransactionChanges](type-aliases/ResolveTransactionChanges.md) +- [ResultStream](type-aliases/ResultStream.md) +- [ResultTypeFromSelect](type-aliases/ResultTypeFromSelect.md) +- [Row](type-aliases/Row.md) +- [SchemaFromSource](type-aliases/SchemaFromSource.md) +- [SelectObject](type-aliases/SelectObject.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) +- [StringCollationConfig](type-aliases/StringCollationConfig.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) +- [UnloadSubsetFn](type-aliases/UnloadSubsetFn.md) +- [UpdateMutationFn](type-aliases/UpdateMutationFn.md) +- [UpdateMutationFnParams](type-aliases/UpdateMutationFnParams.md) +- [UtilsRecord](type-aliases/UtilsRecord.md) +- [WhereCallback](type-aliases/WhereCallback.md) +- [WithResult](type-aliases/WithResult.md) +- [WritableDeep](type-aliases/WritableDeep.md) + +## Variables + +- [IndexOperation](variables/IndexOperation.md) +- [operators](variables/operators.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) +- [deepEquals](functions/deepEquals.md) +- [eq](functions/eq.md) +- [extractFieldPath](functions/extractFieldPath.md) +- [extractSimpleComparisons](functions/extractSimpleComparisons.md) +- [extractValue](functions/extractValue.md) +- [getActiveTransaction](functions/getActiveTransaction.md) +- [gt](functions/gt.md) +- [gte](functions/gte.md) +- [ilike](functions/ilike.md) +- [inArray](functions/inArray.md) +- [isLimitSubset](functions/isLimitSubset.md) +- [isNull](functions/isNull.md) +- [isOffsetLimitSubset](functions/isOffsetLimitSubset.md) +- [isOrderBySubset](functions/isOrderBySubset.md) +- [isPredicateSubset](functions/isPredicateSubset.md) +- [isUndefined](functions/isUndefined.md) +- [isWhereSubset](functions/isWhereSubset.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) +- [minusWherePredicates](functions/minusWherePredicates.md) +- [not](functions/not.md) +- [or](functions/or.md) +- [parseLoadSubsetOptions](functions/parseLoadSubsetOptions.md) +- [parseOrderByExpression](functions/parseOrderByExpression.md) +- [parseWhereExpression](functions/parseWhereExpression.md) +- [queueStrategy](functions/queueStrategy.md) +- [sum](functions/sum.md) +- [throttleStrategy](functions/throttleStrategy.md) +- [unionWherePredicates](functions/unionWherePredicates.md) +- [upper](functions/upper.md) +- [walkExpression](functions/walkExpression.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..0ee50d792 --- /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:16 + +Options for Ordered index + +## Properties + +### compareFn()? + +```ts +optional compareFn: (a, b) => number; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:17 + +#### Parameters + +##### a + +`any` + +##### b + +`any` + +#### Returns + +`number` + +*** + +### compareOptions? + +```ts +optional compareOptions: CompareOptions; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:18 diff --git a/docs/reference/interfaces/BaseCollectionConfig.md b/docs/reference/interfaces/BaseCollectionConfig.md new file mode 100644 index 000000000..7b750a634 --- /dev/null +++ b/docs/reference/interfaces/BaseCollectionConfig.md @@ -0,0 +1,427 @@ +--- +id: BaseCollectionConfig +title: BaseCollectionConfig +--- + +# Interface: BaseCollectionConfig\ + +Defined in: packages/db/src/types.ts:499 + +## 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: "off" | "eager"; +``` + +Defined in: packages/db/src/types.ts:548 + +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:559 + +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() +``` + +*** + +### defaultStringCollation? + +```ts +optional defaultStringCollation: StringCollationConfig; +``` + +Defined in: packages/db/src/types.ts:705 + +Specifies how to compare data in the collection. +This should be configured to match data ordering on the backend. +E.g., when using the Electric DB collection these options + should match the database's collation settings. + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: packages/db/src/types.ts:528 + +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:523 + +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:512 + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: packages/db/src/types.ts:697 + +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:610 + +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:654 + +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:513 + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: packages/db/src/types.ts:539 + +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:568 + +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:707 diff --git a/docs/reference/interfaces/BaseStrategy.md b/docs/reference/interfaces/BaseStrategy.md new file mode 100644 index 000000000..bf99bb127 --- /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 + +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 + +Type discriminator for strategy identification + +*** + +### cleanup() + +```ts +cleanup: () => void; +``` + +Defined in: packages/db/src/strategies/types.ts:23 + +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 + +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..8b26361e5 --- /dev/null +++ b/docs/reference/interfaces/ChangeMessage.md @@ -0,0 +1,68 @@ +--- +id: ChangeMessage +title: ChangeMessage +--- + +# Interface: ChangeMessage\ + +Defined in: packages/db/src/types.ts:359 + +## 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:363 + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: packages/db/src/types.ts:367 + +*** + +### previousValue? + +```ts +optional previousValue: T; +``` + +Defined in: packages/db/src/types.ts:365 + +*** + +### type + +```ts +type: OperationType; +``` + +Defined in: packages/db/src/types.ts:366 + +*** + +### value + +```ts +value: T; +``` + +Defined in: packages/db/src/types.ts:364 diff --git a/docs/reference/interfaces/Collection.md b/docs/reference/interfaces/Collection.md new file mode 100644 index 000000000..3ea009ae6 --- /dev/null +++ b/docs/reference/interfaces/Collection.md @@ -0,0 +1,1608 @@ +--- +id: Collection +title: Collection +--- + +# Interface: Collection\ + +Defined in: packages/db/src/collection/index.ts:48 + +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:283 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`_lifecycle`](../classes/CollectionImpl.md#_lifecycle) + +*** + +### \_state + +```ts +_state: CollectionStateManager; +``` + +Defined in: packages/db/src/collection/index.ts:295 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`_state`](../classes/CollectionImpl.md#_state) + +*** + +### \_sync + +```ts +_sync: CollectionSyncManager; +``` + +Defined in: packages/db/src/collection/index.ts:284 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`_sync`](../classes/CollectionImpl.md#_sync) + +*** + +### config + +```ts +config: CollectionConfig; +``` + +Defined in: packages/db/src/collection/index.ts:274 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`config`](../classes/CollectionImpl.md#config) + +*** + +### id + +```ts +id: string; +``` + +Defined in: packages/db/src/collection/index.ts:273 + +#### 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:56 + +*** + +### utils + +```ts +readonly utils: TUtils; +``` + +Defined in: packages/db/src/collection/index.ts:55 + +#### Overrides + +[`CollectionImpl`](../classes/CollectionImpl.md).[`utils`](../classes/CollectionImpl.md#utils) + +## Accessors + +### compareOptions + +#### Get Signature + +```ts +get compareOptions(): StringCollationConfig; +``` + +Defined in: packages/db/src/collection/index.ts:580 + +##### Returns + +[`StringCollationConfig`](../type-aliases/StringCollationConfig.md) + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`compareOptions`](../classes/CollectionImpl.md#compareoptions) + +*** + +### indexes + +#### Get Signature + +```ts +get indexes(): Map>; +``` + +Defined in: packages/db/src/collection/index.ts:565 + +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:431 + +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:468 + +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:757 + +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:386 + +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:393 + +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:786 + +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:496 + +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:923 + +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:555 + +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:824 + +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:734 + +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:489 + +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:503 + +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:454 + +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:518 + +#### 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:461 + +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>; +``` + +Defined in: packages/db/src/collection/index.ts:621 + +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`\>\> + +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:423 + +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:475 + +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:512 + +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:902 + +Unsubscribe from a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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:882 + +Subscribe to a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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:892 + +Subscribe to a collection event once + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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:407 + +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:447 + +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:439 + +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:771 + +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:872 + +Subscribe to changes in the collection + +#### Parameters + +##### callback + +(`changes`) => `void` + +Function called when items change + +##### options + +[`SubscribeChangesOptions`](SubscribeChangesOptions.md)\<`T`\> = `{}` + +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 using where callback +import { eq } from "@tanstack/db" + +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + includeInitialState: true, + where: (row) => eq(row.status, "active") +}) +``` + +```ts +// Using multiple conditions with and() +import { and, eq, gt } from "@tanstack/db" + +const subscription = collection.subscribeChanges((changes) => { + updateUI(changes) +}, { + where: (row) => and(eq(row.status, "active"), gt(row.priority, 5)) +}) +``` + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`subscribeChanges`](../classes/CollectionImpl.md#subscribechanges) + +*** + +### toArrayWhenReady() + +```ts +toArrayWhenReady(): Promise; +``` + +Defined in: packages/db/src/collection/index.ts:796 + +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:666 + +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:672 + +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:679 + +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:685 + +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:572 + +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:482 + +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:912 + +Wait for a collection event + +#### Type Parameters + +##### T + +`T` *extends* + \| `"status:error"` + \| `"status:idle"` + \| `"status:loading"` + \| `"status:ready"` + \| `"status:cleaned-up"` + \| `"status:change"` + \| `"subscribers:change"` + \| `"loadingSubset:change"` + \| `"truncate"` + +#### 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..cb58d40d8 --- /dev/null +++ b/docs/reference/interfaces/CollectionConfig.md @@ -0,0 +1,484 @@ +--- +id: CollectionConfig +title: CollectionConfig +--- + +# Interface: CollectionConfig\ + +Defined in: packages/db/src/types.ts:710 + +## 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: "off" | "eager"; +``` + +Defined in: packages/db/src/types.ts:548 + +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:559 + +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) + +*** + +### defaultStringCollation? + +```ts +optional defaultStringCollation: StringCollationConfig; +``` + +Defined in: packages/db/src/types.ts:705 + +Specifies how to compare data in the collection. +This should be configured to match data ordering on the backend. +E.g., when using the Electric DB collection these options + should match the database's collation settings. + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`defaultStringCollation`](BaseCollectionConfig.md#defaultstringcollation) + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: packages/db/src/types.ts:528 + +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:523 + +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:512 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`id`](BaseCollectionConfig.md#id) + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: packages/db/src/types.ts:697 + +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:610 + +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:654 + +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:513 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`schema`](BaseCollectionConfig.md#schema) + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: packages/db/src/types.ts:539 + +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:716 + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: packages/db/src/types.ts:568 + +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:707 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`utils`](BaseCollectionConfig.md#utils) diff --git a/docs/reference/interfaces/CollectionLike.md b/docs/reference/interfaces/CollectionLike.md new file mode 100644 index 000000000..f815e561b --- /dev/null +++ b/docs/reference/interfaces/CollectionLike.md @@ -0,0 +1,147 @@ +--- +id: CollectionLike +title: CollectionLike +--- + +# Interface: CollectionLike\ + +Defined in: packages/db/src/types.ts:13 + +Interface for a collection-like object that provides the necessary methods +for the change events system to work + +## Extends + +- `Pick`\<[`Collection`](Collection.md)\<`T`, `TKey`\>, `"get"` \| `"has"` \| `"entries"` \| `"indexes"` \| `"id"` \| `"compareOptions"`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` + +## Properties + +### compareOptions + +```ts +compareOptions: StringCollationConfig; +``` + +Defined in: packages/db/src/collection/index.ts:580 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`compareOptions`](../classes/CollectionImpl.md#compareoptions) + +*** + +### id + +```ts +id: string; +``` + +Defined in: packages/db/src/collection/index.ts:273 + +#### Inherited from + +[`CollectionImpl`](../classes/CollectionImpl.md).[`id`](../classes/CollectionImpl.md#id) + +*** + +### indexes + +```ts +indexes: Map>; +``` + +Defined in: packages/db/src/collection/index.ts:565 + +#### Inherited from + +```ts +Pick.indexes +``` + +## Methods + +### entries() + +```ts +entries(): IterableIterator<[TKey, T]>; +``` + +Defined in: packages/db/src/collection/index.ts:489 + +Get all entries (virtual derived state) + +#### Returns + +`IterableIterator`\<\[`TKey`, `T`\]\> + +#### Inherited from + +```ts +Pick.entries +``` + +*** + +### get() + +```ts +get(key): T | undefined; +``` + +Defined in: packages/db/src/collection/index.ts:454 + +Get the current value for a key (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`T` \| `undefined` + +#### Inherited from + +```ts +Pick.get +``` + +*** + +### has() + +```ts +has(key): boolean; +``` + +Defined in: packages/db/src/collection/index.ts:461 + +Check if a key exists in the collection (virtual derived state) + +#### Parameters + +##### key + +`TKey` + +#### Returns + +`boolean` + +#### Inherited from + +```ts +Pick.has +``` diff --git a/docs/reference/interfaces/Context.md b/docs/reference/interfaces/Context.md new file mode 100644 index 000000000..5410bec47 --- /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 + +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 + +*** + +### fromSourceName + +```ts +fromSourceName: string; +``` + +Defined in: packages/db/src/query/builder/types.ts:41 + +*** + +### hasJoins? + +```ts +optional hasJoins: boolean; +``` + +Defined in: packages/db/src/query/builder/types.ts:43 + +*** + +### joinTypes? + +```ts +optional joinTypes: Record; +``` + +Defined in: packages/db/src/query/builder/types.ts:45 + +*** + +### result? + +```ts +optional result: any; +``` + +Defined in: packages/db/src/query/builder/types.ts:50 + +*** + +### schema + +```ts +schema: ContextSchema; +``` + +Defined in: packages/db/src/query/builder/types.ts:39 + +*** + +### singleResult? + +```ts +optional singleResult: boolean; +``` + +Defined in: packages/db/src/query/builder/types.ts:52 diff --git a/docs/reference/interfaces/CreateOptimisticActionsOptions.md b/docs/reference/interfaces/CreateOptimisticActionsOptions.md new file mode 100644 index 000000000..83dac8039 --- /dev/null +++ b/docs/reference/interfaces/CreateOptimisticActionsOptions.md @@ -0,0 +1,118 @@ +--- +id: CreateOptimisticActionsOptions +title: CreateOptimisticActionsOptions +--- + +# Interface: CreateOptimisticActionsOptions\ + +Defined in: packages/db/src/types.ts:179 + +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:170 + +#### Inherited from + +[`TransactionConfig`](TransactionConfig.md).[`autoCommit`](TransactionConfig.md#autocommit) + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: packages/db/src/types.ts:168 + +Unique identifier for the transaction + +#### Inherited from + +[`TransactionConfig`](TransactionConfig.md).[`id`](TransactionConfig.md#id) + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: packages/db/src/types.ts:173 + +Custom metadata to associate with the transaction + +#### Inherited from + +[`TransactionConfig`](TransactionConfig.md).[`metadata`](TransactionConfig.md#metadata) + +*** + +### mutationFn() + +```ts +mutationFn: (vars, params) => Promise; +``` + +Defined in: packages/db/src/types.ts:186 + +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:184 + +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..442c95d7f --- /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:840 + +Options for getting current state as changes + +## Properties + +### limit? + +```ts +optional limit: number; +``` + +Defined in: packages/db/src/types.ts:844 + +*** + +### optimizedOnly? + +```ts +optional optimizedOnly: boolean; +``` + +Defined in: packages/db/src/types.ts:845 + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: packages/db/src/types.ts:843 + +*** + +### where? + +```ts +optional where: BasicExpression; +``` + +Defined in: packages/db/src/types.ts:842 + +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..5a132d564 --- /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 + +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 + +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 + +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 + +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 diff --git a/docs/reference/interfaces/DebounceStrategyOptions.md b/docs/reference/interfaces/DebounceStrategyOptions.md new file mode 100644 index 000000000..a25718c64 --- /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 + +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 + +Execute immediately on the first call + +*** + +### trailing? + +```ts +optional trailing: boolean; +``` + +Defined in: packages/db/src/strategies/types.ts:36 + +Execute after the wait period on the last call + +*** + +### wait + +```ts +wait: number; +``` + +Defined in: packages/db/src/strategies/types.ts:32 + +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..1490144e2 --- /dev/null +++ b/docs/reference/interfaces/IndexInterface.md @@ -0,0 +1,506 @@ +--- +id: IndexInterface +title: IndexInterface +--- + +# Interface: IndexInterface\ + +Defined in: packages/db/src/indexes/base-index.ts:28 + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` \| `undefined` = `string` \| `number` \| `undefined` + +## Properties + +### add() + +```ts +add: (key, item) => void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:31 + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +*** + +### build() + +```ts +build: (entries) => void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:35 + +#### Parameters + +##### entries + +`Iterable`\<\[`TKey`, `any`\]\> + +#### Returns + +`void` + +*** + +### clear() + +```ts +clear: () => void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:36 + +#### Returns + +`void` + +*** + +### equalityLookup() + +```ts +equalityLookup: (value) => Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:40 + +#### Parameters + +##### value + +`any` + +#### Returns + +`Set`\<`TKey`\> + +*** + +### getStats() + +```ts +getStats: () => IndexStats; +``` + +Defined in: packages/db/src/indexes/base-index.ts:75 + +#### Returns + +[`IndexStats`](IndexStats.md) + +*** + +### inArrayLookup() + +```ts +inArrayLookup: (values) => Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:41 + +#### Parameters + +##### values + +`any`[] + +#### Returns + +`Set`\<`TKey`\> + +*** + +### lookup() + +```ts +lookup: (operation, value) => Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:38 + +#### 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:72 + +#### Parameters + +##### compareOptions + +`CompareOptions` + +#### Returns + +`boolean` + +*** + +### matchesDirection() + +```ts +matchesDirection: (direction) => boolean; +``` + +Defined in: packages/db/src/indexes/base-index.ts:73 + +#### 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:71 + +#### Parameters + +##### fieldPath + +`string`[] + +#### Returns + +`boolean` + +*** + +### rangeQuery() + +```ts +rangeQuery: (options) => Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:43 + +#### Parameters + +##### options + +[`RangeQueryOptions`](RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +*** + +### rangeQueryReversed() + +```ts +rangeQueryReversed: (options) => Set; +``` + +Defined in: packages/db/src/indexes/base-index.ts:44 + +#### Parameters + +##### options + +[`RangeQueryOptions`](RangeQueryOptions.md) + +#### Returns + +`Set`\<`TKey`\> + +*** + +### remove() + +```ts +remove: (key, item) => void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:32 + +#### Parameters + +##### key + +`TKey` + +##### item + +`any` + +#### Returns + +`void` + +*** + +### supports() + +```ts +supports: (operation) => boolean; +``` + +Defined in: packages/db/src/indexes/base-index.ts:69 + +#### 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 + +#### Parameters + +##### n + +`number` + +##### from + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### takeFromStart() + +```ts +takeFromStart: (n, filterFn?) => TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:51 + +#### Parameters + +##### n + +`number` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### takeReversed() + +```ts +takeReversed: (n, from, filterFn?) => TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:52 + +#### Parameters + +##### n + +`number` + +##### from + +`TKey` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### takeReversedFromEnd() + +```ts +takeReversedFromEnd: (n, filterFn?) => TKey[]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:57 + +#### Parameters + +##### n + +`number` + +##### filterFn? + +(`key`) => `boolean` + +#### Returns + +`TKey`[] + +*** + +### update() + +```ts +update: (key, oldItem, newItem) => void; +``` + +Defined in: packages/db/src/indexes/base-index.ts:33 + +#### 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:66 + +##### Returns + +`Set`\<`TKey`\> + +*** + +### keyCount + +#### Get Signature + +```ts +get keyCount(): number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:62 + +##### Returns + +`number` + +*** + +### orderedEntriesArray + +#### Get Signature + +```ts +get orderedEntriesArray(): [any, Set][]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:63 + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### orderedEntriesArrayReversed + +#### Get Signature + +```ts +get orderedEntriesArrayReversed(): [any, Set][]; +``` + +Defined in: packages/db/src/indexes/base-index.ts:64 + +##### Returns + +\[`any`, `Set`\<`TKey`\>\][] + +*** + +### valueMapData + +#### Get Signature + +```ts +get valueMapData(): Map>; +``` + +Defined in: packages/db/src/indexes/base-index.ts:67 + +##### 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..5c2e3ff5a --- /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 + +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 + +*** + +### name? + +```ts +optional name: string; +``` + +Defined in: packages/db/src/indexes/index-options.ts:7 + +*** + +### 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 diff --git a/docs/reference/interfaces/IndexStats.md b/docs/reference/interfaces/IndexStats.md new file mode 100644 index 000000000..5167d1031 --- /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 + +Statistics about index usage and performance + +## Properties + +### averageLookupTime + +```ts +readonly averageLookupTime: number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:24 + +*** + +### entryCount + +```ts +readonly entryCount: number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:22 + +*** + +### lastUpdated + +```ts +readonly lastUpdated: Date; +``` + +Defined in: packages/db/src/indexes/base-index.ts:25 + +*** + +### lookupCount + +```ts +readonly lookupCount: number; +``` + +Defined in: packages/db/src/indexes/base-index.ts:23 diff --git a/docs/reference/interfaces/InsertConfig.md b/docs/reference/interfaces/InsertConfig.md new file mode 100644 index 000000000..2bd14d996 --- /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:417 + +## Properties + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: packages/db/src/types.ts:418 + +*** + +### optimistic? + +```ts +optional optimistic: boolean; +``` + +Defined in: packages/db/src/types.ts:420 + +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..71a5e8af9 --- /dev/null +++ b/docs/reference/interfaces/LiveQueryCollectionConfig.md @@ -0,0 +1,185 @@ +--- +id: LiveQueryCollectionConfig +title: LiveQueryCollectionConfig +--- + +# Interface: LiveQueryCollectionConfig\ + +Defined in: packages/db/src/query/live/types.ts:55 + +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 + +### defaultStringCollation? + +```ts +optional defaultStringCollation: StringCollationConfig; +``` + +Defined in: packages/db/src/query/live/types.ts:109 + +Optional compare options for string sorting. +If provided, these will be used instead of inheriting from the FROM collection. + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: packages/db/src/query/live/types.ts:98 + +GC time for the collection + +*** + +### getKey()? + +```ts +optional getKey: (item) => string | number; +``` + +Defined in: packages/db/src/query/live/types.ts:76 + +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:63 + +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:88 + +*** + +### onInsert? + +```ts +optional onInsert: InsertMutationFn; +``` + +Defined in: packages/db/src/query/live/types.ts:86 + +Optional mutation handlers + +*** + +### onUpdate? + +```ts +optional onUpdate: UpdateMutationFn; +``` + +Defined in: packages/db/src/query/live/types.ts:87 + +*** + +### query + +```ts +query: + | QueryBuilder +| (q) => QueryBuilder; +``` + +Defined in: packages/db/src/query/live/types.ts:68 + +Query builder function that defines the live query + +*** + +### schema? + +```ts +optional schema: undefined; +``` + +Defined in: packages/db/src/query/live/types.ts:81 + +Optional schema for validation + +*** + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: packages/db/src/query/live/types.ts:103 + +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:93 + +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..6967d53af --- /dev/null +++ b/docs/reference/interfaces/LocalOnlyCollectionConfig.md @@ -0,0 +1,463 @@ +--- +id: LocalOnlyCollectionConfig +title: LocalOnlyCollectionConfig +--- + +# Interface: LocalOnlyCollectionConfig\ + +Defined in: packages/db/src/local-only.ts:22 + +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: "off" | "eager"; +``` + +Defined in: packages/db/src/types.ts:548 + +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:559 + +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 +``` + +*** + +### defaultStringCollation? + +```ts +optional defaultStringCollation: StringCollationConfig; +``` + +Defined in: packages/db/src/types.ts:705 + +Specifies how to compare data in the collection. +This should be configured to match data ordering on the backend. +E.g., when using the Electric DB collection these options + should match the database's collation settings. + +#### Inherited from + +```ts +Omit.defaultStringCollation +``` + +*** + +### getKey() + +```ts +getKey: (item) => TKey; +``` + +Defined in: packages/db/src/types.ts:523 + +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:512 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`id`](BaseCollectionConfig.md#id) + +*** + +### initialData? + +```ts +optional initialData: T[]; +``` + +Defined in: packages/db/src/local-only.ts:34 + +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:697 + +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:610 + +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:654 + +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:513 + +#### Inherited from + +```ts +Omit.schema +``` + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: packages/db/src/types.ts:568 + +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:707 + +#### 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..c17238eb6 --- /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 + +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 + +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..7dd1978af --- /dev/null +++ b/docs/reference/interfaces/LocalStorageCollectionConfig.md @@ -0,0 +1,529 @@ +--- +id: LocalStorageCollectionConfig +title: LocalStorageCollectionConfig +--- + +# Interface: LocalStorageCollectionConfig\ + +Defined in: packages/db/src/local-storage.ts:58 + +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: "off" | "eager"; +``` + +Defined in: packages/db/src/types.ts:548 + +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:559 + +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) + +*** + +### defaultStringCollation? + +```ts +optional defaultStringCollation: StringCollationConfig; +``` + +Defined in: packages/db/src/types.ts:705 + +Specifies how to compare data in the collection. +This should be configured to match data ordering on the backend. +E.g., when using the Electric DB collection these options + should match the database's collation settings. + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`defaultStringCollation`](BaseCollectionConfig.md#defaultstringcollation) + +*** + +### gcTime? + +```ts +optional gcTime: number; +``` + +Defined in: packages/db/src/types.ts:528 + +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:523 + +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:512 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`id`](BaseCollectionConfig.md#id) + +*** + +### onDelete? + +```ts +optional onDelete: DeleteMutationFn; +``` + +Defined in: packages/db/src/types.ts:697 + +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:610 + +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:654 + +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 + +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:513 + +#### Inherited from + +[`BaseCollectionConfig`](BaseCollectionConfig.md).[`schema`](BaseCollectionConfig.md#schema) + +*** + +### startSync? + +```ts +optional startSync: boolean; +``` + +Defined in: packages/db/src/types.ts:539 + +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 + +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 + +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 + +The key to use for storing the collection data in localStorage/sessionStorage + +*** + +### syncMode? + +```ts +optional syncMode: SyncMode; +``` + +Defined in: packages/db/src/types.ts:568 + +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:707 + +#### 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..ff1cc9015 --- /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 + +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 + +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 + +*** + +### getStorageSize + +```ts +getStorageSize: GetStorageSizeFn; +``` + +Defined in: packages/db/src/local-storage.ts:102 diff --git a/docs/reference/interfaces/OperationConfig.md b/docs/reference/interfaces/OperationConfig.md new file mode 100644 index 000000000..1345b0485 --- /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:411 + +## Properties + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: packages/db/src/types.ts:412 + +*** + +### optimistic? + +```ts +optional optimistic: boolean; +``` + +Defined in: packages/db/src/types.ts:414 + +Whether to apply optimistic updates immediately. Defaults to true. diff --git a/docs/reference/interfaces/PacedMutationsConfig.md b/docs/reference/interfaces/PacedMutationsConfig.md new file mode 100644 index 000000000..9dc756284 --- /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 + +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 + +Custom metadata to associate with transactions + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: packages/db/src/paced-mutations.ts:21 + +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 + +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 + +Strategy for controlling mutation execution timing +Examples: debounceStrategy, queueStrategy, throttleStrategy diff --git a/docs/reference/interfaces/ParseWhereOptions.md b/docs/reference/interfaces/ParseWhereOptions.md new file mode 100644 index 000000000..87ee37030 --- /dev/null +++ b/docs/reference/interfaces/ParseWhereOptions.md @@ -0,0 +1,451 @@ +--- +id: ParseWhereOptions +title: ParseWhereOptions +--- + +# Interface: ParseWhereOptions\ + +Defined in: packages/db/src/query/expression-helpers.ts:53 + +Options for customizing how WHERE expressions are parsed + +## Type Parameters + +### T + +`T` = `any` + +## Properties + +### handlers + +```ts +handlers: object & object; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:67 + +Handler functions for different operators. +Each handler receives the parsed field path(s) and value(s) and returns your custom format. + +Supported operators from TanStack DB: +- Comparison: eq, gt, gte, lt, lte, in, like, ilike +- Logical: and, or, not +- Null checking: isNull, isUndefined +- String functions: upper, lower, length, concat +- Numeric: add +- Utility: coalesce +- Aggregates: count, avg, sum, min, max + +#### Type Declaration + +##### add()? + +```ts +optional add: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### and()? + +```ts +optional and: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### avg()? + +```ts +optional avg: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### coalesce()? + +```ts +optional coalesce: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### concat()? + +```ts +optional concat: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### count()? + +```ts +optional count: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### eq()? + +```ts +optional eq: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### gt()? + +```ts +optional gt: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### gte()? + +```ts +optional gte: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### ilike()? + +```ts +optional ilike: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### in()? + +```ts +optional in: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### isNull()? + +```ts +optional isNull: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### isUndefined()? + +```ts +optional isUndefined: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### length()? + +```ts +optional length: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### like()? + +```ts +optional like: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### lower()? + +```ts +optional lower: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### lt()? + +```ts +optional lt: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### lte()? + +```ts +optional lte: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### max()? + +```ts +optional max: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### min()? + +```ts +optional min: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### not()? + +```ts +optional not: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### or()? + +```ts +optional or: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### sum()? + +```ts +optional sum: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +##### upper()? + +```ts +optional upper: (...args) => T; +``` + +###### Parameters + +###### args + +...`any`[] + +###### Returns + +`T` + +*** + +### onUnknownOperator()? + +```ts +optional onUnknownOperator: (operator, args) => T; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:76 + +Optional handler for when an unknown operator is encountered. +If not provided, unknown operators throw an error. + +#### Parameters + +##### operator + +`string` + +##### args + +`any`[] + +#### Returns + +`T` diff --git a/docs/reference/interfaces/ParsedOrderBy.md b/docs/reference/interfaces/ParsedOrderBy.md new file mode 100644 index 000000000..9f7089e4b --- /dev/null +++ b/docs/reference/interfaces/ParsedOrderBy.md @@ -0,0 +1,76 @@ +--- +id: ParsedOrderBy +title: ParsedOrderBy +--- + +# Interface: ParsedOrderBy + +Defined in: packages/db/src/query/expression-helpers.ts:82 + +Result of parsing an ORDER BY expression + +## Properties + +### direction + +```ts +direction: "asc" | "desc"; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:84 + +*** + +### field + +```ts +field: FieldPath; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:83 + +*** + +### locale? + +```ts +optional locale: string; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:89 + +Locale for locale-aware string sorting (e.g., 'en-US') + +*** + +### localeOptions? + +```ts +optional localeOptions: object; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:91 + +Additional options for locale-aware sorting + +*** + +### nulls + +```ts +nulls: "first" | "last"; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:85 + +*** + +### stringSort? + +```ts +optional stringSort: "lexical" | "locale"; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:87 + +String sorting method: 'lexical' (default) or 'locale' (locale-aware) diff --git a/docs/reference/interfaces/Parser.md b/docs/reference/interfaces/Parser.md new file mode 100644 index 000000000..151ade804 --- /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 + +## Properties + +### parse() + +```ts +parse: (data) => unknown; +``` + +Defined in: packages/db/src/local-storage.ts:48 + +#### Parameters + +##### data + +`string` + +#### Returns + +`unknown` + +*** + +### stringify() + +```ts +stringify: (data) => string; +``` + +Defined in: packages/db/src/local-storage.ts:49 + +#### 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..b24d895d3 --- /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:89 + +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:106 + +*** + +### collection + +```ts +collection: TCollection; +``` + +Defined in: packages/db/src/types.ts:117 + +*** + +### createdAt + +```ts +createdAt: Date; +``` + +Defined in: packages/db/src/types.ts:115 + +*** + +### globalKey + +```ts +globalKey: string; +``` + +Defined in: packages/db/src/types.ts:107 + +*** + +### key + +```ts +key: any; +``` + +Defined in: packages/db/src/types.ts:109 + +*** + +### metadata + +```ts +metadata: unknown; +``` + +Defined in: packages/db/src/types.ts:111 + +*** + +### modified + +```ts +modified: T; +``` + +Defined in: packages/db/src/types.ts:104 + +*** + +### mutationId + +```ts +mutationId: string; +``` + +Defined in: packages/db/src/types.ts:100 + +*** + +### optimistic + +```ts +optimistic: boolean; +``` + +Defined in: packages/db/src/types.ts:114 + +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:102 + +*** + +### syncMetadata + +```ts +syncMetadata: Record; +``` + +Defined in: packages/db/src/types.ts:112 + +*** + +### type + +```ts +type: TOperation; +``` + +Defined in: packages/db/src/types.ts:110 + +*** + +### updatedAt + +```ts +updatedAt: Date; +``` + +Defined in: packages/db/src/types.ts:116 diff --git a/docs/reference/interfaces/QueueStrategy.md b/docs/reference/interfaces/QueueStrategy.md new file mode 100644 index 000000000..101ca06c1 --- /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 + +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 + +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 + +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 + +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 diff --git a/docs/reference/interfaces/QueueStrategyOptions.md b/docs/reference/interfaces/QueueStrategyOptions.md new file mode 100644 index 000000000..56d73b681 --- /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 + +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 + +Where to add new items in the queue + +*** + +### getItemsFrom? + +```ts +optional getItemsFrom: "front" | "back"; +``` + +Defined in: packages/db/src/strategies/types.ts:58 + +Where to get items from when processing + +*** + +### maxSize? + +```ts +optional maxSize: number; +``` + +Defined in: packages/db/src/strategies/types.ts:54 + +Maximum queue size (items are dropped if exceeded) + +*** + +### wait? + +```ts +optional wait: number; +``` + +Defined in: packages/db/src/strategies/types.ts:52 + +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..a017bd705 --- /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:24 + +Options for range queries + +## Properties + +### from? + +```ts +optional from: any; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:25 + +*** + +### fromInclusive? + +```ts +optional fromInclusive: boolean; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:27 + +*** + +### to? + +```ts +optional to: any; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:26 + +*** + +### toInclusive? + +```ts +optional toInclusive: boolean; +``` + +Defined in: packages/db/src/indexes/btree-index.ts:28 diff --git a/docs/reference/interfaces/SimpleComparison.md b/docs/reference/interfaces/SimpleComparison.md new file mode 100644 index 000000000..7746e9342 --- /dev/null +++ b/docs/reference/interfaces/SimpleComparison.md @@ -0,0 +1,40 @@ +--- +id: SimpleComparison +title: SimpleComparison +--- + +# Interface: SimpleComparison + +Defined in: packages/db/src/query/expression-helpers.ts:44 + +Represents a simple comparison operation + +## Properties + +### field + +```ts +field: FieldPath; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:45 + +*** + +### operator + +```ts +operator: string; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:46 + +*** + +### value? + +```ts +optional value: any; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:47 diff --git a/docs/reference/interfaces/SubscribeChangesOptions.md b/docs/reference/interfaces/SubscribeChangesOptions.md new file mode 100644 index 000000000..6fe28421a --- /dev/null +++ b/docs/reference/interfaces/SubscribeChangesOptions.md @@ -0,0 +1,152 @@ +--- +id: SubscribeChangesOptions +title: SubscribeChangesOptions +--- + +# Interface: SubscribeChangesOptions\ + +Defined in: packages/db/src/types.ts:784 + +Options for subscribing to collection changes + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### includeInitialState? + +```ts +optional includeInitialState: boolean; +``` + +Defined in: packages/db/src/types.ts:788 + +Whether to include the current state as initial changes + +*** + +### limit? + +```ts +optional limit: number; +``` + +Defined in: packages/db/src/types.ts:821 + +**`Internal`** + +Optional limit to include in loadSubset for query-specific cache keys. + +*** + +### onLoadSubsetResult()? + +```ts +optional onLoadSubsetResult: (result) => void; +``` + +Defined in: packages/db/src/types.ts:827 + +**`Internal`** + +Callback that receives the loadSubset result (Promise or true) from requestSnapshot. +Allows the caller to directly track the loading promise for isReady status. + +#### Parameters + +##### result + +`true` | `Promise`\<`void`\> + +#### Returns + +`void` + +*** + +### onStatusChange()? + +```ts +optional onStatusChange: (event) => void; +``` + +Defined in: packages/db/src/types.ts:811 + +**`Internal`** + +Listener for subscription status changes. +Registered BEFORE any snapshot is requested, ensuring no status transitions are missed. + +#### Parameters + +##### event + +[`SubscriptionStatusChangeEvent`](SubscriptionStatusChangeEvent.md) + +#### Returns + +`void` + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: packages/db/src/types.ts:816 + +**`Internal`** + +Optional orderBy to include in loadSubset for query-specific cache keys. + +*** + +### where()? + +```ts +optional where: (row) => any; +``` + +Defined in: packages/db/src/types.ts:803 + +Callback function for filtering changes using a row proxy. +The callback receives a proxy object that records property access, +allowing you to use query builder functions like `eq`, `gt`, etc. + +#### Parameters + +##### row + +`SingleRowRefProxy`\<`T`\> + +#### Returns + +`any` + +#### Example + +```ts +import { eq } from "@tanstack/db" + +collection.subscribeChanges(callback, { + where: (row) => eq(row.status, "active") +}) +``` + +*** + +### whereExpression? + +```ts +optional whereExpression: BasicExpression; +``` + +Defined in: packages/db/src/types.ts:805 + +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..742135995 --- /dev/null +++ b/docs/reference/interfaces/SubscribeChangesSnapshotOptions.md @@ -0,0 +1,178 @@ +--- +id: SubscribeChangesSnapshotOptions +title: SubscribeChangesSnapshotOptions +--- + +# Interface: SubscribeChangesSnapshotOptions\ + +Defined in: packages/db/src/types.ts:830 + +## Extends + +- `Omit`\<[`SubscribeChangesOptions`](SubscribeChangesOptions.md)\<`T`\>, `"includeInitialState"`\> + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### limit? + +```ts +optional limit: number; +``` + +Defined in: packages/db/src/types.ts:834 + +**`Internal`** + +Optional limit to include in loadSubset for query-specific cache keys. + +#### Overrides + +```ts +Omit.limit +``` + +*** + +### onLoadSubsetResult()? + +```ts +optional onLoadSubsetResult: (result) => void; +``` + +Defined in: packages/db/src/types.ts:827 + +**`Internal`** + +Callback that receives the loadSubset result (Promise or true) from requestSnapshot. +Allows the caller to directly track the loading promise for isReady status. + +#### Parameters + +##### result + +`true` | `Promise`\<`void`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit.onLoadSubsetResult +``` + +*** + +### onStatusChange()? + +```ts +optional onStatusChange: (event) => void; +``` + +Defined in: packages/db/src/types.ts:811 + +**`Internal`** + +Listener for subscription status changes. +Registered BEFORE any snapshot is requested, ensuring no status transitions are missed. + +#### Parameters + +##### event + +[`SubscriptionStatusChangeEvent`](SubscriptionStatusChangeEvent.md) + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit.onStatusChange +``` + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: packages/db/src/types.ts:833 + +**`Internal`** + +Optional orderBy to include in loadSubset for query-specific cache keys. + +#### Overrides + +```ts +Omit.orderBy +``` + +*** + +### where()? + +```ts +optional where: (row) => any; +``` + +Defined in: packages/db/src/types.ts:803 + +Callback function for filtering changes using a row proxy. +The callback receives a proxy object that records property access, +allowing you to use query builder functions like `eq`, `gt`, etc. + +#### Parameters + +##### row + +`SingleRowRefProxy`\<`T`\> + +#### Returns + +`any` + +#### Example + +```ts +import { eq } from "@tanstack/db" + +collection.subscribeChanges(callback, { + where: (row) => eq(row.status, "active") +}) +``` + +#### Inherited from + +```ts +Omit.where +``` + +*** + +### whereExpression? + +```ts +optional whereExpression: BasicExpression; +``` + +Defined in: packages/db/src/types.ts:805 + +Pre-compiled expression for filtering changes + +#### Inherited from + +```ts +Omit.whereExpression +``` diff --git a/docs/reference/interfaces/Subscription.md b/docs/reference/interfaces/Subscription.md new file mode 100644 index 000000000..fe7dd44aa --- /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:252 + +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:254 + +Current status of the subscription + +## Methods + +### clearListeners() + +```ts +protected clearListeners(): void; +``` + +Defined in: packages/db/src/event-emitter.ts:115 + +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 + +**`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 + +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 + +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 + +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 + +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..b6eac062e --- /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:213 + +Event emitted when subscription status changes + +## Properties + +### previousStatus + +```ts +previousStatus: SubscriptionStatus; +``` + +Defined in: packages/db/src/types.ts:216 + +*** + +### status + +```ts +status: SubscriptionStatus; +``` + +Defined in: packages/db/src/types.ts:217 + +*** + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: packages/db/src/types.ts:215 + +*** + +### type + +```ts +type: "status:change"; +``` + +Defined in: packages/db/src/types.ts:214 diff --git a/docs/reference/interfaces/SubscriptionStatusEvent.md b/docs/reference/interfaces/SubscriptionStatusEvent.md new file mode 100644 index 000000000..e04e42edc --- /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:223 + +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:226 + +*** + +### status + +```ts +status: T; +``` + +Defined in: packages/db/src/types.ts:227 + +*** + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: packages/db/src/types.ts:225 + +*** + +### type + +```ts +type: `status:${T}`; +``` + +Defined in: packages/db/src/types.ts:224 diff --git a/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md b/docs/reference/interfaces/SubscriptionUnsubscribedEvent.md new file mode 100644 index 000000000..425311487 --- /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:233 + +Event emitted when subscription is unsubscribed + +## Properties + +### subscription + +```ts +subscription: Subscription; +``` + +Defined in: packages/db/src/types.ts:235 + +*** + +### type + +```ts +type: "unsubscribed"; +``` + +Defined in: packages/db/src/types.ts:234 diff --git a/docs/reference/interfaces/SyncConfig.md b/docs/reference/interfaces/SyncConfig.md new file mode 100644 index 000000000..d5b1690b2 --- /dev/null +++ b/docs/reference/interfaces/SyncConfig.md @@ -0,0 +1,106 @@ +--- +id: SyncConfig +title: SyncConfig +--- + +# Interface: SyncConfig\ + +Defined in: packages/db/src/types.ts:325 + +## 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:347 + +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:356 + +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:329 + +#### Parameters + +##### params + +###### begin + +(`options?`) => `void` + +Begin a new sync transaction. + +###### 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..c854b6b21 --- /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 + +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 + +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 + +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 + +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 diff --git a/docs/reference/interfaces/ThrottleStrategyOptions.md b/docs/reference/interfaces/ThrottleStrategyOptions.md new file mode 100644 index 000000000..8fa04e71c --- /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 + +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 + +Execute immediately on the first call + +*** + +### trailing? + +```ts +optional trailing: boolean; +``` + +Defined in: packages/db/src/strategies/types.ts:80 + +Execute on the last call after wait period + +*** + +### wait + +```ts +wait: number; +``` + +Defined in: packages/db/src/strategies/types.ts:76 + +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..cff4aa5ce --- /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 + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### autoCommit + +```ts +autoCommit: boolean; +``` + +Defined in: packages/db/src/transactions.ts:214 + +*** + +### createdAt + +```ts +createdAt: Date; +``` + +Defined in: packages/db/src/transactions.ts:215 + +*** + +### error? + +```ts +optional error: object; +``` + +Defined in: packages/db/src/transactions.ts:218 + +#### error + +```ts +error: Error; +``` + +#### message + +```ts +message: string; +``` + +*** + +### id + +```ts +id: string; +``` + +Defined in: packages/db/src/transactions.ts:209 + +*** + +### isPersisted + +```ts +isPersisted: Deferred>; +``` + +Defined in: packages/db/src/transactions.ts:213 + +*** + +### metadata + +```ts +metadata: Record; +``` + +Defined in: packages/db/src/transactions.ts:217 + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: packages/db/src/transactions.ts:211 + +*** + +### mutations + +```ts +mutations: PendingMutation>[]; +``` + +Defined in: packages/db/src/transactions.ts:212 + +*** + +### sequenceNumber + +```ts +sequenceNumber: number; +``` + +Defined in: packages/db/src/transactions.ts:216 + +*** + +### state + +```ts +state: TransactionState; +``` + +Defined in: packages/db/src/transactions.ts:210 + +## Methods + +### applyMutations() + +```ts +applyMutations(mutations): void; +``` + +Defined in: packages/db/src/transactions.ts:327 + +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 + +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 + +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 + +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 + +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 + +#### Parameters + +##### newState + +[`TransactionState`](../type-aliases/TransactionState.md) + +#### Returns + +`void` + +*** + +### touchCollection() + +```ts +touchCollection(): void; +``` + +Defined in: packages/db/src/transactions.ts:417 + +#### Returns + +`void` diff --git a/docs/reference/interfaces/TransactionConfig.md b/docs/reference/interfaces/TransactionConfig.md new file mode 100644 index 000000000..0a70e46f1 --- /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:166 + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +## Properties + +### autoCommit? + +```ts +optional autoCommit: boolean; +``` + +Defined in: packages/db/src/types.ts:170 + +*** + +### id? + +```ts +optional id: string; +``` + +Defined in: packages/db/src/types.ts:168 + +Unique identifier for the transaction + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: packages/db/src/types.ts:173 + +Custom metadata to associate with the transaction + +*** + +### mutationFn + +```ts +mutationFn: MutationFn; +``` + +Defined in: packages/db/src/types.ts:171 diff --git a/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md b/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md index e33ad5872..be767361c 100644 --- a/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md +++ b/docs/reference/powersync-db-collection/classes/PowerSyncTransactor.md @@ -5,7 +5,7 @@ title: PowerSyncTransactor # Class: PowerSyncTransactor -Defined in: [PowerSyncTransactor.ts:54](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L54) +Defined in: PowerSyncTransactor.ts:54 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 @@ -51,7 +51,7 @@ The transaction containing mutations to apply new PowerSyncTransactor(options): PowerSyncTransactor; ``` -Defined in: [PowerSyncTransactor.ts:58](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L58) +Defined in: PowerSyncTransactor.ts:58 #### Parameters @@ -71,7 +71,7 @@ Defined in: [PowerSyncTransactor.ts:58](https://github.com/TanStack/db/blob/main database: AbstractPowerSyncDatabase; ``` -Defined in: [PowerSyncTransactor.ts:55](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L55) +Defined in: PowerSyncTransactor.ts:55 *** @@ -81,7 +81,7 @@ Defined in: [PowerSyncTransactor.ts:55](https://github.com/TanStack/db/blob/main pendingOperationStore: PendingOperationStore; ``` -Defined in: [PowerSyncTransactor.ts:56](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L56) +Defined in: PowerSyncTransactor.ts:56 ## Methods @@ -91,7 +91,7 @@ Defined in: [PowerSyncTransactor.ts:56](https://github.com/TanStack/db/blob/main applyTransaction(transaction): Promise; ``` -Defined in: [PowerSyncTransactor.ts:66](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L66) +Defined in: PowerSyncTransactor.ts:66 Persists a Transaction to the PowerSync SQLite database. @@ -113,7 +113,7 @@ Persists a Transaction to the PowerSync SQLite database. protected getMutationCollectionMeta(mutation): PowerSyncCollectionMeta; ``` -Defined in: [PowerSyncTransactor.ts:294](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L294) +Defined in: PowerSyncTransactor.ts:294 #### Parameters @@ -136,7 +136,7 @@ protected handleDelete( waitForCompletion): Promise; ``` -Defined in: [PowerSyncTransactor.ts:221](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L221) +Defined in: PowerSyncTransactor.ts:221 #### Parameters @@ -167,7 +167,7 @@ protected handleInsert( waitForCompletion): Promise; ``` -Defined in: [PowerSyncTransactor.ts:152](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L152) +Defined in: PowerSyncTransactor.ts:152 #### Parameters @@ -199,7 +199,7 @@ protected handleOperationWithCompletion( handler): Promise; ``` -Defined in: [PowerSyncTransactor.ts:263](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L263) +Defined in: PowerSyncTransactor.ts:263 Helper function which wraps a persistence operation by: - Fetching the mutation's collection's SQLite table details @@ -239,7 +239,7 @@ protected handleUpdate( waitForCompletion): Promise; ``` -Defined in: [PowerSyncTransactor.ts:187](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L187) +Defined in: PowerSyncTransactor.ts:187 #### Parameters @@ -267,7 +267,7 @@ Defined in: [PowerSyncTransactor.ts:187](https://github.com/TanStack/db/blob/mai protected processMutationMetadata(mutation): string | null; ``` -Defined in: [PowerSyncTransactor.ts:313](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L313) +Defined in: PowerSyncTransactor.ts:313 Processes collection mutation metadata for persistence to the database. We only support storing string metadata. diff --git a/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md b/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md index b40d086f6..9de3967e7 100644 --- a/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md +++ b/docs/reference/powersync-db-collection/functions/powerSyncCollectionOptions.md @@ -13,7 +13,7 @@ Implementation of powerSyncCollectionOptions that handles both schema and non-sc 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) +Defined in: powersync.ts:71 Creates a PowerSync collection configuration with basic default validation. Input and Output types are the SQLite column types. @@ -66,7 +66,7 @@ const collection = createCollection( function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, PowerSyncCollectionUtils> & object & object; ``` -Defined in: [powersync.ts:128](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L128) +Defined in: powersync.ts:128 Creates a PowerSync collection configuration with schema validation. @@ -141,7 +141,7 @@ const collection = createCollection( function powerSyncCollectionOptions(config): CollectionConfig, string, TSchema, PowerSyncCollectionUtils> & object & object; ``` -Defined in: [powersync.ts:196](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/powersync.ts#L196) +Defined in: powersync.ts:196 Creates a PowerSync collection configuration with schema validation. diff --git a/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md index 4966c6574..bb1dded66 100644 --- a/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md +++ b/docs/reference/powersync-db-collection/type-aliases/BasePowerSyncCollectionConfig.md @@ -9,7 +9,7 @@ title: BasePowerSyncCollectionConfig 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) +Defined in: definitions.ts:165 ## Type Declaration diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md index a51250077..1e2063981 100644 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithArbitraryCollectionTypes.md @@ -9,7 +9,7 @@ title: ConfigWithArbitraryCollectionTypes 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) +Defined in: definitions.ts:125 Config where TInput and TOutput have arbitrarily typed values. The keys of the types need to equal the SQLite types. diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md index 1d58b51a6..154bc4610 100644 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteInputType.md @@ -9,7 +9,7 @@ title: ConfigWithSQLiteInputType 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) +Defined in: definitions.ts:106 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. diff --git a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md index edc414511..baa7ac810 100644 --- a/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md +++ b/docs/reference/powersync-db-collection/type-aliases/ConfigWithSQLiteTypes.md @@ -9,6 +9,6 @@ title: ConfigWithSQLiteTypes type ConfigWithSQLiteTypes = object; ``` -Defined in: [definitions.ts:100](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L100) +Defined in: definitions.ts:100 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 index 898bf6119..9ae80c31d 100644 --- a/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md +++ b/docs/reference/powersync-db-collection/type-aliases/CustomSQLiteSerializer.md @@ -9,7 +9,7 @@ title: CustomSQLiteSerializer 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) +Defined in: definitions.ts:52 A mapping type for custom serialization of object properties to SQLite-compatible values. diff --git a/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md index 711548258..6a64ed0c7 100644 --- a/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md +++ b/docs/reference/powersync-db-collection/type-aliases/EnhancedPowerSyncCollectionConfig.md @@ -9,7 +9,7 @@ title: EnhancedPowerSyncCollectionConfig type EnhancedPowerSyncCollectionConfig = CollectionConfig> & object; ``` -Defined in: [definitions.ts:259](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L259) +Defined in: definitions.ts:259 A CollectionConfig which includes utilities for PowerSync. diff --git a/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md b/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md index d7e31998e..f20f531b6 100644 --- a/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md +++ b/docs/reference/powersync-db-collection/type-aliases/InferPowerSyncOutputType.md @@ -9,7 +9,7 @@ title: InferPowerSyncOutputType 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) +Defined in: definitions.ts:20 Small helper which determines the output type if: - Standard SQLite types are to be used OR diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md index d06b3d3b7..40628c611 100644 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionConfig.md @@ -12,7 +12,7 @@ type PowerSyncCollectionConfig = BasePowerSyncCollectionConfig< | ConfigWithArbitraryCollectionTypes; ``` -Defined in: [definitions.ts:222](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L222) +Defined in: definitions.ts:222 Configuration options for creating a PowerSync collection. diff --git a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md index b7dddfa05..79fdbceff 100644 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionMeta.md @@ -9,7 +9,7 @@ title: PowerSyncCollectionMeta type PowerSyncCollectionMeta = object; ``` -Defined in: [definitions.ts:235](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L235) +Defined in: definitions.ts:235 Metadata for the PowerSync Collection. @@ -27,7 +27,7 @@ Metadata for the PowerSync Collection. metadataIsTracked: boolean; ``` -Defined in: [definitions.ts:253](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L253) +Defined in: definitions.ts:253 Whether the PowerSync table tracks metadata. @@ -39,7 +39,7 @@ Whether the PowerSync table tracks metadata. serializeValue: (value) => ExtractedTable; ``` -Defined in: [definitions.ts:248](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L248) +Defined in: definitions.ts:248 Serializes a collection value to the SQLite type @@ -61,7 +61,7 @@ Serializes a collection value to the SQLite type tableName: string; ``` -Defined in: [definitions.ts:239](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L239) +Defined in: definitions.ts:239 The SQLite table representing the collection. @@ -73,6 +73,6 @@ The SQLite table representing the collection. trackedTableName: string; ``` -Defined in: [definitions.ts:243](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L243) +Defined in: definitions.ts:243 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 index 72a2803d6..b7b20bfce 100644 --- a/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md +++ b/docs/reference/powersync-db-collection/type-aliases/PowerSyncCollectionUtils.md @@ -9,7 +9,7 @@ title: PowerSyncCollectionUtils type PowerSyncCollectionUtils = object; ``` -Defined in: [definitions.ts:277](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L277) +Defined in: definitions.ts:277 Collection-level utilities for PowerSync. @@ -27,7 +27,7 @@ Collection-level utilities for PowerSync. getMeta: () => PowerSyncCollectionMeta; ``` -Defined in: [definitions.ts:278](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L278) +Defined in: definitions.ts:278 #### Returns diff --git a/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md b/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md index 2ce69107c..cacbe57f7 100644 --- a/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md +++ b/docs/reference/powersync-db-collection/type-aliases/SerializerConfig.md @@ -9,7 +9,7 @@ title: SerializerConfig type SerializerConfig = object; ``` -Defined in: [definitions.ts:61](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L61) +Defined in: definitions.ts:61 ## Type Parameters @@ -29,7 +29,7 @@ Defined in: [definitions.ts:61](https://github.com/TanStack/db/blob/main/package onDeserializationError: (error) => void; ``` -Defined in: [definitions.ts:94](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L94) +Defined in: definitions.ts:94 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. @@ -53,7 +53,7 @@ Use this callback to react to deserialization errors. optional serializer: CustomSQLiteSerializer; ``` -Defined in: [definitions.ts:87](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L87) +Defined in: definitions.ts:87 Optional partial serializer object for customizing how individual columns are serialized for SQLite. diff --git a/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md b/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md index 7a9051b65..5167523d6 100644 --- a/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md +++ b/docs/reference/powersync-db-collection/type-aliases/TransactorOptions.md @@ -9,7 +9,7 @@ title: TransactorOptions type TransactorOptions = object; ``` -Defined in: [PowerSyncTransactor.ts:15](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L15) +Defined in: PowerSyncTransactor.ts:15 ## Properties @@ -19,4 +19,4 @@ Defined in: [PowerSyncTransactor.ts:15](https://github.com/TanStack/db/blob/main database: AbstractPowerSyncDatabase; ``` -Defined in: [PowerSyncTransactor.ts:16](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/PowerSyncTransactor.ts#L16) +Defined in: PowerSyncTransactor.ts:16 diff --git a/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md b/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md index f0a61f582..01775e60d 100644 --- a/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md +++ b/docs/reference/powersync-db-collection/variables/DEFAULT_BATCH_SIZE.md @@ -9,6 +9,6 @@ title: DEFAULT_BATCH_SIZE const DEFAULT_BATCH_SIZE: 1000 = 1000; ``` -Defined in: [definitions.ts:284](https://github.com/TanStack/db/blob/main/packages/powersync-db-collection/src/definitions.ts#L284) +Defined in: definitions.ts:284 Default value for [PowerSyncCollectionConfig#syncBatchSize](../type-aliases/BasePowerSyncCollectionConfig.md). diff --git a/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md b/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md index 925711239..83394c530 100644 --- a/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md @@ -5,7 +5,7 @@ title: DeleteOperationItemNotFoundError # Class: DeleteOperationItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:76](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L76) +Defined in: packages/query-db-collection/src/errors.ts:76 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:76](https://github.com/T new DeleteOperationItemNotFoundError(key): DeleteOperationItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:77](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L77) +Defined in: packages/query-db-collection/src/errors.ts:77 #### Parameters diff --git a/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md b/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md index 7eeb9248f..0044e6ab8 100644 --- a/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md +++ b/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md @@ -5,7 +5,7 @@ title: DuplicateKeyInBatchError # Class: DuplicateKeyInBatchError -Defined in: [packages/query-db-collection/src/errors.ts:62](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L62) +Defined in: packages/query-db-collection/src/errors.ts:62 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:62](https://github.com/T new DuplicateKeyInBatchError(key): DuplicateKeyInBatchError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:63](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L63) +Defined in: packages/query-db-collection/src/errors.ts:63 #### Parameters diff --git a/docs/reference/query-db-collection/classes/GetKeyRequiredError.md b/docs/reference/query-db-collection/classes/GetKeyRequiredError.md index e557c7729..1f8e2f511 100644 --- a/docs/reference/query-db-collection/classes/GetKeyRequiredError.md +++ b/docs/reference/query-db-collection/classes/GetKeyRequiredError.md @@ -5,7 +5,7 @@ title: GetKeyRequiredError # Class: GetKeyRequiredError -Defined in: [packages/query-db-collection/src/errors.ts:32](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L32) +Defined in: packages/query-db-collection/src/errors.ts:32 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:32](https://github.com/T new GetKeyRequiredError(): GetKeyRequiredError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:33](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L33) +Defined in: packages/query-db-collection/src/errors.ts:33 #### Returns diff --git a/docs/reference/query-db-collection/classes/InvalidItemStructureError.md b/docs/reference/query-db-collection/classes/InvalidItemStructureError.md index 7b01648f5..e6d0783ad 100644 --- a/docs/reference/query-db-collection/classes/InvalidItemStructureError.md +++ b/docs/reference/query-db-collection/classes/InvalidItemStructureError.md @@ -5,7 +5,7 @@ title: InvalidItemStructureError # Class: InvalidItemStructureError -Defined in: [packages/query-db-collection/src/errors.ts:48](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L48) +Defined in: packages/query-db-collection/src/errors.ts:48 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:48](https://github.com/T new InvalidItemStructureError(message): InvalidItemStructureError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:49](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L49) +Defined in: packages/query-db-collection/src/errors.ts:49 #### Parameters diff --git a/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md b/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md index 2691b6f06..dfd0793a8 100644 --- a/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md +++ b/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md @@ -5,7 +5,7 @@ title: InvalidSyncOperationError # Class: InvalidSyncOperationError -Defined in: [packages/query-db-collection/src/errors.ts:83](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L83) +Defined in: packages/query-db-collection/src/errors.ts:83 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:83](https://github.com/T new InvalidSyncOperationError(message): InvalidSyncOperationError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:84](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L84) +Defined in: packages/query-db-collection/src/errors.ts:84 #### Parameters diff --git a/docs/reference/query-db-collection/classes/ItemNotFoundError.md b/docs/reference/query-db-collection/classes/ItemNotFoundError.md index 85c1400f6..bd8e66f1d 100644 --- a/docs/reference/query-db-collection/classes/ItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/ItemNotFoundError.md @@ -5,7 +5,7 @@ title: ItemNotFoundError # Class: ItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:55](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L55) +Defined in: packages/query-db-collection/src/errors.ts:55 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:55](https://github.com/T new ItemNotFoundError(key): ItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:56](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L56) +Defined in: packages/query-db-collection/src/errors.ts:56 #### Parameters diff --git a/docs/reference/query-db-collection/classes/MissingKeyFieldError.md b/docs/reference/query-db-collection/classes/MissingKeyFieldError.md index 3c44dc2ac..29c715f29 100644 --- a/docs/reference/query-db-collection/classes/MissingKeyFieldError.md +++ b/docs/reference/query-db-collection/classes/MissingKeyFieldError.md @@ -5,7 +5,7 @@ title: MissingKeyFieldError # Class: MissingKeyFieldError -Defined in: [packages/query-db-collection/src/errors.ts:97](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L97) +Defined in: packages/query-db-collection/src/errors.ts:97 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:97](https://github.com/T new MissingKeyFieldError(operation, message): MissingKeyFieldError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:98](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L98) +Defined in: packages/query-db-collection/src/errors.ts:98 #### Parameters diff --git a/docs/reference/query-db-collection/classes/QueryClientRequiredError.md b/docs/reference/query-db-collection/classes/QueryClientRequiredError.md index 4d58fb190..6815e302c 100644 --- a/docs/reference/query-db-collection/classes/QueryClientRequiredError.md +++ b/docs/reference/query-db-collection/classes/QueryClientRequiredError.md @@ -5,7 +5,7 @@ title: QueryClientRequiredError # Class: QueryClientRequiredError -Defined in: [packages/query-db-collection/src/errors.ts:25](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L25) +Defined in: packages/query-db-collection/src/errors.ts:25 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:25](https://github.com/T new QueryClientRequiredError(): QueryClientRequiredError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:26](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L26) +Defined in: packages/query-db-collection/src/errors.ts:26 #### Returns diff --git a/docs/reference/query-db-collection/classes/QueryCollectionError.md b/docs/reference/query-db-collection/classes/QueryCollectionError.md index 9e3c7fce5..59a1a5165 100644 --- a/docs/reference/query-db-collection/classes/QueryCollectionError.md +++ b/docs/reference/query-db-collection/classes/QueryCollectionError.md @@ -5,7 +5,7 @@ title: QueryCollectionError # Class: QueryCollectionError -Defined in: [packages/query-db-collection/src/errors.ts:4](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L4) +Defined in: packages/query-db-collection/src/errors.ts:4 ## Extends @@ -35,7 +35,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:4](https://github.com/Ta new QueryCollectionError(message): QueryCollectionError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:5](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L5) +Defined in: packages/query-db-collection/src/errors.ts:5 #### Parameters diff --git a/docs/reference/query-db-collection/classes/QueryFnRequiredError.md b/docs/reference/query-db-collection/classes/QueryFnRequiredError.md index 816d130c8..0f15cba51 100644 --- a/docs/reference/query-db-collection/classes/QueryFnRequiredError.md +++ b/docs/reference/query-db-collection/classes/QueryFnRequiredError.md @@ -5,7 +5,7 @@ title: QueryFnRequiredError # Class: QueryFnRequiredError -Defined in: [packages/query-db-collection/src/errors.ts:18](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L18) +Defined in: packages/query-db-collection/src/errors.ts:18 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:18](https://github.com/T new QueryFnRequiredError(): QueryFnRequiredError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:19](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L19) +Defined in: packages/query-db-collection/src/errors.ts:19 #### Returns diff --git a/docs/reference/query-db-collection/classes/QueryKeyRequiredError.md b/docs/reference/query-db-collection/classes/QueryKeyRequiredError.md index 9e804cafd..769ac973e 100644 --- a/docs/reference/query-db-collection/classes/QueryKeyRequiredError.md +++ b/docs/reference/query-db-collection/classes/QueryKeyRequiredError.md @@ -5,7 +5,7 @@ title: QueryKeyRequiredError # Class: QueryKeyRequiredError -Defined in: [packages/query-db-collection/src/errors.ts:11](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L11) +Defined in: packages/query-db-collection/src/errors.ts:11 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:11](https://github.com/T new QueryKeyRequiredError(): QueryKeyRequiredError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:12](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L12) +Defined in: packages/query-db-collection/src/errors.ts:12 #### Returns diff --git a/docs/reference/query-db-collection/classes/SyncNotInitializedError.md b/docs/reference/query-db-collection/classes/SyncNotInitializedError.md index 8e5a132f5..08854dbf2 100644 --- a/docs/reference/query-db-collection/classes/SyncNotInitializedError.md +++ b/docs/reference/query-db-collection/classes/SyncNotInitializedError.md @@ -5,7 +5,7 @@ title: SyncNotInitializedError # Class: SyncNotInitializedError -Defined in: [packages/query-db-collection/src/errors.ts:39](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L39) +Defined in: packages/query-db-collection/src/errors.ts:39 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:39](https://github.com/T new SyncNotInitializedError(): SyncNotInitializedError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:40](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L40) +Defined in: packages/query-db-collection/src/errors.ts:40 #### Returns diff --git a/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md b/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md index ab9b76715..758fbad9a 100644 --- a/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md +++ b/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md @@ -5,7 +5,7 @@ title: UnknownOperationTypeError # Class: UnknownOperationTypeError -Defined in: [packages/query-db-collection/src/errors.ts:90](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L90) +Defined in: packages/query-db-collection/src/errors.ts:90 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:90](https://github.com/T new UnknownOperationTypeError(type): UnknownOperationTypeError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:91](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L91) +Defined in: packages/query-db-collection/src/errors.ts:91 #### Parameters diff --git a/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md b/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md index 304555e78..8790ce1f8 100644 --- a/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md @@ -5,7 +5,7 @@ title: UpdateOperationItemNotFoundError # Class: UpdateOperationItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:69](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L69) +Defined in: packages/query-db-collection/src/errors.ts:69 ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:69](https://github.com/T new UpdateOperationItemNotFoundError(key): UpdateOperationItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:70](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L70) +Defined in: packages/query-db-collection/src/errors.ts:70 #### Parameters diff --git a/docs/reference/query-db-collection/functions/queryCollectionOptions.md b/docs/reference/query-db-collection/functions/queryCollectionOptions.md index 3aab0096f..3bdc62f4b 100644 --- a/docs/reference/query-db-collection/functions/queryCollectionOptions.md +++ b/docs/reference/query-db-collection/functions/queryCollectionOptions.md @@ -11,7 +11,7 @@ title: queryCollectionOptions function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:394](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L394) +Defined in: packages/query-db-collection/src/query.ts:394 Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -151,7 +151,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:429](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L429) +Defined in: packages/query-db-collection/src/query.ts:429 Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -291,7 +291,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:462](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L462) +Defined in: packages/query-db-collection/src/query.ts:462 Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -423,7 +423,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:496](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L496) +Defined in: packages/query-db-collection/src/query.ts:496 Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md b/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md index 710db1ee9..3ee60a0a6 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md @@ -5,7 +5,7 @@ title: QueryCollectionConfig # Interface: QueryCollectionConfig\ -Defined in: [packages/query-db-collection/src/query.ts:60](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L60) +Defined in: packages/query-db-collection/src/query.ts:60 Configuration options for creating a Query Collection @@ -63,7 +63,7 @@ The schema type for validation optional enabled: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:86](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L86) +Defined in: packages/query-db-collection/src/query.ts:86 Whether the query should automatically run (default: true) @@ -75,7 +75,7 @@ Whether the query should automatically run (default: true) optional meta: Record; ``` -Defined in: [packages/query-db-collection/src/query.ts:136](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L136) +Defined in: packages/query-db-collection/src/query.ts:136 Metadata to pass to the query. Available in queryFn via context.meta @@ -107,7 +107,7 @@ meta: { queryClient: QueryClient; ``` -Defined in: [packages/query-db-collection/src/query.ts:82](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L82) +Defined in: packages/query-db-collection/src/query.ts:82 The TanStack Query client instance @@ -119,7 +119,7 @@ The TanStack Query client instance queryFn: TQueryFn extends (context) => Promise ? (context) => Promise : TQueryFn; ``` -Defined in: [packages/query-db-collection/src/query.ts:74](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L74) +Defined in: packages/query-db-collection/src/query.ts:74 Function that fetches data from the server. Must return the complete collection state @@ -131,7 +131,7 @@ Function that fetches data from the server. Must return the complete collection queryKey: TQueryKey | TQueryKeyBuilder; ``` -Defined in: [packages/query-db-collection/src/query.ts:72](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L72) +Defined in: packages/query-db-collection/src/query.ts:72 The query key used by TanStack Query to identify this query @@ -143,7 +143,7 @@ The query key used by TanStack Query to identify this query optional refetchInterval: number | false | (query) => number | false | undefined; ``` -Defined in: [packages/query-db-collection/src/query.ts:87](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L87) +Defined in: packages/query-db-collection/src/query.ts:87 *** @@ -153,7 +153,7 @@ Defined in: [packages/query-db-collection/src/query.ts:87](https://github.com/Ta optional retry: RetryValue; ``` -Defined in: [packages/query-db-collection/src/query.ts:94](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L94) +Defined in: packages/query-db-collection/src/query.ts:94 *** @@ -163,7 +163,7 @@ Defined in: [packages/query-db-collection/src/query.ts:94](https://github.com/Ta optional retryDelay: RetryDelayValue; ``` -Defined in: [packages/query-db-collection/src/query.ts:101](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L101) +Defined in: packages/query-db-collection/src/query.ts:101 *** @@ -173,7 +173,7 @@ Defined in: [packages/query-db-collection/src/query.ts:101](https://github.com/T optional select: (data) => T[]; ``` -Defined in: [packages/query-db-collection/src/query.ts:80](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L80) +Defined in: packages/query-db-collection/src/query.ts:80 #### Parameters @@ -193,4 +193,4 @@ Defined in: [packages/query-db-collection/src/query.ts:80](https://github.com/Ta optional staleTime: StaleTimeFunction; ``` -Defined in: [packages/query-db-collection/src/query.ts:108](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L108) +Defined in: packages/query-db-collection/src/query.ts:108 diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionMeta.md b/docs/reference/query-db-collection/interfaces/QueryCollectionMeta.md index 6d27f6bac..8ec67f89c 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionMeta.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionMeta.md @@ -5,7 +5,7 @@ title: QueryCollectionMeta # Interface: QueryCollectionMeta -Defined in: [packages/query-db-collection/src/global.ts:30](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/global.ts#L30) +Defined in: packages/query-db-collection/src/global.ts:30 Base interface for Query Collection meta properties. Users can extend this interface to add their own custom properties while @@ -40,4 +40,4 @@ declare module "@tanstack/query-db-collection" { optional loadSubsetOptions: LoadSubsetOptions; ``` -Defined in: [packages/query-db-collection/src/global.ts:31](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/global.ts#L31) +Defined in: packages/query-db-collection/src/global.ts:31 diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md index 2385eca11..b44738404 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md @@ -5,7 +5,7 @@ title: QueryCollectionUtils # Interface: QueryCollectionUtils\ -Defined in: [packages/query-db-collection/src/query.ts:155](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L155) +Defined in: packages/query-db-collection/src/query.ts:155 Utility methods available on Query Collections for direct writes and manual operations. Direct writes bypass the normal query/mutation flow and write directly to the synced data store. @@ -54,7 +54,7 @@ The type of errors that can occur during queries clearError: () => Promise; ``` -Defined in: [packages/query-db-collection/src/query.ts:200](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L200) +Defined in: packages/query-db-collection/src/query.ts:200 Clear the error state and trigger a refetch of the query @@ -76,7 +76,7 @@ Error if the refetch fails dataUpdatedAt: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:191](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L191) +Defined in: packages/query-db-collection/src/query.ts:191 Get timestamp of last successful data update (in milliseconds) @@ -88,7 +88,7 @@ Get timestamp of last successful data update (in milliseconds) errorCount: number; ``` -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) +Defined in: packages/query-db-collection/src/query.ts:183 Get the number of consecutive sync failures. Incremented only when query fails completely (not per retry attempt); reset on success. @@ -101,7 +101,7 @@ Incremented only when query fails completely (not per retry attempt); reset on s fetchStatus: "idle" | "fetching" | "paused"; ``` -Defined in: [packages/query-db-collection/src/query.ts:193](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L193) +Defined in: packages/query-db-collection/src/query.ts:193 Get current fetch status @@ -113,7 +113,7 @@ Get current fetch status isError: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:178](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L178) +Defined in: packages/query-db-collection/src/query.ts:178 Check if the collection is in an error state @@ -125,7 +125,7 @@ Check if the collection is in an error state isFetching: boolean; ``` -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) +Defined in: packages/query-db-collection/src/query.ts:185 Check if query is currently fetching (initial or background) @@ -137,7 +137,7 @@ Check if query is currently fetching (initial or background) isLoading: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:189](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L189) +Defined in: packages/query-db-collection/src/query.ts:189 Check if query is loading for the first time (no data yet) @@ -149,7 +149,7 @@ Check if query is loading for the first time (no data yet) isRefetching: boolean; ``` -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) +Defined in: packages/query-db-collection/src/query.ts:187 Check if query is refetching in background (not initial fetch) @@ -161,7 +161,7 @@ Check if query is refetching in background (not initial fetch) lastError: TError | undefined; ``` -Defined in: [packages/query-db-collection/src/query.ts:176](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L176) +Defined in: packages/query-db-collection/src/query.ts:176 Get the last error encountered by the query (if any); reset on success @@ -173,7 +173,7 @@ Get the last error encountered by the query (if any); reset on success refetch: RefetchFn; ``` -Defined in: [packages/query-db-collection/src/query.ts:162](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L162) +Defined in: packages/query-db-collection/src/query.ts:162 Manually trigger a refetch of the query @@ -185,7 +185,7 @@ Manually trigger a refetch of the query writeBatch: (callback) => void; ``` -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) +Defined in: packages/query-db-collection/src/query.ts:172 Execute multiple write operations as a single atomic batch to the synced data store @@ -207,7 +207,7 @@ Execute multiple write operations as a single atomic batch to the synced data st writeDelete: (keys) => void; ``` -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:168 Delete one or more items directly from the synced data store without triggering a query refetch or optimistic update @@ -229,7 +229,7 @@ Delete one or more items directly from the synced data store without triggering writeInsert: (data) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:164](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L164) +Defined in: packages/query-db-collection/src/query.ts:164 Insert one or more items directly into the synced data store without triggering a query refetch or optimistic update @@ -251,7 +251,7 @@ Insert one or more items directly into the synced data store without triggering writeUpdate: (updates) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:166](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L166) +Defined in: packages/query-db-collection/src/query.ts:166 Update one or more items directly in the synced data store without triggering a query refetch or optimistic update @@ -273,7 +273,7 @@ Update one or more items directly in the synced data store without triggering a writeUpsert: (data) => void; ``` -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:170 Insert or update one or more items directly in the synced data store without triggering a query refetch or optimistic update diff --git a/docs/reference/query-db-collection/type-aliases/SyncOperation.md b/docs/reference/query-db-collection/type-aliases/SyncOperation.md index 9cb0b5eb9..e077df1b4 100644 --- a/docs/reference/query-db-collection/type-aliases/SyncOperation.md +++ b/docs/reference/query-db-collection/type-aliases/SyncOperation.md @@ -25,7 +25,7 @@ type SyncOperation = }; ``` -Defined in: [packages/query-db-collection/src/manual-sync.ts:20](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/manual-sync.ts#L20) +Defined in: packages/query-db-collection/src/manual-sync.ts:20 ## Type Parameters diff --git a/docs/reference/rxdb-db-collection/functions/rxdbCollectionOptions.md b/docs/reference/rxdb-db-collection/functions/rxdbCollectionOptions.md index adf36b74a..e9ada578f 100644 --- a/docs/reference/rxdb-db-collection/functions/rxdbCollectionOptions.md +++ b/docs/reference/rxdb-db-collection/functions/rxdbCollectionOptions.md @@ -11,7 +11,7 @@ title: rxdbCollectionOptions function rxdbCollectionOptions(config): CollectionConfig, string, T, UtilsRecord> & object; ``` -Defined in: [rxdb.ts:89](https://github.com/TanStack/db/blob/main/packages/rxdb-db-collection/src/rxdb.ts#L89) +Defined in: rxdb.ts:89 Creates RxDB collection options for use with a standard Collection @@ -41,7 +41,7 @@ Collection options with utilities function rxdbCollectionOptions(config): CollectionConfig & object; ``` -Defined in: [rxdb.ts:96](https://github.com/TanStack/db/blob/main/packages/rxdb-db-collection/src/rxdb.ts#L96) +Defined in: rxdb.ts:96 Creates RxDB collection options for use with a standard Collection diff --git a/docs/reference/rxdb-db-collection/functions/stripRxdbFields.md b/docs/reference/rxdb-db-collection/functions/stripRxdbFields.md index 989b3dde6..d17e4d189 100644 --- a/docs/reference/rxdb-db-collection/functions/stripRxdbFields.md +++ b/docs/reference/rxdb-db-collection/functions/stripRxdbFields.md @@ -9,7 +9,7 @@ title: stripRxdbFields function stripRxdbFields(obj): T; ``` -Defined in: [helper.ts:8](https://github.com/TanStack/db/blob/main/packages/rxdb-db-collection/src/helper.ts#L8) +Defined in: helper.ts:8 ## Type Parameters diff --git a/docs/reference/rxdb-db-collection/type-aliases/RxDBCollectionConfig.md b/docs/reference/rxdb-db-collection/type-aliases/RxDBCollectionConfig.md index 447463e90..33201a330 100644 --- a/docs/reference/rxdb-db-collection/type-aliases/RxDBCollectionConfig.md +++ b/docs/reference/rxdb-db-collection/type-aliases/RxDBCollectionConfig.md @@ -9,7 +9,7 @@ title: RxDBCollectionConfig type RxDBCollectionConfig = Omit, "onInsert" | "onUpdate" | "onDelete" | "getKey"> & object; ``` -Defined in: [rxdb.ts:49](https://github.com/TanStack/db/blob/main/packages/rxdb-db-collection/src/rxdb.ts#L49) +Defined in: rxdb.ts:49 Configuration interface for RxDB collection options diff --git a/docs/reference/rxdb-db-collection/variables/OPEN_RXDB_SUBSCRIPTIONS.md b/docs/reference/rxdb-db-collection/variables/OPEN_RXDB_SUBSCRIPTIONS.md index 12525d564..d56750343 100644 --- a/docs/reference/rxdb-db-collection/variables/OPEN_RXDB_SUBSCRIPTIONS.md +++ b/docs/reference/rxdb-db-collection/variables/OPEN_RXDB_SUBSCRIPTIONS.md @@ -9,6 +9,6 @@ title: OPEN_RXDB_SUBSCRIPTIONS const OPEN_RXDB_SUBSCRIPTIONS: WeakMap>; ``` -Defined in: [rxdb.ts:31](https://github.com/TanStack/db/blob/main/packages/rxdb-db-collection/src/rxdb.ts#L31) +Defined in: rxdb.ts:31 Used in tests to ensure proper cleanup diff --git a/docs/reference/type-aliases/ApplyJoinOptionalityToMergedSchema.md b/docs/reference/type-aliases/ApplyJoinOptionalityToMergedSchema.md new file mode 100644 index 000000000..21aded667 --- /dev/null +++ b/docs/reference/type-aliases/ApplyJoinOptionalityToMergedSchema.md @@ -0,0 +1,54 @@ +--- +id: ApplyJoinOptionalityToMergedSchema +title: ApplyJoinOptionalityToMergedSchema +--- + +# Type Alias: ApplyJoinOptionalityToMergedSchema\ + +```ts +type ApplyJoinOptionalityToMergedSchema = { [K in keyof TExistingSchema]: K extends TFromSourceName ? TJoinType extends "right" | "full" ? TExistingSchema[K] | undefined : TExistingSchema[K] : TExistingSchema[K] } & { [K in keyof TNewSchema]: TJoinType extends "left" | "full" ? TNewSchema[K] | undefined : TNewSchema[K] }; +``` + +Defined in: packages/db/src/query/builder/types.ts:622 + +ApplyJoinOptionalityToMergedSchema - Applies optionality rules when merging schemas + +This type implements the SQL join optionality semantics: + +**For Existing Tables**: +- `RIGHT JOIN` or `FULL JOIN`: Main table (from fromSourceName) becomes optional +- Other join types: Existing tables keep their current optionality +- Previously joined tables: Keep their already-applied optionality + +**For New Tables**: +- `LEFT JOIN` or `FULL JOIN`: New table becomes optional +- `INNER JOIN` or `RIGHT JOIN`: New table remains required + +**Examples**: +```sql +FROM users LEFT JOIN orders -- orders becomes optional +FROM users RIGHT JOIN orders -- users becomes optional +FROM users FULL JOIN orders -- both become optional +FROM users INNER JOIN orders -- both remain required +``` + +The intersection (&) ensures both existing and new schemas are merged +into a single type while preserving all table references. + +## Type Parameters + +### TExistingSchema + +`TExistingSchema` *extends* [`ContextSchema`](ContextSchema.md) + +### TNewSchema + +`TNewSchema` *extends* [`ContextSchema`](ContextSchema.md) + +### TJoinType + +`TJoinType` *extends* `"inner"` \| `"left"` \| `"right"` \| `"full"` \| `"outer"` \| `"cross"` + +### TFromSourceName + +`TFromSourceName` *extends* `string` diff --git a/docs/reference/type-aliases/ChangeListener.md b/docs/reference/type-aliases/ChangeListener.md new file mode 100644 index 000000000..22f64de50 --- /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:879 + +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/ChangeMessageOrDeleteKeyMessage.md b/docs/reference/type-aliases/ChangeMessageOrDeleteKeyMessage.md new file mode 100644 index 000000000..ec0bb2237 --- /dev/null +++ b/docs/reference/type-aliases/ChangeMessageOrDeleteKeyMessage.md @@ -0,0 +1,24 @@ +--- +id: ChangeMessageOrDeleteKeyMessage +title: ChangeMessageOrDeleteKeyMessage +--- + +# Type Alias: ChangeMessageOrDeleteKeyMessage\ + +```ts +type ChangeMessageOrDeleteKeyMessage = + | Omit, "key"> +| DeleteKeyMessage; +``` + +Defined in: packages/db/src/types.ts:375 + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` diff --git a/docs/reference/type-aliases/ChangesPayload.md b/docs/reference/type-aliases/ChangesPayload.md new file mode 100644 index 000000000..f03893fba --- /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:742 + +## 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..b4f4edd05 --- /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:318 + +## Returns + +`void` diff --git a/docs/reference/type-aliases/ClearStorageFn.md b/docs/reference/type-aliases/ClearStorageFn.md new file mode 100644 index 000000000..13beee497 --- /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 + +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..9ce0ad02f --- /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:735 + +## 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..78d1561fc --- /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:485 + +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/ContextSchema.md b/docs/reference/type-aliases/ContextSchema.md new file mode 100644 index 000000000..1e07b6f5e --- /dev/null +++ b/docs/reference/type-aliases/ContextSchema.md @@ -0,0 +1,20 @@ +--- +id: ContextSchema +title: ContextSchema +--- + +# Type Alias: ContextSchema + +```ts +type ContextSchema = Record; +``` + +Defined in: packages/db/src/query/builder/types.ts:64 + +ContextSchema - The shape of available tables/collections in a query context + +This is simply a record mapping table aliases to their TypeScript types. +It evolves as the query progresses: +- Initial: Just the `from()` table +- After joins: Includes all joined tables with proper optionality +- In subqueries: May be a subset of the outer query's schema diff --git a/docs/reference/type-aliases/CursorExpressions.md b/docs/reference/type-aliases/CursorExpressions.md new file mode 100644 index 000000000..687fefa75 --- /dev/null +++ b/docs/reference/type-aliases/CursorExpressions.md @@ -0,0 +1,60 @@ +--- +id: CursorExpressions +title: CursorExpressions +--- + +# Type Alias: CursorExpressions + +```ts +type CursorExpressions = object; +``` + +Defined in: packages/db/src/types.ts:264 + +Cursor expressions for pagination, passed separately from the main `where` clause. +The sync layer can choose to use cursor-based pagination (combining these with the where) +or offset-based pagination (ignoring these and using the `offset` parameter). + +Neither expression includes the main `where` clause - they are cursor-specific only. + +## Properties + +### lastKey? + +```ts +optional lastKey: string | number; +``` + +Defined in: packages/db/src/types.ts:282 + +The key of the last item that was loaded. +Can be used by sync layers for tracking or deduplication. + +*** + +### whereCurrent + +```ts +whereCurrent: BasicExpression; +``` + +Defined in: packages/db/src/types.ts:277 + +Expression for rows equal to the current cursor value (first orderBy column only). +Used to handle tie-breaking/duplicates at the boundary. +Example: eq(col1, v1) or for Dates: and(gte(col1, v1), lt(col1, v1+1ms)) + +*** + +### whereFrom + +```ts +whereFrom: BasicExpression; +``` + +Defined in: packages/db/src/types.ts:271 + +Expression for rows greater than (after) the cursor value. +For multi-column orderBy, this is a composite cursor using OR of conditions. +Example for [col1 ASC, col2 DESC] with values [v1, v2]: + or(gt(col1, v1), and(eq(col1, v1), lt(col2, v2))) diff --git a/docs/reference/type-aliases/DeleteKeyMessage.md b/docs/reference/type-aliases/DeleteKeyMessage.md new file mode 100644 index 000000000..ae6a96d82 --- /dev/null +++ b/docs/reference/type-aliases/DeleteKeyMessage.md @@ -0,0 +1,26 @@ +--- +id: DeleteKeyMessage +title: DeleteKeyMessage +--- + +# Type Alias: DeleteKeyMessage\ + +```ts +type DeleteKeyMessage = Omit, "value" | "previousValue" | "type"> & object; +``` + +Defined in: packages/db/src/types.ts:370 + +## Type Declaration + +### type + +```ts +type: "delete"; +``` + +## Type Parameters + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` diff --git a/docs/reference/type-aliases/DeleteMutationFn.md b/docs/reference/type-aliases/DeleteMutationFn.md new file mode 100644 index 000000000..f14dde494 --- /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:463 + +## 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..28c0fb91b --- /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:440 + +## 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:446 + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: packages/db/src/types.ts:445 diff --git a/docs/reference/type-aliases/ExtractContext.md b/docs/reference/type-aliases/ExtractContext.md new file mode 100644 index 000000000..9c76aaac1 --- /dev/null +++ b/docs/reference/type-aliases/ExtractContext.md @@ -0,0 +1,18 @@ +--- +id: ExtractContext +title: ExtractContext +--- + +# Type Alias: ExtractContext\ + +```ts +type ExtractContext = T extends BaseQueryBuilder ? TContext : T extends QueryBuilder ? TContext : never; +``` + +Defined in: packages/db/src/query/builder/index.ts:900 + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/FieldPath.md b/docs/reference/type-aliases/FieldPath.md new file mode 100644 index 000000000..e4a32806b --- /dev/null +++ b/docs/reference/type-aliases/FieldPath.md @@ -0,0 +1,15 @@ +--- +id: FieldPath +title: FieldPath +--- + +# Type Alias: FieldPath + +```ts +type FieldPath = (string | number)[]; +``` + +Defined in: packages/db/src/query/expression-helpers.ts:39 + +Represents a simple field path extracted from an expression. +Can include string keys for object properties and numbers for array indices. diff --git a/docs/reference/type-aliases/Fn.md b/docs/reference/type-aliases/Fn.md new file mode 100644 index 000000000..ec4bc58b3 --- /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:67 + +Represents a utility function that can be attached to a collection + +## Parameters + +### args + +...`any`[] + +## Returns + +`any` diff --git a/docs/reference/type-aliases/FunctionalHavingRow.md b/docs/reference/type-aliases/FunctionalHavingRow.md new file mode 100644 index 000000000..cfa167235 --- /dev/null +++ b/docs/reference/type-aliases/FunctionalHavingRow.md @@ -0,0 +1,34 @@ +--- +id: FunctionalHavingRow +title: FunctionalHavingRow +--- + +# Type Alias: FunctionalHavingRow\ + +```ts +type FunctionalHavingRow = TContext["schema"] & TContext["result"] extends object ? object : object; +``` + +Defined in: packages/db/src/query/builder/types.ts:365 + +FunctionalHavingRow - Type for the row parameter in functional having callbacks + +Functional having callbacks receive a namespaced row that includes: +- Table data from the schema (when available) +- $selected: The SELECT result fields (when select() has been called) + +After `select()` is called, this type includes `$selected` which provides access +to the SELECT result fields via `$selected.fieldName` syntax. + +Note: When used with GROUP BY, functional having receives `{ $selected: ... }` with the +aggregated SELECT results. When used without GROUP BY, it receives the full namespaced row +which includes both table data and `$selected`. + +Example: `({ $selected }) => $selected.sessionCount > 2` +Example (no GROUP BY): `(row) => row.user.salary > 70000 && row.$selected.user_count > 2` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) diff --git a/docs/reference/type-aliases/GetResult.md b/docs/reference/type-aliases/GetResult.md new file mode 100644 index 000000000..67c9233e9 --- /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:678 + +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..ac50c65c3 --- /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 + +Type for the getStorageSize utility function + +## Returns + +`number` diff --git a/docs/reference/type-aliases/GroupByCallback.md b/docs/reference/type-aliases/GroupByCallback.md new file mode 100644 index 000000000..ca9292570 --- /dev/null +++ b/docs/reference/type-aliases/GroupByCallback.md @@ -0,0 +1,35 @@ +--- +id: GroupByCallback +title: GroupByCallback +--- + +# Type Alias: GroupByCallback()\ + +```ts +type GroupByCallback = (refs) => any; +``` + +Defined in: packages/db/src/query/builder/types.ts:328 + +GroupByCallback - Type for groupBy clause callback functions + +These callbacks receive refs for all available tables and should return +expressions that will be used for grouping query results. + +Example: `(refs) => refs.orders.status` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +## Parameters + +### refs + +[`RefsForContext`](RefsForContext.md)\<`TContext`\> + +## Returns + +`any` diff --git a/docs/reference/type-aliases/IndexConstructor.md b/docs/reference/type-aliases/IndexConstructor.md new file mode 100644 index 000000000..000bd5bd4 --- /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:214 + +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..19cd6fb84 --- /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 + +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..fd47fdc76 --- /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:225 + +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/InferCollectionType.md b/docs/reference/type-aliases/InferCollectionType.md new file mode 100644 index 000000000..ce3971624 --- /dev/null +++ b/docs/reference/type-aliases/InferCollectionType.md @@ -0,0 +1,23 @@ +--- +id: InferCollectionType +title: InferCollectionType +--- + +# Type Alias: InferCollectionType\ + +```ts +type InferCollectionType = T extends CollectionImpl ? TOutput : never; +``` + +Defined in: packages/db/src/query/builder/types.ts:85 + +InferCollectionType - Extracts the TypeScript type from a CollectionImpl + +This helper ensures we get the same type that was used when creating the collection itself. +This can be an explicit type passed by the user or the schema output type. + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/InferResultType.md b/docs/reference/type-aliases/InferResultType.md new file mode 100644 index 000000000..80b4ce24f --- /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:648 + +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..da04dbfeb --- /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:56 + +**`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..9f9c227d7 --- /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:45 + +**`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..04f5635fe --- /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:886 diff --git a/docs/reference/type-aliases/InputRow.md b/docs/reference/type-aliases/InputRow.md new file mode 100644 index 000000000..58ba45406 --- /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:749 + +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..c22d2dcc1 --- /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:449 + +## 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..935b5390e --- /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:432 + +## 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:438 + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: packages/db/src/types.ts:437 diff --git a/docs/reference/type-aliases/JoinOnCallback.md b/docs/reference/type-aliases/JoinOnCallback.md new file mode 100644 index 000000000..4574e706d --- /dev/null +++ b/docs/reference/type-aliases/JoinOnCallback.md @@ -0,0 +1,39 @@ +--- +id: JoinOnCallback +title: JoinOnCallback +--- + +# Type Alias: JoinOnCallback()\ + +```ts +type JoinOnCallback = (refs) => any; +``` + +Defined in: packages/db/src/query/builder/types.ts:344 + +JoinOnCallback - Type for join condition callback functions + +These callbacks receive refs for all available tables (including the newly +joined table) and should return a boolean expression defining the join condition. + +Important: The newly joined table is NOT marked as optional in this callback, +even for left/right/full joins, because optionality is applied AFTER the join +condition is evaluated. + +Example: `(refs) => eq(refs.users.id, refs.orders.userId)` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +## Parameters + +### refs + +[`RefsForContext`](RefsForContext.md)\<`TContext`\> + +## Returns + +`any` diff --git a/docs/reference/type-aliases/KeyedNamespacedRow.md b/docs/reference/type-aliases/KeyedNamespacedRow.md new file mode 100644 index 000000000..f323b9adc --- /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:772 + +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..ace11abe1 --- /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:755 + +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..efa2f0ac3 --- /dev/null +++ b/docs/reference/type-aliases/LiveQueryCollectionUtils.md @@ -0,0 +1,74 @@ +--- +id: LiveQueryCollectionUtils +title: LiveQueryCollectionUtils +--- + +# Type Alias: LiveQueryCollectionUtils + +```ts +type LiveQueryCollectionUtils = UtilsRecord & object; +``` + +Defined in: packages/db/src/query/live/collection-config-builder.ts:39 + +## Type Declaration + +### \[LIVE\_QUERY\_INTERNAL\] + +```ts +[LIVE_QUERY_INTERNAL]: LiveQueryInternalUtils; +``` + +### 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..118ea9164 --- /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:314 + +## 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..e465694d2 --- /dev/null +++ b/docs/reference/type-aliases/LoadSubsetOptions.md @@ -0,0 +1,95 @@ +--- +id: LoadSubsetOptions +title: LoadSubsetOptions +--- + +# Type Alias: LoadSubsetOptions + +```ts +type LoadSubsetOptions = object; +``` + +Defined in: packages/db/src/types.ts:285 + +## Properties + +### cursor? + +```ts +optional cursor: CursorExpressions; +``` + +Defined in: packages/db/src/types.ts:297 + +Cursor expressions for cursor-based pagination. +These are separate from `where` - the sync layer should combine them if using cursor-based pagination. +Neither expression includes the main `where` clause. + +*** + +### limit? + +```ts +optional limit: number; +``` + +Defined in: packages/db/src/types.ts:291 + +The limit of the data to load + +*** + +### offset? + +```ts +optional offset: number; +``` + +Defined in: packages/db/src/types.ts:302 + +Row offset for offset-based pagination. +The sync layer can use this instead of `cursor` if it prefers offset-based pagination. + +*** + +### orderBy? + +```ts +optional orderBy: OrderBy; +``` + +Defined in: packages/db/src/types.ts:289 + +The order by clause to sort the data + +*** + +### subscription? + +```ts +optional subscription: Subscription; +``` + +Defined in: packages/db/src/types.ts:311 + +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:287 + +The where expression to filter the data (does NOT include cursor expressions) diff --git a/docs/reference/type-aliases/MakeOptional.md b/docs/reference/type-aliases/MakeOptional.md new file mode 100644 index 000000000..36878a647 --- /dev/null +++ b/docs/reference/type-aliases/MakeOptional.md @@ -0,0 +1,22 @@ +--- +id: MakeOptional +title: MakeOptional +--- + +# Type Alias: MakeOptional\ + +```ts +type MakeOptional = Omit & Partial>; +``` + +Defined in: packages/db/src/types.ts:958 + +## Type Parameters + +### T + +`T` + +### K + +`K` *extends* keyof `T` diff --git a/docs/reference/type-aliases/MaybeSingleResult.md b/docs/reference/type-aliases/MaybeSingleResult.md new file mode 100644 index 000000000..d05f7b720 --- /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:727 + +## Properties + +### singleResult? + +```ts +optional singleResult: true; +``` + +Defined in: packages/db/src/types.ts:731 + +If enabled the collection will return a single object instead of an array diff --git a/docs/reference/type-aliases/MergeContextForJoinCallback.md b/docs/reference/type-aliases/MergeContextForJoinCallback.md new file mode 100644 index 000000000..005e5002c --- /dev/null +++ b/docs/reference/type-aliases/MergeContextForJoinCallback.md @@ -0,0 +1,108 @@ +--- +id: MergeContextForJoinCallback +title: MergeContextForJoinCallback +--- + +# Type Alias: MergeContextForJoinCallback\ + +```ts +type MergeContextForJoinCallback = object; +``` + +Defined in: packages/db/src/query/builder/types.ts:807 + +MergeContextForJoinCallback - Special context for join condition callbacks + +This type creates a context specifically for the `onCallback` parameter of join operations. +The key difference from `MergeContextWithJoinType` is that NO optionality is applied here. + +**Why No Optionality?** +In SQL, join conditions are evaluated BEFORE optionality is determined. Both tables +must be treated as available (non-optional) within the join condition itself. +Optionality is only applied to the result AFTER the join logic executes. + +**Example**: +```typescript +.from({ users }) +.leftJoin({ orders }, ({ users, orders }) => { + // users is NOT optional here - we can access users.id directly + // orders is NOT optional here - we can access orders.userId directly + return eq(users.id, orders.userId) +}) +.where(({ orders }) => { + // NOW orders is optional because it's after the LEFT JOIN + return orders?.status === 'pending' +}) +``` + +The simple intersection (&) merges schemas without any optionality transformation. + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +### TNewSchema + +`TNewSchema` *extends* [`ContextSchema`](ContextSchema.md) + +## Properties + +### baseSchema + +```ts +baseSchema: TContext["baseSchema"]; +``` + +Defined in: packages/db/src/query/builder/types.ts:811 + +*** + +### fromSourceName + +```ts +fromSourceName: TContext["fromSourceName"]; +``` + +Defined in: packages/db/src/query/builder/types.ts:814 + +*** + +### hasJoins + +```ts +hasJoins: true; +``` + +Defined in: packages/db/src/query/builder/types.ts:815 + +*** + +### joinTypes + +```ts +joinTypes: TContext["joinTypes"] extends Record ? TContext["joinTypes"] : object; +``` + +Defined in: packages/db/src/query/builder/types.ts:816 + +*** + +### result + +```ts +result: TContext["result"]; +``` + +Defined in: packages/db/src/query/builder/types.ts:819 + +*** + +### schema + +```ts +schema: TContext["schema"] & TNewSchema; +``` + +Defined in: packages/db/src/query/builder/types.ts:813 diff --git a/docs/reference/type-aliases/MergeContextWithJoinType.md b/docs/reference/type-aliases/MergeContextWithJoinType.md new file mode 100644 index 000000000..f2bbb87ff --- /dev/null +++ b/docs/reference/type-aliases/MergeContextWithJoinType.md @@ -0,0 +1,86 @@ +--- +id: MergeContextWithJoinType +title: MergeContextWithJoinType +--- + +# Type Alias: MergeContextWithJoinType\ + +```ts +type MergeContextWithJoinType = object & PreserveSingleResultFlag; +``` + +Defined in: packages/db/src/query/builder/types.ts:573 + +MergeContextWithJoinType - Creates a new context after a join operation + +This is the core type that handles the complex logic of merging schemas +when tables are joined, applying the correct optionality based on join type. + +**Key Responsibilities**: +1. **Schema Merging**: Combines existing schema with newly joined tables +2. **Optionality Logic**: Applies join-specific optionality rules: + - `LEFT JOIN`: New table becomes optional + - `RIGHT JOIN`: Existing tables become optional + - `FULL JOIN`: Both existing and new become optional + - `INNER JOIN`: No tables become optional +3. **State Tracking**: Updates hasJoins and joinTypes for future operations + +**Context Evolution**: +- `baseSchema`: Unchanged (always the original `from()` tables) +- `schema`: Expanded with new tables and proper optionality +- `hasJoins`: Set to true +- `joinTypes`: Updated to track this join type +- `result`: Preserved from previous operations +- `singleResult`: Preserved only if already true (via PreserveSingleResultFlag) + +## Type Declaration + +### baseSchema + +```ts +baseSchema: TContext["baseSchema"]; +``` + +### fromSourceName + +```ts +fromSourceName: TContext["fromSourceName"]; +``` + +### hasJoins + +```ts +hasJoins: true; +``` + +### joinTypes + +```ts +joinTypes: TContext["joinTypes"] extends Record ? TContext["joinTypes"] : object & { [K in keyof TNewSchema & string]: TJoinType }; +``` + +### result + +```ts +result: TContext["result"]; +``` + +### schema + +```ts +schema: ApplyJoinOptionalityToMergedSchema; +``` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +### TNewSchema + +`TNewSchema` *extends* [`ContextSchema`](ContextSchema.md) + +### TJoinType + +`TJoinType` *extends* `"inner"` \| `"left"` \| `"right"` \| `"full"` \| `"outer"` \| `"cross"` diff --git a/docs/reference/type-aliases/MutationFn.md b/docs/reference/type-aliases/MutationFn.md new file mode 100644 index 000000000..bed21513a --- /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:127 + +## 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..a0bde6ce9 --- /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:123 + +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:124 diff --git a/docs/reference/type-aliases/NamespacedAndKeyedStream.md b/docs/reference/type-aliases/NamespacedAndKeyedStream.md new file mode 100644 index 000000000..f77f3c4f4 --- /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:779 + +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..320406f9e --- /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:766 + +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..7f804f66b --- /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:134 + +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..fab595a45 --- /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:723 + +## Properties + +### singleResult? + +```ts +optional singleResult: never; +``` + +Defined in: packages/db/src/types.ts:724 diff --git a/docs/reference/type-aliases/OperationType.md b/docs/reference/type-aliases/OperationType.md new file mode 100644 index 000000000..001d1521a --- /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:203 diff --git a/docs/reference/type-aliases/OperatorName.md b/docs/reference/type-aliases/OperatorName.md new file mode 100644 index 000000000..ee7cc3cd2 --- /dev/null +++ b/docs/reference/type-aliases/OperatorName.md @@ -0,0 +1,12 @@ +--- +id: OperatorName +title: OperatorName +--- + +# Type Alias: OperatorName + +```ts +type OperatorName = typeof operators[number]; +``` + +Defined in: packages/db/src/query/builder/functions.ts:378 diff --git a/docs/reference/type-aliases/OptimisticChangeMessage.md b/docs/reference/type-aliases/OptimisticChangeMessage.md new file mode 100644 index 000000000..dab293df4 --- /dev/null +++ b/docs/reference/type-aliases/OptimisticChangeMessage.md @@ -0,0 +1,24 @@ +--- +id: OptimisticChangeMessage +title: OptimisticChangeMessage +--- + +# Type Alias: OptimisticChangeMessage\ + +```ts +type OptimisticChangeMessage = + | ChangeMessage & object + | DeleteKeyMessage & object; +``` + +Defined in: packages/db/src/types.ts:380 + +## Type Parameters + +### T + +`T` *extends* `object` = `Record`\<`string`, `unknown`\> + +### TKey + +`TKey` *extends* `string` \| `number` = `string` \| `number` diff --git a/docs/reference/type-aliases/OrderByCallback.md b/docs/reference/type-aliases/OrderByCallback.md new file mode 100644 index 000000000..5f227a690 --- /dev/null +++ b/docs/reference/type-aliases/OrderByCallback.md @@ -0,0 +1,35 @@ +--- +id: OrderByCallback +title: OrderByCallback +--- + +# Type Alias: OrderByCallback()\ + +```ts +type OrderByCallback = (refs) => any; +``` + +Defined in: packages/db/src/query/builder/types.ts:292 + +OrderByCallback - Type for orderBy clause callback functions + +Similar to WhereCallback, these receive refs for all available tables +and should return expressions that will be used for sorting. + +Example: `(refs) => refs.users.createdAt` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +## Parameters + +### refs + +[`RefsForContext`](RefsForContext.md)\<`TContext`\> + +## Returns + +`any` diff --git a/docs/reference/type-aliases/Prettify.md b/docs/reference/type-aliases/Prettify.md new file mode 100644 index 000000000..0700a115b --- /dev/null +++ b/docs/reference/type-aliases/Prettify.md @@ -0,0 +1,20 @@ +--- +id: Prettify +title: Prettify +--- + +# Type Alias: Prettify\ + +```ts +type Prettify = { [K in keyof T]: T[K] } & object; +``` + +Defined in: packages/db/src/query/builder/types.ts:845 + +Prettify - Utility type for clean IDE display + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/QueryBuilder.md b/docs/reference/type-aliases/QueryBuilder.md new file mode 100644 index 000000000..0f6c3c805 --- /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:890 + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) diff --git a/docs/reference/type-aliases/QueryResult.md b/docs/reference/type-aliases/QueryResult.md new file mode 100644 index 000000000..36895799a --- /dev/null +++ b/docs/reference/type-aliases/QueryResult.md @@ -0,0 +1,18 @@ +--- +id: QueryResult +title: QueryResult +--- + +# Type Alias: QueryResult\ + +```ts +type QueryResult = GetResult>; +``` + +Defined in: packages/db/src/query/builder/index.ts:908 + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/type-aliases/Ref.md b/docs/reference/type-aliases/Ref.md new file mode 100644 index 000000000..120bf6a21 --- /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:496 + +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/RefsForContext.md b/docs/reference/type-aliases/RefsForContext.md new file mode 100644 index 000000000..3cb62f885 --- /dev/null +++ b/docs/reference/type-aliases/RefsForContext.md @@ -0,0 +1,40 @@ +--- +id: RefsForContext +title: RefsForContext +--- + +# Type Alias: RefsForContext\ + +```ts +type RefsForContext = { [K in keyof TContext["schema"]]: IsNonExactOptional extends true ? IsNonExactNullable extends true ? Ref> | undefined : Ref> | undefined : IsNonExactNullable extends true ? Ref> | null : Ref } & TContext["result"] extends object ? object : object; +``` + +Defined in: packages/db/src/query/builder/types.ts:391 + +RefProxyForContext - Creates ref proxies for all tables/collections in a query context + +This is the main entry point for creating ref objects in query builder callbacks. +It handles optionality by placing undefined/null OUTSIDE the RefProxy to enable +JavaScript's optional chaining operator (?.): + +Examples: +- Required field: `RefProxy` → user.name works +- Optional field: `RefProxy | undefined` → user?.name works +- Nullable field: `RefProxy | null` → user?.name works +- Both optional and nullable: `RefProxy | undefined` → user?.name works + +The key insight is that `RefProxy` would NOT allow `user?.name` +because the undefined is "inside" the proxy, but `RefProxy | undefined` +does allow it because the undefined is "outside" the proxy. + +The logic prioritizes optional chaining by always placing `undefined` outside when +a type is both optional and nullable (e.g., `string | null | undefined`). + +After `select()` is called, this type also includes `$selected` which provides access +to the SELECT result fields via `$selected.fieldName` syntax. + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) diff --git a/docs/reference/type-aliases/ResolveTransactionChanges.md b/docs/reference/type-aliases/ResolveTransactionChanges.md new file mode 100644 index 000000000..11d236c31 --- /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:80 + +## 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..90dac8ba7 --- /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:761 + +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/ResultTypeFromSelect.md b/docs/reference/type-aliases/ResultTypeFromSelect.md new file mode 100644 index 000000000..c65320d07 --- /dev/null +++ b/docs/reference/type-aliases/ResultTypeFromSelect.md @@ -0,0 +1,53 @@ +--- +id: ResultTypeFromSelect +title: ResultTypeFromSelect +--- + +# Type Alias: ResultTypeFromSelect\ + +```ts +type ResultTypeFromSelect = WithoutRefBrand extends true ? ExtractExpressionType : TSelectObject[K] extends Ref ? ExtractRef : TSelectObject[K] extends RefLeaf ? T : TSelectObject[K] extends RefLeaf | undefined ? T | undefined : TSelectObject[K] extends RefLeaf | null ? T | null : TSelectObject[K] extends Ref<(...)> | undefined ? ExtractRef<(...)> | undefined : (...)[(...)] extends (...) | (...) ? (...) | (...) : (...) extends (...) ? (...) : (...) }>>; +``` + +Defined in: packages/db/src/query/builder/types.ts:226 + +ResultTypeFromSelect - Infers the result type from a select object + +This complex type transforms the input to `select()` into the actual TypeScript +type that the query will return. It handles all the different kinds of values +that can appear in a select clause: + +**Ref/RefProxy Extraction**: +- `RefProxy` → `T`: Extracts the underlying type +- `Ref | undefined` → `T | undefined`: Preserves optionality +- `Ref | null` → `T | null`: Preserves nullability + +**Expression Types**: +- `BasicExpression` → `T`: Function results like `upper()` → `string` +- `Aggregate` → `T`: Aggregation results like `count()` → `number` + +**JavaScript Literals** (pass through as-is): +- `string` → `string`: String literals remain strings +- `number` → `number`: Numeric literals remain numbers +- `boolean` → `boolean`: Boolean literals remain booleans +- `null` → `null`: Explicit null remains null +- `undefined` → `undefined`: Direct undefined values + +**Nested Objects** (recursive): +- Plain objects are recursively processed to handle nested projections +- RefProxy objects are detected and their types extracted + +Example transformation: +```typescript +// Input: +{ id: Ref, name: Ref, status: 'active', count: 42, profile: { bio: Ref } } + +// Output: +{ id: number, name: string, status: 'active', count: 42, profile: { bio: string } } +``` + +## Type Parameters + +### TSelectObject + +`TSelectObject` diff --git a/docs/reference/type-aliases/Row.md b/docs/reference/type-aliases/Row.md new file mode 100644 index 000000000..d9e356d99 --- /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:201 + +## Type Parameters + +### TExtensions + +`TExtensions` = `never` diff --git a/docs/reference/type-aliases/SchemaFromSource.md b/docs/reference/type-aliases/SchemaFromSource.md new file mode 100644 index 000000000..b922f7419 --- /dev/null +++ b/docs/reference/type-aliases/SchemaFromSource.md @@ -0,0 +1,27 @@ +--- +id: SchemaFromSource +title: SchemaFromSource +--- + +# Type Alias: SchemaFromSource\ + +```ts +type SchemaFromSource = Prettify<{ [K in keyof T]: T[K] extends CollectionImpl ? InferCollectionType : T[K] extends QueryBuilder ? GetResult : never }>; +``` + +Defined in: packages/db/src/query/builder/types.ts:98 + +SchemaFromSource - Converts a Source definition into a ContextSchema + +This transforms the input to `from()` into the schema format used throughout +the query builder. For each alias in the source: +- Collections → their inferred TypeScript type +- Subqueries → their result type (what they would return if executed) + +The `Prettify` wrapper ensures clean type display in IDEs. + +## Type Parameters + +### T + +`T` *extends* [`Source`](Source.md) diff --git a/docs/reference/type-aliases/SelectObject.md b/docs/reference/type-aliases/SelectObject.md new file mode 100644 index 000000000..fb73721b2 --- /dev/null +++ b/docs/reference/type-aliases/SelectObject.md @@ -0,0 +1,24 @@ +--- +id: SelectObject +title: SelectObject +--- + +# Type Alias: SelectObject\ + +```ts +type SelectObject = T; +``` + +Defined in: packages/db/src/query/builder/types.ts:188 + +SelectObject - Wrapper type for select clause objects + +This ensures that objects passed to `select()` have valid SelectValue types +for all their properties. It's a simple wrapper that provides better error +messages when invalid selections are attempted. + +## Type Parameters + +### T + +`T` *extends* `SelectShape` = `SelectShape` diff --git a/docs/reference/type-aliases/SingleResult.md b/docs/reference/type-aliases/SingleResult.md new file mode 100644 index 000000000..e012dbb02 --- /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:719 + +## Properties + +### singleResult + +```ts +singleResult: true; +``` + +Defined in: packages/db/src/types.ts:720 diff --git a/docs/reference/type-aliases/Source.md b/docs/reference/type-aliases/Source.md new file mode 100644 index 000000000..d37c7bb1c --- /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 + +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..04f56cd37 --- /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:397 + +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..d56e630d7 --- /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:409 + +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..26b8032d7 --- /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 + +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..5961ef08d --- /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 + +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 + +#### Parameters + +##### type + +`"storage"` + +##### listener + +(`event`) => `void` + +#### Returns + +`void` + +*** + +### removeEventListener() + +```ts +removeEventListener: (type, listener) => void; +``` + +Defined in: packages/db/src/local-storage.ts:33 + +#### 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..ed75375cb --- /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 + +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..06fc18c7d --- /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 + +Extract the options type from a strategy + +## Type Parameters + +### T + +`T` *extends* [`Strategy`](Strategy.md) diff --git a/docs/reference/type-aliases/StringCollationConfig.md b/docs/reference/type-aliases/StringCollationConfig.md new file mode 100644 index 000000000..9b1034929 --- /dev/null +++ b/docs/reference/type-aliases/StringCollationConfig.md @@ -0,0 +1,28 @@ +--- +id: StringCollationConfig +title: StringCollationConfig +--- + +# Type Alias: StringCollationConfig + +```ts +type StringCollationConfig = + | { + stringSort?: "lexical"; +} + | { + locale?: string; + localeOptions?: object; + stringSort?: "locale"; +}; +``` + +Defined in: packages/db/src/types.ts:30 + +StringSortOpts - Options for string sorting behavior + +This discriminated union allows for two types of string sorting: +- **Lexical**: Simple character-by-character comparison (default) +- **Locale**: Locale-aware sorting with optional customization + +The union ensures that locale options are only available when locale sorting is selected. diff --git a/docs/reference/type-aliases/SubscriptionEvents.md b/docs/reference/type-aliases/SubscriptionEvents.md new file mode 100644 index 000000000..f398f4194 --- /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:241 + +All subscription events + +## Properties + +### status:change + +```ts +status:change: SubscriptionStatusChangeEvent; +``` + +Defined in: packages/db/src/types.ts:242 + +*** + +### status:loadingSubset + +```ts +status:loadingSubset: SubscriptionStatusEvent<"loadingSubset">; +``` + +Defined in: packages/db/src/types.ts:244 + +*** + +### status:ready + +```ts +status:ready: SubscriptionStatusEvent<"ready">; +``` + +Defined in: packages/db/src/types.ts:243 + +*** + +### unsubscribed + +```ts +unsubscribed: SubscriptionUnsubscribedEvent; +``` + +Defined in: packages/db/src/types.ts:245 diff --git a/docs/reference/type-aliases/SubscriptionStatus.md b/docs/reference/type-aliases/SubscriptionStatus.md new file mode 100644 index 000000000..44d07aad4 --- /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:208 + +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..39318b239 --- /dev/null +++ b/docs/reference/type-aliases/SyncConfigRes.md @@ -0,0 +1,42 @@ +--- +id: SyncConfigRes +title: SyncConfigRes +--- + +# Type Alias: SyncConfigRes + +```ts +type SyncConfigRes = object; +``` + +Defined in: packages/db/src/types.ts:320 + +## Properties + +### cleanup? + +```ts +optional cleanup: CleanupFn; +``` + +Defined in: packages/db/src/types.ts:321 + +*** + +### loadSubset? + +```ts +optional loadSubset: LoadSubsetFn; +``` + +Defined in: packages/db/src/types.ts:322 + +*** + +### unloadSubset? + +```ts +optional unloadSubset: UnloadSubsetFn; +``` + +Defined in: packages/db/src/types.ts:323 diff --git a/docs/reference/type-aliases/SyncMode.md b/docs/reference/type-aliases/SyncMode.md new file mode 100644 index 000000000..2e3c11258 --- /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:497 diff --git a/docs/reference/type-aliases/TransactionState.md b/docs/reference/type-aliases/TransactionState.md new file mode 100644 index 000000000..674d347bb --- /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:62 diff --git a/docs/reference/type-aliases/TransactionWithMutations.md b/docs/reference/type-aliases/TransactionWithMutations.md new file mode 100644 index 000000000..997fbbe33 --- /dev/null +++ b/docs/reference/type-aliases/TransactionWithMutations.md @@ -0,0 +1,51 @@ +--- +id: TransactionWithMutations +title: TransactionWithMutations +--- + +# Type Alias: TransactionWithMutations\ + +```ts +type TransactionWithMutations = Omit, "mutations"> & object; +``` + +Defined in: packages/db/src/types.ts:140 + +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>; +``` + +We must omit the `mutations` property from `Transaction` before intersecting +because TypeScript intersects property types when the same property appears on +both sides of an intersection. + +Without `Omit`: +- `Transaction` has `mutations: Array>` +- The intersection would create: `Array> & NonEmptyArray>` +- When mapping over this array, TypeScript widens `TOperation` from the specific literal + (e.g., `"delete"`) to the union `OperationType` (`"insert" | "update" | "delete"`) +- This causes `PendingMutation` to evaluate the conditional type + `original: TOperation extends 'insert' ? {} : T` as `{} | T` instead of just `T` + +With `Omit`: +- We remove `mutations` from `Transaction` first +- Then add back `mutations: NonEmptyArray>` +- TypeScript can properly narrow `TOperation` to the specific literal type +- This ensures `mutation.original` is correctly typed as `T` (not `{} | T`) when mapping + +## 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/UnloadSubsetFn.md b/docs/reference/type-aliases/UnloadSubsetFn.md new file mode 100644 index 000000000..ee3adaa12 --- /dev/null +++ b/docs/reference/type-aliases/UnloadSubsetFn.md @@ -0,0 +1,22 @@ +--- +id: UnloadSubsetFn +title: UnloadSubsetFn +--- + +# Type Alias: UnloadSubsetFn() + +```ts +type UnloadSubsetFn = (options) => void; +``` + +Defined in: packages/db/src/types.ts:316 + +## Parameters + +### options + +[`LoadSubsetOptions`](LoadSubsetOptions.md) + +## Returns + +`void` diff --git a/docs/reference/type-aliases/UpdateMutationFn.md b/docs/reference/type-aliases/UpdateMutationFn.md new file mode 100644 index 000000000..0a4ea243f --- /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:456 + +## 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..df76236d7 --- /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:423 + +## 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:429 + +*** + +### transaction + +```ts +transaction: TransactionWithMutations; +``` + +Defined in: packages/db/src/types.ts:428 diff --git a/docs/reference/type-aliases/UtilsRecord.md b/docs/reference/type-aliases/UtilsRecord.md new file mode 100644 index 000000000..eeb1f85b0 --- /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:72 + +A record of utilities (functions or getters) that can be attached to a collection diff --git a/docs/reference/type-aliases/WhereCallback.md b/docs/reference/type-aliases/WhereCallback.md new file mode 100644 index 000000000..842a03061 --- /dev/null +++ b/docs/reference/type-aliases/WhereCallback.md @@ -0,0 +1,36 @@ +--- +id: WhereCallback +title: WhereCallback +--- + +# Type Alias: WhereCallback()\ + +```ts +type WhereCallback = (refs) => any; +``` + +Defined in: packages/db/src/query/builder/types.ts:123 + +WhereCallback - Type for where/having clause callback functions + +These callbacks receive a `refs` object containing RefProxy instances for +all available tables. The callback should return a boolean expression +that will be used to filter query results. + +Example: `(refs) => eq(refs.users.age, 25)` + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +## Parameters + +### refs + +[`RefsForContext`](RefsForContext.md)\<`TContext`\> + +## Returns + +`any` diff --git a/docs/reference/type-aliases/WithResult.md b/docs/reference/type-aliases/WithResult.md new file mode 100644 index 000000000..0414998c3 --- /dev/null +++ b/docs/reference/type-aliases/WithResult.md @@ -0,0 +1,35 @@ +--- +id: WithResult +title: WithResult +--- + +# Type Alias: WithResult\ + +```ts +type WithResult = Prettify & object>; +``` + +Defined in: packages/db/src/query/builder/types.ts:836 + +WithResult - Updates a context with a new result type after select() + +This utility type is used internally when the `select()` method is called +to update the context with the projected result type. It preserves all +other context properties while replacing the `result` field. + +**Usage**: +When `select()` is called, the query builder uses this type to create +a new context where `result` contains the shape of the selected fields. + +The double `Prettify` ensures both the overall context and the nested +result type display cleanly in IDEs. + +## Type Parameters + +### TContext + +`TContext` *extends* [`Context`](../interfaces/Context.md) + +### TResult + +`TResult` diff --git a/docs/reference/type-aliases/WritableDeep.md b/docs/reference/type-aliases/WritableDeep.md new file mode 100644 index 000000000..23d425e05 --- /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:939 + +## Type Parameters + +### T + +`T` diff --git a/docs/reference/variables/IndexOperation.md b/docs/reference/variables/IndexOperation.md new file mode 100644 index 000000000..4c805dcd5 --- /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 + +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..5f7f010a6 --- /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:897 diff --git a/docs/reference/variables/operators.md b/docs/reference/variables/operators.md new file mode 100644 index 000000000..94f2a7fe6 --- /dev/null +++ b/docs/reference/variables/operators.md @@ -0,0 +1,14 @@ +--- +id: operators +title: operators +--- + +# Variable: operators + +```ts +const operators: readonly ["eq", "gt", "gte", "lt", "lte", "in", "like", "ilike", "and", "or", "not", "isNull", "isUndefined", "upper", "lower", "length", "concat", "add", "coalesce", "count", "avg", "sum", "min", "max"]; +``` + +Defined in: packages/db/src/query/builder/functions.ts:344 + +All supported operator names in TanStack DB expressions diff --git a/packages/db/tsconfig.docs.json b/packages/db/tsconfig.docs.json index 2880b4dfa..8f4e90ec2 100644 --- a/packages/db/tsconfig.docs.json +++ b/packages/db/tsconfig.docs.json @@ -1,4 +1,10 @@ { "extends": "./tsconfig.json", - "include": ["tests", "src"] + "compilerOptions": { + "paths": { + "@tanstack/store": ["../store/src"], + "@tanstack/db-ivm": ["../db-ivm/src"] + } + }, + "include": ["src"] }