import Store from 'somes/store';
import path from 'somes/path';
export async function make({ url = 'http://127.0.0.1:8091/service-api', signer, name, store, descriptors }) {
    var _store = store || new Store(name);
    if (_store.isLoaded)
        return _store;
    var urlObj = new path.URL(url);
    await _store.initialize({
        host: urlObj.hostname,
        port: urlObj.port,
        ssl: /^(http|ws)s/.test(urlObj.protocol),
        prefix: urlObj.filename,
        descriptors,
    });
    if (signer) {
        _store.setSigner(signer);
    }
    return _store;
}
