squarefi-bff-api-module 1.36.14 → 1.36.15

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.
@@ -1,5 +1,4 @@
1
1
  export const createWalletTransactionsConfig = (walletId) => ({
2
2
  channelName: `wallet-transactions-${walletId}`,
3
- table: 'transactions',
4
- filter: `wallet_id=eq.${walletId}`,
3
+ event: 'tx',
5
4
  });
@@ -1,9 +1,7 @@
1
1
  export interface SubscriptionConfig {
2
2
  channelName: string;
3
- table: string;
4
- schema?: string;
5
- event?: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
6
- filter?: string;
3
+ /** Broadcast event name emitted by the database trigger (realtime.send). */
4
+ event: string;
7
5
  }
8
6
  export interface UseSupabaseSubscriptionProps {
9
7
  config: SubscriptionConfig;
@@ -14,13 +14,8 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true, key
14
14
  subscriptionRef.current = null;
15
15
  }
16
16
  const subscription = supabaseClient
17
- .channel(key || config.channelName)
18
- .on('postgres_changes', {
19
- event: config.event || '*',
20
- schema: config.schema || 'public',
21
- table: config.table,
22
- ...(config.filter && { filter: config.filter }),
23
- }, (payload) => callbackRef.current(payload))
17
+ .channel(key || config.channelName, { config: { private: true } })
18
+ .on('broadcast', { event: config.event }, (payload) => callbackRef.current(payload))
24
19
  .subscribe();
25
20
  subscriptionRef.current = subscription;
26
21
  return () => {
@@ -29,7 +24,7 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true, key
29
24
  subscriptionRef.current = null;
30
25
  }
31
26
  };
32
- }, [enabled, config.channelName, config.table, config.schema, config.event, config.filter, supabaseClient, key]);
27
+ }, [enabled, config.channelName, config.event, supabaseClient, key]);
33
28
  return {
34
29
  isConnected: !!subscriptionRef.current,
35
30
  isClientAvailable: !!supabaseClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.36.14",
3
+ "version": "1.36.15",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",