@quatrain/auth-supabase 1.0.4 → 1.1.5
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.
|
@@ -10,7 +10,11 @@ export declare class SupabaseAuthAdapter extends AbstractAuthAdapter {
|
|
|
10
10
|
*/
|
|
11
11
|
register(user: User): Promise<any>;
|
|
12
12
|
getAuthToken(bearer: string): Promise<any>;
|
|
13
|
-
|
|
13
|
+
revokeAuthToken(token: string): Promise<void>;
|
|
14
|
+
signup(login: string, password: string): Promise<false | {
|
|
15
|
+
user: any;
|
|
16
|
+
session: any;
|
|
17
|
+
}>;
|
|
14
18
|
signout(user: User): Promise<any>;
|
|
15
19
|
update(user: User, updatable: any): Promise<any>;
|
|
16
20
|
delete(user: User): Promise<any>;
|
|
@@ -60,8 +60,24 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
60
60
|
throw new Error('Unable to retrieve auth token from Supabase');
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
+
revokeAuthToken(token) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
// Careful, this only delete tokens on client side, not on server side
|
|
66
|
+
const { error } = yield this._client.auth.signOut();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
63
69
|
signup(login, password) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const { data, error } = yield this._client.auth.signInWithPassword({
|
|
72
|
+
email: login,
|
|
73
|
+
password,
|
|
74
|
+
});
|
|
75
|
+
if (error !== null) {
|
|
76
|
+
auth_1.Auth.log(error);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return { user: data.user, session: data.session };
|
|
80
|
+
});
|
|
65
81
|
}
|
|
66
82
|
signout(user) {
|
|
67
83
|
return __awaiter(this, void 0, void 0, function* () { });
|
|
@@ -88,7 +104,11 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
88
104
|
}
|
|
89
105
|
setCustomUserClaims(id, claims) {
|
|
90
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
|
|
107
|
+
auth_1.Auth.log(`Updating user ${id} with claims ${JSON.stringify(claims)}`);
|
|
108
|
+
const { data, error } = yield this._client.auth.admin.updateUserById(id, {
|
|
109
|
+
user_metadata: claims,
|
|
110
|
+
});
|
|
111
|
+
console.log(data, error);
|
|
92
112
|
if (error) {
|
|
93
113
|
throw new Error(error);
|
|
94
114
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/auth-supabase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -9,17 +9,14 @@
|
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
11
|
"author": "Quatrain Développement SAS <developers@quatrain.com>",
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"@quatrain/core": "^1.0.0-beta2"
|
|
14
|
-
},
|
|
15
12
|
"dependencies": {
|
|
16
|
-
"@quatrain/auth": "^1.
|
|
17
|
-
"@supabase/supabase-js": "^2.
|
|
13
|
+
"@quatrain/auth": "^1.1.5",
|
|
14
|
+
"@supabase/supabase-js": "^2.45.1"
|
|
18
15
|
},
|
|
19
16
|
"devDependencies": {
|
|
20
|
-
"@faker-js/faker": "^7.6.0",
|
|
21
17
|
"@tsconfig/recommended": "^1.0.1",
|
|
22
18
|
"@types/jest": "^27.0.3",
|
|
19
|
+
"@types/node": "^22.10.1",
|
|
23
20
|
"jest": "^27.4.7",
|
|
24
21
|
"jest-node-exports-resolver": "^1.1.6",
|
|
25
22
|
"jest-serial-runner": "^1.2.1",
|
|
@@ -32,8 +29,9 @@
|
|
|
32
29
|
"pretest": "tsc",
|
|
33
30
|
"test": "clear && firebase emulators:exec 'jest -i --verbose'",
|
|
34
31
|
"test-ci": "jest --runInBand",
|
|
35
|
-
"build": "tsc
|
|
36
|
-
"
|
|
37
|
-
"
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"wbuild": "tsc --watch",
|
|
34
|
+
"bump-to": "yarn version",
|
|
35
|
+
"publish": "yarn build && yarn npm publish --access public"
|
|
38
36
|
}
|
|
39
|
-
}
|
|
37
|
+
}
|