@pol-studios/db 1.0.19 → 1.0.21

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