@pol-studios/db 1.0.0 → 1.0.1

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 (45) hide show
  1. package/README.md +434 -0
  2. package/dist/EntityPermissions-DwFt4tUd.d.ts +35 -0
  3. package/dist/FilterConfig-Bt2Ek74z.d.ts +99 -0
  4. package/dist/UserMetadataContext-CeUdM6kV.d.ts +89 -0
  5. package/dist/auth/context.d.ts +47 -0
  6. package/dist/auth/context.js +12791 -0
  7. package/dist/auth/context.js.map +1 -0
  8. package/dist/auth/guards.d.ts +180 -0
  9. package/dist/auth/guards.js +7651 -0
  10. package/dist/auth/guards.js.map +1 -0
  11. package/dist/auth/hooks.d.ts +312 -0
  12. package/dist/auth/hooks.js +10600 -0
  13. package/dist/auth/hooks.js.map +1 -0
  14. package/dist/auth/index.d.ts +10 -0
  15. package/dist/auth/index.js +13035 -0
  16. package/dist/auth/index.js.map +1 -0
  17. package/dist/client/index.d.ts +16 -0
  18. package/dist/core/index.d.ts +508 -0
  19. package/dist/executor-CB4KHyYG.d.ts +507 -0
  20. package/dist/gen/index.d.ts +1099 -0
  21. package/dist/hooks/index.d.ts +6 -0
  22. package/dist/index-CMhJjgef.d.ts +1815 -0
  23. package/dist/index-DNv49L9u.d.ts +8780 -0
  24. package/dist/index.d.ts +1486 -0
  25. package/dist/index.js +10320 -7124
  26. package/dist/index.js.map +1 -1
  27. package/dist/mutation/index.d.ts +58 -0
  28. package/dist/mutation/index.js +4581 -76
  29. package/dist/mutation/index.js.map +1 -1
  30. package/dist/parser/index.d.ts +366 -0
  31. package/dist/parser/index.js +26 -26
  32. package/dist/parser/index.js.map +1 -1
  33. package/dist/query/index.d.ts +723 -0
  34. package/dist/query/index.js +13124 -10324
  35. package/dist/query/index.js.map +1 -1
  36. package/dist/realtime/index.d.ts +44 -0
  37. package/dist/realtime/index.js +13217 -9297
  38. package/dist/realtime/index.js.map +1 -1
  39. package/dist/select-query-parser-CGI40aOg.d.ts +352 -0
  40. package/dist/types/index.d.ts +6 -0
  41. package/dist/types-DjuX1XHy.d.ts +62 -0
  42. package/dist/useBatchUpsert-BHaIk9ID.d.ts +24 -0
  43. package/dist/useDbQuery-C-TL8jY1.d.ts +19 -0
  44. package/dist/useSupabase-DO9kQv2O.d.ts +27 -0
  45. package/package.json +28 -15
@@ -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 };