@adobe/spacecat-shared-data-access 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [@adobe/spacecat-shared-data-access-v3.6.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.6.0...@adobe/spacecat-shared-data-access-v3.6.1) (2026-03-03)
2
+
3
+ ### Bug Fixes
4
+
5
+ * stage changes wrt to spacecat-shared ([#1394](https://github.com/adobe/spacecat-shared/issues/1394)) ([7145fb0](https://github.com/adobe/spacecat-shared/commit/7145fb037e5b809d4552889c291b6f8688655b88))
6
+
1
7
  ## [@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)
2
8
 
3
9
  ### Features
package/CLAUDE.md CHANGED
@@ -21,7 +21,8 @@ Lambda/ECS service
21
21
  | File | Purpose |
22
22
  |------|---------|
23
23
  | `src/index.js` | Default export: `dataAccessWrapper(fn)` for Helix/Lambda handlers |
24
- | `src/service/index.js` | `createDataAccess(config, log?, client?)` factory |
24
+ | `src/service/index.js` | `createDataAccess(config, log?, client?)` factory — returns entity collections + `services.postgrestClient` |
25
+ | `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):
159
+
160
+ ```js
161
+ const { postgrestClient } = context.dataAccess.services;
162
+
163
+ const { data, error } = await postgrestClient
164
+ .from('brand_presence_executions')
165
+ .select('*')
166
+ .eq('site_id', siteId)
167
+ .limit(100);
168
+ ```
169
+
170
+ This is the same client instance used internally by entity collections — same URL, auth, and schema.
171
+
155
172
  ## Common Patterns
156
173
 
157
174
  ### Collection query with WHERE clause
package/README.md CHANGED
@@ -16,9 +16,10 @@ npm install @adobe/spacecat-shared-data-access
16
16
  ## What You Get
17
17
 
18
18
  The package provides:
19
- - `createDataAccess(config, log?, client?)`
19
+ - `createDataAccess(config, log?, client?)` — returns entity collections + `services.postgrestClient`
20
20
  - `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
100
+
101
+ // Use entity collections as usual
102
+ const site = await Site.findById(siteId);
103
+
104
+ // Direct queries against non-entity tables
105
+ const { data, error } = await postgrestClient
106
+ .from('brand_presence_executions')
107
+ .select('execution_date, visibility_score, sentiment')
108
+ .eq('site_id', siteId)
109
+ .gte('execution_date', '2025-01-01')
110
+ .order('execution_date', { ascending: false })
111
+ .limit(100);
112
+ ```
113
+
114
+ This is the same `@supabase/postgrest-js` `PostgrestClient` instance used internally by the entity collections. Full IDE 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.
@@ -383,7 +407,10 @@ export MYSTICAT_DATA_SERVICE_REPOSITORY=682033462621.dkr.ecr.us-east-1.amazonaws
383
407
 
384
408
  Type definitions are shipped from:
385
409
  - `src/index.d.ts`
386
- - `src/models/**/index.d.ts`
410
+ - `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.
389
416
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -344,6 +344,12 @@ export const configSchema = Joi.object({
344
344
  edgeOptimizeConfig: Joi.object({
345
345
  enabled: Joi.boolean().optional(),
346
346
  opted: Joi.number().optional(),
347
+ stagingDomains: Joi.array().items(
348
+ Joi.object({
349
+ domain: Joi.string().required(),
350
+ id: Joi.string().required(),
351
+ }),
352
+ ).optional(),
347
353
  }).optional(),
348
354
  contentAiConfig: Joi.object({
349
355
  index: Joi.string().optional(),