-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add apollo, esModuleInterop, everything breaks
- Loading branch information
Showing
16 changed files
with
536 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
metadata: | ||
kind: apollo-listener | ||
name: test-apollo | ||
data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { ApolloServer, gql } from 'apollo-server'; | ||
import { BaseListener } from './BaseListener'; | ||
import { Listener, FetchOptions } from './Listener'; | ||
import { ChildServiceOptions } from 'src/ChildService'; | ||
import { Message } from 'src/entity/Message'; | ||
|
||
const books = [{ | ||
title: 'test', | ||
author: 'test', | ||
}]; | ||
|
||
const typeDefs = gql` | ||
type Book { | ||
title: String | ||
author: String | ||
} | ||
type Query { | ||
books: [Book] | ||
} | ||
`; | ||
|
||
const resolvers = { | ||
Query: { | ||
books: () => books, | ||
}, | ||
}; | ||
|
||
export interface ApolloListenerData {} | ||
export type ApolloListenerOptions = ChildServiceOptions<ApolloListenerData>; | ||
|
||
export class ApolloListener extends BaseListener<ApolloListenerData> implements Listener { | ||
protected server: ApolloServer; | ||
|
||
constructor(options: ApolloListenerOptions) { | ||
super(options); | ||
this.server = new ApolloServer({ | ||
typeDefs, | ||
resolvers, | ||
}); | ||
} | ||
|
||
public async start() { | ||
const info = await this.server.listen(); | ||
this.logger.debug({ info }, 'started apollo server'); | ||
} | ||
|
||
public async stop() { | ||
return this.server.stop(); | ||
} | ||
|
||
public async emit() { | ||
|
||
} | ||
|
||
public async fetch(options: FetchOptions): Promise<Array<Message>> { | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.