File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,41 @@ export class Job<
117117 return this . options . logLevel ;
118118 }
119119
120+ get integrations ( ) : Record < string , IntegrationConfig > {
121+ return Object . keys ( this . options . integrations ?? { } ) . reduce (
122+ ( acc : Record < string , IntegrationConfig > , key ) => {
123+ const integration = this . options . integrations ! [ key ] ;
124+
125+ acc [ key ] = {
126+ id : integration . id ,
127+ metadata : integration . metadata ,
128+ authSource : integration . authSource ,
129+ } ;
130+
131+ return acc ;
132+ } ,
133+ { }
134+ ) ;
135+ }
136+
137+ toJSON ( ) : JobMetadata {
138+ // @ts -ignore
139+ const internal = this . options . __internal as JobMetadata [ "internal" ] ;
140+
141+ return {
142+ id : this . id ,
143+ name : this . name ,
144+ version : this . version ,
145+ event : this . trigger . event ,
146+ trigger : this . trigger . toJSON ( ) ,
147+ integrations : this . integrations ,
148+ startPosition : "latest" , // this is deprecated, leaving this for now to make sure newer clients work with older servers
149+ enabled : this . enabled ,
150+ preprocessRuns : this . trigger . preprocessRuns ,
151+ internal,
152+ } ;
153+ }
154+
120155 // Make sure the id is valid (must only contain alphanumeric characters and dashes)
121156 // Make sure the version is valid (must be a valid semver version)
122157 #validate( ) {
You can’t perform that action at this time.
0 commit comments