import { KDocument, JSONObject } from "kuzzle-sdk"; import { KuzzleRequest, PipeEventHandler } from "../../../index"; /** * Events with documents only having the `_id` */ type EventGenericDocumentPartial = { name: `generic:document:${name}`; args: [Array<{ _id: string; }>, KuzzleRequest]; }; export type EventGenericDocumentBeforeDelete = EventGenericDocumentPartial<"beforeDelete">; export type EventGenericDocumentAfterDelete = EventGenericDocumentPartial<"afterDelete">; export type EventGenericDocumentBeforeGet = EventGenericDocumentPartial<"beforeGet">; /** * Events having entire documents */ type EventGenericDocument = { name: `generic:document:${name}`; args: [KDocument[], KuzzleRequest]; }; export type EventGenericDocumentBeforeWrite = EventGenericDocument<"beforeWrite", KDocumentContent>; export type EventGenericDocumentAfterWrite = EventGenericDocument<"afterWrite", KDocumentContent>; export type EventGenericDocumentBeforeUpdate = EventGenericDocument<"beforeUpdate", KDocumentContent>; export type EventGenericDocumentAfterUpdate = EventGenericDocument<"afterUpdate", KDocumentContent>; export type EventGenericDocumentAfterGet = EventGenericDocument<"afterGet", KDocumentContent>; export type EventGenericDocumentInjectMetadata = { name: `generic:document:injectMetadata`; args: [ { /** * Kuzzle Request that triggered the event */ request: KuzzleRequest; /** * Metadata of the document */ metadata: JSONObject; /** * Default metadata of the document. * Only used when calling document:upsert. */ defaultMetadata?: JSONObject; } ]; } & PipeEventHandler; export {};