@@ -11,7 +11,7 @@ const enabledCalls = json5.parse(fs.readFileSync(path.join(__dirname, 'enabled-c
1111// Sanity check this json file
1212Object . keys ( enabledCalls ) . forEach ( rpc =>
1313 Object . keys ( enabledCalls [ rpc ] ) . forEach ( type => {
14- if ( ! [ 'promise' , 'incoming' , 'engineListener' ] . includes ( type ) ) {
14+ if ( ! [ 'promise' , 'incoming' , 'engineListener' , 'custom' ] . includes ( type ) ) {
1515 console . log ( colors . red ( 'ERROR! Invalid enabled call?\n\n ' ) , rpc , type )
1616 process . exit ( 1 )
1717 }
@@ -212,13 +212,11 @@ function analyzeMessages(json, project) {
212212 const isUIMethod = isUIProtocol || enabledCall ( methodName , 'incoming' )
213213
214214 if ( isUIMethod ) {
215- project . incomingMaps [
216- methodName
217- ] = `(params: MessageTypes[${ methodName } ]['inParam'] & {sessionID: number}) => void`
215+ project . incomingMaps [ methodName ] = `(params: MessageTypes[${ methodName } ]['inParam']) => void`
218216 if ( ! message . hasOwnProperty ( 'notify' ) ) {
219217 project . customResponseIncomingMaps [
220218 methodName
221- ] = `(params: MessageTypes[${ methodName } ]['inParam'] & {sessionID: number} , response: {error: IncomingErrorCallback, result: (res: MessageTypes[${ methodName } ]['outParam']) => void}) => void`
219+ ] = `(params: MessageTypes[${ methodName } ]['inParam'], response: {error: IncomingErrorCallback, result: (res: MessageTypes[${ methodName } ]['outParam']) => void}) => void`
222220 }
223221 }
224222
@@ -400,7 +398,7 @@ function writeActions() {
400398 actions : Object . keys ( projects ) . reduce ( ( map , p ) => {
401399 const callMap = projects [ p ] . incomingMaps
402400 callMap &&
403- Object . keys ( callMap ) . reduce ( ( map , method ) => {
401+ Object . keys ( callMap ) . reduce ( ( m , method ) => {
404402 const name = method
405403 . replace ( / ' / g, '' )
406404 . split ( '.' )
@@ -413,10 +411,10 @@ function writeActions() {
413411 response = `, response: {error: ${ p } Types.IncomingErrorCallback, result: (param: ${ p } Types.MessageTypes[${ method } ]['outParam']) => void}`
414412 }
415413
416- map [ name ] = {
417- params : `${ p } Types.MessageTypes[${ method } ]['inParam'] & {sessionID: number} ${ response } ` ,
414+ m [ name ] = {
415+ params : `${ p } Types.MessageTypes[${ method } ]['inParam'] ${ response } ` ,
418416 }
419- return map
417+ return m
420418 } , map )
421419 return map
422420 } , staticActions ) ,
@@ -502,9 +500,10 @@ export type IncomingErrorCallback = (err?: SimpleError | null) => void
502500 const types = Object . keys ( typeDefs . types ) . map ( k => typeDefs . types [ k ] )
503501 const messagePromise = Object . keys ( typeDefs . messages ) . map ( k => typeDefs . messages [ k ] . rpcPromise )
504502 const messageEngineListener = Object . keys ( typeDefs . messages ) . map ( k => typeDefs . messages [ k ] . engineListener )
505- const callMapType = Object . keys ( project . incomingMaps ) . length ? 'IncomingCallMapType' : 'void'
503+ // const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
506504 const incomingMap = `\nexport type IncomingCallMapType = {
507505 ${ Object . keys ( project . incomingMaps )
506+ . filter ( im => enabledCall ( im , 'incoming' ) )
508507 . map ( im => ` ${ im } ?: ${ project . incomingMaps [ im ] } ` )
509508 . join ( ',' ) }
510509 }`
@@ -514,6 +513,7 @@ export type IncomingErrorCallback = (err?: SimpleError | null) => void
514513 : 'void'
515514 const customResponseIncomingMap = `\nexport type CustomResponseIncomingCallMap = {
516515 ${ Object . keys ( project . customResponseIncomingMaps )
516+ . filter ( im => enabledCall ( im , 'custom' ) )
517517 . map ( im => ` ${ im } ?: ${ project . customResponseIncomingMaps [ im ] } ` )
518518 . join ( ',' ) }
519519 }`
@@ -560,7 +560,7 @@ ${messageTypesData}
560560function write ( typeDefs , project ) {
561561 // Need any for weird flow issue where it gets confused by multiple
562562 // incoming call map types
563- const callMapType = Object . keys ( project . incomingMaps ) . length ? 'IncomingCallMapType' : 'void'
563+ // const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
564564
565565 const typePrelude = `/* eslint-disable */
566566
0 commit comments