jason-rails 0.8.2 → 0.8.4
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/app/controllers/jason/pusher_controller.rb +1 -1
- data/client/package.json +1 -1
- data/lib/jason/subscription.rb +12 -12
- data/lib/jason/version.rb +1 -1
- data/lib/jason.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1459a38f9838d91a9e0c85f5993bcc8d49e5ec123261afb84ac344a5ab3e248
|
4
|
+
data.tar.gz: c6f0176ff3d0f7c25c6b3046cb683d9d549eff89d4015e371cd29a5fc8f68efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55e9e8e7421fd503b8b1941569846f9265f0ae16bd24c45905cf84e44443718c1f0175fb9c4893498dac4fd1b510b78b6d0fb2845acda0b441dc4afbb6bcffc7
|
7
|
+
data.tar.gz: 1afd0c07a6829a85c0fbb6152cb13225a63ae19ea786fab28c773116c6e739bb8b25a8714c5681a8a8cada9a2aa4565b327972749ec768d5de5b0ec8f3b86c60
|
data/CHANGELOG.md
CHANGED
data/client/package.json
CHANGED
data/lib/jason/subscription.rb
CHANGED
@@ -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
data/lib/jason.rb
CHANGED
@@ -40,7 +40,7 @@ module Jason
|
|
40
40
|
return if $PROGRAM_NAME == '-e' || ActiveRecord::Base.connection.migration_context.needs_migration?
|
41
41
|
|
42
42
|
# Check if the schema has changed since last time app was started. If so, do some work to ensure cache contains the correct data
|
43
|
-
got_lock = $redis_jason.set('jason:schema:lock', nx: true, ex: 3600) # Basic lock mechanism for multi-process environments
|
43
|
+
got_lock = $redis_jason.set('jason:schema:lock', '1', nx: true, ex: 3600) # Basic lock mechanism for multi-process environments
|
44
44
|
return if !got_lock
|
45
45
|
|
46
46
|
previous_schema = JSON.parse($redis_jason.get('jason:last_schema') || '{}')
|
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.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Rees
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|