@adobe/spacecat-shared-data-access 3.12.1 → 3.14.0
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 +12 -0
- package/package.json +3 -2
- package/src/models/audit/audit.model.js +1 -0
- package/src/service/index.js +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-data-access-v3.14.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.13.0...@adobe/spacecat-shared-data-access-v3.14.0) (2026-03-10)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* enable HTTP connection reuse for PostgrestClient and VaultClient ([#1423](https://github.com/adobe/spacecat-shared/issues/1423)) ([ff92207](https://github.com/adobe/spacecat-shared/commit/ff922075a7e4d035c663d33b8b16ebe1c4dce2c6))
|
|
6
|
+
|
|
7
|
+
## [@adobe/spacecat-shared-data-access-v3.13.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.12.1...@adobe/spacecat-shared-data-access-v3.13.0) (2026-03-10)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add related-urls audit type ([#1422](https://github.com/adobe/spacecat-shared/issues/1422)) ([3826f3f](https://github.com/adobe/spacecat-shared/commit/3826f3f6fbb030314f825d8523352c329f3c0fcf))
|
|
12
|
+
|
|
1
13
|
## [@adobe/spacecat-shared-data-access-v3.12.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.12.0...@adobe/spacecat-shared-data-access-v3.12.1) (2026-03-10)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-data-access",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@adobe/
|
|
43
|
+
"@adobe/fetch": "^4.2.3",
|
|
44
|
+
"@adobe/spacecat-shared-utils": "1.101.0",
|
|
44
45
|
"@supabase/postgrest-js": "^1.21.4",
|
|
45
46
|
"@aws-sdk/client-s3": "^3.940.0",
|
|
46
47
|
"@types/joi": "17.2.3",
|
|
@@ -54,6 +54,7 @@ class Audit extends BaseModel {
|
|
|
54
54
|
LLM_ERROR_PAGES: 'llm-error-pages',
|
|
55
55
|
COSTS: 'costs',
|
|
56
56
|
STRUCTURED_DATA: 'structured-data',
|
|
57
|
+
RELATED_URLS: 'related-urls',
|
|
57
58
|
STRUCTURED_DATA_AUTO_SUGGEST: 'structured-data-auto-suggest',
|
|
58
59
|
FORMS_OPPORTUNITIES: 'forms-opportunities',
|
|
59
60
|
SITE_DETECTION: 'site-detection',
|
package/src/service/index.js
CHANGED
|
@@ -12,11 +12,40 @@
|
|
|
12
12
|
|
|
13
13
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
14
14
|
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
15
|
+
import { h1NoCache, keepAliveNoCache } from '@adobe/fetch';
|
|
15
16
|
|
|
16
17
|
import { instrumentAWSClient } from '@adobe/spacecat-shared-utils';
|
|
17
18
|
import { EntityRegistry } from '../models/index.js';
|
|
18
19
|
import { registerLogger } from '../util/logger-registry.js';
|
|
19
20
|
|
|
21
|
+
// Create a dedicated fetch context for PostgREST with:
|
|
22
|
+
// - keepAlive: true for HTTP/1.1 connection reuse (the default h2() context sets keepAlive: false
|
|
23
|
+
// for h1 on Node 19+, which defeats connection reuse for plain HTTP targets like our ALB)
|
|
24
|
+
// - maxCacheSize: 0 to disable HTTP response caching (PostgREST GET responses are cacheable
|
|
25
|
+
// by default, which could cause stale reads after writes within the same Lambda invocation)
|
|
26
|
+
// h1NoCache() in tests for nock compat; keepAliveNoCache() in prod for connection reuse.
|
|
27
|
+
const fetchContext = process.env.HELIX_FETCH_FORCE_HTTP1
|
|
28
|
+
? h1NoCache() : keepAliveNoCache();
|
|
29
|
+
const { fetch: postgrestFetch } = fetchContext;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a fetch wrapper that converts native (WHATWG) Headers instances to plain objects.
|
|
33
|
+
* @adobe/fetch's Headers class doesn't recognize native Headers instances (instanceof check
|
|
34
|
+
* fails), causing all headers to be silently dropped. @supabase/postgrest-js passes native
|
|
35
|
+
* Headers objects, so we convert them to plain objects for compatibility.
|
|
36
|
+
*
|
|
37
|
+
* @param {Function} fetchFn - The underlying fetch function to wrap
|
|
38
|
+
* @returns {Function} A wrapped fetch function with Headers compatibility
|
|
39
|
+
*/
|
|
40
|
+
export const createFetchCompat = (fetchFn) => (url, opts) => {
|
|
41
|
+
if (opts?.headers instanceof Headers) {
|
|
42
|
+
return fetchFn(url, { ...opts, headers: Object.fromEntries(opts.headers.entries()) });
|
|
43
|
+
}
|
|
44
|
+
return fetchFn(url, opts);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const fetch = createFetchCompat(postgrestFetch);
|
|
48
|
+
|
|
20
49
|
export * from '../errors/index.js';
|
|
21
50
|
export * from '../models/index.js';
|
|
22
51
|
export * from '../util/index.js';
|
|
@@ -45,6 +74,7 @@ const createPostgrestService = (config, client = undefined) => {
|
|
|
45
74
|
return new PostgrestClient(postgrestUrl, {
|
|
46
75
|
schema: postgrestSchema,
|
|
47
76
|
headers,
|
|
77
|
+
fetch,
|
|
48
78
|
});
|
|
49
79
|
};
|
|
50
80
|
|