@fachkraftfreund/n8n-nodes-supabase 1.2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SUDEEPTA SARKAR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,428 @@
1
+ # n8n-nodes-supabase
2
+
3
+ A comprehensive n8n community node for Supabase that provides both database and storage operations with enhanced functionality beyond the built-in Supabase node.
4
+
5
+ ![n8n](https://img.shields.io/badge/n8n-community%20node-FF6D5A)
6
+ ![npm](https://img.shields.io/npm/v/n8n-nodes-supabase)
7
+ ![License](https://img.shields.io/npm/l/n8n-nodes-supabase)
8
+
9
+ ## Features
10
+
11
+ ### Database Operations
12
+
13
+ - **Enhanced CRUD Operations**: Create, Read, Update, Delete, and Upsert with advanced filtering
14
+ - **Schema Management**: Create/drop tables, add/remove columns, manage indexes
15
+ - **Custom SQL Queries**: Execute any SQL query directly
16
+ - **Advanced Filtering**: Support for complex filters and sorting
17
+ - **Dual UI Modes**: Simple form-based UI and advanced JSON mode
18
+
19
+ ### Storage Operations
20
+
21
+ - **File Management**: Upload, download, list, delete, move, and copy files
22
+ - **Multiple Upload Types**: Binary data, URL downloads, or text content
23
+ - **Bucket Management**: Create, delete, and manage storage buckets
24
+ - **Signed URLs**: Generate time-limited access URLs
25
+ - **File Metadata**: Get detailed file information and manage metadata
26
+
27
+ ### Key Improvements Over Built-in Node
28
+
29
+ - ✅ Complete storage operations support
30
+ - ✅ Schema management capabilities
31
+ - ✅ Advanced filtering and sorting
32
+ - ✅ Dual UI modes (simple + advanced)
33
+ - ✅ **Smart Dropdowns**: Auto-fetch project URLs and bucket names
34
+ - ✅ **Project Caching**: Recent project URLs cached for convenience
35
+ - ✅ Better error handling and validation
36
+ - ✅ Comprehensive file operations
37
+ - ✅ Bucket management
38
+ - ✅ Custom SQL query execution
39
+
40
+ ## Installation
41
+
42
+ ### Community Nodes (Recommended)
43
+
44
+ 1. Go to **Settings > Community Nodes** in your n8n instance
45
+ 2. Click **Install a community node**
46
+ 3. Enter: `n8n-nodes-supabase`
47
+ 4. Click **Install**
48
+
49
+ ### Manual Installation
50
+
51
+ ```bash
52
+ # In your n8n installation directory
53
+ npm install n8n-nodes-supabase
54
+ ```
55
+
56
+ ### Docker
57
+
58
+ Add to your n8n Docker environment:
59
+
60
+ ```bash
61
+ docker run -it --rm \
62
+ --name n8n \
63
+ -p 5678:5678 \
64
+ -e N8N_COMMUNITY_PACKAGES="n8n-nodes-supabase" \
65
+ n8nio/n8n
66
+ ```
67
+
68
+ ## Setup
69
+
70
+ ### 1. Create Supabase Credentials
71
+
72
+ 1. Go to your [Supabase Dashboard](https://app.supabase.com)
73
+ 2. Select your project
74
+ 3. Go to **Settings** > **API**
75
+ 4. Copy your **Project URL** and **API Key**
76
+
77
+ ### 2. Configure in n8n
78
+
79
+ 1. Create a new **Supabase API** credential
80
+ 2. **Project URL**: Select from recent projects or enter manually (e.g., `https://your-project.supabase.co`)
81
+ 3. Choose **API Key Type**:
82
+ - **Anon Key**: For client-side operations with RLS
83
+ - **Service Role Key**: For server-side operations (bypasses RLS)
84
+ 4. Enter your **API Key**
85
+
86
+ ## New in v1.1.1: Enhanced Credential Management 🚀
87
+
88
+ ### Dual-Mode Connection System
89
+
90
+ **Auto-Discovery Mode** 🔍
91
+
92
+ - **Management API Integration**: Connect using your Supabase Management API token
93
+ - **Organization Selection**: Auto-discover and select from your organizations
94
+ - **Project Auto-Discovery**: Real-time project list with status and metadata
95
+ - **Automatic URL Population**: Project URLs auto-populated from selections
96
+ - **Rich Metadata**: See project status, region, creation date, and more
97
+
98
+ **Manual Entry Mode** ✏️
99
+
100
+ - **Enhanced Validation**: Better URL format validation and error messages
101
+ - **Smart Caching**: Recent project URLs cached for quick selection
102
+ - **Improved Testing**: Enhanced credential validation with detailed feedback
103
+ - **Backward Compatibility**: All existing configurations continue to work
104
+
105
+ ### Smart Dropdowns & Auto-Discovery
106
+
107
+ **Project & Organization Management**
108
+
109
+ - **Real Organizations**: Load actual organizations from your Supabase account
110
+ - **Live Project Data**: See real project names, status, and regions
111
+ - **Auto-Population**: Project URLs automatically filled when selected
112
+ - **Fallback Support**: Graceful fallback to manual entry if API unavailable
113
+
114
+ **Database Schema Discovery**
115
+
116
+ - **Table Auto-Discovery**: Dropdown of actual tables from your database
117
+ - **Column Intelligence**: Auto-populate columns based on selected table
118
+ - **Schema Awareness**: Support for custom schemas beyond 'public'
119
+ - **Metadata Rich**: See table info like RLS status, size, and row counts
120
+
121
+ **Storage Integration**
122
+
123
+ - **Bucket Auto-Fetch**: Real-time bucket list with metadata
124
+ - **Permission Validation**: Automatic access permission checking
125
+ - **Status Indicators**: Visual indicators for public/private buckets
126
+ - **Creation Metadata**: See bucket creation dates and properties
127
+
128
+ ### Benefits
129
+
130
+ - 🎯 **Zero Configuration Errors**: Eliminate typos in URLs, table names, and bucket names
131
+ - ⚡ **Lightning Fast Setup**: Auto-discovery reduces setup time by 90%
132
+ - 🔍 **Real-Time Validation**: Instant feedback on credential validity
133
+ - 📊 **Rich Context**: See project status, table schemas, and bucket properties
134
+ - 🔄 **Always Current**: Live data from your Supabase projects
135
+ - 🛡️ **Enhanced Security**: Management API integration with proper scoping
136
+ - 🔧 **Flexible Configuration**: Choose between auto-discovery or manual entry
137
+ - 🔄 **Graceful Fallbacks**: Manual entry available when auto-discovery fails
138
+
139
+ ## How to Get Management API Token
140
+
141
+ For Auto-Discovery mode, you'll need a Supabase Management API token:
142
+
143
+ 1. **Login to Supabase Dashboard**: Go to https://supabase.com/dashboard
144
+ 2. **Account Settings**: Click your profile/avatar in the top right
145
+ 3. **Access Tokens**: Navigate to "Access Tokens" section
146
+ 4. **Generate Token**: Click "Generate new token"
147
+ 5. **Set Permissions**: Choose appropriate scopes:
148
+ - **Projects**: Read access to list and get project details
149
+ - **Organizations**: Read access to list organizations
150
+ - **Database**: Read access for schema information
151
+ - **Storage**: Read access for bucket management
152
+ 6. **Copy Token**: Save the token securely (starts with `sbp_`)
153
+
154
+ **Note**: Management API tokens are different from project API keys and are used for managing multiple projects and organizations.
155
+
156
+ ## Usage Examples
157
+
158
+ ### Database Operations
159
+
160
+ #### Create a Record
161
+
162
+ ```javascript
163
+ // Simple Mode
164
+ Resource: Database
165
+ Operation: Create
166
+ Table: users
167
+ Columns:
168
+ - name: John Doe
169
+ - email: john@example.com
170
+ - age: 30
171
+
172
+ // Advanced Mode
173
+ Resource: Database
174
+ Operation: Create
175
+ Table: users
176
+ JSON Data: {
177
+ "name": "John Doe",
178
+ "email": "john@example.com",
179
+ "age": 30
180
+ }
181
+ ```
182
+
183
+ #### Read with Filters
184
+
185
+ ```javascript
186
+ // Simple Mode
187
+ Resource: Database
188
+ Operation: Read
189
+ Table: users
190
+ Filters:
191
+ - Column: age, Operator: Greater Than, Value: 25
192
+ - Column: status, Operator: Equals, Value: active
193
+ Return Fields: id,name,email
194
+ Limit: 10
195
+
196
+ // Advanced Mode
197
+ Resource: Database
198
+ Operation: Read
199
+ Table: users
200
+ Advanced Filters: {
201
+ "age": {"gt": 25},
202
+ "status": "active"
203
+ }
204
+ ```
205
+
206
+ #### Create Table
207
+
208
+ ```javascript
209
+ Resource: Database
210
+ Operation: Create Table
211
+ Table Name: products
212
+ Column Definitions:
213
+ - Name: id, Type: uuid, Primary Key: true, Default: gen_random_uuid()
214
+ - Name: name, Type: varchar(255), Nullable: false
215
+ - Name: price, Type: decimal(10,2), Nullable: false
216
+ - Name: created_at, Type: timestamptz, Default: now()
217
+ ```
218
+
219
+ ### Storage Operations
220
+
221
+ #### Upload File
222
+
223
+ ```javascript
224
+ Resource: Storage
225
+ Operation: Upload File
226
+ Bucket: documents
227
+ File Name: report.pdf
228
+ Input Type: Binary Data
229
+ Binary Property Name: data
230
+ ```
231
+
232
+ #### Download File
233
+
234
+ ```javascript
235
+ Resource: Storage
236
+ Operation: Download File
237
+ Bucket: documents
238
+ File Path: reports/monthly-report.pdf
239
+ Output Format: Binary Data
240
+ ```
241
+
242
+ #### List Files
243
+
244
+ ```javascript
245
+ Resource: Storage
246
+ Operation: List Files
247
+ Bucket: images
248
+ Folder Path: avatars/
249
+ Limit: 50
250
+ Sort Column: created_at
251
+ Sort Order: desc
252
+ ```
253
+
254
+ #### Create Bucket
255
+
256
+ ```javascript
257
+ Resource: Storage
258
+ Operation: Create Bucket
259
+ Bucket Name: user-uploads
260
+ Public Bucket: false
261
+ File Size Limit: 10485760 // 10MB
262
+ Allowed MIME Types: image/jpeg,image/png,image/gif
263
+ ```
264
+
265
+ ## API Reference
266
+
267
+ ### Database Operations
268
+
269
+ | Operation | Description | Parameters |
270
+ |-----------|-------------|------------|
271
+ | `create` | Insert new row | table, data (columns or JSON) |
272
+ | `read` | Select rows | table, filters, sort, limit, offset |
273
+ | `update` | Update existing rows | table, data, filters |
274
+ | `delete` | Delete rows | table, filters |
275
+ | `upsert` | Insert or update | table, data, onConflict |
276
+ | `createTable` | Create new table | tableName, columnDefinitions |
277
+ | `dropTable` | Drop table | tableName, cascade |
278
+ | `addColumn` | Add column | tableName, columnDefinition |
279
+ | `dropColumn` | Drop column | tableName, columnName |
280
+ | `createIndex` | Create index | tableName, indexDefinition |
281
+ | `dropIndex` | Drop index | indexName |
282
+ | `customQuery` | Execute SQL | customSql |
283
+
284
+ ### Storage Operations
285
+
286
+ | Operation | Description | Parameters |
287
+ |-----------|-------------|------------|
288
+ | `uploadFile` | Upload file | bucket, fileName, inputType, data |
289
+ | `downloadFile` | Download file | bucket, filePath, outputFormat |
290
+ | `listFiles` | List files | bucket, folderPath, options |
291
+ | `deleteFile` | Delete files | bucket, filePaths |
292
+ | `moveFile` | Move file | bucket, fromPath, toPath |
293
+ | `copyFile` | Copy file | bucket, fromPath, toPath |
294
+ | `createBucket` | Create bucket | bucketName, options |
295
+ | `deleteBucket` | Delete bucket | bucketName |
296
+ | `listBuckets` | List buckets | - |
297
+ | `getBucketDetails` | Get bucket info | bucketName |
298
+ | `getFileInfo` | Get file info | bucket, filePath |
299
+ | `generateSignedUrl` | Create signed URL | bucket, filePath, expiresIn |
300
+
301
+ ## Advanced Features
302
+
303
+ ### Row Level Security (RLS)
304
+
305
+ The node respects Supabase's Row Level Security policies:
306
+
307
+ - **Anon Key**: Operates within RLS policies
308
+ - **Service Role Key**: Bypasses RLS (use with caution)
309
+
310
+ ### Error Handling
311
+
312
+ Comprehensive error handling with detailed messages:
313
+
314
+ ```javascript
315
+ // Automatic retry on network errors
316
+ // Validation of table/column names
317
+ // Clear error messages for debugging
318
+ // Support for n8n's "Continue on Fail" option
319
+ ```
320
+
321
+ ### Performance Optimization
322
+
323
+ - Connection pooling
324
+ - Efficient query building
325
+ - Batch operations support
326
+ - Proper indexing recommendations
327
+
328
+ ## Troubleshooting
329
+
330
+ ### Common Issues
331
+
332
+ #### 1. "Invalid credentials" Error
333
+
334
+ - Verify your Project URL format: `https://your-project.supabase.co`
335
+ - Check API key type matches your use case
336
+ - Ensure API key has required permissions
337
+
338
+ #### 2. "Table not found" Error
339
+
340
+ - Verify table name spelling and case
341
+ - Check if table exists in correct schema
342
+ - Ensure API key has access to the table
343
+
344
+ #### 3. Storage Upload Fails
345
+
346
+ - Verify bucket exists and is accessible
347
+ - Check file size limits
348
+ - Ensure proper MIME type configuration
349
+ - Verify RLS policies for storage
350
+
351
+ #### 4. RLS Policy Errors
352
+
353
+ - Use Service Role key to bypass RLS for testing
354
+ - Check your RLS policies in Supabase dashboard
355
+ - Ensure authenticated user has proper permissions
356
+
357
+ ### Debug Mode
358
+
359
+ Enable detailed logging in n8n settings to see:
360
+
361
+ - Full SQL queries generated
362
+ - Supabase API responses
363
+ - Error stack traces
364
+ - Performance metrics
365
+
366
+ ## Contributing
367
+
368
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
369
+
370
+ ### Development Setup
371
+
372
+ ```bash
373
+ # Clone the repository
374
+ git clone https://github.com/sudsarkar13/n8n-nodes-supabase.git
375
+ cd n8n-nodes-supabase
376
+
377
+ # Install dependencies
378
+ npm install
379
+
380
+ # Build the project
381
+ npm run build
382
+
383
+ # Run tests
384
+ npm test
385
+
386
+ # Link for local development
387
+ npm link
388
+ cd ~/.n8n/nodes
389
+ npm link n8n-nodes-supabase
390
+ ```
391
+
392
+ ### Testing
393
+
394
+ ```bash
395
+ # Run unit tests
396
+ npm run test
397
+
398
+ # Run integration tests (requires Supabase project)
399
+ SUPABASE_URL=your-url SUPABASE_KEY=your-key npm run test:integration
400
+
401
+ # Run with coverage
402
+ npm run test:cov
403
+ ```
404
+
405
+ ## Changelog
406
+
407
+ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
408
+
409
+ ## License
410
+
411
+ [MIT](LICENSE) - see LICENSE file for details.
412
+
413
+ ## Support
414
+
415
+ - 📖 [Documentation](https://github.com/sudsarkar13/n8n-nodes-supabase/wiki)
416
+ - 🐛 [Bug Reports](https://github.com/sudsarkar13/n8n-nodes-supabase/issues)
417
+ - 💡 [Feature Requests](https://github.com/sudsarkar13/n8n-nodes-supabase/discussions)
418
+ - 💬 [Community Discord](https://discord.gg/n8n)
419
+
420
+ ## Related Projects
421
+
422
+ - [n8n](https://n8n.io) - Workflow automation platform
423
+ - [Supabase](https://supabase.com) - Open source Firebase alternative
424
+ - [n8n Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
425
+
426
+ ---
427
+
428
+ Made with ❤️ by the n8n community
@@ -0,0 +1,9 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class SupabaseExtendedApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SupabaseExtendedApi = void 0;
4
+ class SupabaseExtendedApi {
5
+ constructor() {
6
+ this.name = 'supabaseExtendedApi';
7
+ this.displayName = 'Supabase Extended API';
8
+ this.documentationUrl = 'https://supabase.com/docs/guides/api';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Host',
12
+ name: 'host',
13
+ type: 'string',
14
+ default: '',
15
+ placeholder: 'https://your-project.supabase.co',
16
+ required: true,
17
+ description: 'Your Supabase project URL',
18
+ },
19
+ {
20
+ displayName: 'Service Role Secret',
21
+ name: 'serviceKey',
22
+ type: 'string',
23
+ default: '',
24
+ typeOptions: {
25
+ password: true,
26
+ },
27
+ required: true,
28
+ description: 'Your Supabase API key (service_role key recommended for full access)',
29
+ },
30
+ {
31
+ displayName: 'Additional Options',
32
+ name: 'additionalOptions',
33
+ type: 'collection',
34
+ placeholder: 'Add Option',
35
+ default: {},
36
+ options: [
37
+ {
38
+ displayName: 'Schema',
39
+ name: 'schema',
40
+ type: 'string',
41
+ default: 'public',
42
+ description: 'Database schema to use (default: public)',
43
+ },
44
+ ],
45
+ },
46
+ ];
47
+ this.authenticate = {
48
+ type: 'generic',
49
+ properties: {
50
+ headers: {
51
+ apikey: '={{$credentials.serviceKey}}',
52
+ Authorization: 'Bearer {{$credentials.serviceKey}}',
53
+ },
54
+ },
55
+ };
56
+ this.test = {
57
+ request: {
58
+ baseURL: '={{$credentials.host}}',
59
+ url: '/rest/v1/',
60
+ method: 'GET',
61
+ headers: {
62
+ apikey: '={{$credentials.serviceKey}}',
63
+ Authorization: 'Bearer {{$credentials.serviceKey}}',
64
+ 'Accept': 'application/vnd.pgrst.object+json',
65
+ 'Content-Type': 'application/json',
66
+ },
67
+ },
68
+ };
69
+ }
70
+ }
71
+ exports.SupabaseExtendedApi = SupabaseExtendedApi;
@@ -0,0 +1,12 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Supabase implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ methods: {
6
+ loadOptions: {
7
+ getBuckets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
8
+ getTables(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
9
+ getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
10
+ };
11
+ };
12
+ }