mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -18,8 +16,26 @@ import {
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function supabaseApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = await this.getCredentials('supabaseApi') as { host: string, serviceRole: string };
|
||||
export async function supabaseApiRequest(
|
||||
this:
|
||||
| IExecuteFunctions
|
||||
| IExecuteSingleFunctions
|
||||
| ILoadOptionsFunctions
|
||||
| IHookFunctions
|
||||
| IWebhookFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
headers: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = (await this.getCredentials('supabaseApi')) as {
|
||||
host: string;
|
||||
serviceRole: string;
|
||||
};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
@@ -42,17 +58,16 @@ export async function supabaseApiRequest(this: IExecuteFunctions | IExecuteSingl
|
||||
}
|
||||
//@ts-ignore
|
||||
return await this.helpers?.request(options);
|
||||
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
}
|
||||
|
||||
const mapOperations: { [key: string]: string } = {
|
||||
'create': 'created',
|
||||
'update': 'updated',
|
||||
'getAll': 'retrieved',
|
||||
'delete': 'deleted',
|
||||
create: 'created',
|
||||
update: 'updated',
|
||||
getAll: 'retrieved',
|
||||
delete: 'deleted',
|
||||
};
|
||||
|
||||
export function getFilters(
|
||||
@@ -73,7 +88,8 @@ export function getFilters(
|
||||
value: 'allFilters',
|
||||
},
|
||||
],
|
||||
}): INodeProperties[] {
|
||||
},
|
||||
): INodeProperties[] {
|
||||
return [
|
||||
{
|
||||
displayName: filterTypeDisplayName,
|
||||
@@ -107,9 +123,7 @@ export function getFilters(
|
||||
show: {
|
||||
resource: resources,
|
||||
operation: operations,
|
||||
filterType: [
|
||||
'manual',
|
||||
],
|
||||
filterType: ['manual'],
|
||||
},
|
||||
},
|
||||
default: 'anyFilter',
|
||||
@@ -125,9 +139,7 @@ export function getFilters(
|
||||
show: {
|
||||
resource: resources,
|
||||
operation: operations,
|
||||
filterType: [
|
||||
'manual',
|
||||
],
|
||||
filterType: ['manual'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -141,11 +153,10 @@ export function getFilters(
|
||||
displayName: 'Field Name or ID',
|
||||
name: 'keyName',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: [
|
||||
'tableId',
|
||||
],
|
||||
loadOptionsDependsOn: ['tableId'],
|
||||
loadOptionsMethod: 'getTableColumns',
|
||||
},
|
||||
default: '',
|
||||
@@ -207,9 +218,7 @@ export function getFilters(
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
condition: [
|
||||
'fullText',
|
||||
],
|
||||
condition: ['fullText'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -244,16 +253,15 @@ export function getFilters(
|
||||
description: `Filter to decide which rows get ${mapOperations[operations[0] as string]}`,
|
||||
},
|
||||
{
|
||||
displayName: 'See <a href="https://postgrest.org/en/v9.0/api.html#horizontal-filtering-rows" target="_blank">PostgREST guide</a> to creating filters',
|
||||
displayName:
|
||||
'See <a href="https://postgrest.org/en/v9.0/api.html#horizontal-filtering-rows" target="_blank">PostgREST guide</a> to creating filters',
|
||||
name: 'jsonNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: resources,
|
||||
operation: operations,
|
||||
filterType: [
|
||||
'string',
|
||||
],
|
||||
filterType: ['string'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -269,9 +277,7 @@ export function getFilters(
|
||||
show: {
|
||||
resource: resources,
|
||||
operation: operations,
|
||||
filterType: [
|
||||
'string',
|
||||
],
|
||||
filterType: ['string'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -282,7 +288,9 @@ export function getFilters(
|
||||
|
||||
export const buildQuery = (obj: IDataObject, value: IDataObject) => {
|
||||
if (value.condition === 'fullText') {
|
||||
return Object.assign(obj, { [`${value.keyName}`]: `${value.searchFunction}.${value.keyValue}` });
|
||||
return Object.assign(obj, {
|
||||
[`${value.keyName}`]: `${value.searchFunction}.${value.keyValue}`,
|
||||
});
|
||||
}
|
||||
return Object.assign(obj, { [`${value.keyName}`]: `${value.condition}.${value.keyValue}` });
|
||||
};
|
||||
@@ -300,12 +308,13 @@ export const buildGetQuery = (obj: IDataObject, value: IDataObject) => {
|
||||
|
||||
export async function validateCredentials(
|
||||
this: ICredentialTestFunctions,
|
||||
decryptedCredentials: ICredentialDataDecryptedObject): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
decryptedCredentials: ICredentialDataDecryptedObject,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = decryptedCredentials;
|
||||
|
||||
const { serviceRole } = credentials as {
|
||||
serviceRole: string,
|
||||
serviceRole: string;
|
||||
};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
|
||||
Reference in New Issue
Block a user