@adobe/helix-admin-support 4.0.0 → 5.0.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 +19 -0
- package/package.json +2 -1
- package/src/fetch-config-all.js +1 -1
- package/src/fetch-config.js +1 -1
- package/src/fetch-crontab.js +1 -1
- package/src/fetch-fstab.js +1 -1
- package/src/fetch-helix-config.js +1 -1
- package/src/fetch-index.js +2 -2
- package/src/fetch-s3.js +10 -3
- package/src/fetch-sitemap.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [5.0.1](https://github.com/adobe/helix-admin-support/compare/v5.0.0...v5.0.1) (2025-10-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **s3:** throw when bucket name is not mapped ([#445](https://github.com/adobe/helix-admin-support/issues/445)) ([6576357](https://github.com/adobe/helix-admin-support/commit/65763572e389aab6114763958dcf095699e4fec2))
|
|
7
|
+
|
|
8
|
+
# [5.0.0](https://github.com/adobe/helix-admin-support/compare/v4.0.0...v5.0.0) (2025-10-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **s3:** use bucket mapping ([#444](https://github.com/adobe/helix-admin-support/issues/444)) ([0f25acc](https://github.com/adobe/helix-admin-support/commit/0f25acc34417f1d057ab7584d75ef783386eea7d))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* **s3:** fetchS3 now needs a symbolic name, e.g. content instead of helix-content-bus
|
|
19
|
+
|
|
1
20
|
# [4.0.0](https://github.com/adobe/helix-admin-support/compare/v3.4.2...v4.0.0) (2025-10-09)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-admin-support",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Helix Admin Support Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/fetch": "^4.1.10",
|
|
40
40
|
"@adobe/helix-shared-config": "^11.0.11",
|
|
41
|
+
"@adobe/helix-shared-storage": "^1.5.0",
|
|
41
42
|
"@adobe/helix-shared-utils": "^3.0.2",
|
|
42
43
|
"@aws-sdk/client-s3": "^3.705.0",
|
|
43
44
|
"@aws-sdk/client-sqs": "^3.699.0",
|
package/src/fetch-config-all.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function fetchConfigAll(ctx, opts) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
const key = `${contentBusId}/${partition}/.helix/config-all.json`;
|
|
65
|
-
const response = await fetchS3(ctx, '
|
|
65
|
+
const response = await fetchS3(ctx, 'content', key);
|
|
66
66
|
return handleResponse(log, response, key, 'content-bus');
|
|
67
67
|
};
|
|
68
68
|
|
package/src/fetch-config.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function fetchProjectConfig(ctx, opts) {
|
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
const key = `${contentBusId}/preview/.helix/config.json`;
|
|
70
|
-
const response = await fetchS3(ctx, '
|
|
70
|
+
const response = await fetchS3(ctx, 'content', key);
|
|
71
71
|
return handleResponse(log, response, key, 'content-bus');
|
|
72
72
|
};
|
|
73
73
|
|
package/src/fetch-crontab.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function fetchCrontab(ctx, opts) {
|
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
const key = `${contentBusId}/preview/.helix/crontab.json`;
|
|
70
|
-
const response = await fetchS3(ctx, '
|
|
70
|
+
const response = await fetchS3(ctx, 'content', key);
|
|
71
71
|
return handleResponse(log, response, key, 'content-bus');
|
|
72
72
|
};
|
|
73
73
|
|
package/src/fetch-fstab.js
CHANGED
|
@@ -59,7 +59,7 @@ export async function fetchFstab(ctx, opts, optional) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
let key = `${owner}/${repo}/main/fstab.yaml`;
|
|
62
|
-
let response = await fetchS3(ctx, '
|
|
62
|
+
let response = await fetchS3(ctx, 'code', key);
|
|
63
63
|
const cfg = await handleResponse(log, response, key, 'code-bus');
|
|
64
64
|
if (cfg) {
|
|
65
65
|
return cfg;
|
|
@@ -78,7 +78,7 @@ export async function fetchHelixConfig(ctx, info, optional) {
|
|
|
78
78
|
if (!('helixConfig' in attributes)) {
|
|
79
79
|
if (owner && repo) {
|
|
80
80
|
const key = `${owner}/${repo}/main/helix-config.json`;
|
|
81
|
-
const response = await fetchS3(ctx, '
|
|
81
|
+
const response = await fetchS3(ctx, 'code', key);
|
|
82
82
|
attributes.helixConfig = await handleResponse(log, response, key, 'code-bus');
|
|
83
83
|
} else {
|
|
84
84
|
attributes.helixConfig = null;
|
package/src/fetch-index.js
CHANGED
|
@@ -73,14 +73,14 @@ export async function fetchIndex(ctx, opts, optional) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
let key = `${contentBusId}/${INDEX_LOCATION}`;
|
|
76
|
-
let response = await fetchS3(ctx, '
|
|
76
|
+
let response = await fetchS3(ctx, 'content', key);
|
|
77
77
|
attributes.indexConfig = await handleResponse(log, response, key, 'content-bus');
|
|
78
78
|
if (attributes.indexConfig) {
|
|
79
79
|
return attributes.indexConfig;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
key = `${owner}/${repo}/main/${INDEX_CONFIGURATION_NAME}`;
|
|
83
|
-
response = await fetchS3(ctx, '
|
|
83
|
+
response = await fetchS3(ctx, 'code', key);
|
|
84
84
|
attributes.indexConfig = await handleResponse(log, response, key, 'code-bus');
|
|
85
85
|
if (attributes.indexConfig || optional) {
|
|
86
86
|
return attributes.indexConfig;
|
package/src/fetch-s3.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { promisify } from 'util';
|
|
13
13
|
import zlib from 'zlib';
|
|
14
14
|
import { Response } from '@adobe/fetch';
|
|
15
|
+
import { parseBucketNames } from '@adobe/helix-shared-storage';
|
|
15
16
|
import {
|
|
16
17
|
S3Client,
|
|
17
18
|
GetObjectCommand,
|
|
@@ -42,8 +43,14 @@ export async function fetchS3(context, bucketId, key, head = false) {
|
|
|
42
43
|
const {
|
|
43
44
|
HELIX_HTTP_CONNECTION_TIMEOUT = 5000,
|
|
44
45
|
HELIX_HTTP_SOCKET_TIMEOUT = 15000,
|
|
46
|
+
HELIX_BUCKET_NAMES = null,
|
|
45
47
|
} = env;
|
|
46
48
|
|
|
49
|
+
const bucketName = parseBucketNames(HELIX_BUCKET_NAMES)[bucketId];
|
|
50
|
+
if (!bucketName) {
|
|
51
|
+
throw new Error(`Bucket id is not mapped: ${bucketId}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
try {
|
|
48
55
|
// the client initialization is a bit picky with undefined properties.
|
|
49
56
|
// so we omit the credentials when we provide them via context.env
|
|
@@ -67,7 +74,7 @@ export async function fetchS3(context, bucketId, key, head = false) {
|
|
|
67
74
|
let buffer = '';
|
|
68
75
|
try {
|
|
69
76
|
res = await s3.send(new Command({
|
|
70
|
-
Bucket:
|
|
77
|
+
Bucket: bucketName,
|
|
71
78
|
Key: key,
|
|
72
79
|
}));
|
|
73
80
|
if (!head) {
|
|
@@ -101,12 +108,12 @@ export async function fetchS3(context, bucketId, key, head = false) {
|
|
|
101
108
|
} catch (e) {
|
|
102
109
|
const code = e.Code ?? e.$metadata?.httpStatusCode ?? 500;
|
|
103
110
|
if (code === 'AccessDenied' || code === 404 || e instanceof NoSuchKey) {
|
|
104
|
-
log.info(`Could not find file at ${
|
|
111
|
+
log.info(`Could not find file at ${bucketName}/${key}: ${code}`);
|
|
105
112
|
return new Response('', {
|
|
106
113
|
status: 404,
|
|
107
114
|
});
|
|
108
115
|
} else {
|
|
109
|
-
log.error(`Error while fetching file from ${
|
|
116
|
+
log.error(`Error while fetching file from ${bucketName}/${key}: ${code} (${e.message})`);
|
|
110
117
|
return new Response('', {
|
|
111
118
|
status: 502,
|
|
112
119
|
headers: {
|
package/src/fetch-sitemap.js
CHANGED
|
@@ -70,14 +70,14 @@ export async function fetchSitemap(ctx, opts, optional) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
let key = `${contentBusId}/${SITEMAP_LOCATION}`;
|
|
73
|
-
let response = await fetchS3(ctx, '
|
|
73
|
+
let response = await fetchS3(ctx, 'content', key);
|
|
74
74
|
attributes.sitemapConfig = await handleResponse(log, response, key, 'content-bus');
|
|
75
75
|
if (attributes.sitemapConfig) {
|
|
76
76
|
return attributes.sitemapConfig;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
key = `${owner}/${repo}/main/helix-sitemap.yaml`;
|
|
80
|
-
response = await fetchS3(ctx, '
|
|
80
|
+
response = await fetchS3(ctx, 'code', key);
|
|
81
81
|
attributes.sitemapConfig = await handleResponse(log, response, key, 'code-bus');
|
|
82
82
|
if (attributes.sitemapConfig || optional) {
|
|
83
83
|
return attributes.sitemapConfig;
|