hyper-resource 1.0.0.lap57 → 1.0.0.lap58
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bcbeaa04a6654be3f24e097ea9d2f2f73b9579857a66e1c6ceee03c49013073
|
4
|
+
data.tar.gz: 38bc971a2d049850bafc340cce9545f42953f4fac8eb0ef944217d2dacd6bde8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d502dd12afec243680c27aad39b8998ccb180b6e8783a0ececc989163d47f84aca92909ef9a73cfc99a9e19c11ab32c7e76eb77bdfaec879230ba0845169dbf
|
7
|
+
data.tar.gz: 6dc999b8179e2d0a990a52d528f467fc158b4fbb338b7b439db0308cb34fa76a0146e15d0092a429a53c751dcd39cb537b4da35e02a472a76d62eb47b8c23331
|
@@ -143,7 +143,7 @@ module HyperRecord
|
|
143
143
|
def promise_destroy
|
144
144
|
_local_destroy
|
145
145
|
self.class._promise_delete("#{resource_base_uri}/#{@properties_hash[:id]}").then do |response|
|
146
|
-
|
146
|
+
self
|
147
147
|
end.fail do |response|
|
148
148
|
error_message = "Destroying record #{self} failed!"
|
149
149
|
`console.error(error_message)`
|
@@ -261,10 +261,14 @@ module HyperRecord
|
|
261
261
|
c_record_class = Object.const_get(klass_name)
|
262
262
|
if c_record_class._record_cache.has_key?(data[:cause][:id].to_s)
|
263
263
|
c_record = c_record_class.find(data[:cause][:id])
|
264
|
+
if data[:cause][:destroyed]
|
265
|
+
c_record.instance_variable_set(:@remotely_destroyed, true)
|
266
|
+
c_record._local_destroy
|
267
|
+
end
|
264
268
|
if `Date.parse(#{c_record.updated_at}) >= Date.parse(#{data[:cause][:updated_at]})`
|
265
269
|
if @fetch_states[data[:relation]] == 'f'
|
266
270
|
if send(data[:relation]).include?(c_record)
|
267
|
-
return
|
271
|
+
return unless data[:cause][:destroyed]
|
268
272
|
end
|
269
273
|
end
|
270
274
|
end
|
data/lib/hyper_record/pub_sub.rb
CHANGED
@@ -29,6 +29,7 @@ module HyperRecord
|
|
29
29
|
message[:cause][:record_type] = record.class.to_s
|
30
30
|
message[:cause][:id] = record.id
|
31
31
|
message[:cause][:updated_at] = record.updated_at
|
32
|
+
message[:cause][:destroyed] = true if record.destroyed?
|
32
33
|
end
|
33
34
|
subscribers.each do |session_id, last_requested|
|
34
35
|
if last_requested.to_f < scrub_time
|
@@ -97,7 +97,7 @@ module Hyperloop
|
|
97
97
|
if scope_params
|
98
98
|
scope_params = '[' + scope_params
|
99
99
|
record_class._class_fetch_states[data[:scope]] = 'u'
|
100
|
-
record_class.send(scope_name, JSON.parse(scope_params))
|
100
|
+
record_class.send(scope_name, *JSON.parse(scope_params))
|
101
101
|
else
|
102
102
|
record_class._class_fetch_states[data[:scope]] = 'u'
|
103
103
|
record_class.send(data[:scope])
|
@@ -105,6 +105,8 @@ module Hyperloop
|
|
105
105
|
elsif record_class.record_cached?(data[:id])
|
106
106
|
record = record_class.find(data[:id])
|
107
107
|
record._update_record(data)
|
108
|
+
elsif data[:destroyed]
|
109
|
+
return
|
108
110
|
end
|
109
111
|
end
|
110
112
|
end
|