Skip to content

feat(api): add proxy passthrough to OpenConnector#8

Merged
BlackHole1 merged 2 commits into
mainfrom
feat/open-connector-proxy
Jul 7, 2026
Merged

feat(api): add proxy passthrough to OpenConnector#8
BlackHole1 merged 2 commits into
mainfrom
feat/open-connector-proxy

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

The self-hosted open-connector backend gained a POST /v1/proxy/:service passthrough, so OpenConnector can finally offer the one call path it was still missing relative to the hosted Connector.

open.proxy<T>(service, req, options?) mirrors Connector.proxy: it reuses the shared ProxyRequest/ProxyResponse types and the same connectionNamex-oo-connector-alias selector, and proxy joins the reserved members so a service id that collides with it only loses its path-2 namespace sugar. Two runtime-specific behaviors are documented on the method: the endpoint must be a relative path beginning with / (the hosted gateway also accepts absolute URLs; this one rejects them), and providers without a proxy executor answer proxy_not_supported.

Alongside the method:

  • ProxyResponse gains an optional bodyEncoding: "base64" for binary upstream bodies (shared with the hosted client — additive and non-breaking).
  • The README, all five translations, and examples/open.ts drop the old "except proxy" caveat and show the path-3 call.
  • The with-b tsd fixture flips expectError(open.proxy(...)) to a positive expectType, since proxy is now a real method (only using stays hosted-only).
  • Adds seven open.proxy tests covering the route, connection selector, binary passthrough, and error mapping.

Full suite is green: lint, typecheck, 181 unit tests, and the type-acceptance matrix.

The self-hosted open-connector backend added a `POST /v1/proxy/:service`
passthrough (its "feat: impl proxy"), so the one call path OpenConnector
still lacked relative to the hosted `Connector` is now available on the
runtime.

Add `open.proxy<T>(service, req, options?)` mirroring `Connector.proxy` —
the same shared `ProxyRequest`/`ProxyResponse` types and the
`connectionName` -> `x-oo-connector-alias` selector, with `proxy` joining
the reserved members so a colliding service id only loses its path-2
sugar. Unlike the hosted gateway, the runtime requires `endpoint` to be a
relative path beginning with `/` and answers `proxy_not_supported` for
providers without an executor; both are documented on the method.

Also add an optional `bodyEncoding: "base64"` to the shared
`ProxyResponse` for binary bodies, refresh the README plus all five
translations and `examples/open.ts`, and flip the `with-b` tsd fixture's
`expectError(open.proxy(...))` to a positive assertion.

Signed-off-by: Kevin Cui <bh@bugs.cc>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Added proxy passthrough support to the self-hosted runtime via a new proxy call, including example usage.
    • Added optional bodyEncoding: "base64" handling for proxy binary responses.
  • Bug Fixes

    • Improved reserved-name/collision behavior so proxy is handled consistently with other built-in methods.
  • Documentation

    • Updated README translations to reflect the full call surface (excluding using()), the new proxy example, and the requirement for relative /-prefixed endpoint values.
  • Tests

    • Extended typing and integration coverage for proxy, selector behavior, and related error handling.

Walkthrough

This PR adds proxy passthrough support to OpenConnector. It updates the SDK interface and runtime factory, adds POST /v1/proxy/{service} handling, extends ProxyResponse with bodyEncoding, and marks proxy as a reserved member name. Tests and type fixtures are updated for request shape, response handling, and reserved-member behavior. The example and localized README files are also updated to document open.proxy(...) and the relative endpoint requirement.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant OpenConnector
  participant RuntimeAPI

  Caller->>OpenConnector: open.proxy(service, req, options)
  OpenConnector->>RuntimeAPI: POST /v1/proxy/{service}
  RuntimeAPI-->>OpenConnector: envelope(status, headers, data, bodyEncoding)
  OpenConnector-->>Caller: ProxyResponse<T>
Loading

Possibly related PRs

  • oomol-lab/connector-sdk#5: Introduces the OpenConnector client surface that this PR extends with proxy support and related typing.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required type(scope): subject format and accurately describes the proxy passthrough change.
Description check ✅ Passed The description is clearly related to the PR and summarizes the proxy passthrough, docs, typings, and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/open-connector-proxy

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/open.ts`:
- Around line 159-165: The `proxy` JSDoc in `Open` conflicts with the shared
`ProxyRequest.endpoint` documentation, which still suggests full URLs are
allowed. Update the shared `ProxyRequest` doc in `src/types.ts` to clearly state
the self-hosted/runtime restriction that `endpoint` must be a relative path
starting with `/`, or explicitly note the divergence from the hosted gateway so
callers are not misled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6546006b-3a7d-4611-bbf2-b8d5d2582aab

📥 Commits

Reviewing files that changed from the base of the PR and between dd0f1aa and a5a6029.

📒 Files selected for processing (11)
  • README.md
  • docs/README/README.fr.md
  • docs/README/README.ja.md
  • docs/README/README.ru.md
  • docs/README/README.zh-CN.md
  • docs/README/README.zh-TW.md
  • examples/open.ts
  • fixtures/consumer/with-b/index.test-d.ts
  • src/open.ts
  • src/types.ts
  • test/open.test.ts

Comment thread src/open.ts
The shared `ProxyRequest.endpoint` doc advertised a path OR a full URL, but
the self-hosted `OpenConnector` runtime rejects absolute URLs and requires a
relative path beginning with `/`. Note that divergence on the shared type so
a self-hosted caller reading it doesn't hit an avoidable runtime rejection.

Addresses a CodeRabbit review comment on #8.

Signed-off-by: Kevin Cui <bh@bugs.cc>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/types.ts (1)

79-83: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Clarify data typing when bodyEncoding is set.

When bodyEncoding: "base64" is present, data holds an encoded string rather than the generic T. Since the runtime posts req to /v1/proxy/{service} and returns envelope.data cast as ProxyResponse<T>, and the test confirms "passes a binary body through: surfaces bodyEncoding: base64 from the runtime" with data as a base64 string, callers relying on T typing may be misled for binary responses. Consider documenting this discrepancy inline, or typing data as T | string conditioned on bodyEncoding.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/types.ts` around lines 79 - 83, Clarify the ProxyResponse typing around
binary payloads: when bodyEncoding is "base64", the runtime returns
envelope.data as a base64 string rather than the generic T. Update the
ProxyResponse type in types.ts and the related runtime/proxy handling so callers
of the /v1/proxy/{service} flow can see that data is string-typed for binary
responses, and keep the existing binary-body test expectations aligned with the
ProxyResponse<T> shape.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/types.ts`:
- Around line 79-83: Clarify the ProxyResponse typing around binary payloads:
when bodyEncoding is "base64", the runtime returns envelope.data as a base64
string rather than the generic T. Update the ProxyResponse type in types.ts and
the related runtime/proxy handling so callers of the /v1/proxy/{service} flow
can see that data is string-typed for binary responses, and keep the existing
binary-body test expectations aligned with the ProxyResponse<T> shape.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb3c0aa5-2779-4b48-b4b0-69bab1e1151a

📥 Commits

Reviewing files that changed from the base of the PR and between a5a6029 and 1de375b.

📒 Files selected for processing (1)
  • src/types.ts

@BlackHole1 BlackHole1 merged commit d8232cb into main Jul 7, 2026
2 checks passed
@BlackHole1 BlackHole1 deleted the feat/open-connector-proxy branch July 7, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant