@adobe/helix-admin-support 2.7.3 → 2.8.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 +14 -0
- package/package.json +5 -4
- package/src/fetch-index.js +18 -18
- package/src/fetch-s3.js +1 -1
- package/src/fetch-sitemap.js +20 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.8.1](https://github.com/adobe/helix-admin-support/compare/v2.8.0...v2.8.1) (2024-04-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update adobe fixes ([#254](https://github.com/adobe/helix-admin-support/issues/254)) ([465f2de](https://github.com/adobe/helix-admin-support/commit/465f2de7d63a0001dae39080e4929bab59a2d741))
|
|
7
|
+
|
|
8
|
+
# [2.8.0](https://github.com/adobe/helix-admin-support/compare/v2.7.3...v2.8.0) (2024-04-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* load index/sitemap from content-bus first ([#253](https://github.com/adobe/helix-admin-support/issues/253)) ([e3e9b94](https://github.com/adobe/helix-admin-support/commit/e3e9b94981356878c1f81559a3700eeb1afc75ab))
|
|
14
|
+
|
|
1
15
|
## [2.7.3](https://github.com/adobe/helix-admin-support/compare/v2.7.2...v2.7.3) (2024-04-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-admin-support",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Helix Admin Support Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@adobe/fetch": "4.1.2",
|
|
38
|
-
"@adobe/helix-shared-config": "10.4.
|
|
39
|
-
"@adobe/helix-shared-utils": "3.0.
|
|
38
|
+
"@adobe/helix-shared-config": "10.4.2",
|
|
39
|
+
"@adobe/helix-shared-utils": "3.0.2",
|
|
40
40
|
"@aws-sdk/client-s3": "3.554.0",
|
|
41
41
|
"@aws-sdk/client-sqs": "3.554.0",
|
|
42
|
-
"@
|
|
42
|
+
"@smithy/node-http-handler": "2.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@adobe/eslint-config-helix": "2.0.6",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"mocha-multi-reporters": "1.5.1",
|
|
59
59
|
"nock": "13.5.4",
|
|
60
60
|
"semantic-release": "22.0.12",
|
|
61
|
+
"xml2js": "0.6.2",
|
|
61
62
|
"yaml": "2.4.1"
|
|
62
63
|
},
|
|
63
64
|
"lint-staged": {
|
package/src/fetch-index.js
CHANGED
|
@@ -12,13 +12,18 @@
|
|
|
12
12
|
import { logLevelForStatusCode, propagateStatusCode } from '@adobe/helix-shared-utils';
|
|
13
13
|
import { IndexConfig } from '@adobe/helix-shared-config';
|
|
14
14
|
import { fetchS3 } from './fetch-s3.js';
|
|
15
|
-
import {
|
|
15
|
+
import { getContentBusId } from './contentbus.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Name of the indexing configuration, subject to be renamed.
|
|
19
19
|
*/
|
|
20
20
|
export const INDEX_CONFIGURATION_NAME = 'helix-query.yaml';
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Location of the indexing configuration in the content-bus.
|
|
24
|
+
*/
|
|
25
|
+
const INDEX_LOCATION = 'preview/.helix/query.yaml';
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* Checks if the response is valid and returns an index config.
|
|
24
29
|
*
|
|
@@ -55,33 +60,28 @@ async function handleResponse(log, response, key, type) {
|
|
|
55
60
|
* @returns {Promise<IndexConfig>} the index config
|
|
56
61
|
*/
|
|
57
62
|
export async function fetchIndex(ctx, opts, optional) {
|
|
58
|
-
const { attributes, log
|
|
63
|
+
const { attributes, log } = ctx;
|
|
59
64
|
const { owner, repo } = opts;
|
|
60
65
|
|
|
61
66
|
if (attributes.indexConfig !== undefined) {
|
|
62
67
|
return attributes.indexConfig;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (attributes.indexConfig) {
|
|
69
|
-
return attributes.indexConfig;
|
|
70
|
+
const contentBusId = await getContentBusId(ctx, opts, optional);
|
|
71
|
+
if (!contentBusId) {
|
|
72
|
+
return null;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
let key = `${contentBusId}/${INDEX_LOCATION}`;
|
|
76
|
+
let response = await fetchS3(ctx, 'helix-content-bus', key);
|
|
77
|
+
attributes.indexConfig = await handleResponse(log, response, key, 'content-bus');
|
|
78
|
+
if (attributes.indexConfig) {
|
|
79
|
+
return attributes.indexConfig;
|
|
76
80
|
}
|
|
77
|
-
const { GH_RAW_URL = 'https://raw.githubusercontent.com' } = env;
|
|
78
|
-
|
|
79
|
-
response = await fetch(`${GH_RAW_URL}/${key}`, {
|
|
80
|
-
cache: 'no-store',
|
|
81
|
-
headers,
|
|
82
|
-
});
|
|
83
|
-
attributes.indexConfig = await handleResponse(log, response, key, 'github');
|
|
84
81
|
|
|
82
|
+
key = `${owner}/${repo}/main/${INDEX_CONFIGURATION_NAME}`;
|
|
83
|
+
response = await fetchS3(ctx, 'helix-code-bus', key);
|
|
84
|
+
attributes.indexConfig = await handleResponse(log, response, key, 'code-bus');
|
|
85
85
|
if (attributes.indexConfig || optional) {
|
|
86
86
|
return attributes.indexConfig;
|
|
87
87
|
}
|
package/src/fetch-s3.js
CHANGED
package/src/fetch-sitemap.js
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
import { logLevelForStatusCode, propagateStatusCode } from '@adobe/helix-shared-utils';
|
|
13
13
|
import { SitemapConfig } from '@adobe/helix-shared-config';
|
|
14
14
|
import { fetchS3 } from './fetch-s3.js';
|
|
15
|
+
import { getContentBusId } from './contentbus.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Location of the sitemap configuration in the content-bus.
|
|
19
|
+
*/
|
|
20
|
+
const SITEMAP_LOCATION = 'preview/.helix/sitemap.yaml';
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
23
|
* Checks if the response is valid and returns a sitemap config.
|
|
@@ -58,8 +64,20 @@ export async function fetchSitemap(ctx, opts, optional) {
|
|
|
58
64
|
return attributes.sitemapConfig;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
const
|
|
62
|
-
|
|
67
|
+
const contentBusId = await getContentBusId(ctx, opts, optional);
|
|
68
|
+
if (!contentBusId) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let key = `${contentBusId}/${SITEMAP_LOCATION}`;
|
|
73
|
+
let response = await fetchS3(ctx, 'helix-content-bus', key);
|
|
74
|
+
attributes.sitemapConfig = await handleResponse(log, response, key, 'content-bus');
|
|
75
|
+
if (attributes.sitemapConfig) {
|
|
76
|
+
return attributes.sitemapConfig;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
key = `${owner}/${repo}/main/helix-sitemap.yaml`;
|
|
80
|
+
response = await fetchS3(ctx, 'helix-code-bus', key);
|
|
63
81
|
attributes.sitemapConfig = await handleResponse(log, response, key, 'code-bus');
|
|
64
82
|
if (attributes.sitemapConfig || optional) {
|
|
65
83
|
return attributes.sitemapConfig;
|