UNPKG

growthbook

Version:

The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform

32 lines (31 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FeaturesRepository = void 0; const base_repository_1 = require("./base.repository"); const api_1 = require("../generated/api"); class FeaturesRepository extends base_repository_1.BaseRepository { async getFeature(featureKey) { const featuresApi = this.api(); const result = await featuresApi.getFeature(featureKey); return result.data.feature; } async listFeatures(limit, offset, projectId) { const featuresApi = this.api(); const result = await featuresApi.listFeatures(limit, offset, projectId); return result.data; } async toggleFeature({ enabled, reason, featureKey, environment, }) { const featuresApi = this.api(); const result = await featuresApi.toggleFeature(featureKey, { reason, environments: { [environment]: enabled, }, }); return result.data.feature; } api() { return new api_1.FeaturesApi(this.apiConfig()); } } exports.FeaturesRepository = FeaturesRepository;