@devcycle/nestjs-server-sdk
Version:
The DevCycle NestJS Server SDK used for feature management.
18 lines • 761 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariableValue = void 0;
const common_1 = require("@nestjs/common");
const nestjs_cls_1 = require("nestjs-cls");
const VariableValue = (...dataOrPipes) => {
return (0, common_1.createParamDecorator)((data) => {
const cls = nestjs_cls_1.ClsServiceManager.getClsService();
const client = cls.get('dvc_client');
const user = cls.get('dvc_user');
if (!client || !user) {
throw new Error('Missing DevCycle context. Is the DevCycleModule imported?');
}
return client.variableValue(user, data.key, data.default);
})(...dataOrPipes);
};
exports.VariableValue = VariableValue;
//# sourceMappingURL=VariableValue.js.map