@motherbase/client 1.3.1 → 1.5.0
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/README.md +127 -13
- package/package.json +10 -2
- package/dist/admin.d.ts +0 -81
- package/dist/admin.d.ts.map +0 -1
- package/dist/admin.js +0 -85
- package/dist/admin.js.map +0 -1
- package/dist/auth.d.ts +0 -233
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -418
- package/dist/auth.js.map +0 -1
- package/dist/channel.d.ts +0 -119
- package/dist/channel.d.ts.map +0 -1
- package/dist/channel.js +0 -213
- package/dist/channel.js.map +0 -1
- package/dist/cookie.d.ts +0 -60
- package/dist/cookie.d.ts.map +0 -1
- package/dist/cookie.js +0 -144
- package/dist/cookie.js.map +0 -1
- package/dist/database.d.ts +0 -169
- package/dist/database.d.ts.map +0 -1
- package/dist/database.js +0 -2
- package/dist/database.js.map +0 -1
- package/dist/devices.d.ts +0 -13
- package/dist/devices.d.ts.map +0 -1
- package/dist/devices.js +0 -13
- package/dist/devices.js.map +0 -1
- package/dist/edge.d.ts +0 -7
- package/dist/edge.d.ts.map +0 -1
- package/dist/edge.js +0 -13
- package/dist/edge.js.map +0 -1
- package/dist/functions.d.ts +0 -24
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -24
- package/dist/functions.js.map +0 -1
- package/dist/http.d.ts +0 -96
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -157
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts +0 -118
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -180
- package/dist/index.js.map +0 -1
- package/dist/mfa.d.ts +0 -109
- package/dist/mfa.d.ts.map +0 -1
- package/dist/mfa.js +0 -134
- package/dist/mfa.js.map +0 -1
- package/dist/postgrest.d.ts +0 -239
- package/dist/postgrest.d.ts.map +0 -1
- package/dist/postgrest.js +0 -467
- package/dist/postgrest.js.map +0 -1
- package/dist/profile.d.ts +0 -16
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -26
- package/dist/profile.js.map +0 -1
- package/dist/realtime.d.ts +0 -114
- package/dist/realtime.d.ts.map +0 -1
- package/dist/realtime.js +0 -372
- package/dist/realtime.js.map +0 -1
- package/dist/rest.d.ts +0 -50
- package/dist/rest.d.ts.map +0 -1
- package/dist/rest.js +0 -75
- package/dist/rest.js.map +0 -1
- package/dist/session.d.ts +0 -36
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -90
- package/dist/session.js.map +0 -1
- package/dist/storage.d.ts +0 -72
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -148
- package/dist/storage.js.map +0 -1
- package/dist/types.d.ts +0 -106
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/dist/auth.js
DELETED
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
import { BackendError, toError } from './http.js';
|
|
2
|
-
import { MfaClient } from './mfa.js';
|
|
3
|
-
import { AuthAdminClient } from './admin.js';
|
|
4
|
-
import { HTTP_ROUTES } from '@motherbase/contracts';
|
|
5
|
-
/** Build a clean Session from the Better Auth auth payload. */
|
|
6
|
-
function toSession(payload) {
|
|
7
|
-
return { accessToken: payload.token, user: payload.user };
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Read the token an OAuth callback left in the URL fragment and return the URL
|
|
11
|
-
* with it removed, so a reload or a shared link cannot replay it.
|
|
12
|
-
*
|
|
13
|
-
* The provider callback cannot answer the SDK with a JSON body: it is a browser
|
|
14
|
-
* redirect. The backend therefore appends `#access_token=…` to the redirect it
|
|
15
|
-
* issues, the same implicit flow supabase-js reads. Exported for testing.
|
|
16
|
-
*/
|
|
17
|
-
export function readAccessTokenFromUrl(href) {
|
|
18
|
-
const hash = href.indexOf('#');
|
|
19
|
-
if (hash === -1)
|
|
20
|
-
return null;
|
|
21
|
-
const params = new URLSearchParams(href.slice(hash + 1));
|
|
22
|
-
const accessToken = params.get('access_token');
|
|
23
|
-
if (!accessToken)
|
|
24
|
-
return null;
|
|
25
|
-
params.delete('access_token');
|
|
26
|
-
params.delete('token_type');
|
|
27
|
-
const rest = params.toString();
|
|
28
|
-
return { accessToken, cleanedHref: `${href.slice(0, hash)}${rest ? `#${rest}` : ''}` };
|
|
29
|
-
}
|
|
30
|
-
const EVENT_MAP = {
|
|
31
|
-
signIn: 'SIGNED_IN',
|
|
32
|
-
signOut: 'SIGNED_OUT',
|
|
33
|
-
tokenRefreshed: 'TOKEN_REFRESHED',
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Supabase-compatible auth client. Maps supabase-js method names onto the
|
|
37
|
-
* Motherbase auth endpoints and reuses the existing token/refresh/session-store
|
|
38
|
-
* machinery. Returns `{ data, error }` and never throws for expected failures.
|
|
39
|
-
*/
|
|
40
|
-
export class AuthClient {
|
|
41
|
-
constructor(http, store) {
|
|
42
|
-
this.http = http;
|
|
43
|
-
this.store = store;
|
|
44
|
-
// A successful verify can return a stepped-up session, so mfa re-runs the
|
|
45
|
-
// session read through the same path every other method uses.
|
|
46
|
-
this.mfa = new MfaClient(http, async () => {
|
|
47
|
-
await this.refreshSession();
|
|
48
|
-
});
|
|
49
|
-
this.admin = new AuthAdminClient(http);
|
|
50
|
-
}
|
|
51
|
-
async signUp(credentials) {
|
|
52
|
-
try {
|
|
53
|
-
const payload = await this.http.request(HTTP_ROUTES.authSignUp, {
|
|
54
|
-
method: 'POST',
|
|
55
|
-
body: { email: credentials.email, password: credentials.password, name: credentials.username ?? credentials.email },
|
|
56
|
-
anonymous: true,
|
|
57
|
-
raw: true,
|
|
58
|
-
});
|
|
59
|
-
const session = await this.persist(payload);
|
|
60
|
-
return { data: { user: session.user, session }, error: null };
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async signInWithPassword(credentials) {
|
|
67
|
-
try {
|
|
68
|
-
const payload = await this.http.request(HTTP_ROUTES.authSignIn, {
|
|
69
|
-
method: 'POST',
|
|
70
|
-
body: { email: credentials.email, password: credentials.password },
|
|
71
|
-
anonymous: true,
|
|
72
|
-
raw: true,
|
|
73
|
-
});
|
|
74
|
-
const session = await this.persist(payload);
|
|
75
|
-
return { data: { user: session.user, session }, error: null };
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Request a password-reset OTP by email. Always resolves successfully
|
|
83
|
-
* (whether or not the email is registered) to avoid leaking account
|
|
84
|
-
* existence; check `error` only for transport/server failures.
|
|
85
|
-
*/
|
|
86
|
-
async resetPasswordForEmail(email) {
|
|
87
|
-
try {
|
|
88
|
-
await this.http.request(HTTP_ROUTES.authRequestPasswordReset, {
|
|
89
|
-
method: 'POST',
|
|
90
|
-
body: { email },
|
|
91
|
-
anonymous: true,
|
|
92
|
-
raw: true,
|
|
93
|
-
});
|
|
94
|
-
return { error: null };
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
return { error: toError(err) };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/** Complete a password reset using the OTP sent to the user's email. */
|
|
101
|
-
async resetPassword(args) {
|
|
102
|
-
try {
|
|
103
|
-
await this.http.request(HTTP_ROUTES.authResetPassword, {
|
|
104
|
-
method: 'POST',
|
|
105
|
-
body: { email: args.email, otp: args.otp, password: args.password },
|
|
106
|
-
anonymous: true,
|
|
107
|
-
raw: true,
|
|
108
|
-
});
|
|
109
|
-
return { error: null };
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
return { error: toError(err) };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/** Send a one-time sign-in code by email. Pair with `verifyOtp` to complete sign-in. */
|
|
116
|
-
async signInWithOtp(credentials) {
|
|
117
|
-
try {
|
|
118
|
-
await this.http.request(HTTP_ROUTES.authSendOtp, {
|
|
119
|
-
method: 'POST',
|
|
120
|
-
body: { email: credentials.email, type: 'sign-in' },
|
|
121
|
-
anonymous: true,
|
|
122
|
-
raw: true,
|
|
123
|
-
});
|
|
124
|
-
return { data: {}, error: null };
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
return { data: {}, error: toError(err) };
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/** Complete a `signInWithOtp` sign-in using the code sent to the user's email. */
|
|
131
|
-
async verifyOtp(params) {
|
|
132
|
-
try {
|
|
133
|
-
const payload = await this.http.request(HTTP_ROUTES.authSignInEmailOtp, {
|
|
134
|
-
method: 'POST',
|
|
135
|
-
body: { email: params.email, otp: params.token },
|
|
136
|
-
anonymous: true,
|
|
137
|
-
raw: true,
|
|
138
|
-
});
|
|
139
|
-
const session = await this.persist(payload);
|
|
140
|
-
return { data: { user: session.user, session }, error: null };
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Start an OAuth sign-in with a configured social provider. Resolves with the
|
|
148
|
-
* provider's authorize URL and, in a browser, redirects to it immediately
|
|
149
|
-
* unless `options.skipBrowserRedirect` is set.
|
|
150
|
-
*/
|
|
151
|
-
async signInWithOAuth(credentials) {
|
|
152
|
-
// In a browser, hand the whole handshake to a top-level navigation. Starting
|
|
153
|
-
// it with a fetch makes the OAuth state cookie a cross-site write, which
|
|
154
|
-
// Safari and Firefox drop outright and Chrome drops in incognito, and the
|
|
155
|
-
// callback then fails with state_mismatch. Navigating to the backend's own
|
|
156
|
-
// origin makes that cookie first-party, so a plain SameSite=Lax cookie
|
|
157
|
-
// survives everywhere. The backend redirects on from there.
|
|
158
|
-
if (typeof window !== 'undefined' && !credentials.options?.skipBrowserRedirect) {
|
|
159
|
-
const params = new URLSearchParams();
|
|
160
|
-
if (credentials.options?.redirectTo)
|
|
161
|
-
params.set('callbackURL', credentials.options.redirectTo);
|
|
162
|
-
const query = params.toString();
|
|
163
|
-
const url = this.http.url(`${HTTP_ROUTES.authSignInSocial}/${encodeURIComponent(credentials.provider)}${query ? `?${query}` : ''}`);
|
|
164
|
-
window.location.href = url;
|
|
165
|
-
return { data: { provider: credentials.provider, url }, error: null };
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
const payload = await this.http.request(HTTP_ROUTES.authSignInSocial, {
|
|
169
|
-
method: 'POST',
|
|
170
|
-
body: {
|
|
171
|
-
provider: credentials.provider,
|
|
172
|
-
callbackURL: credentials.options?.redirectTo,
|
|
173
|
-
scopes: credentials.options?.scopes ? credentials.options.scopes.split(' ') : undefined,
|
|
174
|
-
disableRedirect: true,
|
|
175
|
-
},
|
|
176
|
-
anonymous: true,
|
|
177
|
-
raw: true,
|
|
178
|
-
// The server answers with a signed OAuth state cookie it checks again on
|
|
179
|
-
// the provider callback. Without 'include' the browser drops that cookie
|
|
180
|
-
// on a cross-origin call and every callback fails with state_mismatch.
|
|
181
|
-
credentials: 'include',
|
|
182
|
-
});
|
|
183
|
-
const url = payload?.url ?? null;
|
|
184
|
-
if (url && !credentials.options?.skipBrowserRedirect && typeof window !== 'undefined') {
|
|
185
|
-
window.location.href = url;
|
|
186
|
-
}
|
|
187
|
-
return { data: { provider: credentials.provider, url }, error: null };
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
return { data: { provider: credentials.provider, url: null }, error: toError(err) };
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Start an enterprise SSO sign-in. Identify the provider by the user's email
|
|
195
|
-
* domain, by an explicit `domain`, or by `providerId` when you already know
|
|
196
|
-
* which one to use.
|
|
197
|
-
*
|
|
198
|
-
* Resolves with the identity provider's URL and, in a browser, redirects to it
|
|
199
|
-
* unless `options.skipBrowserRedirect` is set. The project must have the SSO
|
|
200
|
-
* plugin enabled and at least one provider registered (Studio →
|
|
201
|
-
* Authentication → Organizations & SSO).
|
|
202
|
-
*/
|
|
203
|
-
async signInWithSSO(params) {
|
|
204
|
-
if (!params.domain && !params.email && !params.providerId && !params.organizationSlug) {
|
|
205
|
-
return { data: { url: null }, error: { message: 'signInWithSSO needs a domain, email, providerId or organizationSlug' } };
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
const payload = await this.http.request('/api/auth/sign-in/sso', {
|
|
209
|
-
method: 'POST',
|
|
210
|
-
body: {
|
|
211
|
-
...(params.domain ? { domain: params.domain } : {}),
|
|
212
|
-
...(params.email ? { email: params.email } : {}),
|
|
213
|
-
...(params.providerId ? { providerId: params.providerId } : {}),
|
|
214
|
-
...(params.organizationSlug ? { organizationSlug: params.organizationSlug } : {}),
|
|
215
|
-
callbackURL: params.options?.redirectTo,
|
|
216
|
-
},
|
|
217
|
-
anonymous: true,
|
|
218
|
-
raw: true,
|
|
219
|
-
credentials: 'include', // Same OAuth state cookie as signInWithOAuth.
|
|
220
|
-
});
|
|
221
|
-
const url = payload?.url ?? null;
|
|
222
|
-
if (url && !params.options?.skipBrowserRedirect && typeof window !== 'undefined') {
|
|
223
|
-
window.location.href = url;
|
|
224
|
-
}
|
|
225
|
-
return { data: { url }, error: null };
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
return { data: { url: null }, error: toError(err) };
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Update the signed-in user's profile fields and/or password. Password
|
|
233
|
-
* changes require `currentPassword` (a Better Auth requirement — there is no
|
|
234
|
-
* blind password overwrite from an authenticated session).
|
|
235
|
-
*/
|
|
236
|
-
async updateUser(attributes) {
|
|
237
|
-
try {
|
|
238
|
-
if (attributes.data && Object.keys(attributes.data).length > 0) {
|
|
239
|
-
await this.http.request(HTTP_ROUTES.authUpdateUser, { method: 'POST', body: attributes.data, raw: true });
|
|
240
|
-
}
|
|
241
|
-
if (attributes.password) {
|
|
242
|
-
if (!attributes.currentPassword) {
|
|
243
|
-
return { data: { user: null }, error: { message: '`currentPassword` is required to change the password.' } };
|
|
244
|
-
}
|
|
245
|
-
await this.http.request(HTTP_ROUTES.authChangePassword, {
|
|
246
|
-
method: 'POST',
|
|
247
|
-
body: { newPassword: attributes.password, currentPassword: attributes.currentPassword },
|
|
248
|
-
raw: true,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return await this.getUser();
|
|
252
|
-
}
|
|
253
|
-
catch (err) {
|
|
254
|
-
return { data: { user: null }, error: toError(err) };
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Permanently delete the signed-in user's account. Not part of the
|
|
259
|
-
* supabase-js client surface (there it's admin-only) — kept here because
|
|
260
|
-
* self-service account deletion is a real product need. Requires the
|
|
261
|
-
* backend's `delete-user` flow to be enabled; clears the local session on
|
|
262
|
-
* success.
|
|
263
|
-
*/
|
|
264
|
-
async deleteUser(attributes = {}) {
|
|
265
|
-
try {
|
|
266
|
-
await this.http.request(HTTP_ROUTES.authDeleteUser, {
|
|
267
|
-
method: 'POST',
|
|
268
|
-
body: attributes,
|
|
269
|
-
raw: true,
|
|
270
|
-
});
|
|
271
|
-
await this.store.set(null, 'signOut');
|
|
272
|
-
return { error: null };
|
|
273
|
-
}
|
|
274
|
-
catch (err) {
|
|
275
|
-
return { error: toError(err) };
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Adopt an externally-obtained access token as the current session (e.g. one
|
|
280
|
-
* captured from an OAuth redirect). Validates it against the server before
|
|
281
|
-
* persisting. `refresh_token` is accepted for supabase-js signature parity
|
|
282
|
-
* and unused — Better Auth bearer sessions have none.
|
|
283
|
-
*/
|
|
284
|
-
async setSession(currentSession) {
|
|
285
|
-
await this.store.set({ accessToken: currentSession.access_token, user: { id: '', email: '' } }, 'signIn');
|
|
286
|
-
try {
|
|
287
|
-
const payload = await this.http.request(HTTP_ROUTES.authSession, { raw: true });
|
|
288
|
-
if (!payload?.user) {
|
|
289
|
-
await this.store.set(null, 'signOut');
|
|
290
|
-
return { data: { user: null, session: null }, error: { message: 'Invalid session' } };
|
|
291
|
-
}
|
|
292
|
-
const session = { accessToken: currentSession.access_token, user: payload.user };
|
|
293
|
-
await this.store.set(session, 'signIn');
|
|
294
|
-
return { data: { user: session.user, session }, error: null };
|
|
295
|
-
}
|
|
296
|
-
catch (err) {
|
|
297
|
-
await this.store.set(null, 'signOut');
|
|
298
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
async signOut() {
|
|
302
|
-
try {
|
|
303
|
-
await this.http.request(HTTP_ROUTES.authSignOut, { method: 'POST', raw: true });
|
|
304
|
-
}
|
|
305
|
-
catch {
|
|
306
|
-
// best-effort; clear locally regardless
|
|
307
|
-
}
|
|
308
|
-
await this.store.set(null, 'signOut');
|
|
309
|
-
return { error: null };
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Finish an OAuth / SSO sign-in after the provider redirected back.
|
|
313
|
-
*
|
|
314
|
-
* `signInWithOAuth` only starts the flow; the session is created during the
|
|
315
|
-
* redirect the browser makes to the backend callback, so the SDK has to pick
|
|
316
|
-
* it up from the URL the browser landed on. Call this once on the page you
|
|
317
|
-
* pointed `redirectTo` at (or on app start, which is where supabase-js does
|
|
318
|
-
* the equivalent). Without it the user is signed in on the backend and signed
|
|
319
|
-
* out in your app.
|
|
320
|
-
*
|
|
321
|
-
* Resolves with a null session and no error when there is nothing to read, so
|
|
322
|
-
* it is safe to call on every page load.
|
|
323
|
-
*/
|
|
324
|
-
async getSessionFromUrl(href) {
|
|
325
|
-
const url = href ?? (typeof window !== 'undefined' ? window.location.href : undefined);
|
|
326
|
-
const found = url ? readAccessTokenFromUrl(url) : null;
|
|
327
|
-
if (!found)
|
|
328
|
-
return { data: { user: null, session: null }, error: null };
|
|
329
|
-
// Strip the token before the network call: a failed lookup must not leave a
|
|
330
|
-
// usable token sitting in the address bar or in the back/forward history.
|
|
331
|
-
if (!href && typeof window !== 'undefined') {
|
|
332
|
-
window.history?.replaceState?.(window.history.state, '', found.cleanedHref);
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
// Resolve the user with the token explicitly rather than storing it first:
|
|
336
|
-
// a rejected token must not emit a SIGNED_IN event carrying a null user.
|
|
337
|
-
const payload = await this.http.request(HTTP_ROUTES.authSession, {
|
|
338
|
-
raw: true,
|
|
339
|
-
anonymous: true,
|
|
340
|
-
headers: { Authorization: `Bearer ${found.accessToken}` },
|
|
341
|
-
});
|
|
342
|
-
if (!payload?.user) {
|
|
343
|
-
return { data: { user: null, session: null }, error: { message: 'OAuth session is no longer valid' } };
|
|
344
|
-
}
|
|
345
|
-
const session = await this.persist({ token: found.accessToken, user: payload.user });
|
|
346
|
-
return { data: { user: session.user, session }, error: null };
|
|
347
|
-
}
|
|
348
|
-
catch (err) {
|
|
349
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
/** Fetch the current user from Better Auth (requires a valid session). */
|
|
353
|
-
async getUser() {
|
|
354
|
-
try {
|
|
355
|
-
const payload = await this.http.request(HTTP_ROUTES.authSession, { raw: true });
|
|
356
|
-
return { data: { user: payload?.user ?? null }, error: null };
|
|
357
|
-
}
|
|
358
|
-
catch (err) {
|
|
359
|
-
return { data: { user: null }, error: toError(err) };
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
/** The locally-held session, if any (no network call). */
|
|
363
|
-
async getSession() {
|
|
364
|
-
await this.store.hydrate();
|
|
365
|
-
return { data: { session: this.store.get() }, error: null };
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Revalidate the current session against the server. Better Auth bearer
|
|
369
|
-
* sessions have no refresh token — if the session is still valid the user is
|
|
370
|
-
* refreshed; otherwise the local session is cleared.
|
|
371
|
-
*/
|
|
372
|
-
async refreshSession() {
|
|
373
|
-
await this.store.hydrate();
|
|
374
|
-
const current = this.store.get();
|
|
375
|
-
if (!current?.accessToken) {
|
|
376
|
-
return { data: { user: null, session: null }, error: { message: 'Auth session missing!' } };
|
|
377
|
-
}
|
|
378
|
-
try {
|
|
379
|
-
const payload = await this.http.request(HTTP_ROUTES.authSession, { raw: true, _retry: true });
|
|
380
|
-
if (!payload?.user) {
|
|
381
|
-
await this.store.set(null, 'signOut');
|
|
382
|
-
return { data: { user: null, session: null }, error: { message: 'Session expired' } };
|
|
383
|
-
}
|
|
384
|
-
const session = { accessToken: current.accessToken, user: payload.user };
|
|
385
|
-
await this.store.set(session, 'tokenRefreshed');
|
|
386
|
-
return { data: { user: session.user, session }, error: null };
|
|
387
|
-
}
|
|
388
|
-
catch (err) {
|
|
389
|
-
// Only a rejected token clears the session. A network failure or a 5xx
|
|
390
|
-
// must leave it intact: middleware runs this on every navigation, so
|
|
391
|
-
// one backend hiccup would otherwise sign the user out.
|
|
392
|
-
const status = err instanceof BackendError ? err.httpStatus : 0;
|
|
393
|
-
if (status === 401 || status === 403)
|
|
394
|
-
await this.store.set(null, 'signOut');
|
|
395
|
-
return { data: { user: null, session: null }, error: toError(err) };
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
onAuthStateChange(callback) {
|
|
399
|
-
const unsubscribe = this.store.subscribe((event, session) => {
|
|
400
|
-
callback(EVENT_MAP[event], session);
|
|
401
|
-
});
|
|
402
|
-
return { data: { subscription: { unsubscribe } } };
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Internal: refresh used by the HttpClient's 401 path. Returns true on success.
|
|
406
|
-
* Not part of the public Supabase surface.
|
|
407
|
-
*/
|
|
408
|
-
async _refresh() {
|
|
409
|
-
const result = await this.refreshSession();
|
|
410
|
-
return result.error === null;
|
|
411
|
-
}
|
|
412
|
-
async persist(payload) {
|
|
413
|
-
const session = toSession(payload);
|
|
414
|
-
await this.store.set(session, 'signIn');
|
|
415
|
-
return session;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA8EpD,+DAA+D;AAC/D,SAAS,SAAS,CAAC,OAAoB;IACrC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/C,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC9B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC/B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CA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timeModule } from './realtime.js';
|
|
2
|
-
import type { RealtimeTopicEnvelope } from '@motherbase/contracts';
|
|
3
|
-
export type PostgresChangeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
4
|
-
export interface PostgresChangeFilter {
|
|
5
|
-
event: PostgresChangeEvent;
|
|
6
|
-
schema?: string;
|
|
7
|
-
table: string;
|
|
8
|
-
/** PostgREST-style column filter, e.g. `room_id=eq.42`. Applied server-side in sub-project #4. */
|
|
9
|
-
filter?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface PostgresChangePayload<T = Record<string, unknown>> {
|
|
12
|
-
schema: string;
|
|
13
|
-
table: string;
|
|
14
|
-
eventType: 'INSERT' | 'UPDATE' | 'DELETE';
|
|
15
|
-
new: T | Record<string, never>;
|
|
16
|
-
old: T | Record<string, never>;
|
|
17
|
-
commit_timestamp: string;
|
|
18
|
-
}
|
|
19
|
-
export interface BroadcastFilter {
|
|
20
|
-
event: string;
|
|
21
|
-
}
|
|
22
|
-
export interface PresenceFilter {
|
|
23
|
-
event: 'sync' | 'join' | 'leave';
|
|
24
|
-
}
|
|
25
|
-
export interface BroadcastMessage {
|
|
26
|
-
type: 'broadcast';
|
|
27
|
-
event: string;
|
|
28
|
-
payload?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
export interface BroadcastReceived {
|
|
31
|
-
type: 'broadcast';
|
|
32
|
-
event: string;
|
|
33
|
-
payload: unknown;
|
|
34
|
-
}
|
|
35
|
-
export interface PresenceEntry {
|
|
36
|
-
presence_ref: string;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
export type PresenceState<T extends Record<string, unknown> = Record<string, unknown>> = Record<string, Array<T & {
|
|
40
|
-
presence_ref: string;
|
|
41
|
-
}>>;
|
|
42
|
-
export interface PresenceJoinPayload {
|
|
43
|
-
key: string;
|
|
44
|
-
newPresences: PresenceEntry[];
|
|
45
|
-
currentPresences: PresenceEntry[];
|
|
46
|
-
}
|
|
47
|
-
export interface PresenceLeavePayload {
|
|
48
|
-
key: string;
|
|
49
|
-
leftPresences: PresenceEntry[];
|
|
50
|
-
currentPresences: PresenceEntry[];
|
|
51
|
-
}
|
|
52
|
-
export type ChannelStatus = 'SUBSCRIBED' | 'TIMED_OUT' | 'CLOSED' | 'CHANNEL_ERROR';
|
|
53
|
-
export interface RealtimeChannelOptions {
|
|
54
|
-
config?: {
|
|
55
|
-
broadcast?: {
|
|
56
|
-
self?: boolean;
|
|
57
|
-
ack?: boolean;
|
|
58
|
-
};
|
|
59
|
-
presence?: {
|
|
60
|
-
key?: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Supabase-compatible realtime channel. Multiplexes broadcast, presence, and
|
|
66
|
-
* postgres_changes over a single topic. `postgres_changes` is delivered through
|
|
67
|
-
* the RealtimeModule.watchTable bridge in this release; broadcast/presence are
|
|
68
|
-
* routed by topic via rt:msg envelopes.
|
|
69
|
-
*/
|
|
70
|
-
export declare class RealtimeChannel {
|
|
71
|
-
readonly topic: string;
|
|
72
|
-
private readonly realtime;
|
|
73
|
-
private readonly options;
|
|
74
|
-
private readonly pgBindings;
|
|
75
|
-
private readonly broadcastBindings;
|
|
76
|
-
private readonly presenceBindings;
|
|
77
|
-
private status;
|
|
78
|
-
private presence;
|
|
79
|
-
/** Settles when the current subscribe() attempt has an ack (or has failed). */
|
|
80
|
-
private ready;
|
|
81
|
-
private onStatus?;
|
|
82
|
-
/** Last state passed to track(), replayed after a reconnect. */
|
|
83
|
-
private trackedState;
|
|
84
|
-
constructor(topic: string, realtime: RealtimeModule, options?: RealtimeChannelOptions);
|
|
85
|
-
on(type: 'broadcast', filter: BroadcastFilter, callback: (payload: BroadcastReceived) => void): this;
|
|
86
|
-
on(type: 'presence', filter: PresenceFilter, callback: (payload: unknown) => void): this;
|
|
87
|
-
on(type: 'postgres_changes', filter: PostgresChangeFilter, callback: (payload: PostgresChangePayload) => void): this;
|
|
88
|
-
/**
|
|
89
|
-
* Join the topic. Returns `this` (supabase-js shape), so it is NOT awaitable:
|
|
90
|
-
* `send()` / `track()` / `untrack()` issued straight after are queued until the
|
|
91
|
-
* join is acked instead of leaving early and being rejected by the server.
|
|
92
|
-
*/
|
|
93
|
-
subscribe(onStatus?: (status: ChannelStatus, err?: Error) => void, timeoutMs?: number): this;
|
|
94
|
-
unsubscribe(): Promise<'ok'>;
|
|
95
|
-
/**
|
|
96
|
-
* Broadcast a message to the topic. Other clients on the topic with a matching
|
|
97
|
-
* `on('broadcast', { event })` binding receive it; the sender receives its own
|
|
98
|
-
* message only when the channel was created with `config.broadcast.self`.
|
|
99
|
-
* With `config.broadcast.ack`, resolves on the server ack.
|
|
100
|
-
*/
|
|
101
|
-
send(message: BroadcastMessage): Promise<'ok' | 'timed out' | 'error'>;
|
|
102
|
-
/** Announce this client's presence on the topic with the given state. */
|
|
103
|
-
track(state: Record<string, unknown>): Promise<'ok' | 'timed out' | 'error'>;
|
|
104
|
-
/** Remove this client's presence from the topic. */
|
|
105
|
-
untrack(): Promise<'ok' | 'timed out' | 'error'>;
|
|
106
|
-
/** Current presence state, keyed by presence key. */
|
|
107
|
-
presenceState<T extends Record<string, unknown> = Record<string, unknown>>(): PresenceState<T>;
|
|
108
|
-
/** Wait for a pending subscribe() to settle; false when the topic is not joined. */
|
|
109
|
-
private subscribed;
|
|
110
|
-
private setStatus;
|
|
111
|
-
/** Internal: the module replayed this topic's join on a new socket. */
|
|
112
|
-
_rejoined(ok: boolean): void;
|
|
113
|
-
/** Internal: receive a topic envelope routed by RealtimeModule. */
|
|
114
|
-
_receive(envelope: RealtimeTopicEnvelope): void;
|
|
115
|
-
private applyPresenceState;
|
|
116
|
-
private emitPresence;
|
|
117
|
-
private buildConfig;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=channel.d.ts.map
|
package/dist/channel.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","s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