diff --git a/packages/nodes-base/nodes/Supabase/GenericFunctions.ts b/packages/nodes-base/nodes/Supabase/GenericFunctions.ts index f3c8aa4db241f8..3a7782b8c5a298 100644 --- a/packages/nodes-base/nodes/Supabase/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Supabase/GenericFunctions.ts @@ -17,6 +17,7 @@ import { INodeProperties, NodeApiError, } from 'n8n-workflow'; +import { IData } from '../Google/Analytics/Interfaces'; export async function supabaseApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise { // tslint:disable-line:no-any const credentials = await this.getCredentials('supabaseApi') as { host: string, serviceRole: string }; @@ -56,13 +57,29 @@ const mapOperations: { [key: string]: string } = { export function getFilters( resources: string[], - operations: string[]): INodeProperties[] { + operations: string[], + { + includeNoneOption = true, + filterTypeDisplayName = 'Filter', + fixedCollectionDisplayName = 'Filters', + mustMatchOptions = [ + { + name: 'Any Filter', + value: 'anyFilter', + }, + { + name: 'All Filters', + value: 'allFilters', + }, + ], + }): INodeProperties[] { return [ { - displayName: 'Filter', + displayName: filterTypeDisplayName, name: 'filterType', type: 'options', options: [ + ...(includeNoneOption ? [{ name: 'None', value: 'none' }] : []), { name: 'Build Manually', value: 'manual', @@ -84,16 +101,7 @@ export function getFilters( displayName: 'Must Match', name: 'matchType', type: 'options', - options: [ - { - name: 'Any Filter', - value: 'anyFilter', - }, - { - name: 'All Filters', - value: 'allFilters', - }, - ], + options: mustMatchOptions, displayOptions: { show: { resource: resources, @@ -106,7 +114,7 @@ export function getFilters( default: 'anyFilter', }, { - displayName: 'Filters', + displayName: fixedCollectionDisplayName, name: 'filters', type: 'fixedCollection', typeOptions: { diff --git a/packages/nodes-base/nodes/Supabase/RowDescription.ts b/packages/nodes-base/nodes/Supabase/RowDescription.ts index 223c1e690a6897..1ef6fbf764e4be 100644 --- a/packages/nodes-base/nodes/Supabase/RowDescription.ts +++ b/packages/nodes-base/nodes/Supabase/RowDescription.ts @@ -79,7 +79,24 @@ export const rowFields: INodeProperties[] = [ }, default: '', }, - ...getFilters(['row'], ['update']), + ...getFilters( + ['row'], + ['update'], + { + includeNoneOption: false, + filterTypeDisplayName: 'Select Type', + fixedCollectionDisplayName: 'Select Conditions', + mustMatchOptions: [ + { + name: 'Any Select Condition', + value: 'anyFilter', + }, + { + name: 'All Select Conditions', + value: 'allFilters', + }, + ], + }), { displayName: 'Data to Send', name: 'dataToSend', @@ -187,7 +204,23 @@ export const rowFields: INodeProperties[] = [ /* -------------------------------------------------------------------------- */ /* row:delete */ /* -------------------------------------------------------------------------- */ - ...getFilters(['row'], ['delete']), + ...getFilters( + ['row'], + ['delete'], + { + includeNoneOption: false, + filterTypeDisplayName: 'Select Type', + fixedCollectionDisplayName: 'Select Conditions', + mustMatchOptions: [ + { + name: 'Any Select Condition', + value: 'anyFilter', + }, + { + name: 'All Select Conditions', + value: 'allFilters', + }, + ]}), /* -------------------------------------------------------------------------- */ /* row:get */ /* -------------------------------------------------------------------------- */ @@ -282,5 +315,5 @@ export const rowFields: INodeProperties[] = [ default: 50, description: 'How many results to return', }, - ...getFilters(['row'], ['getAll']), + ...getFilters(['row'], ['getAll'], {}), ];