{"version":3,"file":"use-crud-ctx.decorator.cjs","sources":["../../../nestjs/decorators/use-crud-ctx.decorator.ts"],"sourcesContent":["import { applyDecorators } from '@nestjs/common';\nimport { UseMiddleware } from './use-middleware.decorator';\n\nexport const UseCrudCtx = (callback) => {\n  const middlewareDecorator = UseMiddleware((req) => {\n    const crudCtx = callback(req);\n\n    if (!req.crudCtx) {\n      req.crudCtx = {};\n    }\n\n    req.crudCtx = {\n      ...req.crudCtx,\n      ...crudCtx,\n    };\n  });\n\n  return applyDecorators(middlewareDecorator);\n};\n"],"names":["UseCrudCtx","callback","middlewareDecorator","UseMiddleware","req","crudCtx","applyDecorators"],"mappings":"8JAGaA,EAAcC,GAAa,CAChC,MAAAC,EAAsBC,gBAAeC,GAAQ,CAC3C,MAAAC,EAAUJ,EAASG,CAAG,EAEvBA,EAAI,UACPA,EAAI,QAAU,CAAC,GAGjBA,EAAI,QAAU,CACZ,GAAGA,EAAI,QACP,GAAGC,CACL,CAAA,CACD,EAED,OAAOC,EAAAA,gBAAgBJ,CAAmB,CAC5C"}