@bounded-sh/client 0.0.3 → 0.0.4

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/dist/hooks/useQuery.d.ts +58 -0
  2. package/dist/{index-2UpSvA7V.js → index-BBLnBZjY.js} +353 -2627
  3. package/dist/index-BBLnBZjY.js.map +1 -0
  4. package/dist/{index-C2JpxGAC.js → index-BMrN-6oK.js} +2 -2
  5. package/dist/{index-C2JpxGAC.js.map → index-BMrN-6oK.js.map} +1 -1
  6. package/dist/{index-DJg-Dduo.esm.js → index-D5Ut2JU7.esm.js} +2 -2
  7. package/dist/{index-DJg-Dduo.esm.js.map → index-D5Ut2JU7.esm.js.map} +1 -1
  8. package/dist/{index-C2yvle9S.esm.js → index-DkWfblRJ.esm.js} +2 -2
  9. package/dist/{index-C2yvle9S.esm.js.map → index-DkWfblRJ.esm.js.map} +1 -1
  10. package/dist/{index-CYVVTWs4.js → index-FYyc3l_y.js} +2 -2
  11. package/dist/{index-CYVVTWs4.js.map → index-FYyc3l_y.js.map} +1 -1
  12. package/dist/{index-DyfiK3_X.esm.js → index-n4fG6EZJ.esm.js} +350 -2628
  13. package/dist/index-n4fG6EZJ.esm.js.map +1 -0
  14. package/dist/{index.browser-pymH6o1X.esm.js → index.browser-CCWEiCH-.esm.js} +2 -2
  15. package/dist/{index.browser-pymH6o1X.esm.js.map → index.browser-CCWEiCH-.esm.js.map} +1 -1
  16. package/dist/{index.browser-BTJZmhY1.js → index.browser-D5evrolK.js} +2 -2
  17. package/dist/{index.browser-BTJZmhY1.js.map → index.browser-D5evrolK.js.map} +1 -1
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.js +5 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/{index.native-BTjBgNiE.esm.js → index.native-D5q2RUeV.esm.js} +82 -2420
  23. package/dist/index.native-D5q2RUeV.esm.js.map +1 -0
  24. package/dist/{index.native-BvsmNFXn.js → index.native-D82ofFXB.js} +84 -2419
  25. package/dist/index.native-D82ofFXB.js.map +1 -0
  26. package/dist/index.native.esm.js +1 -1
  27. package/dist/index.native.js +4 -1
  28. package/dist/index.native.js.map +1 -1
  29. package/dist/{phantom-wallet-provider-CTossIFB.esm.js → phantom-wallet-provider-C8DNu92D.esm.js} +3 -3
  30. package/dist/{phantom-wallet-provider-CTossIFB.esm.js.map → phantom-wallet-provider-C8DNu92D.esm.js.map} +1 -1
  31. package/dist/{phantom-wallet-provider-BXMvoOrI.js → phantom-wallet-provider-CoL7g8Sr.js} +3 -3
  32. package/dist/{phantom-wallet-provider-BXMvoOrI.js.map → phantom-wallet-provider-CoL7g8Sr.js.map} +1 -1
  33. package/dist/{privy-wallet-provider-D64DJ3u4.js → privy-wallet-provider-CV1mU4KR.js} +3 -3
  34. package/dist/{privy-wallet-provider-D64DJ3u4.js.map → privy-wallet-provider-CV1mU4KR.js.map} +1 -1
  35. package/dist/{privy-wallet-provider-1qE_f-DF.esm.js → privy-wallet-provider-De3mfJYo.esm.js} +3 -3
  36. package/dist/{privy-wallet-provider-1qE_f-DF.esm.js.map → privy-wallet-provider-De3mfJYo.esm.js.map} +1 -1
  37. package/dist/{solana-mobile-wallet-provider-9M8U6AA7.esm.js → solana-mobile-wallet-provider-CLCvi-08.esm.js} +2 -2
  38. package/dist/{solana-mobile-wallet-provider-9M8U6AA7.esm.js.map → solana-mobile-wallet-provider-CLCvi-08.esm.js.map} +1 -1
  39. package/dist/{solana-mobile-wallet-provider-C1wQ1DRK.js → solana-mobile-wallet-provider-D9dPbk__.js} +2 -2
  40. package/dist/{solana-mobile-wallet-provider-C1wQ1DRK.js.map → solana-mobile-wallet-provider-D9dPbk__.js.map} +1 -1
  41. package/package.json +2 -2
  42. package/dist/index-2UpSvA7V.js.map +0 -1
  43. package/dist/index-DyfiK3_X.esm.js.map +0 -1
  44. package/dist/index.native-BTjBgNiE.esm.js.map +0 -1
  45. package/dist/index.native-BvsmNFXn.js.map +0 -1
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Reactive realtime query hook — the ergonomic counterpart to the imperative
3
+ * `subscribe(path, { onData })`.
4
+ *
5
+ * `useQuery` subscribes for you and returns an **auto-updating value**, so you
6
+ * never write an `onData` callback (and never trip the classic trap of treating
7
+ * the *first* callback as the final state). `data` always holds the **full,
8
+ * current, read-rule-filtered** result the server last delivered — an array for
9
+ * a collection path, the document (or `null`) for a single-document path — and
10
+ * re-renders whenever ANY writer changes the matching set.
11
+ *
12
+ * ```tsx
13
+ * const { data: rows, loading, error } = useQuery<Presence[]>(
14
+ * `rooms/${roomId}/presence`,
15
+ * { filter: { online: true } },
16
+ * );
17
+ * if (loading) return <Spinner/>;
18
+ * return <>{rows!.map(p => <Peer key={p._id} p={p}/>)}</>; // shows EVERYONE, always
19
+ * ```
20
+ *
21
+ * Mirrors Convex's `useQuery`: there is no callback to get wrong, so a doc
22
+ * another client writes a moment later simply appears in `data` on the next
23
+ * render — there is no "missed cross-writer update".
24
+ *
25
+ * Pass `path = null`/`undefined` to skip subscribing (e.g. until an id is ready);
26
+ * `data` stays `undefined` and `loading` flips to `false`.
27
+ */
28
+ export interface UseQueryOptions {
29
+ /** MongoDB-style filter, same shape as `get()`/`subscribe()`. */
30
+ filter?: Record<string, any>;
31
+ /** Server-side sort, e.g. `{ createdAt: -1 }`. */
32
+ sort?: Record<string, number>;
33
+ /** Natural-language filter (AI), evaluated server-side. */
34
+ prompt?: string;
35
+ /** Also walk nested sub-collections at the path. */
36
+ includeSubPaths?: boolean;
37
+ /** Expand relationship links on each delivered doc. */
38
+ shape?: Record<string, any>;
39
+ /** Cap how many docs the live feed tracks. */
40
+ limit?: number;
41
+ /** Pagination cursor. */
42
+ cursor?: string;
43
+ /** Explicit app id override (else the configured one). */
44
+ appId?: string;
45
+ }
46
+ export interface UseQueryResult<T> {
47
+ /**
48
+ * The full current value the server delivered: an array of documents for a
49
+ * collection path, the document (or `null`) for a single-document path, and
50
+ * `undefined` before the first delivery (or when `path` is nullish).
51
+ */
52
+ data: T | undefined;
53
+ /** `true` until the first delivery arrives. */
54
+ loading: boolean;
55
+ /** The last subscription error, or `null`. */
56
+ error: Error | null;
57
+ }
58
+ export declare function useQuery<T = any>(path: string | null | undefined, options?: UseQueryOptions): UseQueryResult<T>;