UNPKG

hypertune

Version:

[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt

53 lines 2.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = require("../../shared/types"); const edge_1 = require("../edge"); const shared_1 = require("../../shared"); const newTracedFetch_1 = __importDefault(require("../../shared/helpers/newTracedFetch")); const defaultLocalLogger_1 = __importDefault(require("../../shared/helpers/defaultLocalLogger")); class HypertuneEdgeInitDataProvider { // eslint-disable-next-line max-params constructor({ baseUrl, token, branchName = null, localLogger = defaultLocalLogger_1.default, timeoutMs = 10000, }) { if (branchName !== null && branchName !== shared_1.defaultBranchName) { localLogger(types_1.LogLevel.Warn, `using non default branch name: "${branchName}"`, {}); } this.baseUrl = baseUrl; this.token = token; this.branchName = branchName; this.tracedFetch = (0, newTracedFetch_1.default)({ timeoutMs, localLogger, }); } // eslint-disable-next-line class-methods-use-this getName() { return "Hypertune Edge"; } getInitData({ traceId, initQuery, variableValues, }) { return (0, edge_1.initRequest)({ traceId, query: initQuery, variables: variableValues, token: this.token, branchName: this.branchName, edgeBaseUrl: this.baseUrl, tracedFetch: this.tracedFetch, }); } getHashData({ traceId, initQuery, variableValues, }) { return (0, edge_1.hashRequest)({ traceId, query: initQuery, variables: variableValues, token: this.token, branchName: this.branchName, edgeBaseUrl: this.baseUrl, tracedFetch: this.tracedFetch, }); } } exports.default = HypertuneEdgeInitDataProvider; //# sourceMappingURL=HypertuneEdgeInitDataProvider.js.map