yrby-rails 0.8.0 → 0.9.0

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: 83a5440fa6532dbedcf992660959297611b9b7cf958f7c7c6c1522dd0ac162b0
4
- data.tar.gz: 23509b37d1bb0ce706c648a779993236addb244cb603031415de4084a58e4636
3
+ metadata.gz: 56e31c8cc1697d3894702fdfff977817fe1c22bb95318718dd3b0940171ed74f
4
+ data.tar.gz: 2a3a49d17af5c0d690ab98ca0c3bf6f41f7c79d0a9b6041f3dd49b98f0829e84
5
5
  SHA512:
6
- metadata.gz: c51b2e0b9acefc89d6c69e3b935206d195ccaba7b302ec13316c39f7fab0115d09fd7a5d108f537294b8c069a54ef2e1a53fc19b39ec21873e7b61be866e7a5d
7
- data.tar.gz: 5ffd94a472cd16ada77f62e57c7bd571f7df461a9552756212ef6fd12c9c1a2cb92bdb3ac72fe0320a1992d27f6b22ce8964240db81057ffaaa4cc2be1872124
6
+ metadata.gz: 148304e573708e6ace7234f5de8ecde4020fa8139f4daf8284598b6a6c79f478791c342dc7b70ab91e4d65e9bbf11eb4dc88a82ea364c027d44714337228a9a7
7
+ data.tar.gz: 9b929e7b58b7524052bb18026aee2ec7a90d82b22fd8d0eb3b61275d4c912da416a3a442121a516643da8621984ff06e843f3405ad74eb64766e14005c00893b
data/CHANGELOG-rails.md CHANGED
@@ -7,6 +7,34 @@ this project aims to follow [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2026-11-09
11
+
12
+ Requires yrby 0.9.0 or later.
13
+
14
+ ### Security
15
+
16
+ - `Y::ActionCable::Sync`'s methods and `Y::DocumentChannel`'s
17
+ `authorized_document_key` accessors are private. Action Cable treats a
18
+ channel's public methods as actions a client can call, so a client could call
19
+ `sync_subscribed` directly and skip the channel's own `subscribed` and
20
+ `receive`. Channels that call these from `subscribed` and `receive` keep
21
+ working. Code that calls them on a channel from outside, such as a test, now
22
+ needs `send`.
23
+
24
+ ### Added
25
+
26
+ - `bin/rails generate yrby:install` pins `yrby-client`, `yrby-client/element`,
27
+ `yjs`, and `@rails/actioncable` when the app has `config/importmap.rb`. The
28
+ gem ships `yrby/yrby-client.js` and `yrby/yjs.js` for those pins, so an
29
+ import-map app needs no npm packages. Each shared module has one pin, so the
30
+ page and its editor binding load one copy of yjs. Pins the app already has
31
+ are left alone.
32
+ - `has_collaborative_document :body, channel: "PostDocumentChannel"` names
33
+ an app's own `Y::DocumentChannel` subclass for an attribute.
34
+ `collaborative_document(:body).channel` returns it, so
35
+ `collaborative_document_tag` and Ruby clients subscribe there without
36
+ passing `channel:` each time.
37
+
10
38
  ## [0.8.0] - 2026-11-03
11
39
 
12
40
  Requires yrby 0.9.0 or later.
data/README.md CHANGED
@@ -76,15 +76,21 @@ doc = post.collaborative_document(:body).y_doc
76
76
  doc.read_text("content") # or Y::Lexxy.new(doc).to_html for rich text
77
77
  ```
78
78
 
79
- Install the gem and the npm package:
79
+ Install the gem and run its generator:
80
80
 
81
81
  ```
82
- gem install yrby-rails # depends on yrby
83
- npm install yrby-client yjs y-protocols @rails/actioncable
84
-
82
+ bundle add yrby-rails # depends on yrby
85
83
  bin/rails generate yrby:install && bin/rails db:migrate
86
84
  ```
87
85
 
86
+ In an app that uses import maps, the generator pins `yrby-client`, `yjs`, and
87
+ `@rails/actioncable` to JavaScript the gem ships. With a bundler, install the
88
+ npm packages instead:
89
+
90
+ ```
91
+ npm install yrby-client yjs y-protocols @rails/actioncable
92
+ ```
93
+
88
94
  ## Contents
89
95
 
90
96
  - [Scope](#scope)
@@ -101,7 +107,7 @@ bin/rails generate yrby:install && bin/rails db:migrate
101
107
  - [Rendering to HTML](#rendering-to-html)
102
108
  - [Protocol codec (module functions)](#protocol-codec-module-functions)
103
109
  - [ActionCable Integration](#actioncable-integration)
104
- - [Experimental: writing from Ruby](#experimental-writing-from-ruby)
110
+ - [Experimental: writing from Ruby, and collaborators](#experimental-writing-from-ruby-and-collaborators)
105
111
  - [Thread Safety](#thread-safety)
106
112
  - [Parallelism (GVL release)](#parallelism-gvl-release)
107
113
  - [Message Type Constants](#message-type-constants)
@@ -664,6 +670,16 @@ the `authorize_document` block with the record and the attribute name, or to
664
670
  accept any valid grant when there's no block. A subclass can override
665
671
  `authorized?` directly and read the located record from `record`.
666
672
 
673
+ A page subscribes to the channel its document names, `Y::DocumentChannel`
674
+ unless the model says otherwise. Name a subclass where you declare the
675
+ attribute, and the tag, a Ruby client, and a collaborator all use it:
676
+
677
+ ```ruby
678
+ class Post < ApplicationRecord
679
+ has_collaborative_document :body, channel: "PostDocumentChannel"
680
+ end
681
+ ```
682
+
667
683
  ### Grant lifetime and refresh
668
684
 
669
685
  A grant lasts as long as GlobalID's signed-id default, which is one month under
@@ -1077,7 +1093,7 @@ The browser clients manage presence (cursors, selections). The server doesn't
1077
1093
  set or hold presence state, and it relays awareness frames without reading
1078
1094
  them. See `yrby-client` for the client-side awareness API.
1079
1095
 
1080
- ## Experimental: writing from Ruby
1096
+ ## Experimental: writing from Ruby, and collaborators
1081
1097
 
1082
1098
  These APIs are new. They may change in any minor release, and they aren't
1083
1099
  covered by yrby's usual compatibility promise.
@@ -1088,6 +1104,12 @@ covered by yrby's usual compatibility promise.
1088
1104
  - Anchors: a block's identity as a value
1089
1105
  - Streaming into a document with `Doc#edit`
1090
1106
  - Editing a record's document from Ruby
1107
+ - From the `yrby-agent` gem: joining a document from a Ruby process with
1108
+ `Y::ActionCable::Client`, collaborators with `Y::Collaborator`, and agents
1109
+ with `Y::Agent`
1110
+
1111
+ `require "y/action_cable/client"`, `require "y/collaborator"`, and
1112
+ `require "y/agent"` print a warning in Ruby's `:experimental` category. `Warning[:experimental] = false` turns it off.
1091
1113
 
1092
1114
  ## Thread Safety
1093
1115