UNPKG

kobp

Version:
14 lines 499 B
import { METADATA_KEYS, OperationDocumentBuilder } from './doc.helpers'; /** * The Passthrough Middleware that inject document's metadata */ export const withDocument = (doc) => { const fn = async (_ctx, next) => { await next(); }; // Define documents const out = typeof doc === 'function' ? () => doc(new OperationDocumentBuilder()).build() : () => doc; Reflect.defineMetadata(METADATA_KEYS.DOC_KEY, out, fn); return fn; }; //# sourceMappingURL=withDocument.js.map