@quatrain/auth-supabase 1.1.14 → 1.1.16

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 ADDED
@@ -0,0 +1,28 @@
1
+ # @quatrain/auth-supabase
2
+
3
+ An authentication adapter for Supabase Auth. This package provides a seamless integration between Quatrain and Supabase's GoTrue-based authentication service.
4
+
5
+ ## Features
6
+
7
+ - Implements the `@quatrain/auth` abstract adapter.
8
+ - Works with both Supabase SaaS and self-hosted instances.
9
+ - Leverages Supabase's Row-Level Security (RLS) for data access.
10
+ - Uses the `@supabase/supabase-js` library.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @quatrain/auth-supabase @supabase/supabase-js
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { Auth } from '@quatrain/auth'
22
+ import { SupabaseAuthAdapter } from '@quatrain/auth-supabase'
23
+
24
+ const adapter = new SupabaseAuthAdapter({
25
+ config: { url: '...', anonKey: '...' },
26
+ })
27
+ Auth.addAdapter(adapter, 'default', true)
28
+ ```
@@ -8,7 +8,7 @@ export declare class SupabaseAuthAdapter extends AbstractAuthAdapter {
8
8
  * @param user
9
9
  * @returns user unique id
10
10
  */
11
- register(user: User): Promise<any>;
11
+ register(user: User, clearPassword?: string): Promise<any>;
12
12
  getAuthToken(bearer: string): Promise<any>;
13
13
  refreshToken(refreshToken: string): Promise<any>;
14
14
  revokeAuthToken(token: string): Promise<void>;
@@ -46,20 +46,21 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
46
46
  persistSession: false,
47
47
  },
48
48
  });
49
+ auth_1.Auth.info(`Created Supabase client for ${params.config.supabaseUrl}`);
49
50
  }
50
51
  /**
51
52
  * Register new user in authentication
52
53
  * @param user
53
54
  * @returns user unique id
54
55
  */
55
- register(user) {
56
+ register(user, clearPassword) {
56
57
  return __awaiter(this, void 0, void 0, function* () {
57
58
  try {
58
59
  const { name: displayName, email, phone: phoneNumber, password, } = user._;
59
60
  auth_1.Auth.info(`[SAA] Adding user '${displayName}'`);
60
61
  const { data, error } = yield this._client.auth.admin.createUser({
61
62
  email,
62
- password,
63
+ password: clearPassword || password,
63
64
  email_confirm: true, // TODO move to params
64
65
  });
65
66
  if (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/auth-supabase",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
12
12
  "dependencies": {
13
- "@quatrain/auth": "^1.1.16",
14
- "@supabase/supabase-js": "^2.48.1",
13
+ "@quatrain/auth": "^1.1.17",
14
+ "@supabase/supabase-js": "^2.57.2",
15
15
  "node-fetch-native": "^1.6.4"
16
16
  },
17
17
  "devDependencies": {