@tabl.io/auth 0.3.1 → 0.3.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.
- package/dist/index.d.ts +27 -0
- package/dist/index.js +707 -625
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { PersistOptions } from 'zustand/middleware';
|
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { QueryClientConfig } from '@tanstack/react-query';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
|
+
import { RealtimePostgresChangesPayload } from '@supabase/supabase-js';
|
|
6
7
|
import { StoreApi } from 'zustand';
|
|
7
8
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
8
9
|
import { UseBoundStore } from 'zustand';
|
|
@@ -125,6 +126,32 @@ export declare interface LoginPageProps {
|
|
|
125
126
|
logo?: React.ReactNode;
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
export declare type RealtimeEventType = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
130
|
+
|
|
131
|
+
export declare type RealtimeListener<T extends Record<string, unknown> = Record<string, unknown>> = (payload: RealtimePostgresChangesPayload<T>) => void;
|
|
132
|
+
|
|
133
|
+
declare class RealtimeRegistry {
|
|
134
|
+
private readonly tables;
|
|
135
|
+
private supabase;
|
|
136
|
+
private authWatchActive;
|
|
137
|
+
/**
|
|
138
|
+
* Registra um listener para eventos de uma tabela.
|
|
139
|
+
* Canal criado no primeiro registro, destruído no último unsubscribe.
|
|
140
|
+
*
|
|
141
|
+
* IMPORTANTE: a tabela precisa estar na publication do Supabase Realtime
|
|
142
|
+
* (`ALTER PUBLICATION supabase_realtime ADD TABLE <tabela>`).
|
|
143
|
+
* Subscrever uma tabela fora da publication gera CHANNEL_ERROR em loop.
|
|
144
|
+
*/
|
|
145
|
+
subscribe(supabase: SupabaseClient, table: string, event: RealtimeEventType, listener: RealtimeListener): () => void;
|
|
146
|
+
private watchAuth;
|
|
147
|
+
private reconnectAll;
|
|
148
|
+
private createChannel;
|
|
149
|
+
private dispatch;
|
|
150
|
+
private scheduleReconnect;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export declare const realtimeRegistry: RealtimeRegistry;
|
|
154
|
+
|
|
128
155
|
/**
|
|
129
156
|
* Wrapper declarativo que protege conteúdo por role.
|
|
130
157
|
* Não redireciona — use `useRequireRole` para redirecionamento de rota.
|