@absinthe/socket
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(n){return n&&"object"==typeof n&&"default"in n?n.default:n}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck"));require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),utilsArray=require("@jumpn/utils-array"),_this$2=void 0,handlePush=function(n,i){return _newArrowCheck(this,_this$2),n.receive("ok",i.onSucceed).receive("error",i.onError).receive("timeout",i.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,i){return _newArrowCheck(this,_this$4),function(e){return _newArrowCheck(this,_this$4),e[n]&&e[n](i)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,i,e){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(i),e))}.bind(void 0),_this$3=void 0,notifyall=function(n,i,e){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,i,e)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,i,e){return _newArrowCheck(this,_this$7),n.find(utilsComposite.hasIn([i],e))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,i){return _newArrowCheck(this,_this$6),function(e){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",i);s&&e.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,i,e){return _newArrowCheck(this,_this$6),utilsComposite.map(createEventHandler(i,e),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,i,e){return _newArrowCheck(this,_this$9),n.findIndex(utilsComposite.hasIn([i],e))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(i){return _newArrowCheck(this,_this$8),utilsArray.remove(findIndex(i,"request",n.request),1,i)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(i){return _newArrowCheck(this,_this$10),utilsArray.replace(findIndex(i,"request",n.request),[n],i)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,i){return _newArrowCheck(this,_this$11),n.notifiers=i(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,i,e){var r=e.subscriptionId;_newArrowCheck(this,_this$5),updateNotifiers(n,refresh(_extends({},i,{subscriptionId:r}))),notifyStart(i)}.bind(void 0),abortRequest=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Abort",e)}.bind(void 0),onError=function(n,i,e){return _newArrowCheck(this,_this$5),abortRequest(n,i,new Error(e))}.bind(void 0),onSubscriptionResponse=function(n,i,e){_newArrowCheck(this,_this$5),e.errors?onError(n,i,utilsGraphql.errorsToString(e.errors)):onSubscriptionSucceed(n,i,e)}.bind(void 0),onQueryOrMutationResponse=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Result",e)}.bind(void 0),onTimeout=function(n,i){return _newArrowCheck(this,_this$5),notify(i,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var i=n.operation,e=n.variables;return _newArrowCheck(this,_this$5),e?{query:i,variables:e}:{query:i}}.bind(void 0),send=function(n,i,e){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(i)),createPushHandler(e,n,i))}.bind(void 0),pushRequest=function(n,i){_newArrowCheck(this,_this$5),"subscription"===i.operationType?send(n,i.request,subcriptionHandler):(notifyStart(i),send(n,i.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(i){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(i)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(i){return _newArrowCheck(this,_this$1),pushRequest(n,i)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,i){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(i)),notify(i,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"mutation"===i.operationType?mutationOnConnectionClose(n,i):notify(i,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this),function(){return _newArrowCheck(this,_this),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,i){var e=i.payload;_newArrowCheck(this,_this);var r=find(n.notifiers,"subscriptionId",e.subscriptionId);r&¬ify(r,"Result",e.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"subscription:data"===i.event&&onSubscriptionData(n,i)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this),function(){_newArrowCheck(this,_this),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this);var i={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(i)),n.onMessage(onMessage(i)),n.onClose(onConnectionClose(i)),i}.bind(void 0);module.exports=create; | ||
"use strict";function _interopDefault(n){return n&&"object"==typeof n&&"default"in n?n.default:n}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck"));require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),utilsArray=require("@jumpn/utils-array"),_this$2=void 0,handlePush=function(n,i){return _newArrowCheck(this,_this$2),n.receive("ok",i.onSucceed).receive("error",i.onError).receive("timeout",i.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,i){return _newArrowCheck(this,_this$4),function(e){return _newArrowCheck(this,_this$4),e[n]&&e[n](i)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,i,e){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(i),e))}.bind(void 0),_this$3=void 0,notifyall=function(n,i,e){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,i,e)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,i,e){return _newArrowCheck(this,_this$7),n.find(utilsComposite.hasIn([i],e))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,i){return _newArrowCheck(this,_this$6),function(e){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",i);s&&e.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,i,e){return _newArrowCheck(this,_this$6),utilsComposite.map(createEventHandler(i,e),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,i,e){return _newArrowCheck(this,_this$9),n.findIndex(utilsComposite.hasIn([i],e))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(i){return _newArrowCheck(this,_this$8),utilsArray.remove(findIndex(i,"request",n.request),1,i)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(i){return _newArrowCheck(this,_this$10),utilsArray.replace(findIndex(i,"request",n.request),[n],i)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,i){return _newArrowCheck(this,_this$11),n.notifiers=i(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,i,e){var r=e.subscriptionId;_newArrowCheck(this,_this$5);var t=_extends({},i,{subscriptionId:r});updateNotifiers(n,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Abort",e)}.bind(void 0),onError=function(n,i,e){return _newArrowCheck(this,_this$5),abortRequest(n,i,new Error(e))}.bind(void 0),onSubscriptionResponse=function(n,i,e){_newArrowCheck(this,_this$5),e.errors?onError(n,i,utilsGraphql.errorsToString(e.errors)):onSubscriptionSucceed(n,i,e)}.bind(void 0),onQueryOrMutationResponse=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Result",e)}.bind(void 0),onTimeout=function(n,i){return _newArrowCheck(this,_this$5),notify(i,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var i=n.operation,e=n.variables;return _newArrowCheck(this,_this$5),e?{query:i,variables:e}:{query:i}}.bind(void 0),send=function(n,i,e){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(i)),createPushHandler(e,n,i))}.bind(void 0),pushRequest=function(n,i){_newArrowCheck(this,_this$5),"subscription"===i.operationType?send(n,i.request,subcriptionHandler):(notifyStart(i),send(n,i.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(i){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(i)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(i){return _newArrowCheck(this,_this$1),pushRequest(n,i)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,i){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(i)),notify(i,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"mutation"===i.operationType?mutationOnConnectionClose(n,i):notify(i,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this),function(){return _newArrowCheck(this,_this),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,i){var e=i.payload;_newArrowCheck(this,_this);var r=find(n.notifiers,"subscriptionId",e.subscriptionId);r&¬ify(r,"Result",e.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"subscription:data"===i.event&&onSubscriptionData(n,i)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this),function(){_newArrowCheck(this,_this),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this);var i={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(i)),n.onMessage(onMessage(i)),n.onClose(onConnectionClose(i)),i}.bind(void 0);module.exports=create; | ||
//# sourceMappingURL=create.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),Observable=_interopDefault(require("zen-observable")),_this$2=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$3),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(n){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(n,"request",e.request),1,n)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$7),e.notifiers=n(e.notifiers),e}.bind(void 0),_this=void 0,removeNotifiers=function(e,n){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(n)),notify(n,"Cancel",n)}.bind(void 0),onError=function(e,n,i){_newArrowCheck(this,_this),unsubscribe(e,n),notify(n,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this),notify(n,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(e,n){return _newArrowCheck(this,_this),handlePush(e.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),createPushHandler(notifierPushHandler,e,n.request))}.bind(void 0),cancel=function(e,n){return _newArrowCheck(this,_this),"subscription"===n.operationType?unsubscribe(e,n):removeNotifiers(e,n),e}.bind(void 0),_this$10=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$10),e.forEach(function(e){return _newArrowCheck(this,_this$10),notify(e,n,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(e){return _newArrowCheck(this,_this$12),function(n){return _newArrowCheck(this,_this$12),utilsArray.replace(findIndex(n,"request",e.request),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,notifyStart=function(e){return _newArrowCheck(this,_this$11),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(e,refresh(_extends({},n,{subscriptionId:r}))),notifyStart(n)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError$1=function(e,n,i){return _newArrowCheck(this,_this$11),abortRequest(e,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,n,i){_newArrowCheck(this,_this$11),i.errors?onError$1(e,n,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,n,i)}.bind(void 0),onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout$1=function(e,n){return _newArrowCheck(this,_this$11),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var n=e.operation,i=e.variables;return _newArrowCheck(this,_this$11),i?{query:n,variables:i}:{query:n}}.bind(void 0),send=function(e,n,i){return _newArrowCheck(this,_this$11),handlePush(e.channel.push("doc",requestToDoc(n)),createPushHandler(i,e,n))}.bind(void 0),pushRequest=function(e,n){_newArrowCheck(this,_this$11),"subscription"===n.operationType?send(e,n.request,subcriptionHandler):(notifyStart(n),send(e,n.request,queryOrMutationHandler))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$9),{onError:function(n){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$9),e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$9),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$9),handlePush(e.channel.join(),createChannelJoinHandler(e)),e.channelJoinCreated=!0,e}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(e,n){_newArrowCheck(this,_this$8),updateNotifiers(e,remove$1(n)),notify(n,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"mutation"===n.operationType?mutationOnConnectionClose(e,n):notify(n,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(){return _newArrowCheck(this,_this$8),e.notifiers.forEach(notifierOnConnectionClose(e))}.bind(this)}.bind(void 0),onSubscriptionData=function(e,n){var i=n.payload;_newArrowCheck(this,_this$8);var r=find(e.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"subscription:data"===n.event&&onSubscriptionData(e,n)}.bind(this)}.bind(void 0),shouldJoinChannel=function(e){return _newArrowCheck(this,_this$8),!e.channelJoinCreated&&e.notifiers.length>0}.bind(void 0),onConnectionOpen=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),shouldJoinChannel(e)&&joinChannel(e)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(e){_newArrowCheck(this,_this$8);var n={phoenixSocket:e,channel:e.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return e.onOpen(onConnectionOpen(n)),e.onMessage(onMessage(n)),e.onClose(onConnectionClose(n)),n}.bind(void 0),_this$14=void 0,observe$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[n])})}.bind(void 0),_this$13=void 0,observe=function(e,n,i){return _newArrowCheck(this,_this$13),updateNotifiers(e,refresh(observe$2(n,i)))}.bind(void 0),_this$16=void 0,create$2=function(e){return _newArrowCheck(this,_this$16),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoinChannel=function(e){_newArrowCheck(this,_this$15),e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),sendNew=function(e,n){_newArrowCheck(this,_this$15);var i=create$2(n);return updateNotifiers(e,utilsArray.append([i])),e.channelJoinCreated?pushRequest(e,i):connectOrJoinChannel(e),i}.bind(void 0),send$1=function(e,n){return _newArrowCheck(this,_this$15),find(e.notifiers,"request",n)||sendNew(e,n)}.bind(void 0),_this$17=void 0,onResult=function(e,n){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),n.next(i),"subscription"!==e.operationType&&n.complete()}.bind(this)}.bind(void 0),toObservable=function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,t=i.onStart,o=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(e,n,{onError:r,onStart:t,onAbort:i.error,onResult:onResult(n,i)}),o}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:utilsArray.remove(i.indexOf(n),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(e,n,i){return _newArrowCheck(this,_this$18),updateNotifiers(e,refresh(unobserve$2(n,i))),e}.bind(void 0);exports.cancel=cancel,exports.create=create,exports.observe=observe,exports.send=send$1,exports.toObservable=toObservable,exports.unobserve=unobserve; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),Observable=_interopDefault(require("zen-observable")),_this$2=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$3),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(n){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(n,"request",e.request),1,n)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$7),e.notifiers=n(e.notifiers),e}.bind(void 0),_this=void 0,removeNotifiers=function(e,n){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(n)),notify(n,"Cancel",n)}.bind(void 0),onError=function(e,n,i){_newArrowCheck(this,_this),unsubscribe(e,n),notify(n,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this),notify(n,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(e,n){return _newArrowCheck(this,_this),handlePush(e.channel.push("unsubscribe",{subscriptionId:n.subscriptionId}),createPushHandler(notifierPushHandler,e,n.request))}.bind(void 0),cancel=function(e,n){return _newArrowCheck(this,_this),"subscription"===n.operationType?unsubscribe(e,n):removeNotifiers(e,n),e}.bind(void 0),_this$10=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$10),e.forEach(function(e){return _newArrowCheck(this,_this$10),notify(e,n,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(e){return _newArrowCheck(this,_this$12),function(n){return _newArrowCheck(this,_this$12),utilsArray.replace(findIndex(n,"request",e.request),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,notifyStart=function(e){return _newArrowCheck(this,_this$11),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11);var t=_extends({},n,{subscriptionId:r});updateNotifiers(e,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError$1=function(e,n,i){return _newArrowCheck(this,_this$11),abortRequest(e,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,n,i){_newArrowCheck(this,_this$11),i.errors?onError$1(e,n,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,n,i)}.bind(void 0),onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$11),updateNotifiers(e,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout$1=function(e,n){return _newArrowCheck(this,_this$11),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var n=e.operation,i=e.variables;return _newArrowCheck(this,_this$11),i?{query:n,variables:i}:{query:n}}.bind(void 0),send=function(e,n,i){return _newArrowCheck(this,_this$11),handlePush(e.channel.push("doc",requestToDoc(n)),createPushHandler(i,e,n))}.bind(void 0),pushRequest=function(e,n){_newArrowCheck(this,_this$11),"subscription"===n.operationType?send(e,n.request,subcriptionHandler):(notifyStart(n),send(e,n.request,queryOrMutationHandler))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$9),{onError:function(n){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$9),e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$9),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$9),handlePush(e.channel.join(),createChannelJoinHandler(e)),e.channelJoinCreated=!0,e}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(e,n){_newArrowCheck(this,_this$8),updateNotifiers(e,remove$1(n)),notify(n,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"mutation"===n.operationType?mutationOnConnectionClose(e,n):notify(n,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(e){return _newArrowCheck(this,_this$8),function(){return _newArrowCheck(this,_this$8),e.notifiers.forEach(notifierOnConnectionClose(e))}.bind(this)}.bind(void 0),onSubscriptionData=function(e,n){var i=n.payload;_newArrowCheck(this,_this$8);var r=find(e.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(e){return _newArrowCheck(this,_this$8),function(n){_newArrowCheck(this,_this$8),"subscription:data"===n.event&&onSubscriptionData(e,n)}.bind(this)}.bind(void 0),shouldJoinChannel=function(e){return _newArrowCheck(this,_this$8),!e.channelJoinCreated&&e.notifiers.length>0}.bind(void 0),onConnectionOpen=function(e){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),shouldJoinChannel(e)&&joinChannel(e)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(e){_newArrowCheck(this,_this$8);var n={phoenixSocket:e,channel:e.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return e.onOpen(onConnectionOpen(n)),e.onMessage(onMessage(n)),e.onClose(onConnectionClose(n)),n}.bind(void 0),_this$14=void 0,observe$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[n])})}.bind(void 0),_this$13=void 0,observe=function(e,n,i){return _newArrowCheck(this,_this$13),updateNotifiers(e,refresh(observe$2(n,i)))}.bind(void 0),_this$16=void 0,create$2=function(e){return _newArrowCheck(this,_this$16),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoinChannel=function(e){_newArrowCheck(this,_this$15),e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),sendNew=function(e,n){_newArrowCheck(this,_this$15);var i=create$2(n);return updateNotifiers(e,utilsArray.append([i])),e.channelJoinCreated?pushRequest(e,i):connectOrJoinChannel(e),i}.bind(void 0),send$1=function(e,n){return _newArrowCheck(this,_this$15),find(e.notifiers,"request",n)||sendNew(e,n)}.bind(void 0),_this$17=void 0,onResult=function(e,n){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),n.next(i),"subscription"!==e.operationType&&n.complete()}.bind(this)}.bind(void 0),toObservable=function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,t=i.onStart,o=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(e,n,{onError:r,onStart:t,onAbort:i.error,onResult:onResult(n,i)}),o}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(e,n){var i=e.observers,r=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:utilsArray.remove(i.indexOf(n),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(e,n,i){return _newArrowCheck(this,_this$18),updateNotifiers(e,refresh(unobserve$2(n,i))),e}.bind(void 0);exports.cancel=cancel,exports.create=create,exports.observe=observe,exports.send=send$1,exports.toObservable=toObservable,exports.unobserve=unobserve; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck"));require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),utilsArray=require("@jumpn/utils-array"),_this$1=void 0,handlePush=function(e,r){return _newArrowCheck(this,_this$1),e.receive("ok",r.onSucceed).receive("error",r.onError).receive("timeout",r.onTimeout)}.bind(void 0),_this$3=void 0,getNotifier=function(e,r){return _newArrowCheck(this,_this$3),function(i){return _newArrowCheck(this,_this$3),i[e]&&i[e](r)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$3),"on"+String(e)}.bind(void 0),notify=function(e,r,i){return _newArrowCheck(this,_this$3),e.observers.forEach(getNotifier(getHandlerName(r),i))}.bind(void 0),_this$2=void 0,notifyall=function(e,r,i){return _newArrowCheck(this,_this$2),e.forEach(function(e){return _newArrowCheck(this,_this$2),notify(e,r,i)}.bind(this))}.bind(void 0),_this$6=void 0,find=function(e,r,i){return _newArrowCheck(this,_this$6),e.find(utilsComposite.hasIn([r],i))}.bind(void 0),_this$5=void 0,createEventHandler=function(e,r){return _newArrowCheck(this,_this$5),function(i){return _newArrowCheck(this,_this$5),function(){for(var n=arguments.length,t=Array(n),o=0;o<n;o++)t[o]=arguments[o];_newArrowCheck(this,_this$5);var s=find(e.notifiers,"request",r);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,r,i){return _newArrowCheck(this,_this$5),utilsComposite.map(createEventHandler(r,i),e)}.bind(void 0),_this$8=void 0,findIndex=function(e,r,i){return _newArrowCheck(this,_this$8),e.findIndex(utilsComposite.hasIn([r],i))}.bind(void 0),_this$7=void 0,remove$1=function(e){return _newArrowCheck(this,_this$7),function(r){return _newArrowCheck(this,_this$7),utilsArray.remove(findIndex(r,"request",e.request),1,r)}.bind(this)}.bind(void 0),_this$9=void 0,refresh=function(e){return _newArrowCheck(this,_this$9),function(r){return _newArrowCheck(this,_this$9),utilsArray.replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$10=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$10),e.notifiers=r(e.notifiers),e}.bind(void 0),_this$4=void 0,notifyStart=function(e){return _newArrowCheck(this,_this$4),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,r,i){var n=i.subscriptionId;_newArrowCheck(this,_this$4),updateNotifiers(e,refresh(_extends({},r,{subscriptionId:n}))),notifyStart(r)}.bind(void 0),abortRequest=function(e,r,i){_newArrowCheck(this,_this$4),updateNotifiers(e,remove$1(r)),notify(r,"Abort",i)}.bind(void 0),onError=function(e,r,i){return _newArrowCheck(this,_this$4),abortRequest(e,r,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,r,i){_newArrowCheck(this,_this$4),i.errors?onError(e,r,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,r,i)}.bind(void 0),onQueryOrMutationResponse=function(e,r,i){_newArrowCheck(this,_this$4),updateNotifiers(e,remove$1(r)),notify(r,"Result",i)}.bind(void 0),onTimeout=function(e,r){return _newArrowCheck(this,_this$4),notify(r,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var r=e.operation,i=e.variables;return _newArrowCheck(this,_this$4),i?{query:r,variables:i}:{query:r}}.bind(void 0),send=function(e,r,i){return _newArrowCheck(this,_this$4),handlePush(e.channel.push("doc",requestToDoc(r)),createPushHandler(i,e,r))}.bind(void 0),pushRequest=function(e,r){_newArrowCheck(this,_this$4),"subscription"===r.operationType?send(e,r.request,subcriptionHandler):(notifyStart(r),send(e,r.request,queryOrMutationHandler))}.bind(void 0),_this=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this),{onError:function(r){return _newArrowCheck(this,_this),notifyall(e.notifiers,"Error",new Error("channel join: "+String(r)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this),e.notifiers.forEach(function(r){return _newArrowCheck(this,_this),pushRequest(e,r)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this),handlePush(e.channel.join(),createChannelJoinHandler(e)),e.channelJoinCreated=!0,e}.bind(void 0);module.exports=joinChannel; | ||
"use strict";function _interopDefault(r){return r&&"object"==typeof r&&"default"in r?r.default:r}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck"));require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),utilsArray=require("@jumpn/utils-array"),_this$1=void 0,handlePush=function(r,e){return _newArrowCheck(this,_this$1),r.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$3=void 0,getNotifier=function(r,e){return _newArrowCheck(this,_this$3),function(i){return _newArrowCheck(this,_this$3),i[r]&&i[r](e)}.bind(this)}.bind(void 0),getHandlerName=function(r){return _newArrowCheck(this,_this$3),"on"+String(r)}.bind(void 0),notify=function(r,e,i){return _newArrowCheck(this,_this$3),r.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$2=void 0,notifyall=function(r,e,i){return _newArrowCheck(this,_this$2),r.forEach(function(r){return _newArrowCheck(this,_this$2),notify(r,e,i)}.bind(this))}.bind(void 0),_this$6=void 0,find=function(r,e,i){return _newArrowCheck(this,_this$6),r.find(utilsComposite.hasIn([e],i))}.bind(void 0),_this$5=void 0,createEventHandler=function(r,e){return _newArrowCheck(this,_this$5),function(i){return _newArrowCheck(this,_this$5),function(){for(var n=arguments.length,t=Array(n),o=0;o<n;o++)t[o]=arguments[o];_newArrowCheck(this,_this$5);var s=find(r.notifiers,"request",e);s&&i.apply(void 0,[r,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(r,e,i){return _newArrowCheck(this,_this$5),utilsComposite.map(createEventHandler(e,i),r)}.bind(void 0),_this$8=void 0,findIndex=function(r,e,i){return _newArrowCheck(this,_this$8),r.findIndex(utilsComposite.hasIn([e],i))}.bind(void 0),_this$7=void 0,remove$1=function(r){return _newArrowCheck(this,_this$7),function(e){return _newArrowCheck(this,_this$7),utilsArray.remove(findIndex(e,"request",r.request),1,e)}.bind(this)}.bind(void 0),_this$9=void 0,refresh=function(r){return _newArrowCheck(this,_this$9),function(e){return _newArrowCheck(this,_this$9),utilsArray.replace(findIndex(e,"request",r.request),[r],e)}.bind(this)}.bind(void 0),_this$10=void 0,updateNotifiers=function(r,e){return _newArrowCheck(this,_this$10),r.notifiers=e(r.notifiers),r}.bind(void 0),_this$4=void 0,notifyStart=function(r){return _newArrowCheck(this,_this$4),notify(r,"Start",r)}.bind(void 0),onSubscriptionSucceed=function(r,e,i){var n=i.subscriptionId;_newArrowCheck(this,_this$4);var t=_extends({},e,{subscriptionId:n});updateNotifiers(r,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(r,e,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError=function(r,e,i){return _newArrowCheck(this,_this$4),abortRequest(r,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(r,e,i){_newArrowCheck(this,_this$4),i.errors?onError(r,e,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(r,e,i)}.bind(void 0),onQueryOrMutationResponse=function(r,e,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout=function(r,e){return _newArrowCheck(this,_this$4),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(r){var e=r.operation,i=r.variables;return _newArrowCheck(this,_this$4),i?{query:e,variables:i}:{query:e}}.bind(void 0),send=function(r,e,i){return _newArrowCheck(this,_this$4),handlePush(r.channel.push("doc",requestToDoc(e)),createPushHandler(i,r,e))}.bind(void 0),pushRequest=function(r,e){_newArrowCheck(this,_this$4),"subscription"===e.operationType?send(r,e.request,subcriptionHandler):(notifyStart(e),send(r,e.request,queryOrMutationHandler))}.bind(void 0),_this=void 0,createChannelJoinHandler=function(r){return _newArrowCheck(this,_this),{onError:function(e){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this),r.notifiers.forEach(function(e){return _newArrowCheck(this,_this),pushRequest(r,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(r){return _newArrowCheck(this,_this),handlePush(r.channel.join(),createChannelJoinHandler(r)),r.channelJoinCreated=!0,r}.bind(void 0);module.exports=joinChannel; | ||
//# sourceMappingURL=joinChannel.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _extends=_interopDefault(require("babel-runtime/helpers/extends")),_newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_this$2=void 0,find=function(e,r,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([r],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,r){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",r);s&&i.apply(void 0,[e,s].concat(n))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,r,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(r,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,r){return _newArrowCheck(this,_this$3),e.receive("ok",r.onSucceed).receive("error",r.onError).receive("timeout",r.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,r){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](r)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,r,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(r),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,r,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([r],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(r){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(r,"request",e.request),1,r)}.bind(this)}.bind(void 0),_this$7=void 0,refresh=function(e){return _newArrowCheck(this,_this$7),function(r){return _newArrowCheck(this,_this$7),utilsArray.replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$8=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$8),e.notifiers=r(e.notifiers),e}.bind(void 0),_this=void 0,notifyStart=function(e){return _newArrowCheck(this,_this),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,r,i){var t=i.subscriptionId;_newArrowCheck(this,_this),updateNotifiers(e,refresh(_extends({},r,{subscriptionId:t}))),notifyStart(r)}.bind(void 0),abortRequest=function(e,r,i){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(r)),notify(r,"Abort",i)}.bind(void 0),onError=function(e,r,i){return _newArrowCheck(this,_this),abortRequest(e,r,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,r,i){_newArrowCheck(this,_this),i.errors?onError(e,r,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,r,i)}.bind(void 0),onQueryOrMutationResponse=function(e,r,i){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(r)),notify(r,"Result",i)}.bind(void 0),onTimeout=function(e,r){return _newArrowCheck(this,_this),notify(r,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var r=e.operation,i=e.variables;return _newArrowCheck(this,_this),i?{query:r,variables:i}:{query:r}}.bind(void 0),send=function(e,r,i){return _newArrowCheck(this,_this),handlePush(e.channel.push("doc",requestToDoc(r)),createPushHandler(i,e,r))}.bind(void 0),pushRequest=function(e,r){_newArrowCheck(this,_this),"subscription"===r.operationType?send(e,r.request,subcriptionHandler):(notifyStart(r),send(e,r.request,queryOrMutationHandler))}.bind(void 0);module.exports=pushRequest; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _extends=_interopDefault(require("babel-runtime/helpers/extends")),_newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite");require("phoenix");var utilsArray=require("@jumpn/utils-array"),_this$2=void 0,find=function(e,r,i){return _newArrowCheck(this,_this$2),e.find(utilsComposite.hasIn([r],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(e,r){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(e.notifiers,"request",r);s&&i.apply(void 0,[e,s].concat(n))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,r,i){return _newArrowCheck(this,_this$1),utilsComposite.map(createEventHandler(r,i),e)}.bind(void 0),_this$3=void 0,handlePush=function(e,r){return _newArrowCheck(this,_this$3),e.receive("ok",r.onSucceed).receive("error",r.onError).receive("timeout",r.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,r){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](r)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,r,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(r),i))}.bind(void 0),_this$6=void 0,findIndex=function(e,r,i){return _newArrowCheck(this,_this$6),e.findIndex(utilsComposite.hasIn([r],i))}.bind(void 0),_this$5=void 0,remove$1=function(e){return _newArrowCheck(this,_this$5),function(r){return _newArrowCheck(this,_this$5),utilsArray.remove(findIndex(r,"request",e.request),1,r)}.bind(this)}.bind(void 0),_this$7=void 0,refresh=function(e){return _newArrowCheck(this,_this$7),function(r){return _newArrowCheck(this,_this$7),utilsArray.replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$8=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$8),e.notifiers=r(e.notifiers),e}.bind(void 0),_this=void 0,notifyStart=function(e){return _newArrowCheck(this,_this),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,r,i){var t=i.subscriptionId;_newArrowCheck(this,_this);var n=_extends({},r,{subscriptionId:t});updateNotifiers(e,refresh(n)),notifyStart(n)}.bind(void 0),abortRequest=function(e,r,i){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(r)),notify(r,"Abort",i)}.bind(void 0),onError=function(e,r,i){return _newArrowCheck(this,_this),abortRequest(e,r,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,r,i){_newArrowCheck(this,_this),i.errors?onError(e,r,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,r,i)}.bind(void 0),onQueryOrMutationResponse=function(e,r,i){_newArrowCheck(this,_this),updateNotifiers(e,remove$1(r)),notify(r,"Result",i)}.bind(void 0),onTimeout=function(e,r){return _newArrowCheck(this,_this),notify(r,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var r=e.operation,i=e.variables;return _newArrowCheck(this,_this),i?{query:r,variables:i}:{query:r}}.bind(void 0),send=function(e,r,i){return _newArrowCheck(this,_this),handlePush(e.channel.push("doc",requestToDoc(r)),createPushHandler(i,e,r))}.bind(void 0),pushRequest=function(e,r){_newArrowCheck(this,_this),"subscription"===r.operationType?send(e,r.request,subcriptionHandler):(notifyStart(r),send(e,r.request,queryOrMutationHandler))}.bind(void 0);module.exports=pushRequest; | ||
//# sourceMappingURL=pushRequest.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsArray=require("@jumpn/utils-array");require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),_this$2=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$2),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$3=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$3),e.forEach(function(e){return _newArrowCheck(this,_this$3),notify(e,n,i)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$7),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$6=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$6),function(i){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$6),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$9=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$9),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$8=void 0,remove$1=function(e){return _newArrowCheck(this,_this$8),function(n){return _newArrowCheck(this,_this$8),utilsArray.remove(findIndex(n,"request",e.request),1,n)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(e){return _newArrowCheck(this,_this$10),function(n){return _newArrowCheck(this,_this$10),utilsArray.replace(findIndex(n,"request",e.request),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$11),e.notifiers=n(e.notifiers),e}.bind(void 0),_this$5=void 0,notifyStart=function(e){return _newArrowCheck(this,_this$5),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$5),updateNotifiers(e,refresh(_extends({},n,{subscriptionId:r}))),notifyStart(n)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$5),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError=function(e,n,i){return _newArrowCheck(this,_this$5),abortRequest(e,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,n,i){_newArrowCheck(this,_this$5),i.errors?onError(e,n,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,n,i)}.bind(void 0),onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$5),updateNotifiers(e,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this$5),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var n=e.operation,i=e.variables;return _newArrowCheck(this,_this$5),i?{query:n,variables:i}:{query:n}}.bind(void 0),send$2=function(e,n,i){return _newArrowCheck(this,_this$5),handlePush(e.channel.push("doc",requestToDoc(n)),createPushHandler(i,e,n))}.bind(void 0),pushRequest=function(e,n){_newArrowCheck(this,_this$5),"subscription"===n.operationType?send$2(e,n.request,subcriptionHandler):(notifyStart(n),send$2(e,n.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$1),{onError:function(n){return _newArrowCheck(this,_this$1),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$1),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$1),handlePush(e.channel.join(),createChannelJoinHandler(e)),e.channelJoinCreated=!0,e}.bind(void 0),_this$12=void 0,create=function(e){return _newArrowCheck(this,_this$12),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this=void 0,connectOrJoinChannel=function(e){_newArrowCheck(this,_this),e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),sendNew=function(e,n){_newArrowCheck(this,_this);var i=create(n);return updateNotifiers(e,utilsArray.append([i])),e.channelJoinCreated?pushRequest(e,i):connectOrJoinChannel(e),i}.bind(void 0),send=function(e,n){return _newArrowCheck(this,_this),find(e.notifiers,"request",n)||sendNew(e,n)}.bind(void 0);module.exports=send; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),utilsArray=require("@jumpn/utils-array");require("phoenix");var _extends=_interopDefault(require("babel-runtime/helpers/extends")),utilsGraphql=require("@jumpn/utils-graphql"),utilsComposite=require("@jumpn/utils-composite"),_this$2=void 0,handlePush=function(e,n){return _newArrowCheck(this,_this$2),e.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(e,n){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[e]&&i[e](n)}.bind(this)}.bind(void 0),getHandlerName=function(e){return _newArrowCheck(this,_this$4),"on"+String(e)}.bind(void 0),notify=function(e,n,i){return _newArrowCheck(this,_this$4),e.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$3=void 0,notifyall=function(e,n,i){return _newArrowCheck(this,_this$3),e.forEach(function(e){return _newArrowCheck(this,_this$3),notify(e,n,i)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(e,n,i){return _newArrowCheck(this,_this$7),e.find(utilsComposite.hasIn([n],i))}.bind(void 0),_this$6=void 0,createEventHandler=function(e,n){return _newArrowCheck(this,_this$6),function(i){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(e.notifiers,"request",n);s&&i.apply(void 0,[e,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(e,n,i){return _newArrowCheck(this,_this$6),utilsComposite.map(createEventHandler(n,i),e)}.bind(void 0),_this$9=void 0,findIndex=function(e,n,i){return _newArrowCheck(this,_this$9),e.findIndex(utilsComposite.hasIn([n],i))}.bind(void 0),_this$8=void 0,remove$1=function(e){return _newArrowCheck(this,_this$8),function(n){return _newArrowCheck(this,_this$8),utilsArray.remove(findIndex(n,"request",e.request),1,n)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(e){return _newArrowCheck(this,_this$10),function(n){return _newArrowCheck(this,_this$10),utilsArray.replace(findIndex(n,"request",e.request),[e],n)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(e,n){return _newArrowCheck(this,_this$11),e.notifiers=n(e.notifiers),e}.bind(void 0),_this$5=void 0,notifyStart=function(e){return _newArrowCheck(this,_this$5),notify(e,"Start",e)}.bind(void 0),onSubscriptionSucceed=function(e,n,i){var r=i.subscriptionId;_newArrowCheck(this,_this$5);var t=_extends({},n,{subscriptionId:r});updateNotifiers(e,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(e,n,i){_newArrowCheck(this,_this$5),updateNotifiers(e,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError=function(e,n,i){return _newArrowCheck(this,_this$5),abortRequest(e,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(e,n,i){_newArrowCheck(this,_this$5),i.errors?onError(e,n,utilsGraphql.errorsToString(i.errors)):onSubscriptionSucceed(e,n,i)}.bind(void 0),onQueryOrMutationResponse=function(e,n,i){_newArrowCheck(this,_this$5),updateNotifiers(e,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout=function(e,n){return _newArrowCheck(this,_this$5),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(e){var n=e.operation,i=e.variables;return _newArrowCheck(this,_this$5),i?{query:n,variables:i}:{query:n}}.bind(void 0),send$2=function(e,n,i){return _newArrowCheck(this,_this$5),handlePush(e.channel.push("doc",requestToDoc(n)),createPushHandler(i,e,n))}.bind(void 0),pushRequest=function(e,n){_newArrowCheck(this,_this$5),"subscription"===n.operationType?send$2(e,n.request,subcriptionHandler):(notifyStart(n),send$2(e,n.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(e){return _newArrowCheck(this,_this$1),{onError:function(n){return _newArrowCheck(this,_this$1),notifyall(e.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),e.notifiers.forEach(function(n){return _newArrowCheck(this,_this$1),pushRequest(e,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(e.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(e){return _newArrowCheck(this,_this$1),handlePush(e.channel.join(),createChannelJoinHandler(e)),e.channelJoinCreated=!0,e}.bind(void 0),_this$12=void 0,create=function(e){return _newArrowCheck(this,_this$12),{request:e,observers:[],operationType:utilsGraphql.getOperationType(e.operation),subscriptionId:void 0}}.bind(void 0),_this=void 0,connectOrJoinChannel=function(e){_newArrowCheck(this,_this),e.phoenixSocket.isConnected()?joinChannel(e):e.phoenixSocket.connect()}.bind(void 0),sendNew=function(e,n){_newArrowCheck(this,_this);var i=create(n);return updateNotifiers(e,utilsArray.append([i])),e.channelJoinCreated?pushRequest(e,i):connectOrJoinChannel(e),i}.bind(void 0),send=function(e,n){return _newArrowCheck(this,_this),find(e.notifiers,"request",n)||sendNew(e,n)}.bind(void 0);module.exports=send; | ||
//# sourceMappingURL=send.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import{remove,replace}from"@jumpn/utils-array";var _this$2=void 0,handlePush=function(n,i){return _newArrowCheck(this,_this$2),n.receive("ok",i.onSucceed).receive("error",i.onError).receive("timeout",i.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,i){return _newArrowCheck(this,_this$4),function(e){return _newArrowCheck(this,_this$4),e[n]&&e[n](i)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,i,e){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(i),e))}.bind(void 0),_this$3=void 0,notifyall=function(n,i,e){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,i,e)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,i,e){return _newArrowCheck(this,_this$7),n.find(hasIn([i],e))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,i){return _newArrowCheck(this,_this$6),function(e){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",i);s&&e.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,i,e){return _newArrowCheck(this,_this$6),map(createEventHandler(i,e),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,i,e){return _newArrowCheck(this,_this$9),n.findIndex(hasIn([i],e))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(i){return _newArrowCheck(this,_this$8),remove(findIndex(i,"request",n.request),1,i)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(i){return _newArrowCheck(this,_this$10),replace(findIndex(i,"request",n.request),[n],i)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,i){return _newArrowCheck(this,_this$11),n.notifiers=i(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,i,e){var r=e.subscriptionId;_newArrowCheck(this,_this$5),updateNotifiers(n,refresh(_extends({},i,{subscriptionId:r}))),notifyStart(i)}.bind(void 0),abortRequest=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Abort",e)}.bind(void 0),onError=function(n,i,e){return _newArrowCheck(this,_this$5),abortRequest(n,i,new Error(e))}.bind(void 0),onSubscriptionResponse=function(n,i,e){_newArrowCheck(this,_this$5),e.errors?onError(n,i,errorsToString(e.errors)):onSubscriptionSucceed(n,i,e)}.bind(void 0),onQueryOrMutationResponse=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Result",e)}.bind(void 0),onTimeout=function(n,i){return _newArrowCheck(this,_this$5),notify(i,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var i=n.operation,e=n.variables;return _newArrowCheck(this,_this$5),e?{query:i,variables:e}:{query:i}}.bind(void 0),send=function(n,i,e){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(i)),createPushHandler(e,n,i))}.bind(void 0),pushRequest=function(n,i){_newArrowCheck(this,_this$5),"subscription"===i.operationType?send(n,i.request,subcriptionHandler):(notifyStart(i),send(n,i.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(i){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(i)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(i){return _newArrowCheck(this,_this$1),pushRequest(n,i)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,i){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(i)),notify(i,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"mutation"===i.operationType?mutationOnConnectionClose(n,i):notify(i,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this),function(){return _newArrowCheck(this,_this),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,i){var e=i.payload;_newArrowCheck(this,_this);var r=find(n.notifiers,"subscriptionId",e.subscriptionId);r&¬ify(r,"Result",e.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"subscription:data"===i.event&&onSubscriptionData(n,i)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this),function(){_newArrowCheck(this,_this),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this);var i={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(i)),n.onMessage(onMessage(i)),n.onClose(onConnectionClose(i)),i}.bind(void 0);export default create; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import{remove,replace}from"@jumpn/utils-array";var _this$2=void 0,handlePush=function(n,i){return _newArrowCheck(this,_this$2),n.receive("ok",i.onSucceed).receive("error",i.onError).receive("timeout",i.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,i){return _newArrowCheck(this,_this$4),function(e){return _newArrowCheck(this,_this$4),e[n]&&e[n](i)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,i,e){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(i),e))}.bind(void 0),_this$3=void 0,notifyall=function(n,i,e){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,i,e)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,i,e){return _newArrowCheck(this,_this$7),n.find(hasIn([i],e))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,i){return _newArrowCheck(this,_this$6),function(e){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",i);s&&e.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,i,e){return _newArrowCheck(this,_this$6),map(createEventHandler(i,e),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,i,e){return _newArrowCheck(this,_this$9),n.findIndex(hasIn([i],e))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(i){return _newArrowCheck(this,_this$8),remove(findIndex(i,"request",n.request),1,i)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(i){return _newArrowCheck(this,_this$10),replace(findIndex(i,"request",n.request),[n],i)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,i){return _newArrowCheck(this,_this$11),n.notifiers=i(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,i,e){var r=e.subscriptionId;_newArrowCheck(this,_this$5);var t=_extends({},i,{subscriptionId:r});updateNotifiers(n,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Abort",e)}.bind(void 0),onError=function(n,i,e){return _newArrowCheck(this,_this$5),abortRequest(n,i,new Error(e))}.bind(void 0),onSubscriptionResponse=function(n,i,e){_newArrowCheck(this,_this$5),e.errors?onError(n,i,errorsToString(e.errors)):onSubscriptionSucceed(n,i,e)}.bind(void 0),onQueryOrMutationResponse=function(n,i,e){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(i)),notify(i,"Result",e)}.bind(void 0),onTimeout=function(n,i){return _newArrowCheck(this,_this$5),notify(i,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var i=n.operation,e=n.variables;return _newArrowCheck(this,_this$5),e?{query:i,variables:e}:{query:i}}.bind(void 0),send=function(n,i,e){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(i)),createPushHandler(e,n,i))}.bind(void 0),pushRequest=function(n,i){_newArrowCheck(this,_this$5),"subscription"===i.operationType?send(n,i.request,subcriptionHandler):(notifyStart(i),send(n,i.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(i){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(i)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(i){return _newArrowCheck(this,_this$1),pushRequest(n,i)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,i){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(i)),notify(i,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"mutation"===i.operationType?mutationOnConnectionClose(n,i):notify(i,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this),function(){return _newArrowCheck(this,_this),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,i){var e=i.payload;_newArrowCheck(this,_this);var r=find(n.notifiers,"subscriptionId",e.subscriptionId);r&¬ify(r,"Result",e.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this),function(i){_newArrowCheck(this,_this),"subscription:data"===i.event&&onSubscriptionData(n,i)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this),function(){_newArrowCheck(this,_this),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this);var i={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(i)),n.onMessage(onMessage(i)),n.onClose(onConnectionClose(i)),i}.bind(void 0);export default create; | ||
//# sourceMappingURL=create.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{append,remove,replace}from"@jumpn/utils-array";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import Observable from"zen-observable";var _this$2=void 0,find=function(n,e,i){return _newArrowCheck(this,_this$2),n.find(hasIn([e],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(n,e){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,o=Array(r),t=0;t<r;t++)o[t]=arguments[t];_newArrowCheck(this,_this$1);var s=find(n.notifiers,"request",e);s&&i.apply(void 0,[n,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,e,i){return _newArrowCheck(this,_this$1),map(createEventHandler(e,i),n)}.bind(void 0),_this$3=void 0,handlePush=function(n,e){return _newArrowCheck(this,_this$3),n.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[n]&&i[n](e)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,e,i){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$6=void 0,findIndex=function(n,e,i){return _newArrowCheck(this,_this$6),n.findIndex(hasIn([e],i))}.bind(void 0),_this$5=void 0,remove$1=function(n){return _newArrowCheck(this,_this$5),function(e){return _newArrowCheck(this,_this$5),remove(findIndex(e,"request",n.request),1,e)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(n,e){return _newArrowCheck(this,_this$7),n.notifiers=e(n.notifiers),n}.bind(void 0),_this=void 0,removeNotifiers=function(n,e){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(e)),notify(e,"Cancel",e)}.bind(void 0),onError=function(n,e,i){_newArrowCheck(this,_this),unsubscribe(n,e),notify(e,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(n,e){return _newArrowCheck(this,_this),notify(e,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(n,e){return _newArrowCheck(this,_this),handlePush(n.channel.push("unsubscribe",{subscriptionId:e.subscriptionId}),createPushHandler(notifierPushHandler,n,e.request))}.bind(void 0),cancel=function(n,e){return _newArrowCheck(this,_this),"subscription"===e.operationType?unsubscribe(n,e):removeNotifiers(n,e),n}.bind(void 0),_this$10=void 0,notifyall=function(n,e,i){return _newArrowCheck(this,_this$10),n.forEach(function(n){return _newArrowCheck(this,_this$10),notify(n,e,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(n){return _newArrowCheck(this,_this$12),function(e){return _newArrowCheck(this,_this$12),replace(findIndex(e,"request",n.request),[n],e)}.bind(this)}.bind(void 0),_this$11=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$11),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,e,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11),updateNotifiers(n,refresh(_extends({},e,{subscriptionId:r}))),notifyStart(e)}.bind(void 0),abortRequest=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError$1=function(n,e,i){return _newArrowCheck(this,_this$11),abortRequest(n,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(n,e,i){_newArrowCheck(this,_this$11),i.errors?onError$1(n,e,errorsToString(i.errors)):onSubscriptionSucceed(n,e,i)}.bind(void 0),onQueryOrMutationResponse=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout$1=function(n,e){return _newArrowCheck(this,_this$11),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var e=n.operation,i=n.variables;return _newArrowCheck(this,_this$11),i?{query:e,variables:i}:{query:e}}.bind(void 0),send=function(n,e,i){return _newArrowCheck(this,_this$11),handlePush(n.channel.push("doc",requestToDoc(e)),createPushHandler(i,n,e))}.bind(void 0),pushRequest=function(n,e){_newArrowCheck(this,_this$11),"subscription"===e.operationType?send(n,e.request,subcriptionHandler):(notifyStart(e),send(n,e.request,queryOrMutationHandler))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$9),{onError:function(e){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$9),n.notifiers.forEach(function(e){return _newArrowCheck(this,_this$9),pushRequest(n,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$9),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,e){_newArrowCheck(this,_this$8),updateNotifiers(n,remove$1(e)),notify(e,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"mutation"===e.operationType?mutationOnConnectionClose(n,e):notify(e,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(){return _newArrowCheck(this,_this$8),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,e){var i=e.payload;_newArrowCheck(this,_this$8);var r=find(n.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"subscription:data"===e.event&&onSubscriptionData(n,e)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this$8),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this$8);var e={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(e)),n.onMessage(onMessage(e)),n.onClose(onConnectionClose(e)),e}.bind(void 0),_this$14=void 0,observe$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[e])})}.bind(void 0),_this$13=void 0,observe=function(n,e,i){return _newArrowCheck(this,_this$13),updateNotifiers(n,refresh(observe$2(e,i)))}.bind(void 0),_this$16=void 0,create$2=function(n){return _newArrowCheck(this,_this$16),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoinChannel=function(n){_newArrowCheck(this,_this$15),n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),sendNew=function(n,e){_newArrowCheck(this,_this$15);var i=create$2(e);return updateNotifiers(n,append([i])),n.channelJoinCreated?pushRequest(n,i):connectOrJoinChannel(n),i}.bind(void 0),send$1=function(n,e){return _newArrowCheck(this,_this$15),find(n.notifiers,"request",e)||sendNew(n,e)}.bind(void 0),_this$17=void 0,onResult=function(n,e){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),e.next(i),"subscription"!==n.operationType&&e.complete()}.bind(this)}.bind(void 0),toObservable=function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,o=i.onStart,t=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(n,e,{onError:r,onStart:o,onAbort:i.error,onResult:onResult(e,i)}),t}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:remove(i.indexOf(e),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(n,e,i){return _newArrowCheck(this,_this$18),updateNotifiers(n,refresh(unobserve$2(e,i))),n}.bind(void 0);export{cancel,create,observe,send$1 as send,toObservable,unobserve}; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{append,remove,replace}from"@jumpn/utils-array";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import Observable from"zen-observable";var _this$2=void 0,find=function(n,e,i){return _newArrowCheck(this,_this$2),n.find(hasIn([e],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(n,e){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var r=arguments.length,o=Array(r),t=0;t<r;t++)o[t]=arguments[t];_newArrowCheck(this,_this$1);var s=find(n.notifiers,"request",e);s&&i.apply(void 0,[n,s].concat(o))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,e,i){return _newArrowCheck(this,_this$1),map(createEventHandler(e,i),n)}.bind(void 0),_this$3=void 0,handlePush=function(n,e){return _newArrowCheck(this,_this$3),n.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[n]&&i[n](e)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,e,i){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$6=void 0,findIndex=function(n,e,i){return _newArrowCheck(this,_this$6),n.findIndex(hasIn([e],i))}.bind(void 0),_this$5=void 0,remove$1=function(n){return _newArrowCheck(this,_this$5),function(e){return _newArrowCheck(this,_this$5),remove(findIndex(e,"request",n.request),1,e)}.bind(this)}.bind(void 0),_this$7=void 0,updateNotifiers=function(n,e){return _newArrowCheck(this,_this$7),n.notifiers=e(n.notifiers),n}.bind(void 0),_this=void 0,removeNotifiers=function(n,e){_newArrowCheck(this,_this),updateNotifiers(n,remove$1(e)),notify(e,"Cancel",e)}.bind(void 0),onError=function(n,e,i){_newArrowCheck(this,_this),unsubscribe(n,e),notify(e,"Error","unsubscribe: "+String(i))}.bind(void 0),onTimeout=function(n,e){return _newArrowCheck(this,_this),notify(e,"Error","unsubscribe: timeout")}.bind(void 0),notifierPushHandler={onError:onError,onTimeout:onTimeout,onSucceed:removeNotifiers},unsubscribe=function(n,e){return _newArrowCheck(this,_this),handlePush(n.channel.push("unsubscribe",{subscriptionId:e.subscriptionId}),createPushHandler(notifierPushHandler,n,e.request))}.bind(void 0),cancel=function(n,e){return _newArrowCheck(this,_this),"subscription"===e.operationType?unsubscribe(n,e):removeNotifiers(n,e),n}.bind(void 0),_this$10=void 0,notifyall=function(n,e,i){return _newArrowCheck(this,_this$10),n.forEach(function(n){return _newArrowCheck(this,_this$10),notify(n,e,i)}.bind(this))}.bind(void 0),_this$12=void 0,refresh=function(n){return _newArrowCheck(this,_this$12),function(e){return _newArrowCheck(this,_this$12),replace(findIndex(e,"request",n.request),[n],e)}.bind(this)}.bind(void 0),_this$11=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$11),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,e,i){var r=i.subscriptionId;_newArrowCheck(this,_this$11);var o=_extends({},e,{subscriptionId:r});updateNotifiers(n,refresh(o)),notifyStart(o)}.bind(void 0),abortRequest=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError$1=function(n,e,i){return _newArrowCheck(this,_this$11),abortRequest(n,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(n,e,i){_newArrowCheck(this,_this$11),i.errors?onError$1(n,e,errorsToString(i.errors)):onSubscriptionSucceed(n,e,i)}.bind(void 0),onQueryOrMutationResponse=function(n,e,i){_newArrowCheck(this,_this$11),updateNotifiers(n,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout$1=function(n,e){return _newArrowCheck(this,_this$11),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError$1,onTimeout:onTimeout$1,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var e=n.operation,i=n.variables;return _newArrowCheck(this,_this$11),i?{query:e,variables:i}:{query:e}}.bind(void 0),send=function(n,e,i){return _newArrowCheck(this,_this$11),handlePush(n.channel.push("doc",requestToDoc(e)),createPushHandler(i,n,e))}.bind(void 0),pushRequest=function(n,e){_newArrowCheck(this,_this$11),"subscription"===e.operationType?send(n,e.request,subcriptionHandler):(notifyStart(e),send(n,e.request,queryOrMutationHandler))}.bind(void 0),_this$9=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$9),{onError:function(e){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$9),n.notifiers.forEach(function(e){return _newArrowCheck(this,_this$9),pushRequest(n,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$9),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$9),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this$8=void 0,createConnectionCloseError=function(){return _newArrowCheck(this,_this$8),new Error("connection: close")}.bind(void 0),mutationOnConnectionClose=function(n,e){_newArrowCheck(this,_this$8),updateNotifiers(n,remove$1(e)),notify(e,"Abort",createConnectionCloseError())}.bind(void 0),notifierOnConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"mutation"===e.operationType?mutationOnConnectionClose(n,e):notify(e,"Error",createConnectionCloseError())}.bind(this)}.bind(void 0),onConnectionClose=function(n){return _newArrowCheck(this,_this$8),function(){return _newArrowCheck(this,_this$8),n.notifiers.forEach(notifierOnConnectionClose(n))}.bind(this)}.bind(void 0),onSubscriptionData=function(n,e){var i=e.payload;_newArrowCheck(this,_this$8);var r=find(n.notifiers,"subscriptionId",i.subscriptionId);r&¬ify(r,"Result",i.result)}.bind(void 0),onMessage=function(n){return _newArrowCheck(this,_this$8),function(e){_newArrowCheck(this,_this$8),"subscription:data"===e.event&&onSubscriptionData(n,e)}.bind(this)}.bind(void 0),shouldJoinChannel=function(n){return _newArrowCheck(this,_this$8),!n.channelJoinCreated&&n.notifiers.length>0}.bind(void 0),onConnectionOpen=function(n){return _newArrowCheck(this,_this$8),function(){_newArrowCheck(this,_this$8),shouldJoinChannel(n)&&joinChannel(n)}.bind(this)}.bind(void 0),absintheChannelName="__absinthe__:control",create=function(n){_newArrowCheck(this,_this$8);var e={phoenixSocket:n,channel:n.channel(absintheChannelName),channelJoinCreated:!1,notifiers:[]};return n.onOpen(onConnectionOpen(e)),n.onMessage(onMessage(e)),n.onClose(onConnectionClose(e)),e}.bind(void 0),_this$14=void 0,observe$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$14),_extends({},r,{observers:[].concat(_toConsumableArray(i),[e])})}.bind(void 0),_this$13=void 0,observe=function(n,e,i){return _newArrowCheck(this,_this$13),updateNotifiers(n,refresh(observe$2(e,i)))}.bind(void 0),_this$16=void 0,create$2=function(n){return _newArrowCheck(this,_this$16),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this$15=void 0,connectOrJoinChannel=function(n){_newArrowCheck(this,_this$15),n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),sendNew=function(n,e){_newArrowCheck(this,_this$15);var i=create$2(e);return updateNotifiers(n,append([i])),n.channelJoinCreated?pushRequest(n,i):connectOrJoinChannel(n),i}.bind(void 0),send$1=function(n,e){return _newArrowCheck(this,_this$15),find(n.notifiers,"request",e)||sendNew(n,e)}.bind(void 0),_this$17=void 0,onResult=function(n,e){return _newArrowCheck(this,_this$17),function(i){_newArrowCheck(this,_this$17),e.next(i),"subscription"!==n.operationType&&e.complete()}.bind(this)}.bind(void 0),toObservable=function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onError,o=i.onStart,t=i.unsubscribe;return _newArrowCheck(this,_this$17),new Observable(function(i){return _newArrowCheck(this,_this$17),observe(n,e,{onError:r,onStart:o,onAbort:i.error,onResult:onResult(e,i)}),t}.bind(this))}.bind(void 0),_this$19=void 0,unobserve$2=function(n,e){var i=n.observers,r=_objectWithoutProperties(n,["observers"]);return _newArrowCheck(this,_this$19),_extends({},r,{observers:remove(i.indexOf(e),1,i)})}.bind(void 0),_this$18=void 0,unobserve=function(n,e,i){return _newArrowCheck(this,_this$18),updateNotifiers(n,refresh(unobserve$2(e,i))),n}.bind(void 0);export{cancel,create,observe,send$1 as send,toObservable,unobserve}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import{remove,replace}from"@jumpn/utils-array";var _this$1=void 0,handlePush=function(r,n){return _newArrowCheck(this,_this$1),r.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$3=void 0,getNotifier=function(r,n){return _newArrowCheck(this,_this$3),function(i){return _newArrowCheck(this,_this$3),i[r]&&i[r](n)}.bind(this)}.bind(void 0),getHandlerName=function(r){return _newArrowCheck(this,_this$3),"on"+String(r)}.bind(void 0),notify=function(r,n,i){return _newArrowCheck(this,_this$3),r.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$2=void 0,notifyall=function(r,n,i){return _newArrowCheck(this,_this$2),r.forEach(function(r){return _newArrowCheck(this,_this$2),notify(r,n,i)}.bind(this))}.bind(void 0),_this$6=void 0,find=function(r,n,i){return _newArrowCheck(this,_this$6),r.find(hasIn([n],i))}.bind(void 0),_this$5=void 0,createEventHandler=function(r,n){return _newArrowCheck(this,_this$5),function(i){return _newArrowCheck(this,_this$5),function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];_newArrowCheck(this,_this$5);var s=find(r.notifiers,"request",n);s&&i.apply(void 0,[r,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(r,n,i){return _newArrowCheck(this,_this$5),map(createEventHandler(n,i),r)}.bind(void 0),_this$8=void 0,findIndex=function(r,n,i){return _newArrowCheck(this,_this$8),r.findIndex(hasIn([n],i))}.bind(void 0),_this$7=void 0,remove$1=function(r){return _newArrowCheck(this,_this$7),function(n){return _newArrowCheck(this,_this$7),remove(findIndex(n,"request",r.request),1,n)}.bind(this)}.bind(void 0),_this$9=void 0,refresh=function(r){return _newArrowCheck(this,_this$9),function(n){return _newArrowCheck(this,_this$9),replace(findIndex(n,"request",r.request),[r],n)}.bind(this)}.bind(void 0),_this$10=void 0,updateNotifiers=function(r,n){return _newArrowCheck(this,_this$10),r.notifiers=n(r.notifiers),r}.bind(void 0),_this$4=void 0,notifyStart=function(r){return _newArrowCheck(this,_this$4),notify(r,"Start",r)}.bind(void 0),onSubscriptionSucceed=function(r,n,i){var e=i.subscriptionId;_newArrowCheck(this,_this$4),updateNotifiers(r,refresh(_extends({},n,{subscriptionId:e}))),notifyStart(n)}.bind(void 0),abortRequest=function(r,n,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError=function(r,n,i){return _newArrowCheck(this,_this$4),abortRequest(r,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(r,n,i){_newArrowCheck(this,_this$4),i.errors?onError(r,n,errorsToString(i.errors)):onSubscriptionSucceed(r,n,i)}.bind(void 0),onQueryOrMutationResponse=function(r,n,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout=function(r,n){return _newArrowCheck(this,_this$4),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(r){var n=r.operation,i=r.variables;return _newArrowCheck(this,_this$4),i?{query:n,variables:i}:{query:n}}.bind(void 0),send=function(r,n,i){return _newArrowCheck(this,_this$4),handlePush(r.channel.push("doc",requestToDoc(n)),createPushHandler(i,r,n))}.bind(void 0),pushRequest=function(r,n){_newArrowCheck(this,_this$4),"subscription"===n.operationType?send(r,n.request,subcriptionHandler):(notifyStart(n),send(r,n.request,queryOrMutationHandler))}.bind(void 0),_this=void 0,createChannelJoinHandler=function(r){return _newArrowCheck(this,_this),{onError:function(n){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this),r.notifiers.forEach(function(n){return _newArrowCheck(this,_this),pushRequest(r,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(r){return _newArrowCheck(this,_this),handlePush(r.channel.join(),createChannelJoinHandler(r)),r.channelJoinCreated=!0,r}.bind(void 0);export default joinChannel; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import{remove,replace}from"@jumpn/utils-array";var _this$1=void 0,handlePush=function(r,n){return _newArrowCheck(this,_this$1),r.receive("ok",n.onSucceed).receive("error",n.onError).receive("timeout",n.onTimeout)}.bind(void 0),_this$3=void 0,getNotifier=function(r,n){return _newArrowCheck(this,_this$3),function(i){return _newArrowCheck(this,_this$3),i[r]&&i[r](n)}.bind(this)}.bind(void 0),getHandlerName=function(r){return _newArrowCheck(this,_this$3),"on"+String(r)}.bind(void 0),notify=function(r,n,i){return _newArrowCheck(this,_this$3),r.observers.forEach(getNotifier(getHandlerName(n),i))}.bind(void 0),_this$2=void 0,notifyall=function(r,n,i){return _newArrowCheck(this,_this$2),r.forEach(function(r){return _newArrowCheck(this,_this$2),notify(r,n,i)}.bind(this))}.bind(void 0),_this$6=void 0,find=function(r,n,i){return _newArrowCheck(this,_this$6),r.find(hasIn([n],i))}.bind(void 0),_this$5=void 0,createEventHandler=function(r,n){return _newArrowCheck(this,_this$5),function(i){return _newArrowCheck(this,_this$5),function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];_newArrowCheck(this,_this$5);var s=find(r.notifiers,"request",n);s&&i.apply(void 0,[r,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(r,n,i){return _newArrowCheck(this,_this$5),map(createEventHandler(n,i),r)}.bind(void 0),_this$8=void 0,findIndex=function(r,n,i){return _newArrowCheck(this,_this$8),r.findIndex(hasIn([n],i))}.bind(void 0),_this$7=void 0,remove$1=function(r){return _newArrowCheck(this,_this$7),function(n){return _newArrowCheck(this,_this$7),remove(findIndex(n,"request",r.request),1,n)}.bind(this)}.bind(void 0),_this$9=void 0,refresh=function(r){return _newArrowCheck(this,_this$9),function(n){return _newArrowCheck(this,_this$9),replace(findIndex(n,"request",r.request),[r],n)}.bind(this)}.bind(void 0),_this$10=void 0,updateNotifiers=function(r,n){return _newArrowCheck(this,_this$10),r.notifiers=n(r.notifiers),r}.bind(void 0),_this$4=void 0,notifyStart=function(r){return _newArrowCheck(this,_this$4),notify(r,"Start",r)}.bind(void 0),onSubscriptionSucceed=function(r,n,i){var e=i.subscriptionId;_newArrowCheck(this,_this$4);var t=_extends({},n,{subscriptionId:e});updateNotifiers(r,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(r,n,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(n)),notify(n,"Abort",i)}.bind(void 0),onError=function(r,n,i){return _newArrowCheck(this,_this$4),abortRequest(r,n,new Error(i))}.bind(void 0),onSubscriptionResponse=function(r,n,i){_newArrowCheck(this,_this$4),i.errors?onError(r,n,errorsToString(i.errors)):onSubscriptionSucceed(r,n,i)}.bind(void 0),onQueryOrMutationResponse=function(r,n,i){_newArrowCheck(this,_this$4),updateNotifiers(r,remove$1(n)),notify(n,"Result",i)}.bind(void 0),onTimeout=function(r,n){return _newArrowCheck(this,_this$4),notify(n,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(r){var n=r.operation,i=r.variables;return _newArrowCheck(this,_this$4),i?{query:n,variables:i}:{query:n}}.bind(void 0),send=function(r,n,i){return _newArrowCheck(this,_this$4),handlePush(r.channel.push("doc",requestToDoc(n)),createPushHandler(i,r,n))}.bind(void 0),pushRequest=function(r,n){_newArrowCheck(this,_this$4),"subscription"===n.operationType?send(r,n.request,subcriptionHandler):(notifyStart(n),send(r,n.request,queryOrMutationHandler))}.bind(void 0),_this=void 0,createChannelJoinHandler=function(r){return _newArrowCheck(this,_this),{onError:function(n){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: "+String(n)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this),r.notifiers.forEach(function(n){return _newArrowCheck(this,_this),pushRequest(r,n)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this),notifyall(r.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(r){return _newArrowCheck(this,_this),handlePush(r.channel.join(),createChannelJoinHandler(r)),r.channelJoinCreated=!0,r}.bind(void 0);export default joinChannel; | ||
//# sourceMappingURL=joinChannel.js.map |
@@ -1,2 +0,2 @@ | ||
import _extends from"babel-runtime/helpers/extends";import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{remove,replace}from"@jumpn/utils-array";var _this$2=void 0,find=function(r,e,i){return _newArrowCheck(this,_this$2),r.find(hasIn([e],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(r,e){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var n=arguments.length,t=Array(n),o=0;o<n;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(r.notifiers,"request",e);s&&i.apply(void 0,[r,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(r,e,i){return _newArrowCheck(this,_this$1),map(createEventHandler(e,i),r)}.bind(void 0),_this$3=void 0,handlePush=function(r,e){return _newArrowCheck(this,_this$3),r.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(r,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[r]&&i[r](e)}.bind(this)}.bind(void 0),getHandlerName=function(r){return _newArrowCheck(this,_this$4),"on"+String(r)}.bind(void 0),notify=function(r,e,i){return _newArrowCheck(this,_this$4),r.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$6=void 0,findIndex=function(r,e,i){return _newArrowCheck(this,_this$6),r.findIndex(hasIn([e],i))}.bind(void 0),_this$5=void 0,remove$1=function(r){return _newArrowCheck(this,_this$5),function(e){return _newArrowCheck(this,_this$5),remove(findIndex(e,"request",r.request),1,e)}.bind(this)}.bind(void 0),_this$7=void 0,refresh=function(r){return _newArrowCheck(this,_this$7),function(e){return _newArrowCheck(this,_this$7),replace(findIndex(e,"request",r.request),[r],e)}.bind(this)}.bind(void 0),_this$8=void 0,updateNotifiers=function(r,e){return _newArrowCheck(this,_this$8),r.notifiers=e(r.notifiers),r}.bind(void 0),_this=void 0,notifyStart=function(r){return _newArrowCheck(this,_this),notify(r,"Start",r)}.bind(void 0),onSubscriptionSucceed=function(r,e,i){var n=i.subscriptionId;_newArrowCheck(this,_this),updateNotifiers(r,refresh(_extends({},e,{subscriptionId:n}))),notifyStart(e)}.bind(void 0),abortRequest=function(r,e,i){_newArrowCheck(this,_this),updateNotifiers(r,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError=function(r,e,i){return _newArrowCheck(this,_this),abortRequest(r,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(r,e,i){_newArrowCheck(this,_this),i.errors?onError(r,e,errorsToString(i.errors)):onSubscriptionSucceed(r,e,i)}.bind(void 0),onQueryOrMutationResponse=function(r,e,i){_newArrowCheck(this,_this),updateNotifiers(r,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout=function(r,e){return _newArrowCheck(this,_this),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(r){var e=r.operation,i=r.variables;return _newArrowCheck(this,_this),i?{query:e,variables:i}:{query:e}}.bind(void 0),send=function(r,e,i){return _newArrowCheck(this,_this),handlePush(r.channel.push("doc",requestToDoc(e)),createPushHandler(i,r,e))}.bind(void 0),pushRequest=function(r,e){_newArrowCheck(this,_this),"subscription"===e.operationType?send(r,e.request,subcriptionHandler):(notifyStart(e),send(r,e.request,queryOrMutationHandler))}.bind(void 0);export default pushRequest; | ||
import _extends from"babel-runtime/helpers/extends";import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{errorsToString}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";import"phoenix";import{remove,replace}from"@jumpn/utils-array";var _this$2=void 0,find=function(r,e,i){return _newArrowCheck(this,_this$2),r.find(hasIn([e],i))}.bind(void 0),_this$1=void 0,createEventHandler=function(r,e){return _newArrowCheck(this,_this$1),function(i){return _newArrowCheck(this,_this$1),function(){for(var n=arguments.length,t=Array(n),o=0;o<n;o++)t[o]=arguments[o];_newArrowCheck(this,_this$1);var s=find(r.notifiers,"request",e);s&&i.apply(void 0,[r,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(r,e,i){return _newArrowCheck(this,_this$1),map(createEventHandler(e,i),r)}.bind(void 0),_this$3=void 0,handlePush=function(r,e){return _newArrowCheck(this,_this$3),r.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(r,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[r]&&i[r](e)}.bind(this)}.bind(void 0),getHandlerName=function(r){return _newArrowCheck(this,_this$4),"on"+String(r)}.bind(void 0),notify=function(r,e,i){return _newArrowCheck(this,_this$4),r.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$6=void 0,findIndex=function(r,e,i){return _newArrowCheck(this,_this$6),r.findIndex(hasIn([e],i))}.bind(void 0),_this$5=void 0,remove$1=function(r){return _newArrowCheck(this,_this$5),function(e){return _newArrowCheck(this,_this$5),remove(findIndex(e,"request",r.request),1,e)}.bind(this)}.bind(void 0),_this$7=void 0,refresh=function(r){return _newArrowCheck(this,_this$7),function(e){return _newArrowCheck(this,_this$7),replace(findIndex(e,"request",r.request),[r],e)}.bind(this)}.bind(void 0),_this$8=void 0,updateNotifiers=function(r,e){return _newArrowCheck(this,_this$8),r.notifiers=e(r.notifiers),r}.bind(void 0),_this=void 0,notifyStart=function(r){return _newArrowCheck(this,_this),notify(r,"Start",r)}.bind(void 0),onSubscriptionSucceed=function(r,e,i){var n=i.subscriptionId;_newArrowCheck(this,_this);var t=_extends({},e,{subscriptionId:n});updateNotifiers(r,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(r,e,i){_newArrowCheck(this,_this),updateNotifiers(r,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError=function(r,e,i){return _newArrowCheck(this,_this),abortRequest(r,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(r,e,i){_newArrowCheck(this,_this),i.errors?onError(r,e,errorsToString(i.errors)):onSubscriptionSucceed(r,e,i)}.bind(void 0),onQueryOrMutationResponse=function(r,e,i){_newArrowCheck(this,_this),updateNotifiers(r,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout=function(r,e){return _newArrowCheck(this,_this),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(r){var e=r.operation,i=r.variables;return _newArrowCheck(this,_this),i?{query:e,variables:i}:{query:e}}.bind(void 0),send=function(r,e,i){return _newArrowCheck(this,_this),handlePush(r.channel.push("doc",requestToDoc(e)),createPushHandler(i,r,e))}.bind(void 0),pushRequest=function(r,e){_newArrowCheck(this,_this),"subscription"===e.operationType?send(r,e.request,subcriptionHandler):(notifyStart(e),send(r,e.request,queryOrMutationHandler))}.bind(void 0);export default pushRequest; | ||
//# sourceMappingURL=pushRequest.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{append,remove,replace}from"@jumpn/utils-array";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";var _this$2=void 0,handlePush=function(n,e){return _newArrowCheck(this,_this$2),n.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[n]&&i[n](e)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,e,i){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$3=void 0,notifyall=function(n,e,i){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,e,i)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,e,i){return _newArrowCheck(this,_this$7),n.find(hasIn([e],i))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,e){return _newArrowCheck(this,_this$6),function(i){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",e);s&&i.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,e,i){return _newArrowCheck(this,_this$6),map(createEventHandler(e,i),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,e,i){return _newArrowCheck(this,_this$9),n.findIndex(hasIn([e],i))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(e){return _newArrowCheck(this,_this$8),remove(findIndex(e,"request",n.request),1,e)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(e){return _newArrowCheck(this,_this$10),replace(findIndex(e,"request",n.request),[n],e)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,e){return _newArrowCheck(this,_this$11),n.notifiers=e(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,e,i){var r=i.subscriptionId;_newArrowCheck(this,_this$5),updateNotifiers(n,refresh(_extends({},e,{subscriptionId:r}))),notifyStart(e)}.bind(void 0),abortRequest=function(n,e,i){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError=function(n,e,i){return _newArrowCheck(this,_this$5),abortRequest(n,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(n,e,i){_newArrowCheck(this,_this$5),i.errors?onError(n,e,errorsToString(i.errors)):onSubscriptionSucceed(n,e,i)}.bind(void 0),onQueryOrMutationResponse=function(n,e,i){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout=function(n,e){return _newArrowCheck(this,_this$5),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var e=n.operation,i=n.variables;return _newArrowCheck(this,_this$5),i?{query:e,variables:i}:{query:e}}.bind(void 0),send$2=function(n,e,i){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(e)),createPushHandler(i,n,e))}.bind(void 0),pushRequest=function(n,e){_newArrowCheck(this,_this$5),"subscription"===e.operationType?send$2(n,e.request,subcriptionHandler):(notifyStart(e),send$2(n,e.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(e){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(e){return _newArrowCheck(this,_this$1),pushRequest(n,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this$12=void 0,create=function(n){return _newArrowCheck(this,_this$12),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this=void 0,connectOrJoinChannel=function(n){_newArrowCheck(this,_this),n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),sendNew=function(n,e){_newArrowCheck(this,_this);var i=create(e);return updateNotifiers(n,append([i])),n.channelJoinCreated?pushRequest(n,i):connectOrJoinChannel(n),i}.bind(void 0),send=function(n,e){return _newArrowCheck(this,_this),find(n.notifiers,"request",e)||sendNew(n,e)}.bind(void 0);export default send; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{append,remove,replace}from"@jumpn/utils-array";import"phoenix";import _extends from"babel-runtime/helpers/extends";import{errorsToString,getOperationType}from"@jumpn/utils-graphql";import{hasIn,map}from"@jumpn/utils-composite";var _this$2=void 0,handlePush=function(n,e){return _newArrowCheck(this,_this$2),n.receive("ok",e.onSucceed).receive("error",e.onError).receive("timeout",e.onTimeout)}.bind(void 0),_this$4=void 0,getNotifier=function(n,e){return _newArrowCheck(this,_this$4),function(i){return _newArrowCheck(this,_this$4),i[n]&&i[n](e)}.bind(this)}.bind(void 0),getHandlerName=function(n){return _newArrowCheck(this,_this$4),"on"+String(n)}.bind(void 0),notify=function(n,e,i){return _newArrowCheck(this,_this$4),n.observers.forEach(getNotifier(getHandlerName(e),i))}.bind(void 0),_this$3=void 0,notifyall=function(n,e,i){return _newArrowCheck(this,_this$3),n.forEach(function(n){return _newArrowCheck(this,_this$3),notify(n,e,i)}.bind(this))}.bind(void 0),_this$7=void 0,find=function(n,e,i){return _newArrowCheck(this,_this$7),n.find(hasIn([e],i))}.bind(void 0),_this$6=void 0,createEventHandler=function(n,e){return _newArrowCheck(this,_this$6),function(i){return _newArrowCheck(this,_this$6),function(){for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];_newArrowCheck(this,_this$6);var s=find(n.notifiers,"request",e);s&&i.apply(void 0,[n,s].concat(t))}.bind(this)}.bind(this)}.bind(void 0),createPushHandler=function(n,e,i){return _newArrowCheck(this,_this$6),map(createEventHandler(e,i),n)}.bind(void 0),_this$9=void 0,findIndex=function(n,e,i){return _newArrowCheck(this,_this$9),n.findIndex(hasIn([e],i))}.bind(void 0),_this$8=void 0,remove$1=function(n){return _newArrowCheck(this,_this$8),function(e){return _newArrowCheck(this,_this$8),remove(findIndex(e,"request",n.request),1,e)}.bind(this)}.bind(void 0),_this$10=void 0,refresh=function(n){return _newArrowCheck(this,_this$10),function(e){return _newArrowCheck(this,_this$10),replace(findIndex(e,"request",n.request),[n],e)}.bind(this)}.bind(void 0),_this$11=void 0,updateNotifiers=function(n,e){return _newArrowCheck(this,_this$11),n.notifiers=e(n.notifiers),n}.bind(void 0),_this$5=void 0,notifyStart=function(n){return _newArrowCheck(this,_this$5),notify(n,"Start",n)}.bind(void 0),onSubscriptionSucceed=function(n,e,i){var r=i.subscriptionId;_newArrowCheck(this,_this$5);var t=_extends({},e,{subscriptionId:r});updateNotifiers(n,refresh(t)),notifyStart(t)}.bind(void 0),abortRequest=function(n,e,i){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(e)),notify(e,"Abort",i)}.bind(void 0),onError=function(n,e,i){return _newArrowCheck(this,_this$5),abortRequest(n,e,new Error(i))}.bind(void 0),onSubscriptionResponse=function(n,e,i){_newArrowCheck(this,_this$5),i.errors?onError(n,e,errorsToString(i.errors)):onSubscriptionSucceed(n,e,i)}.bind(void 0),onQueryOrMutationResponse=function(n,e,i){_newArrowCheck(this,_this$5),updateNotifiers(n,remove$1(e)),notify(e,"Result",i)}.bind(void 0),onTimeout=function(n,e){return _newArrowCheck(this,_this$5),notify(e,"Error",new Error("request: timeout"))}.bind(void 0),queryOrMutationHandler={onError:onError,onTimeout:onTimeout,onSucceed:onQueryOrMutationResponse},subcriptionHandler={onError:onError,onTimeout:onTimeout,onSucceed:onSubscriptionResponse},requestToDoc=function(n){var e=n.operation,i=n.variables;return _newArrowCheck(this,_this$5),i?{query:e,variables:i}:{query:e}}.bind(void 0),send$2=function(n,e,i){return _newArrowCheck(this,_this$5),handlePush(n.channel.push("doc",requestToDoc(e)),createPushHandler(i,n,e))}.bind(void 0),pushRequest=function(n,e){_newArrowCheck(this,_this$5),"subscription"===e.operationType?send$2(n,e.request,subcriptionHandler):(notifyStart(e),send$2(n,e.request,queryOrMutationHandler))}.bind(void 0),_this$1=void 0,createChannelJoinHandler=function(n){return _newArrowCheck(this,_this$1),{onError:function(e){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: "+String(e)))}.bind(this),onSucceed:function(){return _newArrowCheck(this,_this$1),n.notifiers.forEach(function(e){return _newArrowCheck(this,_this$1),pushRequest(n,e)}.bind(this))}.bind(this),onTimeout:function(){return _newArrowCheck(this,_this$1),notifyall(n.notifiers,"Error",new Error("channel join: timeout"))}.bind(this)}}.bind(void 0),joinChannel=function(n){return _newArrowCheck(this,_this$1),handlePush(n.channel.join(),createChannelJoinHandler(n)),n.channelJoinCreated=!0,n}.bind(void 0),_this$12=void 0,create=function(n){return _newArrowCheck(this,_this$12),{request:n,observers:[],operationType:getOperationType(n.operation),subscriptionId:void 0}}.bind(void 0),_this=void 0,connectOrJoinChannel=function(n){_newArrowCheck(this,_this),n.phoenixSocket.isConnected()?joinChannel(n):n.phoenixSocket.connect()}.bind(void 0),sendNew=function(n,e){_newArrowCheck(this,_this);var i=create(e);return updateNotifiers(n,append([i])),n.channelJoinCreated?pushRequest(n,i):connectOrJoinChannel(n),i}.bind(void 0),send=function(n,e){return _newArrowCheck(this,_this),find(n.notifiers,"request",e)||sendNew(n,e)}.bind(void 0);export default send; | ||
//# sourceMappingURL=send.js.map |
{ | ||
"name": "@absinthe/socket", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Absinthe Socket", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
@@ -79,7 +79,7 @@ # @absinthe/socket | ||
type Observer<Result> = { | ||
onAbort: (error: Error) => any, | ||
onCancel: (error: Error) => any, | ||
onError: (error: Error) => any, | ||
onStart: () => any, | ||
onResult: (result: Result) => any | ||
onAbort?: (error: Error) => any, | ||
onCancel?: () => any, | ||
onError?: (error: Error) => any, | ||
onStart?: (notifier: Notifier<Result>) => any, | ||
onResult?: (result: Result) => any | ||
}; | ||
@@ -86,0 +86,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
355964
965