@adobe/helix-admin-support 3.4.2 → 5.0.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 +24 -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 +4 -1
- package/src/fetch-sitemap.js +2 -2
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/fetch-feature-flags.d.ts +0 -21
- package/src/fetch-feature-flags.js +0 -91
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# [5.0.0](https://github.com/adobe/helix-admin-support/compare/v4.0.0...v5.0.0) (2025-10-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **s3:** use bucket mapping ([#444](https://github.com/adobe/helix-admin-support/issues/444)) ([0f25acc](https://github.com/adobe/helix-admin-support/commit/0f25acc34417f1d057ab7584d75ef783386eea7d))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **s3:** fetchS3 now needs a symbolic name, e.g. content instead of helix-content-bus
|
|
12
|
+
|
|
13
|
+
# [4.0.0](https://github.com/adobe/helix-admin-support/compare/v3.4.2...v4.0.0) (2025-10-09)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* remove removed config ([#443](https://github.com/adobe/helix-admin-support/issues/443)) ([fb7f481](https://github.com/adobe/helix-admin-support/commit/fb7f481c3ba4604943f7421a087641c0f39d5ad8))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* feature flags config was removed.
|
|
24
|
+
|
|
1
25
|
## [3.4.2](https://github.com/adobe/helix-admin-support/compare/v3.4.1...v3.4.2) (2025-10-09)
|
|
2
26
|
|
|
3
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-admin-support",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
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,6 +43,7 @@ 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
|
|
|
47
49
|
try {
|
|
@@ -66,8 +68,9 @@ export async function fetchS3(context, bucketId, key, head = false) {
|
|
|
66
68
|
let res;
|
|
67
69
|
let buffer = '';
|
|
68
70
|
try {
|
|
71
|
+
const bucket = parseBucketNames(HELIX_BUCKET_NAMES)[bucketId];
|
|
69
72
|
res = await s3.send(new Command({
|
|
70
|
-
Bucket:
|
|
73
|
+
Bucket: bucket,
|
|
71
74
|
Key: key,
|
|
72
75
|
}));
|
|
73
76
|
if (!head) {
|
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;
|
package/src/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export * from './fetch-index';
|
|
|
31
31
|
export * from './fetch-helix-config';
|
|
32
32
|
export * from './fetch-s3';
|
|
33
33
|
export * from './fetch-sitemap';
|
|
34
|
-
export * from './fetch-feature-flags';
|
|
35
34
|
export * from './flatJson2Object';
|
|
36
35
|
export * from './BatchedQueueClient';
|
|
37
36
|
export * from './UpdatesPartitioner';
|
package/src/index.js
CHANGED
|
@@ -20,7 +20,6 @@ export * from './fetch-index.js';
|
|
|
20
20
|
export * from './fetch-helix-config.js';
|
|
21
21
|
export * from './fetch-s3.js';
|
|
22
22
|
export * from './fetch-sitemap.js';
|
|
23
|
-
export * from './fetch-feature-flags.js';
|
|
24
23
|
export * from './flatJson2Object.js';
|
|
25
24
|
export * from './BatchedQueueClient.js';
|
|
26
25
|
export * from './UpdatesPartitioner.js';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { AdminContext, PathInfo } from './index';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Retrieves feature flags for the specified project.
|
|
17
|
-
* @param {AdminContext} ctx the context
|
|
18
|
-
* @param {Pick<PathInfo, 'owner' | 'repo'>} info partial path info
|
|
19
|
-
* @returns {Promise<Record<string, boolean>>} map of { feature name => enabled? }
|
|
20
|
-
*/
|
|
21
|
-
export function fetchFeatureFlags(ctx: AdminContext, info: Pick<PathInfo, 'owner' | 'repo'>): Promise<Record<string, boolean>>;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { logLevelForStatusCode, propagateStatusCode } from '@adobe/helix-shared-utils';
|
|
14
|
-
import { fetchS3 } from './fetch-s3.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Checks if the response is valid and returns the feature flags.
|
|
18
|
-
*
|
|
19
|
-
* @param {Console} log logger
|
|
20
|
-
* @param {Response} response response from the storage
|
|
21
|
-
* @param {string} key storage key (logging information)
|
|
22
|
-
* @param {string} type type of storage (logging information)
|
|
23
|
-
* @returns {Promise<Record<string, boolean>>}
|
|
24
|
-
*/
|
|
25
|
-
async function handleResponse(log, response, key, type) {
|
|
26
|
-
const text = await response.text();
|
|
27
|
-
if (response.ok) {
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(text);
|
|
30
|
-
// eslint-disable-next-line no-empty
|
|
31
|
-
} catch { }
|
|
32
|
-
log.info(`Empty or invalid feature flags found in ${type} ${key}`);
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (response.status === 404) {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
log[logLevelForStatusCode(response.status)](
|
|
41
|
-
`Invalid response (${response.status}) when fetching feature flags from ${type} ${key}`,
|
|
42
|
-
);
|
|
43
|
-
const err = new Error(`Unable to fetch feature flags: ${response.status} ${text}`);
|
|
44
|
-
err.status = propagateStatusCode(response.status);
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves feature flags for the specified project.
|
|
50
|
-
* @param ctx
|
|
51
|
-
* @param info
|
|
52
|
-
* @returns {Promise<Record<string, boolean>>} map of { feature name => enabled? }
|
|
53
|
-
*/
|
|
54
|
-
export async function fetchFeatureFlags(ctx, info) {
|
|
55
|
-
const { log, attributes } = ctx;
|
|
56
|
-
const { repo, owner } = info;
|
|
57
|
-
|
|
58
|
-
if (!attributes.featureFlags) {
|
|
59
|
-
attributes.featureFlags = {};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* each flag file is a simple { [feature: string]: boolean } format
|
|
64
|
-
* repo-level flags override org-level flags
|
|
65
|
-
* @param {Record<string, boolean>} repoData
|
|
66
|
-
* @param {Record<string, boolean>} orgData
|
|
67
|
-
* @returns {Record<string, boolean>}
|
|
68
|
-
*/
|
|
69
|
-
const flattenFlags = (repoData, orgData) => ({
|
|
70
|
-
...orgData,
|
|
71
|
-
...repoData,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @param {string} file
|
|
76
|
-
*/
|
|
77
|
-
const getFlags = async (file) => {
|
|
78
|
-
if (!attributes.featureFlags[file]) {
|
|
79
|
-
const key = `adobe/helix-admin-website/main/tools/hidden-features/${file}.json`;
|
|
80
|
-
const response = await fetchS3(ctx, 'helix-code-bus', key);
|
|
81
|
-
attributes.featureFlags[file] = await handleResponse(log, response, key, 'code-bus');
|
|
82
|
-
}
|
|
83
|
-
return attributes.featureFlags[file];
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const [orgData, repoData] = await Promise.all([
|
|
87
|
-
getFlags(`${owner}--all`),
|
|
88
|
-
getFlags(`${owner}--${repo}`),
|
|
89
|
-
]);
|
|
90
|
-
return flattenFlags(repoData, orgData);
|
|
91
|
-
}
|