Merge branch 'backstage:master' into 7340-remote-config-fix

This commit is contained in:
Praveen Ranjan Keshri
2021-12-07 22:46:46 +05:30
committed by GitHub
593 changed files with 26063 additions and 2542 deletions
+7
View File
@@ -1,5 +1,12 @@
# @backstage/config-loader
## 0.8.1
### Patch Changes
- b055a6addc: Align on usage of `cross-fetch` vs `node-fetch` in frontend vs backend packages, and remove some unnecessary imports of either one of them
- 4bea7b81d3: Uses key visibility as fallback in non-object arrays
## 0.8.0
### Minor Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/config-loader",
"description": "Config loading functionality used by Backstage backend, and CLI",
"version": "0.8.0",
"version": "0.8.1",
"private": false,
"publishConfig": {
"access": "public",
@@ -41,10 +41,10 @@
"json-schema": "^0.4.0",
"json-schema-merge-allof": "^0.8.1",
"json-schema-traverse": "^1.0.0",
"node-fetch": "^2.6.1",
"typescript-json-schema": "^0.51.0",
"yaml": "^1.9.2",
"yup": "^0.32.9",
"node-fetch": "2.6.5"
"yup": "^0.32.9"
},
"devDependencies": {
"@types/jest": "^26.0.7",
@@ -20,6 +20,7 @@ import { filterByVisibility, filterErrorsByVisibility } from './filtering';
const data = {
arr: ['f', 'b', 's'],
arrU: ['f', 'b', 't'],
objArr: [
{ f: 1, b: 2, s: 3 },
{ f: 4, b: 5, s: 6 },
@@ -40,6 +41,8 @@ const data = {
const visibility = new Map<string, ConfigVisibility>(
Object.entries({
'/arrU': 'frontend',
'/arrU/2': 'backend',
'/arr/0': 'frontend',
'/arr/1': 'backend',
'/arr/2': 'secret',
@@ -71,6 +74,9 @@ describe('filterByVisibility', () => {
'arr[0]',
'arr[1]',
'arr[2]',
'arrU[0]',
'arrU[1]',
'arrU[2]',
'objArr[0].f',
'objArr[0].b',
'objArr[0].s',
@@ -97,10 +103,12 @@ describe('filterByVisibility', () => {
obj: { f: 'a' },
arrF: [],
objF: {},
arrU: ['f', 'b'],
},
filteredKeys: [
'arr[1]',
'arr[2]',
'arrU[2]',
'objArr[0].b',
'objArr[0].s',
'objArr[1].b',
@@ -120,6 +128,7 @@ describe('filterByVisibility', () => {
{
data: {
arr: ['b'],
arrU: ['t'],
objArr: [{ b: 2 }, { b: 5 }],
obj: { b: {} },
arrF: [{ never: 'here' }],
@@ -132,6 +141,8 @@ describe('filterByVisibility', () => {
filteredKeys: [
'arr[0]',
'arr[2]',
'arrU[0]',
'arrU[1]',
'objArr[0].f',
'objArr[0].s',
'objArr[1].f',
@@ -154,6 +165,9 @@ describe('filterByVisibility', () => {
filteredKeys: [
'arr[0]',
'arr[1]',
'arrU[0]',
'arrU[1]',
'arrU[2]',
'objArr[0].f',
'objArr[0].b',
'objArr[1].f',
@@ -61,11 +61,17 @@ export function filterByVisibility(
const arr = new Array<JsonValue>();
for (const [index, value] of jsonVal.entries()) {
const out = transform(
value,
let path = visibilityPath;
const hasVisibilityInIndex = visibilityByDataPath.get(
`${visibilityPath}/${index}`,
`${filterPath}[${index}]`,
);
if (hasVisibilityInIndex || typeof value === 'object') {
path = `${visibilityPath}/${index}`;
}
const out = transform(value, path, `${filterPath}[${index}]`);
if (out !== undefined) {
arr.push(out);
}