diff --git a/about/obs.js b/about/obs.js new file mode 100644 index 00000000..ea08bd6b --- /dev/null +++ b/about/obs.js @@ -0,0 +1,60 @@ +const { Value } = require('mutant') +const nest = require('depnest') +const { isFeed } = require('ssb-ref') +const gql = require('graphql-tag').default +// var colorHash = new (require('color-hash'))() +// var fallbackImageUrl = 'data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==' + +exports.needs = nest({ + 'about.sync.shortFeedId': 'first', + 'blob.sync.url': 'first', + 'graphql.async.query': 'first' +}) + +exports.gives = nest({ + 'about.obs.name': true, + 'about.obs.imageUrl': true +}) + +const nameQuery = gql` + query author($feedId: String!) { + author(id: $feedId) { + name + } + } +` + +exports.create = function (api) { + var nameCache = {} + + return nest({ + 'about.obs.name': name, + 'about.obs.imageUrl': imageUrl + }) + + // TODO !!! + // add something which watches new about messages coming in and updates any feedId's referenced + + function name (id) { + if (!isFeed(id)) throw new Error('about.obs.name requires a feedId, got', id) + + if (nameCache[id]) return nameCache[id] + + nameCache[id] = Value(api.about.sync.shortFeedId(id)) + fetchCurrentName(id, (err, res) => { + if (err) return console.error(JSON.stringify(err, null, 2)) + + nameCache[id].set(res.data.author.name) + }) + + return nameCache[id] + } + + function imageUrl () { + // returns nothing, so will fall back to original + } + + function fetchCurrentName (feedId, cb) { + api.graphql.async.query({ query: nameQuery, variables: { feedId } }, cb) + } +} diff --git a/app/styles/css/open-dyslexic.js b/app/styles/css/open-dyslexic.js new file mode 100644 index 00000000..6bf20d18 --- /dev/null +++ b/app/styles/css/open-dyslexic.js @@ -0,0 +1,11 @@ +const nest = require('depnest') +const requireStyle = require('require-style') +const { assign } = Object + +exports.gives = nest('styles.css') + +exports.create = function (api) { + return nest('styles.css', (sofar = {}) => { + return assign(sofar, { openDyslexic: requireStyle('open-dyslexic') }) + }) +} diff --git a/app/sync/initialise/patchql.js b/app/sync/initialise/patchql.js new file mode 100644 index 00000000..93c630e0 --- /dev/null +++ b/app/sync/initialise/patchql.js @@ -0,0 +1,79 @@ +const pull = require('pull-stream') +const nest = require('depnest') +const { ApolloClient } = require('apollo-client') +const { InMemoryCache } = require('apollo-cache-inmemory') +const { createHttpLink } = require('apollo-link-http') +const gql = require('graphql-tag').default +// NOTE also depends on graphql module + +exports.needs = nest({ + 'sbot.async.run': 'first' +}) +exports.gives = nest({ + 'app.sync.initialise': true, + 'graphql.async.query': true +}) + +const mutation = gql` + mutation process($chunkSize: Int) { + process(chunkSize: $chunkSize) { + chunkSize, + latestSequence + } + } +` +exports.create = function (api) { + var graphql + + return nest({ + 'app.sync.initialise': startPatchql, + 'graphql.async.query': graphQuery + }) + + function startPatchql () { + if (process.env.PATCHQL === 'false') return + + graphql = GraphqlClient() + + var latestSequence + var nextSequence + + api.sbot.async.run(server => { + server.jsbotPatchql.start({}, () => { + indexLoop() + }) + }) + + function indexLoop () { + graphql.mutate({ mutation, variables: { chunkSize: 10e3 } }) + .then(res => { + nextSequence = res.data.process.latestSequence + if (latestSequence === nextSequence) setTimeout(indexLoop, 5e3) + else { + latestSequence = nextSequence + console.log('patchql latestSequence:', latestSequence) + indexLoop() + } + }) + .catch(err => { + console.error(err) + return setTimeout(indexLoop, 2e3) + }) + } + } + + function graphQuery ({ query, variables }, cb) { + if (!graphql) return setTimeout(() => graphQuery({ query, variables }, cb), 1e3) + + graphql.query({ query, variables }) + .then(res => cb(null, res)) + .catch(err => cb(err)) + } + + function GraphqlClient () { + return new ApolloClient({ + link: createHttpLink({ uri: 'http://localhost:8080/graphql' }), // set by jsbot-patchql + cache: new InMemoryCache() + }) + } +} diff --git a/index.js b/index.js index d4693b5a..31d6a171 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,9 @@ const plugins = [ 'ssb-search', 'ssb-suggest', 'ssb-tangle', - 'ssb-unread' + 'ssb-unread', + + 'jsbot-patchql' ] ahoy( diff --git a/package-lock.json b/package-lock.json index b08edb77..d06baf8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -119,6 +119,11 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.6.tgz", "integrity": "sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg==" }, + "@types/zen-observable": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.0.tgz", + "integrity": "sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==" + }, "abstract-leveldown": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-5.0.0.tgz", @@ -273,6 +278,120 @@ "resolved": "https://registry.npmjs.org/ap/-/ap-0.1.0.tgz", "integrity": "sha1-2KPyZhU3k5ihtTymzBpmag+/4VA=" }, + "apollo-cache": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/apollo-cache/-/apollo-cache-1.2.1.tgz", + "integrity": "sha512-nzFmep/oKlbzUuDyz6fS6aYhRmfpcHWqNkkA9Bbxwk18RD6LXC4eZkuE0gXRX0IibVBHNjYVK+Szi0Yied4SpQ==", + "requires": { + "apollo-utilities": "^1.2.1", + "tslib": "^1.9.3" + } + }, + "apollo-cache-inmemory": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/apollo-cache-inmemory/-/apollo-cache-inmemory-1.5.1.tgz", + "integrity": "sha512-D3bdpPmWfaKQkWy8lfwUg+K8OBITo3sx0BHLs1B/9vIdOIZ7JNCKq3EUcAgAfInomJUdN0QG1yOfi8M8hxkN1g==", + "requires": { + "apollo-cache": "^1.2.1", + "apollo-utilities": "^1.2.1", + "optimism": "^0.6.9", + "ts-invariant": "^0.2.1", + "tslib": "^1.9.3" + } + }, + "apollo-client": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/apollo-client/-/apollo-client-2.5.1.tgz", + "integrity": "sha512-MNcQKiqLHdGmNJ0rZ0NXaHrToXapJgS/5kPk0FygXt+/FmDCdzqcujI7OPxEC6e9Yw5S/8dIvOXcRNuOMElHkA==", + "requires": { + "@types/zen-observable": "^0.8.0", + "apollo-cache": "1.2.1", + "apollo-link": "^1.0.0", + "apollo-link-dedup": "^1.0.0", + "apollo-utilities": "1.2.1", + "symbol-observable": "^1.0.2", + "ts-invariant": "^0.2.1", + "tslib": "^1.9.3", + "zen-observable": "^0.8.0" + }, + "dependencies": { + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + } + } + }, + "apollo-link": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.11.tgz", + "integrity": "sha512-PQvRCg13VduLy3X/0L79M6uOpTh5iHdxnxYuo8yL7sJlWybKRJwsv4IcRBJpMFbChOOaHY7Og9wgPo6DLKDKDA==", + "requires": { + "apollo-utilities": "^1.2.1", + "ts-invariant": "^0.3.2", + "tslib": "^1.9.3", + "zen-observable-ts": "^0.8.18" + }, + "dependencies": { + "ts-invariant": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.3.3.tgz", + "integrity": "sha512-UReOKsrJFGC9tUblgSRWo+BsVNbEd77Cl6WiV/XpMlkifXwNIJbknViCucHvVZkXSC/mcWeRnIGdY7uprcwvdQ==", + "requires": { + "tslib": "^1.9.3" + } + } + } + }, + "apollo-link-dedup": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/apollo-link-dedup/-/apollo-link-dedup-1.0.18.tgz", + "integrity": "sha512-1rr54wyMTuqUmbWvcXbwduIcaCDcuIgU6MqQ599nAMuTrbSOXthGfoAD8BDTxBGQ9roVlM7ABP0VZVEWRoHWSg==", + "requires": { + "apollo-link": "^1.2.11", + "tslib": "^1.9.3" + } + }, + "apollo-link-http": { + "version": "1.5.14", + "resolved": "https://registry.npmjs.org/apollo-link-http/-/apollo-link-http-1.5.14.tgz", + "integrity": "sha512-XEoPXmGpxFG3wioovgAlPXIarWaW4oWzt8YzjTYZ87R4R7d1A3wKR/KcvkdMV1m5G7YSAHcNkDLe/8hF2nH6cg==", + "requires": { + "apollo-link": "^1.2.11", + "apollo-link-http-common": "^0.2.13", + "tslib": "^1.9.3" + } + }, + "apollo-link-http-common": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/apollo-link-http-common/-/apollo-link-http-common-0.2.13.tgz", + "integrity": "sha512-Uyg1ECQpTTA691Fwx5e6Rc/6CPSu4TB4pQRTGIpwZ4l5JDOQ+812Wvi/e3IInmzOZpwx5YrrOfXrtN8BrsDXoA==", + "requires": { + "apollo-link": "^1.2.11", + "ts-invariant": "^0.3.2", + "tslib": "^1.9.3" + }, + "dependencies": { + "ts-invariant": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.3.3.tgz", + "integrity": "sha512-UReOKsrJFGC9tUblgSRWo+BsVNbEd77Cl6WiV/XpMlkifXwNIJbknViCucHvVZkXSC/mcWeRnIGdY7uprcwvdQ==", + "requires": { + "tslib": "^1.9.3" + } + } + } + }, + "apollo-utilities": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.2.1.tgz", + "integrity": "sha512-Zv8Udp9XTSFiN8oyXOjf6PMHepD4yxxReLsl6dPUy5Ths7jti3nmlBzZUOxuTWRwZn0MoclqL7RQ5UEJN8MAxg==", + "requires": { + "fast-json-stable-stringify": "^2.0.0", + "ts-invariant": "^0.2.1", + "tslib": "^1.9.3" + } + }, "app-builder-bin": { "version": "2.6.6", "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.6.6.tgz", @@ -898,6 +1017,15 @@ "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==" }, + "binary": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", + "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", + "requires": { + "buffers": "~0.1.1", + "chainsaw": "~0.1.0" + } + }, "binary-extensions": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", @@ -1144,6 +1272,14 @@ "resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.0.tgz", "integrity": "sha1-QUGcrvdpdVkp3VGJZ9PuwKYmJ3E=" }, + "browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "requires": { + "pako": "~0.2.0" + } + }, "buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -1178,6 +1314,11 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, + "buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=" + }, "builder-util": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-10.0.0.tgz", @@ -1584,6 +1725,14 @@ "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.4.tgz", "integrity": "sha512-fpZ81yYfzentuieinmGnphk0pLkOTMm6MZdVqwd77ROvhko6iujLNGrHH5E7utq3ygWklwfmwuG+A7P+NpqT6w==" }, + "chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", + "requires": { + "traverse": ">=0.3.0 <0.4" + } + }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -4986,6 +5135,27 @@ } } }, + "fstream": { + "version": "0.1.31", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-0.1.31.tgz", + "integrity": "sha1-czfwWPu7vvqMn1YaKMqwhJICyYg=", + "requires": { + "graceful-fs": "~3.0.2", + "inherits": "~2.0.0", + "mkdirp": "0.5", + "rimraf": "2" + }, + "dependencies": { + "graceful-fs": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", + "requires": { + "natives": "^1.1.0" + } + } + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -5192,6 +5362,19 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" }, + "graphql": { + "version": "14.3.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.3.0.tgz", + "integrity": "sha512-MdfI4v7kSNC3NhB7cF8KNijDsifuWO2XOtzpyququqaclO8wVuChYv+KogexDwgP5sp7nFI9Z6N4QHgoLkfjrg==", + "requires": { + "iterall": "^1.2.2" + } + }, + "graphql-tag": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.1.tgz", + "integrity": "sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg==" + }, "graphreduce": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/graphreduce/-/graphreduce-3.0.4.tgz", @@ -5200,6 +5383,19 @@ "statistics": "^3.3.0" } }, + "gunzip-maybe": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.1.tgz", + "integrity": "sha512-qtutIKMthNJJgeHQS7kZ9FqDq59/Wn0G2HYCRNjpup7yKfVI6/eqwpmroyZGFoCYaG+sW6psNVb4zoLADHpp2g==", + "requires": { + "browserify-zlib": "^0.1.4", + "is-deflate": "^1.0.0", + "is-gzip": "^1.0.0", + "peek-stream": "^1.1.0", + "pumpify": "^1.3.3", + "through2": "^2.0.3" + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -5593,12 +5789,26 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "idb-kv-store": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/idb-kv-store/-/idb-kv-store-4.4.0.tgz", + "integrity": "sha1-IsVqjV+QvYj4GKhZ25xYYn3ieL4=", + "requires": { + "inherits": "^2.0.3", + "promisize": "^1.1.2" + } + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "immutable-tuple": { + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/immutable-tuple/-/immutable-tuple-0.4.10.tgz", + "integrity": "sha512-45jheDbc3Kr5Cw8EtDD+4woGRUV0utIrJBZT8XH0TPZRfm8tzT0/sLGGzyyCCFqFMG5Pv5Igf3WY/arn6+8V9Q==" + }, "import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", @@ -5896,6 +6106,11 @@ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.3.tgz", "integrity": "sha512-bvLSwoDg2q6Gf+E2LEPiklHZxxiSi3XAh4Mav65mKqTfCO1HM3uBs24TjEH8iJX3bbDdLXKJXBTmGzuTUuAEjQ==" }, + "is-deflate": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-deflate/-/is-deflate-1.0.0.tgz", + "integrity": "sha1-yGKQHDwWH7CdrHzcfnhPgOmPLxQ=" + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -5965,6 +6180,11 @@ "is-extglob": "^1.0.0" } }, + "is-gzip": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-gzip/-/is-gzip-1.0.0.tgz", + "integrity": "sha1-bKiwe5nHeZgCWQDlVc7Y7YCHmoM=" + }, "is-hexadecimal": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz", @@ -6165,6 +6385,11 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "iterall": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.2.2.tgz", + "integrity": "sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==" + }, "iterators": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/iterators/-/iterators-0.1.0.tgz", @@ -6201,6 +6426,98 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsbot-patchql": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/jsbot-patchql/-/jsbot-patchql-1.0.7.tgz", + "integrity": "sha512-u67qWtHxB+LZVSwS9T9wOtYFn12+RzUuaChJQ9mtXbsS+GENsJvaOqPISvNPrj1ueGAG/1LiRIh/3oKN4MiXZg==", + "requires": { + "env-paths": "^2.2.0", + "gunzip-maybe": "^1.4.1", + "mkdirp": "^0.5.1", + "pull-stream": "^3.6.11", + "pull-write-file": "^0.2.4", + "request": "^2.88.0", + "stream-to-pull-stream": "^1.7.3", + "tar-fs": "^2.0.0", + "unzip": "^0.1.11" + }, + "dependencies": { + "bl": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.0.tgz", + "integrity": "sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==", + "requires": { + "readable-stream": "^3.0.1" + } + }, + "env-paths": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", + "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" + }, + "looper": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", + "integrity": "sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k=" + }, + "pull-stream": { + "version": "3.6.11", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.11.tgz", + "integrity": "sha512-43brwtqO0OSltctKbW1mgzzKH4TNE8egkW+Y4BFzlDWiG2Ayl7VKr4SeuoKacfgPfUWcSwcPlHsf40BEqNR32A==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "readable-stream": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "stream-to-pull-stream": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.3.tgz", + "integrity": "sha512-6sNyqJpr5dIOQdgNy/xcDWwDuzAsAwVzhzrWlAPAQ7Lkjx/rv0wgvxEyKwTq6FmNd5rjTrELt/CLmaSw7crMGg==", + "requires": { + "looper": "^3.0.0", + "pull-stream": "^3.2.3" + } + }, + "tar-fs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", + "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", + "requires": { + "chownr": "^1.1.1", + "mkdirp": "^0.5.1", + "pump": "^3.0.0", + "tar-stream": "^2.0.0" + } + }, + "tar-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.0.1.tgz", + "integrity": "sha512-I6OJF7wE62BC6zNPdHDtseK0D0187PBjbKSLYY4ffvVkBM6tyBn2O9plDvVM2229/mozfEL/X3++qSvYYQE2xw==", + "requires": { + "bl": "^3.0.0", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + } + } + }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", @@ -6942,6 +7259,38 @@ "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-0.4.0.tgz", "integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE=" }, + "match-stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/match-stream/-/match-stream-0.0.2.tgz", + "integrity": "sha1-mesFAJOzTf+t5CG5rAtBCpz6F88=", + "requires": { + "buffers": "~0.1.1", + "readable-stream": "~1.0.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "math-random": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", @@ -7428,6 +7777,11 @@ "integrity": "sha512-Tr0DNY4RzTaBG2W2m3l7ZtFuJChTH6VZhXVhkGGjF/4cZTt+i8GcM9ozD+30Lmr4mDoZ5Xx34t2o4GJqYWDGcg==", "optional": true }, + "natives": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.6.tgz", + "integrity": "sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==" + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7704,6 +8058,11 @@ "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" }, + "open-dyslexic": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/open-dyslexic/-/open-dyslexic-1.0.3.tgz", + "integrity": "sha512-pZ6LuLvnwT/T/HiDc6hGj2bTs+HimGrYHGQEaexQcou4E9euHhSmgJ6GvUOZQRSU+mYSvdu2M8RgiUcqqAAaCQ==" + }, "open-external": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/open-external/-/open-external-0.1.1.tgz", @@ -7714,6 +8073,14 @@ "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" }, + "optimism": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.6.9.tgz", + "integrity": "sha512-xoQm2lvXbCA9Kd7SCx6y713Y7sZ6fUc5R6VYpoL5M6svKJbTuvtNopexK8sO8K4s0EOUYHuPN2+yAEsNyRggkQ==", + "requires": { + "immutable-tuple": "^0.4.9" + } + }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", @@ -7768,6 +8135,11 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "over": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/over/-/over-0.0.5.tgz", + "integrity": "sha1-8phS5w/X4l82DgE6jsRMgq7bVwg=" + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -7830,6 +8202,11 @@ "pull-through": "^1.0.17" } }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=" + }, "parse-color": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", @@ -8487,6 +8864,16 @@ "pinkie-promise": "^2.0.0" } }, + "peek-stream": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz", + "integrity": "sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==", + "requires": { + "buffer-from": "^1.0.0", + "duplexify": "^3.5.0", + "through2": "^2.0.3" + } + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -8852,6 +9239,11 @@ "resolved": "https://registry.npmjs.org/promisify-tuple/-/promisify-tuple-1.0.0.tgz", "integrity": "sha512-cLx3LIS6pjWJym+M2TWCc5Mvt6LFaZakGBaRQWpOQkrcobJ7PHFX7m+VXnbb9Ha7n4SULB9ajulWvasSdi5JHw==" }, + "promisize": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/promisize/-/promisize-1.1.2.tgz", + "integrity": "sha1-m0fiyyrkl+seutwsQZHWTRXJSdE=" + }, "prop-types": { "version": "15.7.2", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", @@ -9268,6 +9660,40 @@ "ws": "^1.1.0" } }, + "pullstream": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pullstream/-/pullstream-0.4.1.tgz", + "integrity": "sha1-1vs79a7Wl+gxFQ6xACwlo/iuExQ=", + "requires": { + "over": ">= 0.0.5 < 1", + "readable-stream": "~1.0.31", + "setimmediate": ">= 1.0.2 < 2", + "slice-stream": ">= 1.0.0 < 2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -9277,6 +9703,16 @@ "once": "^1.3.1" } }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -10548,6 +10984,37 @@ } } }, + "slice-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-stream/-/slice-stream-1.0.0.tgz", + "integrity": "sha1-WzO9ZvATsaf4ZGCwPUY97DmtPqA=", + "requires": { + "readable-stream": "~1.0.31" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "smart-buffer": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.0.2.tgz", @@ -13523,15 +13990,6 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==" }, - "idb-kv-store": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/idb-kv-store/-/idb-kv-store-4.4.0.tgz", - "integrity": "sha1-IsVqjV+QvYj4GKhZ25xYYn3ieL4=", - "requires": { - "inherits": "^2.0.3", - "promisize": "^1.1.2" - } - }, "increment-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/increment-buffer/-/increment-buffer-1.0.1.tgz", @@ -13835,15 +14293,7 @@ "@babel/template": "^7.0.0", "@babel/traverse": "^7.0.0", "@babel/types": "^7.0.0", - "istanbul-lib-coverage": "^2.0.4", - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz", - "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==" - } + "istanbul-lib-coverage": "^2.0.4" } }, "js-tokens": { @@ -15990,11 +16440,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, - "promisize": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/promisize/-/promisize-1.1.2.tgz", - "integrity": "sha1-m0fiyyrkl+seutwsQZHWTRXJSdE=" - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -18959,6 +19404,11 @@ } } }, + "traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=" + }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", @@ -18993,6 +19443,19 @@ "utf8-byte-length": "^1.0.1" } }, + "ts-invariant": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.2.1.tgz", + "integrity": "sha512-Z/JSxzVmhTo50I+LKagEISFJW3pvPCqsMWLamCTX8Kr3N5aMrnGOqcflbe5hLUzwjvgPfnLzQtHZv0yWQ+FIHg==", + "requires": { + "tslib": "^1.9.3" + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, "ttl": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/ttl/-/ttl-1.3.1.tgz", @@ -19240,6 +19703,42 @@ "os-homedir": "^1.0.0" } }, + "unzip": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/unzip/-/unzip-0.1.11.tgz", + "integrity": "sha1-iXScY7BY19kNYZ+GuYqhU107l/A=", + "requires": { + "binary": ">= 0.3.0 < 1", + "fstream": ">= 0.1.30 < 1", + "match-stream": ">= 0.0.2 < 1", + "pullstream": ">= 0.4.1 < 1", + "readable-stream": "~1.0.31", + "setimmediate": ">= 1.0.1 < 2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "unzip-response": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", @@ -19736,6 +20235,20 @@ "fd-slicer": "~1.0.1" } }, + "zen-observable": { + "version": "0.8.14", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.14.tgz", + "integrity": "sha512-kQz39uonEjEESwh+qCi83kcC3rZJGh4mrZW7xjkSQYXkq//JZHTtKo+6yuVloTgMtzsIWOJrjIrKvk/dqm0L5g==" + }, + "zen-observable-ts": { + "version": "0.8.18", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.18.tgz", + "integrity": "sha512-q7d05s75Rn1j39U5Oapg3HI2wzriVwERVo4N7uFGpIYuHB9ff02P/E92P9B8T7QVC93jCMHpbXH7X0eVR5LA7A==", + "requires": { + "tslib": "^1.9.3", + "zen-observable": "^0.8.0" + } + }, "zerr": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/zerr/-/zerr-1.0.4.tgz", diff --git a/package.json b/package.json index 06301ed3..4a13f69f 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,9 @@ }, "homepage": "https://github.com/ssbc/patchbay#readme", "dependencies": { + "apollo-cache-inmemory": "^1.5.1", + "apollo-client": "^2.5.1", + "apollo-link-http": "^1.5.14", "bulk-require": "^1.0.1", "chart.js": "^2.7.3", "cross-script": "^1.0.5", @@ -55,11 +58,14 @@ "electron-spellchecker": "github:ssbc/electron-spellchecker-prebuilt", "electron-window-state": "^5.0.1", "font-awesome": "^4.7.0", + "graphql": "^14.3.0", + "graphql-tag": "^2.10.1", "highlight.js": "^9.13.1", "hypercrop": "^1.1.0", "hyperfile": "^2.0.0", "hyperlightbox": "^1.0.0", "hypertabs": "^5.0.1", + "jsbot-patchql": "^1.0.7", "json5": "^2.0.1", "libnested": "^1.3.2", "lodash": "^4.17.10", @@ -67,6 +73,7 @@ "micro-css": "^2.0.1", "mutant": "^3.22.3", "mutant-scroll": "^1.0.2", + "open-dyslexic": "^1.0.3", "open-external": "^0.1.1", "patch-drafts": "0.0.6", "patch-history": "^1.0.0", diff --git a/sbot/async/run.js b/sbot/async/run.js index b4376ef6..b9452615 100644 --- a/sbot/async/run.js +++ b/sbot/async/run.js @@ -10,6 +10,7 @@ exports.needs = nest({ exports.create = (api) => { return nest({ 'sbot.async.run': function run (fn) { + // fn(server) onceTrue(api.sbot.obs.connection, fn) } })