@absinthe/socket
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -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),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; | ||
//# 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")),Observable=_interopDefault(require("zen-observable")),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),utilsArray=require("@jumpn/utils-array"),utilsComposite=require("@jumpn/utils-composite"),_this$2=void 0,observe$2=function(e,r){var t=e.observers,i=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$2),_extends({},i,{observers:[].concat(_toConsumableArray(t),[r])})}.bind(void 0),_this$4=void 0,findIndex=function(e,r,t){return _newArrowCheck(this,_this$4),e.findIndex(utilsComposite.hasIn([r],t))}.bind(void 0),_this$3=void 0,refresh=function(e){return _newArrowCheck(this,_this$3),function(r){return _newArrowCheck(this,_this$3),utilsArray.replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$5=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$5),e.notifiers=r(e.notifiers),e}.bind(void 0),_this$1=void 0,observe=function(e,r,t){return _newArrowCheck(this,_this$1),updateNotifiers(e,refresh(observe$2(r,t)))}.bind(void 0),_this=void 0,onResult=function(e,r){return _newArrowCheck(this,_this),function(t){_newArrowCheck(this,_this),r.next(t),"subscription"!==e.operationType&&r.complete()}.bind(this)}.bind(void 0),toObservable=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.onError,o=t.onStart,n=t.unsubscribe;return _newArrowCheck(this,_this),new Observable(function(t){return _newArrowCheck(this,_this),observe(e,r,{onError:i,onStart:o,onAbort:t.error,onresult:onResult(r,t)}),n}.bind(this))}.bind(void 0);module.exports=toObservable; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _newArrowCheck=_interopDefault(require("babel-runtime/helpers/newArrowCheck")),Observable=_interopDefault(require("zen-observable")),_toConsumableArray=_interopDefault(require("babel-runtime/helpers/toConsumableArray")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),utilsArray=require("@jumpn/utils-array"),utilsComposite=require("@jumpn/utils-composite"),_this$2=void 0,observe$2=function(e,r){var t=e.observers,i=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$2),_extends({},i,{observers:[].concat(_toConsumableArray(t),[r])})}.bind(void 0),_this$4=void 0,findIndex=function(e,r,t){return _newArrowCheck(this,_this$4),e.findIndex(utilsComposite.hasIn([r],t))}.bind(void 0),_this$3=void 0,refresh=function(e){return _newArrowCheck(this,_this$3),function(r){return _newArrowCheck(this,_this$3),utilsArray.replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$5=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$5),e.notifiers=r(e.notifiers),e}.bind(void 0),_this$1=void 0,observe=function(e,r,t){return _newArrowCheck(this,_this$1),updateNotifiers(e,refresh(observe$2(r,t)))}.bind(void 0),_this=void 0,onResult=function(e,r){return _newArrowCheck(this,_this),function(t){_newArrowCheck(this,_this),r.next(t),"subscription"!==e.operationType&&r.complete()}.bind(this)}.bind(void 0),toObservable=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.onError,o=t.onStart,n=t.unsubscribe;return _newArrowCheck(this,_this),new Observable(function(t){return _newArrowCheck(this,_this),observe(e,r,{onError:i,onStart:o,onAbort:t.error,onResult:onResult(r,t)}),n}.bind(this))}.bind(void 0);module.exports=toObservable; | ||
//# sourceMappingURL=toObservable.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),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}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import Observable from"zen-observable";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _extends from"babel-runtime/helpers/extends";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import{replace}from"@jumpn/utils-array";import{hasIn}from"@jumpn/utils-composite";var _this$2=void 0,observe$2=function(e,r){var t=e.observers,o=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$2),_extends({},o,{observers:[].concat(_toConsumableArray(t),[r])})}.bind(void 0),_this$4=void 0,findIndex=function(e,r,t){return _newArrowCheck(this,_this$4),e.findIndex(hasIn([r],t))}.bind(void 0),_this$3=void 0,refresh=function(e){return _newArrowCheck(this,_this$3),function(r){return _newArrowCheck(this,_this$3),replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$5=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$5),e.notifiers=r(e.notifiers),e}.bind(void 0),_this$1=void 0,observe=function(e,r,t){return _newArrowCheck(this,_this$1),updateNotifiers(e,refresh(observe$2(r,t)))}.bind(void 0),_this=void 0,onResult=function(e,r){return _newArrowCheck(this,_this),function(t){_newArrowCheck(this,_this),r.next(t),"subscription"!==e.operationType&&r.complete()}.bind(this)}.bind(void 0),toObservable=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.onError,i=t.onStart,n=t.unsubscribe;return _newArrowCheck(this,_this),new Observable(function(t){return _newArrowCheck(this,_this),observe(e,r,{onError:o,onStart:i,onAbort:t.error,onresult:onResult(r,t)}),n}.bind(this))}.bind(void 0);export default toObservable; | ||
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import Observable from"zen-observable";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import _extends from"babel-runtime/helpers/extends";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import{replace}from"@jumpn/utils-array";import{hasIn}from"@jumpn/utils-composite";var _this$2=void 0,observe$2=function(e,r){var t=e.observers,o=_objectWithoutProperties(e,["observers"]);return _newArrowCheck(this,_this$2),_extends({},o,{observers:[].concat(_toConsumableArray(t),[r])})}.bind(void 0),_this$4=void 0,findIndex=function(e,r,t){return _newArrowCheck(this,_this$4),e.findIndex(hasIn([r],t))}.bind(void 0),_this$3=void 0,refresh=function(e){return _newArrowCheck(this,_this$3),function(r){return _newArrowCheck(this,_this$3),replace(findIndex(r,"request",e.request),[e],r)}.bind(this)}.bind(void 0),_this$5=void 0,updateNotifiers=function(e,r){return _newArrowCheck(this,_this$5),e.notifiers=r(e.notifiers),e}.bind(void 0),_this$1=void 0,observe=function(e,r,t){return _newArrowCheck(this,_this$1),updateNotifiers(e,refresh(observe$2(r,t)))}.bind(void 0),_this=void 0,onResult=function(e,r){return _newArrowCheck(this,_this),function(t){_newArrowCheck(this,_this),r.next(t),"subscription"!==e.operationType&&r.complete()}.bind(this)}.bind(void 0),toObservable=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.onError,i=t.onStart,n=t.unsubscribe;return _newArrowCheck(this,_this),new Observable(function(t){return _newArrowCheck(this,_this),observe(e,r,{onError:o,onStart:i,onAbort:t.error,onResult:onResult(r,t)}),n}.bind(this))}.bind(void 0);export default toObservable; | ||
//# sourceMappingURL=toObservable.js.map |
{ | ||
"name": "@absinthe/socket", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Absinthe Socket", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
@@ -26,8 +26,7 @@ // @flow | ||
const onSubscriptionSucceed = (absintheSocket, notifier, {subscriptionId}) => { | ||
updateNotifiers( | ||
absintheSocket, | ||
notifierRefresh({...notifier, subscriptionId}) | ||
); | ||
const updatedNotifier = {...notifier, subscriptionId}; | ||
notifyStart(notifier); | ||
updateNotifiers(absintheSocket, notifierRefresh(updatedNotifier)); | ||
notifyStart(updatedNotifier); | ||
}; | ||
@@ -34,0 +33,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
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
355093
964