feat(provider): add Upstash Redis REST actions - #210
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Summary by CodeRabbit
WalkthroughAdds a complete Upstash Redis provider integration. It defines Redis actions for Sequence Diagram(s)sequenceDiagram
participant ProviderExecutor
participant RedisActionHandler
participant UpstashCommandExecutor
participant UpstashRESTAPI
ProviderExecutor->>RedisActionHandler: action input and context
RedisActionHandler->>UpstashCommandExecutor: Redis command array
UpstashCommandExecutor->>UpstashRESTAPI: authenticated POST request
UpstashRESTAPI-->>UpstashCommandExecutor: command result or error
UpstashCommandExecutor-->>RedisActionHandler: parsed and validated result
RedisActionHandler-->>ProviderExecutor: action output
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reading the SET payload with requiredString ran it through optionalString,
which trims and rejects whitespace-only input. Redis strings are opaque, so
a value such as a JSON document with a trailing newline was silently stored
without it while get read the stored bytes back untouched — set/get did not
round-trip inside the same provider. Read the payload with optionalRawString
so what reaches Redis is exactly what the caller sent.
Upstash reports quota and throttling as Redis errors inside a 400 response
("ERR max daily request limit exceeded", "ERR max concurrent connections
exceeded"), so those surfaced as invalid_input and no client backed off.
Detect them from the message and map them to 429/rate_limited.
Also drop three unreachable branches in createUpstashError (the documented
status set is 200/400/401/405, and the general return already yields the
same status for every 4xx), drop the dead hostname === "upstash.io" operand
that the ".upstash.io" suffix check already covers, name the createContext
return type, correct the read-only token description (Upstash blocks SCAN
for read-only tokens), and document that non-UTF-8 bytes come back as U+FFFD.
Summary / 概要
Changes / 改动内容
Add custom credentials with
estUrl and secret
estToken, validated through PING.
新增
estUrl 与敏感
estToken 凭据,并使用 PING 校验连接。
Add seven string-key actions: get, set, delete, exists, expire, tl, and single-page scan.
新增 7 个字符串键操作:get、set、delete、exists、expire、 tl 和单页 scan。
Support atomic SET key value [EX seconds] [NX|XX] writes and preserve Redis TTL semantics.
支持原子 SET key value [EX seconds] [NX|XX] 写入,并保留 Redis TTL 语义。
Restrict REST URLs to public https://*.upstash.io root endpoints and route requests through the injected SSRF-protected fetcher.
REST URL 仅允许公网 https://*.upstash.io 根路径端点,所有请求均使用注入的 SSRF 防护 Fetch。
Handle timeouts, cancellation, JSON response envelopes, upstream errors, and non-JSON error bodies while preserving relevant HTTP status codes.
处理超时、取消、JSON 响应包络、上游错误和非 JSON 错误响应,并保留关键 HTTP 状态码。
Validation / 验证
pm run typecheck
Notes / 说明
No npm dependencies or shared runtime changes were added.
未新增 npm 依赖,也未修改共享运行时。
package-lock.json is intentionally excluded because it is unrelated local user work.
package-lock.json 为无关的本地用户修改,未包含在本 PR 中。