@mastra/auth-supabase 0.10.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.
@@ -0,0 +1,30 @@
1
+
2
+ > @mastra/auth-supabase@0.10.0 build /home/runner/work/mastra/mastra/auth/supabase
3
+ > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.4.0
8
+ TSC Build start
9
+ TSC ⚡️ Build success in 8308ms
10
+ DTS Build start
11
+ CLI Target: es2022
12
+ Analysis will use the bundled TypeScript version 5.8.3
13
+ Writing package typings: /home/runner/work/mastra/mastra/auth/supabase/dist/_tsup-dts-rollup.d.ts
14
+ Analysis will use the bundled TypeScript version 5.8.3
15
+ Writing package typings: /home/runner/work/mastra/mastra/auth/supabase/dist/_tsup-dts-rollup.d.cts
16
+ DTS ⚡️ Build success in 10975ms
17
+ CLI Cleaning output folder
18
+ ESM Build start
19
+ CJS Build start
20
+ ESM dist/getMachineId-darwin-UJH25LDA.js 770.00 B
21
+ ESM dist/getMachineId-linux-YF3RLZNP.js 440.00 B
22
+ ESM dist/getMachineId-bsd-IPBZSYCM.js 564.00 B
23
+ ESM dist/getMachineId-win-PKATJI4A.js 738.00 B
24
+ ESM dist/chunk-N62AETLJ.js 334.00 B
25
+ ESM dist/getMachineId-unsupported-UOUTBEEW.js 382.00 B
26
+ ESM dist/index.js 11.52 KB
27
+ ESM dist/chunk-JLXWUSDO.js 32.51 KB
28
+ ESM ⚡️ Build success in 2958ms
29
+ CJS dist/index.cjs 53.47 KB
30
+ CJS ⚡️ Build success in 2958ms
package/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ # @mastra/auth-supabase
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Mastra AI, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @mastra/auth-supabase
2
+
3
+ A Supabase authentication integration for Mastra, providing seamless authentication and authorization capabilities using Supabase's authentication system.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/auth-supabase
9
+ # or
10
+ yarn add @mastra/auth-supabase
11
+ # or
12
+ pnpm add @mastra/auth-supabase
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import { Mastra } from '@mastra/core';
19
+ import { MastraAuthSupabase } from '@mastra/auth-supabase';
20
+
21
+ // Initialize with environment variables
22
+ const auth = new MastraAuthSupabase();
23
+
24
+ // Or initialize with explicit configuration
25
+ const auth = new MastraAuthSupabase({
26
+ url: 'your-supabase-url',
27
+ anonKey: 'your-supabase-anon-key',
28
+ });
29
+
30
+ // Enable auth in Mastra
31
+ const mastra = new Mastra({
32
+ ...
33
+ server: {
34
+ experimental_auth: auth,
35
+ },
36
+ });
37
+ ```
38
+
39
+ ## Configuration
40
+
41
+ The package can be configured in two ways:
42
+
43
+ 1. **Environment Variables**:
44
+
45
+ - `SUPABASE_URL`: Your Supabase project URL
46
+ - `SUPABASE_ANON_KEY`: Your Supabase anonymous key
47
+
48
+ 2. **Constructor Options**:
49
+ ```typescript
50
+ interface MastraAuthSupabaseOptions {
51
+ url?: string;
52
+ anonKey?: string;
53
+ }
54
+ ```
55
+
56
+ ## Features
57
+
58
+ - **Authentication**: Verifies user tokens and retrieves user information from Supabase
59
+ - **Authorization**: Checks user permissions based on their role in Supabase
60
+ - **Type Safety**: Full TypeScript support with proper type definitions
61
+ - **Environment Variable Support**: Easy configuration through environment variables
62
+
63
+ ## API
64
+
65
+ ### `authenticateToken(token: string)`
66
+
67
+ Authenticates a user token and returns the user information if valid.
68
+
69
+ ### `authorizeUser(user: User)`
70
+
71
+ Checks if a user has the required permissions (currently checks for admin status).
72
+
73
+ ## Requirements
74
+
75
+ - Node.js 16 or higher
76
+ - Supabase project with authentication enabled
77
+ - Supabase URL and anonymous key
78
+
79
+ ## License
80
+
81
+ Elastic-2.0
@@ -0,0 +1,18 @@
1
+ import { MastraAuthProvider } from '@mastra/core/server';
2
+ import type { MastraAuthProviderOptions } from '@mastra/core/server';
3
+ import type { SupabaseClient } from '@supabase/supabase-js';
4
+ import type { User } from '@supabase/supabase-js';
5
+
6
+ export declare class MastraAuthSupabase extends MastraAuthProvider<User> {
7
+ protected supabase: SupabaseClient;
8
+ constructor(options?: MastraAuthSupabaseOptions);
9
+ authenticateToken(token: string): Promise<User | null>;
10
+ authorizeUser(user: User): Promise<any>;
11
+ }
12
+
13
+ declare interface MastraAuthSupabaseOptions extends MastraAuthProviderOptions<User> {
14
+ url?: string;
15
+ anonKey?: string;
16
+ }
17
+
18
+ export { }
@@ -0,0 +1,18 @@
1
+ import { MastraAuthProvider } from '@mastra/core/server';
2
+ import type { MastraAuthProviderOptions } from '@mastra/core/server';
3
+ import type { SupabaseClient } from '@supabase/supabase-js';
4
+ import type { User } from '@supabase/supabase-js';
5
+
6
+ export declare class MastraAuthSupabase extends MastraAuthProvider<User> {
7
+ protected supabase: SupabaseClient;
8
+ constructor(options?: MastraAuthSupabaseOptions);
9
+ authenticateToken(token: string): Promise<User | null>;
10
+ authorizeUser(user: User): Promise<any>;
11
+ }
12
+
13
+ declare interface MastraAuthSupabaseOptions extends MastraAuthProviderOptions<User> {
14
+ url?: string;
15
+ anonKey?: string;
16
+ }
17
+
18
+ export { }