@@ -37,6 +37,7 @@ import {
3737 reactionRemoved ,
3838 reactionUpdated ,
3939} from "./payload-examples" ;
40+ import { onCommentProperties , onIssueProperties , updatedFromProperties } from "./utils" ;
4041
4142/** **WARNING:** Still in alpha - use with caution! */
4243export const onAttachment : EventSpecification < GetLinearPayload < AttachmentEvent > > = {
@@ -53,46 +54,49 @@ export const onAttachment: EventSpecification<GetLinearPayload<AttachmentEvent>>
5354} ;
5455
5556/** **WARNING:** Still in alpha - use with caution! */
56- export const onAttachmentCreated : EventSpecification < GetLinearPayload < AttachmentEvent , "create" > > = {
57- name : "Attachment" ,
58- title : "On Attachment Created" ,
59- source : "linear.app" ,
60- icon : "linear" ,
61- filter : {
62- action : [ "create" ] ,
63- } ,
64- examples : [ attachmentCreated ] ,
65- parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "create" > ,
66- runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
67- } ;
57+ export const onAttachmentCreated : EventSpecification < GetLinearPayload < AttachmentEvent , "create" > > =
58+ {
59+ name : "Attachment" ,
60+ title : "On Attachment Created" ,
61+ source : "linear.app" ,
62+ icon : "linear" ,
63+ filter : {
64+ action : [ "create" ] ,
65+ } ,
66+ examples : [ attachmentCreated ] ,
67+ parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "create" > ,
68+ runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
69+ } ;
6870
6971/** **WARNING:** Still in alpha - use with caution! */
70- export const onAttachmentRemoved : EventSpecification < GetLinearPayload < AttachmentEvent , "remove" > > = {
71- name : "Attachment" ,
72- title : "On Attachment Removed" ,
73- source : "linear.app" ,
74- icon : "linear" ,
75- filter : {
76- action : [ "remove" ] ,
77- } ,
78- examples : [ attachmentRemoved ] ,
79- parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "remove" > ,
80- runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
81- } ;
72+ export const onAttachmentRemoved : EventSpecification < GetLinearPayload < AttachmentEvent , "remove" > > =
73+ {
74+ name : "Attachment" ,
75+ title : "On Attachment Removed" ,
76+ source : "linear.app" ,
77+ icon : "linear" ,
78+ filter : {
79+ action : [ "remove" ] ,
80+ } ,
81+ examples : [ attachmentRemoved ] ,
82+ parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "remove" > ,
83+ runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
84+ } ;
8285
8386/** **WARNING:** Still in alpha - use with caution! */
84- export const onAttachmentUpdated : EventSpecification < GetLinearPayload < AttachmentEvent , "update" > > = {
85- name : "Attachment" ,
86- title : "On Attachment Updated" ,
87- source : "linear.app" ,
88- icon : "linear" ,
89- filter : {
90- action : [ "update" ] ,
91- } ,
92- examples : [ attachmentUpdated ] ,
93- parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "update" > ,
94- runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
95- } ;
87+ export const onAttachmentUpdated : EventSpecification < GetLinearPayload < AttachmentEvent , "update" > > =
88+ {
89+ name : "Attachment" ,
90+ title : "On Attachment Updated" ,
91+ source : "linear.app" ,
92+ icon : "linear" ,
93+ filter : {
94+ action : [ "update" ] ,
95+ } ,
96+ examples : [ attachmentUpdated ] ,
97+ parsePayload : ( payload ) => payload as GetLinearPayload < AttachmentEvent , "update" > ,
98+ runProperties : ( payload ) => [ { label : "Attachment ID" , text : payload . data . id } ] ,
99+ } ;
96100
97101export const onComment : EventSpecification < GetLinearPayload < CommentEvent > > = {
98102 name : "Comment" ,
@@ -103,7 +107,8 @@ export const onComment: EventSpecification<GetLinearPayload<CommentEvent>> = {
103107 parsePayload : ( payload ) => payload as GetLinearPayload < CommentEvent > ,
104108 runProperties : ( payload ) => [
105109 { label : "Event action" , text : payload . action } ,
106- { label : "Comment ID" , text : payload . data . id } ,
110+ ...onCommentProperties ( payload ) ,
111+ ...updatedFromProperties ( payload ) ,
107112 ] ,
108113} ;
109114
@@ -117,7 +122,7 @@ export const onCommentCreated: EventSpecification<GetLinearPayload<CommentEvent,
117122 } ,
118123 examples : [ commentCreated ] ,
119124 parsePayload : ( payload ) => payload as GetLinearPayload < CommentEvent , "create" > ,
120- runProperties : ( payload ) => [ { label : "Comment ID" , text : payload . data . id } ] ,
125+ runProperties : ( payload ) => onCommentProperties ( payload ) ,
121126} ;
122127
123128export const onCommentRemoved : EventSpecification < GetLinearPayload < CommentEvent , "remove" > > = {
@@ -130,7 +135,7 @@ export const onCommentRemoved: EventSpecification<GetLinearPayload<CommentEvent,
130135 } ,
131136 examples : [ commentRemoved ] ,
132137 parsePayload : ( payload ) => payload as GetLinearPayload < CommentEvent , "remove" > ,
133- runProperties : ( payload ) => [ { label : "Comment ID" , text : payload . data . id } ] ,
138+ runProperties : ( payload ) => onCommentProperties ( payload ) ,
134139} ;
135140
136141export const onCommentUpdated : EventSpecification < GetLinearPayload < CommentEvent , "update" > > = {
@@ -143,7 +148,7 @@ export const onCommentUpdated: EventSpecification<GetLinearPayload<CommentEvent,
143148 } ,
144149 examples : [ commentUpdated ] ,
145150 parsePayload : ( payload ) => payload as GetLinearPayload < CommentEvent , "update" > ,
146- runProperties : ( payload ) => [ { label : "Comment ID" , text : payload . data . id } ] ,
151+ runProperties : ( payload ) => [ ... onCommentProperties ( payload ) , ... updatedFromProperties ( payload ) ] ,
147152} ;
148153
149154export const onCycle : EventSpecification < GetLinearPayload < CycleEvent > > = {
@@ -207,7 +212,8 @@ export const onIssue: EventSpecification<GetLinearPayload<IssueEvent>> = {
207212 parsePayload : ( payload ) => payload as GetLinearPayload < IssueEvent > ,
208213 runProperties : ( payload ) => [
209214 { label : "Event action" , text : payload . action } ,
210- { label : "Issue ID" , text : payload . data . id } ,
215+ ...onIssueProperties ( payload ) ,
216+ ...updatedFromProperties ( payload ) ,
211217 ] ,
212218} ;
213219
@@ -221,7 +227,7 @@ export const onIssueCreated: EventSpecification<GetLinearPayload<IssueEvent, "cr
221227 } ,
222228 examples : [ issueCreated ] ,
223229 parsePayload : ( payload ) => payload as GetLinearPayload < IssueEvent , "create" > ,
224- runProperties : ( payload ) => [ { label : "Issue ID" , text : payload . data . id } ] ,
230+ runProperties : ( payload ) => onIssueProperties ( payload ) ,
225231} ;
226232
227233export const onIssueRemoved : EventSpecification < GetLinearPayload < IssueEvent , "remove" > > = {
@@ -234,7 +240,7 @@ export const onIssueRemoved: EventSpecification<GetLinearPayload<IssueEvent, "re
234240 } ,
235241 examples : [ issueRemoved ] ,
236242 parsePayload : ( payload ) => payload as GetLinearPayload < IssueEvent , "remove" > ,
237- runProperties : ( payload ) => [ { label : "Issue ID" , text : payload . data . id } ] ,
243+ runProperties : ( payload ) => onIssueProperties ( payload ) ,
238244} ;
239245
240246export const onIssueUpdated : EventSpecification < GetLinearPayload < IssueEvent , "update" > > = {
@@ -247,7 +253,7 @@ export const onIssueUpdated: EventSpecification<GetLinearPayload<IssueEvent, "up
247253 } ,
248254 examples : [ issueUpdated ] ,
249255 parsePayload : ( payload ) => payload as GetLinearPayload < IssueEvent , "update" > ,
250- runProperties : ( payload ) => [ { label : "Issue ID" , text : payload . data . id } ] ,
256+ runProperties : ( payload ) => [ ... onIssueProperties ( payload ) , ... updatedFromProperties ( payload ) ] ,
251257} ;
252258
253259export const onIssueLabel : EventSpecification < GetLinearPayload < IssueLabelEvent > > = {
@@ -263,44 +269,47 @@ export const onIssueLabel: EventSpecification<GetLinearPayload<IssueLabelEvent>>
263269 ] ,
264270} ;
265271
266- export const onIssueLabelCreated : EventSpecification < GetLinearPayload < IssueLabelEvent , "create" > > = {
267- name : "IssueLabel" ,
268- title : "On IssueLabel Created" ,
269- source : "linear.app" ,
270- icon : "linear" ,
271- filter : {
272- action : [ "create" ] ,
273- } ,
274- examples : [ issueLabelCreated ] ,
275- parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "create" > ,
276- runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
277- } ;
278-
279- export const onIssueLabelRemoved : EventSpecification < GetLinearPayload < IssueLabelEvent , "remove" > > = {
280- name : "IssueLabel" ,
281- title : "On IssueLabel Removed" ,
282- source : "linear.app" ,
283- icon : "linear" ,
284- filter : {
285- action : [ "remove" ] ,
286- } ,
287- examples : [ issueLabelRemoved ] ,
288- parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "remove" > ,
289- runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
290- } ;
291-
292- export const onIssueLabelUpdated : EventSpecification < GetLinearPayload < IssueLabelEvent , "update" > > = {
293- name : "IssueLabel" ,
294- title : "On IssueLabel Updated" ,
295- source : "linear.app" ,
296- icon : "linear" ,
297- filter : {
298- action : [ "update" ] ,
299- } ,
300- examples : [ issueLabelUpdated ] ,
301- parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "update" > ,
302- runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
303- } ;
272+ export const onIssueLabelCreated : EventSpecification < GetLinearPayload < IssueLabelEvent , "create" > > =
273+ {
274+ name : "IssueLabel" ,
275+ title : "On IssueLabel Created" ,
276+ source : "linear.app" ,
277+ icon : "linear" ,
278+ filter : {
279+ action : [ "create" ] ,
280+ } ,
281+ examples : [ issueLabelCreated ] ,
282+ parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "create" > ,
283+ runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
284+ } ;
285+
286+ export const onIssueLabelRemoved : EventSpecification < GetLinearPayload < IssueLabelEvent , "remove" > > =
287+ {
288+ name : "IssueLabel" ,
289+ title : "On IssueLabel Removed" ,
290+ source : "linear.app" ,
291+ icon : "linear" ,
292+ filter : {
293+ action : [ "remove" ] ,
294+ } ,
295+ examples : [ issueLabelRemoved ] ,
296+ parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "remove" > ,
297+ runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
298+ } ;
299+
300+ export const onIssueLabelUpdated : EventSpecification < GetLinearPayload < IssueLabelEvent , "update" > > =
301+ {
302+ name : "IssueLabel" ,
303+ title : "On IssueLabel Updated" ,
304+ source : "linear.app" ,
305+ icon : "linear" ,
306+ filter : {
307+ action : [ "update" ] ,
308+ } ,
309+ examples : [ issueLabelUpdated ] ,
310+ parsePayload : ( payload ) => payload as GetLinearPayload < IssueLabelEvent , "update" > ,
311+ runProperties : ( payload ) => [ { label : "IssueLabel ID" , text : payload . data . id } ] ,
312+ } ;
304313
305314// TODO: this needs to be tested
306315export const onIssueSLA : EventSpecification < GetLinearPayload < IssueSLAEvent > > = {
@@ -361,6 +370,8 @@ export const onProject: EventSpecification<GetLinearPayload<ProjectEvent>> = {
361370 runProperties : ( payload ) => [
362371 { label : "Event action" , text : payload . action } ,
363372 { label : "Project ID" , text : payload . data . id } ,
373+ { label : "Project Name" , text : payload . data . name , url : payload . url ?? undefined } ,
374+ ...updatedFromProperties ( payload ) ,
364375 ] ,
365376} ;
366377
@@ -374,7 +385,10 @@ export const onProjectCreated: EventSpecification<GetLinearPayload<ProjectEvent,
374385 } ,
375386 examples : [ projectCreated ] ,
376387 parsePayload : ( payload ) => payload as GetLinearPayload < ProjectEvent , "create" > ,
377- runProperties : ( payload ) => [ { label : "Project ID" , text : payload . data . id } ] ,
388+ runProperties : ( payload ) => [
389+ { label : "Project ID" , text : payload . data . id } ,
390+ { label : "Project Name" , text : payload . data . name , url : payload . url ?? undefined } ,
391+ ] ,
378392} ;
379393
380394export const onProjectRemoved : EventSpecification < GetLinearPayload < ProjectEvent , "remove" > > = {
@@ -387,10 +401,12 @@ export const onProjectRemoved: EventSpecification<GetLinearPayload<ProjectEvent,
387401 } ,
388402 examples : [ projectRemoved ] ,
389403 parsePayload : ( payload ) => payload as GetLinearPayload < ProjectEvent , "remove" > ,
390- runProperties : ( payload ) => [ { label : "Project ID" , text : payload . data . id } ] ,
404+ runProperties : ( payload ) => [
405+ { label : "Project ID" , text : payload . data . id } ,
406+ { label : "Project Name" , text : payload . data . name , url : payload . url ?? undefined } ,
407+ ] ,
391408} ;
392409
393- // TODO: think of a better naming scheme (clashes with ProjectUpdated entity)
394410export const onProjectUpdated : EventSpecification < GetLinearPayload < ProjectEvent , "update" > > = {
395411 name : "Project" ,
396412 title : "On Project Updated" ,
@@ -401,7 +417,11 @@ export const onProjectUpdated: EventSpecification<GetLinearPayload<ProjectEvent,
401417 } ,
402418 examples : [ projectUpdated ] ,
403419 parsePayload : ( payload ) => payload as GetLinearPayload < ProjectEvent , "update" > ,
404- runProperties : ( payload ) => [ { label : "Project ID" , text : payload . data . id } ] ,
420+ runProperties : ( payload ) => [
421+ { label : "Project ID" , text : payload . data . id } ,
422+ { label : "Project Name" , text : payload . data . name , url : payload . url ?? undefined } ,
423+ ...updatedFromProperties ( payload ) ,
424+ ] ,
405425} ;
406426
407427export const onProjectUpdate : EventSpecification < GetLinearPayload < ProjectUpdateEvent > > = {
@@ -417,7 +437,9 @@ export const onProjectUpdate: EventSpecification<GetLinearPayload<ProjectUpdateE
417437 ] ,
418438} ;
419439
420- export const onProjectUpdateCreated : EventSpecification < GetLinearPayload < ProjectUpdateEvent , "create" > > = {
440+ export const onProjectUpdateCreated : EventSpecification <
441+ GetLinearPayload < ProjectUpdateEvent , "create" >
442+ > = {
421443 name : "ProjectUpdate" ,
422444 title : "On ProjectUpdate Created" ,
423445 source : "linear.app" ,
@@ -430,7 +452,9 @@ export const onProjectUpdateCreated: EventSpecification<GetLinearPayload<Project
430452 runProperties : ( payload ) => [ { label : "ProjectUpdate ID" , text : payload . data . id } ] ,
431453} ;
432454
433- export const onProjectUpdateRemoved : EventSpecification < GetLinearPayload < ProjectUpdateEvent , "remove" > > = {
455+ export const onProjectUpdateRemoved : EventSpecification <
456+ GetLinearPayload < ProjectUpdateEvent , "remove" >
457+ > = {
434458 name : "ProjectUpdate" ,
435459 title : "On ProjectUpdate Removed" ,
436460 source : "linear.app" ,
@@ -443,7 +467,9 @@ export const onProjectUpdateRemoved: EventSpecification<GetLinearPayload<Project
443467 runProperties : ( payload ) => [ { label : "ProjectUpdate ID" , text : payload . data . id } ] ,
444468} ;
445469
446- export const onProjectUpdateUpdated : EventSpecification < GetLinearPayload < ProjectUpdateEvent , "update" > > = {
470+ export const onProjectUpdateUpdated : EventSpecification <
471+ GetLinearPayload < ProjectUpdateEvent , "update" >
472+ > = {
447473 name : "ProjectUpdate" ,
448474 title : "On ProjectUpdate Updated" ,
449475 source : "linear.app" ,
0 commit comments