cable_ready 5.0.0.pre0 → 5.0.0.pre4
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 +87 -8
- data/Gemfile.lock +105 -97
- data/README.md +10 -6
- data/app/channels/cable_ready/stream.rb +12 -0
- data/app/helpers/cable_ready_helper.rb +24 -0
- data/app/jobs/cable_ready_broadcast_job.rb +14 -0
- data/app/models/concerns/cable_ready/updatable/collection_updatable_callbacks.rb +19 -0
- data/app/models/concerns/cable_ready/updatable/collections_registry.rb +33 -0
- data/app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb +28 -0
- data/app/models/concerns/cable_ready/updatable.rb +98 -0
- data/app/models/concerns/extend_has_many.rb +13 -0
- data/lib/cable_ready/channels.rb +1 -1
- data/lib/cable_ready/compoundable.rb +1 -1
- data/lib/cable_ready/config.rb +2 -0
- data/lib/cable_ready/identifiable.rb +13 -2
- data/lib/cable_ready/operation_builder.rb +25 -14
- data/lib/cable_ready/sanity_checker.rb +50 -50
- data/lib/cable_ready/version.rb +1 -1
- data/lib/cable_ready.rb +3 -0
- data/lib/generators/cable_ready/{stream_from_generator.rb → helpers_generator.rb} +1 -1
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/global_idable_entity.rb +16 -0
- data/test/dummy/app/models/post.rb +4 -0
- data/test/dummy/app/models/section.rb +6 -0
- data/test/dummy/app/models/team.rb +6 -0
- data/test/dummy/app/models/topic.rb +4 -0
- data/test/dummy/app/models/user.rb +7 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +76 -0
- data/test/dummy/config/environments/production.rb +120 -0
- data/test/dummy/config/environments/test.rb +59 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/test/dummy/config/initializers/cable_ready.rb +18 -0
- data/test/dummy/config/initializers/content_security_policy.rb +28 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/permissions_policy.rb +11 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/puma.rb +43 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/db/migrate/20210902154139_create_users.rb +9 -0
- data/test/dummy/db/migrate/20210902154153_create_posts.rb +10 -0
- data/test/dummy/db/migrate/20210904081930_create_topics.rb +9 -0
- data/test/dummy/db/migrate/20210904093607_create_sections.rb +9 -0
- data/test/dummy/db/migrate/20210913191735_create_teams.rb +8 -0
- data/test/dummy/db/migrate/20210913191759_add_team_reference_to_users.rb +5 -0
- data/test/dummy/db/schema.rb +49 -0
- data/test/dummy/test/models/post_test.rb +7 -0
- data/test/dummy/test/models/section_test.rb +7 -0
- data/test/dummy/test/models/team_test.rb +7 -0
- data/test/dummy/test/models/topic_test.rb +7 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/test/lib/cable_ready/cable_car_test.rb +25 -3
- data/test/lib/cable_ready/compoundable_test.rb +26 -0
- data/test/lib/cable_ready/helper_test.rb +25 -0
- data/test/lib/cable_ready/identifiable_test.rb +0 -6
- data/test/lib/cable_ready/operation_builder_test.rb +89 -28
- data/test/lib/cable_ready/updatable_test.rb +112 -0
- data/test/test_helper.rb +4 -1
- metadata +126 -14
- data/cable_ready.gemspec +0 -27
- data/package.json +0 -39
- data/tags +0 -80
- data/yarn.lock +0 -2562
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2b77b47c0eb8de63edb60db0cb235067ffd3ca9006ad0b2ea61f0b48d187203
|
4
|
+
data.tar.gz: 324b35591eed716da4e7fefda9bf063d9dd8809d5462102936d7c5dd7221caf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3117dd4df1af91c451d3e22c84b96f2f430af511437145c03b1212217b87be1b0ce71e58d507ec4a10c268653f04518823ab66e02fd4153f91b3b506fcb985f
|
7
|
+
data.tar.gz: 5416faffa9ba9a6550989f1d21fb7d54adfa1f50fe5d4f96040aaff4de1c0f22dcc4c3128731ae5602dd56733429a9f9164003777ebd9a0629d88f3c9c23a187
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,89 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v5.0.0.pre3](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre3) (2021-08-22)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre2...v5.0.0.pre3)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- redirect\_to operation [\#144](https://github.com/stimulusreflex/cable_ready/pull/144) ([leastbad](https://github.com/leastbad))
|
10
|
+
- RFC simplifed JSON payload + named batches [\#142](https://github.com/stimulusreflex/cable_ready/pull/142) ([leastbad](https://github.com/leastbad))
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Bump path-parse from 1.0.6 to 1.0.7 [\#143](https://github.com/stimulusreflex/cable_ready/pull/143) ([dependabot[bot]](https://github.com/apps/dependabot))
|
15
|
+
|
16
|
+
## [v5.0.0.pre2](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre2) (2021-07-21)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre1...v5.0.0.pre2)
|
19
|
+
|
20
|
+
**Implemented enhancements:**
|
21
|
+
|
22
|
+
- register a CableReady JSON MIME type [\#140](https://github.com/stimulusreflex/cable_ready/pull/140) ([existentialmutt](https://github.com/existentialmutt))
|
23
|
+
- Smart options \(they grow up so fast\) [\#136](https://github.com/stimulusreflex/cable_ready/pull/136) ([leastbad](https://github.com/leastbad))
|
24
|
+
- Support `to_dom_selector` for operation selectors [\#135](https://github.com/stimulusreflex/cable_ready/pull/135) ([jaredcwhite](https://github.com/jaredcwhite))
|
25
|
+
- dom\_id should always be lowercase [\#129](https://github.com/stimulusreflex/cable_ready/pull/129) ([leastbad](https://github.com/leastbad))
|
26
|
+
|
27
|
+
**Fixed bugs:**
|
28
|
+
|
29
|
+
- Improve install experience [\#128](https://github.com/stimulusreflex/cable_ready/pull/128) ([leastbad](https://github.com/leastbad))
|
30
|
+
|
31
|
+
**Closed issues:**
|
32
|
+
|
33
|
+
- Idea: ability to pass any object which responds to `to_dom_selector` as a selector [\#134](https://github.com/stimulusreflex/cable_ready/issues/134)
|
34
|
+
|
35
|
+
**Merged pull requests:**
|
36
|
+
|
37
|
+
- Bump addressable from 2.7.0 to 2.8.0 [\#141](https://github.com/stimulusreflex/cable_ready/pull/141) ([dependabot[bot]](https://github.com/apps/dependabot))
|
38
|
+
- chore: make webpack happy with no sideEffects [\#138](https://github.com/stimulusreflex/cable_ready/pull/138) ([ParamagicDev](https://github.com/ParamagicDev))
|
39
|
+
|
40
|
+
## [v5.0.0.pre1](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre1) (2021-06-02)
|
41
|
+
|
42
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre0...v5.0.0.pre1)
|
43
|
+
|
44
|
+
**Merged pull requests:**
|
45
|
+
|
46
|
+
- Include app folder in release [\#133](https://github.com/stimulusreflex/cable_ready/pull/133) ([julianrubisch](https://github.com/julianrubisch))
|
47
|
+
|
48
|
+
## [v5.0.0.pre0](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre0) (2021-05-20)
|
49
|
+
|
50
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v4.5.0...v5.0.0.pre0)
|
51
|
+
|
52
|
+
**Implemented enhancements:**
|
53
|
+
|
54
|
+
- console\_table operation [\#125](https://github.com/stimulusreflex/cable_ready/pull/125) ([leastbad](https://github.com/leastbad))
|
55
|
+
- Introduce `OperationStore` to add operations on-the-fly [\#124](https://github.com/stimulusreflex/cable_ready/pull/124) ([marcoroth](https://github.com/marcoroth))
|
56
|
+
- cable\_car aka 'Ajax mode' [\#108](https://github.com/stimulusreflex/cable_ready/pull/108) ([leastbad](https://github.com/leastbad))
|
57
|
+
- chainable selectors [\#107](https://github.com/stimulusreflex/cable_ready/pull/107) ([leastbad](https://github.com/leastbad))
|
58
|
+
|
59
|
+
**Closed issues:**
|
60
|
+
|
61
|
+
- Warning in Ruby 3.0 [\#113](https://github.com/stimulusreflex/cable_ready/issues/113)
|
62
|
+
- play\_sound operation hijacks sound controls [\#111](https://github.com/stimulusreflex/cable_ready/issues/111)
|
63
|
+
- Provide a CableReady channel generator [\#94](https://github.com/stimulusreflex/cable_ready/issues/94)
|
64
|
+
- Jest Error [\#85](https://github.com/stimulusreflex/cable_ready/issues/85)
|
65
|
+
- Event Dispatch: help with serialization [\#59](https://github.com/stimulusreflex/cable_ready/issues/59)
|
66
|
+
|
67
|
+
**Merged pull requests:**
|
68
|
+
|
69
|
+
- Remove warning message for already registered custom element [\#126](https://github.com/stimulusreflex/cable_ready/pull/126) ([marcoroth](https://github.com/marcoroth))
|
70
|
+
- Bump lodash from 4.17.20 to 4.17.21 [\#123](https://github.com/stimulusreflex/cable_ready/pull/123) ([dependabot[bot]](https://github.com/apps/dependabot))
|
71
|
+
- Bump handlebars from 4.7.6 to 4.7.7 [\#122](https://github.com/stimulusreflex/cable_ready/pull/122) ([dependabot[bot]](https://github.com/apps/dependabot))
|
72
|
+
- Bump actionpack from 6.1.3.1 to 6.1.3.2 [\#121](https://github.com/stimulusreflex/cable_ready/pull/121) ([dependabot[bot]](https://github.com/apps/dependabot))
|
73
|
+
- Bump rexml from 3.2.4 to 3.2.5 [\#120](https://github.com/stimulusreflex/cable_ready/pull/120) ([dependabot[bot]](https://github.com/apps/dependabot))
|
74
|
+
- broadcast\_later [\#119](https://github.com/stimulusreflex/cable_ready/pull/119) ([julianrubisch](https://github.com/julianrubisch))
|
75
|
+
- set\_meta operation [\#117](https://github.com/stimulusreflex/cable_ready/pull/117) ([leastbad](https://github.com/leastbad))
|
76
|
+
- Setup better finalizer [\#116](https://github.com/stimulusreflex/cable_ready/pull/116) ([hopsoft](https://github.com/hopsoft))
|
77
|
+
- Bump activerecord from 6.1.1 to 6.1.3 [\#115](https://github.com/stimulusreflex/cable_ready/pull/115) ([dependabot[bot]](https://github.com/apps/dependabot))
|
78
|
+
- Bump actionpack from 6.1.1 to 6.1.3 [\#114](https://github.com/stimulusreflex/cable_ready/pull/114) ([dependabot[bot]](https://github.com/apps/dependabot))
|
79
|
+
- sound opt-in [\#112](https://github.com/stimulusreflex/cable_ready/pull/112) ([leastbad](https://github.com/leastbad))
|
80
|
+
- before -\> operate -\> after [\#110](https://github.com/stimulusreflex/cable_ready/pull/110) ([leastbad](https://github.com/leastbad))
|
81
|
+
- restructure client [\#109](https://github.com/stimulusreflex/cable_ready/pull/109) ([leastbad](https://github.com/leastbad))
|
82
|
+
- undefined no more [\#106](https://github.com/stimulusreflex/cable_ready/pull/106) ([leastbad](https://github.com/leastbad))
|
83
|
+
- sanity check + initializer generator [\#105](https://github.com/stimulusreflex/cable_ready/pull/105) ([leastbad](https://github.com/leastbad))
|
84
|
+
- stream\_from [\#104](https://github.com/stimulusreflex/cable_ready/pull/104) ([leastbad](https://github.com/leastbad))
|
85
|
+
- Channel generator [\#95](https://github.com/stimulusreflex/cable_ready/pull/95) ([julianrubisch](https://github.com/julianrubisch))
|
86
|
+
|
3
87
|
## [v4.5.0](https://github.com/stimulusreflex/cable_ready/tree/v4.5.0) (2021-01-26)
|
4
88
|
|
5
89
|
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v4.4.6...v4.5.0)
|
@@ -28,8 +112,6 @@
|
|
28
112
|
- pluggable before/after morph callbacks [\#87](https://github.com/stimulusreflex/cable_ready/pull/87) ([leastbad](https://github.com/leastbad))
|
29
113
|
- Add more detail to the CableReady error message [\#84](https://github.com/stimulusreflex/cable_ready/pull/84) ([marcoroth](https://github.com/marcoroth))
|
30
114
|
|
31
|
-
# Changelog
|
32
|
-
|
33
115
|
## [v4.4.5](https://github.com/stimulusreflex/cable_ready/tree/v4.4.5) (2020-12-13)
|
34
116
|
|
35
117
|
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v4.4.4...v4.4.5)
|
@@ -186,6 +268,8 @@
|
|
186
268
|
- Support for multiple CSS classes. [\#49](https://github.com/stimulusreflex/cable_ready/pull/49) ([sarriagada](https://github.com/sarriagada))
|
187
269
|
- Make morph emit after event [\#48](https://github.com/stimulusreflex/cable_ready/pull/48) ([julianrubisch](https://github.com/julianrubisch))
|
188
270
|
- Customize operations via initializer [\#47](https://github.com/stimulusreflex/cable_ready/pull/47) ([leastbad](https://github.com/leastbad))
|
271
|
+
- Correct method 'outerHtml' to 'outer\_html' in documentation [\#39](https://github.com/stimulusreflex/cable_ready/pull/39) ([pskarlas](https://github.com/pskarlas))
|
272
|
+
- Add setStyles [\#37](https://github.com/stimulusreflex/cable_ready/pull/37) ([excid3](https://github.com/excid3))
|
189
273
|
- Fix typo in method name outerHTML -\> outer\_html [\#35](https://github.com/stimulusreflex/cable_ready/pull/35) ([back2war](https://github.com/back2war))
|
190
274
|
|
191
275
|
## [v4.2.0](https://github.com/stimulusreflex/cable_ready/tree/v4.2.0) (2020-06-02)
|
@@ -199,9 +283,7 @@
|
|
199
283
|
**Merged pull requests:**
|
200
284
|
|
201
285
|
- after-outer-html emitted from new element [\#46](https://github.com/stimulusreflex/cable_ready/pull/46) ([leastbad](https://github.com/leastbad))
|
202
|
-
- Fix `
|
203
|
-
- Correct method 'outerHtml' to 'outer\_html' in documentation [\#39](https://github.com/stimulusreflex/cable_ready/pull/39) ([pskarlas](https://github.com/pskarlas))
|
204
|
-
- Add setStyles [\#37](https://github.com/stimulusreflex/cable_ready/pull/37) ([excid3](https://github.com/excid3))
|
286
|
+
- Fix `outer_html` notation [\#45](https://github.com/stimulusreflex/cable_ready/pull/45) ([julianrubisch](https://github.com/julianrubisch))
|
205
287
|
- Print out the selector for easier debugging perform errors [\#36](https://github.com/stimulusreflex/cable_ready/pull/36) ([excid3](https://github.com/excid3))
|
206
288
|
- add set\_property method to library [\#34](https://github.com/stimulusreflex/cable_ready/pull/34) ([leastbad](https://github.com/leastbad))
|
207
289
|
|
@@ -404,7 +486,4 @@
|
|
404
486
|
|
405
487
|
|
406
488
|
|
407
|
-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
408
|
-
|
409
|
-
|
410
489
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
@@ -1,113 +1,123 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (5.0.0.
|
4
|
+
cable_ready (5.0.0.pre4)
|
5
5
|
rails (>= 5.2)
|
6
6
|
thread-local (>= 1.1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.1.
|
12
|
-
actionpack (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
11
|
+
actioncable (6.1.4.1)
|
12
|
+
actionpack (= 6.1.4.1)
|
13
|
+
activesupport (= 6.1.4.1)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.1.
|
17
|
-
actionpack (= 6.1.
|
18
|
-
activejob (= 6.1.
|
19
|
-
activerecord (= 6.1.
|
20
|
-
activestorage (= 6.1.
|
21
|
-
activesupport (= 6.1.
|
16
|
+
actionmailbox (6.1.4.1)
|
17
|
+
actionpack (= 6.1.4.1)
|
18
|
+
activejob (= 6.1.4.1)
|
19
|
+
activerecord (= 6.1.4.1)
|
20
|
+
activestorage (= 6.1.4.1)
|
21
|
+
activesupport (= 6.1.4.1)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.1.
|
24
|
-
actionpack (= 6.1.
|
25
|
-
actionview (= 6.1.
|
26
|
-
activejob (= 6.1.
|
27
|
-
activesupport (= 6.1.
|
23
|
+
actionmailer (6.1.4.1)
|
24
|
+
actionpack (= 6.1.4.1)
|
25
|
+
actionview (= 6.1.4.1)
|
26
|
+
activejob (= 6.1.4.1)
|
27
|
+
activesupport (= 6.1.4.1)
|
28
28
|
mail (~> 2.5, >= 2.5.4)
|
29
29
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.1.
|
31
|
-
actionview (= 6.1.
|
32
|
-
activesupport (= 6.1.
|
30
|
+
actionpack (6.1.4.1)
|
31
|
+
actionview (= 6.1.4.1)
|
32
|
+
activesupport (= 6.1.4.1)
|
33
33
|
rack (~> 2.0, >= 2.0.9)
|
34
34
|
rack-test (>= 0.6.3)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.1.
|
38
|
-
actionpack (= 6.1.
|
39
|
-
activerecord (= 6.1.
|
40
|
-
activestorage (= 6.1.
|
41
|
-
activesupport (= 6.1.
|
37
|
+
actiontext (6.1.4.1)
|
38
|
+
actionpack (= 6.1.4.1)
|
39
|
+
activerecord (= 6.1.4.1)
|
40
|
+
activestorage (= 6.1.4.1)
|
41
|
+
activesupport (= 6.1.4.1)
|
42
42
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.1.
|
44
|
-
activesupport (= 6.1.
|
43
|
+
actionview (6.1.4.1)
|
44
|
+
activesupport (= 6.1.4.1)
|
45
45
|
builder (~> 3.1)
|
46
46
|
erubi (~> 1.4)
|
47
47
|
rails-dom-testing (~> 2.0)
|
48
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.1.
|
50
|
-
activesupport (= 6.1.
|
49
|
+
activejob (6.1.4.1)
|
50
|
+
activesupport (= 6.1.4.1)
|
51
51
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.1.
|
53
|
-
activesupport (= 6.1.
|
54
|
-
activerecord (6.1.
|
55
|
-
activemodel (= 6.1.
|
56
|
-
activesupport (= 6.1.
|
57
|
-
activestorage (6.1.
|
58
|
-
actionpack (= 6.1.
|
59
|
-
activejob (= 6.1.
|
60
|
-
activerecord (= 6.1.
|
61
|
-
activesupport (= 6.1.
|
52
|
+
activemodel (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
|
+
activerecord (6.1.4.1)
|
55
|
+
activemodel (= 6.1.4.1)
|
56
|
+
activesupport (= 6.1.4.1)
|
57
|
+
activestorage (6.1.4.1)
|
58
|
+
actionpack (= 6.1.4.1)
|
59
|
+
activejob (= 6.1.4.1)
|
60
|
+
activerecord (= 6.1.4.1)
|
61
|
+
activesupport (= 6.1.4.1)
|
62
62
|
marcel (~> 1.0.0)
|
63
|
-
mini_mime (
|
64
|
-
activesupport (6.1.
|
63
|
+
mini_mime (>= 1.1.0)
|
64
|
+
activesupport (6.1.4.1)
|
65
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
66
|
i18n (>= 1.6, < 2)
|
67
67
|
minitest (>= 5.1)
|
68
68
|
tzinfo (~> 2.0)
|
69
69
|
zeitwerk (~> 2.3)
|
70
|
-
addressable (2.
|
70
|
+
addressable (2.8.0)
|
71
71
|
public_suffix (>= 2.0.2, < 5.0)
|
72
72
|
ast (2.4.2)
|
73
|
-
async (1.
|
73
|
+
async (1.30.1)
|
74
74
|
console (~> 1.10)
|
75
75
|
nio4r (~> 2.3)
|
76
76
|
timers (~> 4.1)
|
77
|
-
async-http (0.56.
|
78
|
-
async (
|
79
|
-
async-io (
|
80
|
-
async-pool (
|
77
|
+
async-http (0.56.5)
|
78
|
+
async (>= 1.25)
|
79
|
+
async-io (>= 1.28)
|
80
|
+
async-pool (>= 0.2)
|
81
81
|
protocol-http (~> 0.22.0)
|
82
82
|
protocol-http1 (~> 0.14.0)
|
83
83
|
protocol-http2 (~> 0.14.0)
|
84
|
-
async-http-faraday (0.
|
84
|
+
async-http-faraday (0.11.0)
|
85
85
|
async-http (~> 0.42)
|
86
86
|
faraday
|
87
|
-
async-io (1.
|
88
|
-
async
|
89
|
-
async-pool (0.3.
|
90
|
-
async (
|
87
|
+
async-io (1.32.2)
|
88
|
+
async
|
89
|
+
async-pool (0.3.8)
|
90
|
+
async (>= 1.25)
|
91
91
|
builder (3.2.4)
|
92
92
|
coderay (1.1.3)
|
93
|
-
concurrent-ruby (1.1.
|
94
|
-
console (1.
|
93
|
+
concurrent-ruby (1.1.9)
|
94
|
+
console (1.13.1)
|
95
95
|
fiber-local
|
96
96
|
crass (1.0.6)
|
97
97
|
erubi (1.10.0)
|
98
|
-
faraday (1.
|
98
|
+
faraday (1.7.0)
|
99
|
+
faraday-em_http (~> 1.0)
|
100
|
+
faraday-em_synchrony (~> 1.0)
|
99
101
|
faraday-excon (~> 1.1)
|
102
|
+
faraday-httpclient (~> 1.0.1)
|
100
103
|
faraday-net_http (~> 1.0)
|
101
104
|
faraday-net_http_persistent (~> 1.1)
|
105
|
+
faraday-patron (~> 1.0)
|
106
|
+
faraday-rack (~> 1.0)
|
102
107
|
multipart-post (>= 1.2, < 3)
|
103
108
|
ruby2_keywords (>= 0.0.4)
|
109
|
+
faraday-em_http (1.0.0)
|
110
|
+
faraday-em_synchrony (1.0.0)
|
104
111
|
faraday-excon (1.1.0)
|
105
112
|
faraday-http-cache (2.2.0)
|
106
113
|
faraday (>= 0.8)
|
114
|
+
faraday-httpclient (1.0.1)
|
107
115
|
faraday-net_http (1.0.1)
|
108
|
-
faraday-net_http_persistent (1.
|
116
|
+
faraday-net_http_persistent (1.2.0)
|
117
|
+
faraday-patron (1.0.0)
|
118
|
+
faraday-rack (1.0.0)
|
109
119
|
fiber-local (1.0.0)
|
110
|
-
github_changelog_generator (1.16.
|
120
|
+
github_changelog_generator (1.16.4)
|
111
121
|
activesupport
|
112
122
|
async (>= 1.25.0)
|
113
123
|
async-http-faraday
|
@@ -116,12 +126,11 @@ GEM
|
|
116
126
|
octokit (~> 4.6)
|
117
127
|
rainbow (>= 2.2.1)
|
118
128
|
rake (>= 10.0)
|
119
|
-
|
120
|
-
|
121
|
-
activesupport (>= 4.2.0)
|
129
|
+
globalid (0.5.2)
|
130
|
+
activesupport (>= 5.0)
|
122
131
|
i18n (1.8.10)
|
123
132
|
concurrent-ruby (~> 1.0)
|
124
|
-
loofah (2.
|
133
|
+
loofah (2.12.0)
|
125
134
|
crass (~> 1.0.2)
|
126
135
|
nokogiri (>= 1.5.9)
|
127
136
|
magic_frozen_string_literal (1.2.0)
|
@@ -129,24 +138,22 @@ GEM
|
|
129
138
|
mini_mime (>= 0.1.1)
|
130
139
|
marcel (1.0.1)
|
131
140
|
method_source (0.9.2)
|
132
|
-
mini_mime (1.
|
133
|
-
mini_portile2 (2.5.1)
|
141
|
+
mini_mime (1.1.1)
|
134
142
|
minitest (5.14.4)
|
135
|
-
mocha (1.
|
143
|
+
mocha (1.13.0)
|
136
144
|
multi_json (1.15.0)
|
137
145
|
multipart-post (2.1.1)
|
138
|
-
nio4r (2.5.
|
139
|
-
nokogiri (1.
|
140
|
-
mini_portile2 (~> 2.5.0)
|
146
|
+
nio4r (2.5.8)
|
147
|
+
nokogiri (1.12.5-x86_64-linux)
|
141
148
|
racc (~> 1.4)
|
142
149
|
octokit (4.21.0)
|
143
150
|
faraday (>= 0.9)
|
144
151
|
sawyer (~> 0.8.0, >= 0.5.3)
|
145
152
|
parallel (1.20.1)
|
146
|
-
parser (3.0.
|
153
|
+
parser (3.0.2.0)
|
147
154
|
ast (~> 2.4.1)
|
148
155
|
protocol-hpack (1.4.2)
|
149
|
-
protocol-http (0.22.
|
156
|
+
protocol-http (0.22.5)
|
150
157
|
protocol-http1 (0.14.1)
|
151
158
|
protocol-http (~> 0.22)
|
152
159
|
protocol-http2 (0.14.2)
|
@@ -162,53 +169,52 @@ GEM
|
|
162
169
|
rack (2.2.3)
|
163
170
|
rack-test (1.1.0)
|
164
171
|
rack (>= 1.0, < 3)
|
165
|
-
rails (6.1.
|
166
|
-
actioncable (= 6.1.
|
167
|
-
actionmailbox (= 6.1.
|
168
|
-
actionmailer (= 6.1.
|
169
|
-
actionpack (= 6.1.
|
170
|
-
actiontext (= 6.1.
|
171
|
-
actionview (= 6.1.
|
172
|
-
activejob (= 6.1.
|
173
|
-
activemodel (= 6.1.
|
174
|
-
activerecord (= 6.1.
|
175
|
-
activestorage (= 6.1.
|
176
|
-
activesupport (= 6.1.
|
172
|
+
rails (6.1.4.1)
|
173
|
+
actioncable (= 6.1.4.1)
|
174
|
+
actionmailbox (= 6.1.4.1)
|
175
|
+
actionmailer (= 6.1.4.1)
|
176
|
+
actionpack (= 6.1.4.1)
|
177
|
+
actiontext (= 6.1.4.1)
|
178
|
+
actionview (= 6.1.4.1)
|
179
|
+
activejob (= 6.1.4.1)
|
180
|
+
activemodel (= 6.1.4.1)
|
181
|
+
activerecord (= 6.1.4.1)
|
182
|
+
activestorage (= 6.1.4.1)
|
183
|
+
activesupport (= 6.1.4.1)
|
177
184
|
bundler (>= 1.15.0)
|
178
|
-
railties (= 6.1.
|
185
|
+
railties (= 6.1.4.1)
|
179
186
|
sprockets-rails (>= 2.0.0)
|
180
187
|
rails-dom-testing (2.0.3)
|
181
188
|
activesupport (>= 4.2.0)
|
182
189
|
nokogiri (>= 1.6)
|
183
|
-
rails-html-sanitizer (1.
|
190
|
+
rails-html-sanitizer (1.4.2)
|
184
191
|
loofah (~> 2.3)
|
185
|
-
railties (6.1.
|
186
|
-
actionpack (= 6.1.
|
187
|
-
activesupport (= 6.1.
|
192
|
+
railties (6.1.4.1)
|
193
|
+
actionpack (= 6.1.4.1)
|
194
|
+
activesupport (= 6.1.4.1)
|
188
195
|
method_source
|
189
|
-
rake (>= 0.
|
196
|
+
rake (>= 0.13)
|
190
197
|
thor (~> 1.0)
|
191
198
|
rainbow (3.0.0)
|
192
|
-
rake (13.0.
|
199
|
+
rake (13.0.6)
|
193
200
|
regexp_parser (2.1.1)
|
194
|
-
retriable (3.1.2)
|
195
201
|
rexml (3.2.5)
|
196
|
-
rubocop (1.
|
202
|
+
rubocop (1.18.4)
|
197
203
|
parallel (~> 1.10)
|
198
204
|
parser (>= 3.0.0.0)
|
199
205
|
rainbow (>= 2.2.2, < 4.0)
|
200
206
|
regexp_parser (>= 1.8, < 3.0)
|
201
207
|
rexml
|
202
|
-
rubocop-ast (>= 1.
|
208
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
203
209
|
ruby-progressbar (~> 1.7)
|
204
210
|
unicode-display_width (>= 1.4.0, < 3.0)
|
205
|
-
rubocop-ast (1.
|
211
|
+
rubocop-ast (1.10.0)
|
206
212
|
parser (>= 3.0.1.1)
|
207
|
-
rubocop-performance (1.11.
|
213
|
+
rubocop-performance (1.11.4)
|
208
214
|
rubocop (>= 1.7.0, < 2.0)
|
209
215
|
rubocop-ast (>= 0.4.0)
|
210
216
|
ruby-progressbar (1.11.0)
|
211
|
-
ruby2_keywords (0.0.
|
217
|
+
ruby2_keywords (0.0.5)
|
212
218
|
sawyer (0.8.2)
|
213
219
|
addressable (>= 2.3.5)
|
214
220
|
faraday (> 0.8, < 2.0)
|
@@ -219,9 +225,10 @@ GEM
|
|
219
225
|
actionpack (>= 4.0)
|
220
226
|
activesupport (>= 4.0)
|
221
227
|
sprockets (>= 3.0.0)
|
222
|
-
|
223
|
-
|
224
|
-
rubocop
|
228
|
+
sqlite3 (1.4.2)
|
229
|
+
standard (1.1.7)
|
230
|
+
rubocop (= 1.18.4)
|
231
|
+
rubocop-performance (= 1.11.4)
|
225
232
|
standardrb (1.0.0)
|
226
233
|
standard
|
227
234
|
thor (1.1.0)
|
@@ -230,7 +237,7 @@ GEM
|
|
230
237
|
tzinfo (2.0.4)
|
231
238
|
concurrent-ruby (~> 1.0)
|
232
239
|
unicode-display_width (2.0.0)
|
233
|
-
websocket-driver (0.7.
|
240
|
+
websocket-driver (0.7.5)
|
234
241
|
websocket-extensions (>= 0.1.0)
|
235
242
|
websocket-extensions (0.1.5)
|
236
243
|
zeitwerk (2.4.2)
|
@@ -246,7 +253,8 @@ DEPENDENCIES
|
|
246
253
|
pry
|
247
254
|
pry-nav
|
248
255
|
rake
|
256
|
+
sqlite3
|
249
257
|
standardrb
|
250
258
|
|
251
259
|
BUNDLED WITH
|
252
|
-
2.2.
|
260
|
+
2.2.19
|
data/README.md
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
<img src="https://gitcdn.link/repo/stimulusreflex/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
|
3
3
|
<h1 align="center">Welcome to CableReady 👋</h1>
|
4
4
|
<p align="center">
|
5
|
-
<
|
6
|
-
|
5
|
+
<a href="https://rubygems.org/gems/cable_ready">
|
6
|
+
<img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" />
|
7
|
+
</a>
|
8
|
+
<a href="https://www.npmjs.com/package/cable_ready">
|
9
|
+
<img src="https://img.shields.io/npm/v/cable_ready.svg?color=blue" />
|
10
|
+
</a>
|
7
11
|
<a href="https://www.npmjs.com/package/cable_ready">
|
8
12
|
<img alt="downloads" src="https://img.shields.io/npm/dm/cable_ready.svg?color=blue" target="_blank" />
|
9
13
|
</a>
|
@@ -79,10 +83,10 @@ Please run `./bin/standardize` prior submitting pull requests.
|
|
79
83
|
### 📦 Releasing
|
80
84
|
|
81
85
|
1. Bump version number at `lib/cable_ready/version.rb`
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
+
2. Run `rake build`
|
87
|
+
3. Run `rake release`
|
88
|
+
4. Run `yarn publish --no-git-tag-version`
|
89
|
+
5. Commit and push changes to the `package.json` file
|
86
90
|
|
87
91
|
## 📝 License
|
88
92
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CableReady
|
4
|
+
class Stream < ActionCable::Channel::Base
|
5
|
+
include CableReady::StreamIdentifier
|
6
|
+
|
7
|
+
def subscribed
|
8
|
+
locator = verified_stream_identifier(params[:identifier])
|
9
|
+
locator.present? ? stream_from(locator) : reject
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CableReadyHelper
|
4
|
+
include CableReady::Compoundable
|
5
|
+
include CableReady::StreamIdentifier
|
6
|
+
|
7
|
+
def stream_from(*keys, html_options: {})
|
8
|
+
tag.stream_from(**build_options(*keys, html_options))
|
9
|
+
end
|
10
|
+
|
11
|
+
def updates_for(*keys, url: nil, debounce: nil, html_options: {}, &block)
|
12
|
+
options = build_options(*keys, html_options)
|
13
|
+
options[:url] = url if url
|
14
|
+
options[:debounce] = debounce if debounce
|
15
|
+
tag.updates_for(**options) { capture(&block) }
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def build_options(*keys, html_options)
|
21
|
+
keys.select!(&:itself)
|
22
|
+
{identifier: signed_stream_identifier(compound(keys))}.merge(html_options)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CableReadyBroadcastJob < (defined?(ActiveJob::Base) ? ActiveJob::Base : Object)
|
4
|
+
include CableReady::Broadcaster
|
5
|
+
queue_as :default if defined?(ActiveJob::Base)
|
6
|
+
|
7
|
+
def perform(identifier:, operations:, model: nil)
|
8
|
+
if model.present?
|
9
|
+
cable_ready[identifier.safe_constantize].apply!(operations).broadcast_to(model)
|
10
|
+
else
|
11
|
+
cable_ready[identifier].apply!(operations).broadcast
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CableReady
|
2
|
+
module Updatable
|
3
|
+
class CollectionUpdatableCallbacks
|
4
|
+
def initialize(operation)
|
5
|
+
@operation = operation
|
6
|
+
end
|
7
|
+
|
8
|
+
def after_commit(model)
|
9
|
+
update_collections(model)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def update_collections(model)
|
15
|
+
model.class.cable_ready_collections.broadcast_for!(model, @operation)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module CableReady
|
2
|
+
module Updatable
|
3
|
+
class CollectionsRegistry
|
4
|
+
def initialize
|
5
|
+
@registered_collections = []
|
6
|
+
end
|
7
|
+
|
8
|
+
def register(collection)
|
9
|
+
@registered_collections << collection
|
10
|
+
end
|
11
|
+
|
12
|
+
def broadcast_for!(model, operation)
|
13
|
+
@registered_collections.select { |c| c[:options][:on].include?(operation) }
|
14
|
+
.each do |collection|
|
15
|
+
resource = find_resource_for_update(collection, model)
|
16
|
+
next if resource.nil?
|
17
|
+
|
18
|
+
collection[:klass].cable_ready_update_collection(resource, collection[:name]) if collection[:options][:if].call(resource)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def find_resource_for_update(collection, model)
|
25
|
+
raise ArgumentError, "Could not find inverse_of for #{collection[:name]}" unless collection[:inverse_association]
|
26
|
+
|
27
|
+
resource = model
|
28
|
+
resource = resource.send(collection[:through_association].underscore) if collection[:through_association]
|
29
|
+
resource.send(collection[:inverse_association].underscore)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module CableReady
|
2
|
+
module Updatable
|
3
|
+
class ModelUpdatableCallbacks
|
4
|
+
def initialize(operation, enabled_operations = %i[create update destroy])
|
5
|
+
@operation = operation
|
6
|
+
@enabled_operations = enabled_operations
|
7
|
+
end
|
8
|
+
|
9
|
+
def after_commit(model)
|
10
|
+
return unless @enabled_operations.include?(@operation)
|
11
|
+
|
12
|
+
send("broadcast_#{@operation}", model)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def broadcast_create(model)
|
18
|
+
ActionCable.server.broadcast(model.class, {})
|
19
|
+
end
|
20
|
+
alias_method :broadcast_destroy, :broadcast_create
|
21
|
+
|
22
|
+
def broadcast_update(model)
|
23
|
+
ActionCable.server.broadcast(model.class, {})
|
24
|
+
ActionCable.server.broadcast(model.to_global_id, {})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|