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