From 8f988cf2acaee3a0d1c84109adce199234db3845 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Mon, 16 Aug 2021 10:48:03 +0200 Subject: [PATCH] fixed GetHookData --- index.d.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index d81a141..f5f1d87 100644 --- a/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ export interface ReadCollectionOptions { sort?: string[] } -interface GetHookData { +interface GetHookGetOnlyData { /** * true if only one document was requested via /COLLECTION/ID */ @@ -27,6 +27,9 @@ interface GetHookData { * get list of documents (only valid after stage "read" in "get" hook) */ results(): CollectionDocument[] +} + +interface GetHookData { /** * filter map only valid for "get" hooks */ @@ -60,7 +63,7 @@ interface PostHookData { data?: CollectionDocument } -export interface HookContext extends GetHookData, PostHookData { +export interface HookContext extends GetHookData, GetHookGetOnlyData, PostHookData { request(): { method: string remoteAddr: string @@ -375,7 +378,7 @@ export interface HookException { export interface HookResponse extends GetHookData, PostHookData { data?: CollectionDocument - results: any + results?: any } declare global {