@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.
Files changed (49) 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-BYYqA6LI.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 +83 -0
  22. package/dist/index-DNrSptau.d.ts +8780 -0
  23. package/dist/index.d.ts +338 -0
  24. package/dist/index.js +10320 -7124
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.web.d.ts +318 -0
  27. package/dist/index.web.js +56795 -0
  28. package/dist/index.web.js.map +1 -0
  29. package/dist/mutation/index.d.ts +58 -0
  30. package/dist/mutation/index.js +4581 -76
  31. package/dist/mutation/index.js.map +1 -1
  32. package/dist/parser/index.d.ts +366 -0
  33. package/dist/parser/index.js +26 -26
  34. package/dist/parser/index.js.map +1 -1
  35. package/dist/query/index.d.ts +723 -0
  36. package/dist/query/index.js +13124 -10324
  37. package/dist/query/index.js.map +1 -1
  38. package/dist/realtime/index.d.ts +44 -0
  39. package/dist/realtime/index.js +13217 -9297
  40. package/dist/realtime/index.js.map +1 -1
  41. package/dist/select-query-parser-CLkOKHzc.d.ts +352 -0
  42. package/dist/types/index.d.ts +6 -0
  43. package/dist/types-CKsWM8T3.d.ts +62 -0
  44. package/dist/useBatchUpsert-ooLlpJMg.d.ts +24 -0
  45. package/dist/useDbCount-B5-Va9sg.d.ts +1740 -0
  46. package/dist/useDbQuery-C-TL8jY1.d.ts +19 -0
  47. package/dist/useResolveFeedback-DuGP4Tgb.d.ts +1165 -0
  48. package/dist/useSupabase-pPhUZHcl.d.ts +27 -0
  49. 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 };