Skip to content

[SEA-NodeJS] (1/9) Backend abstraction — IBackend / ISessionBackend / IOperationBackend#378

Draft
msrathore-db wants to merge 2 commits into
mainfrom
msrathore/sea-abstraction
Draft

[SEA-NodeJS] (1/9) Backend abstraction — IBackend / ISessionBackend / IOperationBackend#378
msrathore-db wants to merge 2 commits into
mainfrom
msrathore/sea-abstraction

Conversation

@msrathore-db
Copy link
Copy Markdown
Contributor

Summary

Introduces a 3-layer backend interface (`IBackend`, `ISessionBackend`, `IOperationBackend`) so the existing thrift driver and the new SEA driver can plug in behind a uniform contract. Adds a stub `SeaBackend` placeholder for downstream branches to fill in.

Stack position

PR 1/9 in the M0+M1-Phase-1 SEA stack. All 9 sibling PRs are off `main` (parallel topology — the linear cumulative anchor is PR 8/9 `sea-integration`).

Branch chain for review order:

  1. this PR — abstraction
  2. napi-binding (loader + build script)
  3. errors-logging (kernel ErrorCode → JS class mapping)
  4. auth (PAT)
  5. execution (executeStatement + openSession)
  6. results (CloudFetch + Inline Arrow)
  7. operation (cancel / close / finished)
  8. integration (cumulative M0 — INTERVAL fix + all of the above merged)
  9. auth-u2m (M1 Phase 1 OAuth M2M + U2M)

Test plan

  • Existing thrift backend wraps cleanly behind `IBackend` interface
  • No behavior change on the thrift path
  • Stub SeaBackend compiles + exposes the same interface

…kend

Refactors DBSQLClient/Session/Operation to dispatch through three
backend interfaces. ThriftBackend (lib/thrift-backend/) contains the
relocated existing thrift logic. SeaBackend (lib/sea/) is a stub for
M0; the sea-napi-binding feature wires the real impl.

Public surface (lib/index.ts) unchanged.
No new dependencies. All existing tests pass.

Files:
- lib/contracts/IBackend.ts (new)
- lib/contracts/ISessionBackend.ts (new)
- lib/contracts/IOperationBackend.ts (new)
- lib/contracts/IDBSQLClient.ts (adds useSEA?: boolean to ConnectionOptions)
- lib/thrift-backend/ThriftBackend.ts (new)
- lib/thrift-backend/ThriftSessionBackend.ts (new)
- lib/thrift-backend/ThriftOperationBackend.ts (new)
- lib/sea/SeaBackend.ts (new, M0 stub)
- lib/DBSQLClient.ts (dispatch through IBackend; useSEA picks SeaBackend)
- lib/DBSQLSession.ts (facade over ISessionBackend; staging stays here)
- lib/DBSQLOperation.ts (facade over IOperationBackend; iterators/fetchAll stay here)
- tests/unit/DBSQLClient.test.ts (retarget internal state lookup through backend; pre-seed client.backend in tests that bypass connect())
- tests/unit/DBSQLOperation.test.ts (retarget internal state lookup through backend)
…nline type

Addresses code-bloat-watchdog findings from commit 0085928:
- Restores public-API JSDoc on DBSQLSession + DBSQLOperation methods
  (was deleted as scope creep; contracts unchanged so docs still apply)
- Adds makeStubbedClient() helper to tests/unit/DBSQLClient.test.ts;
  replaces 14× duplicated ThriftBackend pre-seed
- Imports WaitUntilReadyOptions instead of inline option types in
  IOperationBackend + DBSQLOperation.waitUntilReady
@github-actions
Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

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