avo 1.18.2 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +6 -6
  4. data/app/components/avo/fields/belongs_to_field/index_component.html.erb +1 -1
  5. data/app/components/avo/fields/belongs_to_field/show_component.html.erb +1 -1
  6. data/app/components/avo/fields/common/multiple_file_viewer_component.html.erb +1 -1
  7. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +1 -2
  8. data/app/components/avo/fields/has_one_field/index_component.html.erb +1 -1
  9. data/app/components/avo/fields/has_one_field/show_component.html.erb +1 -1
  10. data/app/components/avo/fields/has_one_field/show_component.rb +6 -1
  11. data/app/components/avo/fields/index_component.rb +2 -2
  12. data/app/components/avo/fields/trix_field/edit_component.html.erb +1 -1
  13. data/app/components/avo/index/grid_item_component.html.erb +4 -4
  14. data/app/components/avo/index/resource_controls_component.html.erb +1 -1
  15. data/app/components/avo/index/resource_controls_component.rb +22 -6
  16. data/app/components/avo/index/resource_table_component.html.erb +1 -1
  17. data/app/components/avo/panel_component.rb +3 -4
  18. data/app/components/avo/resource_component.rb +5 -1
  19. data/app/components/avo/views/resource_edit_component.html.erb +2 -2
  20. data/app/components/avo/views/resource_edit_component.rb +3 -3
  21. data/app/components/avo/views/resource_index_component.html.erb +2 -8
  22. data/app/components/avo/views/resource_index_component.rb +7 -15
  23. data/app/components/avo/views/resource_new_component.html.erb +2 -2
  24. data/app/components/avo/views/resource_new_component.rb +6 -2
  25. data/app/components/avo/views/resource_show_component.html.erb +5 -4
  26. data/app/components/avo/views/resource_show_component.rb +11 -6
  27. data/app/controllers/avo/actions_controller.rb +1 -1
  28. data/app/controllers/avo/application_controller.rb +2 -61
  29. data/app/controllers/avo/attachments_controller.rb +3 -2
  30. data/app/controllers/avo/base_controller.rb +28 -21
  31. data/app/controllers/avo/home_controller.rb +5 -1
  32. data/app/controllers/avo/relations_controller.rb +3 -3
  33. data/app/controllers/avo/search_controller.rb +1 -1
  34. data/app/helpers/avo/application_helper.rb +5 -11
  35. data/app/helpers/avo/resources_helper.rb +1 -1
  36. data/app/helpers/avo/url_helpers.rb +77 -0
  37. data/app/packs/entrypoints/application.css +1 -0
  38. data/app/packs/entrypoints/application.js +7 -0
  39. data/app/packs/js/controllers/loading_button_controller.js +22 -0
  40. data/app/packs/stylesheets/components/status.css +22 -15
  41. data/app/packs/stylesheets/spinner.css +49 -0
  42. data/app/views/avo/actions/show.html.erb +2 -2
  43. data/app/views/avo/base/_actions.html.erb +3 -3
  44. data/app/views/avo/base/_filters.html.erb +1 -1
  45. data/app/views/avo/home/failed_to_load.html.erb +3 -0
  46. data/app/views/avo/partials/_failed_state.html.erb +16 -0
  47. data/app/views/avo/partials/_paginator.html.erb +2 -2
  48. data/app/views/avo/relations/new.html.erb +0 -2
  49. data/app/views/avo/sidebar/_sidebar.html.erb +1 -1
  50. data/app/views/kaminari/_page.html.erb +1 -1
  51. data/config/routes.rb +7 -5
  52. data/lib/avo/app.rb +4 -8
  53. data/lib/avo/base_action.rb +9 -1
  54. data/lib/avo/base_resource.rb +33 -7
  55. data/lib/avo/configuration.rb +2 -0
  56. data/lib/avo/fields/base_field.rb +8 -2
  57. data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -19
  58. data/lib/avo/fields/has_base_field.rb +35 -0
  59. data/lib/avo/fields/has_many_field.rb +1 -19
  60. data/lib/avo/fields/has_one_field.rb +3 -19
  61. data/lib/avo/services/authorization_service.rb +8 -4
  62. data/lib/avo/version.rb +1 -1
  63. data/lib/generators/avo/templates/locales/avo.en.yml +2 -0
  64. data/public/avo-packs/css/{application-f9191617.css → application-c3b50b28.css} +54 -12
  65. data/public/avo-packs/css/application-c3b50b28.css.br +0 -0
  66. data/public/avo-packs/css/{application-f9191617.css.gz → application-c3b50b28.css.gz} +0 -0
  67. data/public/avo-packs/css/application-c3b50b28.css.map +1 -0
  68. data/public/avo-packs/css/application-c3b50b28.css.map.br +0 -0
  69. data/public/avo-packs/css/application-c3b50b28.css.map.gz +0 -0
  70. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js +2 -0
  71. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.br +0 -0
  72. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.gz +0 -0
  73. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map +1 -0
  74. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.br +0 -0
  75. data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.gz +0 -0
  76. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js +26 -0
  77. data/public/avo-packs/js/{application-cc89f096028eb1d4d971.js.LICENSE.txt → application-6fc968cfa52976c4582b.js.LICENSE.txt} +0 -0
  78. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.br +0 -0
  79. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.gz +0 -0
  80. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map +1 -0
  81. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.br +0 -0
  82. data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.gz +0 -0
  83. data/public/avo-packs/manifest.json +21 -21
  84. metadata +27 -21
  85. data/public/avo-packs/css/application-f9191617.css.br +0 -0
  86. data/public/avo-packs/css/application-f9191617.css.map +0 -1
  87. data/public/avo-packs/css/application-f9191617.css.map.br +0 -0
  88. data/public/avo-packs/css/application-f9191617.css.map.gz +0 -0
  89. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js +0 -2
  90. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.br +0 -0
  91. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.gz +0 -0
  92. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map +0 -1
  93. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br +0 -0
  94. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz +0 -0
  95. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js +0 -26
  96. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.br +0 -0
  97. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.gz +0 -0
  98. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map +0 -1
  99. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.br +0 -0
  100. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.gz +0 -0
@@ -1,2 +0,0 @@
1
- (globalThis.webpackChunkavo=globalThis.webpackChunkavo||[]).push([[219],{7034:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Connection:()=>m,ConnectionMonitor:()=>l,Consumer:()=>v,INTERNAL:()=>h,Subscription:()=>b,Subscriptions:()=>f,adapters:()=>i,createConsumer:()=>y,createWebSocketURL:()=>S,getConfig:()=>A,logger:()=>o});const i={logger:self.console,WebSocket:self.WebSocket},o={log(...t){this.enabled&&(t.push(Date.now()),i.logger.log("[ActionCable]",...t))}},s=()=>(new Date).getTime(),r=t=>(s()-t)/1e3;class c{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=s(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),o.log(`ConnectionMonitor started. pollInterval = ${this.getPollInterval()} ms`))}stop(){this.isRunning()&&(this.stoppedAt=s(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),o.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=s()}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,o.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=s(),o.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout((()=>{this.reconnectIfStale(),this.poll()}),this.getPollInterval())}getPollInterval(){const{min:t,max:e,multiplier:n}=this.constructor.pollInterval,i=n*Math.log(this.reconnectAttempts+1);return Math.round(1e3*((t,e,n)=>Math.max(e,Math.min(n,t)))(i,t,e))}reconnectIfStale(){this.connectionIsStale()&&(o.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, pollInterval = ${this.getPollInterval()} ms, time disconnected = ${r(this.disconnectedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?o.log("ConnectionMonitor skipping reopening recent disconnect"):(o.log("ConnectionMonitor reopening"),this.connection.reopen()))}connectionIsStale(){return r(this.pingedAt?this.pingedAt:this.startedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&r(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){"visible"===document.visibilityState&&setTimeout((()=>{!this.connectionIsStale()&&this.connection.isOpen()||(o.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())}),200)}}c.pollInterval={min:3,max:30,multiplier:5},c.staleThreshold=6;const l=c,h={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"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},{message_types:a,protocols:u}=h,d=u.slice(0,u.length-1),p=[].indexOf;class g{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new l(this),this.disconnected=!0}send(t){return!!this.isOpen()&&(this.webSocket.send(JSON.stringify(t)),!0)}open(){return this.isActive()?(o.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1):(o.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${u}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new i.WebSocket(this.consumer.url,u),this.installEventHandlers(),this.monitor.start(),!0)}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isActive())return this.webSocket.close()}reopen(){if(o.log(`Reopening WebSocket, current state is ${this.getState()}`),!this.isActive())return this.open();try{return this.close()}catch(t){o.log("Failed to reopen WebSocket",t)}finally{o.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}isProtocolSupported(){return p.call(d,this.getProtocol())>=0}isState(...t){return p.call(t,this.getState())>=0}getState(){if(this.webSocket)for(let t in i.WebSocket)if(i.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase();return null}installEventHandlers(){for(let t in this.events){const e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}}g.reopenDelay=500,g.prototype.events={message(t){if(!this.isProtocolSupported())return;const{identifier:e,message:n,reason:i,reconnect:s,type:r}=JSON.parse(t.data);switch(r){case a.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case a.disconnect:return o.log(`Disconnecting. Reason: ${i}`),this.close({allowReconnect:s});case a.ping:return this.monitor.recordPing();case a.confirmation:return this.subscriptions.notify(e,"connected");case a.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",n)}},open(){if(o.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return o.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(t){if(o.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){o.log("WebSocket onerror event")}};const m=g;class b{constructor(t,e={},n){this.consumer=t,this.identifier=JSON.stringify(e),function(t,e){if(null!=e)for(let n in e){const i=e[n];t[n]=i}}(this,n)}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)}}class f{constructor(t){this.consumer=t,this.subscriptions=[]}create(t,e){const n="object"==typeof t?t:{channel:t},i=new b(this.consumer,n,e);return this.add(i)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.sendCommand(t,"subscribe"),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map((t=>(this.forget(t),this.notify(t,"rejected"),t)))}forget(t){return 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.sendCommand(t,"subscribe")))}notifyAll(t,...e){return this.subscriptions.map((n=>this.notify(n,t,...e)))}notify(t,e,...n){let i;return i="string"==typeof t?this.findAll(t):[t],i.map((t=>"function"==typeof t[e]?t[e](...n):void 0))}sendCommand(t,e){const{identifier:n}=t;return this.consumer.send({command:e,identifier:n})}}class v{constructor(t){this._url=t,this.subscriptions=new f(this),this.connection=new m(this)}get url(){return S(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()}}function S(t){if("function"==typeof t&&(t=t()),t&&!/^wss?:/i.test(t)){const e=document.createElement("a");return e.href=t,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}return t}function y(t=A("url")||h.default_mount_path){return new v(t)}function A(t){const e=document.head.querySelector(`meta[name='action-cable-${t}']`);if(e)return e.getAttribute("content")}}}]);
2
- //# sourceMappingURL=219-9aa2b689f44613118203.chunk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack://avo/./node_modules/@rails/actioncable/src/adapters.js","webpack://avo/./node_modules/@rails/actioncable/src/logger.js","webpack://avo/./node_modules/@rails/actioncable/src/connection_monitor.js","webpack://avo/./node_modules/@rails/actioncable/src/internal.js","webpack://avo/./node_modules/@rails/actioncable/src/connection.js","webpack://avo/./node_modules/@rails/actioncable/src/subscription.js","webpack://avo/./node_modules/@rails/actioncable/src/subscriptions.js","webpack://avo/./node_modules/@rails/actioncable/src/consumer.js","webpack://avo/./node_modules/@rails/actioncable/src/index.js"],"names":["logger","self","console","WebSocket","messages","this","enabled","push","Date","now","adapters","log","getTime","secondsSince","time","ConnectionMonitor","connection","visibilityDidChange","bind","reconnectAttempts","isRunning","startedAt","stoppedAt","startPolling","addEventListener","getPollInterval","stopPolling","removeEventListener","pingedAt","recordPing","disconnectedAt","poll","clearTimeout","pollTimeout","setTimeout","reconnectIfStale","min","max","multiplier","constructor","pollInterval","interval","Math","round","number","clamp","connectionIsStale","staleThreshold","disconnectedRecently","reopen","document","visibilityState","isOpen","message_types","protocols","supportedProtocols","slice","length","indexOf","Connection","consumer","open","subscriptions","monitor","disconnected","data","webSocket","send","JSON","stringify","isActive","getState","uninstallEventHandlers","url","installEventHandlers","start","allowReconnect","stop","close","error","reopenDelay","protocol","isState","call","getProtocol","states","state","readyState","toLowerCase","eventName","events","handler","prototype","event","isProtocolSupported","identifier","message","reason","reconnect","type","parse","welcome","recordConnect","reload","disconnect","ping","confirmation","notify","rejection","reject","recordDisconnect","notifyAll","willAttemptReconnect","Subscription","params","mixin","object","properties","key","value","extend","action","command","remove","Subscriptions","channelName","channel","subscription","add","ensureActiveConnection","sendCommand","forget","findAll","map","filter","s","callbackName","args","undefined","Consumer","_url","createWebSocketURL","test","a","createElement","href","replace","createConsumer","getConfig","name","element","head","querySelector","getAttribute"],"mappings":"6TAAA,SACEA,OAAQC,KAAKC,QACbC,UAAWF,KAAKE,WCYlB,GACE,OAAOC,GACDC,KAAKC,UACPF,EAASG,KAAKC,KAAKC,OACnBC,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,OAAOV,EAAcS,KAAiBC,GACpC,IAAI3E,EAOJ,OALEA,EAD0B,iBAAjBiE,EACO1H,KAAK+H,QAAQL,GAEb,CAACA,GAGZjE,EAAcuE,KAAKN,GACe,mBAA/BA,EAAaS,GAA+BT,EAAaS,MAAiBC,QAAQC,IAG9F,YAAYX,EAAcL,GACxB,MAAM,WAAC3B,GAAcgC,EACrB,OAAO1H,KAAKuD,SAASO,KAAK,CAACuD,UAAS3B,gBCvDzB,MAAM4C,EACnB,YAAYlE,GACVpE,KAAKuI,KAAOnE,EACZpE,KAAKyD,cAAgB,IAAI8D,EAAcvH,MACvCA,KAAKW,WAAa,IAAI,EAAWX,MAGnC,UACE,OAAOwI,EAAmBxI,KAAKuI,MAGjC,KAAK3E,GACH,OAAO5D,KAAKW,WAAWmD,KAAKF,GAG9B,UACE,OAAO5D,KAAKW,WAAW6C,OAGzB,aACE,OAAOxD,KAAKW,WAAW8D,MAAM,CAACF,gBAAgB,IAGhD,yBACE,IAAKvE,KAAKW,WAAWsD,WACnB,OAAOjE,KAAKW,WAAW6C,QAKtB,SAASgF,EAAmBpE,GAKjC,GAJmB,mBAARA,IACTA,EAAMA,KAGJA,IAAQ,UAAUqE,KAAKrE,GAAM,CAC/B,MAAMsE,EAAI7F,SAAS8F,cAAc,KAKjC,OAJAD,EAAEE,KAAOxE,EAETsE,EAAEE,KAAOF,EAAEE,KACXF,EAAE9D,SAAW8D,EAAE9D,SAASiE,QAAQ,OAAQ,MACjCH,EAAEE,KAET,OAAOxE,ECnDJ,SAAS0E,EAAe1E,EAAM2E,EAAU,QAAU,sBACvD,OAAO,IAAIT,EAASlE,GAGf,SAAS2E,EAAUC,GACxB,MAAMC,EAAUpG,SAASqG,KAAKC,cAAc,2BAA2BH,OACvE,GAAIC,EACF,OAAOA,EAAQG,aAAa","file":"js/219-9aa2b689f44613118203.chunk.js","sourcesContent":["export default {\n logger: self.console,\n WebSocket: self.WebSocket\n}\n","import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n","import 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\nconst clamp = (number, min, max) => Math.max(min, Math.min(max, number))\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(`ConnectionMonitor started. pollInterval = ${this.getPollInterval()} ms`)\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 }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const {min, max, multiplier} = this.constructor.pollInterval\n const interval = multiplier * Math.log(this.reconnectAttempts + 1)\n return Math.round(clamp(interval, min, max) * 1000)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, pollInterval = ${this.getPollInterval()} ms, time disconnected = ${secondsSince(this.disconnectedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(\"ConnectionMonitor skipping reopening recent disconnect\")\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n connectionIsStale() {\n return secondsSince(this.pingedAt ? this.pingedAt : this.startedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.pollInterval = {\n min: 3,\n max: 30,\n multiplier: 5\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\n\nexport default ConnectionMonitor\n","export default {\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 },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n","import 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 logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${protocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, protocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n if (this.isActive()) {\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 }\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 // 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 (let 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 (let 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 (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\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 return this.subscriptions.notify(identifier, \"connected\")\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) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n","// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n","import Subscription from \"./subscription\"\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 default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\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) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.sendCommand(subscription, \"subscribe\")\n return subscription\n }\n\n remove(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) {\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) {\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.sendCommand(subscription, \"subscribe\"))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\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) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\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 default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\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\nexport function createWebSocketURL(url) {\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 // Fix populating Location properties in IE. Otherwise, protocol will be blank.\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","import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\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) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n"],"sourceRoot":""}