dexiecable 3.0.0 → 3.0.1
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/README.md +4 -2
- data/lib/dexiecable/active_record_ext.rb +3 -3
- data/lib/dexiecable/version.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: bd35d8a96ed1aa2ae0df024ec4d6bd8293b48213fa3b3b0107d805d0031d2b5a
|
|
4
|
+
data.tar.gz: 07c321a93ff08c1a57954715f5818d265e2c33076aff5f0f75baea4628ecef34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b0303b8b5094a7a6a9adacfa76bae28cb1efa9d0f9842af8cb91c4808ed147013e6db9743081f2b8f8734a0548480754b9c71b0309af80851c83098381f55d9
|
|
7
|
+
data.tar.gz: 9ed45ea925d28bb1395a305c97492fc70e36eed26936c96b8d78a0fc347a5a960cfef403595dd43365e031bff4d29dd7ab19083c156a9453731a084838c52b41
|
data/README.md
CHANGED
|
@@ -333,10 +333,12 @@ Internally, `syncs_to_dexie` sets up the following ActiveRecord callbacks:
|
|
|
333
333
|
|
|
334
334
|
| Event | Action |
|
|
335
335
|
|---|---|
|
|
336
|
-
| `after_commit on: :create` | `channel.table(table).
|
|
337
|
-
| `after_commit on: :update` | `channel.table(table).
|
|
336
|
+
| `after_commit on: :create` | `channel.table(table).upsert(id, as_json_for_dexie)` |
|
|
337
|
+
| `after_commit on: :update` | `channel.table(table).upsert(id, as_json_for_dexie)` |
|
|
338
338
|
| `after_commit on: :destroy` | `channel.table(table).delete(id)` |
|
|
339
339
|
|
|
340
|
+
Both create and update use Dexie's `upsert`, so replays are idempotent: a create for a row the client already has patches it instead of throwing `ConstraintError`, and an update for a row the client missed inserts it. The full serialized payload is sent, so `upsert` can materialize a complete row when the client never received the create.
|
|
341
|
+
|
|
340
342
|
#### Options
|
|
341
343
|
|
|
342
344
|
| Option | Default | Description |
|
|
@@ -54,7 +54,8 @@ module DexieCable
|
|
|
54
54
|
after_commit on: :create, **conditions do
|
|
55
55
|
resolve_channels(via).each do |channel|
|
|
56
56
|
next unless channel
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
channel.table(resolve_table(table)).upsert(id, resolve(serializer))
|
|
58
59
|
end
|
|
59
60
|
end
|
|
60
61
|
end
|
|
@@ -64,8 +65,7 @@ module DexieCable
|
|
|
64
65
|
resolve_channels(via).each do |channel|
|
|
65
66
|
next unless channel
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
channel.table(resolve_table(table)).update(id, changes)
|
|
68
|
+
channel.table(resolve_table(table)).upsert(id, resolve(serializer))
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
end
|
data/lib/dexiecable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dexiecable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefan Buhrmester
|
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
90
|
version: '0'
|
|
91
91
|
requirements: []
|
|
92
|
-
rubygems_version: 4.0.
|
|
92
|
+
rubygems_version: 4.0.23
|
|
93
93
|
specification_version: 4
|
|
94
94
|
summary: Run Dexie.js IndexedDB operations from your Rails ActionCable channels.
|
|
95
95
|
test_files: []
|