@supalive/react 0.1.1 → 0.1.5

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 (42) hide show
  1. package/dist/src/index.d.ts +185 -10
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +269 -32
  4. package/dist/src/index.js.map +1 -1
  5. package/package.json +10 -5
  6. package/dist/src/context.d.ts +0 -10
  7. package/dist/src/context.d.ts.map +0 -1
  8. package/dist/src/context.js +0 -12
  9. package/dist/src/context.js.map +0 -1
  10. package/dist/src/create_action.d.ts +0 -11
  11. package/dist/src/create_action.d.ts.map +0 -1
  12. package/dist/src/create_action.js +0 -45
  13. package/dist/src/create_action.js.map +0 -1
  14. package/dist/src/create_live_query.d.ts +0 -28
  15. package/dist/src/create_live_query.d.ts.map +0 -1
  16. package/dist/src/create_live_query.js +0 -49
  17. package/dist/src/create_live_query.js.map +0 -1
  18. package/dist/src/create_mutation.d.ts +0 -20
  19. package/dist/src/create_mutation.d.ts.map +0 -1
  20. package/dist/src/create_mutation.js +0 -64
  21. package/dist/src/create_mutation.js.map +0 -1
  22. package/dist/src/create_query.d.ts +0 -10
  23. package/dist/src/create_query.d.ts.map +0 -1
  24. package/dist/src/create_query.js +0 -46
  25. package/dist/src/create_query.js.map +0 -1
  26. package/dist/src/provider.d.ts +0 -33
  27. package/dist/src/provider.d.ts.map +0 -1
  28. package/dist/src/provider.js +0 -41
  29. package/dist/src/provider.js.map +0 -1
  30. package/dist/src/types.d.ts +0 -56
  31. package/dist/src/types.d.ts.map +0 -1
  32. package/dist/src/types.js +0 -9
  33. package/dist/src/types.js.map +0 -1
  34. package/dist/src/use_connection_state.d.ts +0 -18
  35. package/dist/src/use_connection_state.d.ts.map +0 -1
  36. package/dist/src/use_connection_state.js +0 -14
  37. package/dist/src/use_connection_state.js.map +0 -1
  38. package/dist/src/use_supalive.d.ts +0 -9
  39. package/dist/src/use_supalive.d.ts.map +0 -1
  40. package/dist/src/use_supalive.js +0 -13
  41. package/dist/src/use_supalive.js.map +0 -1
  42. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,45 +0,0 @@
1
- import { useCallback, useRef, useState } from "react";
2
- import { useContextOrThrow } from "./context";
3
- /**
4
- * Typed action hook factory. Same shape as `useMutation` — actions in
5
- * Supalive have the same client-side semantics (single-call, response,
6
- * may be queued during disconnect).
7
- *
8
- * const [bulkUpdate, { status }] = useAction(c => c.bulkUpdateItems);
9
- */
10
- export function createAction(ctx) {
11
- return function useAction(selector) {
12
- const client = useContextOrThrow(ctx);
13
- const selectorRef = useRef(selector);
14
- selectorRef.current = selector;
15
- const [data, setData] = useState(undefined);
16
- const [status, setStatus] = useState("idle");
17
- const [error, setError] = useState(null);
18
- const reset = useCallback(() => {
19
- setData(undefined);
20
- setStatus("idle");
21
- setError(null);
22
- }, []);
23
- const run = useCallback(async (input) => {
24
- setError(null);
25
- setData(undefined);
26
- setStatus("queued");
27
- try {
28
- const result = await selectorRef.current(client).action(input, {
29
- onSend: () => setStatus("loading"),
30
- });
31
- setData(result);
32
- setStatus("success");
33
- return result;
34
- }
35
- catch (err) {
36
- const e = err instanceof Error ? err : new Error(String(err));
37
- setError(e);
38
- setStatus("error");
39
- throw e;
40
- }
41
- }, [client]);
42
- return [run, { data, status, error, reset }];
43
- };
44
- }
45
- //# sourceMappingURL=create_action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_action.js","sourceRoot":"","sources":["../../src/create_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ9C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAU,GAA6B;IACjE,OAAO,SAAS,SAAS,CACvB,QAA0E;QAK1E,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAEtC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAsB,SAAS,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAiB,MAAM,CAAC,CAAC;QAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;QAEvD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,SAAS,CAAC,CAAC;YACnB,SAAS,CAAC,MAAM,CAAC,CAAC;YAClB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,GAAG,GAAG,WAAW,CACrB,KAAK,EAAE,KAAa,EAAoB,EAAE;YACxC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,OAAO,CAAC,SAAS,CAAC,CAAC;YACnB,SAAS,CAAC,QAAQ,CAAC,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE;oBAC7D,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC;iBACnC,CAAC,CAAC;gBACH,OAAO,CAAC,MAAM,CAAC,CAAC;gBAChB,SAAS,CAAC,SAAS,CAAC,CAAC;gBACrB,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,MAAM,CAAC,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9D,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACZ,SAAS,CAAC,OAAO,CAAC,CAAC;gBACnB,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC"}
@@ -1,28 +0,0 @@
1
- import type { SupaliveContext } from "./context";
2
- import type { LiveQueryResult, ProcedureSelector, QueryProcedureLike } from "./types";
3
- /**
4
- * Returns a typed `useLiveQuery` hook bound to a specific client type.
5
- *
6
- * Userland:
7
- * const useLiveQuery = createLiveQuery<SupaliveClient>(SupaliveCtx);
8
- * const { data, status, error } = useLiveQuery(c => c.listItems, { limit: 50 });
9
- *
10
- * Internals (modelled on Convex's `useQuery` + `useSubscription`, but
11
- * using React 18's native `useSyncExternalStore` instead of the legacy
12
- * shim Convex still bundles):
13
- *
14
- * - Selector is fired synchronously to get the procedure object; the
15
- * procedure's `liveQuery(input)` returns a shared `LiveQueryHandle`
16
- * (ref-counted in the client) so multiple components reading the same
17
- * query share one server-side subscription.
18
- * - `useSyncExternalStore(handle.onState, handle.getState)` gives a
19
- * tearing-free, concurrent-safe render path.
20
- * - Re-subscription is keyed off `stableStringify(input)` so an inline
21
- * object literal that produces the same values doesn't churn handles.
22
- *
23
- * Define selectors at module scope (or with `useCallback`) so the reference
24
- * is stable across renders; this isn't required for correctness, but it
25
- * keeps the `useMemo` cheap.
26
- */
27
- export declare function createLiveQuery<TClient>(ctx: SupaliveContext<TClient>): <TInput, TOutput>(selector: ProcedureSelector<TClient, QueryProcedureLike<TInput, TOutput>>, input: TInput) => LiveQueryResult<TOutput>;
28
- //# sourceMappingURL=create_live_query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_live_query.d.ts","sourceRoot":"","sources":["../../src/create_live_query.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAGjB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,IACvC,MAAM,EAAE,OAAO,EAC1C,UAAU,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzE,OAAO,MAAM,KACZ,eAAe,CAAC,OAAO,CAAC,CA+B5B"}
@@ -1,49 +0,0 @@
1
- import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
2
- import { useContextOrThrow } from "./context";
3
- import { stableStringify } from "@supalive/core/types";
4
- /**
5
- * Returns a typed `useLiveQuery` hook bound to a specific client type.
6
- *
7
- * Userland:
8
- * const useLiveQuery = createLiveQuery<SupaliveClient>(SupaliveCtx);
9
- * const { data, status, error } = useLiveQuery(c => c.listItems, { limit: 50 });
10
- *
11
- * Internals (modelled on Convex's `useQuery` + `useSubscription`, but
12
- * using React 18's native `useSyncExternalStore` instead of the legacy
13
- * shim Convex still bundles):
14
- *
15
- * - Selector is fired synchronously to get the procedure object; the
16
- * procedure's `liveQuery(input)` returns a shared `LiveQueryHandle`
17
- * (ref-counted in the client) so multiple components reading the same
18
- * query share one server-side subscription.
19
- * - `useSyncExternalStore(handle.onState, handle.getState)` gives a
20
- * tearing-free, concurrent-safe render path.
21
- * - Re-subscription is keyed off `stableStringify(input)` so an inline
22
- * object literal that produces the same values doesn't churn handles.
23
- *
24
- * Define selectors at module scope (or with `useCallback`) so the reference
25
- * is stable across renders; this isn't required for correctness, but it
26
- * keeps the `useMemo` cheap.
27
- */
28
- export function createLiveQuery(ctx) {
29
- return function useLiveQuery(selector, input) {
30
- const client = useContextOrThrow(ctx);
31
- // Keep the latest selector in a ref. We don't include it in the
32
- // memo deps because selectors are usually inline arrow functions;
33
- // we re-read it on every render but only re-acquire the handle
34
- // when the *input key* changes (or the client identity changes).
35
- const selectorRef = useRef(selector);
36
- selectorRef.current = selector;
37
- const serializedInput = stableStringify(input);
38
- const handle = useMemo(() => selectorRef.current(client).liveQuery(input, serializedInput), [client, serializedInput]);
39
- const state = useSyncExternalStore(handle.onState, handle.getState, handle.getState);
40
- const refetch = useCallback(() => handle.refetch(), [handle]);
41
- return {
42
- data: state.data,
43
- status: state.status,
44
- error: state.error,
45
- refetch,
46
- };
47
- };
48
- }
49
- //# sourceMappingURL=create_live_query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_live_query.js","sourceRoot":"","sources":["../../src/create_live_query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAM9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAAU,GAA6B;IACpE,OAAO,SAAS,YAAY,CAC1B,QAAyE,EACzE,KAAa;QAEb,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAEtC,gEAAgE;QAChE,kEAAkE;QAClE,+DAA+D;QAC/D,iEAAiE;QACjE,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,MAAM,GAA6B,OAAO,CAC9C,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,eAAe,CAAC,EACnE,CAAC,MAAM,EAAE,eAAe,CAAC,CAC1B,CAAC;QAEF,MAAM,KAAK,GAAG,oBAAoB,CAChC,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,QAAQ,CAChB,CAAC;QAEF,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAE9D,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO;SACR,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { SupaliveContext } from "./context";
2
- import type { MutationProcedureLike, MutationState, ProcedureSelector } from "./types";
3
- /**
4
- * Typed mutation hook factory.
5
- *
6
- * const [createItem, { status, error, data, reset }] =
7
- * useMutation(c => c.createItem);
8
- *
9
- * Statuses:
10
- * - "idle" — initial state, or after `reset()`
11
- * - "queued" — call has been queued because the client wasn't ready
12
- * (offline, reconnecting, mid-handshake); we use the
13
- * transport's `onSend` callback to flip to "loading" once
14
- * the request actually leaves the wire
15
- * - "loading" — request is on the wire, awaiting response
16
- * - "success" — server returned success
17
- * - "error" — server returned an error or the call rejected
18
- */
19
- export declare function createMutation<TClient>(ctx: SupaliveContext<TClient>): <TInput, TOutput>(selector: ProcedureSelector<TClient, MutationProcedureLike<TInput, TOutput>>) => [(input: TInput) => Promise<TOutput>, MutationState<TOutput>];
20
- //# sourceMappingURL=create_mutation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_mutation.d.ts","sourceRoot":"","sources":["../../src/create_mutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EAEb,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,IACvC,MAAM,EAAE,OAAO,EACzC,UAAU,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC3E,CACD,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EACnC,aAAa,CAAC,OAAO,CAAC,CACvB,CAkDF"}
@@ -1,64 +0,0 @@
1
- import { useCallback, useRef, useState } from "react";
2
- import { useContextOrThrow } from "./context";
3
- /**
4
- * Typed mutation hook factory.
5
- *
6
- * const [createItem, { status, error, data, reset }] =
7
- * useMutation(c => c.createItem);
8
- *
9
- * Statuses:
10
- * - "idle" — initial state, or after `reset()`
11
- * - "queued" — call has been queued because the client wasn't ready
12
- * (offline, reconnecting, mid-handshake); we use the
13
- * transport's `onSend` callback to flip to "loading" once
14
- * the request actually leaves the wire
15
- * - "loading" — request is on the wire, awaiting response
16
- * - "success" — server returned success
17
- * - "error" — server returned an error or the call rejected
18
- */
19
- export function createMutation(ctx) {
20
- return function useMutation(selector) {
21
- const client = useContextOrThrow(ctx);
22
- const selectorRef = useRef(selector);
23
- selectorRef.current = selector;
24
- const [data, setData] = useState(undefined);
25
- const [status, setStatus] = useState("idle");
26
- const [error, setError] = useState(null);
27
- const reset = useCallback(() => {
28
- setData(undefined);
29
- setStatus("idle");
30
- setError(null);
31
- }, []);
32
- const mutate = useCallback(async (input) => {
33
- setError(null);
34
- setData(undefined);
35
- // We optimistically assume the transport will queue if not ready,
36
- // and the transport's `onSend` will flip us to "loading".
37
- setStatus("queued");
38
- let sent = false;
39
- try {
40
- const result = await selectorRef.current(client).mutate(input, {
41
- onSend: () => {
42
- sent = true;
43
- setStatus("loading");
44
- },
45
- });
46
- // If the call was queued and dispatched in one tick, onSend may
47
- // have fired before this line — `sent` reflects that. Either way
48
- // we end up at "success".
49
- setData(result);
50
- setStatus("success");
51
- return result;
52
- }
53
- catch (err) {
54
- const e = err instanceof Error ? err : new Error(String(err));
55
- setError(e);
56
- setStatus("error");
57
- void sent;
58
- throw e;
59
- }
60
- }, [client]);
61
- return [mutate, { data, status, error, reset }];
62
- };
63
- }
64
- //# sourceMappingURL=create_mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_mutation.js","sourceRoot":"","sources":["../../src/create_mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAU,GAA6B;IACnE,OAAO,SAAS,WAAW,CACzB,QAA4E;QAK5E,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAEtC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAsB,SAAS,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAiB,MAAM,CAAC,CAAC;QAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;QAEvD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,SAAS,CAAC,CAAC;YACnB,SAAS,CAAC,MAAM,CAAC,CAAC;YAClB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,MAAM,GAAG,WAAW,CACxB,KAAK,EAAE,KAAa,EAAoB,EAAE;YACxC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,OAAO,CAAC,SAAS,CAAC,CAAC;YACnB,kEAAkE;YAClE,0DAA0D;YAC1D,SAAS,CAAC,QAAQ,CAAC,CAAC;YACpB,IAAI,IAAI,GAAG,KAAK,CAAC;YACjB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE;oBAC7D,MAAM,EAAE,GAAG,EAAE;wBACX,IAAI,GAAG,IAAI,CAAC;wBACZ,SAAS,CAAC,SAAS,CAAC,CAAC;oBACvB,CAAC;iBACF,CAAC,CAAC;gBACH,gEAAgE;gBAChE,iEAAiE;gBACjE,0BAA0B;gBAC1B,OAAO,CAAC,MAAM,CAAC,CAAC;gBAChB,SAAS,CAAC,SAAS,CAAC,CAAC;gBACrB,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,MAAM,CAAC,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9D,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACZ,SAAS,CAAC,OAAO,CAAC,CAAC;gBACnB,KAAK,IAAI,CAAC;gBACV,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,OAAO,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { SupaliveContext } from "./context";
2
- import type { ProcedureSelector, QueryProcedureLike, QueryResult } from "./types";
3
- /**
4
- * One-shot query (no live updates). Re-runs when the serialised input
5
- * changes. `refetch()` re-issues the same query immediately.
6
- *
7
- * const { data, status, error, refetch } = useQuery(c => c.getItem, { id });
8
- */
9
- export declare function createQuery<TClient>(ctx: SupaliveContext<TClient>): <TInput, TOutput>(selector: ProcedureSelector<TClient, QueryProcedureLike<TInput, TOutput>>, input: TInput) => QueryResult<TOutput>;
10
- //# sourceMappingURL=create_query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_query.d.ts","sourceRoot":"","sources":["../../src/create_query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EAEZ,MAAM,SAAS,CAAC;AAGjB;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,IACvC,MAAM,EAAE,OAAO,EACtC,UAAU,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzE,OAAO,MAAM,KACZ,WAAW,CAAC,OAAO,CAAC,CAuCxB"}
@@ -1,46 +0,0 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
2
- import { useContextOrThrow } from "./context";
3
- import { stableStringify } from "@supalive/core/types";
4
- /**
5
- * One-shot query (no live updates). Re-runs when the serialised input
6
- * changes. `refetch()` re-issues the same query immediately.
7
- *
8
- * const { data, status, error, refetch } = useQuery(c => c.getItem, { id });
9
- */
10
- export function createQuery(ctx) {
11
- return function useQuery(selector, input) {
12
- const client = useContextOrThrow(ctx);
13
- const selectorRef = useRef(selector);
14
- selectorRef.current = selector;
15
- const [data, setData] = useState();
16
- const [status, setStatus] = useState("idle");
17
- const [error, setError] = useState(null);
18
- const [tick, setTick] = useState(0);
19
- const serializedInput = stableStringify(input);
20
- useEffect(() => {
21
- let cancelled = false;
22
- setStatus("loading");
23
- setError(null);
24
- selectorRef.current(client)
25
- .query(input)
26
- .then((result) => {
27
- if (cancelled)
28
- return;
29
- setData(result);
30
- setStatus("success");
31
- })
32
- .catch((err) => {
33
- if (cancelled)
34
- return;
35
- setError(err instanceof Error ? err : new Error(String(err)));
36
- setStatus("error");
37
- });
38
- return () => {
39
- cancelled = true;
40
- };
41
- }, [client, serializedInput, tick]);
42
- const refetch = useCallback(() => setTick((t) => t + 1), []);
43
- return { data, status, error, refetch };
44
- };
45
- }
46
- //# sourceMappingURL=create_query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_query.js","sourceRoot":"","sources":["../../src/create_query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAO9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAU,GAA6B;IAChE,OAAO,SAAS,QAAQ,CACtB,QAAyE,EACzE,KAAa;QAEb,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAEtC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;QAE/B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,EAAuB,CAAC;QACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAc,MAAM,CAAC,CAAC;QAC1D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;QACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAE/C,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,SAAS,GAAG,KAAK,CAAC;YACtB,SAAS,CAAC,SAAS,CAAC,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEf,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;iBACxB,KAAK,CAAC,KAAK,CAAC;iBACZ,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;gBACf,IAAI,SAAS;oBAAE,OAAO;gBACtB,OAAO,CAAC,MAAM,CAAC,CAAC;gBAChB,SAAS,CAAC,SAAS,CAAC,CAAC;YACvB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;gBACtB,IAAI,SAAS;oBAAE,OAAO;gBACtB,QAAQ,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC9D,SAAS,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;YAEL,OAAO,GAAG,EAAE;gBACV,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;QAEpC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
@@ -1,33 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { SupaliveContext } from "./context";
3
- /**
4
- * Minimal shape we need from any client passed through this provider. Both
5
- * `createClient`'s output (which has `WSClientMethods`) and a hand-rolled
6
- * client satisfy it, so the provider stays generic.
7
- */
8
- interface SupaliveLifecycleClient {
9
- connect(): Promise<void>;
10
- disconnect(): void;
11
- }
12
- export interface SupaliveProviderProps<TClient> {
13
- /**
14
- * Either a factory (built each mount, lazy) or a pre-built client. A
15
- * factory matches the Convex pattern of letting the provider own the
16
- * client's lifetime; passing a pre-built client lets you share it with
17
- * non-React callers (SSR, scripts).
18
- */
19
- client: TClient | (() => TClient);
20
- children: ReactNode;
21
- }
22
- /**
23
- * Build a typed `<SupaliveProvider>` for a given `TClient`. Pass the same
24
- * context object to every other hook factory so they share the client.
25
- *
26
- * StrictMode-safe: the client lives on a ref and is never recreated. The
27
- * cleanup schedules `disconnect()` through a 250 ms timer parked on a ref,
28
- * so a synchronous re-mount (as StrictMode does in dev) cancels it before
29
- * the socket is torn down. A real unmount lets the timer fire.
30
- */
31
- export declare function createSupaliveProvider<TClient extends SupaliveLifecycleClient>(ctx: SupaliveContext<TClient>): ({ client, children, }: SupaliveProviderProps<TClient>) => import("react/jsx-runtime").JSX.Element;
32
- export {};
33
- //# sourceMappingURL=provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD;;;;GAIG;AACH,UAAU,uBAAuB;IAC/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB,CAAC,OAAO;IAC5C;;;;;OAKG;IACH,MAAM,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;IAClC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,uBAAuB,EAC5E,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,IAEI,uBAG9B,qBAAqB,CAAC,OAAO,CAAC,6CAgClC"}
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from "react";
3
- /**
4
- * Build a typed `<SupaliveProvider>` for a given `TClient`. Pass the same
5
- * context object to every other hook factory so they share the client.
6
- *
7
- * StrictMode-safe: the client lives on a ref and is never recreated. The
8
- * cleanup schedules `disconnect()` through a 250 ms timer parked on a ref,
9
- * so a synchronous re-mount (as StrictMode does in dev) cancels it before
10
- * the socket is torn down. A real unmount lets the timer fire.
11
- */
12
- export function createSupaliveProvider(ctx) {
13
- return function SupaliveProvider({ client, children, }) {
14
- const clientRef = useRef(null);
15
- const disconnectTimerRef = useRef(null);
16
- if (!clientRef.current) {
17
- clientRef.current = typeof client === "function" ? client() : client;
18
- }
19
- useEffect(() => {
20
- // A pending disconnect from a prior cleanup (StrictMode) — cancel it
21
- // before we'd start a redundant reconnect.
22
- if (disconnectTimerRef.current) {
23
- clearTimeout(disconnectTimerRef.current);
24
- disconnectTimerRef.current = null;
25
- }
26
- const c = clientRef.current;
27
- void c.connect().catch((err) => {
28
- console.error("[Supalive] connect failed:", err);
29
- });
30
- return () => {
31
- disconnectTimerRef.current = setTimeout(() => {
32
- disconnectTimerRef.current = null;
33
- c.disconnect();
34
- }, 250);
35
- };
36
- // eslint-disable-next-line react-hooks/exhaustive-deps
37
- }, []);
38
- return _jsx(ctx.Provider, { value: clientRef.current, children: children });
39
- };
40
- }
41
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAwB1D;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAA6B;IAE7B,OAAO,SAAS,gBAAgB,CAAC,EAC/B,MAAM,EACN,QAAQ,GACuB;QAC/B,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,kBAAkB,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;QAE9E,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YACvB,SAAS,CAAC,OAAO,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAE,MAAwB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC1F,CAAC;QAED,SAAS,CAAC,GAAG,EAAE;YACb,qEAAqE;YACrE,2CAA2C;YAC3C,IAAI,kBAAkB,CAAC,OAAO,EAAE,CAAC;gBAC/B,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBACzC,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAC;YACpC,CAAC;YAED,MAAM,CAAC,GAAG,SAAS,CAAC,OAAQ,CAAC;YAC7B,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;gBACtC,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;YAEH,OAAO,GAAG,EAAE;gBACV,kBAAkB,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC3C,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAC;oBAClC,CAAC,CAAC,UAAU,EAAE,CAAC;gBACjB,CAAC,EAAE,GAAG,CAAC,CAAC;YACV,CAAC,CAAC;YACF,uDAAuD;QACzD,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,KAAC,GAAG,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAG,QAAQ,GAAgB,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * Procedure shapes and hook result types, defined locally to keep this
3
- * package decoupled from any specific app's `ClientFromProcedures` mapping.
4
- * The hook factories take the user's `TClient` as a type parameter; selectors
5
- * pull a single procedure off it and TypeScript infers `TInput` / `TOutput`
6
- * from the selector's return type.
7
- */
8
- import type { LiveQueryHandle, LiveQueryState } from "@supalive/core/client";
9
- export type { LiveQueryState } from "@supalive/core/client";
10
- /** Shape of a query procedure exposed by `ClientFromProcedures`. */
11
- export interface QueryProcedureLike<TInput, TOutput> {
12
- query: (input: TInput) => Promise<TOutput>;
13
- liveQuery: (input: TInput, serializedInput: string) => LiveQueryHandle<TOutput>;
14
- }
15
- /** Shape of a mutation procedure. */
16
- export interface MutationProcedureLike<TInput, TOutput> {
17
- mutate: (input: TInput, opts?: {
18
- onSend?: () => void;
19
- }) => Promise<TOutput>;
20
- }
21
- /** Shape of an action procedure. */
22
- export interface ActionProcedureLike<TInput, TOutput> {
23
- action: (input: TInput, opts?: {
24
- onSend?: () => void;
25
- }) => Promise<TOutput>;
26
- }
27
- /** Selector function used by all hooks. */
28
- export type ProcedureSelector<TClient, TProc> = (client: TClient) => TProc;
29
- export type QueryStatus = "idle" | "loading" | "success" | "error";
30
- export interface QueryResult<T> {
31
- data: T | undefined;
32
- status: QueryStatus;
33
- error: Error | null;
34
- refetch: () => void;
35
- }
36
- export type LiveQueryStatus = LiveQueryState<unknown>["status"];
37
- export interface LiveQueryResult<T> {
38
- data: T | undefined;
39
- status: LiveQueryStatus;
40
- error: Error | null;
41
- refetch: () => void;
42
- }
43
- export type MutationStatus = "idle" | "queued" | "loading" | "success" | "error";
44
- export interface MutationState<T> {
45
- data: T | undefined;
46
- status: MutationStatus;
47
- error: Error | null;
48
- reset: () => void;
49
- }
50
- export interface ActionState<T> {
51
- data: T | undefined;
52
- status: MutationStatus;
53
- error: Error | null;
54
- reset: () => void;
55
- }
56
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,oEAAoE;AACpE,MAAM,WAAW,kBAAkB,CAAC,MAAM,EAAE,OAAO;IACjD,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,KAAK,eAAe,CAAC,OAAO,CAAC,CAAC;CACjF;AAED,qCAAqC;AACrC,MAAM,WAAW,qBAAqB,CAAC,MAAM,EAAE,OAAO;IACpD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7E;AAED,oCAAoC;AACpC,MAAM,WAAW,mBAAmB,CAAC,MAAM,EAAE,OAAO;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7E;AAED,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEnE,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEhE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
package/dist/src/types.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * Procedure shapes and hook result types, defined locally to keep this
3
- * package decoupled from any specific app's `ClientFromProcedures` mapping.
4
- * The hook factories take the user's `TClient` as a type parameter; selectors
5
- * pull a single procedure off it and TypeScript infers `TInput` / `TOutput`
6
- * from the selector's return type.
7
- */
8
- export {};
9
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -1,18 +0,0 @@
1
- import type { ClientPublicState } from "@supalive/core/client";
2
- import type { SupaliveContext } from "./context";
3
- /**
4
- * Shape of any client that surfaces the WS connection state. Both the
5
- * generated `createClient` proxy and a hand-rolled client satisfy it.
6
- */
7
- interface ClientWithState {
8
- onState(listener: (s: ClientPublicState) => void): () => void;
9
- getPublicState(): ClientPublicState;
10
- }
11
- /**
12
- * Returns a `useSupaliveConnectionState` hook for showing connection
13
- * banners ("Reconnecting…", "Offline", etc.) without having to subscribe
14
- * to the client manually.
15
- */
16
- export declare function createUseConnectionState<TClient extends ClientWithState>(ctx: SupaliveContext<TClient>): () => ClientPublicState;
17
- export {};
18
- //# sourceMappingURL=use_connection_state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_connection_state.d.ts","sourceRoot":"","sources":["../../src/use_connection_state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD;;;GAGG;AACH,UAAU,eAAe;IACvB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,cAAc,IAAI,iBAAiB,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,SAAS,eAAe,EACtE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,SAEiB,iBAAiB,CAQhE"}
@@ -1,14 +0,0 @@
1
- import { useSyncExternalStore } from "react";
2
- import { useContextOrThrow } from "./context";
3
- /**
4
- * Returns a `useSupaliveConnectionState` hook for showing connection
5
- * banners ("Reconnecting…", "Offline", etc.) without having to subscribe
6
- * to the client manually.
7
- */
8
- export function createUseConnectionState(ctx) {
9
- return function useSupaliveConnectionState() {
10
- const client = useContextOrThrow(ctx);
11
- return useSyncExternalStore((cb) => client.onState(() => cb()), () => client.getPublicState(), () => client.getPublicState());
12
- };
13
- }
14
- //# sourceMappingURL=use_connection_state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_connection_state.js","sourceRoot":"","sources":["../../src/use_connection_state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAW9C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,GAA6B;IAE7B,OAAO,SAAS,0BAA0B;QACxC,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,oBAAoB,CACzB,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAClC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,EAC7B,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAC9B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { SupaliveContext } from "./context";
2
- /**
3
- * Returns a `useSupalive` hook that yields the typed client. Use this when
4
- * you need to call procedures imperatively (outside the standard query/
5
- * mutation hooks), e.g. inside an event handler that doesn't fit one of
6
- * the higher-level helpers.
7
- */
8
- export declare function createUseSupalive<TClient>(ctx: SupaliveContext<TClient>): () => TClient;
9
- //# sourceMappingURL=use_supalive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_supalive.d.ts","sourceRoot":"","sources":["../../src/use_supalive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,SACvC,OAAO,CAGvC"}
@@ -1,13 +0,0 @@
1
- import { useContextOrThrow } from "./context";
2
- /**
3
- * Returns a `useSupalive` hook that yields the typed client. Use this when
4
- * you need to call procedures imperatively (outside the standard query/
5
- * mutation hooks), e.g. inside an event handler that doesn't fit one of
6
- * the higher-level helpers.
7
- */
8
- export function createUseSupalive(ctx) {
9
- return function useSupalive() {
10
- return useContextOrThrow(ctx);
11
- };
12
- }
13
- //# sourceMappingURL=use_supalive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_supalive.js","sourceRoot":"","sources":["../../src/use_supalive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAU,GAA6B;IACtE,OAAO,SAAS,WAAW;QACzB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC"}