From 544cf39a2d424612d51e1dbc8b90caf0b86cb98b Mon Sep 17 00:00:00 2001 From: rafaelsouzaf Date: Sun, 26 Nov 2017 23:18:12 -0300 Subject: [PATCH] Added generic LifeCycle interfaces. --- .../hapi/v17/definitions/util/lifecycle.d.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 types/hapi/v17/definitions/util/lifecycle.d.ts diff --git a/types/hapi/v17/definitions/util/lifecycle.d.ts b/types/hapi/v17/definitions/util/lifecycle.d.ts new file mode 100644 index 0000000000..9dba7980d4 --- /dev/null +++ b/types/hapi/v17/definitions/util/lifecycle.d.ts @@ -0,0 +1,28 @@ +/** + * Lifecycle methods are the interface between the framework and the application. Many of the request lifecycle steps: + * extensions, authentication, handlers, pre-handler methods, and failAction function values are lifecyle methods + * provided by the developer and executed by the framework. + * Each lifecycle method is a function with the signature await function(request, h, [err]) where: + * * request - the request object. + * * h - the response toolkit the handler must call to set a response and return control back to the framework. + * * err - an error object availble only when the method is used as a failAction value. + */ +export interface LifecycleMethod { + + // TODO need to be implemented. Ideally with Generics types. + +} + +/** + * Each lifecycle method must return a value or a promise that resolves into a value. If a lifecycle method returns + * without a value or resolves to an undefined value, an Internal Server Error (500) error response is sent. + * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#lifecycle-methods) + */ +export interface LifecycleReturnValue { + + + +} + + +