@launchdarkly/js-server-sdk-common
Version:
LaunchDarkly Server SDK for JavaScript - common code
32 lines • 2.27 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const js_sdk_common_1 = require("@launchdarkly/js-sdk-common");
const Configuration_1 = require("../options/Configuration");
const createDiagnosticsInitConfig = (config, platform, featureStore) => {
var _a, _b, _c, _d, _e, _f;
return ({
customBaseURI: config.serviceEndpoints.polling !== Configuration_1.defaultValues.baseUri,
customStreamURI: config.serviceEndpoints.streaming !== Configuration_1.defaultValues.streamUri,
customEventsURI: config.serviceEndpoints.events !== Configuration_1.defaultValues.eventsUri,
eventsCapacity: config.eventsCapacity,
// Node doesn't distinguish between these two kinds of timeouts. It is unlikely other web
// based implementations would be able to either.
connectTimeoutMillis: (0, js_sdk_common_1.secondsToMillis)(config.timeout),
socketTimeoutMillis: (0, js_sdk_common_1.secondsToMillis)(config.timeout),
eventsFlushIntervalMillis: (0, js_sdk_common_1.secondsToMillis)(config.flushInterval),
pollingIntervalMillis: (0, js_sdk_common_1.secondsToMillis)(config.pollInterval),
reconnectTimeMillis: (0, js_sdk_common_1.secondsToMillis)(config.streamInitialReconnectDelay),
contextKeysFlushIntervalMillis: (0, js_sdk_common_1.secondsToMillis)(config.contextKeysFlushInterval),
diagnosticRecordingIntervalMillis: (0, js_sdk_common_1.secondsToMillis)(config.diagnosticRecordingInterval),
streamingDisabled: !config.stream,
usingRelayDaemon: config.useLdd,
offline: config.offline,
allAttributesPrivate: config.allAttributesPrivate,
contextKeysCapacity: config.contextKeysCapacity,
usingProxy: !!((_b = (_a = platform.requests).usingProxy) === null || _b === void 0 ? void 0 : _b.call(_a)),
usingProxyAuthenticator: !!((_d = (_c = platform.requests).usingProxyAuth) === null || _d === void 0 ? void 0 : _d.call(_c)),
dataStoreType: (_f = (_e = featureStore.getDescription) === null || _e === void 0 ? void 0 : _e.call(featureStore)) !== null && _f !== void 0 ? _f : 'memory',
});
};
exports.default = createDiagnosticsInitConfig;
//# sourceMappingURL=createDiagnosticsInitConfig.js.map
;