@pol-studios/db 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +434 -0
- package/dist/EntityPermissions-DwFt4tUd.d.ts +35 -0
- package/dist/FilterConfig-Bt2Ek74z.d.ts +99 -0
- package/dist/UserMetadataContext-BYYqA6LI.d.ts +89 -0
- package/dist/auth/context.d.ts +47 -0
- package/dist/auth/context.js +12791 -0
- package/dist/auth/context.js.map +1 -0
- package/dist/auth/guards.d.ts +180 -0
- package/dist/auth/guards.js +7651 -0
- package/dist/auth/guards.js.map +1 -0
- package/dist/auth/hooks.d.ts +312 -0
- package/dist/auth/hooks.js +10600 -0
- package/dist/auth/hooks.js.map +1 -0
- package/dist/auth/index.d.ts +10 -0
- package/dist/auth/index.js +13035 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/client/index.d.ts +16 -0
- package/dist/core/index.d.ts +508 -0
- package/dist/executor-CB4KHyYG.d.ts +507 -0
- package/dist/gen/index.d.ts +1099 -0
- package/dist/hooks/index.d.ts +83 -0
- package/dist/index-DNrSptau.d.ts +8780 -0
- package/dist/index.d.ts +338 -0
- package/dist/index.js +10320 -7124
- package/dist/index.js.map +1 -1
- package/dist/index.web.d.ts +318 -0
- package/dist/index.web.js +56795 -0
- package/dist/index.web.js.map +1 -0
- package/dist/mutation/index.d.ts +58 -0
- package/dist/mutation/index.js +4581 -76
- package/dist/mutation/index.js.map +1 -1
- package/dist/parser/index.d.ts +366 -0
- package/dist/parser/index.js +26 -26
- package/dist/parser/index.js.map +1 -1
- package/dist/query/index.d.ts +723 -0
- package/dist/query/index.js +13124 -10324
- package/dist/query/index.js.map +1 -1
- package/dist/realtime/index.d.ts +44 -0
- package/dist/realtime/index.js +13217 -9297
- package/dist/realtime/index.js.map +1 -1
- package/dist/select-query-parser-CLkOKHzc.d.ts +352 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types-CKsWM8T3.d.ts +62 -0
- package/dist/useBatchUpsert-ooLlpJMg.d.ts +24 -0
- package/dist/useDbCount-B5-Va9sg.d.ts +1740 -0
- package/dist/useDbQuery-C-TL8jY1.d.ts +19 -0
- package/dist/useResolveFeedback-DuGP4Tgb.d.ts +1165 -0
- package/dist/useSupabase-pPhUZHcl.d.ts +27 -0
- package/package.json +31 -7
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RealtimePostgresChangesPayload, PostgrestSingleResponse } from '@supabase/supabase-js';
|
|
2
|
+
import { ItemType } from '@pol-studios/utils';
|
|
3
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
4
|
+
import { U as UseDbQuerySingleReturn } from '../useDbQuery-C-TL8jY1.js';
|
|
5
|
+
import '@supabase-cache-helpers/postgrest-react-query';
|
|
6
|
+
|
|
7
|
+
declare function useRealtime(key: string, query: string, table: string | {
|
|
8
|
+
table: string;
|
|
9
|
+
schema: string;
|
|
10
|
+
}, primaryKeys: string[], options?: {
|
|
11
|
+
filter?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
onChange?: (payload: RealtimePostgresChangesPayload<{
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>) => any;
|
|
16
|
+
}): "SUBSCRIBED" | "TIMED_OUT" | "CLOSED" | "CHANNEL_ERROR";
|
|
17
|
+
|
|
18
|
+
type ConfigurationOptions<T> = {
|
|
19
|
+
crossOrganization?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type FilterOperator = "or" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike" | "is" | "in" | "cs" | "cd" | "fts" | "plfts";
|
|
22
|
+
type ValueType = number | string | boolean | null | Date | object;
|
|
23
|
+
type FilterDefinition = {
|
|
24
|
+
path: string;
|
|
25
|
+
alias?: string;
|
|
26
|
+
operator: FilterOperator;
|
|
27
|
+
negate: boolean;
|
|
28
|
+
value: ValueType;
|
|
29
|
+
};
|
|
30
|
+
type FilterDefinitions = (FilterComposite | FilterDefinition)[];
|
|
31
|
+
type FilterComposite = {
|
|
32
|
+
or?: FilterDefinitions;
|
|
33
|
+
and?: FilterDefinitions;
|
|
34
|
+
};
|
|
35
|
+
type UseRealtimeQueryResult<T> = UseDbQuerySingleReturn<T> & {
|
|
36
|
+
realtimeStatus: "SUBSCRIBED" | "TIMED_OUT" | "CLOSED" | "CHANNEL_ERROR" | "Loading...";
|
|
37
|
+
isRealtimeConnected: boolean;
|
|
38
|
+
isRealtimeLoading: boolean;
|
|
39
|
+
};
|
|
40
|
+
type DataType = Record<string, any>;
|
|
41
|
+
declare function convertFilterToRealtimeQuery(filters: FilterDefinitions): string;
|
|
42
|
+
declare function useRealtimeQuery<Result extends DataType>(query: PromiseLike<PostgrestSingleResponse<Result>>, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & ConfigurationOptions<Result>, primaryKeys?: (keyof ItemType<Result> & string)[]): UseRealtimeQueryResult<Result>;
|
|
43
|
+
|
|
44
|
+
export { type UseRealtimeQueryResult, convertFilterToRealtimeQuery, useRealtimeQuery as useDbRealtimeQuery, useRealtime, useRealtimeQuery };
|