homura-runtime 0.2.14 → 0.2.16
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/lib/cloudflare_workers/version.rb +1 -1
- data/lib/cloudflare_workers.rb +12 -0
- data/lib/opal_patches.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 411bf1884ba07170427e2f1a905b2848c81e8de9d53caea247006c7d41377f3e
|
|
4
|
+
data.tar.gz: 83b2fc17572d59b4c93625553d2e46477e9df01161feaa76be41a8cb8e7acf5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d8fb86ad2a4aee75cc5c1864b954d04ac8bbda9fd4c10a1151076eeb0996db4eca85f59fcd25ae6721e060f409097a8a83856c30b57bc063e9145156973380e
|
|
7
|
+
data.tar.gz: 0a451bc7da52d28fd1d253bfe7b6885caa463b2f5790d53bbd2de0bc49f9ea7efe282c690a8131a0cc4fafa4dd720bc7f3571744280631acf5e423800343f3d5
|
data/lib/cloudflare_workers.rb
CHANGED
|
@@ -685,7 +685,19 @@ module Cloudflare
|
|
|
685
685
|
# Flatten common keys from `result['meta']` to the top of the hash so
|
|
686
686
|
# callers can write `meta['last_row_id']` without descending into the
|
|
687
687
|
# nested D1 metadata object. Preserves the original shape unchanged.
|
|
688
|
+
#
|
|
689
|
+
# The gem's own Ruby sources are NOT processed by the build's
|
|
690
|
+
# auto-await pass — only user app code is. So when `execute_insert`
|
|
691
|
+
# passes the result of `stmt.run` here, `result` may still be a JS
|
|
692
|
+
# Promise. Await it explicitly so the flatten branch actually runs;
|
|
693
|
+
# otherwise the early `unless result.is_a?(Hash)` would short-circuit
|
|
694
|
+
# and `meta['last_row_id']` would come back as nil at the call site
|
|
695
|
+
# (the caller's auto-await resolves the Promise *after* this method
|
|
696
|
+
# returns).
|
|
688
697
|
def self.flatten_meta(result)
|
|
698
|
+
if defined?(::Cloudflare) && ::Cloudflare.js_promise?(result)
|
|
699
|
+
result = result.__await__
|
|
700
|
+
end
|
|
689
701
|
return result unless result.is_a?(Hash)
|
|
690
702
|
nested = result['meta']
|
|
691
703
|
return result unless nested.is_a?(Hash)
|
data/lib/opal_patches.rb
CHANGED
|
@@ -456,10 +456,12 @@ module ::SecureRandom
|
|
|
456
456
|
padding ? s : s.delete('=')
|
|
457
457
|
end
|
|
458
458
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
459
|
+
# NOTE: `SecureRandom.random_number` is provided by `Random::Formatter`
|
|
460
|
+
# (extended into `SecureRandom` by stdlib/securerandom.rb). Defining a
|
|
461
|
+
# `self.random_number` stub here used to shadow that real implementation
|
|
462
|
+
# and pin the result to `0`, which silently broke any caller that did
|
|
463
|
+
# the canonical `format('%06d', SecureRandom.random_number(1_000_000))`.
|
|
464
|
+
# Leave the formatter implementation alone; do NOT redefine here.
|
|
463
465
|
|
|
464
466
|
# Returns a hex string of `n` random bytes, or nil when no entropy
|
|
465
467
|
# source is available. Tries node:crypto.randomBytes first (works
|