@graffy/client
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -1,5 +0,20 @@ | ||
export default function getPath(query) { | ||
return Object.keys(query).sort().map(function (key) { | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = getPath; | ||
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys")); | ||
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort")); | ||
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map")); | ||
function getPath(query) { | ||
var _context, _context2; | ||
return (0, _map["default"])(_context = (0, _sort["default"])(_context2 = (0, _keys["default"])(query)).call(_context2)).call(_context, function (key) { | ||
return typeof query[key] === 'object' ? key + "(" + getPath(query[key]) + ")" : key; | ||
}).join(','); | ||
} |
21
index.js
@@ -1,8 +0,17 @@ | ||
import { makeStream } from '@graffy/common'; | ||
import getPath from './getPath'; | ||
export default function GraffyClient(baseUrl) { | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = GraffyClient; | ||
var _common = require("@graffy/common"); | ||
var _getPath = _interopRequireDefault(require("./getPath")); | ||
function GraffyClient(baseUrl) { | ||
return function (store) { | ||
store.onGet(function (query) { | ||
if (!fetch) throw Error('client.fetch.unavailable'); | ||
var url = baseUrl + "?include=" + getPath(query); | ||
var url = baseUrl + "?include=" + (0, _getPath["default"])(query); | ||
return fetch(url).then(function (res) { | ||
@@ -14,6 +23,6 @@ return res.json(); | ||
if (!EventSource) throw Error('client.sse.unavailable'); | ||
var url = baseUrl + "?include=" + getPath(query); | ||
var url = baseUrl + "?include=" + (0, _getPath["default"])(query); | ||
var source = new EventSource(url); | ||
var _makeStream = makeStream(function () { | ||
var _makeStream = (0, _common.makeStream)(function () { | ||
source.close(); | ||
@@ -20,0 +29,0 @@ }), |
@@ -5,3 +5,3 @@ { | ||
"author": "aravind (https://github.com/aravindet)", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"repository": { | ||
@@ -13,4 +13,4 @@ "type": "git", | ||
"dependencies": { | ||
"@graffy/common": "0.8.0" | ||
"@graffy/common": "0.8.1" | ||
} | ||
} |
2944
49
+ Added@graffy/common@0.8.1(transitive)
- Removed@graffy/common@0.8.0(transitive)
Updated@graffy/common@0.8.1