feat(data-access): expose postgrestClient for direct PostgREST queries#1396
Merged
feat(data-access): expose postgrestClient for direct PostgREST queries#1396
Conversation
vivesing
approved these changes
Mar 2, 2026
…r direct PostgREST queries Adds the underlying PostgrestClient instance under a `services` namespace on the object returned by createDataAccess(), enabling controllers to perform direct PostgREST queries against tables that are not modeled as entities (e.g. analytics views, brand presence tables). Also adds full TypeScript typings for all 32 entity collections on the DataAccess interface and re-exports 5 previously missing collection types from models/index.d.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21672e2 to
b8c1747
Compare
|
This PR will trigger a minor release when merged. |
solaris007
pushed a commit
that referenced
this pull request
Mar 2, 2026
## [@adobe/spacecat-shared-data-access-v3.6.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.5.0...@adobe/spacecat-shared-data-access-v3.6.0) (2026-03-02) ### Features * **data-access:** expose postgrestClient for direct PostgREST queries ([#1396](#1396)) ([307711c](307711c))
Member
|
🎉 This PR is included in version @adobe/spacecat-shared-data-access-v3.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
ekremney
added a commit
that referenced
this pull request
Mar 2, 2026
## Summary - Documents the `services.postgrestClient` API added in #1396 in both README.md and CLAUDE.md - Updates the "What You Get" and "TypeScript" sections in README.md - Adds "Direct PostgREST Queries" section with usage examples to both docs - Adds `src/service/index.d.ts` to the Key Files table in CLAUDE.md Follow-up to #1396 which was merged before docs were updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PostgrestClientinstance under aservicesnamespace on the object returned bycreateDataAccess(), enabling direct PostgREST queries against tables that are not modeled as entities (e.g. analytics views, brand presence tables)DataAccessinterface (previously typed asobject)models/index.d.ts(ApiKey,AuditUrl,PageCitability,PageIntent,Project)Motivation
Some API endpoints need to query PostgREST tables that don't have corresponding entity models in the data-access layer (e.g.
brand_presence_executions,brand_metrics_weekly). Previously, developers resorted to reaching into collection internals likeSite.postgrestServiceto get the raw client. This change makes it a first-class, typed API under aservicesnamespace that cleanly separates infrastructure from entity collections.Usage
Full IDE autocomplete is available for the entire PostgREST query builder chain (
.from(),.select(),.eq(),.gte(),.order(),.range(),.rpc(), etc.).Test plan
services.postgrestClientis present and is the correct instance🤖 Generated with Claude Code