@pol-studios/db 1.0.1 → 1.0.3

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.
@@ -0,0 +1,1071 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { UseQueryOptions, UseMutationResult, UseMutationOptions } from '@tanstack/react-query';
3
+ import { D as Database } from './useSupabase-pPhUZHcl.js';
4
+ import { G as GetResult } from './select-query-parser-CLkOKHzc.js';
5
+ import { G as GenericSchema, a as GenericTable } from './types-CKsWM8T3.js';
6
+ import { useInsertMutation, useUpdateMutation } from '@supabase-cache-helpers/postgrest-react-query';
7
+ import { PostgrestSingleResponse, PostgrestError, RealtimePostgresChangesPayload, SupabaseClient } from '@supabase/supabase-js';
8
+ import { u as useDbAdvanceFilterQuery, Q as QueryState, T as Tables, d as DbChangeLog } from './index-DNrSptau.js';
9
+ import { ItemType as ItemType$6 } from '@pol-studios/utils';
10
+ import { U as UseDbQuerySingleReturn } from './useDbQuery-C-TL8jY1.js';
11
+ import { T as TableDataAdapter, C as CapableDataAdapter, c as AdapterCapabilities, A as AdapterQueryResult } from './useDbCount-B5-Va9sg.js';
12
+ import { DatabaseSchema, QueryOptions } from './core/index.js';
13
+ import { FunctionsResponse } from '@supabase/functions-js';
14
+ import * as _supabase_postgrest_js from '@supabase/postgrest-js';
15
+ import { PostgrestSingleResponse as PostgrestSingleResponse$1 } from '@supabase/postgrest-js';
16
+ import { Moment } from 'moment';
17
+ import * as react from 'react';
18
+ import { ReactNode } from 'react';
19
+ import { TransformOptions } from '@supabase/storage-js';
20
+ import * as react_jsx_runtime from 'react/jsx-runtime';
21
+
22
+ declare function setSupabaseUrl(url: string): void;
23
+ declare function getSupabaseUrl(): string;
24
+
25
+ type ItemType$5<T> = T extends Array<infer U> ? U : T;
26
+ declare function useDbDelete<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], Query extends string = "*", RelationName = unknown, Relationships = Table extends {
27
+ Relationships: infer R;
28
+ } ? R : unknown, RowResult extends object = GetResult<PublicSchema, Table["Row"], RelationName, Relationships, Query>>(relation: TableName | {
29
+ table: TableName;
30
+ schema: Schema;
31
+ }, primaryKeys?: (keyof ItemType$5<RowResult> & string)[]): _tanstack_react_query.UseMutationResult<RowResult, Error, Partial<RowResult>, unknown>;
32
+
33
+ type ItemType$4<T> = T extends Array<infer U> ? U : T;
34
+ type MutationOption$2 = Parameters<typeof useInsertMutation>[3];
35
+ declare function useDbInsert<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", ReturnQuery extends string | undefined = undefined, PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], RelationName = unknown, Relationships = Table extends {
36
+ Relationships: infer R;
37
+ } ? R : unknown, RowResult = ReturnQuery extends undefined ? null : GetResult<PublicSchema, Table["Row"], RelationName, Relationships, Extract<ReturnQuery, string>>, ResultInsert extends object = GetResult<PublicSchema, Table["Insert"], RelationName, Relationships, "*">>(relation: TableName | {
38
+ table: TableName;
39
+ schema: Schema;
40
+ }, primaryKeys?: (keyof (ItemType$4<RowResult> | any) & string)[], query?: ReturnQuery, mutationOption?: MutationOption$2 & {
41
+ crossOrganization?: boolean;
42
+ }): _tanstack_react_query.UseMutationResult<RowResult, Error, ResultInsert, unknown>;
43
+
44
+ type ItemType$3<T> = T extends Array<infer U> ? U : T;
45
+ declare function useDbMultiDelete<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], Query extends string = "*", RelationName = unknown, Relationships = Table extends {
46
+ Relationships: infer R;
47
+ } ? R : unknown, RowResult extends object = Omit<GetResult<PublicSchema, Table["Update"], RelationName, Relationships, Query>, "id">>(relation: TableName | {
48
+ table: TableName;
49
+ schema: Schema;
50
+ }, primaryKeys?: (keyof ItemType$3<RowResult> & string)[]): _tanstack_react_query.UseMutationResult<RowResult, Error, RowResult | RowResult[], unknown>;
51
+
52
+ type ItemType$2<T> = T extends Array<infer U> ? U : T;
53
+ declare function useDbMultiUpsert<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], Query extends string = "*", RelationName = unknown, Relationships = Table extends {
54
+ Relationships: infer R;
55
+ } ? R : unknown, RowResult extends object = GetResult<PublicSchema, Table["Row"], RelationName, Relationships, Query>, ResultInsert extends object = GetResult<PublicSchema, Table["Insert"], RelationName, Relationships, Query>, ResultUpdate extends object = Omit<GetResult<PublicSchema, Table["Update"], RelationName, Relationships, Query>, "id"> & {
56
+ id: any;
57
+ }>(relation: TableName | {
58
+ table: TableName;
59
+ schema: Schema;
60
+ }, primaryKeys?: (keyof (ItemType$2<RowResult> | any) & string)[], query?: string): _tanstack_react_query.UseMutationResult<RowResult[], Error, (ResultInsert | ResultUpdate)[], unknown>;
61
+
62
+ type UseDbPartialAdvanceQueryResult<T extends Record<string, any>> = ReturnType<typeof useDbPartialAdvanceQuery<T[]>>;
63
+ declare function useDbPartialAdvanceQuery<Result extends Record<string, any>[]>(query: PromiseLike<PostgrestSingleResponse<Result>>, itemCountPerPage: number, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & {
64
+ filterKey?: string;
65
+ timeout?: number;
66
+ }): [
67
+ ReturnType<typeof useDbAdvanceFilterQuery<Result>>[0] & {
68
+ currentPage: number;
69
+ setCurrentPage: (value: React.SetStateAction<number>) => void;
70
+ fetchNextPage: () => any;
71
+ fetchPreviousPage: () => any;
72
+ data: {
73
+ Items: Result;
74
+ CurrentPage: number;
75
+ ItemCount: number;
76
+ MaxCountPerPage: number;
77
+ PageCount: number;
78
+ };
79
+ pageCount: number;
80
+ hasNextPage: boolean;
81
+ hasPreviousPage: boolean;
82
+ count: number;
83
+ },
84
+ QueryState,
85
+ React.Dispatch<React.SetStateAction<QueryState>>
86
+ ];
87
+
88
+ type UseDbPartialQueryResult<T extends Record<string, any>> = ReturnType<typeof useDbPartialQuery<T[]>>;
89
+ declare function useDbPartialQuery<Result extends Record<string, any>[]>(query: PromiseLike<PostgrestSingleResponse<Result>>, itemCountPerPage: number, config?: Omit<UseQueryOptions<Result, PostgrestError>, "queryKey" | "queryFn">): {
90
+ fetchPreviousPage: () => void;
91
+ fetchNextPage: () => void;
92
+ currentPage: number;
93
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
94
+ data: {
95
+ Items: Result;
96
+ CurrentPage: number;
97
+ ItemCount: number;
98
+ MaxCountPerPage: number;
99
+ PageCount: number;
100
+ };
101
+ pageCount: number;
102
+ hasNextPage: boolean;
103
+ hasPreviousPage: boolean;
104
+ error: PostgrestError;
105
+ status: "error";
106
+ isError: true;
107
+ isPending: false;
108
+ isSuccess: false;
109
+ failureCount: number;
110
+ failureReason: PostgrestError;
111
+ isPaused: boolean;
112
+ isLoading: false;
113
+ isLoadingError: false;
114
+ isRefetchError: true;
115
+ isPlaceholderData: false;
116
+ dataUpdatedAt: number;
117
+ errorUpdatedAt: number;
118
+ errorUpdateCount: number;
119
+ isFetched: boolean;
120
+ isFetchedAfterMount: boolean;
121
+ isFetching: boolean;
122
+ isInitialLoading: boolean;
123
+ isRefetching: boolean;
124
+ isStale: boolean;
125
+ isEnabled: boolean;
126
+ fetchStatus: _tanstack_react_query.FetchStatus;
127
+ promise: Promise<Result>;
128
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
129
+ count: number | null;
130
+ } | {
131
+ fetchPreviousPage: () => void;
132
+ fetchNextPage: () => void;
133
+ currentPage: number;
134
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
135
+ data: {
136
+ Items: Result;
137
+ CurrentPage: number;
138
+ ItemCount: number;
139
+ MaxCountPerPage: number;
140
+ PageCount: number;
141
+ };
142
+ pageCount: number;
143
+ hasNextPage: boolean;
144
+ hasPreviousPage: boolean;
145
+ error: null;
146
+ status: "success";
147
+ isError: false;
148
+ isPending: false;
149
+ isSuccess: true;
150
+ failureCount: number;
151
+ failureReason: PostgrestError;
152
+ isPaused: boolean;
153
+ isLoading: false;
154
+ isLoadingError: false;
155
+ isRefetchError: false;
156
+ isPlaceholderData: false;
157
+ dataUpdatedAt: number;
158
+ errorUpdatedAt: number;
159
+ errorUpdateCount: number;
160
+ isFetched: boolean;
161
+ isFetchedAfterMount: boolean;
162
+ isFetching: boolean;
163
+ isInitialLoading: boolean;
164
+ isRefetching: boolean;
165
+ isStale: boolean;
166
+ isEnabled: boolean;
167
+ fetchStatus: _tanstack_react_query.FetchStatus;
168
+ promise: Promise<Result>;
169
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
170
+ count: number | null;
171
+ } | {
172
+ fetchPreviousPage: () => void;
173
+ fetchNextPage: () => void;
174
+ currentPage: number;
175
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
176
+ data: {
177
+ Items: Result;
178
+ CurrentPage: number;
179
+ ItemCount: number;
180
+ MaxCountPerPage: number;
181
+ PageCount: number;
182
+ };
183
+ pageCount: number;
184
+ hasNextPage: boolean;
185
+ hasPreviousPage: boolean;
186
+ error: PostgrestError;
187
+ status: "error";
188
+ isError: true;
189
+ isPending: false;
190
+ isSuccess: false;
191
+ failureCount: number;
192
+ failureReason: PostgrestError;
193
+ isPaused: boolean;
194
+ isLoading: false;
195
+ isLoadingError: true;
196
+ isRefetchError: false;
197
+ isPlaceholderData: false;
198
+ dataUpdatedAt: number;
199
+ errorUpdatedAt: number;
200
+ errorUpdateCount: number;
201
+ isFetched: boolean;
202
+ isFetchedAfterMount: boolean;
203
+ isFetching: boolean;
204
+ isInitialLoading: boolean;
205
+ isRefetching: boolean;
206
+ isStale: boolean;
207
+ isEnabled: boolean;
208
+ fetchStatus: _tanstack_react_query.FetchStatus;
209
+ promise: Promise<Result>;
210
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
211
+ count: number | null;
212
+ } | {
213
+ fetchPreviousPage: () => void;
214
+ fetchNextPage: () => void;
215
+ currentPage: number;
216
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
217
+ data: {
218
+ Items: Result;
219
+ CurrentPage: number;
220
+ ItemCount: number;
221
+ MaxCountPerPage: number;
222
+ PageCount: number;
223
+ };
224
+ pageCount: number;
225
+ hasNextPage: boolean;
226
+ hasPreviousPage: boolean;
227
+ error: null;
228
+ status: "pending";
229
+ isError: false;
230
+ isPending: true;
231
+ isSuccess: false;
232
+ failureCount: number;
233
+ failureReason: PostgrestError;
234
+ isPaused: boolean;
235
+ isLoading: true;
236
+ isLoadingError: false;
237
+ isRefetchError: false;
238
+ isPlaceholderData: false;
239
+ dataUpdatedAt: number;
240
+ errorUpdatedAt: number;
241
+ errorUpdateCount: number;
242
+ isFetched: boolean;
243
+ isFetchedAfterMount: boolean;
244
+ isFetching: boolean;
245
+ isInitialLoading: boolean;
246
+ isRefetching: boolean;
247
+ isStale: boolean;
248
+ isEnabled: boolean;
249
+ fetchStatus: _tanstack_react_query.FetchStatus;
250
+ promise: Promise<Result>;
251
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
252
+ count: number | null;
253
+ } | {
254
+ fetchPreviousPage: () => void;
255
+ fetchNextPage: () => void;
256
+ currentPage: number;
257
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
258
+ data: {
259
+ Items: Result;
260
+ CurrentPage: number;
261
+ ItemCount: number;
262
+ MaxCountPerPage: number;
263
+ PageCount: number;
264
+ };
265
+ pageCount: number;
266
+ hasNextPage: boolean;
267
+ hasPreviousPage: boolean;
268
+ error: null;
269
+ status: "pending";
270
+ isError: false;
271
+ isPending: true;
272
+ isSuccess: false;
273
+ failureCount: number;
274
+ failureReason: PostgrestError;
275
+ isPaused: boolean;
276
+ isLoading: boolean;
277
+ isLoadingError: false;
278
+ isRefetchError: false;
279
+ isPlaceholderData: false;
280
+ dataUpdatedAt: number;
281
+ errorUpdatedAt: number;
282
+ errorUpdateCount: number;
283
+ isFetched: boolean;
284
+ isFetchedAfterMount: boolean;
285
+ isFetching: boolean;
286
+ isInitialLoading: boolean;
287
+ isRefetching: boolean;
288
+ isStale: boolean;
289
+ isEnabled: boolean;
290
+ fetchStatus: _tanstack_react_query.FetchStatus;
291
+ promise: Promise<Result>;
292
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
293
+ count: number | null;
294
+ } | {
295
+ fetchPreviousPage: () => void;
296
+ fetchNextPage: () => void;
297
+ currentPage: number;
298
+ setCurrentPage: react.Dispatch<react.SetStateAction<number>>;
299
+ data: {
300
+ Items: Result;
301
+ CurrentPage: number;
302
+ ItemCount: number;
303
+ MaxCountPerPage: number;
304
+ PageCount: number;
305
+ };
306
+ pageCount: number;
307
+ hasNextPage: boolean;
308
+ hasPreviousPage: boolean;
309
+ error: null;
310
+ status: "success";
311
+ isError: false;
312
+ isPending: false;
313
+ isSuccess: true;
314
+ failureCount: number;
315
+ failureReason: PostgrestError;
316
+ isPaused: boolean;
317
+ isLoading: false;
318
+ isLoadingError: false;
319
+ isRefetchError: false;
320
+ isPlaceholderData: true;
321
+ dataUpdatedAt: number;
322
+ errorUpdatedAt: number;
323
+ errorUpdateCount: number;
324
+ isFetched: boolean;
325
+ isFetchedAfterMount: boolean;
326
+ isFetching: boolean;
327
+ isInitialLoading: boolean;
328
+ isRefetching: boolean;
329
+ isStale: boolean;
330
+ isEnabled: boolean;
331
+ fetchStatus: _tanstack_react_query.FetchStatus;
332
+ promise: Promise<Result>;
333
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PostgrestSingleResponse<Result>, PostgrestError>>;
334
+ count: number | null;
335
+ };
336
+
337
+ declare function useDbRealtime(key: string, query: string, table: string | {
338
+ table: string;
339
+ schema: string;
340
+ }, primaryKeys: string[], options?: {
341
+ filter?: string;
342
+ enabled?: boolean;
343
+ onChange?: (payload: RealtimePostgresChangesPayload<{
344
+ [key: string]: any;
345
+ }>) => any;
346
+ }): "SUBSCRIBED" | "TIMED_OUT" | "CLOSED" | "CHANNEL_ERROR";
347
+
348
+ type ConfigurationOptions<T> = {
349
+ crossOrganization?: boolean;
350
+ };
351
+ type FilterOperator = "or" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike" | "is" | "in" | "cs" | "cd" | "fts" | "plfts";
352
+ type ValueType = number | string | boolean | null | Date | object;
353
+ type FilterDefinition = {
354
+ path: string;
355
+ alias?: string;
356
+ operator: FilterOperator;
357
+ negate: boolean;
358
+ value: ValueType;
359
+ };
360
+ type FilterDefinitions = (FilterComposite | FilterDefinition)[];
361
+ type FilterComposite = {
362
+ or?: FilterDefinitions;
363
+ and?: FilterDefinitions;
364
+ };
365
+ type UseDbRealtimeQueryResult<T> = UseDbQuerySingleReturn<T> & {
366
+ realtimeStatus: "SUBSCRIBED" | "TIMED_OUT" | "CLOSED" | "CHANNEL_ERROR" | "Loading...";
367
+ isRealtimeConnected: boolean;
368
+ isRealtimeLoading: boolean;
369
+ };
370
+ type DataType = Record<string, any>;
371
+ declare function convertFilterToRealtimeQuery(filters: FilterDefinitions): string;
372
+ declare function useDbRealtimeQuery<Result extends DataType>(query: PromiseLike<PostgrestSingleResponse<Result>>, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & ConfigurationOptions<Result>, primaryKeys?: (keyof ItemType$6<Result> & string)[]): UseDbRealtimeQueryResult<Result>;
373
+
374
+ type ItemType$1<T> = T extends Array<infer U> ? U : T;
375
+ type MutationOption$1 = Parameters<typeof useUpdateMutation>[3];
376
+ declare function useDbUpdate<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", ReturnQuery extends string | undefined = undefined, PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], RelationName = unknown, Relationships = Table extends {
377
+ Relationships: infer R;
378
+ } ? R : unknown, RowResult = ReturnQuery extends undefined ? null : GetResult<PublicSchema, Table["Row"], RelationName, Relationships, Extract<ReturnQuery, string>>, ResultUpdate extends object = (Omit<GetResult<PublicSchema, Table["Update"], RelationName, Relationships, "*">, "id"> & {
379
+ id: number;
380
+ }) | Omit<GetResult<PublicSchema, Table["Update"], RelationName, Relationships, "*">, "id">>(relation: TableName | {
381
+ table: TableName;
382
+ schema: Schema;
383
+ }, primaryKeys?: (keyof (ItemType$1<RowResult> | any) & string)[], query?: ReturnQuery, mutationOption?: MutationOption$1 & {
384
+ crossOrganization?: boolean;
385
+ }): _tanstack_react_query.UseMutationResult<RowResult, Error, ResultUpdate, unknown>;
386
+
387
+ type ItemType<T> = T extends Array<infer U> ? U : T;
388
+ type MutationOption = Parameters<typeof useUpdateMutation>[3];
389
+ type useDbUpsertResponse = ReturnType<typeof useDbUpsert>;
390
+ declare function useDbUpsert<TableName extends string & keyof PublicSchema["Tables"], Table extends PublicSchema["Tables"][TableName], Schema extends keyof Database = "public", ReturnQuery extends string | undefined = undefined, PublicSchema extends GenericSchema = Database[Extract<keyof Database, Schema>], RelationName = unknown, Relationships = Table extends {
391
+ Relationships: infer R;
392
+ } ? R : unknown, RowResult = ReturnQuery extends undefined ? null : GetResult<PublicSchema, Table["Row"], RelationName, Relationships, Extract<ReturnQuery, string>>, ResultInsert extends object = Omit<GetResult<PublicSchema, Table["Insert"], RelationName, Relationships, "*">, "id">, ResultUpdate extends object = Omit<GetResult<PublicSchema, Table["Update"], RelationName, Relationships, "*">, "id"> & {
393
+ id?: any;
394
+ }>(relation: TableName | {
395
+ table: TableName;
396
+ schema: Schema;
397
+ }, primaryKeys?: (keyof (ItemType<RowResult> | any) & string)[], query?: ReturnQuery, mutationOption?: MutationOption & {
398
+ crossOrganization?: boolean;
399
+ }): _tanstack_react_query.UseMutationResult<RowResult, Error, ResultInsert | ResultUpdate, unknown>;
400
+
401
+ interface UseMutationSuccessOptions {
402
+ successMessage?: string;
403
+ entityName?: string;
404
+ enabled?: boolean;
405
+ onSuccess?: () => void;
406
+ }
407
+ /**
408
+ * Hook to automatically show success feedback after successful mutations
409
+ * Works with both React Native and Web platforms
410
+ */
411
+ declare function useMutationSuccess<TData, TError, TVariables>(mutation: UseMutationResult<TData, TError, TVariables>, options?: UseMutationSuccessOptions): UseMutationResult<TData, TError, TVariables>;
412
+ /**
413
+ * Hook for React Native that uses native toast/alert system
414
+ * @deprecated Use useMutationSuccess instead - it auto-detects platform
415
+ */
416
+ declare function useMutationSuccessRN<TData, TError, TVariables>(mutation: UseMutationResult<TData, TError, TVariables>, options?: UseMutationSuccessOptions): UseMutationResult<TData, TError, TVariables>;
417
+
418
+ /**
419
+ * V3 Data Layer - Supabase Adapter
420
+ *
421
+ * Implements the TableDataAdapter interface for direct Supabase/PostgREST queries.
422
+ * This adapter is used for online-only data access without local caching.
423
+ */
424
+
425
+ /**
426
+ * Adapter for querying Supabase directly via PostgREST API.
427
+ *
428
+ * This adapter:
429
+ * - Queries Supabase directly (no local caching)
430
+ * - Supports real-time subscriptions via Supabase Realtime
431
+ * - Works only when online
432
+ * - Uses Supabase's native select embedding for relations
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const adapter = createSupabaseAdapter(supabaseClient, schema);
437
+ *
438
+ * // Query with relations
439
+ * const result = await adapter.query<Project>("projects", {
440
+ * select: "*, client:clients(*), tasks(*)",
441
+ * where: { status: "active" },
442
+ * orderBy: [{ field: "created_at", direction: "desc" }],
443
+ * limit: 10
444
+ * });
445
+ * ```
446
+ */
447
+ declare class SupabaseAdapter implements TableDataAdapter, CapableDataAdapter {
448
+ private supabase;
449
+ private schema;
450
+ readonly name = "supabase";
451
+ readonly capabilities: AdapterCapabilities;
452
+ constructor(supabase: SupabaseClient, schema: DatabaseSchema);
453
+ /**
454
+ * Parse a table identifier to extract schema and table name.
455
+ * Handles schema-qualified names like "core.Profile" -> { schema: "core", tableName: "Profile" }
456
+ *
457
+ * @param table - The table name, optionally schema-qualified (e.g., "users" or "core.Profile")
458
+ * @returns Object with schema (defaults to "public") and tableName
459
+ */
460
+ private parseTableIdentifier;
461
+ /**
462
+ * Execute a query and return results with optional count
463
+ *
464
+ * @param table - The table name to query
465
+ * @param options - Query options (select, where, orderBy, limit, offset)
466
+ * @returns Promise resolving to query results with optional count
467
+ */
468
+ query<T>(table: string, options: QueryOptions): Promise<AdapterQueryResult<T>>;
469
+ /**
470
+ * Query a single record by ID
471
+ *
472
+ * @param table - The table name to query
473
+ * @param id - The record ID
474
+ * @param options - Optional query options (mainly for select)
475
+ * @returns Promise resolving to the record or null if not found
476
+ */
477
+ queryById<T>(table: string, id: string, options?: Pick<QueryOptions, "select">): Promise<T | null>;
478
+ /**
479
+ * Insert a new record
480
+ *
481
+ * @param table - The table name
482
+ * @param data - The data to insert
483
+ * @returns Promise resolving to the inserted record
484
+ */
485
+ insert<T>(table: string, data: Partial<T>): Promise<T>;
486
+ /**
487
+ * Update an existing record by ID
488
+ *
489
+ * @param table - The table name
490
+ * @param id - The record ID to update
491
+ * @param data - The data to update
492
+ * @returns Promise resolving to the updated record
493
+ */
494
+ update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
495
+ /**
496
+ * Upsert (insert or update) a record
497
+ *
498
+ * @param table - The table name
499
+ * @param data - The data to upsert
500
+ * @returns Promise resolving to the upserted record
501
+ */
502
+ upsert<T>(table: string, data: Partial<T>): Promise<T>;
503
+ /**
504
+ * Delete a record by ID
505
+ *
506
+ * @param table - The table name
507
+ * @param id - The record ID to delete
508
+ * @returns Promise that resolves when deletion is complete
509
+ */
510
+ delete(table: string, id: string): Promise<void>;
511
+ /**
512
+ * Subscribe to real-time changes on a query
513
+ *
514
+ * @param table - The table name to watch
515
+ * @param options - Query options to filter what to watch
516
+ * @param callback - Function called with updated data
517
+ * @returns Unsubscribe function
518
+ */
519
+ subscribe<T>(table: string, options: QueryOptions, callback: (data: T[]) => void): () => void;
520
+ /**
521
+ * Apply where clause filters to a Supabase query
522
+ *
523
+ * Converts WhereClause to Supabase filter methods:
524
+ * - Direct value: .eq(field, value)
525
+ * - { in: [...] }: .in(field, values)
526
+ * - { gt: n }: .gt(field, n)
527
+ * - { gte: n }: .gte(field, n)
528
+ * - { lt: n }: .lt(field, n)
529
+ * - { lte: n }: .lte(field, n)
530
+ * - { like: s }: .ilike(field, s)
531
+ * - { is: null }: .is(field, null)
532
+ * - { neq: v }: .neq(field, v) or .not(field, "is", null)
533
+ * - { notIn: [...] }: .not().in(field, values)
534
+ *
535
+ * @param query - The Supabase query builder
536
+ * @param where - The where clause to apply
537
+ * @returns The query with filters applied
538
+ */
539
+ private applyWhereClause;
540
+ }
541
+ /**
542
+ * Create a new SupabaseAdapter instance
543
+ *
544
+ * @param supabase - The Supabase client instance
545
+ * @param schema - The database schema definition
546
+ * @returns A new SupabaseAdapter instance
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * const adapter = createSupabaseAdapter(supabaseClient, databaseSchema);
551
+ * const projects = await adapter.query<Project>("projects", {
552
+ * where: { status: "active" }
553
+ * });
554
+ * ```
555
+ */
556
+ declare function createSupabaseAdapter(supabase: SupabaseClient, schema: DatabaseSchema): SupabaseAdapter;
557
+
558
+ declare function useSupabaseFunction(): {
559
+ downloadFunctionResponse: (functionName: string, body?: any, name?: string) => Promise<void>;
560
+ };
561
+
562
+ declare function getErrorBody(response: FunctionsResponse<any>): Promise<any>;
563
+
564
+ interface AIOptions {
565
+ maxTokens?: number;
566
+ temperature?: number;
567
+ }
568
+ interface AIResponse {
569
+ success: boolean;
570
+ data?: {
571
+ response: string;
572
+ };
573
+ error?: string;
574
+ }
575
+ declare function useAI(): {
576
+ generate: (prompt: string, context: Record<string, any>, options?: AIOptions) => Promise<string>;
577
+ };
578
+
579
+ interface ExtractedReceipt {
580
+ merchantName: string;
581
+ transactionDate: string | null;
582
+ currency: string;
583
+ subtotal: number | null;
584
+ tax: number | null;
585
+ total: number;
586
+ lineItems: Array<{
587
+ description: string;
588
+ amount: number;
589
+ quantity: number | null;
590
+ suggestedCategory: string | null;
591
+ }>;
592
+ confidence: number;
593
+ notes: string | null;
594
+ }
595
+ interface PendingExpense {
596
+ id: string;
597
+ file: File;
598
+ status: "processing" | "ready" | "error" | "confirming";
599
+ extractedData: ExtractedReceipt | null;
600
+ error: string | null;
601
+ duplicateWarning?: {
602
+ existingExpenseId: number;
603
+ reason: string;
604
+ };
605
+ }
606
+ interface BatchAnalysisProgress {
607
+ total: number;
608
+ completed: number;
609
+ processing: string[];
610
+ }
611
+ interface RecentExpenseContext {
612
+ merchantName: string;
613
+ category: string | null;
614
+ amount: number;
615
+ }
616
+ interface UseReceiptAIOptions {
617
+ recentExpenses?: RecentExpenseContext[];
618
+ taxCategories?: Tables<"TaxCategory">[];
619
+ }
620
+ declare function useReceiptAI(options?: UseReceiptAIOptions): {
621
+ analyzeReceipt: (file: File) => Promise<ExtractedReceipt | null>;
622
+ analyzeMultipleReceipts: (files: File[], onProgress?: (progress: BatchAnalysisProgress) => void, onItemComplete?: (item: PendingExpense) => void) => Promise<PendingExpense[]>;
623
+ isAnalyzing: boolean;
624
+ batchProgress: BatchAnalysisProgress;
625
+ error: string;
626
+ extractedData: ExtractedReceipt;
627
+ reset: () => void;
628
+ };
629
+
630
+ interface ServerAvailabilityState {
631
+ isAvailable: boolean | null;
632
+ isChecking: boolean;
633
+ lastChecked: Date | null;
634
+ error: Error | null;
635
+ }
636
+ /**
637
+ * Hook to check if the Supabase server is available.
638
+ * Performs periodic health checks and provides availability state.
639
+ * Works without requiring Supabase context, making it safe to use at app initialization.
640
+ */
641
+ declare function useServerAvailability(options?: {
642
+ enabled?: boolean;
643
+ checkInterval?: number;
644
+ timeout?: number;
645
+ }): ServerAvailabilityState & {
646
+ checkAvailability: () => Promise<void>;
647
+ };
648
+
649
+ declare function useSearchQuery<Result>(baseQuery: PromiseLike<PostgrestSingleResponse$1<Result>>, searchText: string, columns: ((string & keyof Result) | string)[], options?: {
650
+ isOptional: boolean;
651
+ additionCondition: (string | undefined)[];
652
+ }): PromiseLike<PostgrestSingleResponse$1<Result>>;
653
+
654
+ type PublicSchema$2 = Database[Extract<keyof Database, "public">];
655
+ type TableRow<T> = T extends {
656
+ Row: infer R extends Record<string, unknown>;
657
+ } ? R : Record<string, unknown>;
658
+ declare function useLiveChangeTracking<Relation extends GenericTable, TableName extends string & keyof PublicSchema$2["Tables"], Table extends PublicSchema$2["Tables"][TableName] = PublicSchema$2["Tables"][TableName], Query extends string = "*", RelationName = unknown, Relationships = Table extends {
659
+ Relationships: infer R;
660
+ } ? R : unknown, TItem = GetResult<PublicSchema$2, TableRow<Table>, RelationName, Relationships, Query>>(tableName: TableName, item: TItem, action?: (updates: Partial<TItem>, changeLog: DbChangeLog) => any): DbChangeLog;
661
+
662
+ declare function useLatestOperationLog(tableName: string, recordId: number): UseDbQuerySingleReturn<unknown>;
663
+
664
+ type PublicSchema$1 = Database[Extract<keyof Database, "public">];
665
+ type TimeActivity = any;
666
+ declare function newTimeActivity(date: Moment): TimeActivity;
667
+ type AutosaveOptions<T> = UpdateOptions<T> & {
668
+ delay: number;
669
+ primaryKeys?: string[];
670
+ transformBeforeMutation?: (item: T) => Partial<T>;
671
+ };
672
+ type UpdateOptions<T> = Partial<UseMutationOptions<T, Error, T, unknown>> & {
673
+ updateCache?: boolean;
674
+ };
675
+ /**
676
+ * Hook for managing autosave state with proper entity switching support.
677
+ *
678
+ * This hook provides three main functions:
679
+ * 1. `updateValue` - For making changes to the current entity (with autosave)
680
+ * 2. `setNewEntity` - For switching to a completely different entity (saves previous entity first)
681
+ * 3. `setValue` - For setting a value without triggering autosave or change tracking
682
+ *
683
+ * @example
684
+ * ```tsx
685
+ * const [value, updateValue, mutation, setValue, setNewEntity] = useAutosaveState(
686
+ * 'time_activities',
687
+ * defaultTimeActivity,
688
+ * {
689
+ * delay: 500,
690
+ * transformBeforeMutation: (item) => omitFields(item, ['computedField', 'uiOnlyField'])
691
+ * }
692
+ * );
693
+ *
694
+ * // For making changes to current entity (autosaves after delay)
695
+ * updateValue(prev => ({ ...prev, description: 'New description' }));
696
+ *
697
+ * // For switching to a different entity (saves current entity first)
698
+ * setNewEntity(differentTimeActivity);
699
+ * ```
700
+ */
701
+ declare function useAutosaveState<T extends TItem & {
702
+ id: number;
703
+ }, TableName extends string & keyof PublicSchema$1["Tables"] = any, Table extends PublicSchema$1["Tables"][TableName] = any, Query extends string = "*", RelationName = unknown, Relationships = Table extends {
704
+ Relationships: infer R;
705
+ } ? R : unknown, TItem = Omit<GetResult<PublicSchema$1, Table extends {
706
+ Row: infer R;
707
+ } ? R extends Record<string, unknown> ? R : any : any, RelationName, Relationships, Query>, "id"> & {
708
+ id: number;
709
+ }>(relation: TableName, defaultValue: T, options?: AutosaveOptions<T>): [
710
+ T,
711
+ React.Dispatch<React.SetStateAction<T>>,
712
+ UseMutationResult<PostgrestSingleResponse<T>, Error, T, unknown>,
713
+ React.Dispatch<React.SetStateAction<T>>,
714
+ (newEntity: T) => void,
715
+ () => Promise<void>
716
+ ];
717
+
718
+ declare function useToastError<T>(mutation: useDbUpsertResponse): UseMutationResult<unknown, Error, object, unknown>;
719
+
720
+ declare function executeAdvanceQuery<Result>(supabase: any, query: PromiseLike<PostgrestSingleResponse<Result>>, filterLayer: QueryState): Promise<{
721
+ data: any;
722
+ count: number | null;
723
+ error: any;
724
+ }>;
725
+
726
+ type CustomPageQueryResult<T extends Record<string, any>[]> = ReturnType<typeof useDbPartialQuery<T>>;
727
+
728
+ type Attachment = {
729
+ bucketId: string;
730
+ path: string;
731
+ };
732
+ declare function useStorageUrl(): {
733
+ fetchUrl: (entity: {
734
+ bucketId: string;
735
+ path: string;
736
+ }, options?: {
737
+ download?: string | boolean;
738
+ transform?: TransformOptions;
739
+ }) => Promise<string>;
740
+ fetchUrls: (entities: Attachment[], options?: {
741
+ download?: string | boolean;
742
+ transform?: TransformOptions;
743
+ }) => Promise<Map<string, string | undefined>>;
744
+ prefetchImage: (entity: Attachment, options?: {
745
+ download?: string | boolean;
746
+ transform?: TransformOptions;
747
+ }) => Promise<void>;
748
+ fetchPublicUrl: (entity: {
749
+ bucketId: string;
750
+ path: string;
751
+ }, options?: {
752
+ download?: string | boolean;
753
+ transform?: TransformOptions;
754
+ }) => Promise<string>;
755
+ expireCache: (entity: {
756
+ bucketId: string;
757
+ path: string;
758
+ }) => Promise<void>;
759
+ getCacheVersion: (entity: {
760
+ bucketId: string;
761
+ path: string;
762
+ }) => number;
763
+ subscribeToCacheVersion: (entity: {
764
+ bucketId: string;
765
+ path: string;
766
+ }, callback: () => void) => () => void;
767
+ };
768
+
769
+ /**
770
+ * Metadata stored in storage.objects.metadata JSONB column
771
+ */
772
+ interface StorageObjectMetadata {
773
+ processingStatus: "None" | "Processing" | "Error";
774
+ contentType: string;
775
+ contentHeight?: number;
776
+ contentWidth?: number;
777
+ originalFileName?: string;
778
+ legacyAttachmentId?: number;
779
+ }
780
+ type UseStoragePathOptions = {
781
+ /** Whether to fetch metadata from storage.objects (default: true) */
782
+ fetchMetadata?: boolean;
783
+ /** Transform options for the URL */
784
+ transform?: {
785
+ width?: number;
786
+ height?: number;
787
+ quality?: number;
788
+ format?: "origin";
789
+ };
790
+ /** Whether to get a download URL */
791
+ download?: string | boolean;
792
+ };
793
+ type UseStoragePathResult = {
794
+ /** Signed URL for the storage object */
795
+ url: string | null;
796
+ /** Metadata from storage.objects.metadata JSONB */
797
+ metadata: StorageObjectMetadata | null;
798
+ /** Content type (from metadata or inferred from path) */
799
+ contentType: string;
800
+ /** Whether the URL or metadata is still loading */
801
+ isLoading: boolean;
802
+ /** Error if URL fetch failed */
803
+ error: Error | null;
804
+ };
805
+ /**
806
+ * Hook to get a signed URL and metadata for a storage path.
807
+ * Replaces useAttachment for the path-based storage approach.
808
+ *
809
+ * @param storagePath - The path within the bucket (e.g., "14/abc-123.jpg")
810
+ * @param bucketId - The storage bucket ID
811
+ * @param options - Optional configuration
812
+ *
813
+ * @example
814
+ * ```tsx
815
+ * const { url, contentType, isLoading } = useStoragePath(
816
+ * profile.profilePath,
817
+ * 'attachments'
818
+ * );
819
+ *
820
+ * if (isLoading) return <Spinner />;
821
+ * return <img src={url} />;
822
+ * ```
823
+ */
824
+ declare function useStoragePath(storagePath: string | undefined | null, bucketId: string, options?: UseStoragePathOptions): UseStoragePathResult;
825
+
826
+ /**
827
+ * Storage bucket names for Supabase storage.
828
+ * Use these constants when calling storage APIs.
829
+ */
830
+ declare const BUCKETS: {
831
+ readonly AVATARS: "avatars";
832
+ readonly FIXTURE_CATALOG_COVER: "fixture-catalog-cover";
833
+ readonly FIXTURE_ATTACHMENTS: "fixture-attachments";
834
+ readonly UNIT_DOCUMENTATION: "unit-documentation-attachments";
835
+ readonly DATASHEETS: "datasheets";
836
+ readonly PATTERNS: "patterns";
837
+ readonly LOGOS: "logos";
838
+ readonly RECEIPTS: "receipts";
839
+ readonly TICKET_ATTACHMENTS: "ticket-attachment";
840
+ readonly PROCESS_RESULTS: "process-results";
841
+ readonly DATA_EXCHANGE_IMPORTS: "data-exchange-imports";
842
+ readonly EMAIL_TEMPLATES: "email-templates";
843
+ readonly EMAIL_TEMPLATES_ASSETS: "email-templates-assets";
844
+ };
845
+ type BucketName = (typeof BUCKETS)[keyof typeof BUCKETS];
846
+
847
+ declare function createInCondition(column: string, values: (string | number)[]): string;
848
+
849
+ declare const TIMEOUT_ERROR_MESSAGE = "Request timed out";
850
+ declare const DEFAULT_QUERY_TIMEOUT = 15000;
851
+ declare function isTimeoutError(error: Error | null | undefined): boolean;
852
+
853
+ interface AlertProps {
854
+ title: string;
855
+ description: string;
856
+ }
857
+ interface Context {
858
+ lastModifiedUserName: string;
859
+ changeLog: DbChangeLog;
860
+ }
861
+ declare const LiveChangeContext: react.Context<Context>;
862
+ declare const LiveChangeContextProvider: ({ children, changeLog, }: {
863
+ children: ReactNode;
864
+ changeLog: DbChangeLog;
865
+ }) => react_jsx_runtime.JSX.Element;
866
+
867
+ /**
868
+ * Upsert a changelog (create or update)
869
+ */
870
+ declare const useUpsertChangelog: () => _tanstack_react_query.UseMutationResult<any, Error, Omit<any, "id"> | (Omit<any, "id"> & {
871
+ id?: any;
872
+ }), unknown>;
873
+ /**
874
+ * Delete a changelog
875
+ * Note: Cascade delete will remove all associated entries and media
876
+ */
877
+ declare const useDeleteChangelog: () => _tanstack_react_query.UseMutationResult<any, Error, Partial<any>, unknown>;
878
+ /**
879
+ * Upsert a changelog entry (create or update)
880
+ */
881
+ declare const useUpsertChangelogEntry: () => _tanstack_react_query.UseMutationResult<any, Error, Omit<any, "id"> | (Omit<any, "id"> & {
882
+ id?: any;
883
+ }), unknown>;
884
+ /**
885
+ * Upsert multiple changelog entries at once
886
+ */
887
+ declare const useMultiUpsertChangelogEntries: () => _tanstack_react_query.UseMutationResult<any[], Error, any[], unknown>;
888
+ /**
889
+ * Delete a changelog entry
890
+ * Note: Cascade delete will remove all associated media
891
+ */
892
+ declare const useDeleteChangelogEntry: () => _tanstack_react_query.UseMutationResult<any, Error, Partial<any>, unknown>;
893
+ /**
894
+ * Delete multiple changelog entries at once
895
+ */
896
+ declare const useMultiDeleteChangelogEntries: () => _tanstack_react_query.UseMutationResult<Omit<any, "id">, Error, Omit<any, "id"> | Omit<any, "id">[], unknown>;
897
+ /**
898
+ * Upsert changelog media (create or update)
899
+ */
900
+ declare const useUpsertChangelogMedia: () => _tanstack_react_query.UseMutationResult<any, Error, Omit<any, "id"> | (Omit<any, "id"> & {
901
+ id?: any;
902
+ }), unknown>;
903
+ /**
904
+ * Delete changelog media
905
+ */
906
+ declare const useDeleteChangelogMedia: () => _tanstack_react_query.UseMutationResult<any, Error, Partial<any>, unknown>;
907
+ /**
908
+ * Upload media file for changelog entry
909
+ * Just returns a simple upload function - caller handles creating ChangelogMedia records
910
+ */
911
+ declare const useUploadChangelogMedia: () => {
912
+ mutateAsync: () => Promise<{
913
+ path: string;
914
+ publicUrl: string;
915
+ }>;
916
+ };
917
+
918
+ /**
919
+ * Fetch all changelogs with their entries and media
920
+ * Ordered by release date (newest first)
921
+ */
922
+ declare const useChangelogs: (options?: {
923
+ realtime?: boolean;
924
+ }) => (Omit<_tanstack_react_query.QueryObserverRefetchErrorResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
925
+ data: any[];
926
+ count?: number | null;
927
+ }) | (Omit<_tanstack_react_query.QueryObserverSuccessResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
928
+ data: any[];
929
+ count?: number | null;
930
+ }) | (Omit<_tanstack_react_query.QueryObserverLoadingErrorResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
931
+ data: any[];
932
+ count?: number | null;
933
+ }) | (Omit<_tanstack_react_query.QueryObserverPendingResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
934
+ data: any[];
935
+ count?: number | null;
936
+ }) | (Omit<_tanstack_react_query.QueryObserverPlaceholderResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
937
+ data: any[];
938
+ count?: number | null;
939
+ });
940
+ /**
941
+ * Fetch published changelogs only
942
+ */
943
+ declare const usePublishedChangelogs: (options?: {
944
+ realtime?: boolean;
945
+ }) => (Omit<_tanstack_react_query.QueryObserverRefetchErrorResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
946
+ data: any[];
947
+ count?: number | null;
948
+ }) | (Omit<_tanstack_react_query.QueryObserverSuccessResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
949
+ data: any[];
950
+ count?: number | null;
951
+ }) | (Omit<_tanstack_react_query.QueryObserverLoadingErrorResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
952
+ data: any[];
953
+ count?: number | null;
954
+ }) | (Omit<_tanstack_react_query.QueryObserverPendingResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
955
+ data: any[];
956
+ count?: number | null;
957
+ }) | (Omit<_tanstack_react_query.QueryObserverPlaceholderResult<any[], _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_tanstack_react_query.UseQueryResult<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, _supabase_postgrest_js.PostgrestError>, "refetch"> & Pick<_supabase_postgrest_js.PostgrestSingleResponse<any[]>, "count"> & {
958
+ data: any[];
959
+ count?: number | null;
960
+ });
961
+ /**
962
+ * Fetch a single changelog by ID
963
+ */
964
+ declare const useChangelogById: (id: string | undefined) => UseDbQuerySingleReturn<any>;
965
+ /**
966
+ * Fetch a single changelog by slug
967
+ */
968
+ declare const useChangelogBySlug: (slug: string | undefined) => UseDbQuerySingleReturn<any>;
969
+ /**
970
+ * Fetch changelog entries for a specific changelog
971
+ */
972
+ declare const useChangelogEntries: (changelogId: string | undefined) => UseDbQuerySingleReturn<any[]>;
973
+ /**
974
+ * Fetch media for a specific changelog entry
975
+ */
976
+ declare const useChangelogMedia: (entryId: string | undefined) => UseDbQuerySingleReturn<any[]>;
977
+
978
+ interface FeedbackListItem {
979
+ id: number;
980
+ userId: string | null;
981
+ table: string | null;
982
+ schema: string;
983
+ memoryType: string;
984
+ resolved: boolean;
985
+ resolvedAt: string | null;
986
+ resolvedBy: string | null;
987
+ createdAt: string;
988
+ updatedAt: string;
989
+ data: {
990
+ query: string;
991
+ queryHash?: string;
992
+ status?: "success" | "failure" | "needs_review" | "cache_hit";
993
+ statusMessage?: string;
994
+ confidence?: number;
995
+ filters?: any;
996
+ sql?: string;
997
+ sqlError?: string;
998
+ agentDecisions?: any;
999
+ context?: any;
1000
+ trace?: any;
1001
+ corrections?: {
1002
+ domainTerm?: string;
1003
+ domainFieldPath?: string;
1004
+ fieldPath?: string;
1005
+ filters?: any;
1006
+ };
1007
+ feedback?: string;
1008
+ modelUsed?: string;
1009
+ reasoningEffort?: "minimal" | "medium" | "high";
1010
+ performance?: any;
1011
+ resultCount?: number;
1012
+ };
1013
+ }
1014
+ interface FeedbackListParams {
1015
+ resolved?: boolean;
1016
+ status?: string;
1017
+ limit?: number;
1018
+ offset?: number;
1019
+ userId?: string;
1020
+ startDate?: string;
1021
+ endDate?: string;
1022
+ }
1023
+ declare function useFeedbackList(params?: FeedbackListParams): _tanstack_react_query.UseQueryResult<{
1024
+ success: boolean;
1025
+ data: FeedbackListItem[];
1026
+ pagination: {
1027
+ limit: number;
1028
+ offset: number;
1029
+ total: number;
1030
+ };
1031
+ }, Error>;
1032
+
1033
+ interface SubmitFeedbackParams {
1034
+ memoryId?: number;
1035
+ query: string;
1036
+ table: string;
1037
+ schema?: string;
1038
+ status?: "success" | "failure" | "needs_review";
1039
+ corrections?: {
1040
+ domainTerm?: string;
1041
+ domainFieldPath?: string;
1042
+ fieldPath?: string;
1043
+ filters?: any;
1044
+ };
1045
+ feedback?: string;
1046
+ }
1047
+ declare function useSubmitFeedback(): _tanstack_react_query.UseMutationResult<{
1048
+ success: boolean;
1049
+ data: any;
1050
+ }, Error, SubmitFeedbackParams, unknown>;
1051
+
1052
+ declare function useApplyFeedback(): _tanstack_react_query.UseMutationResult<{
1053
+ success: boolean;
1054
+ data: any;
1055
+ learningResults: Array<{
1056
+ type: string;
1057
+ id: number;
1058
+ action: string;
1059
+ }>;
1060
+ }, Error, number, unknown>;
1061
+
1062
+ declare function useResolveFeedback(): _tanstack_react_query.UseMutationResult<{
1063
+ success: boolean;
1064
+ data: any;
1065
+ learningResults: Array<{
1066
+ type: string;
1067
+ id: number;
1068
+ }>;
1069
+ }, Error, number, unknown>;
1070
+
1071
+ export { LiveChangeContext as $, type UseMutationSuccessOptions as A, useMutationSuccess as B, useMutationSuccessRN as C, getErrorBody as D, type AIOptions as E, type AIResponse as F, useAI as G, type ExtractedReceipt as H, type BatchAnalysisProgress as I, type ServerAvailabilityState as J, useServerAvailability as K, useSearchQuery as L, type MutationOption as M, type UpdateOptions as N, executeAdvanceQuery as O, type PendingExpense as P, type CustomPageQueryResult as Q, type StorageObjectMetadata as R, SupabaseAdapter as S, BUCKETS as T, type UseDbPartialAdvanceQueryResult as U, type BucketName as V, createInCondition as W, TIMEOUT_ERROR_MESSAGE as X, DEFAULT_QUERY_TIMEOUT as Y, isTimeoutError as Z, type AlertProps as _, useDbInsert as a, LiveChangeContextProvider as a0, useUpsertChangelog as a1, useDeleteChangelog as a2, useUpsertChangelogEntry as a3, useMultiUpsertChangelogEntries as a4, useDeleteChangelogEntry as a5, useMultiDeleteChangelogEntries as a6, useUpsertChangelogMedia as a7, useDeleteChangelogMedia as a8, useUploadChangelogMedia as a9, useChangelogs as aa, usePublishedChangelogs as ab, useChangelogById as ac, useChangelogBySlug as ad, useChangelogEntries as ae, useChangelogMedia as af, useFeedbackList as ag, type FeedbackListItem as ah, type FeedbackListParams as ai, useSubmitFeedback as aj, type SubmitFeedbackParams as ak, useApplyFeedback as al, useResolveFeedback as am, useDbUpdate as b, useDbDelete as c, useDbUpsert as d, useDbRealtimeQuery as e, createSupabaseAdapter as f, useSupabaseFunction as g, useReceiptAI as h, useLiveChangeTracking as i, useLatestOperationLog as j, useAutosaveState as k, useToastError as l, useStorageUrl as m, newTimeActivity as n, useStoragePath as o, getSupabaseUrl as p, useDbMultiDelete as q, useDbMultiUpsert as r, setSupabaseUrl as s, useDbPartialAdvanceQuery as t, useDbRealtime as u, type UseDbPartialQueryResult as v, useDbPartialQuery as w, type UseDbRealtimeQueryResult as x, convertFilterToRealtimeQuery as y, type useDbUpsertResponse as z };