@fluxbase/sdk 0.0.1-rc.36 → 0.0.1-rc.37
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.cjs +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -4
- package/dist/index.d.ts +21 -4
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -243,9 +243,16 @@ var FluxbaseAuth = class {
|
|
|
243
243
|
*/
|
|
244
244
|
async signUp(credentials) {
|
|
245
245
|
return wrapAsync(async () => {
|
|
246
|
+
const requestBody = {
|
|
247
|
+
email: credentials.email,
|
|
248
|
+
password: credentials.password
|
|
249
|
+
};
|
|
250
|
+
if (credentials.options?.data) {
|
|
251
|
+
requestBody.user_metadata = credentials.options.data;
|
|
252
|
+
}
|
|
246
253
|
const response = await this.fetch.post(
|
|
247
254
|
"/api/v1/auth/signup",
|
|
248
|
-
|
|
255
|
+
requestBody
|
|
249
256
|
);
|
|
250
257
|
if (response.access_token && response.refresh_token) {
|
|
251
258
|
const session = {
|
|
@@ -314,14 +321,28 @@ var FluxbaseAuth = class {
|
|
|
314
321
|
});
|
|
315
322
|
}
|
|
316
323
|
/**
|
|
317
|
-
* Update the current user
|
|
324
|
+
* Update the current user (Supabase-compatible)
|
|
325
|
+
* @param attributes - User attributes to update (email, password, data for metadata)
|
|
318
326
|
*/
|
|
319
|
-
async updateUser(
|
|
327
|
+
async updateUser(attributes) {
|
|
320
328
|
return wrapAsync(async () => {
|
|
321
329
|
if (!this.session) {
|
|
322
330
|
throw new Error("Not authenticated");
|
|
323
331
|
}
|
|
324
|
-
const
|
|
332
|
+
const requestBody = {};
|
|
333
|
+
if (attributes.email) {
|
|
334
|
+
requestBody.email = attributes.email;
|
|
335
|
+
}
|
|
336
|
+
if (attributes.password) {
|
|
337
|
+
requestBody.password = attributes.password;
|
|
338
|
+
}
|
|
339
|
+
if (attributes.data) {
|
|
340
|
+
requestBody.user_metadata = attributes.data;
|
|
341
|
+
}
|
|
342
|
+
if (attributes.nonce) {
|
|
343
|
+
requestBody.nonce = attributes.nonce;
|
|
344
|
+
}
|
|
345
|
+
const user = await this.fetch.patch("/api/v1/auth/user", requestBody);
|
|
325
346
|
if (this.session) {
|
|
326
347
|
this.session.user = user;
|
|
327
348
|
this.saveSession();
|