You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`src/service/index.d.ts`|`DataAccess` and `DataAccessServices` type definitions |
25
26
|`src/models/base/schema.builder.js`| DSL for defining entity schemas (attributes, references, indexes) |
26
27
|`src/models/base/base.model.js`| Base entity class (auto-generated getters/setters, save, remove) |
27
28
|`src/models/base/base.collection.js`| Base collection class (findById, all, query, count) |
@@ -152,6 +153,22 @@ npm run test:it
152
153
- PostgREST calls are stubbed via sinon
153
154
- Each entity model and collection has its own test file
154
155
156
+
## Direct PostgREST Queries
157
+
158
+
`dataAccess.services.postgrestClient` exposes the raw `@supabase/postgrest-js``PostgrestClient` for querying tables that don't have entity models (e.g. analytics views, reporting tables):
-`dataAccessWrapper(fn)` (default export) for Helix/Lambda style handlers
21
21
- Entity collections/models with stable external API shape for services
22
+
-`services.postgrestClient` for direct PostgREST queries against non-entity tables
22
23
23
24
## Quick Start
24
25
@@ -89,6 +90,29 @@ The wrapper reads from `context.env`:
89
90
-`S3_CONFIG_BUCKET`
90
91
-`AWS_REGION`
91
92
93
+
## Direct PostgREST Queries
94
+
95
+
For querying PostgREST tables that are not modeled as entities (e.g. analytics views, reporting tables), the `postgrestClient` is available under `dataAccess.services`:
96
+
97
+
```js
98
+
const { Site } = dataAccess; // entity collections
99
+
const { postgrestClient } = dataAccess.services; // raw PostgREST client
This is the same `@supabase/postgrest-js``PostgrestClient` instance used internally by the entity collections. FullIDE autocomplete is available for the query builder chain.
115
+
92
116
## Field Mapping Behavior
93
117
94
118
Public model API remains camelCase while Postgres/PostgREST tables are snake_case.
- `src/service/index.d.ts` — `DataAccess` and `DataAccessServices` interfaces
411
+
- `src/models/**/index.d.ts` — per-entity collection and model interfaces
412
+
413
+
The `DataAccess` interface provides full typing for all entity collections and `services.postgrestClient` (typed as `PostgrestClient` from `@supabase/postgrest-js`).
387
414
388
415
Use the package directly in TS projects; no extra setup required.
0 commit comments