UNPKG

kobp

Version:
18 lines 640 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withDocument = void 0; const doc_helpers_1 = require("./doc.helpers"); /** * The Passthrough Middleware that inject document's metadata */ const withDocument = (doc) => { const fn = async (_ctx, next) => { await next(); }; // Define documents const out = typeof doc === 'function' ? () => doc(new doc_helpers_1.OperationDocumentBuilder()).build() : () => doc; Reflect.defineMetadata(doc_helpers_1.METADATA_KEYS.DOC_KEY, out, fn); return fn; }; exports.withDocument = withDocument; //# sourceMappingURL=withDocument.js.map