@@ -17,7 +17,7 @@ export class JiraTrigger implements INodeType {
17
17
name : 'jiraTrigger' ,
18
18
icon : 'file:jira.svg' ,
19
19
group : [ 'trigger' ] ,
20
- version : 1 ,
20
+ version : [ 1 , 1.1 ] ,
21
21
description : 'Starts the workflow when Jira events occur' ,
22
22
defaults : {
23
23
name : 'Jira Trigger' ,
@@ -26,6 +26,7 @@ export class JiraTrigger implements INodeType {
26
26
outputs : [ 'main' ] ,
27
27
credentials : [
28
28
{
29
+ displayName : 'Credentials to Connect to Jira' ,
29
30
name : 'jiraSoftwareCloudApi' ,
30
31
required : true ,
31
32
displayOptions : {
@@ -35,6 +36,7 @@ export class JiraTrigger implements INodeType {
35
36
} ,
36
37
} ,
37
38
{
39
+ displayName : 'Credentials to Connect to Jira' ,
38
40
name : 'jiraSoftwareServerApi' ,
39
41
required : true ,
40
42
displayOptions : {
@@ -46,7 +48,17 @@ export class JiraTrigger implements INodeType {
46
48
{
47
49
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
48
50
name : 'httpQueryAuth' ,
49
- required : true ,
51
+ displayName : 'Credentials to Authenticate Webhook' ,
52
+ displayOptions : {
53
+ show : {
54
+ authenticateWebhook : [ true ] ,
55
+ } ,
56
+ } ,
57
+ } ,
58
+ {
59
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
60
+ name : 'httpQueryAuth' ,
61
+ displayName : 'Credentials to Authenticate Webhook' ,
50
62
displayOptions : {
51
63
show : {
52
64
incomingAuthentication : [ 'queryAuth' ] ,
@@ -80,7 +92,20 @@ export class JiraTrigger implements INodeType {
80
92
default : 'cloud' ,
81
93
} ,
82
94
{
83
- displayName : 'Incoming Authentication' ,
95
+ displayName : 'Authenticate Incoming Webhook' ,
96
+ name : 'authenticateWebhook' ,
97
+ type : 'boolean' ,
98
+ default : false ,
99
+ description :
100
+ 'Whether authentication should be activated for the incoming webhooks (makes it more secure)' ,
101
+ displayOptions : {
102
+ show : {
103
+ '@version' : [ { _cnd : { gte : 1.1 } } ] ,
104
+ } ,
105
+ } ,
106
+ } ,
107
+ {
108
+ displayName : 'Authenticate Webhook With' ,
84
109
name : 'incomingAuthentication' ,
85
110
type : 'options' ,
86
111
options : [
@@ -95,6 +120,11 @@ export class JiraTrigger implements INodeType {
95
120
] ,
96
121
default : 'none' ,
97
122
description : 'If authentication should be activated for the webhook (makes it more secure)' ,
123
+ displayOptions : {
124
+ show : {
125
+ '@version' : [ 1 ] ,
126
+ } ,
127
+ } ,
98
128
} ,
99
129
{
100
130
displayName : 'Events' ,
@@ -382,17 +412,24 @@ export class JiraTrigger implements INodeType {
382
412
return false ;
383
413
} ,
384
414
async create ( this : IHookFunctions ) : Promise < boolean > {
415
+ const nodeVersion = this . getNode ( ) . typeVersion ;
385
416
const webhookUrl = this . getNodeWebhookUrl ( 'default' ) as string ;
386
-
387
417
let events = this . getNodeParameter ( 'events' , [ ] ) as string [ ] ;
388
-
389
418
const additionalFields = this . getNodeParameter ( 'additionalFields' ) as IDataObject ;
390
-
391
419
const endpoint = '/webhooks/1.0/webhook' ;
392
-
393
420
const webhookData = this . getWorkflowStaticData ( 'node' ) ;
394
421
395
- const incomingAuthentication = this . getNodeParameter ( 'incomingAuthentication' ) as string ;
422
+ let authenticateWebhook = false ;
423
+
424
+ if ( nodeVersion === 1 ) {
425
+ const incomingAuthentication = this . getNodeParameter ( 'incomingAuthentication' ) as string ;
426
+
427
+ if ( incomingAuthentication === 'queryAuth' ) {
428
+ authenticateWebhook = true ;
429
+ }
430
+ } else {
431
+ authenticateWebhook = this . getNodeParameter ( 'authenticateWebhook' ) as boolean ;
432
+ }
396
433
397
434
if ( events . includes ( '*' ) ) {
398
435
events = allEvents ;
@@ -418,7 +455,7 @@ export class JiraTrigger implements INodeType {
418
455
419
456
const parameters : any = { } ;
420
457
421
- if ( incomingAuthentication === 'queryAuth' ) {
458
+ if ( authenticateWebhook ) {
422
459
let httpQueryAuth ;
423
460
try {
424
461
httpQueryAuth = await this . getCredentials ( 'httpQueryAuth' ) ;
@@ -477,13 +514,24 @@ export class JiraTrigger implements INodeType {
477
514
} ;
478
515
479
516
async webhook ( this : IWebhookFunctions ) : Promise < IWebhookResponseData > {
517
+ const nodeVersion = this . getNode ( ) . typeVersion ;
480
518
const bodyData = this . getBodyData ( ) ;
481
519
const queryData = this . getQueryData ( ) as IDataObject ;
482
520
const response = this . getResponseObject ( ) ;
483
521
484
- const incomingAuthentication = this . getNodeParameter ( 'incomingAuthentication' ) as string ;
522
+ let authenticateWebhook = false ;
523
+
524
+ if ( nodeVersion === 1 ) {
525
+ const incomingAuthentication = this . getNodeParameter ( 'incomingAuthentication' ) as string ;
526
+
527
+ if ( incomingAuthentication === 'queryAuth' ) {
528
+ authenticateWebhook = true ;
529
+ }
530
+ } else {
531
+ authenticateWebhook = this . getNodeParameter ( 'authenticateWebhook' ) as boolean ;
532
+ }
485
533
486
- if ( incomingAuthentication === 'queryAuth' ) {
534
+ if ( authenticateWebhook ) {
487
535
let httpQueryAuth : ICredentialDataDecryptedObject | undefined ;
488
536
489
537
try {
0 commit comments