fixed GetHookData

This commit is contained in:
Sebastian Frank 2021-08-16 10:48:03 +02:00
parent 7a628c0a55
commit 8f988cf2ac
Signed by: apairon
GPG Key ID: A0E05A8199CE3F57

9
index.d.ts vendored
View File

@ -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 {