@adobe/helix-admin-support 3.4.1 → 4.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 +19 -0
- package/package.json +5 -5
- package/src/fetch-helix-config.js +3 -3
- 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,22 @@
|
|
|
1
|
+
# [4.0.0](https://github.com/adobe/helix-admin-support/compare/v3.4.2...v4.0.0) (2025-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove removed config ([#443](https://github.com/adobe/helix-admin-support/issues/443)) ([fb7f481](https://github.com/adobe/helix-admin-support/commit/fb7f481c3ba4604943f7421a087641c0f39d5ad8))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* feature flags config was removed.
|
|
12
|
+
|
|
13
|
+
## [3.4.2](https://github.com/adobe/helix-admin-support/compare/v3.4.1...v3.4.2) (2025-10-09)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* avoid unrequired ref ([#442](https://github.com/adobe/helix-admin-support/issues/442)) ([65b95d8](https://github.com/adobe/helix-admin-support/commit/65b95d8059aa7763504624883f30f32296444540))
|
|
19
|
+
|
|
1
20
|
## [3.4.1](https://github.com/adobe/helix-admin-support/compare/v3.4.0...v3.4.1) (2025-10-02)
|
|
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": "4.0.0",
|
|
4
4
|
"description": "Helix Admin Support Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@smithy/node-http-handler": "^4.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@adobe/eslint-config-helix": "3.0.
|
|
47
|
+
"@adobe/eslint-config-helix": "3.0.11",
|
|
48
48
|
"@adobe/jsonschema2md": "8.0.6",
|
|
49
|
-
"@eslint/config-helpers": "0.
|
|
49
|
+
"@eslint/config-helpers": "0.4.0",
|
|
50
50
|
"@semantic-release/changelog": "6.0.3",
|
|
51
51
|
"@semantic-release/git": "10.0.1",
|
|
52
52
|
"@semantic-release/npm": "12.0.2",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"jsdoc-to-markdown": "9.1.2",
|
|
57
57
|
"json-schema-to-typescript": "15.0.4",
|
|
58
58
|
"junit-report-builder": "5.1.1",
|
|
59
|
-
"lint-staged": "16.
|
|
59
|
+
"lint-staged": "16.2.0",
|
|
60
60
|
"mocha": "11.7.2",
|
|
61
61
|
"mocha-multi-reporters": "1.5.1",
|
|
62
62
|
"mocha-suppress-logs": "0.6.0",
|
|
63
63
|
"nock": "13.5.6",
|
|
64
|
-
"semantic-release": "24.2.
|
|
64
|
+
"semantic-release": "24.2.9",
|
|
65
65
|
"xml2js": "0.6.2",
|
|
66
66
|
"yaml": "2.8.1"
|
|
67
67
|
},
|
|
@@ -73,10 +73,10 @@ async function handleResponse(log, response, key, type) {
|
|
|
73
73
|
*/
|
|
74
74
|
export async function fetchHelixConfig(ctx, info, optional) {
|
|
75
75
|
const { attributes, log } = ctx;
|
|
76
|
-
const { owner, repo
|
|
76
|
+
const { owner, repo } = info;
|
|
77
77
|
|
|
78
78
|
if (!('helixConfig' in attributes)) {
|
|
79
|
-
if (owner && repo
|
|
79
|
+
if (owner && repo) {
|
|
80
80
|
const key = `${owner}/${repo}/main/helix-config.json`;
|
|
81
81
|
const response = await fetchS3(ctx, 'helix-code-bus', key);
|
|
82
82
|
attributes.helixConfig = await handleResponse(log, response, key, 'code-bus');
|
|
@@ -88,7 +88,7 @@ export async function fetchHelixConfig(ctx, info, optional) {
|
|
|
88
88
|
if (attributes.helixConfig || optional) {
|
|
89
89
|
return attributes.helixConfig;
|
|
90
90
|
}
|
|
91
|
-
const err = Error(`no helix-config for ${owner}/${repo}
|
|
91
|
+
const err = Error(`no helix-config for ${owner}/${repo}`);
|
|
92
92
|
err.status = 404;
|
|
93
93
|
throw err;
|
|
94
94
|
}
|
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
|
-
}
|