Saxonberg Server API
    Preparing search index...

    Public shape added by AroundSaveHookMixin.

    interface AroundSaveHook {
        aroundSave(
            collection: string,
            doc: Record<string, unknown>,
            next: (doc: Record<string, unknown>) => Promise<string>,
        ): Promise<string>;
    }
    Index

    Methods

    Methods

    • Parameters

      • collection: string
      • doc: Record<string, unknown>
      • next: (doc: Record<string, unknown>) => Promise<string>

      Returns Promise<string>

      Invoked by PersistenceManager around every save to the hook's collection, middleware-style. Around — you MUST call next(doc) (with the original or a transformed doc) to proceed, and return its result (the saved id); validate/transform before, or throw to reject the save. Default is pass-through.