Merge pull request #25462 from backstage/renovate/lodash-4.x-lockfile

chore(deps): update dependency @types/lodash to v4.17.7
This commit is contained in:
Fredrik Adelöw
2024-08-27 17:11:12 +02:00
committed by GitHub
4 changed files with 23 additions and 18 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': patch
---
Small internal fix to better work with recent `lodash` versions
@@ -71,6 +71,9 @@ export function defaultEntityPresentation(
};
}
const isString = (value: unknown): value is string =>
Boolean(value) && typeof value === 'string';
// Try to extract display-worthy parts of an entity or ref as best we can, without throwing
function getParts(entityOrRef: Entity | CompoundEntityRef | string): {
kind?: string;
@@ -99,35 +102,29 @@ function getParts(entityOrRef: Entity | CompoundEntityRef | string): {
}
if (typeof entityOrRef === 'object' && entityOrRef !== null) {
const kind = [get(entityOrRef, 'kind')].find(
candidate => candidate && typeof candidate === 'string',
);
const kind = [get(entityOrRef, 'kind')].find(isString);
const namespace = [
get(entityOrRef, 'metadata.namespace'),
get(entityOrRef, 'namespace'),
].find(candidate => candidate && typeof candidate === 'string');
].find(isString);
const name = [
get(entityOrRef, 'metadata.name'),
get(entityOrRef, 'name'),
].find(candidate => candidate && typeof candidate === 'string');
].find(isString);
const title = [get(entityOrRef, 'metadata.title')].find(
candidate => candidate && typeof candidate === 'string',
);
const title = [get(entityOrRef, 'metadata.title')].find(isString);
const description = [get(entityOrRef, 'metadata.description')].find(
candidate => candidate && typeof candidate === 'string',
isString,
);
const displayName = [get(entityOrRef, 'spec.profile.displayName')].find(
candidate => candidate && typeof candidate === 'string',
isString,
);
const type = [get(entityOrRef, 'spec.type')].find(
candidate => candidate && typeof candidate === 'string',
);
const type = [get(entityOrRef, 'spec.type')].find(isString);
return { kind, namespace, name, title, description, displayName, type };
}
@@ -34,6 +34,9 @@ type FacetsInitialRequest = {
text: string;
};
const maybeString = (value: unknown): string | undefined =>
typeof value === 'string' ? value : undefined;
/**
* This hook asynchronously loads the entity owners using the facets endpoint.
* EntityOwnerPicker uses this hook when mode="owners-only" is passed as prop.
@@ -67,11 +70,11 @@ export function useFacetsEntities({ enabled }: { enabled: boolean }) {
'en-US',
) ||
(
get(a, 'spec.profile.displayName') ||
maybeString(get(a, 'spec.profile.displayName')) ||
a.metadata.title ||
a.metadata.name
).localeCompare(
get(b, 'spec.profile.displayName') ||
maybeString(get(b, 'spec.profile.displayName')) ||
b.metadata.title ||
b.metadata.name,
'en-US',
+3 -3
View File
@@ -18161,9 +18161,9 @@ __metadata:
linkType: hard
"@types/lodash@npm:^4.14.151":
version: 4.17.5
resolution: "@types/lodash@npm:4.17.5"
checksum: 3c9bb15772509f0ecb40428531863dbc3f064f2bf34bbccc2ce2b2923c69fb0868aec7e357b1d97fd0d7f7e435a014ea5c1adef8a64715529887179c97a5a823
version: 4.17.7
resolution: "@types/lodash@npm:4.17.7"
checksum: 09e58a119cd8a70acfb33f8623dc2fc54f74cdce3b3429b879fc2daac4807fe376190a04b9e024dd300f9a3ee1876d6623979cefe619f70654ca0fe0c47679a7
languageName: node
linkType: hard