first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const deployOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deploy'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Cancel',
|
||||
value: 'cancel',
|
||||
description: 'Cancel a deployment',
|
||||
action: 'Cancel a deployment',
|
||||
},
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new deployment',
|
||||
action: 'Create a deployment',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a deployment',
|
||||
action: 'Get a deployment',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many deployments',
|
||||
action: 'Get many deployments',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
];
|
||||
|
||||
export const deployFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Site Name or ID',
|
||||
name: 'siteId',
|
||||
required: true,
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSites',
|
||||
},
|
||||
description:
|
||||
'Enter the Site ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deploy'],
|
||||
operation: ['get', 'create', 'getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Deploy ID',
|
||||
name: 'deployId',
|
||||
required: true,
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deploy'],
|
||||
operation: ['get', 'cancel'],
|
||||
},
|
||||
},
|
||||
},
|
||||
// ----- Get All Deploys ------ //
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['getAll'],
|
||||
resource: ['deploy'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['getAll'],
|
||||
resource: ['deploy'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 200,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
// ---- Create Site Deploy ---- //
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Fields',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deploy'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Branch',
|
||||
name: 'branch',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,75 @@
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function netlifyApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
qs: query,
|
||||
body,
|
||||
uri: uri || `https://api.netlify.com/api/v1${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (!Object.keys(body as IDataObject).length) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (Object.keys(option)) {
|
||||
Object.assign(options, option);
|
||||
}
|
||||
|
||||
try {
|
||||
const credentials = await this.getCredentials('netlifyApi');
|
||||
|
||||
options.headers!.Authorization = `Bearer ${credentials.accessToken}`;
|
||||
|
||||
return await this.helpers.request(options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export async function netlifyRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
query.page = 0;
|
||||
query.per_page = 100;
|
||||
|
||||
do {
|
||||
responseData = await netlifyApiRequest.call(this, method, endpoint, body, query, undefined, {
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
query.page++;
|
||||
returnData.push.apply(returnData, responseData.body as IDataObject[]);
|
||||
} while (responseData.headers.link.includes('next'));
|
||||
|
||||
return returnData;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.netlify",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/netlify/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.netlify/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { deployFields, deployOperations } from './DeployDescription';
|
||||
import { netlifyApiRequest, netlifyRequestAllItems } from './GenericFunctions';
|
||||
import { siteFields, siteOperations } from './SiteDescription';
|
||||
|
||||
export class Netlify implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Netlify',
|
||||
name: 'netlify',
|
||||
icon: 'file:netlify.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Netlify API',
|
||||
defaults: {
|
||||
name: 'Netlify',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'netlifyApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Deploy',
|
||||
value: 'deploy',
|
||||
},
|
||||
{
|
||||
name: 'Site',
|
||||
value: 'site',
|
||||
},
|
||||
],
|
||||
default: 'deploy',
|
||||
required: true,
|
||||
},
|
||||
...deployOperations,
|
||||
...deployFields,
|
||||
...siteOperations,
|
||||
...siteFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getSites(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const sites = await netlifyApiRequest.call(this, 'GET', '/sites');
|
||||
for (const site of sites) {
|
||||
returnData.push({
|
||||
name: site.name,
|
||||
value: site.site_id,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const qs: IDataObject = {};
|
||||
const body: IDataObject = {};
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (resource === 'deploy') {
|
||||
if (operation === 'cancel') {
|
||||
const deployId = this.getNodeParameter('deployId', i);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/deploys/${deployId}/cancel`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'create') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
if (body.title) {
|
||||
qs.title = body.title;
|
||||
delete body.title;
|
||||
}
|
||||
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/sites/${siteId}/deploys`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
const deployId = this.getNodeParameter('deployId', i);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys/${deployId}`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
if (returnAll) {
|
||||
responseData = await netlifyRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys`,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys`,
|
||||
{},
|
||||
{ per_page: limit },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resource === 'site') {
|
||||
if (operation === 'delete') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
responseData = await netlifyApiRequest.call(this, 'DELETE', `/sites/${siteId}`);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
responseData = await netlifyApiRequest.call(this, 'GET', `/sites/${siteId}`);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
if (returnAll) {
|
||||
responseData = await netlifyRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/sites',
|
||||
{},
|
||||
{ filter: 'all' },
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/sites',
|
||||
{},
|
||||
{ filter: 'all', per_page: limit },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.netlifyTrigger",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/netlify/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.netlifytrigger/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import { snakeCase } from 'change-case';
|
||||
import type {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IWebhookResponseData,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { netlifyApiRequest } from './GenericFunctions';
|
||||
|
||||
export class NetlifyTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Netlify Trigger',
|
||||
name: 'netlifyTrigger',
|
||||
icon: 'file:netlify.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["event"]}}',
|
||||
description: 'Handle netlify events via webhooks',
|
||||
defaults: {
|
||||
name: 'Netlify Trigger',
|
||||
},
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'netlifyApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
{
|
||||
name: 'default',
|
||||
httpMethod: 'POST',
|
||||
responseMode: 'onReceived',
|
||||
path: 'webhook',
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Site Name or ID',
|
||||
name: 'siteId',
|
||||
required: true,
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSites',
|
||||
},
|
||||
description:
|
||||
'Select the Site ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Event',
|
||||
name: 'event',
|
||||
type: 'options',
|
||||
required: true,
|
||||
default: '',
|
||||
options: [
|
||||
{
|
||||
name: 'Deploy Building',
|
||||
value: 'deployBuilding',
|
||||
},
|
||||
{
|
||||
name: 'Deploy Failed',
|
||||
value: 'deployFailed',
|
||||
},
|
||||
{
|
||||
name: 'Deploy Created',
|
||||
value: 'deployCreated',
|
||||
},
|
||||
{
|
||||
name: 'Form Submitted',
|
||||
value: 'submissionCreated',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Form Name or ID',
|
||||
name: 'formId',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: ['submissionCreated'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getForms',
|
||||
},
|
||||
description:
|
||||
'Select a form. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simple',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: ['submissionCreated'],
|
||||
},
|
||||
},
|
||||
default: true,
|
||||
description:
|
||||
'Whether to return a simplified version of the response instead of the raw data',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
webhookMethods = {
|
||||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
const qs: IDataObject = {};
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
qs.site_id = this.getNodeParameter('siteId') as string;
|
||||
const webhooks = await netlifyApiRequest.call(this, 'GET', '/hooks', {}, qs);
|
||||
for (const webhook of webhooks) {
|
||||
if (webhook.type === 'url') {
|
||||
if (webhook.data.url === webhookUrl && webhook.event === snakeCase(event)) {
|
||||
webhookData.webhookId = webhook.id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
//TODO - implement missing events
|
||||
// alL posible events can be found doing a GET /hooks/types
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
const body: IDataObject = {
|
||||
event: snakeCase(event),
|
||||
data: {
|
||||
url: webhookUrl,
|
||||
},
|
||||
site_id: this.getNodeParameter('siteId') as string,
|
||||
};
|
||||
const formId = this.getNodeParameter('formId', '*') as string;
|
||||
if (event === 'submissionCreated' && formId !== '*') {
|
||||
body.form_id = this.getNodeParameter('formId') as string;
|
||||
}
|
||||
const webhook = await netlifyApiRequest.call(this, 'POST', '/hooks', body);
|
||||
webhookData.webhookId = webhook.id;
|
||||
return true;
|
||||
},
|
||||
async delete(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
try {
|
||||
await netlifyApiRequest.call(this, 'DELETE', `/hooks/${webhookData.webhookId}`);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
delete webhookData.webhookId;
|
||||
return true;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getSites(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const sites = await netlifyApiRequest.call(this, 'GET', '/sites');
|
||||
for (const site of sites) {
|
||||
returnData.push({
|
||||
name: site.name,
|
||||
value: site.site_id,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
async getForms(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const siteId = this.getNodeParameter('siteId');
|
||||
const forms = await netlifyApiRequest.call(this, 'GET', `/sites/${siteId}/forms`);
|
||||
for (const form of forms) {
|
||||
returnData.push({
|
||||
name: form.name,
|
||||
value: form.id,
|
||||
});
|
||||
}
|
||||
returnData.unshift({ name: '[All Forms]', value: '*' });
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const req = this.getRequestObject();
|
||||
const simple = this.getNodeParameter('simple', false) as boolean;
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
let response = req.body;
|
||||
|
||||
if (simple && event === 'submissionCreated') {
|
||||
response = response.data;
|
||||
}
|
||||
|
||||
return {
|
||||
workflowData: [this.helpers.returnJsonArray(response as IDataObject)],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const siteOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['site'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a site',
|
||||
action: 'Delete a site',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a site',
|
||||
action: 'Get a site',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Returns many sites',
|
||||
action: 'Get many sites',
|
||||
},
|
||||
],
|
||||
default: 'delete',
|
||||
},
|
||||
];
|
||||
|
||||
export const siteFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Site ID',
|
||||
name: 'siteId',
|
||||
required: true,
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['site'],
|
||||
operation: ['get', 'delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['getAll'],
|
||||
resource: ['site'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['getAll'],
|
||||
resource: ['site'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 200,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="113" fill="none"><g clip-path="url(#a)"><path fill="#05BDBA" d="M34.593 94.05h-1.209l-6.033-6.032v-1.209l9.223-9.222h6.39l.852.852v6.39zm-7.242-68.234v-1.209l6.033-6.033h1.209l9.223 9.223v6.39l-.852.852h-6.39z"/><path fill="#014847" d="M80.46 74.605h-8.778l-.733-.733V53.326c0-3.656-1.436-6.489-5.844-6.588-2.269-.06-4.865 0-7.638.11l-.416.425v26.589l-.733.733H47.54l-.733-.733V38.764l.733-.733h19.753c7.677 0 13.898 6.22 13.898 13.898v21.943z"/><path fill="#05BDBA" d="M35.841 61.45H.733L0 60.715v-8.797l.733-.733h35.108l.733.733v8.797zm91.436 0H92.169l-.733-.734v-8.797l.733-.733h35.108l.733.733v8.797zM58.943 27.064V.734L59.676 0h8.797l.733.733v26.331l-.733.733h-8.797zm0 84.838v-26.33l.733-.734h8.797l.733.733v26.331l-.733.733h-8.797z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h128v112.635H0z"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 895 B |
Reference in New Issue
Block a user