@fachkraftfreund/n8n-nodes-supabase 1.2.1 → 1.2.3

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.
@@ -60,7 +60,6 @@ class SupabaseExtendedApi {
60
60
  method: 'GET',
61
61
  headers: {
62
62
  apikey: '={{$credentials.serviceKey}}',
63
- 'Accept': 'application/vnd.pgrst.object+json',
64
63
  'Content-Type': 'application/json',
65
64
  },
66
65
  },
@@ -245,10 +245,12 @@ class Supabase {
245
245
  {
246
246
  displayName: 'Table',
247
247
  name: 'table',
248
- type: 'string',
248
+ type: 'options',
249
+ typeOptions: {
250
+ loadOptionsMethod: 'getTables',
251
+ },
249
252
  required: true,
250
253
  default: '',
251
- placeholder: 'users',
252
254
  description: 'Name of the table to operate on',
253
255
  displayOptions: {
254
256
  show: {
@@ -281,9 +283,11 @@ class Supabase {
281
283
  {
282
284
  displayName: 'Name',
283
285
  name: 'name',
284
- type: 'string',
286
+ type: 'options',
287
+ typeOptions: {
288
+ loadOptionsMethod: 'getColumns',
289
+ },
285
290
  default: '',
286
- placeholder: 'column_name',
287
291
  description: 'Name of the column',
288
292
  },
289
293
  {
@@ -335,9 +339,11 @@ class Supabase {
335
339
  {
336
340
  displayName: 'Column',
337
341
  name: 'column',
338
- type: 'string',
342
+ type: 'options',
343
+ typeOptions: {
344
+ loadOptionsMethod: 'getColumns',
345
+ },
339
346
  default: '',
340
- placeholder: 'column_name',
341
347
  description: 'Column to filter on',
342
348
  },
343
349
  {
@@ -423,9 +429,11 @@ class Supabase {
423
429
  {
424
430
  displayName: 'Column',
425
431
  name: 'column',
426
- type: 'string',
432
+ type: 'options',
433
+ typeOptions: {
434
+ loadOptionsMethod: 'getColumns',
435
+ },
427
436
  default: '',
428
- placeholder: 'column_name',
429
437
  description: 'Column to sort by',
430
438
  },
431
439
  {
@@ -682,22 +690,64 @@ class Supabase {
682
690
  }
683
691
  },
684
692
  async getTables() {
685
- return [
686
- {
687
- name: 'Enter table name manually',
688
- value: '',
689
- description: 'Please enter the table name manually in the field above',
690
- },
691
- ];
693
+ const credentials = await this.getCredentials('supabaseExtendedApi');
694
+ (0, supabaseClient_1.validateCredentials)(credentials);
695
+ const host = credentials.host.replace(/\/$/, '');
696
+ try {
697
+ const response = await this.helpers.request({
698
+ method: 'GET',
699
+ url: `${host}/rest/v1/`,
700
+ headers: {
701
+ apikey: credentials.serviceKey,
702
+ Authorization: `Bearer ${credentials.serviceKey}`,
703
+ },
704
+ json: true,
705
+ });
706
+ const definitions = response.definitions || {};
707
+ const tables = Object.keys(definitions).sort();
708
+ if (tables.length === 0) {
709
+ return [{ name: 'No tables found', value: '', description: 'No tables are exposed via the REST API' }];
710
+ }
711
+ return tables.map((tableName) => ({ name: tableName, value: tableName }));
712
+ }
713
+ catch (error) {
714
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
715
+ return [{ name: `Error: ${errorMessage}`, value: '', description: 'Failed to load tables. Check your credentials.' }];
716
+ }
692
717
  },
693
718
  async getColumns() {
694
- return [
695
- {
696
- name: 'Enter column names manually',
697
- value: '',
698
- description: 'Please enter column names manually in the fields above',
699
- },
700
- ];
719
+ const credentials = await this.getCredentials('supabaseExtendedApi');
720
+ (0, supabaseClient_1.validateCredentials)(credentials);
721
+ const table = this.getCurrentNodeParameter('table');
722
+ if (!table) {
723
+ return [{ name: 'Select a table first', value: '', description: 'Choose a table to load its columns' }];
724
+ }
725
+ const host = credentials.host.replace(/\/$/, '');
726
+ try {
727
+ const response = await this.helpers.request({
728
+ method: 'GET',
729
+ url: `${host}/rest/v1/`,
730
+ headers: {
731
+ apikey: credentials.serviceKey,
732
+ Authorization: `Bearer ${credentials.serviceKey}`,
733
+ },
734
+ json: true,
735
+ });
736
+ const definitions = response.definitions || {};
737
+ const tableSchema = definitions[table];
738
+ if (!(tableSchema === null || tableSchema === void 0 ? void 0 : tableSchema.properties)) {
739
+ return [{ name: 'No columns found', value: '', description: `Table "${table}" not found or has no columns` }];
740
+ }
741
+ return Object.keys(tableSchema.properties).sort().map((col) => {
742
+ const colDef = tableSchema.properties[col];
743
+ const typeLabel = colDef.format ? `${colDef.type} (${colDef.format})` : colDef.type;
744
+ return { name: col, value: col, description: typeLabel };
745
+ });
746
+ }
747
+ catch (error) {
748
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
749
+ return [{ name: `Error: ${errorMessage}`, value: '', description: 'Failed to load columns. Check your credentials.' }];
750
+ }
701
751
  },
702
752
  },
703
753
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fachkraftfreund/n8n-nodes-supabase",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Comprehensive n8n community node for Supabase with database and storage operations",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",