From ba3007b000d858ec3adae9c8618148b5d451975a Mon Sep 17 00:00:00 2001 From: Kara Stubbs Date: Fri, 21 Jun 2019 00:39:48 +0100 Subject: [PATCH] UrqlUseSubscription (#60) --- .../__snapshots__/UrqlClient_test.bs.js.snap | 4 + examples/5-subscription/bsconfig.json | 5 +- examples/5-subscription/package.json | 5 +- examples/5-subscription/public/index.html | 8 -- examples/5-subscription/src/app/App.re | 46 ++----- examples/5-subscription/src/app/AppStyles.re | 15 +++ examples/5-subscription/src/app/Circles.re | 58 +++++++++ examples/5-subscription/src/app/Logo.re | 61 ---------- examples/5-subscription/src/app/Messages.re | 83 ------------- examples/5-subscription/src/server/schema.js | 6 +- examples/5-subscription/webpack.config.js | 3 + examples/5-subscription/yarn.lock | 115 ++++-------------- package.json | 2 +- src/ReasonUrql.re | 4 +- src/UrqlTypes.re | 19 ++- src/components/UrqlSubscription.re | 74 +++++------ src/hooks/UrqlUseSubscription.re | 59 +++++++++ src/hooks/UrqlUseSubscription.rei | 9 ++ src/hooks/UrqlUseSubscriptionWithHandler.re | 72 +++++++++++ src/hooks/UrqlUseSubscriptionWithHandler.rei | 13 ++ yarn.lock | 101 ++------------- 21 files changed, 343 insertions(+), 419 deletions(-) create mode 100644 examples/5-subscription/src/app/AppStyles.re create mode 100644 examples/5-subscription/src/app/Circles.re delete mode 100644 examples/5-subscription/src/app/Logo.re delete mode 100644 examples/5-subscription/src/app/Messages.re create mode 100644 src/hooks/UrqlUseSubscription.re create mode 100644 src/hooks/UrqlUseSubscription.rei create mode 100644 src/hooks/UrqlUseSubscriptionWithHandler.re create mode 100644 src/hooks/UrqlUseSubscriptionWithHandler.rei diff --git a/__tests__/__snapshots__/UrqlClient_test.bs.js.snap b/__tests__/__snapshots__/UrqlClient_test.bs.js.snap index ae205170..9e77c3e9 100644 --- a/__tests__/__snapshots__/UrqlClient_test.bs.js.snap +++ b/__tests__/__snapshots__/UrqlClient_test.bs.js.snap @@ -17,6 +17,7 @@ Client { "operations$": [Function], "reexecuteOperation": [Function], "results$": [Function], + "suspense": false, "url": "https://localhost:3000", } `; @@ -42,6 +43,7 @@ Client { "operations$": [Function], "reexecuteOperation": [Function], "results$": [Function], + "suspense": false, "url": "https://localhost:3000", } `; @@ -67,6 +69,7 @@ Client { "operations$": [Function], "reexecuteOperation": [Function], "results$": [Function], + "suspense": false, "url": "https://localhost:3000", } `; @@ -88,6 +91,7 @@ Client { "operations$": [Function], "reexecuteOperation": [Function], "results$": [Function], + "suspense": false, "url": "https://localhost:3000", } `; diff --git a/examples/5-subscription/bsconfig.json b/examples/5-subscription/bsconfig.json index 71a34139..4f255b23 100644 --- a/examples/5-subscription/bsconfig.json +++ b/examples/5-subscription/bsconfig.json @@ -1,8 +1,9 @@ { "name": "5-subscription", "reason": { - "react-jsx": 2 + "react-jsx": 3 }, + "bsc-flags": ["-bs-super-errors"], "sources": [ { "dir": "src/app", @@ -12,7 +13,7 @@ ], "package-specs": [ { - "module": "commonjs", + "module": "es6", "in-source": true } ], diff --git a/examples/5-subscription/package.json b/examples/5-subscription/package.json index 54a8b108..8bff7db5 100644 --- a/examples/5-subscription/package.json +++ b/examples/5-subscription/package.json @@ -8,18 +8,19 @@ "scripts": { "start": "bsb -make-world -w", "clean": "bsb -clean-world", + "build": "bsb -make-world", "webpack": "webpack-dev-server --hot", "server": "node src/server/index.js", "start:demo": "run-p server webpack" }, "dependencies": { "bs-css": "^8.0.2", - "reason-react": ">=0.3.4", + "reason-react": "0.7.0", "reason-urql": "link:../../" }, "devDependencies": { "apollo-server-express": "^2.4.8", - "bs-platform": "^5.0.3", + "bs-platform": "^5.0.4", "cors": "^2.8.5", "express": "^4.16.4", "faker": "^4.1.0", diff --git a/examples/5-subscription/public/index.html b/examples/5-subscription/public/index.html index 92874d9e..d91b49e3 100644 --- a/examples/5-subscription/public/index.html +++ b/examples/5-subscription/public/index.html @@ -8,14 +8,6 @@ margin: 0; } - -
diff --git a/examples/5-subscription/src/app/App.re b/examples/5-subscription/src/app/App.re index 60cf5e7e..3c17cbb0 100644 --- a/examples/5-subscription/src/app/App.re +++ b/examples/5-subscription/src/app/App.re @@ -1,35 +1,11 @@ -let component = ReasonReact.statelessComponent("App"); - -module Styles = { - open Css; - - let page = - style([ - display(flexBox), - flexDirection(column), - position(absolute), - top(px(0)), - bottom(px(0)), - left(px(0)), - right(px(0)), - padding(px(20)), - ]); - - let side = - style([ - display(flexBox), - flexDirection(column), - alignItems(center), - flexBasis(pct(50.)), - firstChild([justifyContent(flexEnd)]), - ]); -}; - -let make = _children => { - ...component, - render: _self => -
-
-
-
, -}; \ No newline at end of file +[@react.component] +let make = () => +
+ + + +
; \ No newline at end of file diff --git a/examples/5-subscription/src/app/AppStyles.re b/examples/5-subscription/src/app/AppStyles.re new file mode 100644 index 00000000..a555f1c6 --- /dev/null +++ b/examples/5-subscription/src/app/AppStyles.re @@ -0,0 +1,15 @@ +open Css; + +let page = + style([ + display(flexBox), + flexDirection(column), + alignItems(center), + justifyContent(center), + position(absolute), + top(px(0)), + bottom(px(0)), + left(px(0)), + right(px(0)), + padding(px(20)), + ]); \ No newline at end of file diff --git a/examples/5-subscription/src/app/Circles.re b/examples/5-subscription/src/app/Circles.re new file mode 100644 index 00000000..39321b9d --- /dev/null +++ b/examples/5-subscription/src/app/Circles.re @@ -0,0 +1,58 @@ +open ReasonUrql; +open Hooks; + +module SubscribeRandomInt = [%graphql + {| + subscription subscribeNumbers { + newNumber @bsDecoder(fn: "string_of_int") + } +|} +]; + +let handler = (~prevSubscriptions, ~subscription) => { + switch (prevSubscriptions) { + | Some(subs) => Array.append(subs, [|subscription|]) + | None => [|subscription|] + }; +}; + +[@bs.scope "Math"] [@bs.val] external random: unit => float = "random"; +[@bs.scope "Math"] [@bs.val] external floor: float => int = "floor"; +[@bs.send] external toString: (int, int) => string = "toString"; + +let getRandomInt = (max: int) => { + floor(random() *. float_of_int(max)); +}; + +let getRandomHex = () => { + let encode = random() *. float_of_int(16777215) |> floor; + let hex = encode->toString(16); + {j|#$hex|j}; +}; + +[@react.component] +let make = () => { + let {response} = + useSubscriptionWithHandler(~request=SubscribeRandomInt.make(), ~handler); + + switch (response) { + | Fetching => "Loading"->React.string + | Data(d) => + Array.mapi( + (index, datum) => + string_of_int} + />, + d, + ) + |> React.array + | Error(_e) => "Error"->React.string + | NotFound => "Not Found"->React.string + }; +}; \ No newline at end of file diff --git a/examples/5-subscription/src/app/Logo.re b/examples/5-subscription/src/app/Logo.re deleted file mode 100644 index 9680b471..00000000 --- a/examples/5-subscription/src/app/Logo.re +++ /dev/null @@ -1,61 +0,0 @@ -module Styles = { - open Css; - - let wrapper = - style([display(flexBox), flexDirection(column), alignItems(center)]); - - let title = - style([ - fontFamily("'Marck Script', cursive"), - fontSize(rem(3.5)), - margin(px(0)), - ]); - - let logo = style([transform(scale(0.5, 0.5))]); -}; - -let str = ReasonReact.string; - -let component = ReasonReact.statelessComponent("Logo"); - -let make = _children => { - ...component, - render: _self => { -
-

"Words of Wisdom from"->str

- - - - - - - - - - - - - -
; - }, -}; \ No newline at end of file diff --git a/examples/5-subscription/src/app/Messages.re b/examples/5-subscription/src/app/Messages.re deleted file mode 100644 index 51c748e3..00000000 --- a/examples/5-subscription/src/app/Messages.re +++ /dev/null @@ -1,83 +0,0 @@ -open ReasonUrql; - -module SubscribeHPMessages = [%graphql - {| - subscription subscribeMessages { - newMessage { - id - message - } - } -|} -]; - -module Styles = { - open Css; - - let wrapper = - style([ - display(flexBox), - flexDirection(column), - alignItems(center), - justifyContent(center), - ]); - - let fadeIn = - keyframes([ - (0, [transform(translateY(px(20))), opacity(0.)]), - (100, [transform(translateY(px(0))), opacity(1.)]), - ]); - - let message = - style([ - background(linearGradient(turn(0.25), [(0, red), (100, orange)])), - listStyle(none, `outside, none), - padding(px(5)), - margin(px(10)), - borderRadius(px(5)), - fontSize(rem(2.)), - fontFamily("'PT Serif Caption', serif"), - width(pct(50.)), - display(flexBox), - alignItems(center), - justifyContent(center), - animation(~duration=500, ~fillMode=both, fadeIn), - ]); - - let gradientBlock = - style([ - display(block), - padding(px(10)), - background(white), - borderRadius(px(5)), - ]); -}; - -let str = ReasonReact.string; - -let subscription = SubscribeHPMessages.make(); -let query = subscription##query; - -let component = ReasonReact.statelessComponent("Messages"); - -let make = _children => { - ...component, - render: _self => - - ...{({response}) => - switch (response) { - | Fetching =>
"Loading"->str
- | Data(d) => -
-
- - {d##newMessage##message->str} - -
-
- | Error(_e) =>
"Error"->str
- | NotFound =>
"Not Found"->str
- } - } -
, -}; \ No newline at end of file diff --git a/examples/5-subscription/src/server/schema.js b/examples/5-subscription/src/server/schema.js index 6cd21b92..2af1f8c9 100644 --- a/examples/5-subscription/src/server/schema.js +++ b/examples/5-subscription/src/server/schema.js @@ -66,8 +66,8 @@ function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } -setInterval(() => +setInterval(() => { pubsub.publish("newNumber", { newNumber: getRandomInt(1000) - }) -); + }); +}, 2000); diff --git a/examples/5-subscription/webpack.config.js b/examples/5-subscription/webpack.config.js index 3b4126e7..940743d4 100644 --- a/examples/5-subscription/webpack.config.js +++ b/examples/5-subscription/webpack.config.js @@ -8,6 +8,9 @@ module.exports = { publicPath: "/public/", filename: "index.js" }, + resolve: { + modules: [path.resolve(__dirname, "../../node_modules"), "node_modules"] + }, devServer: { open: true, contentBase: path.resolve(__dirname, "public") diff --git a/examples/5-subscription/yarn.lock b/examples/5-subscription/yarn.lock index 46ecf105..49561b15 100644 --- a/examples/5-subscription/yarn.lock +++ b/examples/5-subscription/yarn.lock @@ -688,11 +688,6 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -asap@~2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= - asn1.js@^4.0.0: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" @@ -995,10 +990,10 @@ bs-fetch@^0.3.0: resolved "https://registry.yarnpkg.com/bs-fetch/-/bs-fetch-0.3.1.tgz#9c7d074b27e6bb2b9f2ec985964f32bcac49f79e" integrity sha512-MxwnuuXPldXnoCtlpeN5JNbbmb1tVgsqpLfVunvuMLAIQNyP0TqoImHiQRTz38PBSN8/iX+2yVlm+PFJfnHHiA== -bs-platform@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-5.0.3.tgz#2b167603ef52574cb9534fabab702f6013715e6c" - integrity sha512-GAeypBebeDGTay5kJ3v5Z3Whp1Q4zQ0hAttflVtPG3zps88xDZnVAlS3JGIIBDmJFEMyNtv5947a/IWKvWXcPw== +bs-platform@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-5.0.4.tgz#d406ef43c12d1b19d8546884d8b5b4e0fb709372" + integrity sha512-rXM+ztN8wYXQ4ojfFGylvPOf8GRLOvM94QJsMMV9VpsLChKCjesWMNybTZvpoyNsESu2nC5q+C9soG+BPhuUFQ== bs-rebel@^0.2.3: version "0.2.3" @@ -1342,11 +1337,6 @@ core-js@3.0.0-beta.13: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0-beta.13.tgz#7732c69be5e4758887917235fe7c0352c4cb42a1" integrity sha512-16Q43c/3LT9NyePUJKL8nRIQgYWjcBhjJSMWg96PVSxoS0PeE0NHitPI3opBrs9MGGHjte1KoEVr9W63YKlTXQ== -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= - core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -1414,14 +1404,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-context@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.3.tgz#9ec140a6914a22ef04b8b09b7771de89567cb6f3" - integrity sha512-CQBmD0+QGgTaxDL3OX1IDXYqjkp2It4RIbcb99jS6AEg27Ga+a9G3JtK6SIu0HBwPLZlmwt9F7UwWA4Bn92Rag== - dependencies: - fbjs "^0.8.0" - gud "^1.0.0" - cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -1714,13 +1696,6 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= - dependencies: - iconv-lite "~0.4.13" - end-of-stream@^1.0.0, end-of-stream@^1.1.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" @@ -2004,19 +1979,6 @@ faye-websocket@~0.11.1: dependencies: websocket-driver ">=0.5.1" -fbjs@^0.8.0: - version "0.8.17" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" - integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" @@ -2343,11 +2305,6 @@ graphql_ppx@^0.2.8: request "^2.82.0" yargs "^11.0.0" -gud@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" - integrity sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw== - handle-thing@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" @@ -2542,7 +2499,7 @@ iconv-lite@0.4.23: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -2814,7 +2771,7 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-stream@^1.0.1, is-stream@^1.1.0: +is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -2863,14 +2820,6 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -3049,7 +2998,7 @@ long@^4.0.0: resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -3369,14 +3318,6 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-fetch@^2.1.2, node-fetch@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" @@ -3887,14 +3828,7 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== - dependencies: - asap "~2.0.3" - -prop-types@^15.6.2: +prop-types@^15.6.0, prop-types@^15.6.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -4122,7 +4056,7 @@ readdirp@^2.2.1: micromatch "^3.1.10" readable-stream "^2.0.2" -reason-react@>=0.3.4: +reason-react@0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.0.tgz#46a975c321e81cd51310d7b1a02418ca7667b0d6" integrity sha512-czR/f0lY5iyLCki9gwftOFF5Zs40l7ZSFmpGK/Z6hx2jBVeFDmIiXB8bAQW/cO6IvtuEt97OmsYueiuOYG9XjQ== @@ -4400,7 +4334,7 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4, setimmediate@^1.0.5: +setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= @@ -4956,11 +4890,6 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -ua-parser-js@^0.7.18: - version "0.7.19" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" - integrity sha512-T3PVJ6uz8i0HzPxOF9SWzWAlfN/DavlpQqepn22xgve/5QecC+XMCAtmUNnY7C9StehaV6exjUCI801lOI7QlQ== - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" @@ -5031,13 +4960,15 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" -urql@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/urql/-/urql-1.0.4.tgz#e4140a15fbb7571d73a0008e736782522fd704c1" - integrity sha512-0/d09NkxvToMx1SVavouNrhPnm/y6k/QXaIpfMCo6/o0YeaOsOxv5xsSf8Pm35v5CLrd7L0sk28ZylnJ8XROeg== +urql@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/urql/-/urql-1.1.3.tgz#41fffb0a3b1a3f7ac47be55b7f84ca69875e7358" + integrity sha512-H6xdtT+b3n7OYG1U/ItLHTBfBpM0Kxd6FkQSYP1TvylqUeyz160whRu/XpwDRt2VwbLy5+j729wv4BF1f1zP4Q== dependencies: - create-react-context "^0.2.3" - wonka "^2.0.1" + fast-json-stable-stringify "^2.0.0" + graphql-tag "^2.10.1" + prop-types "^15.6.0" + wonka "^3.0.0" use@^3.1.0: version "3.1.1" @@ -5253,11 +5184,6 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== -whatwg-fetch@>=0.10.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" - integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== - which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -5284,6 +5210,11 @@ wonka@^2.0.1: dependencies: bs-rebel "^0.2.3" +wonka@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/wonka/-/wonka-3.0.0.tgz#4f32a6a30e3229bae5944f002ce32d05b0423ba8" + integrity sha512-eDDzMU1gv1OgZG0fYom/0xi3WO4s2ILt6QvZzjcnSvFM+nzpgX4sux1+Z+LDYWhknJA9agpDADVtATZtajMtLA== + worker-farm@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0" diff --git a/package.json b/package.json index 6f127fee..9f147fbb 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dependencies": { "bs-fetch": "^0.3.0", "graphql": "^14.1.1", - "urql": "^1.0.5", + "urql": "^1.1.1", "wonka": "^2.0.1" }, "devDependencies": { diff --git a/src/ReasonUrql.re b/src/ReasonUrql.re index 1848491c..a82acfae 100644 --- a/src/ReasonUrql.re +++ b/src/ReasonUrql.re @@ -21,4 +21,6 @@ module Exchanges = UrqlClient.UrqlExchanges; module Hooks = { include UrqlUseMutation; include UrqlUseQuery; -}; + include UrqlUseSubscription; + include UrqlUseSubscriptionWithHandler; +}; \ No newline at end of file diff --git a/src/UrqlTypes.re b/src/UrqlTypes.re index de4d36bd..3d7acce5 100644 --- a/src/UrqlTypes.re +++ b/src/UrqlTypes.re @@ -82,4 +82,21 @@ type operationResult = { data: operationData, [@bs.optional] error: UrqlCombinedError.t, -}; \ No newline at end of file +}; + +/* The signature of the structure created by calling `.make()` on a `graphql_ppx` module. */ +type request('response) = { + . + "parse": Js.Json.t => 'response, + "query": string, + "variables": Js.Json.t, +}; + +/* The type of the handler function passed to Subscription and useSubscription. + `handler` corresponds to the type of the handler function _before_ the latest subscription has been parsed. + `parsedHandler` corresponds to the type of the handler function _after_ the latest subscription has been parsed. */ +type handler('acc) = + (~prevSubscriptions: option('acc), ~subscription: Js.Json.t) => 'acc; + +type parsedHandler('acc, 'response) = + (~prevSubscriptions: option('acc), ~subscription: 'response) => 'acc; \ No newline at end of file diff --git a/src/components/UrqlSubscription.re b/src/components/UrqlSubscription.re index de049af8..eb48a245 100644 --- a/src/components/UrqlSubscription.re +++ b/src/components/UrqlSubscription.re @@ -1,11 +1,10 @@ -[@bs.module "urql"] -external subscriptionComponent: ReasonReact.reactClass = "Subscription"; - +[@bs.deriving abstract] type subscriptionRenderPropsJs('a) = { - . - "fetching": bool, - "data": Js.Nullable.t('a), - "error": Js.Nullable.t(UrqlCombinedError.t), + fetching: bool, + [@bs.optional] + data: 'a, + [@bs.optional] + error: UrqlCombinedError.t, }; type subscriptionRenderProps('a) = { @@ -15,50 +14,43 @@ type subscriptionRenderProps('a) = { response: UrqlTypes.response('a), }; +module SubscriptionJs = { + [@bs.module "urql"] [@react.component] + external make: + ( + ~query: string, + ~variables: Js.Json.t=?, + ~handler: UrqlTypes.handler('acc)=?, + ~children: subscriptionRenderPropsJs('a) => React.element + ) => + React.element = + "Subscription"; +}; + let urqlDataToRecord = (result: subscriptionRenderPropsJs('a)) => { - let data = result##data |> Js.Nullable.toOption; - let error = result##error |> Js.Nullable.toOption; + let data = result->dataGet; + let error = result->errorGet; + let fetching = result->fetchingGet; let response: UrqlTypes.response('a) = - switch (result##fetching, data, error) { + switch (fetching, data, error) { | (true, _, _) => Fetching | (false, Some(data), _) => Data(data) | (false, _, Some(error)) => Error(error) | (false, None, None) => NotFound }; - {fetching: result##fetching, data, error, response}; -}; - -type handler('a, 'b) = - (~prevSubscriptions: option('a), ~subscription: 'b) => 'a; - -[@bs.deriving abstract] -type jsProps('a, 'b) = { - query: string, - [@bs.optional] - variables: Js.Json.t, - [@bs.optional] - handler: handler('a, 'b), + {fetching, data, error, response}; }; +[@react.component] let make = ( - ~query, - ~variables=?, - ~handler=?, - children: subscriptionRenderProps('a) => ReasonReact.reactElement, - ) => { - let props = - switch (variables, handler) { - | (Some(v), Some(h)) => jsProps(~query, ~variables=v, ~handler=h, ()) - | (Some(v), None) => jsProps(~query, ~variables=v, ()) - | (None, Some(h)) => jsProps(~query, ~handler=h, ()) - | (None, None) => jsProps(~query, ()) - }; - - ReasonReact.wrapJsForReason( - ~reactClass=subscriptionComponent, ~props, result => - result |> urqlDataToRecord |> children - ); -}; \ No newline at end of file + ~query: string, + ~variables: option(Js.Json.t)=?, + ~handler: option(UrqlTypes.handler('acc))=?, + ~children: subscriptionRenderProps('a) => React.element, + ) => + + {result => result |> urqlDataToRecord |> children} + ; \ No newline at end of file diff --git a/src/hooks/UrqlUseSubscription.re b/src/hooks/UrqlUseSubscription.re new file mode 100644 index 00000000..08353677 --- /dev/null +++ b/src/hooks/UrqlUseSubscription.re @@ -0,0 +1,59 @@ +[@bs.deriving abstract] +type useSubscriptionArgs = { + query: string, + [@bs.optional] + variables: Js.Json.t, +}; + +[@bs.deriving abstract] +type useSubscriptionResponseJs = { + fetching: bool, + [@bs.optional] + data: Js.Json.t, + [@bs.optional] + error: UrqlCombinedError.t, +}; + +type useSubscriptionResponse('response) = { + fetching: bool, + data: option('response), + error: option(UrqlCombinedError.t), + response: UrqlTypes.response('response), +}; + +[@bs.module "urql"] +external useSubscriptionJs: + useSubscriptionArgs => array(useSubscriptionResponseJs) = + "useSubscription"; + +let useSubscriptionResponseToRecord = + (parse: Js.Json.t => 'response, result: useSubscriptionResponseJs) => { + let data = result->dataGet->Belt.Option.map(parse); + let error = result->errorGet; + let fetching = result->fetchingGet; + + let response = + switch (fetching, data, error) { + | (true, None, _) => UrqlTypes.Fetching + | (true, Some(data), _) => Data(data) + | (false, Some(data), _) => Data(data) + | (false, _, Some(error)) => Error(error) + | (false, None, None) => NotFound + }; + + {fetching, data, error, response}; +}; + +let useSubscription = request => { + let args = + useSubscriptionArgs( + ~query=request##query, + ~variables=request##variables, + (), + ); + let state = useSubscriptionJs(args)[0]; + + let useSubscriptionResponse = + state |> useSubscriptionResponseToRecord(request##parse); + useSubscriptionResponse; +}; \ No newline at end of file diff --git a/src/hooks/UrqlUseSubscription.rei b/src/hooks/UrqlUseSubscription.rei new file mode 100644 index 00000000..22e57e94 --- /dev/null +++ b/src/hooks/UrqlUseSubscription.rei @@ -0,0 +1,9 @@ +type useSubscriptionResponse('response) = { + fetching: bool, + data: option('response), + error: option(UrqlCombinedError.t), + response: UrqlTypes.response('response), +}; + +let useSubscription: + UrqlTypes.request('response) => useSubscriptionResponse('response); \ No newline at end of file diff --git a/src/hooks/UrqlUseSubscriptionWithHandler.re b/src/hooks/UrqlUseSubscriptionWithHandler.re new file mode 100644 index 00000000..4cab0017 --- /dev/null +++ b/src/hooks/UrqlUseSubscriptionWithHandler.re @@ -0,0 +1,72 @@ +[@bs.deriving abstract] +type useSubscriptionWithHandlerArgs = { + query: string, + [@bs.optional] + variables: Js.Json.t, +}; + +[@bs.deriving abstract] +type useSubscriptionWithHandlerResponseJs('acc) = { + fetching: bool, + [@bs.optional] + data: 'acc, + [@bs.optional] + error: UrqlCombinedError.t, +}; + +type useSubscriptionWithHandlerResponse('acc) = { + fetching: bool, + data: option('acc), + error: option(UrqlCombinedError.t), + response: UrqlTypes.response('acc), +}; + +[@bs.module "urql"] +external useSubscriptionWithHandlerJs: + ( + useSubscriptionWithHandlerArgs, + UrqlTypes.parsedHandler('acc, 'response) + ) => + array(useSubscriptionWithHandlerResponseJs('acc)) = + "useSubscription"; + +let useSubscriptionResponseToRecordWithHandler = + (result: useSubscriptionWithHandlerResponseJs('acc)) => { + let data = result->dataGet; + let error = result->errorGet; + let fetching = result->fetchingGet; + + let response = + switch (fetching, data, error) { + | (true, None, _) => UrqlTypes.Fetching + | (true, Some(data), _) => Data(data) + | (false, Some(data), _) => Data(data) + | (false, _, Some(error)) => Error(error) + | (false, None, None) => NotFound + }; + + {fetching, data, error, response}; +}; + +let useSubscriptionWithHandler = + ( + ~request: UrqlTypes.request('response), + ~handler: UrqlTypes.parsedHandler('acc, 'response), + ) => { + let parse = request##parse; + let parsedHandler = + (~prevSubscriptions: option('acc), ~subscription: Js.Json.t) => + handler(~prevSubscriptions, ~subscription=parse(subscription)); + + let args = + useSubscriptionWithHandlerArgs( + ~query=request##query, + ~variables=request##variables, + (), + ); + + let state = useSubscriptionWithHandlerJs(args, parsedHandler)[0]; + let useSubscriptionResponse = + state |> useSubscriptionResponseToRecordWithHandler; + useSubscriptionResponse; +}; \ No newline at end of file diff --git a/src/hooks/UrqlUseSubscriptionWithHandler.rei b/src/hooks/UrqlUseSubscriptionWithHandler.rei new file mode 100644 index 00000000..dac881c5 --- /dev/null +++ b/src/hooks/UrqlUseSubscriptionWithHandler.rei @@ -0,0 +1,13 @@ +type useSubscriptionWithHandlerResponse('acc) = { + fetching: bool, + data: option('acc), + error: option(UrqlCombinedError.t), + response: UrqlTypes.response('acc), +}; + +let useSubscriptionWithHandler: + ( + ~request: UrqlTypes.request('response), + ~handler: UrqlTypes.parsedHandler('acc, 'response) + ) => + useSubscriptionWithHandlerResponse('acc); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 7fbe9d5b..93e9ccaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -497,11 +497,6 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -asap@~2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= - asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -847,24 +842,11 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= - core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -create-react-context@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.3.tgz#9ec140a6914a22ef04b8b09b7771de89567cb6f3" - integrity sha512-CQBmD0+QGgTaxDL3OX1IDXYqjkp2It4RIbcb99jS6AEg27Ga+a9G3JtK6SIu0HBwPLZlmwt9F7UwWA4Bn92Rag== - dependencies: - fbjs "^0.8.0" - gud "^1.0.0" - cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -1023,13 +1005,6 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= - dependencies: - iconv-lite "~0.4.13" - end-of-stream@^1.1.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" @@ -1233,19 +1208,6 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs@^0.8.0: - version "0.8.17" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" - integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -1418,11 +1380,6 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -gud@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" - integrity sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw== - handlebars@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" @@ -1521,7 +1478,7 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -1730,7 +1687,7 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-stream@^1.0.1, is-stream@^1.1.0: +is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -1779,14 +1736,6 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -2601,14 +2550,6 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -2996,13 +2937,6 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== - dependencies: - asap "~2.0.3" - prompts@^2.0.1: version "2.1.0" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db" @@ -3366,11 +3300,6 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= - shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -3747,11 +3676,6 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -ua-parser-js@^0.7.18: - version "0.7.19" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" - integrity sha512-T3PVJ6uz8i0HzPxOF9SWzWAlfN/DavlpQqepn22xgve/5QecC+XMCAtmUNnY7C9StehaV6exjUCI801lOI7QlQ== - uglify-js@^3.1.4: version "3.6.0" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" @@ -3790,17 +3714,16 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -urql@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/urql/-/urql-1.0.5.tgz#782b6477692679e871cb55aa380e81f3746e053a" - integrity sha512-HIdfzxMC14ryyztakAxgKNEma4eC2N7iZaebLirslIiZAE+QLN5PoS0t30sfi9uG3ks0V9Y/AJRh2Du05g+8Mg== +urql@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/urql/-/urql-1.1.1.tgz#c89954ffd86d33a431271d331204e4801bede73d" + integrity sha512-aQikzyZEYtcDH5JWAM1I4c9vBZ3N9Sw7G7q0uQI18Yarux3NT/49Z1NTVCQzrk4ApoGk9tloh4R+Tjx4PoF7Ww== dependencies: "@types/fast-json-stable-stringify" "^2.0.0" - create-react-context "^0.2.3" fast-json-stable-stringify "^2.0.0" graphql-tag "^2.10.1" prop-types "^15.6.0" - wonka "^2.0.1" + wonka "^3.0.0" use@^3.1.0: version "3.1.1" @@ -3868,11 +3791,6 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: dependencies: iconv-lite "0.4.24" -whatwg-fetch@>=0.10.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" - integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== - whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" @@ -3922,6 +3840,11 @@ wonka@^2.0.1: dependencies: bs-rebel "^0.2.3" +wonka@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/wonka/-/wonka-3.0.0.tgz#4f32a6a30e3229bae5944f002ce32d05b0423ba8" + integrity sha512-eDDzMU1gv1OgZG0fYom/0xi3WO4s2ILt6QvZzjcnSvFM+nzpgX4sux1+Z+LDYWhknJA9agpDADVtATZtajMtLA== + wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"