@quiltt/core 3.3.8 → 3.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- var N=Object.defineProperty;var L=(i,t,e)=>t in i?N(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var o=(i,t,e)=>(L(i,typeof t!="symbol"?t+"":t,e),e);var u={logger:typeof globalThis!="undefined"?globalThis.console:void 0,WebSocket:typeof globalThis!="undefined"?globalThis.WebSocket:void 0};(()=>{try{return process.env.QUILTT_API_INSECURE}catch(i){return}})();(()=>{try{return process.env.QUILTT_API_DOMAIN}catch(i){return}})();var G=(()=>{try{return !!process.env.QUILTT_DEBUG||process.env.NODE_ENV!=="production"}catch(i){return !1}})(),P=G;var m=class{constructor(){o(this,"enabled",P);}log(...t){u.logger&&this.enabled&&(t.push(Date.now().toString()),u.logger.log("[ActionCable]",...t));}},q=new m,n=q;var p=()=>new Date().getTime(),d=i=>(p()-i)/1e3,a=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0;}start(){this.isRunning()||(this.startedAt=p(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),n.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`));}stop(){this.isRunning()&&(this.stoppedAt=p(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),n.log("ConnectionMonitor stopped"));}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=p();}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,n.log("ConnectionMonitor recorded connect");}recordDisconnect(){this.disconnectedAt=p(),n.log("ConnectionMonitor recorded disconnect");}startPolling(){this.stopPolling(),this.poll();}stopPolling(){clearTimeout(this.pollTimeout);}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll();},this.getPollInterval());}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),c=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+c)}reconnectIfStale(){this.connectionIsStale()&&(n.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${d(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?n.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${d(this.disconnectedAt)} s`):(n.log("ConnectionMonitor reopening"),this.connection.reopen()));}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return d(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&d(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(n.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen());},200);}};a.staleThreshold=6;a.reconnectionBackoffRate=.15;var b=a;var U={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},g=U;var{message_types:l,protocols:S}=g,Q=S.slice(0,S.length-1),E=[].indexOf,h=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new b(this),this.disconnected=!0;}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return n.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...S,...this.consumer.subprotocols||[]];return n.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new u.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(n.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){n.log("Failed to reopen WebSocket",t);}finally{n.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay);}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return E.call(Q,this.getProtocol())>=0}isState(...t){return E.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in u.WebSocket)if(u.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e;}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){};}};h.reopenDelay=500;h.prototype.events={message(i){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:s,reconnect:r,type:c}=JSON.parse(i.data);switch(c){case l.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case l.disconnect:return n.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:r});case l.ping:return this.monitor.recordPing();case l.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case l.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(n.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return n.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(i){if(n.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){n.log("WebSocket onerror event");}};var y=h;var H=function(i,t){if(t!==null)for(let e in t){let s=t[e];i[e]=s;}return i},A=class{constructor(t,e={},s){o(this,"consumer");o(this,"identifier");this.consumer=t,this.identifier=JSON.stringify(e),H(this,s);}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},v=A;var x=class{constructor(t){o(this,"subscriptions");o(this,"pendingSubscriptions");o(this,"retryTimeout");this.subscriptions=t,this.pendingSubscriptions=[];}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(n.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):n.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing();}forget(t){n.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t);}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing();}stopGuaranteeing(){clearTimeout(this.retryTimeout);}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{n.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t);});},500);}},T=x;var k=class{constructor(t){o(this,"consumer");o(this,"guarantor");o(this,"subscriptions");this.consumer=t,this.guarantor=new T(this),this.subscriptions=[];}create(t,e){let s=t,r=typeof s=="object"?s:{channel:s},c=new v(this.consumer,r,e);return this.add(c)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(s=>this.notify(s,t,...e))}notify(t,e,...s){let r;return typeof t=="string"?r=this.findAll(t):r=[t],r.map(c=>typeof c[e]=="function"?c[e](...s):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t);}confirmSubscription(t){n.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e));}sendCommand(t,e){let{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}},C=k;var w=class{constructor(t){o(this,"_url");o(this,"subscriptions");o(this,"connection");o(this,"subprotocols");this._url=t,this.subscriptions=new C(this),this.connection=new y(this),this.subprotocols=[];}get url(){return j(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t];}};function j(i){if(typeof i=="function"&&(i=i()),i&&!/^wss?:/i.test(i)){let t=document.createElement("a");return t.href=i,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return i}var M=w;function Nt(i=J("url")||g.default_mount_path){return new M(i)}function J(i){let t=document.head.querySelector(`meta[name='action-cable-${i}']`);if(t)return t.getAttribute("content")}
1
+ var N=Object.defineProperty;var L=(i,t,e)=>t in i?N(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var o=(i,t,e)=>(L(i,typeof t!="symbol"?t+"":t,e),e);var u={logger:typeof globalThis!="undefined"?globalThis.console:void 0,WebSocket:typeof globalThis!="undefined"?globalThis.WebSocket:void 0};(()=>{try{return process.env.QUILTT_API_INSECURE}catch(i){return}})();(()=>{try{return process.env.QUILTT_API_DOMAIN}catch(i){return}})();var G=(()=>{try{return !!process.env.QUILTT_DEBUG||process.env.NODE_ENV!=="production"}catch(i){return !1}})(),P=G;var b=class{constructor(){o(this,"enabled",P);}log(...t){u.logger&&this.enabled&&(t.push(Date.now().toString()),u.logger.log("[ActionCable]",...t));}},q=new b,n=q;var p=()=>new Date().getTime(),g=i=>(p()-i)/1e3,a=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0;}start(){this.isRunning()||(this.startedAt=p(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),n.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`));}stop(){this.isRunning()&&(this.stoppedAt=p(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),n.log("ConnectionMonitor stopped"));}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=p();}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,n.log("ConnectionMonitor recorded connect");}recordDisconnect(){this.disconnectedAt=p(),n.log("ConnectionMonitor recorded disconnect");}startPolling(){this.stopPolling(),this.poll();}stopPolling(){clearTimeout(this.pollTimeout);}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll();},this.getPollInterval());}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),c=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+c)}reconnectIfStale(){this.connectionIsStale()&&(n.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${g(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?n.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${g(this.disconnectedAt)} s`):(n.log("ConnectionMonitor reopening"),this.connection.reopen()));}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return g(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&g(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(n.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen());},200);}};a.staleThreshold=6;a.reconnectionBackoffRate=.15;var S=a;var U={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},f=U;var{message_types:l,protocols:y}=f,Q=y.slice(0,y.length-1),E=[].indexOf,h=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new S(this),this.disconnected=!0;}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return n.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...y,...this.consumer.subprotocols||[]];return n.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new u.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(n.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){n.log("Failed to reopen WebSocket",t);}finally{n.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay);}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return E.call(Q,this.getProtocol())>=0}isState(...t){return E.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in u.WebSocket)if(u.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e;}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){};}};h.reopenDelay=500;h.prototype.events={message(i){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:s,reconnect:r,type:c}=JSON.parse(i.data);switch(c){case l.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case l.disconnect:return n.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:r});case l.ping:return this.monitor.recordPing();case l.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case l.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(n.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return n.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(i){if(n.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){n.log("WebSocket onerror event");}};var A=h;var H=function(i,t){if(t!==null)for(let e in t){let s=t[e];i[e]=s;}return i},v=class{constructor(t,e={},s){o(this,"consumer");o(this,"identifier");this.consumer=t,this.identifier=JSON.stringify(e),H(this,s);}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},x=v;var T=class{constructor(t){o(this,"subscriptions");o(this,"pendingSubscriptions");o(this,"retryTimeout");this.subscriptions=t,this.pendingSubscriptions=[];}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(n.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):n.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing();}forget(t){n.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t);}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing();}stopGuaranteeing(){clearTimeout(this.retryTimeout);}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{n.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t);});},500);}},k=T;var w=class{constructor(t){o(this,"consumer");o(this,"guarantor");o(this,"subscriptions");this.consumer=t,this.guarantor=new k(this),this.subscriptions=[];}create(t,e){let s=t,r=typeof s=="object"?s:{channel:s},c=new x(this.consumer,r,e);return this.add(c)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(s=>this.notify(s,t,...e))}notify(t,e,...s){let r;return typeof t=="string"?r=this.findAll(t):r=[t],r.map(c=>typeof c[e]=="function"?c[e](...s):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t);}confirmSubscription(t){n.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e));}sendCommand(t,e){let{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}},C=w;var $=class{constructor(t){o(this,"_url");o(this,"subscriptions");o(this,"connection");o(this,"subprotocols");this._url=t,this.subscriptions=new C(this),this.connection=new A(this),this.subprotocols=[];}get url(){return j(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t];}};function j(i){if(typeof i=="function"&&(i=i()),i&&!/^wss?:/i.test(i)){let t=document.createElement("a");return t.href=i,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return i}var M=$;function Lt(i=B("url")||f.default_mount_path){return new M(i)}function B(i){let t=document.head.querySelector(`meta[name='action-cable-${i}']`);if(t)return t.getAttribute("content")}
2
2
 
3
- export { y as Connection, b as ConnectionMonitor, M as Consumer, g as INTERNAL, v as Subscription, T as SubscriptionGuarantor, C as Subscriptions, u as adapters, Nt as createConsumer, j as createWebSocketURL, J as getConfig, n as logger };
3
+ export { A as Connection, S as ConnectionMonitor, M as Consumer, f as INTERNAL, x as Subscription, k as SubscriptionGuarantor, C as Subscriptions, u as adapters, Lt as createConsumer, j as createWebSocketURL, B as getConfig, n as logger };
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/api/graphql/links/actioncable/adapters.ts","../../../../../package.json","../../../../../src/configuration.ts","../../../../../src/api/graphql/links/actioncable/logger.ts","../../../../../src/api/graphql/links/actioncable/connection_monitor.ts","../../../../../src/api/graphql/links/actioncable/internal.ts","../../../../../src/api/graphql/links/actioncable/connection.ts","../../../../../src/api/graphql/links/actioncable/subscription.ts","../../../../../src/api/graphql/links/actioncable/subscription_guarantor.ts","../../../../../src/api/graphql/links/actioncable/subscriptions.ts","../../../../../src/api/graphql/links/actioncable/consumer.ts","../../../../../src/api/graphql/links/actioncable/index.ts"],"names":["adapters_default","name","version","QUILTT_API_INSECURE","e","QUILTT_API_DOMAIN","QUILTT_DEBUG","domain","protocolHttp","protocolWebsockets","debugging","endpointAuth","endpointGraphQL","endpointWebsockets","Logger","__publicField","messages","logger","logger_default","now","secondsSince","time","ConnectionMonitor","connection","staleThreshold","reconnectionBackoffRate","backoff","jitter","connection_monitor_default","INTERNAL","internal_default","message_types","protocols","supportedProtocols","indexOf","Connection","consumer","data","socketProtocols","allowReconnect","error","states","state","eventName","handler","event","identifier","message","reason","reconnect","type","_event","connection_default","extend","object","properties","key","value","Subscription","params","mixin","action","subscription_default","SubscriptionGuarantor","subscriptions","subscription","s","subscription_guarantor_default","Subscriptions","channelName","channel","callbackName","args","command","subscriptions_default","Consumer","url","createWebSocketURL","subprotocol","a","consumer_default","createConsumer","getConfig","element"],"mappings":"qLAAA,IAAOA,EAAQ,CACb,OAAQ,OAAO,YAAe,YAAc,WAAW,QAAU,OACjE,UAAW,OAAO,YAAe,YAAc,WAAW,UAAY,MACxE,ECFE,IAAAC,EAAQ,eACRC,EAAW,QCAb,IAAMC,GAAuB,IAAM,CACjC,GAAI,CACF,OAAO,QAAQ,IAAI,mBACrB,OAAQC,EAAN,CACA,MACF,CACF,GAAG,EAEGC,GAAqB,IAAM,CAC/B,GAAI,CACF,OAAO,QAAQ,IAAI,iBACrB,OAAQD,EAAN,CACA,MACF,CACF,GAAG,EAEGE,GAAgB,IAAM,CAC1B,GAAI,CACF,MAAO,CAAC,CAAC,QAAQ,IAAI,cAAgB,QAAQ,IAAI,WAAa,YAChE,OAAQF,EAAN,CACA,MAAO,EACT,CACF,GAAG,EAEGG,EAASF,GAAqB,YAC9BG,EAAe,OAAOL,EAAsB,GAAK,MACjDM,EAAqB,KAAKJ,EAAoB,GAAK,MAE5CK,EAAYJ,EACZK,EAAe,GAAGH,YAAuBD,qBACzCK,EAAkB,GAAGJ,WAAsBD,eAC3CM,EAAqB,GAAGJ,WAA4BF,eACpDL,EAAU,GAAGD,O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WAAW,SAAS,EAC5B,OAAO,KAAK,WAAW,KAAK,CAEhC,CAEA,eAAeyC,EAAqB,CAClC,KAAK,aAAe,CAAC,GAAG,KAAK,aAAcA,CAAW,CACxD,CACF,EAEO,SAASD,EAAmBD,EAAsC,CAKvE,GAJI,OAAOA,GAAQ,aACjBA,EAAMA,EAAI,GAGRA,GAAO,CAAC,UAAU,KAAKA,CAAG,EAAG,CAC/B,IAAMG,EAAI,SAAS,cAAc,GAAG,EACpC,OAAAA,EAAE,KAAOH,EAETG,EAAE,KAAOA,EAAE,KACXA,EAAE,SAAWA,EAAE,SAAS,QAAQ,OAAQ,IAAI,EACrCA,EAAE,SAET,QAAOH,CAEX,CAEA,IAAOI,EAAQL,EC7DR,SAASM,GAAeL,EAAMM,EAAU,KAAK,GAAKpD,EAAS,mBAAoB,CACpF,OAAO,IAAIkD,EAASJ,CAAG,CACzB,CAEO,SAASM,EAAUjF,EAAc,CACtC,IAAMkF,EAAU,SAAS,KAAK,cAAc,2BAA2BlF,KAAQ,EAC/E,GAAIkF,EACF,OAAOA,EAAQ,aAAa,SAAS,CAEzC","sourcesContent":["export default {\n logger: typeof globalThis !== 'undefined' ? globalThis.console : undefined,\n WebSocket: typeof globalThis !== 'undefined' ? globalThis.WebSocket : undefined,\n}\n","{\n \"name\": \"@quiltt/core\",\n \"version\": \"3.3.8\",\n \"description\": \"Javascript API client and utilities for Quiltt\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/quiltt/quiltt-public.git\",\n \"directory\": \"ECMAScript/core\"\n },\n \"homepage\": \"https://github.com/quiltt/quiltt-public/tree/main/ECMAScript/core#readme\",\n \"keywords\": [\n \"quiltt\",\n \"typescript\"\n ],\n \"license\": \"MIT\",\n \"sideEffects\": [\n \"./src/Storage/Local.ts\",\n \"./src/api/graphql/links/SubscriptionLink.ts\"\n ],\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist/**\",\n \"src/**\",\n \"CHANGELOG.md\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rimraf .turbo dist\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"TIMING=1 eslint --ext .js,.jsx,.ts,.tsx src/ --fix\",\n \"typecheck\": \"tsc --project tsconfig.json --noEmit\"\n },\n \"dependencies\": {\n \"@apollo/client\": \"^3.7.16\",\n \"axios\": \"^1.6.0\",\n \"cross-fetch\": \"^3.1.8\",\n \"graphql\": \"^16.8.1\",\n \"graphql-ruby-client\": \"^1.11.8\"\n },\n \"devDependencies\": {\n \"@trivago/prettier-plugin-sort-imports\": \"4.1.1\",\n \"@types/node\": \"20.11.4\",\n \"@types/react\": \"18.2.7\",\n \"@typescript-eslint/eslint-plugin\": \"5.60.1\",\n \"@typescript-eslint/parser\": \"5.60.1\",\n \"eslint\": \"8.43.0\",\n \"eslint-config-prettier\": \"8.8.0\",\n \"eslint-plugin-prettier\": \"4.2.1\",\n \"prettier\": \"2.8.8\",\n \"tsup\": \"6.7.0\",\n \"typescript\": \"5.1.3\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import { name as packageName, version as packageVersion } from '../package.json'\n\nconst QUILTT_API_INSECURE = (() => {\n try {\n return process.env.QUILTT_API_INSECURE\n } catch {\n return undefined\n }\n})()\n\nconst QUILTT_API_DOMAIN = (() => {\n try {\n return process.env.QUILTT_API_DOMAIN\n } catch {\n return undefined\n }\n})()\n\nconst QUILTT_DEBUG = (() => {\n try {\n return !!process.env.QUILTT_DEBUG || process.env.NODE_ENV !== 'production'\n } catch {\n return false\n }\n})()\n\nconst domain = QUILTT_API_DOMAIN || 'quiltt.io'\nconst protocolHttp = `http${QUILTT_API_INSECURE ? '' : 's'}`\nconst protocolWebsockets = `ws${QUILTT_API_DOMAIN ? '' : 's'}`\n\nexport const debugging = QUILTT_DEBUG\nexport const endpointAuth = `${protocolHttp}://auth.${domain}/v1/users/session`\nexport const endpointGraphQL = `${protocolHttp}://api.${domain}/v1/graphql`\nexport const endpointWebsockets = `${protocolWebsockets}://api.${domain}/websockets`\nexport const version = `${packageName}: v${packageVersion}`\n\nconst Config = {\n debugging,\n endpointAuth,\n endpointGraphQL,\n endpointWebsockets,\n version,\n}\n\nexport default Config\n","import { debugging } from '../../../../configuration'\nimport adapters from './adapters'\n\nclass Logger {\n enabled = debugging\n\n log(...messages: Array<string>) {\n if (adapters.logger && this.enabled) {\n messages.push(Date.now().toString())\n adapters.logger.log('[ActionCable]', ...messages)\n }\n }\n}\n\nexport const logger = new Logger()\nexport default logger\n","// @ts-nocheck\nimport logger from './logger'\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = (time) => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener('visibilitychange', this.visibilityDidChange)\n logger.log(\n `ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`\n )\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener('visibilitychange', this.visibilityDidChange)\n logger.log('ConnectionMonitor stopped')\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log('ConnectionMonitor recorded connect')\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log('ConnectionMonitor recorded disconnect')\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }, this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(\n `ConnectionMonitor detected stale connection. reconnectAttempts = ${\n this.reconnectAttempts\n }, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${\n this.constructor.staleThreshold\n } s`\n )\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(\n `ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(\n this.disconnectedAt\n )} s`\n )\n } else {\n logger.log('ConnectionMonitor reopening')\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return (\n this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold\n )\n }\n\n visibilityDidChange() {\n if (document.visibilityState === 'visible') {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(\n `ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`\n )\n this.connection.reopen()\n }\n }, 200)\n }\n }\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n","const INTERNAL = {\n message_types: {\n welcome: 'welcome',\n disconnect: 'disconnect',\n ping: 'ping',\n confirmation: 'confirm_subscription',\n rejection: 'reject_subscription',\n },\n disconnect_reasons: {\n unauthorized: 'unauthorized',\n invalid_request: 'invalid_request',\n server_restart: 'server_restart',\n remote: 'remote',\n },\n default_mount_path: '/cable',\n protocols: ['actioncable-v1-json', 'actioncable-unsupported'],\n}\n\nexport default INTERNAL\n","// @ts-nocheck\nimport adapters from './adapters'\nimport ConnectionMonitor from './connection_monitor'\nimport INTERNAL from './internal'\nimport logger from './logger'\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst { message_types, protocols } = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...(this.consumer.subprotocols || [])]\n logger.log(\n `Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`\n )\n if (this.webSocket) {\n this.uninstallEventHandlers()\n }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({ allowReconnect } = { allowReconnect: true }) {\n if (!allowReconnect) {\n this.monitor.stop()\n }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log('Failed to reopen WebSocket', error)\n } finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState('open')\n }\n\n isActive() {\n return this.isState('open', 'connecting')\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (const state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (const eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (const eventName in this.events) {\n this.webSocket[`on${eventName}`] = function () {}\n }\n }\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) {\n return\n }\n const { identifier, message, reason, reconnect, type } = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({ allowReconnect: reconnect })\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, 'connected', { reconnected: true })\n } else {\n return this.subscriptions.notify(identifier, 'connected', { reconnected: false })\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, 'received', message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log('Protocol is unsupported. Stopping monitor and disconnecting.')\n return this.close({ allowReconnect: false })\n }\n },\n\n close(_event) {\n logger.log('WebSocket onclose event')\n if (this.disconnected) {\n return\n }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll('disconnected', {\n willAttemptReconnect: this.monitor.isRunning(),\n })\n },\n\n error() {\n logger.log('WebSocket onerror event')\n },\n}\n\nexport default Connection\n","import type { Consumer } from './consumer'\n\nexport type Data = { [id: string]: string | object | null | undefined }\n\nconst extend = function (object: Data, properties: Data) {\n if (properties !== null) {\n for (const key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport class Subscription {\n consumer: Consumer\n identifier: string\n\n constructor(consumer: Consumer, params: Data = {}, mixin: Data) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this as unknown as Data, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action: string, data: Data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data: object) {\n return this.consumer.send({\n command: 'message',\n identifier: this.identifier,\n data: JSON.stringify(data),\n })\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n\nexport default Subscription\n","import logger from './logger'\nimport type { Subscription } from './subscription'\nimport type { Subscriptions } from './subscriptions'\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n subscriptions: Subscriptions\n pendingSubscriptions: Array<Subscription>\n retryTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(subscriptions: Subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription: Subscription) {\n if (this.pendingSubscriptions.indexOf(subscription) == -1) {\n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription)\n } else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription: Subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = this.pendingSubscriptions.filter((s) => s !== subscription)\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n\n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof this.subscriptions.subscribe === 'function') {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }, 500)\n }\n}\n\nexport default SubscriptionGuarantor\n","import type { Consumer } from './consumer'\nimport logger from './logger'\nimport type { Data } from './subscription'\nimport Subscription from './subscription'\nimport SubscriptionGuarantor from './subscription_guarantor'\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport class Subscriptions {\n consumer: Consumer\n guarantor: SubscriptionGuarantor\n subscriptions: Array<Subscription>\n\n constructor(consumer: Consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName: string, mixin: Data) {\n const channel = channelName\n const params = typeof channel === 'object' ? channel : { channel }\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription: Subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, 'initialized')\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription: Subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, 'unsubscribe')\n }\n return subscription\n }\n\n reject(identifier: string) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, 'rejected')\n return subscription\n })\n }\n\n forget(subscription: Subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = this.subscriptions.filter((s) => s !== subscription)\n return subscription\n }\n\n findAll(identifier: string) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) => this.subscribe(subscription))\n }\n\n notifyAll(callbackName: string, ...args: any[]) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args)\n )\n }\n\n notify(subscription: Subscription, callbackName: string, ...args: any[]) {\n let subscriptions\n if (typeof subscription === 'string') {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription: any) =>\n typeof subscription[callbackName] === 'function'\n ? subscription[callbackName](...args)\n : undefined\n )\n }\n\n subscribe(subscription: Subscription) {\n if (this.sendCommand(subscription, 'subscribe')) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier: string) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) => this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription: Subscription, command: string) {\n const { identifier } = subscription\n return this.consumer.send({ command, identifier })\n }\n}\n\nexport default Subscriptions\n","import Connection from './connection'\nimport Subscriptions from './subscriptions'\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport class Consumer {\n _url: string\n subscriptions: Subscriptions\n connection: Connection\n subprotocols: Array<string>\n\n constructor(url: string) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data: object) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({ allowReconnect: false })\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol: string) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url: string | (() => string)): string {\n if (typeof url === 'function') {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement('a')\n a.href = url\n // eslint-disable-next-line no-self-assign\n a.href = a.href\n a.protocol = a.protocol.replace('http', 'ws')\n return a.href\n } else {\n return url\n }\n}\n\nexport default Consumer\n","'use client'\n\nimport adapters from './adapters'\nimport Connection from './connection'\nimport ConnectionMonitor from './connection_monitor'\nimport Consumer, { createWebSocketURL } from './consumer'\nimport INTERNAL from './internal'\nimport logger from './logger'\nimport Subscription from './subscription'\nimport SubscriptionGuarantor from './subscription_guarantor'\nimport Subscriptions from './subscriptions'\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig('url') || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name: string) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute('content')\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/api/graphql/links/actioncable/adapters.ts","../../../../../package.json","../../../../../src/configuration.ts","../../../../../src/api/graphql/links/actioncable/logger.ts","../../../../../src/api/graphql/links/actioncable/connection_monitor.ts","../../../../../src/api/graphql/links/actioncable/internal.ts","../../../../../src/api/graphql/links/actioncable/connection.ts","../../../../../src/api/graphql/links/actioncable/subscription.ts","../../../../../src/api/graphql/links/actioncable/subscription_guarantor.ts","../../../../../src/api/graphql/links/actioncable/subscriptions.ts","../../../../../src/api/graphql/links/actioncable/consumer.ts","../../../../../src/api/graphql/links/actioncable/index.ts"],"names":["adapters_default","name","version","QUILTT_API_INSECURE","e","QUILTT_API_DOMAIN","QUILTT_DEBUG","domain","protocolHttp","protocolWebsockets","debugging","cdnBase","endpointAuth","endpointGraphQL","endpointWebsockets","Logger","__publicField","messages","logger","logger_default","now","secondsSince","time","ConnectionMonitor","connection","staleThreshold","reconnectionBackoffRate","backoff","jitter","connection_monitor_default","INTERNAL","internal_default","message_types","protocols","supportedProtocols","indexOf","Connection","consumer","data","socketProtocols","allowReconnect","error","states","state","eventName","handler","event","identifier","message","reason","reconnect","type","_event","connection_default","extend","object","properties","key","value","Subscription","params","mixin","action","subscription_default","SubscriptionGuarantor","subscriptions","subscription","s","subscription_guarantor_default","Subscriptions","channelName","channel","callbackName","args","command","subscriptions_default","Consumer","url","createWebSocketURL","subprotocol","a","consumer_default","createConsumer","getConfig","element"],"mappings":"qLAAA,IAAOA,EAAQ,CACb,OAAQ,OAAO,YAAe,YAAc,WAAW,QAAU,OACjE,UAAW,OAAO,YAAe,YAAc,WAAW,UAAY,MACxE,ECFE,IAAAC,EAAQ,eACRC,EAAW,SCAb,IAAMC,GAAuB,IAAM,CACjC,GAAI,CACF,OAAO,QAAQ,IAAI,mBACrB,OAAQC,EAAN,CACA,MACF,CACF,GAAG,EAEGC,GAAqB,IAAM,CAC/B,GAAI,CACF,OAAO,QAAQ,IAAI,iBACr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sBACAA,EAAA,mBACAA,EAAA,qBAGE,KAAK,KAAO6D,EACZ,KAAK,cAAgB,IAAIF,EAAc,IAAI,EAC3C,KAAK,WAAa,IAAItB,EAAW,IAAI,EACrC,KAAK,aAAe,CAAC,CACvB,CAEA,IAAI,KAAM,CACR,OAAOyB,EAAmB,KAAK,IAAI,CACrC,CAEA,KAAKxC,EAAc,CACjB,OAAO,KAAK,WAAW,KAAKA,CAAI,CAClC,CAEA,SAAU,CACR,OAAO,KAAK,WAAW,KAAK,CAC9B,CAEA,YAAa,CACX,OAAO,KAAK,WAAW,MAAM,CAAE,eAAgB,EAAM,CAAC,CACxD,CAEA,wBAAyB,CACvB,GAAI,CAAC,KAAK,WAAW,SAAS,EAC5B,OAAO,KAAK,WAAW,KAAK,CAEhC,CAEA,eAAeyC,EAAqB,CAClC,KAAK,aAAe,CAAC,GAAG,KAAK,aAAcA,CAAW,CACxD,CACF,EAEO,SAASD,EAAmBD,EAAsC,CAKvE,GAJI,OAAOA,GAAQ,aACjBA,EAAMA,EAAI,GAGRA,GAAO,CAAC,UAAU,KAAKA,CAAG,EAAG,CAC/B,IAAMG,EAAI,SAAS,cAAc,GAAG,EACpC,OAAAA,EAAE,KAAOH,EAETG,EAAE,KAAOA,EAAE,KACXA,EAAE,SAAWA,EAAE,SAAS,QAAQ,OAAQ,IAAI,EACrCA,EAAE,SAET,QAAOH,CAEX,CAEA,IAAOI,EAAQL,EC7DR,SAASM,GAAeL,EAAMM,EAAU,KAAK,GAAKpD,EAAS,mBAAoB,CACpF,OAAO,IAAIkD,EAASJ,CAAG,CACzB,CAEO,SAASM,EAAUlF,EAAc,CACtC,IAAMmF,EAAU,SAAS,KAAK,cAAc,2BAA2BnF,KAAQ,EAC/E,GAAImF,EACF,OAAOA,EAAQ,aAAa,SAAS,CAEzC","sourcesContent":["export default {\n logger: typeof globalThis !== 'undefined' ? globalThis.console : undefined,\n WebSocket: typeof globalThis !== 'undefined' ? globalThis.WebSocket : undefined,\n}\n","{\n \"name\": \"@quiltt/core\",\n \"version\": \"3.3.10\",\n \"description\": \"Javascript API client and utilities for Quiltt\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/quiltt/quiltt-public.git\",\n \"directory\": \"ECMAScript/core\"\n },\n \"homepage\": \"https://github.com/quiltt/quiltt-public/tree/main/ECMAScript/core#readme\",\n \"keywords\": [\n \"quiltt\",\n \"typescript\"\n ],\n \"license\": \"MIT\",\n \"sideEffects\": [\n \"./src/Storage/Local.ts\",\n \"./src/api/graphql/links/SubscriptionLink.ts\"\n ],\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist/**\",\n \"src/**\",\n \"CHANGELOG.md\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rimraf .turbo dist\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"TIMING=1 eslint --ext .js,.jsx,.ts,.tsx src/ --fix\",\n \"typecheck\": \"tsc --project tsconfig.json --noEmit\"\n },\n \"dependencies\": {\n \"@apollo/client\": \"^3.7.16\",\n \"axios\": \"^1.6.0\",\n \"cross-fetch\": \"^3.1.8\",\n \"graphql\": \"^16.8.1\",\n \"graphql-ruby-client\": \"^1.11.8\"\n },\n \"devDependencies\": {\n \"@trivago/prettier-plugin-sort-imports\": \"4.1.1\",\n \"@types/node\": \"20.11.4\",\n \"@types/react\": \"18.2.7\",\n \"@typescript-eslint/eslint-plugin\": \"5.60.1\",\n \"@typescript-eslint/parser\": \"5.60.1\",\n \"eslint\": \"8.43.0\",\n \"eslint-config-prettier\": \"8.8.0\",\n \"eslint-plugin-prettier\": \"4.2.1\",\n \"prettier\": \"2.8.8\",\n \"tsup\": \"6.7.0\",\n \"typescript\": \"5.1.3\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import { name as packageName, version as packageVersion } from '../package.json'\n\nconst QUILTT_API_INSECURE = (() => {\n try {\n return process.env.QUILTT_API_INSECURE\n } catch {\n return undefined\n }\n})()\n\nconst QUILTT_API_DOMAIN = (() => {\n try {\n return process.env.QUILTT_API_DOMAIN\n } catch {\n return undefined\n }\n})()\n\nconst QUILTT_DEBUG = (() => {\n try {\n return !!process.env.QUILTT_DEBUG || process.env.NODE_ENV !== 'production'\n } catch {\n return false\n }\n})()\n\nconst domain = QUILTT_API_DOMAIN || 'quiltt.io'\nconst protocolHttp = `http${QUILTT_API_INSECURE ? '' : 's'}`\nconst protocolWebsockets = `ws${QUILTT_API_DOMAIN ? '' : 's'}`\n\nexport const debugging = QUILTT_DEBUG\nexport const version = `${packageName}: v${packageVersion}`\n\nexport const cdnBase = `${protocolHttp}://cdn.${domain}`\nexport const endpointAuth = `${protocolHttp}://auth.${domain}/v1/users/session`\nexport const endpointGraphQL = `${protocolHttp}://api.${domain}/v1/graphql`\nexport const endpointWebsockets = `${protocolWebsockets}://api.${domain}/websockets`\n","import { debugging } from '../../../../configuration'\nimport adapters from './adapters'\n\nclass Logger {\n enabled = debugging\n\n log(...messages: Array<string>) {\n if (adapters.logger && this.enabled) {\n messages.push(Date.now().toString())\n adapters.logger.log('[ActionCable]', ...messages)\n }\n }\n}\n\nexport const logger = new Logger()\nexport default logger\n","// @ts-nocheck\nimport logger from './logger'\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = (time) => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener('visibilitychange', this.visibilityDidChange)\n logger.log(\n `ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`\n )\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener('visibilitychange', this.visibilityDidChange)\n logger.log('ConnectionMonitor stopped')\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log('ConnectionMonitor recorded connect')\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log('ConnectionMonitor recorded disconnect')\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }, this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(\n `ConnectionMonitor detected stale connection. reconnectAttempts = ${\n this.reconnectAttempts\n }, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${\n this.constructor.staleThreshold\n } s`\n )\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(\n `ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(\n this.disconnectedAt\n )} s`\n )\n } else {\n logger.log('ConnectionMonitor reopening')\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return (\n this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold\n )\n }\n\n visibilityDidChange() {\n if (document.visibilityState === 'visible') {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(\n `ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`\n )\n this.connection.reopen()\n }\n }, 200)\n }\n }\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n","const INTERNAL = {\n message_types: {\n welcome: 'welcome',\n disconnect: 'disconnect',\n ping: 'ping',\n confirmation: 'confirm_subscription',\n rejection: 'reject_subscription',\n },\n disconnect_reasons: {\n unauthorized: 'unauthorized',\n invalid_request: 'invalid_request',\n server_restart: 'server_restart',\n remote: 'remote',\n },\n default_mount_path: '/cable',\n protocols: ['actioncable-v1-json', 'actioncable-unsupported'],\n}\n\nexport default INTERNAL\n","// @ts-nocheck\nimport adapters from './adapters'\nimport ConnectionMonitor from './connection_monitor'\nimport INTERNAL from './internal'\nimport logger from './logger'\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst { message_types, protocols } = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...(this.consumer.subprotocols || [])]\n logger.log(\n `Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`\n )\n if (this.webSocket) {\n this.uninstallEventHandlers()\n }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({ allowReconnect } = { allowReconnect: true }) {\n if (!allowReconnect) {\n this.monitor.stop()\n }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log('Failed to reopen WebSocket', error)\n } finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState('open')\n }\n\n isActive() {\n return this.isState('open', 'connecting')\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (const state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (const eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (const eventName in this.events) {\n this.webSocket[`on${eventName}`] = function () {}\n }\n }\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) {\n return\n }\n const { identifier, message, reason, reconnect, type } = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({ allowReconnect: reconnect })\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, 'connected', { reconnected: true })\n } else {\n return this.subscriptions.notify(identifier, 'connected', { reconnected: false })\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, 'received', message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log('Protocol is unsupported. Stopping monitor and disconnecting.')\n return this.close({ allowReconnect: false })\n }\n },\n\n close(_event) {\n logger.log('WebSocket onclose event')\n if (this.disconnected) {\n return\n }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll('disconnected', {\n willAttemptReconnect: this.monitor.isRunning(),\n })\n },\n\n error() {\n logger.log('WebSocket onerror event')\n },\n}\n\nexport default Connection\n","import type { Consumer } from './consumer'\n\nexport type Data = { [id: string]: string | object | null | undefined }\n\nconst extend = function (object: Data, properties: Data) {\n if (properties !== null) {\n for (const key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport class Subscription {\n consumer: Consumer\n identifier: string\n\n constructor(consumer: Consumer, params: Data = {}, mixin: Data) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this as unknown as Data, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action: string, data: Data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data: object) {\n return this.consumer.send({\n command: 'message',\n identifier: this.identifier,\n data: JSON.stringify(data),\n })\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n\nexport default Subscription\n","import logger from './logger'\nimport type { Subscription } from './subscription'\nimport type { Subscriptions } from './subscriptions'\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n subscriptions: Subscriptions\n pendingSubscriptions: Array<Subscription>\n retryTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(subscriptions: Subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription: Subscription) {\n if (this.pendingSubscriptions.indexOf(subscription) == -1) {\n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription)\n } else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription: Subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = this.pendingSubscriptions.filter((s) => s !== subscription)\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n\n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof this.subscriptions.subscribe === 'function') {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }, 500)\n }\n}\n\nexport default SubscriptionGuarantor\n","import type { Consumer } from './consumer'\nimport logger from './logger'\nimport type { Data } from './subscription'\nimport Subscription from './subscription'\nimport SubscriptionGuarantor from './subscription_guarantor'\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport class Subscriptions {\n consumer: Consumer\n guarantor: SubscriptionGuarantor\n subscriptions: Array<Subscription>\n\n constructor(consumer: Consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName: string, mixin: Data) {\n const channel = channelName\n const params = typeof channel === 'object' ? channel : { channel }\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription: Subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, 'initialized')\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription: Subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, 'unsubscribe')\n }\n return subscription\n }\n\n reject(identifier: string) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, 'rejected')\n return subscription\n })\n }\n\n forget(subscription: Subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = this.subscriptions.filter((s) => s !== subscription)\n return subscription\n }\n\n findAll(identifier: string) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) => this.subscribe(subscription))\n }\n\n notifyAll(callbackName: string, ...args: any[]) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args)\n )\n }\n\n notify(subscription: Subscription, callbackName: string, ...args: any[]) {\n let subscriptions\n if (typeof subscription === 'string') {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription: any) =>\n typeof subscription[callbackName] === 'function'\n ? subscription[callbackName](...args)\n : undefined\n )\n }\n\n subscribe(subscription: Subscription) {\n if (this.sendCommand(subscription, 'subscribe')) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier: string) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) => this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription: Subscription, command: string) {\n const { identifier } = subscription\n return this.consumer.send({ command, identifier })\n }\n}\n\nexport default Subscriptions\n","import Connection from './connection'\nimport Subscriptions from './subscriptions'\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport class Consumer {\n _url: string\n subscriptions: Subscriptions\n connection: Connection\n subprotocols: Array<string>\n\n constructor(url: string) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data: object) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({ allowReconnect: false })\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol: string) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url: string | (() => string)): string {\n if (typeof url === 'function') {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement('a')\n a.href = url\n // eslint-disable-next-line no-self-assign\n a.href = a.href\n a.protocol = a.protocol.replace('http', 'ws')\n return a.href\n } else {\n return url\n }\n}\n\nexport default Consumer\n","'use client'\n\nimport adapters from './adapters'\nimport Connection from './connection'\nimport ConnectionMonitor from './connection_monitor'\nimport Consumer, { createWebSocketURL } from './consumer'\nimport INTERNAL from './internal'\nimport logger from './logger'\nimport Subscription from './subscription'\nimport SubscriptionGuarantor from './subscription_guarantor'\nimport Subscriptions from './subscriptions'\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig('url') || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name: string) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute('content')\n }\n}\n"]}
@@ -13,16 +13,16 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
13
 
14
14
  var bt__default = /*#__PURE__*/_interopDefault(bt);
15
15
 
16
- var nt=Object.defineProperty,ct=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var lt=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable;var A=(o,t,e)=>t in o?nt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,b=(o,t)=>{for(var e in t||(t={}))lt.call(t,e)&&A(o,e,t[e]);if(D)for(var e of D(t))pt.call(t,e)&&A(o,e,t[e]);return o},g=(o,t)=>ct(o,at(t));var r=(o,t,e)=>(A(o,typeof t!="symbol"?t+"":t,e),e);var v=class{constructor(){r(this,"observers",{});r(this,"isEnabled",()=>{try{return localStorage.setItem("quiltt.ping","pong"),localStorage.removeItem("quiltt.ping"),!0}catch(t){return !1}});r(this,"isDisabled",()=>!this.isEnabled());r(this,"get",t=>{if(!(typeof window=="undefined"||window.expo))try{let e=window.localStorage.getItem(`quiltt.${t}`);return e&&JSON.parse(e)}catch(e){console.warn(`localStorage Error: "quiltt.${t}"`,e);return}});r(this,"set",(t,e)=>{if(!(typeof window=="undefined"||window.expo))try{e?window.localStorage.setItem(`quiltt.${t}`,JSON.stringify(e)):window.localStorage.removeItem(`quiltt.${t}`);}catch(i){console.warn(`localStorage Error: "quiltt.${t}"`,i);}});r(this,"remove",t=>{try{window.localStorage.removeItem(`quiltt.${t}`);}catch(e){console.warn(`localStorage Error: "quiltt.${t}">`,e);}});r(this,"subscribe",(t,e)=>{this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e);});r(this,"unsubscribe",(t,e)=>{var i;this.observers[t]=(i=this.observers[t])==null?void 0:i.filter(s=>s!==e);});r(this,"handleStorageEvent",t=>{if(t.key&&t.key.includes("quiltt.")){let e=t.newValue?JSON.parse(t.newValue):null;this.observers[t.key]&&this.observers[t.key].forEach(i=>i(e));}else Object.entries(this.observers).forEach(([e,i])=>{i.forEach(s=>s(this.get(e)));});});typeof window!="undefined"&&!(window!=null&&window.expo)&&window.addEventListener("storage",this.handleStorageEvent.bind(this));}};var u=class{constructor(t){r(this,"state");r(this,"observers",[]);r(this,"get",()=>this.state);r(this,"set",t=>{this.state!==t&&(this.state=t,this.observers.forEach(e=>e(t)));});r(this,"subscribe",t=>{this.observers.push(t);});r(this,"unsubscribe",t=>{this.observers=this.observers.filter(e=>e!==t);});this.state=t;}};var S=class{constructor(){r(this,"observables",{});r(this,"get",t=>{if(this.observables[t])return this.observables[t].get()});r(this,"set",(t,e)=>{this.observables[t]?this.observables[t].set(e):this.observables[t]=new u(e);});r(this,"subscribe",(t,e)=>{this.observables[t]||(this.observables[t]=new u),this.observables[t].subscribe(e);});r(this,"unsubscribe",(t,e)=>{this.observables[t]&&this.observables[t].unsubscribe(e);});}};var C=class{constructor(){r(this,"memoryStore",new S);r(this,"localStore",new v);r(this,"observers",{});r(this,"monitors",new Set);r(this,"get",t=>{this.monitorLocalStorageChanges(t);let e=this.memoryStore.get(t);return e===void 0&&(e=this.localStore.get(t)),e});r(this,"set",(t,e)=>{var i;this.monitorLocalStorageChanges(t),this.localStore.set(t,e),this.memoryStore.set(t,e),(i=this.observers[t])==null||i.forEach(s=>s(e));});r(this,"subscribe",(t,e)=>{this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e);});r(this,"unsubscribe",(t,e)=>{var i;this.observers[t]=(i=this.observers[t])==null?void 0:i.filter(s=>s!==e);});r(this,"monitorLocalStorageChanges",t=>{this.monitors.has(t)||(this.monitors.add(t),this.localStore.subscribe(t,e=>{var c;let i=this.memoryStore.get(t),s=e instanceof Function?e(i):e;this.memoryStore.set(t,s),(c=this.observers[t])==null||c.forEach(T=>T(s));}));});}},p=new C;var _=class extends index_js$2.ApolloLink{request(t,e){let i=p.get("session");return i?(t.setContext(({headers:s={}})=>({headers:g(b({},s),{authorization:`Bearer ${i}`})})),e(t)):(console.warn("QuilttLink attempted to send an unauthenticated Query"),null)}};var G="@quiltt/core",W="3.3.8";var ht=(()=>{try{return process.env.QUILTT_API_INSECURE}catch(o){return}})(),Q=(()=>{try{return process.env.QUILTT_API_DOMAIN}catch(o){return}})(),dt=(()=>{try{return !!process.env.QUILTT_DEBUG||process.env.NODE_ENV!=="production"}catch(o){return !1}})(),k=Q||"quiltt.io",H=`http${ht?"":"s"}`,mt=`ws${Q?"":"s"}`,U=dt,y=`${H}://api.${k}/v1/graphql`,J=`${mt}://api.${k}/websockets`,B=`${G}: v${W}`;var re=new index_js.BatchHttpLink({uri:y,fetch:bt__default.default});var ce=index_js$1.onError(({graphQLErrors:o,networkError:t})=>{o&&o.forEach(({message:e,locations:i,path:s})=>{console.log(`[GraphQL error]: Message: ${e}, Location: ${i}, Path: ${s}`);}),t&&(t.statusCode===401?(console.warn("[Authentication error]:",t),p.set("session",null)):console.warn("[Network error]:",t));});var pe=new index_js$2.ApolloLink((o,t)=>t(o));var fe=new index_js$3.HttpLink({uri:y,fetch:bt__default.default});var ve=new index_js$4.RetryLink({attempts:{retryIf:(o,t)=>!!o&&(!o.statusCode||o.statusCode>=500)}});var l={logger:typeof globalThis!="undefined"?globalThis.console:void 0,WebSocket:typeof globalThis!="undefined"?globalThis.WebSocket:void 0};var O=class{constructor(){r(this,"enabled",U);}log(...t){l.logger&&this.enabled&&(t.push(Date.now().toString()),l.logger.log("[ActionCable]",...t));}},wt=new O,n=wt;var h=()=>new Date().getTime(),x=o=>(h()-o)/1e3,d=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0;}start(){this.isRunning()||(this.startedAt=h(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),n.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`));}stop(){this.isRunning()&&(this.stoppedAt=h(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),n.log("ConnectionMonitor stopped"));}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=h();}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,n.log("ConnectionMonitor recorded connect");}recordDisconnect(){this.disconnectedAt=h(),n.log("ConnectionMonitor recorded disconnect");}startPolling(){this.stopPolling(),this.poll();}stopPolling(){clearTimeout(this.pollTimeout);}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll();},this.getPollInterval());}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,i=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),c=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*i*(1+c)}reconnectIfStale(){this.connectionIsStale()&&(n.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${x(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?n.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${x(this.disconnectedAt)} s`):(n.log("ConnectionMonitor reopening"),this.connection.reopen()));}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return x(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&x(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(n.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen());},200);}};d.staleThreshold=6;d.reconnectionBackoffRate=.15;var F=d;var Tt={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},w=Tt;var{message_types:m,protocols:L}=w,At=L.slice(0,L.length-1),V=[].indexOf,f=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new F(this),this.disconnected=!0;}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return n.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...L,...this.consumer.subprotocols||[]];return n.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new l.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(n.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){n.log("Failed to reopen WebSocket",t);}finally{n.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay);}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return V.call(At,this.getProtocol())>=0}isState(...t){return V.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in l.WebSocket)if(l.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e;}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){};}};f.reopenDelay=500;f.prototype.events={message(o){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:i,reconnect:s,type:c}=JSON.parse(o.data);switch(c){case m.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case m.disconnect:return n.log(`Disconnecting. Reason: ${i}`),this.close({allowReconnect:s});case m.ping:return this.monitor.recordPing();case m.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case m.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(n.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return n.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(o){if(n.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){n.log("WebSocket onerror event");}};var z=f;var Ct=function(o,t){if(t!==null)for(let e in t){let i=t[e];o[e]=i;}return o},$=class{constructor(t,e={},i){r(this,"consumer");r(this,"identifier");this.consumer=t,this.identifier=JSON.stringify(e),Ct(this,i);}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},K=$;var N=class{constructor(t){r(this,"subscriptions");r(this,"pendingSubscriptions");r(this,"retryTimeout");this.subscriptions=t,this.pendingSubscriptions=[];}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(n.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):n.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing();}forget(t){n.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t);}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing();}stopGuaranteeing(){clearTimeout(this.retryTimeout);}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{n.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t);});},500);}},X=N;var R=class{constructor(t){r(this,"consumer");r(this,"guarantor");r(this,"subscriptions");this.consumer=t,this.guarantor=new X(this),this.subscriptions=[];}create(t,e){let i=t,s=typeof i=="object"?i:{channel:i},c=new K(this.consumer,s,e);return this.add(c)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(i=>this.notify(i,t,...e))}notify(t,e,...i){let s;return typeof t=="string"?s=this.findAll(t):s=[t],s.map(c=>typeof c[e]=="function"?c[e](...i):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t);}confirmSubscription(t){n.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e));}sendCommand(t,e){let{identifier:i}=t;return this.consumer.send({command:e,identifier:i})}},Y=R;var I=class{constructor(t){r(this,"_url");r(this,"subscriptions");r(this,"connection");r(this,"subprotocols");this._url=t,this.subscriptions=new Y(this),this.connection=new z(this),this.subprotocols=[];}get url(){return Z(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t];}};function Z(o){if(typeof o=="function"&&(o=o()),o&&!/^wss?:/i.test(o)){let t=document.createElement("a");return t.href=o,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return o}var tt=I;function et(o=kt("url")||w.default_mount_path){return new tt(o)}function kt(o){let t=document.head.querySelector(`meta[name='action-cable-${o}']`);if(t)return t.getAttribute("content")}var E=class extends index_js$5.ApolloLink{constructor(e){super();r(this,"cables");r(this,"channelName");r(this,"actionName");r(this,"connectionParams");this.cables={},this.channelName=e.channelName||"GraphqlChannel",this.actionName=e.actionName||"execute",this.connectionParams=e.connectionParams||{};}request(e,i){let s=p.get("session");return s?(this.cables[s]||(this.cables[s]=et(J+(s?`?token=${s}`:""))),new index_js$5.Observable(c=>{let T=Math.round(Date.now()+Math.random()*1e5).toString(16),it=this.actionName,st=typeof this.connectionParams=="function"?this.connectionParams(e):this.connectionParams,P=this.cables[s].subscriptions.create(Object.assign({},{channel:this.channelName,channelId:T},st),{connected:()=>{P.perform(it,{query:e.query?graphql.print(e.query):null,variables:e.variables,operationId:e.operationId,operationName:e.operationName});},received:a=>{var M,q;((M=a==null?void 0:a.result)!=null&&M.data||(q=a==null?void 0:a.result)!=null&&q.errors)&&c.next(a.result),a.more||c.complete();}});return Object.assign(P,{closed:!1})})):(console.warn("QuilttLink attempted to send an unauthenticated Subscription"),null)}},ot=E;var rt=class extends ot{constructor(){super({channelName:"GraphQLChannel"});}};var no=new index_js$2.ApolloLink(()=>null);var po=new index_js$2.ApolloLink((o,t)=>(o.setContext(({headers:e={}})=>({headers:g(b({},e),{"Quiltt-Client-Version":B})})),t(o)));
16
+ var nt=Object.defineProperty,ct=Object.defineProperties;var at=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var lt=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable;var C=(r,t,e)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,b=(r,t)=>{for(var e in t||(t={}))lt.call(t,e)&&C(r,e,t[e]);if(_)for(var e of _(t))pt.call(t,e)&&C(r,e,t[e]);return r},g=(r,t)=>ct(r,at(t));var o=(r,t,e)=>(C(r,typeof t!="symbol"?t+"":t,e),e);var v=class{constructor(){o(this,"observers",{});o(this,"isEnabled",()=>{try{return localStorage.setItem("quiltt.ping","pong"),localStorage.removeItem("quiltt.ping"),!0}catch(t){return !1}});o(this,"isDisabled",()=>!this.isEnabled());o(this,"get",t=>{if(!(typeof window=="undefined"||window.expo))try{let e=window.localStorage.getItem(`quiltt.${t}`);return e&&JSON.parse(e)}catch(e){console.warn(`localStorage Error: "quiltt.${t}"`,e);return}});o(this,"set",(t,e)=>{if(!(typeof window=="undefined"||window.expo))try{e?window.localStorage.setItem(`quiltt.${t}`,JSON.stringify(e)):window.localStorage.removeItem(`quiltt.${t}`);}catch(s){console.warn(`localStorage Error: "quiltt.${t}"`,s);}});o(this,"remove",t=>{try{window.localStorage.removeItem(`quiltt.${t}`);}catch(e){console.warn(`localStorage Error: "quiltt.${t}">`,e);}});o(this,"subscribe",(t,e)=>{this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e);});o(this,"unsubscribe",(t,e)=>{var s;this.observers[t]=(s=this.observers[t])==null?void 0:s.filter(i=>i!==e);});o(this,"handleStorageEvent",t=>{if(t.key&&t.key.includes("quiltt.")){let e=t.newValue?JSON.parse(t.newValue):null;this.observers[t.key]&&this.observers[t.key].forEach(s=>s(e));}else Object.entries(this.observers).forEach(([e,s])=>{s.forEach(i=>i(this.get(e)));});});typeof window!="undefined"&&!(window!=null&&window.expo)&&window.addEventListener("storage",this.handleStorageEvent.bind(this));}};var u=class{constructor(t){o(this,"state");o(this,"observers",[]);o(this,"get",()=>this.state);o(this,"set",t=>{this.state!==t&&(this.state=t,this.observers.forEach(e=>e(t)));});o(this,"subscribe",t=>{this.observers.push(t);});o(this,"unsubscribe",t=>{this.observers=this.observers.filter(e=>e!==t);});this.state=t;}};var S=class{constructor(){o(this,"observables",{});o(this,"get",t=>{if(this.observables[t])return this.observables[t].get()});o(this,"set",(t,e)=>{this.observables[t]?this.observables[t].set(e):this.observables[t]=new u(e);});o(this,"subscribe",(t,e)=>{this.observables[t]||(this.observables[t]=new u),this.observables[t].subscribe(e);});o(this,"unsubscribe",(t,e)=>{this.observables[t]&&this.observables[t].unsubscribe(e);});}};var k=class{constructor(){o(this,"memoryStore",new S);o(this,"localStore",new v);o(this,"observers",{});o(this,"monitors",new Set);o(this,"get",t=>{this.monitorLocalStorageChanges(t);let e=this.memoryStore.get(t);return e===void 0&&(e=this.localStore.get(t)),e});o(this,"set",(t,e)=>{var s;this.monitorLocalStorageChanges(t),this.localStore.set(t,e),this.memoryStore.set(t,e),(s=this.observers[t])==null||s.forEach(i=>i(e));});o(this,"subscribe",(t,e)=>{this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e);});o(this,"unsubscribe",(t,e)=>{var s;this.observers[t]=(s=this.observers[t])==null?void 0:s.filter(i=>i!==e);});o(this,"monitorLocalStorageChanges",t=>{this.monitors.has(t)||(this.monitors.add(t),this.localStore.subscribe(t,e=>{var c;let s=this.memoryStore.get(t),i=e instanceof Function?e(s):e;this.memoryStore.set(t,i),(c=this.observers[t])==null||c.forEach(A=>A(i));}));});}},p=new k;var j=class extends index_js$2.ApolloLink{request(t,e){let s=p.get("session");return s?(t.setContext(({headers:i={}})=>({headers:g(b({},i),{authorization:`Bearer ${s}`})})),e(t)):(console.warn("QuilttLink attempted to send an unauthenticated Query"),null)}};var W="@quiltt/core",Q="3.3.10";var ht=(()=>{try{return process.env.QUILTT_API_INSECURE}catch(r){return}})(),H=(()=>{try{return process.env.QUILTT_API_DOMAIN}catch(r){return}})(),dt=(()=>{try{return !!process.env.QUILTT_DEBUG||process.env.NODE_ENV!=="production"}catch(r){return !1}})(),y=H||"quiltt.io",O=`http${ht?"":"s"}`,mt=`ws${H?"":"s"}`,U=dt,B=`${W}: v${Q}`,x=`${O}://api.${y}/v1/graphql`,J=`${mt}://api.${y}/websockets`;var se=new index_js.BatchHttpLink({uri:x,fetch:bt__default.default});var ae=index_js$1.onError(({graphQLErrors:r,networkError:t})=>{r&&r.forEach(({message:e,locations:s,path:i})=>{console.log(`[GraphQL error]: Message: ${e}, Location: ${s}, Path: ${i}`);}),t&&(t.statusCode===401?(console.warn("[Authentication error]:",t),p.set("session",null)):console.warn("[Network error]:",t));});var ue=new index_js$2.ApolloLink((r,t)=>t(r));var be=new index_js$3.HttpLink({uri:x,fetch:bt__default.default});var Se=new index_js$4.RetryLink({attempts:{retryIf:(r,t)=>!!r&&(!r.statusCode||r.statusCode>=500)}});var l={logger:typeof globalThis!="undefined"?globalThis.console:void 0,WebSocket:typeof globalThis!="undefined"?globalThis.WebSocket:void 0};var L=class{constructor(){o(this,"enabled",U);}log(...t){l.logger&&this.enabled&&(t.push(Date.now().toString()),l.logger.log("[ActionCable]",...t));}},wt=new L,n=wt;var h=()=>new Date().getTime(),w=r=>(h()-r)/1e3,d=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0;}start(){this.isRunning()||(this.startedAt=h(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),n.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`));}stop(){this.isRunning()&&(this.stoppedAt=h(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),n.log("ConnectionMonitor stopped"));}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=h();}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,n.log("ConnectionMonitor recorded connect");}recordDisconnect(){this.disconnectedAt=h(),n.log("ConnectionMonitor recorded disconnect");}startPolling(){this.stopPolling(),this.poll();}stopPolling(){clearTimeout(this.pollTimeout);}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll();},this.getPollInterval());}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),c=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+c)}reconnectIfStale(){this.connectionIsStale()&&(n.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${w(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?n.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${w(this.disconnectedAt)} s`):(n.log("ConnectionMonitor reopening"),this.connection.reopen()));}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return w(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&w(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(n.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen());},200);}};d.staleThreshold=6;d.reconnectionBackoffRate=.15;var F=d;var Tt={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},T=Tt;var{message_types:m,protocols:$}=T,At=$.slice(0,$.length-1),V=[].indexOf,f=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new F(this),this.disconnected=!0;}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return n.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...$,...this.consumer.subprotocols||[]];return n.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new l.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(n.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){n.log("Failed to reopen WebSocket",t);}finally{n.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay);}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return V.call(At,this.getProtocol())>=0}isState(...t){return V.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in l.WebSocket)if(l.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e;}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){};}};f.reopenDelay=500;f.prototype.events={message(r){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:s,reconnect:i,type:c}=JSON.parse(r.data);switch(c){case m.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case m.disconnect:return n.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:i});case m.ping:return this.monitor.recordPing();case m.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case m.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(n.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return n.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(r){if(n.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){n.log("WebSocket onerror event");}};var z=f;var Ct=function(r,t){if(t!==null)for(let e in t){let s=t[e];r[e]=s;}return r},N=class{constructor(t,e={},s){o(this,"consumer");o(this,"identifier");this.consumer=t,this.identifier=JSON.stringify(e),Ct(this,s);}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},K=N;var R=class{constructor(t){o(this,"subscriptions");o(this,"pendingSubscriptions");o(this,"retryTimeout");this.subscriptions=t,this.pendingSubscriptions=[];}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(n.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):n.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing();}forget(t){n.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t);}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing();}stopGuaranteeing(){clearTimeout(this.retryTimeout);}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{n.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t);});},500);}},X=R;var I=class{constructor(t){o(this,"consumer");o(this,"guarantor");o(this,"subscriptions");this.consumer=t,this.guarantor=new X(this),this.subscriptions=[];}create(t,e){let s=t,i=typeof s=="object"?s:{channel:s},c=new K(this.consumer,i,e);return this.add(c)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(s=>this.notify(s,t,...e))}notify(t,e,...s){let i;return typeof t=="string"?i=this.findAll(t):i=[t],i.map(c=>typeof c[e]=="function"?c[e](...s):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t);}confirmSubscription(t){n.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e));}sendCommand(t,e){let{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}},Y=I;var E=class{constructor(t){o(this,"_url");o(this,"subscriptions");o(this,"connection");o(this,"subprotocols");this._url=t,this.subscriptions=new Y(this),this.connection=new z(this),this.subprotocols=[];}get url(){return Z(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t];}};function Z(r){if(typeof r=="function"&&(r=r()),r&&!/^wss?:/i.test(r)){let t=document.createElement("a");return t.href=r,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return r}var tt=E;function et(r=kt("url")||T.default_mount_path){return new tt(r)}function kt(r){let t=document.head.querySelector(`meta[name='action-cable-${r}']`);if(t)return t.getAttribute("content")}var P=class extends index_js$5.ApolloLink{constructor(e){super();o(this,"cables");o(this,"channelName");o(this,"actionName");o(this,"connectionParams");this.cables={},this.channelName=e.channelName||"GraphqlChannel",this.actionName=e.actionName||"execute",this.connectionParams=e.connectionParams||{};}request(e,s){let i=p.get("session");return i?(this.cables[i]||(this.cables[i]=et(J+(i?`?token=${i}`:""))),new index_js$5.Observable(c=>{let A=Math.round(Date.now()+Math.random()*1e5).toString(16),st=this.actionName,it=typeof this.connectionParams=="function"?this.connectionParams(e):this.connectionParams,M=this.cables[i].subscriptions.create(Object.assign({},{channel:this.channelName,channelId:A},it),{connected:()=>{M.perform(st,{query:e.query?graphql.print(e.query):null,variables:e.variables,operationId:e.operationId,operationName:e.operationName});},received:a=>{var q,D;((q=a==null?void 0:a.result)!=null&&q.data||(D=a==null?void 0:a.result)!=null&&D.errors)&&c.next(a.result),a.more||c.complete();}});return Object.assign(M,{closed:!1})})):(console.warn("QuilttLink attempted to send an unauthenticated Subscription"),null)}},rt=P;var ot=class extends rt{constructor(){super({channelName:"GraphQLChannel"});}};var cr=new index_js$2.ApolloLink(()=>null);var ur=new index_js$2.ApolloLink((r,t)=>(r.setContext(({headers:e={}})=>({headers:g(b({},e),{"Quiltt-Client-Version":B})})),t(r)));
17
17
 
18
- exports.AuthLink = _;
19
- exports.BatchHttpLink = re;
20
- exports.ErrorLink = ce;
21
- exports.ForwardableLink = pe;
22
- exports.HttpLink = fe;
23
- exports.RetryLink = ve;
24
- exports.SubscriptionLink = rt;
25
- exports.TerminatingLink = no;
26
- exports.VersionLink = po;
18
+ exports.AuthLink = j;
19
+ exports.BatchHttpLink = se;
20
+ exports.ErrorLink = ae;
21
+ exports.ForwardableLink = ue;
22
+ exports.HttpLink = be;
23
+ exports.RetryLink = Se;
24
+ exports.SubscriptionLink = ot;
25
+ exports.TerminatingLink = cr;
26
+ exports.VersionLink = ur;
27
27
  //# sourceMappingURL=out.js.map
28
28
  //# sourceMappingURL=index.cjs.map