wasmify-rails 0.1.4 → 0.1.5
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 +8 -0
- data/README.md +3 -0
- data/lib/active_record/connection_adapters/sqlite3_wasm_adapter.rb +33 -4
- data/lib/wasmify/rails/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: 0ec3282837b68355a92061618b21324e72476610f34c9a99538f7af28461836e
|
4
|
+
data.tar.gz: 195c3113bfa6d07d8e8f589739e415bbeff0518d5fb3248b8450c997c084fd4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3429caf51620abc60aa2de1ec5b0a81743e15cf95bfc2c39081c48e764e738ae7ec78a6bc8e3b44e0b213238593abf774dbd5a2260217d820e887f663d75c26e
|
7
|
+
data.tar.gz: 47907d81582be81de0e2ac6225d70356ca2157a42e627af19dde13dbbe2e59105736c953ac8e7d45acd49f1442423398256adb3a140c15a64f498c53134fad45
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
|
5
5
|
This gem provides tools and extensions to compile Rails applications to WebAssembly.
|
6
6
|
|
7
|
+
> [!NOTE]
|
8
|
+
> Read more in our handbook: [Rails on Wasm](https://writebook-on-wasm.fly.dev/5/ruby-on-rails-on-webassembly)
|
9
|
+
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Adding to your Gemfile:
|
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# Rails 8 compatibility
|
2
2
|
module SQLite3
|
3
|
-
class BusyException < StandardError
|
4
|
-
end
|
5
|
-
|
6
3
|
module ForkSafety
|
7
4
|
def self.suppress_warnings!
|
8
5
|
end
|
9
6
|
end
|
7
|
+
|
8
|
+
class BusyException < StandardError
|
9
|
+
end
|
10
10
|
end
|
11
11
|
|
12
12
|
require "active_record/connection_adapters/sqlite3_adapter"
|
@@ -44,6 +44,12 @@ module ActiveRecord
|
|
44
44
|
JS.global[js_interface].exec(...)
|
45
45
|
end
|
46
46
|
|
47
|
+
def execute_batch2(...)
|
48
|
+
# TODO: it's used by fixtures and truncate_all, so
|
49
|
+
# we don't need it right now
|
50
|
+
raise NotImplementedError, "sqlite3_wasm#execute_batch2 is not implemented yet"
|
51
|
+
end
|
52
|
+
|
47
53
|
def busy_timeout(...) = nil
|
48
54
|
|
49
55
|
def execute(sql)
|
@@ -195,6 +201,29 @@ module ActiveRecord
|
|
195
201
|
def database_exists? = true
|
196
202
|
|
197
203
|
def database_version = SQLite3Adapter::Version.new("3.45.1")
|
204
|
+
|
205
|
+
# Rails 8 interface
|
206
|
+
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false)
|
207
|
+
if batch
|
208
|
+
raw_connection.execute_batch2(sql)
|
209
|
+
elsif prepare
|
210
|
+
raise NotImplementedError, "sqlite3_wasm prepared statements are not implemented yet"
|
211
|
+
else
|
212
|
+
stmt = raw_connection.prepare(sql)
|
213
|
+
result =
|
214
|
+
if stmt.column_count.zero?
|
215
|
+
ActiveRecord::Result.empty
|
216
|
+
else
|
217
|
+
ActiveRecord::Result.new(stmt.columns, stmt.to_a)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
@last_affected_rows = raw_connection.changes
|
222
|
+
verified!
|
223
|
+
|
224
|
+
notification_payload[:row_count] = result&.length || 0
|
225
|
+
result
|
226
|
+
end
|
198
227
|
end
|
199
228
|
end
|
200
229
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasmify-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|