mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IBinaryKeyData,
|
||||
@@ -13,10 +11,7 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
pushbulletApiRequest,
|
||||
pushbulletApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { pushbulletApiRequest, pushbulletApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@@ -61,9 +56,7 @@ export class Pushbullet implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
resource: ['push'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -115,12 +108,8 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: 'note',
|
||||
@@ -132,16 +121,9 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
type: [
|
||||
'note',
|
||||
'link',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
type: ['note', 'link'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -154,17 +136,9 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
type: [
|
||||
'note',
|
||||
'link',
|
||||
'file',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
type: ['note', 'link', 'file'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -177,15 +151,9 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
type: [
|
||||
'link',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
type: ['link'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -199,19 +167,14 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
type: [
|
||||
'file',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
type: ['file'],
|
||||
},
|
||||
},
|
||||
placeholder: '',
|
||||
description: 'Name of the binary property which contains the data for the file to be created',
|
||||
description:
|
||||
'Name of the binary property which contains the data for the file to be created',
|
||||
},
|
||||
{
|
||||
displayName: 'Target',
|
||||
@@ -226,7 +189,7 @@ export class Pushbullet implements INodeType {
|
||||
{
|
||||
name: 'Default',
|
||||
value: 'default',
|
||||
description: 'Broadcast it to all of the user\'s devices',
|
||||
description: "Broadcast it to all of the user's devices",
|
||||
},
|
||||
{
|
||||
name: 'Device ID',
|
||||
@@ -242,12 +205,8 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: 'default',
|
||||
@@ -260,22 +219,16 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
},
|
||||
hide: {
|
||||
target: [
|
||||
'default',
|
||||
'device_iden',
|
||||
],
|
||||
target: ['default', 'device_iden'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The value to be set depending on the target selected. For example, if the target selected is email then this field would take the email address of the person you are trying to send the push to.',
|
||||
description:
|
||||
'The value to be set depending on the target selected. For example, if the target selected is email then this field would take the email address of the person you are trying to send the push to.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value Name or ID',
|
||||
@@ -287,19 +240,14 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
target: [
|
||||
'device_iden',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['create'],
|
||||
target: ['device_iden'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
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>',
|
||||
},
|
||||
{
|
||||
displayName: 'Push ID',
|
||||
@@ -308,12 +256,8 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -324,12 +268,8 @@ export class Pushbullet implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['push'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -341,15 +281,9 @@ export class Pushbullet implements INodeType {
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['push'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -367,12 +301,8 @@ export class Pushbullet implements INodeType {
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -382,7 +312,7 @@ export class Pushbullet implements INodeType {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
|
||||
description: 'Don\'t return deleted pushes',
|
||||
description: "Don't return deleted pushes",
|
||||
},
|
||||
{
|
||||
displayName: 'Modified After',
|
||||
@@ -400,12 +330,8 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -417,16 +343,13 @@ export class Pushbullet implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'push',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['push'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to mark a push as having been dismissed by the user, will cause any notifications for the push to be hidden if possible',
|
||||
description:
|
||||
'Whether to mark a push as having been dismissed by the user, will cause any notifications for the push to be hidden if possible',
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -447,7 +370,6 @@ export class Pushbullet implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
@@ -492,7 +414,11 @@ export class Pushbullet implements INodeType {
|
||||
}
|
||||
//@ts-ignore
|
||||
if (items[i].binary[binaryPropertyName] === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryPropertyName}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName];
|
||||
@@ -504,48 +430,30 @@ export class Pushbullet implements INodeType {
|
||||
file_name,
|
||||
file_type,
|
||||
file_url,
|
||||
} = await pushbulletApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/upload-request`,
|
||||
{
|
||||
file_name: binaryData.fileName,
|
||||
file_type: binaryData.mimeType,
|
||||
},
|
||||
);
|
||||
} = await pushbulletApiRequest.call(this, 'POST', `/upload-request`, {
|
||||
file_name: binaryData.fileName,
|
||||
file_type: binaryData.mimeType,
|
||||
});
|
||||
|
||||
//upload the file
|
||||
await pushbulletApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'',
|
||||
{},
|
||||
{},
|
||||
uploadUrl,
|
||||
{
|
||||
formData: {
|
||||
file: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
await pushbulletApiRequest.call(this, 'POST', '', {}, {}, uploadUrl, {
|
||||
formData: {
|
||||
file: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
json: false,
|
||||
},
|
||||
);
|
||||
json: false,
|
||||
});
|
||||
|
||||
body.file_name = file_name;
|
||||
body.file_type = file_type;
|
||||
body.file_url = file_url;
|
||||
}
|
||||
|
||||
responseData = await pushbulletApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/pushes`,
|
||||
body,
|
||||
);
|
||||
responseData = await pushbulletApiRequest.call(this, 'POST', `/pushes`, body);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -560,8 +468,14 @@ export class Pushbullet implements INodeType {
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await pushbulletApiRequestAllItems.call(this, 'pushes', 'GET', '/pushes', {}, qs);
|
||||
|
||||
responseData = await pushbulletApiRequestAllItems.call(
|
||||
this,
|
||||
'pushes',
|
||||
'GET',
|
||||
'/pushes',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', 0) as number;
|
||||
|
||||
@@ -574,11 +488,7 @@ export class Pushbullet implements INodeType {
|
||||
if (operation === 'delete') {
|
||||
const pushId = this.getNodeParameter('pushId', i) as string;
|
||||
|
||||
responseData = await pushbulletApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/pushes/${pushId}`,
|
||||
);
|
||||
responseData = await pushbulletApiRequest.call(this, 'DELETE', `/pushes/${pushId}`);
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
@@ -588,22 +498,15 @@ export class Pushbullet implements INodeType {
|
||||
|
||||
const dismissed = this.getNodeParameter('dismissed', i) as boolean;
|
||||
|
||||
responseData = await pushbulletApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/pushes/${pushId}`,
|
||||
{
|
||||
dismissed,
|
||||
},
|
||||
);
|
||||
responseData = await pushbulletApiRequest.call(this, 'POST', `/pushes/${pushId}`, {
|
||||
dismissed,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
|
||||
Reference in New Issue
Block a user