@ts4nfdi/terminology-service-suite 7.4.1 → 7.4.2

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.
@@ -31,6 +31,12 @@ export declare function getFrontEndApi(api: string): string;
31
31
  */
32
32
  export declare function getEntityInOntologySuffix(ontologyId: string, entityTypeArray: string[] | string, iri?: string, useLegacy?: boolean): string;
33
33
  export declare function pluralizeType(typeArray: string[] | string, useLegacy?: boolean): "terms" | "classes" | "properties" | "individuals" | "ontologies";
34
+ /**
35
+ * Like {@link pluralizeType}, but returns undefined instead of throwing if no thingType
36
+ * is contained in {@link typeArray}. Use in render paths, where a throw would unmount the
37
+ * whole React tree.
38
+ */
39
+ export declare function tryPluralizeType(typeArray: string[] | string, useLegacy?: boolean): "terms" | "classes" | "properties" | "individuals" | "ontologies" | undefined;
34
40
  export declare function singularizeType(typeArray: string[] | string, useLegacy?: boolean): ThingTypeName;
35
41
  /**
36
42
  * Returns a random string used mainly for component keys.
@@ -42,6 +48,11 @@ export declare function isEuiLinkColor(str: string): str is EuiLinkColor;
42
48
  export declare function withAlpha(color: string, alpha: number): string;
43
49
  export declare function isEuiButtonColor(str: string): str is EuiLinkColor;
44
50
  export declare function getErrorMessageToDisplay(error: any, messagePlaceholder?: string): string;
45
- export declare function inferTypeFromTypeArray(types: string[]): "class" | "term" | "individual" | "property" | "annotationProperty" | "dataProperty" | "objectProperty" | "ontology";
51
+ export declare function inferTypeFromTypeArray(types: string[]): "class" | "term" | "skos:Concept" | "individual" | "property" | "annotationProperty" | "dataProperty" | "objectProperty" | "ontology";
52
+ /**
53
+ * Like {@link inferTypeFromTypeArray}, but returns undefined instead of throwing if the type
54
+ * cannot be inferred. Use in render paths, where a throw would unmount the whole React tree.
55
+ */
56
+ export declare function tryInferTypeFromTypeArray(types: string[]): ThingTypeName | undefined;
46
57
  export declare function manuallyEmbedOnNavigate(code: string, storyContext: StoryContext): string;
47
58
  export declare function dictFromParamString(parameter?: string): any;
@@ -0,0 +1,27 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ type ErrorBoundaryProps = {
3
+ children?: ReactNode;
4
+ /**
5
+ * Rendered instead of {@link children} if rendering them threw. If omitted, a neutral
6
+ * message is displayed.
7
+ */
8
+ fallback?: ReactNode | ((error: Error) => ReactNode);
9
+ };
10
+ type ErrorBoundaryState = {
11
+ error?: Error;
12
+ };
13
+ /**
14
+ * Catches errors thrown while rendering {@link ErrorBoundaryProps.children} and renders
15
+ * {@link ErrorBoundaryProps.fallback} instead, so a single broken subtree does not unmount
16
+ * the whole application.
17
+ *
18
+ * The boundary keeps showing the fallback until it is remounted. Pass a `key` that changes
19
+ * with the rendered content (e.g. the entities' iri) to reset it.
20
+ */
21
+ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
22
+ constructor(props: ErrorBoundaryProps);
23
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
24
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
25
+ render(): ReactNode;
26
+ }
27
+ export {};
@@ -30,7 +30,8 @@ export default meta;
30
30
  type Story = StoryObj<typeof meta>;
31
31
  export declare const Default: Story;
32
32
  export declare const ApiGateway: Story;
33
- export declare const ApiGatewayWithCollection: Story;
33
+ export declare const ApiGatewayWithFAIRAgroCollection: Story;
34
+ export declare const ApiGatewayWithNFDI4HealthCollection: Story;
34
35
  export declare const NavigateToSearchResult: Story;
35
36
  export declare const NFDI4Health: Story;
36
37
  export declare const TibNFDI4CHEM: Story;
@@ -26,7 +26,14 @@ export declare const ApiGatewayArgs: {
26
26
  targetLink: string;
27
27
  useLegacy: boolean;
28
28
  };
29
- export declare const ApiGatewayWithCollectionArgs: {
29
+ export declare const ApiGatewayWithFAIRAgroCollectionArgs: {
30
+ api: string;
31
+ query: string;
32
+ targetLink: string;
33
+ parameter: string;
34
+ useLegacy: boolean;
35
+ };
36
+ export declare const ApiGatewayWithNFDI4HealthCollectionArgs: {
30
37
  api: string;
31
38
  query: string;
32
39
  targetLink: string;