@pol-studios/db 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZFM6AGWV.js → chunk-2T6WTCP4.js} +56 -27
- package/dist/chunk-2T6WTCP4.js.map +1 -0
- package/dist/{chunk-XOPORVJG.js → chunk-R5B2XMN5.js} +6 -8
- package/dist/chunk-R5B2XMN5.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.native.js +2 -2
- package/dist/index.web.js +1 -1
- package/package.json +1 -1
- package/dist/DataLayerContext-ZmLPYR_s.d.ts +0 -825
- package/dist/EntityPermissions-DwFt4tUd.d.ts +0 -35
- package/dist/FilterConfig-Bt2Ek74z.d.ts +0 -99
- package/dist/UserMetadataContext-B8gVWGMl.d.ts +0 -35
- package/dist/UserMetadataContext-DntmpK41.d.ts +0 -33
- package/dist/auth/context.d.ts +0 -48
- package/dist/auth/guards.d.ts +0 -180
- package/dist/auth/hooks.d.ts +0 -312
- package/dist/auth/index.d.ts +0 -11
- package/dist/chunk-XOPORVJG.js.map +0 -1
- package/dist/chunk-ZFM6AGWV.js.map +0 -1
- package/dist/client/index.d.ts +0 -16
- package/dist/core/index.d.ts +0 -539
- package/dist/database.types-ChFCG-4M.d.ts +0 -8604
- package/dist/executor-CB4KHyYG.d.ts +0 -507
- package/dist/gen/index.d.ts +0 -1099
- package/dist/hooks/index.d.ts +0 -100
- package/dist/index-BNKhgDdC.d.ts +0 -433
- package/dist/index.d.ts +0 -33
- package/dist/index.native.d.ts +0 -773
- package/dist/index.web.d.ts +0 -321
- package/dist/mutation/index.d.ts +0 -58
- package/dist/parser/index.d.ts +0 -366
- package/dist/powersync-bridge/index.d.ts +0 -284
- package/dist/query/index.d.ts +0 -723
- package/dist/realtime/index.d.ts +0 -44
- package/dist/select-query-parser-BwyHum1L.d.ts +0 -352
- package/dist/setupAuthContext-Kv-THH-h.d.ts +0 -61
- package/dist/types/index.d.ts +0 -10
- package/dist/types-CYr9JiUE.d.ts +0 -62
- package/dist/useBatchUpsert-9OYjibLh.d.ts +0 -24
- package/dist/useDbCount-Id14x_1P.d.ts +0 -1082
- package/dist/useDbQuery-C-TL8jY1.d.ts +0 -19
- package/dist/useReceiptAI-6HkRpRml.d.ts +0 -58
- package/dist/useResolveFeedback-Ca2rh_Bs.d.ts +0 -997
- package/dist/useSupabase-DvWVuHHE.d.ts +0 -28
- package/dist/with-auth/index.d.ts +0 -704
package/dist/query/index.d.ts
DELETED
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
import { ParsedSelect, SelectRelation } from '../core/index.js';
|
|
2
|
-
export { BuiltQuery, ColumnInfo, DatabaseSchema, OrderBy, QueryOptions, RelationshipInfo, RelationshipType, ResolvedRelationship, SelectColumn, TableSchema, WhereClause, WhereOperators } from '../core/index.js';
|
|
3
|
-
export { P as PowerSyncDatabase, Q as QueryExecutor, e as RelationJoinData, R as RelationshipResolver, b as ResultJoiner, S as SQLBuilder, f as createQueryExecutor, c as createRelationshipResolver, d as createResultJoiner, a as createSQLBuilder } from '../executor-CB4KHyYG.js';
|
|
4
|
-
import { PostgrestSingleResponse, PostgrestError } from '@supabase/supabase-js';
|
|
5
|
-
import { ItemType } from '@pol-studios/utils';
|
|
6
|
-
import { UseQuerySingleReturn as UseQuerySingleReturn$1 } from '@supabase-cache-helpers/postgrest-react-query';
|
|
7
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
8
|
-
import { UseQueryOptions, DefinedUseQueryResult, UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
|
|
9
|
-
import * as _supabase_postgrest_js from '@supabase/postgrest-js';
|
|
10
|
-
import * as react from 'react';
|
|
11
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
12
|
-
import { V as ValueForPropertyType, P as PropertyType, a as FilterConfig } from '../FilterConfig-Bt2Ek74z.js';
|
|
13
|
-
import { G as GenericTable, h as GenericView } from '../types-CYr9JiUE.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Select String Parser
|
|
17
|
-
*
|
|
18
|
-
* Parses Supabase PostgREST select syntax into an AST for local SQLite processing.
|
|
19
|
-
*
|
|
20
|
-
* Supported Syntax:
|
|
21
|
-
* - "*" -> All columns
|
|
22
|
-
* - "id, name, status" -> Specific columns
|
|
23
|
-
* - "*, RelatedTable(*)" -> All columns + relation
|
|
24
|
-
* - "id, RelatedTable(id, name)" -> Specific + relation with specific columns
|
|
25
|
-
* - "*, Parent(*, Grandparent(name))" -> Nested relations
|
|
26
|
-
* - "*, items:RelatedTable(*)" -> Aliased relation
|
|
27
|
-
* - "aliasName:columnName" -> Aliased column
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Tokenize a string at the top level, respecting parentheses nesting.
|
|
32
|
-
* Splits by comma but keeps nested parentheses intact.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* tokenizeTopLevel("id, name, Parent(*, Child(name))")
|
|
36
|
-
* // Returns: ["id", "name", "Parent(*, Child(name))"]
|
|
37
|
-
*/
|
|
38
|
-
declare function tokenizeTopLevel(input: string): string[];
|
|
39
|
-
/**
|
|
40
|
-
* Parse a Supabase PostgREST select string into an AST.
|
|
41
|
-
*
|
|
42
|
-
* @param select - The select string (e.g., "*, RelatedTable(*)")
|
|
43
|
-
* @returns Parsed select AST
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* parseSelect("*")
|
|
47
|
-
* // Returns: { columns: "*", relations: [] }
|
|
48
|
-
*
|
|
49
|
-
* parseSelect("id, name, status")
|
|
50
|
-
* // Returns: {
|
|
51
|
-
* // columns: [{ name: "id" }, { name: "name" }, { name: "status" }],
|
|
52
|
-
* // relations: []
|
|
53
|
-
* // }
|
|
54
|
-
*
|
|
55
|
-
* parseSelect("*, EquipmentFixture(*)")
|
|
56
|
-
* // Returns: {
|
|
57
|
-
* // columns: "*",
|
|
58
|
-
* // relations: [{ name: "EquipmentFixture", columns: "*", relations: [] }]
|
|
59
|
-
* // }
|
|
60
|
-
*
|
|
61
|
-
* parseSelect("id, name, ProjectDatabase(name, Organization(*))")
|
|
62
|
-
* // Returns: {
|
|
63
|
-
* // columns: [{ name: "id" }, { name: "name" }],
|
|
64
|
-
* // relations: [{
|
|
65
|
-
* // name: "ProjectDatabase",
|
|
66
|
-
* // columns: [{ name: "name" }],
|
|
67
|
-
* // relations: [{ name: "Organization", columns: "*", relations: [] }]
|
|
68
|
-
* // }]
|
|
69
|
-
* // }
|
|
70
|
-
*/
|
|
71
|
-
declare function parseSelect(select: string): ParsedSelect;
|
|
72
|
-
/**
|
|
73
|
-
* Convert a parsed select back to a string representation (for debugging)
|
|
74
|
-
*/
|
|
75
|
-
declare function stringifySelect(parsed: ParsedSelect): string;
|
|
76
|
-
/**
|
|
77
|
-
* Extract all column names from a parsed select (for building SQL queries)
|
|
78
|
-
* Does not include relation names.
|
|
79
|
-
*/
|
|
80
|
-
declare function extractColumnNames(parsed: ParsedSelect): string[] | "*";
|
|
81
|
-
/**
|
|
82
|
-
* Extract all relation names from a parsed select
|
|
83
|
-
*/
|
|
84
|
-
declare function extractRelationNames(parsed: ParsedSelect): string[];
|
|
85
|
-
/**
|
|
86
|
-
* Check if a select string references a specific relation
|
|
87
|
-
*/
|
|
88
|
-
declare function hasRelation(parsed: ParsedSelect, relationName: string): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Get the select configuration for a specific relation
|
|
91
|
-
*/
|
|
92
|
-
declare function getRelationSelect(parsed: ParsedSelect, relationName: string): SelectRelation | undefined;
|
|
93
|
-
|
|
94
|
-
type ConfigurationOptions<T> = {
|
|
95
|
-
crossOrganization?: boolean;
|
|
96
|
-
filter?: (item: ItemType<T>) => boolean;
|
|
97
|
-
};
|
|
98
|
-
type UseQuerySingleReturn<T> = UseQuerySingleReturn$1<T> & {
|
|
99
|
-
data: T | null | undefined;
|
|
100
|
-
};
|
|
101
|
-
declare function useQuery<Result>(query: PromiseLike<PostgrestSingleResponse<Result>>, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn"> & ConfigurationOptions<Result>): UseQuerySingleReturn<Result>;
|
|
102
|
-
|
|
103
|
-
type UsePartialQueryResult<T extends Record<string, any>> = ReturnType<typeof usePartialQuery<T[]>>;
|
|
104
|
-
declare function usePartialQuery<Result extends Record<string, any>[]>(query: PromiseLike<PostgrestSingleResponse<Result>>, itemCountPerPage: number, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn">): {
|
|
105
|
-
fetchPreviousPage: () => void;
|
|
106
|
-
fetchNextPage: () => void;
|
|
107
|
-
currentPage: number;
|
|
108
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
109
|
-
data: {
|
|
110
|
-
Items: Result;
|
|
111
|
-
CurrentPage: number;
|
|
112
|
-
ItemCount: number;
|
|
113
|
-
MaxCountPerPage: number;
|
|
114
|
-
PageCount: number;
|
|
115
|
-
};
|
|
116
|
-
pageCount: number;
|
|
117
|
-
hasNextPage: boolean;
|
|
118
|
-
hasPreviousPage: boolean;
|
|
119
|
-
error: _supabase_postgrest_js.PostgrestError;
|
|
120
|
-
status: "error";
|
|
121
|
-
isError: true;
|
|
122
|
-
isPending: false;
|
|
123
|
-
isSuccess: false;
|
|
124
|
-
failureCount: number;
|
|
125
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
126
|
-
isPaused: boolean;
|
|
127
|
-
isLoading: false;
|
|
128
|
-
isLoadingError: false;
|
|
129
|
-
isRefetchError: true;
|
|
130
|
-
isPlaceholderData: false;
|
|
131
|
-
dataUpdatedAt: number;
|
|
132
|
-
errorUpdatedAt: number;
|
|
133
|
-
errorUpdateCount: number;
|
|
134
|
-
isFetched: boolean;
|
|
135
|
-
isFetchedAfterMount: boolean;
|
|
136
|
-
isFetching: boolean;
|
|
137
|
-
isInitialLoading: boolean;
|
|
138
|
-
isRefetching: boolean;
|
|
139
|
-
isStale: boolean;
|
|
140
|
-
isEnabled: boolean;
|
|
141
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
142
|
-
promise: Promise<Result>;
|
|
143
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
144
|
-
count: number;
|
|
145
|
-
} | {
|
|
146
|
-
fetchPreviousPage: () => void;
|
|
147
|
-
fetchNextPage: () => void;
|
|
148
|
-
currentPage: number;
|
|
149
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
150
|
-
data: {
|
|
151
|
-
Items: Result;
|
|
152
|
-
CurrentPage: number;
|
|
153
|
-
ItemCount: number;
|
|
154
|
-
MaxCountPerPage: number;
|
|
155
|
-
PageCount: number;
|
|
156
|
-
};
|
|
157
|
-
pageCount: number;
|
|
158
|
-
hasNextPage: boolean;
|
|
159
|
-
hasPreviousPage: boolean;
|
|
160
|
-
error: null;
|
|
161
|
-
status: "success";
|
|
162
|
-
isError: false;
|
|
163
|
-
isPending: false;
|
|
164
|
-
isSuccess: true;
|
|
165
|
-
failureCount: number;
|
|
166
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
167
|
-
isPaused: boolean;
|
|
168
|
-
isLoading: false;
|
|
169
|
-
isLoadingError: false;
|
|
170
|
-
isRefetchError: false;
|
|
171
|
-
isPlaceholderData: false;
|
|
172
|
-
dataUpdatedAt: number;
|
|
173
|
-
errorUpdatedAt: number;
|
|
174
|
-
errorUpdateCount: number;
|
|
175
|
-
isFetched: boolean;
|
|
176
|
-
isFetchedAfterMount: boolean;
|
|
177
|
-
isFetching: boolean;
|
|
178
|
-
isInitialLoading: boolean;
|
|
179
|
-
isRefetching: boolean;
|
|
180
|
-
isStale: boolean;
|
|
181
|
-
isEnabled: boolean;
|
|
182
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
183
|
-
promise: Promise<Result>;
|
|
184
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
185
|
-
count: number;
|
|
186
|
-
} | {
|
|
187
|
-
fetchPreviousPage: () => void;
|
|
188
|
-
fetchNextPage: () => void;
|
|
189
|
-
currentPage: number;
|
|
190
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
191
|
-
data: {
|
|
192
|
-
Items: Result;
|
|
193
|
-
CurrentPage: number;
|
|
194
|
-
ItemCount: number;
|
|
195
|
-
MaxCountPerPage: number;
|
|
196
|
-
PageCount: number;
|
|
197
|
-
};
|
|
198
|
-
pageCount: number;
|
|
199
|
-
hasNextPage: boolean;
|
|
200
|
-
hasPreviousPage: boolean;
|
|
201
|
-
error: _supabase_postgrest_js.PostgrestError;
|
|
202
|
-
status: "error";
|
|
203
|
-
isError: true;
|
|
204
|
-
isPending: false;
|
|
205
|
-
isSuccess: false;
|
|
206
|
-
failureCount: number;
|
|
207
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
208
|
-
isPaused: boolean;
|
|
209
|
-
isLoading: false;
|
|
210
|
-
isLoadingError: true;
|
|
211
|
-
isRefetchError: false;
|
|
212
|
-
isPlaceholderData: false;
|
|
213
|
-
dataUpdatedAt: number;
|
|
214
|
-
errorUpdatedAt: number;
|
|
215
|
-
errorUpdateCount: number;
|
|
216
|
-
isFetched: boolean;
|
|
217
|
-
isFetchedAfterMount: boolean;
|
|
218
|
-
isFetching: boolean;
|
|
219
|
-
isInitialLoading: boolean;
|
|
220
|
-
isRefetching: boolean;
|
|
221
|
-
isStale: boolean;
|
|
222
|
-
isEnabled: boolean;
|
|
223
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
224
|
-
promise: Promise<Result>;
|
|
225
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
226
|
-
count: number;
|
|
227
|
-
} | {
|
|
228
|
-
fetchPreviousPage: () => void;
|
|
229
|
-
fetchNextPage: () => void;
|
|
230
|
-
currentPage: number;
|
|
231
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
232
|
-
data: {
|
|
233
|
-
Items: Result;
|
|
234
|
-
CurrentPage: number;
|
|
235
|
-
ItemCount: number;
|
|
236
|
-
MaxCountPerPage: number;
|
|
237
|
-
PageCount: number;
|
|
238
|
-
};
|
|
239
|
-
pageCount: number;
|
|
240
|
-
hasNextPage: boolean;
|
|
241
|
-
hasPreviousPage: boolean;
|
|
242
|
-
error: null;
|
|
243
|
-
status: "pending";
|
|
244
|
-
isError: false;
|
|
245
|
-
isPending: true;
|
|
246
|
-
isSuccess: false;
|
|
247
|
-
failureCount: number;
|
|
248
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
249
|
-
isPaused: boolean;
|
|
250
|
-
isLoading: true;
|
|
251
|
-
isLoadingError: false;
|
|
252
|
-
isRefetchError: false;
|
|
253
|
-
isPlaceholderData: false;
|
|
254
|
-
dataUpdatedAt: number;
|
|
255
|
-
errorUpdatedAt: number;
|
|
256
|
-
errorUpdateCount: number;
|
|
257
|
-
isFetched: boolean;
|
|
258
|
-
isFetchedAfterMount: boolean;
|
|
259
|
-
isFetching: boolean;
|
|
260
|
-
isInitialLoading: boolean;
|
|
261
|
-
isRefetching: boolean;
|
|
262
|
-
isStale: boolean;
|
|
263
|
-
isEnabled: boolean;
|
|
264
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
265
|
-
promise: Promise<Result>;
|
|
266
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
267
|
-
count: number;
|
|
268
|
-
} | {
|
|
269
|
-
fetchPreviousPage: () => void;
|
|
270
|
-
fetchNextPage: () => void;
|
|
271
|
-
currentPage: number;
|
|
272
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
273
|
-
data: {
|
|
274
|
-
Items: Result;
|
|
275
|
-
CurrentPage: number;
|
|
276
|
-
ItemCount: number;
|
|
277
|
-
MaxCountPerPage: number;
|
|
278
|
-
PageCount: number;
|
|
279
|
-
};
|
|
280
|
-
pageCount: number;
|
|
281
|
-
hasNextPage: boolean;
|
|
282
|
-
hasPreviousPage: boolean;
|
|
283
|
-
error: null;
|
|
284
|
-
status: "pending";
|
|
285
|
-
isError: false;
|
|
286
|
-
isPending: true;
|
|
287
|
-
isSuccess: false;
|
|
288
|
-
failureCount: number;
|
|
289
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
290
|
-
isPaused: boolean;
|
|
291
|
-
isLoading: boolean;
|
|
292
|
-
isLoadingError: false;
|
|
293
|
-
isRefetchError: false;
|
|
294
|
-
isPlaceholderData: false;
|
|
295
|
-
dataUpdatedAt: number;
|
|
296
|
-
errorUpdatedAt: number;
|
|
297
|
-
errorUpdateCount: number;
|
|
298
|
-
isFetched: boolean;
|
|
299
|
-
isFetchedAfterMount: boolean;
|
|
300
|
-
isFetching: boolean;
|
|
301
|
-
isInitialLoading: boolean;
|
|
302
|
-
isRefetching: boolean;
|
|
303
|
-
isStale: boolean;
|
|
304
|
-
isEnabled: boolean;
|
|
305
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
306
|
-
promise: Promise<Result>;
|
|
307
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
308
|
-
count: number;
|
|
309
|
-
} | {
|
|
310
|
-
fetchPreviousPage: () => void;
|
|
311
|
-
fetchNextPage: () => void;
|
|
312
|
-
currentPage: number;
|
|
313
|
-
setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
|
|
314
|
-
data: {
|
|
315
|
-
Items: Result;
|
|
316
|
-
CurrentPage: number;
|
|
317
|
-
ItemCount: number;
|
|
318
|
-
MaxCountPerPage: number;
|
|
319
|
-
PageCount: number;
|
|
320
|
-
};
|
|
321
|
-
pageCount: number;
|
|
322
|
-
hasNextPage: boolean;
|
|
323
|
-
hasPreviousPage: boolean;
|
|
324
|
-
error: null;
|
|
325
|
-
status: "success";
|
|
326
|
-
isError: false;
|
|
327
|
-
isPending: false;
|
|
328
|
-
isSuccess: true;
|
|
329
|
-
failureCount: number;
|
|
330
|
-
failureReason: _supabase_postgrest_js.PostgrestError;
|
|
331
|
-
isPaused: boolean;
|
|
332
|
-
isLoading: false;
|
|
333
|
-
isLoadingError: false;
|
|
334
|
-
isRefetchError: false;
|
|
335
|
-
isPlaceholderData: true;
|
|
336
|
-
dataUpdatedAt: number;
|
|
337
|
-
errorUpdatedAt: number;
|
|
338
|
-
errorUpdateCount: number;
|
|
339
|
-
isFetched: boolean;
|
|
340
|
-
isFetchedAfterMount: boolean;
|
|
341
|
-
isFetching: boolean;
|
|
342
|
-
isInitialLoading: boolean;
|
|
343
|
-
isRefetching: boolean;
|
|
344
|
-
isStale: boolean;
|
|
345
|
-
isEnabled: boolean;
|
|
346
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
347
|
-
promise: Promise<Result>;
|
|
348
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, _supabase_postgrest_js.PostgrestError>>;
|
|
349
|
-
count: number;
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Filter operators supported by the edge function.
|
|
354
|
-
* This is the single source of truth - matches /supabase/functions/_shared/query-sdk/types.ts
|
|
355
|
-
*
|
|
356
|
-
* Note: The following operators are normalized by normalizeFilter() before sending to the server:
|
|
357
|
-
* - "like" -> "contains"
|
|
358
|
-
* - "regex", "regex_i", "similar_to" -> "contains"
|
|
359
|
-
* - "!=" and "<>" are NOT supported - use "=" with not: true instead
|
|
360
|
-
*/
|
|
361
|
-
type FilterOperator = "=" | ">" | ">=" | "<" | "<=" | "contains" | "ilike" | "is" | "in" | "ai_search";
|
|
362
|
-
/**
|
|
363
|
-
* Filter interface - matches edge function API
|
|
364
|
-
*/
|
|
365
|
-
interface Filter {
|
|
366
|
-
/** Unique identifier */
|
|
367
|
-
id: string;
|
|
368
|
-
/** Field to filter on */
|
|
369
|
-
field: string;
|
|
370
|
-
/** Operator */
|
|
371
|
-
op: FilterOperator;
|
|
372
|
-
/** Value to compare */
|
|
373
|
-
value: string | number | string[] | number[] | boolean | null;
|
|
374
|
-
/** Negate the condition */
|
|
375
|
-
not?: boolean;
|
|
376
|
-
/** AI search options (when op = "ai_search") */
|
|
377
|
-
similarity?: number;
|
|
378
|
-
where?: string;
|
|
379
|
-
display?: string;
|
|
380
|
-
options?: {
|
|
381
|
-
display: string;
|
|
382
|
-
value: ValueForPropertyType<PropertyType>;
|
|
383
|
-
}[];
|
|
384
|
-
/** Filter configuration (UI metadata) */
|
|
385
|
-
info?: FilterConfig<any>;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Filter group - combine multiple filters
|
|
389
|
-
*/
|
|
390
|
-
interface FilterGroup {
|
|
391
|
-
/** Unique identifier */
|
|
392
|
-
id: string;
|
|
393
|
-
/** How to combine filters */
|
|
394
|
-
op: "AND" | "OR";
|
|
395
|
-
/** Filters in this group */
|
|
396
|
-
filters: Array<Filter | FilterGroup>;
|
|
397
|
-
/** Negate the entire group (NOT (A AND B)) */
|
|
398
|
-
not?: boolean;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Pagination settings
|
|
402
|
-
*/
|
|
403
|
-
interface Pagination {
|
|
404
|
-
offset?: number;
|
|
405
|
-
limit?: number;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Configuration for computed/aggregated field sorting
|
|
409
|
-
*/
|
|
410
|
-
interface ComputedSortConfig {
|
|
411
|
-
/** Aggregation function to apply */
|
|
412
|
-
fn: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX";
|
|
413
|
-
/** Field to aggregate */
|
|
414
|
-
field: string;
|
|
415
|
-
/** Relationship path for related table aggregation (e.g., "OrderItem" or "Order.OrderItem") */
|
|
416
|
-
relationship?: string;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* Sort order
|
|
420
|
-
*/
|
|
421
|
-
interface Sort {
|
|
422
|
-
field: string;
|
|
423
|
-
direction: "asc" | "desc";
|
|
424
|
-
/** Optional computed/aggregated sort configuration for sorting by aggregate values */
|
|
425
|
-
computed?: ComputedSortConfig;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Query state that includes FilterGroup plus pagination, sort, and isReady
|
|
429
|
-
* Used by useAdvancedFilterQuery for managing filter state with query metadata
|
|
430
|
-
*/
|
|
431
|
-
interface QueryState extends FilterGroup {
|
|
432
|
-
/** Pagination settings */
|
|
433
|
-
pagination?: Pagination;
|
|
434
|
-
/** Sort order */
|
|
435
|
-
sort?: Sort[];
|
|
436
|
-
/** Distinct ON expressions - returns one record per unique combination */
|
|
437
|
-
distinctOn?: string[];
|
|
438
|
-
/** Natural language query - converts to filters automatically */
|
|
439
|
-
naturalLanguageQuery?: string;
|
|
440
|
-
/** Whether the query is ready to execute */
|
|
441
|
-
isReady: boolean;
|
|
442
|
-
}
|
|
443
|
-
interface ClarificationSuggestion {
|
|
444
|
-
interpretation: string;
|
|
445
|
-
field_path: string;
|
|
446
|
-
example: string;
|
|
447
|
-
confidence: number;
|
|
448
|
-
}
|
|
449
|
-
interface ClarificationQuestion {
|
|
450
|
-
question: string;
|
|
451
|
-
suggestions: ClarificationSuggestion[];
|
|
452
|
-
}
|
|
453
|
-
declare function useAdvancedFilterQuery<Result>(query: PromiseLike<PostgrestSingleResponse<Result>>, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & {
|
|
454
|
-
key?: string;
|
|
455
|
-
filterKey?: string;
|
|
456
|
-
searchByDefault?: boolean;
|
|
457
|
-
timeout?: number;
|
|
458
|
-
count?: "exact" | "estimated" | "";
|
|
459
|
-
}): [
|
|
460
|
-
DefinedUseQueryResult<Result, Error> & {
|
|
461
|
-
count: number;
|
|
462
|
-
clarification?: ClarificationQuestion;
|
|
463
|
-
},
|
|
464
|
-
QueryState,
|
|
465
|
-
Dispatch<SetStateAction<QueryState>>
|
|
466
|
-
];
|
|
467
|
-
declare const useAdvancedQuery: typeof useAdvancedFilterQuery;
|
|
468
|
-
|
|
469
|
-
type DataType = Record<string, any>;
|
|
470
|
-
declare function useInfiniteQuery<Relation extends GenericTable | GenericView, Result extends DataType, Query extends string = "*", RelationName = unknown, Relationships = Relation extends {
|
|
471
|
-
Relationships: infer R;
|
|
472
|
-
} ? R : unknown, Builder = PromiseLike<PostgrestSingleResponse<Result>>>(query: PromiseLike<PostgrestSingleResponse<Result>>, countPerLoad: number, config?: Omit<UseInfiniteQueryOptions<PostgrestSingleResponse<Result>, Error, InfiniteData<PostgrestSingleResponse<Result>, number>>, "queryKey" | "queryFn" | "getNextPageParam" | "initialPageParam"> & {
|
|
473
|
-
crossOrganization?: boolean;
|
|
474
|
-
onQuery?: ({ pageParam, query }: {
|
|
475
|
-
pageParam: number;
|
|
476
|
-
query: Builder;
|
|
477
|
-
}) => any;
|
|
478
|
-
enableOnQuery?: boolean;
|
|
479
|
-
}): {
|
|
480
|
-
count: number;
|
|
481
|
-
data: Result;
|
|
482
|
-
error: Error;
|
|
483
|
-
isError: true;
|
|
484
|
-
isPending: false;
|
|
485
|
-
isLoading: false;
|
|
486
|
-
isLoadingError: false;
|
|
487
|
-
isRefetchError: true;
|
|
488
|
-
isSuccess: false;
|
|
489
|
-
isPlaceholderData: false;
|
|
490
|
-
status: "error";
|
|
491
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
492
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
493
|
-
hasNextPage: boolean;
|
|
494
|
-
hasPreviousPage: boolean;
|
|
495
|
-
isFetchNextPageError: boolean;
|
|
496
|
-
isFetchingNextPage: boolean;
|
|
497
|
-
isFetchPreviousPageError: boolean;
|
|
498
|
-
isFetchingPreviousPage: boolean;
|
|
499
|
-
dataUpdatedAt: number;
|
|
500
|
-
errorUpdatedAt: number;
|
|
501
|
-
failureCount: number;
|
|
502
|
-
failureReason: Error;
|
|
503
|
-
errorUpdateCount: number;
|
|
504
|
-
isFetched: boolean;
|
|
505
|
-
isFetchedAfterMount: boolean;
|
|
506
|
-
isFetching: boolean;
|
|
507
|
-
isInitialLoading: boolean;
|
|
508
|
-
isPaused: boolean;
|
|
509
|
-
isRefetching: boolean;
|
|
510
|
-
isStale: boolean;
|
|
511
|
-
isEnabled: boolean;
|
|
512
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
513
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
514
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
515
|
-
} | {
|
|
516
|
-
count: number;
|
|
517
|
-
data: Result;
|
|
518
|
-
error: null;
|
|
519
|
-
isError: false;
|
|
520
|
-
isPending: false;
|
|
521
|
-
isLoading: false;
|
|
522
|
-
isLoadingError: false;
|
|
523
|
-
isRefetchError: false;
|
|
524
|
-
isFetchNextPageError: false;
|
|
525
|
-
isFetchPreviousPageError: false;
|
|
526
|
-
isSuccess: true;
|
|
527
|
-
isPlaceholderData: false;
|
|
528
|
-
status: "success";
|
|
529
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
530
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
531
|
-
hasNextPage: boolean;
|
|
532
|
-
hasPreviousPage: boolean;
|
|
533
|
-
isFetchingNextPage: boolean;
|
|
534
|
-
isFetchingPreviousPage: boolean;
|
|
535
|
-
dataUpdatedAt: number;
|
|
536
|
-
errorUpdatedAt: number;
|
|
537
|
-
failureCount: number;
|
|
538
|
-
failureReason: Error;
|
|
539
|
-
errorUpdateCount: number;
|
|
540
|
-
isFetched: boolean;
|
|
541
|
-
isFetchedAfterMount: boolean;
|
|
542
|
-
isFetching: boolean;
|
|
543
|
-
isInitialLoading: boolean;
|
|
544
|
-
isPaused: boolean;
|
|
545
|
-
isRefetching: boolean;
|
|
546
|
-
isStale: boolean;
|
|
547
|
-
isEnabled: boolean;
|
|
548
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
549
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
550
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
551
|
-
} | {
|
|
552
|
-
count: number;
|
|
553
|
-
data: Result;
|
|
554
|
-
error: Error;
|
|
555
|
-
isError: true;
|
|
556
|
-
isPending: false;
|
|
557
|
-
isLoading: false;
|
|
558
|
-
isLoadingError: true;
|
|
559
|
-
isRefetchError: false;
|
|
560
|
-
isFetchNextPageError: false;
|
|
561
|
-
isFetchPreviousPageError: false;
|
|
562
|
-
isSuccess: false;
|
|
563
|
-
isPlaceholderData: false;
|
|
564
|
-
status: "error";
|
|
565
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
566
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
567
|
-
hasNextPage: boolean;
|
|
568
|
-
hasPreviousPage: boolean;
|
|
569
|
-
isFetchingNextPage: boolean;
|
|
570
|
-
isFetchingPreviousPage: boolean;
|
|
571
|
-
dataUpdatedAt: number;
|
|
572
|
-
errorUpdatedAt: number;
|
|
573
|
-
failureCount: number;
|
|
574
|
-
failureReason: Error;
|
|
575
|
-
errorUpdateCount: number;
|
|
576
|
-
isFetched: boolean;
|
|
577
|
-
isFetchedAfterMount: boolean;
|
|
578
|
-
isFetching: boolean;
|
|
579
|
-
isInitialLoading: boolean;
|
|
580
|
-
isPaused: boolean;
|
|
581
|
-
isRefetching: boolean;
|
|
582
|
-
isStale: boolean;
|
|
583
|
-
isEnabled: boolean;
|
|
584
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
585
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
586
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
587
|
-
} | {
|
|
588
|
-
count: number;
|
|
589
|
-
data: Result;
|
|
590
|
-
error: null;
|
|
591
|
-
isError: false;
|
|
592
|
-
isPending: true;
|
|
593
|
-
isLoading: true;
|
|
594
|
-
isLoadingError: false;
|
|
595
|
-
isRefetchError: false;
|
|
596
|
-
isFetchNextPageError: false;
|
|
597
|
-
isFetchPreviousPageError: false;
|
|
598
|
-
isSuccess: false;
|
|
599
|
-
isPlaceholderData: false;
|
|
600
|
-
status: "pending";
|
|
601
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
602
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
603
|
-
hasNextPage: boolean;
|
|
604
|
-
hasPreviousPage: boolean;
|
|
605
|
-
isFetchingNextPage: boolean;
|
|
606
|
-
isFetchingPreviousPage: boolean;
|
|
607
|
-
dataUpdatedAt: number;
|
|
608
|
-
errorUpdatedAt: number;
|
|
609
|
-
failureCount: number;
|
|
610
|
-
failureReason: Error;
|
|
611
|
-
errorUpdateCount: number;
|
|
612
|
-
isFetched: boolean;
|
|
613
|
-
isFetchedAfterMount: boolean;
|
|
614
|
-
isFetching: boolean;
|
|
615
|
-
isInitialLoading: boolean;
|
|
616
|
-
isPaused: boolean;
|
|
617
|
-
isRefetching: boolean;
|
|
618
|
-
isStale: boolean;
|
|
619
|
-
isEnabled: boolean;
|
|
620
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
621
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
622
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
623
|
-
} | {
|
|
624
|
-
count: number;
|
|
625
|
-
data: Result;
|
|
626
|
-
error: null;
|
|
627
|
-
isError: false;
|
|
628
|
-
isPending: true;
|
|
629
|
-
isLoadingError: false;
|
|
630
|
-
isRefetchError: false;
|
|
631
|
-
isFetchNextPageError: false;
|
|
632
|
-
isFetchPreviousPageError: false;
|
|
633
|
-
isSuccess: false;
|
|
634
|
-
isPlaceholderData: false;
|
|
635
|
-
status: "pending";
|
|
636
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
637
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
638
|
-
hasNextPage: boolean;
|
|
639
|
-
hasPreviousPage: boolean;
|
|
640
|
-
isFetchingNextPage: boolean;
|
|
641
|
-
isFetchingPreviousPage: boolean;
|
|
642
|
-
dataUpdatedAt: number;
|
|
643
|
-
errorUpdatedAt: number;
|
|
644
|
-
failureCount: number;
|
|
645
|
-
failureReason: Error;
|
|
646
|
-
errorUpdateCount: number;
|
|
647
|
-
isFetched: boolean;
|
|
648
|
-
isFetchedAfterMount: boolean;
|
|
649
|
-
isFetching: boolean;
|
|
650
|
-
isLoading: boolean;
|
|
651
|
-
isInitialLoading: boolean;
|
|
652
|
-
isPaused: boolean;
|
|
653
|
-
isRefetching: boolean;
|
|
654
|
-
isStale: boolean;
|
|
655
|
-
isEnabled: boolean;
|
|
656
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
657
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
658
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
659
|
-
} | {
|
|
660
|
-
count: number;
|
|
661
|
-
data: Result;
|
|
662
|
-
isError: false;
|
|
663
|
-
error: null;
|
|
664
|
-
isPending: false;
|
|
665
|
-
isLoading: false;
|
|
666
|
-
isLoadingError: false;
|
|
667
|
-
isRefetchError: false;
|
|
668
|
-
isSuccess: true;
|
|
669
|
-
isPlaceholderData: true;
|
|
670
|
-
isFetchNextPageError: false;
|
|
671
|
-
isFetchPreviousPageError: false;
|
|
672
|
-
status: "success";
|
|
673
|
-
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
674
|
-
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
675
|
-
hasNextPage: boolean;
|
|
676
|
-
hasPreviousPage: boolean;
|
|
677
|
-
isFetchingNextPage: boolean;
|
|
678
|
-
isFetchingPreviousPage: boolean;
|
|
679
|
-
dataUpdatedAt: number;
|
|
680
|
-
errorUpdatedAt: number;
|
|
681
|
-
failureCount: number;
|
|
682
|
-
failureReason: Error;
|
|
683
|
-
errorUpdateCount: number;
|
|
684
|
-
isFetched: boolean;
|
|
685
|
-
isFetchedAfterMount: boolean;
|
|
686
|
-
isFetching: boolean;
|
|
687
|
-
isInitialLoading: boolean;
|
|
688
|
-
isPaused: boolean;
|
|
689
|
-
isRefetching: boolean;
|
|
690
|
-
isStale: boolean;
|
|
691
|
-
isEnabled: boolean;
|
|
692
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<PostgrestSingleResponse<Result>, unknown>, Error>>;
|
|
693
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
694
|
-
promise: Promise<InfiniteData<PostgrestSingleResponse<Result>, unknown>>;
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
type UsePartialAdvancedQueryResult<T extends Record<string, any>> = ReturnType<typeof usePartialAdvancedQuery<T[]>>;
|
|
698
|
-
declare function usePartialAdvancedQuery<Result extends Record<string, any>[]>(query: PromiseLike<PostgrestSingleResponse<Result>>, itemCountPerPage: number, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & {
|
|
699
|
-
filterKey?: string;
|
|
700
|
-
timeout?: number;
|
|
701
|
-
}): [
|
|
702
|
-
ReturnType<typeof useAdvancedFilterQuery<Result>>[0] & {
|
|
703
|
-
currentPage: number;
|
|
704
|
-
setCurrentPage: (value: React.SetStateAction<number>) => void;
|
|
705
|
-
fetchNextPage: () => any;
|
|
706
|
-
fetchPreviousPage: () => any;
|
|
707
|
-
data: {
|
|
708
|
-
Items: Result;
|
|
709
|
-
CurrentPage: number;
|
|
710
|
-
ItemCount: number;
|
|
711
|
-
MaxCountPerPage: number;
|
|
712
|
-
PageCount: number;
|
|
713
|
-
};
|
|
714
|
-
pageCount: number;
|
|
715
|
-
hasNextPage: boolean;
|
|
716
|
-
hasPreviousPage: boolean;
|
|
717
|
-
count: number;
|
|
718
|
-
},
|
|
719
|
-
QueryState,
|
|
720
|
-
React.Dispatch<React.SetStateAction<QueryState>>
|
|
721
|
-
];
|
|
722
|
-
|
|
723
|
-
export { ParsedSelect, SelectRelation, type UsePartialAdvancedQueryResult, type UsePartialQueryResult, type UseQuerySingleReturn, extractColumnNames, extractRelationNames, getRelationSelect, hasRelation, parseSelect, stringifySelect, tokenizeTopLevel, useAdvancedFilterQuery, useAdvancedQuery, useInfiniteQuery, usePartialAdvancedQuery, usePartialQuery, useQuery };
|