jason-rails 0.8.3 → 0.8.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ff1433058a6e3161db56c679cadfcf087a128c0f0b935ee5ac8a1219848c44e
4
- data.tar.gz: 1d8c542e14dbe8eab26540f8ca33a9e4dde6518cccc0e87b4350389fcbc9c4c0
3
+ metadata.gz: ff84a9e2b7cc044abeaa159eda7993a6296035403db2e86292f3919a1d462c6c
4
+ data.tar.gz: eda4dae9f235460e7566a18f178c3f569c76a03cc68762a79a2bbfa52ca51ba4
5
5
  SHA512:
6
- metadata.gz: 914c935aa960e708a60c309412a503b11e61d6e6f3f0a6011d71021e2a3ed7dcdf5648ac2bfbd5e7bc6ca895005a1e59b38627ab82dc6e8307817f26d8aa908b
7
- data.tar.gz: e342c97211c88fd28ad01bf79fadebfd498595f9d467438d90fb85e7589938e2d629eb624a50a7fbe2501e62f13706b72ea8c7a65b4021305c6ad66e6e7b4bbc
6
+ metadata.gz: fe0da2a182cabbff402b508f6155d97e6e4aad4985b52b1af294b45dbea43d0604659fa7018becd638134333bdab2b1b24ca9d5a67478e442770976d0275e225
7
+ data.tar.gz: fe1c7c4b0e068efacc6c3734a5fe545cbabeaa6d68f1f680ed2455ebb02832eaccaf5442f2d0315091d44b7d0aa2d62773245e6df6b9f66d1c36b4f36cbda53c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.8.6
2
+ - Fix config usage, to allow changing websocket provider
3
+
4
+ ## v0.8.4
5
+ - Fix implicit kwargs that fail in Ruby 3+
6
+
1
7
  ## v0.8.3
2
8
  - Fix lock bug on checking dupe schema
3
9
 
@@ -60,4 +66,4 @@ act.posts.add({ name: 'new post' })
60
66
  ## v0.6.5
61
67
  - Added `reset!` and `reset!(hard: true)` methods to `Subscription`. Reset will load the IDs that should be part of the subscription from the database, and ensure that the graph matches those. It then re-broadcasts the payloads to all connected clients. Hard reset will do the same, but also clear all cached IDs and subscription hooks on instances - this is equivalent from starting from scratch.
62
68
  - Added `enforce: boolean` option to GraphHelper
63
- - When subscriptions are re-activated they now set the IDs with `enforce: true`, as there could be conditions where updates that were made while a subscription was not active would not be properly registered.
69
+ - When subscriptions are re-activated they now set the IDs with `enforce: true`, as there could be conditions where updates that were made while a subscription was not active would not be properly registered.
data/client/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamesr2323/jason",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "module": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {
@@ -6,12 +6,20 @@ import _ from 'lodash'
6
6
  export default function pusherAdapter(jasonConfig, handlePayload, dispatch) {
7
7
  const consumerId = uuidv4()
8
8
 
9
- const { pusherKey, pusherRegion, pusherChannelPrefix } = jasonConfig
10
- const pusher = new Pusher(pusherKey, {
11
- cluster: 'eu',
9
+ const { pusherHost, pusherKey, pusherRegion, pusherChannelPrefix } = jasonConfig
10
+ let config = {
11
+ cluster: pusherRegion,
12
12
  forceTLS: true,
13
13
  authEndpoint: '/jason/api/pusher/auth'
14
- })
14
+ }
15
+ if (pusherHost) {
16
+ config = {
17
+ ...config,
18
+ wsHost: pusherHost,
19
+ httpHost: pusherHost,
20
+ }
21
+ }
22
+ const pusher = new Pusher(pusherKey, config)
15
23
  pusher.connection.bind('state_change', ({ current }) => {
16
24
  if (current === 'connected') {
17
25
  dispatch({ type: 'jason/upsert', payload: { connected: true } })
@@ -106,13 +106,13 @@ class Jason::Subscription
106
106
  subscription.load_ids_for_sub_models(foreign_model_name, new_foreign_id)
107
107
  ] : nil
108
108
 
109
- id_changeset = subscription.graph_helper.apply_update({
109
+ id_changeset = subscription.graph_helper.apply_update(
110
110
  remove: [{
111
111
  model_names: [changed_model_name, foreign_model_name],
112
112
  instance_ids: [[changed_model_id, old_foreign_id]]
113
113
  }],
114
114
  add: add
115
- })
115
+ )
116
116
 
117
117
  subscription.apply_id_changeset(id_changeset)
118
118
  subscription.broadcast_id_changeset(id_changeset)
@@ -127,7 +127,7 @@ class Jason::Subscription
127
127
  # this is simple, only the edges need to change - no IDs can be changed
128
128
  (old_sub_ids & new_sub_ids).each do |sub_id|
129
129
  subscription = find_by_id(sub_id)
130
- subscription.graph_helper.apply_update({
130
+ subscription.graph_helper.apply_update(
131
131
  remove: [{
132
132
  model_names: [changed_model_name, foreign_model_name],
133
133
  instance_ids: [[changed_model_id, old_foreign_id]]
@@ -136,7 +136,7 @@ class Jason::Subscription
136
136
  model_names: [changed_model_name, foreign_model_name],
137
137
  instance_ids: [[changed_model_id, new_foreign_id]]
138
138
  }]
139
- })
139
+ )
140
140
  end
141
141
 
142
142
  #########
@@ -146,7 +146,7 @@ class Jason::Subscription
146
146
  # No edges are removed, just added
147
147
  (new_sub_ids - old_sub_ids).each do |sub_id|
148
148
  subscription = find_by_id(sub_id)
149
- id_changeset = subscription.graph_helper.apply_update({
149
+ id_changeset = subscription.graph_helper.apply_update(
150
150
  add: [
151
151
  {
152
152
  model_names: [changed_model_name, foreign_model_name],
@@ -155,7 +155,7 @@ class Jason::Subscription
155
155
  # Add IDs of child models
156
156
  subscription.load_ids_for_sub_models(changed_model_name, changed_model_id)
157
157
  ]
158
- })
158
+ )
159
159
 
160
160
  subscription.apply_id_changeset(id_changeset)
161
161
  subscription.broadcast_id_changeset(id_changeset)
@@ -168,14 +168,14 @@ class Jason::Subscription
168
168
  # Just need to remove the link, orphan detection will do the rest
169
169
  (old_sub_ids - new_sub_ids).each do |sub_id|
170
170
  subscription = find_by_id(sub_id)
171
- id_changeset = subscription.graph_helper.apply_update({
171
+ id_changeset = subscription.graph_helper.apply_update(
172
172
  remove: [
173
173
  {
174
174
  model_names: [changed_model_name, foreign_model_name],
175
175
  instance_ids: [[changed_model_id, old_foreign_id]]
176
176
  }
177
177
  ]
178
- })
178
+ )
179
179
  subscription.apply_id_changeset(id_changeset)
180
180
  subscription.broadcast_id_changeset(id_changeset)
181
181
  end
@@ -232,7 +232,7 @@ class Jason::Subscription
232
232
  end
233
233
 
234
234
  def add_id(model_name, id)
235
- id_changeset = graph_helper.apply_update({
235
+ id_changeset = graph_helper.apply_update(
236
236
  add: [
237
237
  {
238
238
  model_names: [model_name],
@@ -241,7 +241,7 @@ class Jason::Subscription
241
241
  # Add IDs of child models
242
242
  load_ids_for_sub_models(model_name, id)
243
243
  ]
244
- })
244
+ )
245
245
 
246
246
  apply_id_changeset(id_changeset)
247
247
  broadcast_id_changeset(id_changeset)
@@ -316,10 +316,10 @@ class Jason::Subscription
316
316
  def set_ids_for_sub_models(model_name = model, ids = nil, enforce: false)
317
317
  edge_set = load_ids_for_sub_models(model_name, ids)
318
318
  # Build the tree
319
- id_changeset = graph_helper.apply_update({
319
+ id_changeset = graph_helper.apply_update(
320
320
  add: [edge_set],
321
321
  enforce: enforce
322
- })
322
+ )
323
323
 
324
324
  apply_id_changeset(id_changeset)
325
325
  end
data/lib/jason/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jason
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jason-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Rees
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubygems_version: 3.1.4
265
+ rubygems_version: 3.4.1
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: Reactive user interfaces with minimal boilerplate, using Rails + Redux