-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handlers implementations are now abstract arrow functions
* Fixes #5 [ci skip]
- Loading branch information
Showing
10 changed files
with
189 additions
and
122 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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import type { ContainerType, JSONValue } from '../types'; | ||
import type { ContextTimed } from '@matrixai/contexts'; | ||
import { Handler } from './handler'; | ||
import { ErrorRPCMethodNotImplemented } from '../errors'; | ||
|
||
abstract class ClientHandler< | ||
export abstract class ClientHandler< | ||
Container extends ContainerType = ContainerType, | ||
Input extends JSONValue = JSONValue, | ||
Output extends JSONValue = JSONValue, | ||
> extends Handler<Container, Input, Output> { | ||
abstract handle( | ||
public handle = async ( | ||
input: AsyncIterableIterator<Input>, | ||
cancel: (reason?: any) => void, | ||
meta: Record<string, JSONValue> | undefined, | ||
ctx: ContextTimed, | ||
): Promise<Output>; | ||
): Promise<Output> => { | ||
throw new ErrorRPCMethodNotImplemented(); | ||
}; | ||
} | ||
|
||
export { ClientHandler }; |
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import type { ContextTimed } from '@matrixai/contexts'; | ||
import type { ContainerType, JSONValue } from '../types'; | ||
import { Handler } from '@/handlers/handler'; | ||
import { ErrorRPCMethodNotImplemented } from '../errors'; | ||
|
||
abstract class ServerHandler< | ||
export abstract class ServerHandler< | ||
Container extends ContainerType = ContainerType, | ||
Input extends JSONValue = JSONValue, | ||
Output extends JSONValue = JSONValue, | ||
> extends Handler<Container, Input, Output> { | ||
abstract handle( | ||
public handle = async function* ( | ||
input: Input, | ||
cancel: (reason?: any) => void, | ||
meta: Record<string, JSONValue> | undefined, | ||
ctx: ContextTimed, | ||
): AsyncIterableIterator<Output>; | ||
): AsyncIterableIterator<Output> { | ||
throw new ErrorRPCMethodNotImplemented('This method must be overridden'); | ||
}; | ||
} | ||
|
||
export { ServerHandler }; |
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import type { ContextTimed } from '@matrixai/contexts'; | ||
import type { ContainerType, JSONValue } from '../types'; | ||
import { Handler } from './handler'; | ||
import { ErrorRPCMethodNotImplemented } from '../errors'; | ||
|
||
abstract class UnaryHandler< | ||
export abstract class UnaryHandler< | ||
Container extends ContainerType = ContainerType, | ||
Input extends JSONValue = JSONValue, | ||
Output extends JSONValue = JSONValue, | ||
> extends Handler<Container, Input, Output> { | ||
abstract handle( | ||
public handle = async ( | ||
input: Input, | ||
cancel: (reason?: any) => void, | ||
meta: Record<string, JSONValue> | undefined, | ||
ctx: ContextTimed, | ||
): Promise<Output>; | ||
): Promise<Output> => { | ||
throw new ErrorRPCMethodNotImplemented('This method must be overridden'); | ||
}; | ||
} | ||
|
||
export { UnaryHandler }; |
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.