@splitsoftware/splitio-commons
Version:
Split JavaScript SDK common components
19 lines (18 loc) • 682 B
JavaScript
import { sdkClientFactory } from './sdkClient';
import { RETRIEVE_CLIENT_DEFAULT } from '../logger/constants';
/**
* Factory of client method for server-side SDKs
*/
export function sdkClientMethodFactory(params) {
var log = params.settings.log;
var clientInstance = sdkClientFactory(params);
// Only one client in server-side without bound key
params.clients[''] = clientInstance;
return function client() {
if (arguments.length > 0) {
throw new Error('Shared Client not supported by the storage mechanism. Create isolated instances instead.');
}
log.debug(RETRIEVE_CLIENT_DEFAULT);
return clientInstance;
};
}