storage(r2): build R2 list options via Object/Set for TinyGo parity

Construct the list() options with js.Global().Get("Object").New()+Set instead
of js.ValueOf(map[string]any), keeping the JS-interop surface identical to the
rest of the wasm build. No behavior change; wasm-only file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 15:27:31 -05:00
co-authored by Claude Opus 4.8
parent cb7d9c67a0
commit a03da6ede9
+8 -3
View File
@@ -66,11 +66,16 @@ func (s *R2Store) List(_ context.Context, prefix string) ([]string, error) {
var keys []string
cursor := ""
for {
opts := map[string]any{"prefix": prefix, "limit": 1000}
// Build the list options object with Object/Set (the idiom the syumai R2
// helpers use) rather than js.ValueOf(map), which keeps the JS-interop
// surface identical to the rest of the wasm build.
opts := js.Global().Get("Object").New()
opts.Set("prefix", prefix)
opts.Set("limit", 1000)
if cursor != "" {
opts["cursor"] = cursor
opts.Set("cursor", cursor)
}
res, err := await(s.binding.Call("list", js.ValueOf(opts)))
res, err := await(s.binding.Call("list", opts))
if err != nil {
return nil, err
}