@trylight/app 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -22
- package/dist/auth/config.d.ts +5 -0
- package/dist/auth/config.js +16 -0
- package/dist/auth/context.d.ts +11 -0
- package/dist/auth/context.js +1 -0
- package/dist/auth/core.d.ts +64 -0
- package/dist/auth/core.js +50 -0
- package/dist/auth/db.d.ts +7 -0
- package/dist/auth/db.js +57 -0
- package/dist/auth/lookup.d.ts +47 -0
- package/dist/auth/lookup.js +120 -0
- package/dist/auth/mode.d.ts +8 -0
- package/dist/auth/mode.js +52 -0
- package/dist/auth/next-path.d.ts +1 -0
- package/dist/auth/next-path.js +10 -0
- package/dist/auth/plaza.d.ts +68 -0
- package/dist/auth/plaza.js +154 -0
- package/dist/auth/problems.d.ts +4 -0
- package/dist/auth/problems.js +36 -0
- package/dist/auth/users.d.ts +8 -0
- package/dist/auth/users.js +25 -0
- package/dist/brand.generated.d.ts +2 -0
- package/dist/brand.generated.js +3 -0
- package/dist/chat/paths.d.ts +10 -0
- package/dist/chat/paths.js +10 -0
- package/dist/chat/server.d.ts +24 -0
- package/dist/chat/server.js +161 -0
- package/dist/client.d.ts +517 -19
- package/dist/client.js +244 -24
- package/dist/db/cli.js +3 -40
- package/dist/db/migrations.d.ts +2 -2
- package/dist/db/migrations.js +2 -2
- package/dist/entities.d.ts +3 -1
- package/dist/entities.js +1 -1
- package/dist/invoke/contracts.d.ts +28 -0
- package/dist/invoke/contracts.js +1 -0
- package/dist/invoke/error.d.ts +11 -0
- package/dist/invoke/error.js +13 -0
- package/dist/invoke/index.d.ts +73 -0
- package/dist/invoke/index.js +274 -0
- package/dist/invoke/paths.d.ts +2 -0
- package/dist/invoke/paths.js +2 -0
- package/dist/invoke/server.d.ts +45 -0
- package/dist/invoke/server.js +259 -0
- package/dist/platform/index.d.ts +71 -0
- package/dist/platform/index.js +80 -0
- package/dist/platform/pane-bridge.d.ts +1 -0
- package/dist/platform/pane-bridge.js +216 -0
- package/dist/platform/server-fn-door.d.ts +27 -0
- package/dist/platform/server-fn-door.js +32 -0
- package/dist/platform.d.ts +2 -2
- package/dist/platform.js +3 -3
- package/dist/request-error.d.ts +10 -0
- package/dist/request-error.js +29 -0
- package/dist/schema.d.ts +1 -1
- package/dist/server/db-retry.d.ts +7 -0
- package/dist/server/db-retry.js +58 -0
- package/dist/server/entities.js +18 -3
- package/dist/server/health.d.ts +17 -0
- package/dist/server/health.js +42 -0
- package/dist/server/index.d.ts +7 -6
- package/dist/server/index.js +7 -6
- package/dist/server/sentry-tunnel.d.ts +6 -0
- package/dist/server/sentry-tunnel.js +52 -0
- package/dist/server/session.d.ts +1 -1
- package/dist/server/session.js +2 -2
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +7 -0
- package/package.json +4 -4
- package/dist/db/baseline.d.ts +0 -36
- package/dist/db/baseline.js +0 -439
package/dist/client.d.ts
CHANGED
|
@@ -1,14 +1,67 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import type { Contracts } from "./invoke/server.js";
|
|
2
3
|
import { EntityError, type ListOptions, type NewRow, type Patch, type Row } from "./entities.js";
|
|
3
4
|
import type { Entity } from "./schema.js";
|
|
4
5
|
export { EntityError, LIST_LIMIT, type ListOptions, type NewRow, type Sort, type Patch, type Row, type Where } from "./entities.js";
|
|
5
6
|
export type { FieldSource, FieldSources } from "./schema.js";
|
|
6
7
|
export { siteOf } from "./schema.js";
|
|
7
8
|
export { imageSrc } from "./images.js";
|
|
8
|
-
export { InvocationError, type InvocationStatus } from "
|
|
9
|
+
export { InvocationError, type InvocationStatus } from "./invoke/index.js";
|
|
9
10
|
export declare function createApp<C extends Contracts = Record<never, never>>(): {
|
|
10
11
|
table: typeof tableClient;
|
|
11
|
-
contracts: import("
|
|
12
|
+
contracts: import("./invoke/index.js").Invoker<C>;
|
|
13
|
+
};
|
|
14
|
+
/** Rows one page of `useInfiniteList` asks for; scrolling near the end asks for the next. */
|
|
15
|
+
export declare const PAGE_SIZE = 100;
|
|
16
|
+
/** A column, and which way: what a table header sorts by. */
|
|
17
|
+
export type Sorting = {
|
|
18
|
+
column: string;
|
|
19
|
+
desc: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** What `useInfiniteList` takes: a list's options, less the paging it does itself. */
|
|
22
|
+
export type PageOptions<R> = Omit<ListOptions<R>, "limit" | "offset"> & {
|
|
23
|
+
/** Rows per page; PAGE_SIZE unless a page needs fewer or more. */
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A list as a table draws it (DataTable's `list`): its rows, whether more
|
|
28
|
+
* exist, and how to get them. `useList` and `useInfiniteList` both give one.
|
|
29
|
+
*/
|
|
30
|
+
export type ListView<R> = {
|
|
31
|
+
rows: R[];
|
|
32
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
33
|
+
isPending: boolean;
|
|
34
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
35
|
+
loadError: Error | null;
|
|
36
|
+
refetch: () => unknown;
|
|
37
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
38
|
+
hasMore: boolean;
|
|
39
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
40
|
+
loadMore: (() => void) | null;
|
|
41
|
+
isLoadingMore: boolean;
|
|
42
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
43
|
+
moreFailed: boolean;
|
|
44
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
45
|
+
isSwitching: boolean;
|
|
46
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
47
|
+
serverSort: {
|
|
48
|
+
sorting: Sorting | null;
|
|
49
|
+
setSorting: (next: Sorting | null) => void;
|
|
50
|
+
canSort: (column: string) => boolean;
|
|
51
|
+
} | null;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Where one row sat in a cached query before a write: its value, page and
|
|
55
|
+
* place, to put it back if the write fails. `fields` are the ones the write
|
|
56
|
+
* changed (an update's patch), so a failure takes back only those and never
|
|
57
|
+
* another save's change to the same row; null (a delete) is the whole row.
|
|
58
|
+
*/
|
|
59
|
+
type Before = {
|
|
60
|
+
key: QueryKey;
|
|
61
|
+
page: number;
|
|
62
|
+
index: number;
|
|
63
|
+
row: unknown;
|
|
64
|
+
fields: string[] | null;
|
|
12
65
|
};
|
|
13
66
|
/** One entity table's rows: plain calls, and TanStack Query hooks over them. */
|
|
14
67
|
declare function tableClient<T extends Entity>(entity: T): {
|
|
@@ -31,10 +84,29 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
31
84
|
*/
|
|
32
85
|
useList: (options?: ListOptions<Row<T>>) => {
|
|
33
86
|
rows: (T["$inferSelect"] extends infer T_1 ? { [K in keyof T_1]: Date extends T_1[K] ? string | Exclude<T_1[K], T_1[K] & Date> : T_1[K]; } : never)[];
|
|
87
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
88
|
+
isPending: boolean;
|
|
89
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
90
|
+
loadError: Error | null;
|
|
91
|
+
refetch: () => unknown;
|
|
92
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
93
|
+
hasMore: boolean;
|
|
94
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
95
|
+
loadMore: (() => void) | null;
|
|
96
|
+
isLoadingMore: boolean;
|
|
97
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
98
|
+
moreFailed: boolean;
|
|
99
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
100
|
+
isSwitching: boolean;
|
|
101
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
102
|
+
serverSort: {
|
|
103
|
+
sorting: Sorting | null;
|
|
104
|
+
setSorting: (next: Sorting | null) => void;
|
|
105
|
+
canSort: (column: string) => boolean;
|
|
106
|
+
} | null;
|
|
34
107
|
data: (T["$inferSelect"] extends infer T_2 ? { [K in keyof T_2]: Date extends T_2[K] ? string | Exclude<T_2[K], T_2[K] & Date> : T_2[K]; } : never)[];
|
|
35
108
|
error: EntityError;
|
|
36
109
|
isError: true;
|
|
37
|
-
isPending: false;
|
|
38
110
|
isLoading: false;
|
|
39
111
|
isLoadingError: false;
|
|
40
112
|
isRefetchError: true;
|
|
@@ -54,14 +126,32 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
54
126
|
isRefetching: boolean;
|
|
55
127
|
isStale: boolean;
|
|
56
128
|
isEnabled: boolean;
|
|
57
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<(T["$inferSelect"] extends infer T_3 ? { [K in keyof T_3]: Date extends T_3[K] ? string | Exclude<T_3[K], T_3[K] & Date> : T_3[K]; } : never)[], EntityError>>;
|
|
58
129
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
59
130
|
} | {
|
|
60
131
|
rows: (T["$inferSelect"] extends infer T_3 ? { [K in keyof T_3]: Date extends T_3[K] ? string | Exclude<T_3[K], T_3[K] & Date> : T_3[K]; } : never)[];
|
|
132
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
133
|
+
isPending: boolean;
|
|
134
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
135
|
+
loadError: Error | null;
|
|
136
|
+
refetch: () => unknown;
|
|
137
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
138
|
+
hasMore: boolean;
|
|
139
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
140
|
+
loadMore: (() => void) | null;
|
|
141
|
+
isLoadingMore: boolean;
|
|
142
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
143
|
+
moreFailed: boolean;
|
|
144
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
145
|
+
isSwitching: boolean;
|
|
146
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
147
|
+
serverSort: {
|
|
148
|
+
sorting: Sorting | null;
|
|
149
|
+
setSorting: (next: Sorting | null) => void;
|
|
150
|
+
canSort: (column: string) => boolean;
|
|
151
|
+
} | null;
|
|
61
152
|
data: (T["$inferSelect"] extends infer T_4 ? { [K in keyof T_4]: Date extends T_4[K] ? string | Exclude<T_4[K], T_4[K] & Date> : T_4[K]; } : never)[];
|
|
62
153
|
error: null;
|
|
63
154
|
isError: false;
|
|
64
|
-
isPending: false;
|
|
65
155
|
isLoading: false;
|
|
66
156
|
isLoadingError: false;
|
|
67
157
|
isRefetchError: false;
|
|
@@ -81,14 +171,32 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
81
171
|
isRefetching: boolean;
|
|
82
172
|
isStale: boolean;
|
|
83
173
|
isEnabled: boolean;
|
|
84
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<(T["$inferSelect"] extends infer T_5 ? { [K in keyof T_5]: Date extends T_5[K] ? string | Exclude<T_5[K], T_5[K] & Date> : T_5[K]; } : never)[], EntityError>>;
|
|
85
174
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
86
175
|
} | {
|
|
87
176
|
rows: (T["$inferSelect"] extends infer T_5 ? { [K in keyof T_5]: Date extends T_5[K] ? string | Exclude<T_5[K], T_5[K] & Date> : T_5[K]; } : never)[];
|
|
177
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
178
|
+
isPending: boolean;
|
|
179
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
180
|
+
loadError: Error | null;
|
|
181
|
+
refetch: () => unknown;
|
|
182
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
183
|
+
hasMore: boolean;
|
|
184
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
185
|
+
loadMore: (() => void) | null;
|
|
186
|
+
isLoadingMore: boolean;
|
|
187
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
188
|
+
moreFailed: boolean;
|
|
189
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
190
|
+
isSwitching: boolean;
|
|
191
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
192
|
+
serverSort: {
|
|
193
|
+
sorting: Sorting | null;
|
|
194
|
+
setSorting: (next: Sorting | null) => void;
|
|
195
|
+
canSort: (column: string) => boolean;
|
|
196
|
+
} | null;
|
|
88
197
|
data: undefined;
|
|
89
198
|
error: EntityError;
|
|
90
199
|
isError: true;
|
|
91
|
-
isPending: false;
|
|
92
200
|
isLoading: false;
|
|
93
201
|
isLoadingError: true;
|
|
94
202
|
isRefetchError: false;
|
|
@@ -108,14 +216,32 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
108
216
|
isRefetching: boolean;
|
|
109
217
|
isStale: boolean;
|
|
110
218
|
isEnabled: boolean;
|
|
111
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<(T["$inferSelect"] extends infer T_6 ? { [K in keyof T_6]: Date extends T_6[K] ? string | Exclude<T_6[K], T_6[K] & Date> : T_6[K]; } : never)[], EntityError>>;
|
|
112
219
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
113
220
|
} | {
|
|
114
221
|
rows: (T["$inferSelect"] extends infer T_6 ? { [K in keyof T_6]: Date extends T_6[K] ? string | Exclude<T_6[K], T_6[K] & Date> : T_6[K]; } : never)[];
|
|
222
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
223
|
+
isPending: boolean;
|
|
224
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
225
|
+
loadError: Error | null;
|
|
226
|
+
refetch: () => unknown;
|
|
227
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
228
|
+
hasMore: boolean;
|
|
229
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
230
|
+
loadMore: (() => void) | null;
|
|
231
|
+
isLoadingMore: boolean;
|
|
232
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
233
|
+
moreFailed: boolean;
|
|
234
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
235
|
+
isSwitching: boolean;
|
|
236
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
237
|
+
serverSort: {
|
|
238
|
+
sorting: Sorting | null;
|
|
239
|
+
setSorting: (next: Sorting | null) => void;
|
|
240
|
+
canSort: (column: string) => boolean;
|
|
241
|
+
} | null;
|
|
115
242
|
data: undefined;
|
|
116
243
|
error: null;
|
|
117
244
|
isError: false;
|
|
118
|
-
isPending: true;
|
|
119
245
|
isLoading: true;
|
|
120
246
|
isLoadingError: false;
|
|
121
247
|
isRefetchError: false;
|
|
@@ -135,14 +261,32 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
135
261
|
isRefetching: boolean;
|
|
136
262
|
isStale: boolean;
|
|
137
263
|
isEnabled: boolean;
|
|
138
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<(T["$inferSelect"] extends infer T_7 ? { [K in keyof T_7]: Date extends T_7[K] ? string | Exclude<T_7[K], T_7[K] & Date> : T_7[K]; } : never)[], EntityError>>;
|
|
139
264
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
140
265
|
} | {
|
|
141
266
|
rows: (T["$inferSelect"] extends infer T_7 ? { [K in keyof T_7]: Date extends T_7[K] ? string | Exclude<T_7[K], T_7[K] & Date> : T_7[K]; } : never)[];
|
|
267
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
268
|
+
isPending: boolean;
|
|
269
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
270
|
+
loadError: Error | null;
|
|
271
|
+
refetch: () => unknown;
|
|
272
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
273
|
+
hasMore: boolean;
|
|
274
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
275
|
+
loadMore: (() => void) | null;
|
|
276
|
+
isLoadingMore: boolean;
|
|
277
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
278
|
+
moreFailed: boolean;
|
|
279
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
280
|
+
isSwitching: boolean;
|
|
281
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
282
|
+
serverSort: {
|
|
283
|
+
sorting: Sorting | null;
|
|
284
|
+
setSorting: (next: Sorting | null) => void;
|
|
285
|
+
canSort: (column: string) => boolean;
|
|
286
|
+
} | null;
|
|
142
287
|
data: undefined;
|
|
143
288
|
error: null;
|
|
144
289
|
isError: false;
|
|
145
|
-
isPending: true;
|
|
146
290
|
isLoadingError: false;
|
|
147
291
|
isRefetchError: false;
|
|
148
292
|
isSuccess: false;
|
|
@@ -162,14 +306,32 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
162
306
|
isRefetching: boolean;
|
|
163
307
|
isStale: boolean;
|
|
164
308
|
isEnabled: boolean;
|
|
165
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<(T["$inferSelect"] extends infer T_8 ? { [K in keyof T_8]: Date extends T_8[K] ? string | Exclude<T_8[K], T_8[K] & Date> : T_8[K]; } : never)[], EntityError>>;
|
|
166
309
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
167
310
|
} | {
|
|
168
311
|
rows: (T["$inferSelect"] extends infer T_8 ? { [K in keyof T_8]: Date extends T_8[K] ? string | Exclude<T_8[K], T_8[K] & Date> : T_8[K]; } : never)[];
|
|
312
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
313
|
+
isPending: boolean;
|
|
314
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
315
|
+
loadError: Error | null;
|
|
316
|
+
refetch: () => unknown;
|
|
317
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
318
|
+
hasMore: boolean;
|
|
319
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
320
|
+
loadMore: (() => void) | null;
|
|
321
|
+
isLoadingMore: boolean;
|
|
322
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
323
|
+
moreFailed: boolean;
|
|
324
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
325
|
+
isSwitching: boolean;
|
|
326
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
327
|
+
serverSort: {
|
|
328
|
+
sorting: Sorting | null;
|
|
329
|
+
setSorting: (next: Sorting | null) => void;
|
|
330
|
+
canSort: (column: string) => boolean;
|
|
331
|
+
} | null;
|
|
169
332
|
data: (T["$inferSelect"] extends infer T_9 ? { [K in keyof T_9]: Date extends T_9[K] ? string | Exclude<T_9[K], T_9[K] & Date> : T_9[K]; } : never)[];
|
|
170
333
|
isError: false;
|
|
171
334
|
error: null;
|
|
172
|
-
isPending: false;
|
|
173
335
|
isLoading: false;
|
|
174
336
|
isLoadingError: false;
|
|
175
337
|
isRefetchError: false;
|
|
@@ -189,19 +351,355 @@ declare function tableClient<T extends Entity>(entity: T): {
|
|
|
189
351
|
isRefetching: boolean;
|
|
190
352
|
isStale: boolean;
|
|
191
353
|
isEnabled: boolean;
|
|
192
|
-
|
|
354
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* A list of any size, a page at a time: `loadMore` (DataTable calls it as
|
|
358
|
+
* the end scrolls into view) fetches the next. New options (a tab, a
|
|
359
|
+
* filter, a search) keep the last rows on screen with `isSwitching` until
|
|
360
|
+
* theirs land, so a click never blanks the table. `prefetch` names the
|
|
361
|
+
* sibling views (the other tabs): their first pages load once this one
|
|
362
|
+
* settles, so switching to one is instant. Sorting is the server's, over
|
|
363
|
+
* every row; `sort` is where it starts.
|
|
364
|
+
*
|
|
365
|
+
* const list = app.table(leads).useInfiniteList({ where: { status: tab } }, { prefetch: TABS.map((t) => ({ where: { status: t } })) });
|
|
366
|
+
* <DataTable list={list} … />
|
|
367
|
+
*/
|
|
368
|
+
useInfiniteList: (options?: PageOptions<Row<T>>, { prefetch }?: {
|
|
369
|
+
prefetch?: PageOptions<Row<T>>[];
|
|
370
|
+
}) => {
|
|
371
|
+
rows: (T["$inferSelect"] extends infer T_1 ? { [K in keyof T_1]: Date extends T_1[K] ? string | Exclude<T_1[K], T_1[K] & Date> : T_1[K]; } : never)[];
|
|
372
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
373
|
+
isPending: boolean;
|
|
374
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
375
|
+
loadError: Error | null;
|
|
376
|
+
refetch: () => unknown;
|
|
377
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
378
|
+
hasMore: boolean;
|
|
379
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
380
|
+
loadMore: (() => void) | null;
|
|
381
|
+
isLoadingMore: boolean;
|
|
382
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
383
|
+
moreFailed: boolean;
|
|
384
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
385
|
+
isSwitching: boolean;
|
|
386
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
387
|
+
serverSort: {
|
|
388
|
+
sorting: Sorting | null;
|
|
389
|
+
setSorting: (next: Sorting | null) => void;
|
|
390
|
+
canSort: (column: string) => boolean;
|
|
391
|
+
} | null;
|
|
392
|
+
data: import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_2 ? { [K in keyof T_2]: Date extends T_2[K] ? string | Exclude<T_2[K], T_2[K] & Date> : T_2[K]; } : never)[], unknown>;
|
|
393
|
+
error: Error;
|
|
394
|
+
isError: true;
|
|
395
|
+
isLoading: false;
|
|
396
|
+
isLoadingError: false;
|
|
397
|
+
isRefetchError: true;
|
|
398
|
+
isSuccess: false;
|
|
399
|
+
isPlaceholderData: false;
|
|
400
|
+
status: "error";
|
|
401
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_3 ? { [K in keyof T_3]: Date extends T_3[K] ? string | Exclude<T_3[K], T_3[K] & Date> : T_3[K]; } : never)[], unknown>, Error>>;
|
|
402
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_3 ? { [K in keyof T_3]: Date extends T_3[K] ? string | Exclude<T_3[K], T_3[K] & Date> : T_3[K]; } : never)[], unknown>, Error>>;
|
|
403
|
+
hasNextPage: boolean;
|
|
404
|
+
hasPreviousPage: boolean;
|
|
405
|
+
isFetchNextPageError: boolean;
|
|
406
|
+
isFetchingNextPage: boolean;
|
|
407
|
+
isFetchPreviousPageError: boolean;
|
|
408
|
+
isFetchingPreviousPage: boolean;
|
|
409
|
+
dataUpdatedAt: number;
|
|
410
|
+
errorUpdatedAt: number;
|
|
411
|
+
failureCount: number;
|
|
412
|
+
failureReason: Error | null;
|
|
413
|
+
errorUpdateCount: number;
|
|
414
|
+
isFetched: boolean;
|
|
415
|
+
isFetchedAfterMount: boolean;
|
|
416
|
+
isFetching: boolean;
|
|
417
|
+
isInitialLoading: boolean;
|
|
418
|
+
isPaused: boolean;
|
|
419
|
+
isRefetching: boolean;
|
|
420
|
+
isStale: boolean;
|
|
421
|
+
isEnabled: boolean;
|
|
422
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
423
|
+
} | {
|
|
424
|
+
rows: (T["$inferSelect"] extends infer T_3 ? { [K in keyof T_3]: Date extends T_3[K] ? string | Exclude<T_3[K], T_3[K] & Date> : T_3[K]; } : never)[];
|
|
425
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
426
|
+
isPending: boolean;
|
|
427
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
428
|
+
loadError: Error | null;
|
|
429
|
+
refetch: () => unknown;
|
|
430
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
431
|
+
hasMore: boolean;
|
|
432
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
433
|
+
loadMore: (() => void) | null;
|
|
434
|
+
isLoadingMore: boolean;
|
|
435
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
436
|
+
moreFailed: boolean;
|
|
437
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
438
|
+
isSwitching: boolean;
|
|
439
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
440
|
+
serverSort: {
|
|
441
|
+
sorting: Sorting | null;
|
|
442
|
+
setSorting: (next: Sorting | null) => void;
|
|
443
|
+
canSort: (column: string) => boolean;
|
|
444
|
+
} | null;
|
|
445
|
+
data: import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_4 ? { [K in keyof T_4]: Date extends T_4[K] ? string | Exclude<T_4[K], T_4[K] & Date> : T_4[K]; } : never)[], unknown>;
|
|
446
|
+
error: null;
|
|
447
|
+
isError: false;
|
|
448
|
+
isLoading: false;
|
|
449
|
+
isLoadingError: false;
|
|
450
|
+
isRefetchError: false;
|
|
451
|
+
isFetchNextPageError: false;
|
|
452
|
+
isFetchPreviousPageError: false;
|
|
453
|
+
isSuccess: true;
|
|
454
|
+
isPlaceholderData: false;
|
|
455
|
+
status: "success";
|
|
456
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_5 ? { [K in keyof T_5]: Date extends T_5[K] ? string | Exclude<T_5[K], T_5[K] & Date> : T_5[K]; } : never)[], unknown>, Error>>;
|
|
457
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_5 ? { [K in keyof T_5]: Date extends T_5[K] ? string | Exclude<T_5[K], T_5[K] & Date> : T_5[K]; } : never)[], unknown>, Error>>;
|
|
458
|
+
hasNextPage: boolean;
|
|
459
|
+
hasPreviousPage: boolean;
|
|
460
|
+
isFetchingNextPage: boolean;
|
|
461
|
+
isFetchingPreviousPage: boolean;
|
|
462
|
+
dataUpdatedAt: number;
|
|
463
|
+
errorUpdatedAt: number;
|
|
464
|
+
failureCount: number;
|
|
465
|
+
failureReason: Error | null;
|
|
466
|
+
errorUpdateCount: number;
|
|
467
|
+
isFetched: boolean;
|
|
468
|
+
isFetchedAfterMount: boolean;
|
|
469
|
+
isFetching: boolean;
|
|
470
|
+
isInitialLoading: boolean;
|
|
471
|
+
isPaused: boolean;
|
|
472
|
+
isRefetching: boolean;
|
|
473
|
+
isStale: boolean;
|
|
474
|
+
isEnabled: boolean;
|
|
475
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
476
|
+
} | {
|
|
477
|
+
rows: (T["$inferSelect"] extends infer T_5 ? { [K in keyof T_5]: Date extends T_5[K] ? string | Exclude<T_5[K], T_5[K] & Date> : T_5[K]; } : never)[];
|
|
478
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
479
|
+
isPending: boolean;
|
|
480
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
481
|
+
loadError: Error | null;
|
|
482
|
+
refetch: () => unknown;
|
|
483
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
484
|
+
hasMore: boolean;
|
|
485
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
486
|
+
loadMore: (() => void) | null;
|
|
487
|
+
isLoadingMore: boolean;
|
|
488
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
489
|
+
moreFailed: boolean;
|
|
490
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
491
|
+
isSwitching: boolean;
|
|
492
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
493
|
+
serverSort: {
|
|
494
|
+
sorting: Sorting | null;
|
|
495
|
+
setSorting: (next: Sorting | null) => void;
|
|
496
|
+
canSort: (column: string) => boolean;
|
|
497
|
+
} | null;
|
|
498
|
+
data: undefined;
|
|
499
|
+
error: Error;
|
|
500
|
+
isError: true;
|
|
501
|
+
isLoading: false;
|
|
502
|
+
isLoadingError: true;
|
|
503
|
+
isRefetchError: false;
|
|
504
|
+
isFetchNextPageError: false;
|
|
505
|
+
isFetchPreviousPageError: false;
|
|
506
|
+
isSuccess: false;
|
|
507
|
+
isPlaceholderData: false;
|
|
508
|
+
status: "error";
|
|
509
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_6 ? { [K in keyof T_6]: Date extends T_6[K] ? string | Exclude<T_6[K], T_6[K] & Date> : T_6[K]; } : never)[], unknown>, Error>>;
|
|
510
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_6 ? { [K in keyof T_6]: Date extends T_6[K] ? string | Exclude<T_6[K], T_6[K] & Date> : T_6[K]; } : never)[], unknown>, Error>>;
|
|
511
|
+
hasNextPage: boolean;
|
|
512
|
+
hasPreviousPage: boolean;
|
|
513
|
+
isFetchingNextPage: boolean;
|
|
514
|
+
isFetchingPreviousPage: boolean;
|
|
515
|
+
dataUpdatedAt: number;
|
|
516
|
+
errorUpdatedAt: number;
|
|
517
|
+
failureCount: number;
|
|
518
|
+
failureReason: Error | null;
|
|
519
|
+
errorUpdateCount: number;
|
|
520
|
+
isFetched: boolean;
|
|
521
|
+
isFetchedAfterMount: boolean;
|
|
522
|
+
isFetching: boolean;
|
|
523
|
+
isInitialLoading: boolean;
|
|
524
|
+
isPaused: boolean;
|
|
525
|
+
isRefetching: boolean;
|
|
526
|
+
isStale: boolean;
|
|
527
|
+
isEnabled: boolean;
|
|
528
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
529
|
+
} | {
|
|
530
|
+
rows: (T["$inferSelect"] extends infer T_6 ? { [K in keyof T_6]: Date extends T_6[K] ? string | Exclude<T_6[K], T_6[K] & Date> : T_6[K]; } : never)[];
|
|
531
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
532
|
+
isPending: boolean;
|
|
533
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
534
|
+
loadError: Error | null;
|
|
535
|
+
refetch: () => unknown;
|
|
536
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
537
|
+
hasMore: boolean;
|
|
538
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
539
|
+
loadMore: (() => void) | null;
|
|
540
|
+
isLoadingMore: boolean;
|
|
541
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
542
|
+
moreFailed: boolean;
|
|
543
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
544
|
+
isSwitching: boolean;
|
|
545
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
546
|
+
serverSort: {
|
|
547
|
+
sorting: Sorting | null;
|
|
548
|
+
setSorting: (next: Sorting | null) => void;
|
|
549
|
+
canSort: (column: string) => boolean;
|
|
550
|
+
} | null;
|
|
551
|
+
data: undefined;
|
|
552
|
+
error: null;
|
|
553
|
+
isError: false;
|
|
554
|
+
isLoading: true;
|
|
555
|
+
isLoadingError: false;
|
|
556
|
+
isRefetchError: false;
|
|
557
|
+
isFetchNextPageError: false;
|
|
558
|
+
isFetchPreviousPageError: false;
|
|
559
|
+
isSuccess: false;
|
|
560
|
+
isPlaceholderData: false;
|
|
561
|
+
status: "pending";
|
|
562
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_7 ? { [K in keyof T_7]: Date extends T_7[K] ? string | Exclude<T_7[K], T_7[K] & Date> : T_7[K]; } : never)[], unknown>, Error>>;
|
|
563
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_7 ? { [K in keyof T_7]: Date extends T_7[K] ? string | Exclude<T_7[K], T_7[K] & Date> : T_7[K]; } : never)[], unknown>, Error>>;
|
|
564
|
+
hasNextPage: boolean;
|
|
565
|
+
hasPreviousPage: boolean;
|
|
566
|
+
isFetchingNextPage: boolean;
|
|
567
|
+
isFetchingPreviousPage: boolean;
|
|
568
|
+
dataUpdatedAt: number;
|
|
569
|
+
errorUpdatedAt: number;
|
|
570
|
+
failureCount: number;
|
|
571
|
+
failureReason: Error | null;
|
|
572
|
+
errorUpdateCount: number;
|
|
573
|
+
isFetched: boolean;
|
|
574
|
+
isFetchedAfterMount: boolean;
|
|
575
|
+
isFetching: boolean;
|
|
576
|
+
isInitialLoading: boolean;
|
|
577
|
+
isPaused: boolean;
|
|
578
|
+
isRefetching: boolean;
|
|
579
|
+
isStale: boolean;
|
|
580
|
+
isEnabled: boolean;
|
|
581
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
582
|
+
} | {
|
|
583
|
+
rows: (T["$inferSelect"] extends infer T_7 ? { [K in keyof T_7]: Date extends T_7[K] ? string | Exclude<T_7[K], T_7[K] & Date> : T_7[K]; } : never)[];
|
|
584
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
585
|
+
isPending: boolean;
|
|
586
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
587
|
+
loadError: Error | null;
|
|
588
|
+
refetch: () => unknown;
|
|
589
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
590
|
+
hasMore: boolean;
|
|
591
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
592
|
+
loadMore: (() => void) | null;
|
|
593
|
+
isLoadingMore: boolean;
|
|
594
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
595
|
+
moreFailed: boolean;
|
|
596
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
597
|
+
isSwitching: boolean;
|
|
598
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
599
|
+
serverSort: {
|
|
600
|
+
sorting: Sorting | null;
|
|
601
|
+
setSorting: (next: Sorting | null) => void;
|
|
602
|
+
canSort: (column: string) => boolean;
|
|
603
|
+
} | null;
|
|
604
|
+
data: undefined;
|
|
605
|
+
error: null;
|
|
606
|
+
isError: false;
|
|
607
|
+
isLoadingError: false;
|
|
608
|
+
isRefetchError: false;
|
|
609
|
+
isFetchNextPageError: false;
|
|
610
|
+
isFetchPreviousPageError: false;
|
|
611
|
+
isSuccess: false;
|
|
612
|
+
isPlaceholderData: false;
|
|
613
|
+
status: "pending";
|
|
614
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_8 ? { [K in keyof T_8]: Date extends T_8[K] ? string | Exclude<T_8[K], T_8[K] & Date> : T_8[K]; } : never)[], unknown>, Error>>;
|
|
615
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_8 ? { [K in keyof T_8]: Date extends T_8[K] ? string | Exclude<T_8[K], T_8[K] & Date> : T_8[K]; } : never)[], unknown>, Error>>;
|
|
616
|
+
hasNextPage: boolean;
|
|
617
|
+
hasPreviousPage: boolean;
|
|
618
|
+
isFetchingNextPage: boolean;
|
|
619
|
+
isFetchingPreviousPage: boolean;
|
|
620
|
+
dataUpdatedAt: number;
|
|
621
|
+
errorUpdatedAt: number;
|
|
622
|
+
failureCount: number;
|
|
623
|
+
failureReason: Error | null;
|
|
624
|
+
errorUpdateCount: number;
|
|
625
|
+
isFetched: boolean;
|
|
626
|
+
isFetchedAfterMount: boolean;
|
|
627
|
+
isFetching: boolean;
|
|
628
|
+
isLoading: boolean;
|
|
629
|
+
isInitialLoading: boolean;
|
|
630
|
+
isPaused: boolean;
|
|
631
|
+
isRefetching: boolean;
|
|
632
|
+
isStale: boolean;
|
|
633
|
+
isEnabled: boolean;
|
|
634
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
635
|
+
} | {
|
|
636
|
+
rows: (T["$inferSelect"] extends infer T_8 ? { [K in keyof T_8]: Date extends T_8[K] ? string | Exclude<T_8[K], T_8[K] & Date> : T_8[K]; } : never)[];
|
|
637
|
+
/** Nothing to show yet: the first answer is on its way. */
|
|
638
|
+
isPending: boolean;
|
|
639
|
+
/** Why the first answer failed (a refetch that fails keeps the rows); `refetch` asks again. */
|
|
640
|
+
loadError: Error | null;
|
|
641
|
+
refetch: () => unknown;
|
|
642
|
+
/** More rows exist than are loaded (useList: it stopped at its limit). */
|
|
643
|
+
hasMore: boolean;
|
|
644
|
+
/** Loads the next page; null when this list can't (useList: raise the limit or page it). */
|
|
645
|
+
loadMore: (() => void) | null;
|
|
646
|
+
isLoadingMore: boolean;
|
|
647
|
+
/** The last page asked for failed: `loadMore` asks again, and nothing asks by itself until then. */
|
|
648
|
+
moreFailed: boolean;
|
|
649
|
+
/** Showing the last options' rows while the new options' load (a tab or filter just changed). */
|
|
650
|
+
isSwitching: boolean;
|
|
651
|
+
/** Sorted by the server, which sees every row; null when the table sorts what's loaded. */
|
|
652
|
+
serverSort: {
|
|
653
|
+
sorting: Sorting | null;
|
|
654
|
+
setSorting: (next: Sorting | null) => void;
|
|
655
|
+
canSort: (column: string) => boolean;
|
|
656
|
+
} | null;
|
|
657
|
+
data: import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_9 ? { [K in keyof T_9]: Date extends T_9[K] ? string | Exclude<T_9[K], T_9[K] & Date> : T_9[K]; } : never)[], unknown>;
|
|
658
|
+
isError: false;
|
|
659
|
+
error: null;
|
|
660
|
+
isLoading: false;
|
|
661
|
+
isLoadingError: false;
|
|
662
|
+
isRefetchError: false;
|
|
663
|
+
isSuccess: true;
|
|
664
|
+
isPlaceholderData: true;
|
|
665
|
+
isFetchNextPageError: false;
|
|
666
|
+
isFetchPreviousPageError: false;
|
|
667
|
+
status: "success";
|
|
668
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_10 ? { [K in keyof T_10]: Date extends T_10[K] ? string | Exclude<T_10[K], T_10[K] & Date> : T_10[K]; } : never)[], unknown>, Error>>;
|
|
669
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<(T["$inferSelect"] extends infer T_10 ? { [K in keyof T_10]: Date extends T_10[K] ? string | Exclude<T_10[K], T_10[K] & Date> : T_10[K]; } : never)[], unknown>, Error>>;
|
|
670
|
+
hasNextPage: boolean;
|
|
671
|
+
hasPreviousPage: boolean;
|
|
672
|
+
isFetchingNextPage: boolean;
|
|
673
|
+
isFetchingPreviousPage: boolean;
|
|
674
|
+
dataUpdatedAt: number;
|
|
675
|
+
errorUpdatedAt: number;
|
|
676
|
+
failureCount: number;
|
|
677
|
+
failureReason: Error | null;
|
|
678
|
+
errorUpdateCount: number;
|
|
679
|
+
isFetched: boolean;
|
|
680
|
+
isFetchedAfterMount: boolean;
|
|
681
|
+
isFetching: boolean;
|
|
682
|
+
isInitialLoading: boolean;
|
|
683
|
+
isPaused: boolean;
|
|
684
|
+
isRefetching: boolean;
|
|
685
|
+
isStale: boolean;
|
|
686
|
+
isEnabled: boolean;
|
|
193
687
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
194
688
|
};
|
|
195
689
|
/** One row; `null` waits (nothing open yet). */
|
|
196
690
|
useGet: (id: string | null) => import("@tanstack/react-query").UseQueryResult<T["$inferSelect"] extends infer T_1 ? { [K in keyof T_1]: Date extends T_1[K] ? string | Exclude<T_1[K], T_1[K] & Date> : T_1[K]; } : never, EntityError>;
|
|
197
691
|
useCreate: () => import("@tanstack/react-query").UseMutationResult<T["$inferSelect"] extends infer T_1 ? { [K in keyof T_1]: Date extends T_1[K] ? string | Exclude<T_1[K], T_1[K] & Date> : T_1[K]; } : never, EntityError, NewRow<T>, unknown>;
|
|
198
|
-
/**
|
|
692
|
+
/**
|
|
693
|
+
* Shows the patch at once in every cached list, page and row under the
|
|
694
|
+
* table's key; a save that fails takes it back at once (and the mutation's
|
|
695
|
+
* error says why), then the table refetches.
|
|
696
|
+
*/
|
|
199
697
|
useUpdate: () => import("@tanstack/react-query").UseMutationResult<T["$inferSelect"] extends infer T_1 ? { [K in keyof T_1]: Date extends T_1[K] ? string | Exclude<T_1[K], T_1[K] & Date> : T_1[K]; } : never, EntityError, {
|
|
200
698
|
id: string;
|
|
201
699
|
patch: Patch<T>;
|
|
202
|
-
},
|
|
203
|
-
/** Takes the row out of every cached list at once. */
|
|
204
|
-
useDelete: () => import("@tanstack/react-query").UseMutationResult<void, EntityError, string,
|
|
700
|
+
}, Before[]>;
|
|
701
|
+
/** Takes the row out of every cached list at once; a delete that fails puts it back. */
|
|
702
|
+
useDelete: () => import("@tanstack/react-query").UseMutationResult<void, EntityError, string, Before[]>;
|
|
205
703
|
};
|
|
206
704
|
export type TableClient<T extends Entity> = ReturnType<typeof tableClient<T>>;
|
|
207
705
|
/** To the login page, and back here after. */
|