@quatrain/auth-supabase 1.0.0-beta4 → 1.0.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { User } from '@quatrain/core';
|
|
2
|
+
import { AbstractAuthAdapter, AuthParameters } from '@quatrain/auth';
|
|
2
3
|
export declare class SupabaseAuthAdapter extends AbstractAuthAdapter {
|
|
3
4
|
protected _client: any;
|
|
4
5
|
constructor(params?: AuthParameters);
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SupabaseAuthAdapter = void 0;
|
|
13
|
-
const
|
|
13
|
+
const auth_1 = require("@quatrain/auth");
|
|
14
14
|
const supabase_js_1 = require("@supabase/supabase-js");
|
|
15
15
|
// Create a single supabase client for interacting with your database
|
|
16
|
-
class SupabaseAuthAdapter extends
|
|
16
|
+
class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
17
17
|
constructor(params = {}) {
|
|
18
18
|
super(params);
|
|
19
19
|
this._client = (0, supabase_js_1.createClient)(params.config.supabaseUrl, params.config.supabaseKey);
|
|
@@ -27,7 +27,7 @@ class SupabaseAuthAdapter extends core_1.AbstractAuthAdapter {
|
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
try {
|
|
29
29
|
const { name: displayName, email, phone: phoneNumber, password, disabled = false, } = user._;
|
|
30
|
-
|
|
30
|
+
auth_1.Auth.log(`[SAA] Adding user '${displayName}'`);
|
|
31
31
|
const { data, error } = yield this._client.auth.signUp({
|
|
32
32
|
email,
|
|
33
33
|
password,
|
|
@@ -39,7 +39,7 @@ class SupabaseAuthAdapter extends core_1.AbstractAuthAdapter {
|
|
|
39
39
|
}
|
|
40
40
|
catch (err) {
|
|
41
41
|
console.log(err);
|
|
42
|
-
throw new
|
|
42
|
+
throw new auth_1.AuthenticationError(err.message);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -60,10 +60,10 @@ class SupabaseAuthAdapter extends core_1.AbstractAuthAdapter {
|
|
|
60
60
|
}
|
|
61
61
|
update(user, updatable) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
|
|
63
|
+
auth_1.Auth.log('auth data to update', JSON.stringify(updatable));
|
|
64
64
|
try {
|
|
65
65
|
if (Object.keys(updatable).length > 0) {
|
|
66
|
-
|
|
66
|
+
auth_1.Auth.log(`Updating ${updatable.displayName} Auth record`);
|
|
67
67
|
// await getAuth().updateUser(user.uid, updatable)
|
|
68
68
|
}
|
|
69
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/auth-supabase",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@quatrain/core": "^1.0.0-beta2"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"@quatrain/auth": "^1.0.0",
|
|
16
17
|
"@supabase/supabase-js": "^2.42.4"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|