mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -15,12 +10,19 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
snakeCase,
|
||||
} from 'change-case';
|
||||
|
||||
export async function pagerDutyApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
import { snakeCase } from 'change-case';
|
||||
|
||||
export async function pagerDutyApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
uri?: string,
|
||||
headers: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
@@ -61,8 +63,16 @@ export async function pagerDutyApiRequest(this: IExecuteFunctions | IWebhookFunc
|
||||
}
|
||||
}
|
||||
|
||||
export async function pagerDutyApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function pagerDutyApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -73,14 +83,12 @@ export async function pagerDutyApiRequestAllItems(this: IExecuteFunctions | ILoa
|
||||
responseData = await pagerDutyApiRequest.call(this, method, endpoint, body, query);
|
||||
query.offset++;
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData.more
|
||||
);
|
||||
} while (responseData.more);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function keysToSnakeCase(elements: IDataObject[] | IDataObject) : IDataObject[] {
|
||||
export function keysToSnakeCase(elements: IDataObject[] | IDataObject): IDataObject[] {
|
||||
if (!Array.isArray(elements)) {
|
||||
elements = [elements];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const incidentOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const incidentOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
resource: ['incident'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -46,10 +42,9 @@ export const incidentOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const incidentFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
@@ -58,12 +53,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'A succinct description of the nature, symptoms, cause, or effect of the incident',
|
||||
@@ -79,15 +70,12 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
@@ -98,12 +86,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'The email address of a valid user associated with the account making the request',
|
||||
@@ -115,12 +99,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -133,7 +113,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getEscalationPolicies',
|
||||
},
|
||||
default: '',
|
||||
description: 'Delegate this incident to the specified escalation policy. Cannot be specified if an assignee is given. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Delegate this incident to the specified escalation policy. Cannot be specified if an assignee is given. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Incident Details',
|
||||
@@ -147,7 +128,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'incidentKey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Sending subsequent requests referencing the same service and with the same incident_key will result in those requests being rejected if an open incident matches that incident_key',
|
||||
description:
|
||||
'Sending subsequent requests referencing the same service and with the same incident_key will result in those requests being rejected if an open incident matches that incident_key',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority Name or ID',
|
||||
@@ -157,7 +139,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getPriorities',
|
||||
},
|
||||
default: '',
|
||||
description: 'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Urgency',
|
||||
@@ -188,12 +171,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
placeholder: 'Add Conference Bridge',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -207,22 +186,24 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'conferenceNumber',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone numbers should be formatted like +1 415-555-1212,,,,1234#, where a comma (,) represents a one-second wait and pound (#) completes access code input',
|
||||
description:
|
||||
'Phone numbers should be formatted like +1 415-555-1212,,,,1234#, where a comma (,) represents a one-second wait and pound (#) completes access code input',
|
||||
},
|
||||
{
|
||||
displayName: 'Conference URL',
|
||||
name: 'conferenceUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An URL for the conference bridge. This could be a link to a web conference or Slack channel.',
|
||||
description:
|
||||
'An URL for the conference bridge. This could be a link to a web conference or Slack channel.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Incident ID',
|
||||
name: 'incidentId',
|
||||
@@ -231,31 +212,23 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the incident',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['incident'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -267,15 +240,9 @@ export const incidentFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['incident'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -293,12 +260,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -320,7 +283,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'incidentKey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Incident de-duplication key. Incidents with child alerts do not have an incident key; querying by incident key will return incidents whose alerts have alert_key matching the given incident key.',
|
||||
description:
|
||||
'Incident de-duplication key. Incidents with child alerts do not have an incident key; querying by incident key will return incidents whose alerts have alert_key matching the given incident key.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include',
|
||||
@@ -375,14 +339,16 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getServices',
|
||||
},
|
||||
default: [],
|
||||
description: 'Returns only the incidents associated with the passed service(s). Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Returns only the incidents associated with the passed service(s). Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Since',
|
||||
name: 'since',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The start of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
description:
|
||||
'The start of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort By',
|
||||
@@ -390,7 +356,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'created_at:asc,resolved_at:desc',
|
||||
description: 'Used to specify both the field you wish to sort the results on (incident_number/created_at/resolved_at/urgency), as well as the direction (asc/desc) of the results. The sort_by field and direction should be separated by a colon. A maximum of two fields can be included, separated by a comma.',
|
||||
description:
|
||||
'Used to specify both the field you wish to sort the results on (incident_number/created_at/resolved_at/urgency), as well as the direction (asc/desc) of the results. The sort_by field and direction should be separated by a colon. A maximum of two fields can be included, separated by a comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Statuses',
|
||||
@@ -418,7 +385,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'teamIds',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter. (multiples IDs can be added separated by comma)',
|
||||
description:
|
||||
'Team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter. (multiples IDs can be added separated by comma)',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone Name or ID',
|
||||
@@ -428,14 +396,16 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: 'Time zone in which dates in the result will be rendered. If not set dates will return UTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Time zone in which dates in the result will be rendered. If not set dates will return UTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Until',
|
||||
name: 'until',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The end of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
description:
|
||||
'The end of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
},
|
||||
{
|
||||
displayName: 'Urgencies',
|
||||
@@ -452,20 +422,22 @@ export const incidentFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: [],
|
||||
description: 'Urgencies of the incidents to be returned. Defaults to all urgencies. Account must have the urgencies ability to do this',
|
||||
description:
|
||||
'Urgencies of the incidents to be returned. Defaults to all urgencies. Account must have the urgencies ability to do this',
|
||||
},
|
||||
{
|
||||
displayName: 'User IDs',
|
||||
name: 'userIds',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Returns only the incidents currently assigned to the passed user(s). This expects one or more user IDs (multiple IDs can be added separated by comma).',
|
||||
description:
|
||||
'Returns only the incidents currently assigned to the passed user(s). This expects one or more user IDs (multiple IDs can be added separated by comma).',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incident:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Incident ID',
|
||||
name: 'incidentId',
|
||||
@@ -474,12 +446,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the incident',
|
||||
@@ -493,12 +461,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
description: 'The email address of a valid user associated with the account making the request',
|
||||
@@ -510,12 +474,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -538,7 +498,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getEscalationPolicies',
|
||||
},
|
||||
default: '',
|
||||
description: 'Delegate this incident to the specified escalation policy. Cannot be specified if an assignee is given. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Delegate this incident to the specified escalation policy. Cannot be specified if an assignee is given. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority Name or ID',
|
||||
@@ -548,7 +509,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getPriorities',
|
||||
},
|
||||
default: '',
|
||||
description: 'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The incident will be created on this service. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Resolution',
|
||||
@@ -582,7 +544,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A succinct description of the nature, symptoms, cause, or effect of the incident',
|
||||
description:
|
||||
'A succinct description of the nature, symptoms, cause, or effect of the incident',
|
||||
},
|
||||
{
|
||||
displayName: 'Urgency',
|
||||
@@ -613,12 +576,8 @@ export const incidentFields: INodeProperties[] = [
|
||||
placeholder: 'Add Conference Bridge',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incident',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['incident'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -632,14 +591,16 @@ export const incidentFields: INodeProperties[] = [
|
||||
name: 'conferenceNumber',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone numbers should be formatted like +1 415-555-1212,,,,1234#, where a comma (,) represents a one-second wait and pound (#) completes access code input',
|
||||
description:
|
||||
'Phone numbers should be formatted like +1 415-555-1212,,,,1234#, where a comma (,) represents a one-second wait and pound (#) completes access code input',
|
||||
},
|
||||
{
|
||||
displayName: 'Conference URL',
|
||||
name: 'conferenceUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An URL for the conference bridge. This could be a link to a web conference or Slack channel.',
|
||||
description:
|
||||
'An URL for the conference bridge. This could be a link to a web conference or Slack channel.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IIncident {
|
||||
assignments?: IDataObject[];
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const incidentNoteOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const incidentNoteOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
resource: ['incidentNote'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -25,7 +21,7 @@ export const incidentNoteOperations: INodeProperties[] = [
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all incident\'s notes',
|
||||
description: "Get all incident's notes",
|
||||
action: 'Get all incident notes',
|
||||
},
|
||||
],
|
||||
@@ -34,10 +30,9 @@ export const incidentNoteOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const incidentNoteFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incidentNote:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incidentNote:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Incident ID',
|
||||
name: 'incidentId',
|
||||
@@ -46,12 +41,8 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incidentNote'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the incident',
|
||||
@@ -67,12 +58,8 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incidentNote'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'The note content',
|
||||
@@ -86,19 +73,15 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incidentNote'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'The email address of a valid user associated with the account making the request',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incidentNote:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incidentNote:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Incident ID',
|
||||
name: 'incidentId',
|
||||
@@ -107,12 +90,8 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['incidentNote'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the incident',
|
||||
@@ -123,12 +102,8 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['incidentNote'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -140,15 +115,9 @@ export const incidentNoteFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'incidentNote',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['incidentNote'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const logEntryOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const logEntryOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'logEntry',
|
||||
],
|
||||
resource: ['logEntry'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -34,9 +30,9 @@ export const logEntryOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const logEntryFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* logEntry:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* logEntry:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Log Entry ID',
|
||||
name: 'logEntryId',
|
||||
@@ -45,31 +41,23 @@ export const logEntryFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'logEntry',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['logEntry'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the log entry',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* logEntry:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* logEntry:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'logEntry',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['logEntry'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -81,15 +69,9 @@ export const logEntryFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'logEntry',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['logEntry'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -107,12 +89,8 @@ export const logEntryFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'logEntry',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['logEntry'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -146,14 +124,16 @@ export const logEntryFields: INodeProperties[] = [
|
||||
name: 'isOverview',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return a subset of log entries that show only the most important changes to the incident',
|
||||
description:
|
||||
'Whether to return a subset of log entries that show only the most important changes to the incident',
|
||||
},
|
||||
{
|
||||
displayName: 'Since',
|
||||
name: 'since',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The start of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
description:
|
||||
'The start of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone Name or ID',
|
||||
@@ -163,14 +143,16 @@ export const logEntryFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: 'Time zone in which dates in the result will be rendered. If not set dates will return UTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Time zone in which dates in the result will be rendered. If not set dates will return UTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Until',
|
||||
name: 'until',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The end of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
description:
|
||||
'The end of the date range over which you want to search. (the limit on date ranges is 6 months).',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -17,33 +15,17 @@ import {
|
||||
pagerDutyApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
incidentFields,
|
||||
incidentOperations,
|
||||
} from './IncidentDescription';
|
||||
import { incidentFields, incidentOperations } from './IncidentDescription';
|
||||
|
||||
import {
|
||||
incidentNoteFields,
|
||||
incidentNoteOperations,
|
||||
} from './IncidentNoteDescription';
|
||||
import { incidentNoteFields, incidentNoteOperations } from './IncidentNoteDescription';
|
||||
|
||||
import {
|
||||
logEntryFields,
|
||||
logEntryOperations,
|
||||
} from './LogEntryDescription';
|
||||
import { logEntryFields, logEntryOperations } from './LogEntryDescription';
|
||||
|
||||
import {
|
||||
userFields,
|
||||
userOperations,
|
||||
} from './UserDescription';
|
||||
import { userFields, userOperations } from './UserDescription';
|
||||
|
||||
import {
|
||||
IIncident,
|
||||
} from './IncidentInterface';
|
||||
import { IIncident } from './IncidentInterface';
|
||||
|
||||
import {
|
||||
snakeCase,
|
||||
} from 'change-case';
|
||||
import { snakeCase } from 'change-case';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@@ -67,9 +49,7 @@ export class PagerDuty implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'apiToken',
|
||||
],
|
||||
authentication: ['apiToken'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -78,9 +58,7 @@ export class PagerDuty implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
authentication: ['oAuth2'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -148,7 +126,12 @@ export class PagerDuty implements INodeType {
|
||||
// select them easily
|
||||
async getEscalationPolicies(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const escalationPolicies = await pagerDutyApiRequestAllItems.call(this, 'escalation_policies', 'GET', '/escalation_policies');
|
||||
const escalationPolicies = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'escalation_policies',
|
||||
'GET',
|
||||
'/escalation_policies',
|
||||
);
|
||||
for (const escalationPolicy of escalationPolicies) {
|
||||
const escalationPolicyName = escalationPolicy.name;
|
||||
const escalationPolicyId = escalationPolicy.id;
|
||||
@@ -163,7 +146,12 @@ export class PagerDuty implements INodeType {
|
||||
// select them easily
|
||||
async getPriorities(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const priorities = await pagerDutyApiRequestAllItems.call(this, 'priorities', 'GET', '/priorities');
|
||||
const priorities = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'priorities',
|
||||
'GET',
|
||||
'/priorities',
|
||||
);
|
||||
for (const priority of priorities) {
|
||||
const priorityName = priority.name;
|
||||
const priorityId = priority.id;
|
||||
@@ -180,7 +168,12 @@ export class PagerDuty implements INodeType {
|
||||
// select them easily
|
||||
async getServices(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const services = await pagerDutyApiRequestAllItems.call(this, 'services', 'GET', '/services');
|
||||
const services = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'services',
|
||||
'GET',
|
||||
'/services',
|
||||
);
|
||||
for (const service of services) {
|
||||
const serviceName = service.name;
|
||||
const serviceId = service.id;
|
||||
@@ -225,7 +218,8 @@ export class PagerDuty implements INodeType {
|
||||
const serviceId = this.getNodeParameter('serviceId', i) as string;
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const conferenceBridge = (this.getNodeParameter('conferenceBridgeUi', i) as IDataObject).conferenceBridgeValues as IDataObject;
|
||||
const conferenceBridge = (this.getNodeParameter('conferenceBridgeUi', i) as IDataObject)
|
||||
.conferenceBridgeValues as IDataObject;
|
||||
const body: IIncident = {
|
||||
type: 'incident',
|
||||
title,
|
||||
@@ -264,7 +258,15 @@ export class PagerDuty implements INodeType {
|
||||
conference_url: conferenceBridge.conferenceUrl,
|
||||
};
|
||||
}
|
||||
responseData = await pagerDutyApiRequest.call(this, 'POST', '/incidents', { incident: body }, {}, undefined, { from: email });
|
||||
responseData = await pagerDutyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/incidents',
|
||||
{ incident: body },
|
||||
{},
|
||||
undefined,
|
||||
{ from: email },
|
||||
);
|
||||
responseData = responseData.incident;
|
||||
}
|
||||
//https://api-reference.pagerduty.com/#!/Incidents/get_incidents_id
|
||||
@@ -291,7 +293,14 @@ export class PagerDuty implements INodeType {
|
||||
}
|
||||
Object.assign(qs, keysToSnakeCase(options)[0]);
|
||||
if (returnAll) {
|
||||
responseData = await pagerDutyApiRequestAllItems.call(this, 'incidents', 'GET', '/incidents', {}, qs);
|
||||
responseData = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'incidents',
|
||||
'GET',
|
||||
'/incidents',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await pagerDutyApiRequest.call(this, 'GET', '/incidents', {}, qs);
|
||||
@@ -302,7 +311,8 @@ export class PagerDuty implements INodeType {
|
||||
if (operation === 'update') {
|
||||
const incidentId = this.getNodeParameter('incidentId', i) as string;
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
const conferenceBridge = (this.getNodeParameter('conferenceBridgeUi', i) as IDataObject).conferenceBridgeValues as IDataObject;
|
||||
const conferenceBridge = (this.getNodeParameter('conferenceBridgeUi', i) as IDataObject)
|
||||
.conferenceBridgeValues as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
const body: IIncident = {
|
||||
type: 'incident',
|
||||
@@ -346,7 +356,15 @@ export class PagerDuty implements INodeType {
|
||||
conference_url: conferenceBridge.conferenceUrl,
|
||||
};
|
||||
}
|
||||
responseData = await pagerDutyApiRequest.call(this, 'PUT', `/incidents/${incidentId}`, { incident: body }, {}, undefined, { from: email });
|
||||
responseData = await pagerDutyApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/incidents/${incidentId}`,
|
||||
{ incident: body },
|
||||
{},
|
||||
undefined,
|
||||
{ from: email },
|
||||
);
|
||||
responseData = responseData.incident;
|
||||
}
|
||||
}
|
||||
@@ -359,17 +377,38 @@ export class PagerDuty implements INodeType {
|
||||
const body: IDataObject = {
|
||||
content,
|
||||
};
|
||||
responseData = await pagerDutyApiRequest.call(this, 'POST', `/incidents/${incidentId}/notes`, { note: body }, {}, undefined, { from: email });
|
||||
responseData = await pagerDutyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/incidents/${incidentId}/notes`,
|
||||
{ note: body },
|
||||
{},
|
||||
undefined,
|
||||
{ from: email },
|
||||
);
|
||||
}
|
||||
//https://api-reference.pagerduty.com/#!/Incidents/get_incidents_id_notes
|
||||
if (operation === 'getAll') {
|
||||
const incidentId = this.getNodeParameter('incidentId', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||
if (returnAll) {
|
||||
responseData = await pagerDutyApiRequestAllItems.call(this, 'notes', 'GET', `/incidents/${incidentId}/notes`, {}, qs);
|
||||
responseData = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'notes',
|
||||
'GET',
|
||||
`/incidents/${incidentId}/notes`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await pagerDutyApiRequest.call(this, 'GET', `/incidents/${incidentId}/notes`, {}, qs);
|
||||
responseData = await pagerDutyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/incidents/${incidentId}/notes`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.notes;
|
||||
}
|
||||
}
|
||||
@@ -378,7 +417,11 @@ export class PagerDuty implements INodeType {
|
||||
//https://api-reference.pagerduty.com/#!/Log_Entries/get_log_entries_id
|
||||
if (operation === 'get') {
|
||||
const logEntryId = this.getNodeParameter('logEntryId', i) as string;
|
||||
responseData = await pagerDutyApiRequest.call(this, 'GET', `/log_entries/${logEntryId}`);
|
||||
responseData = await pagerDutyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/log_entries/${logEntryId}`,
|
||||
);
|
||||
responseData = responseData.log_entry;
|
||||
}
|
||||
//https://api-reference.pagerduty.com/#!/Log_Entries/get_log_entries
|
||||
@@ -388,7 +431,14 @@ export class PagerDuty implements INodeType {
|
||||
keysToSnakeCase(qs);
|
||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||
if (returnAll) {
|
||||
responseData = await pagerDutyApiRequestAllItems.call(this, 'log_entries', 'GET', '/log_entries', {}, qs);
|
||||
responseData = await pagerDutyApiRequestAllItems.call(
|
||||
this,
|
||||
'log_entries',
|
||||
'GET',
|
||||
'/log_entries',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await pagerDutyApiRequest.call(this, 'GET', '/log_entries', {}, qs);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const userOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const userOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -28,9 +24,9 @@ export const userOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const userFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
@@ -39,12 +35,8 @@ export const userFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the user',
|
||||
|
||||
Reference in New Issue
Block a user