@backstage/frontend-plugin-api 0.13.1 → 0.13.2-next.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 +9 -2
- package/dist/analytics/useAnalytics.esm.js +14 -1
- package/dist/analytics/useAnalytics.esm.js.map +1 -1
- package/dist/apis/definitions/AlertApi.esm.js +11 -0
- package/dist/apis/definitions/AlertApi.esm.js.map +1 -0
- package/dist/apis/definitions/AnalyticsApi.esm.js +4 -1
- package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppLanguageApi.esm.js +11 -0
- package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -0
- package/dist/apis/definitions/AppThemeApi.esm.js +11 -0
- package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -0
- package/dist/apis/definitions/AppTreeApi.esm.js +4 -1
- package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
- package/dist/apis/definitions/ConfigApi.esm.js +11 -0
- package/dist/apis/definitions/ConfigApi.esm.js.map +1 -0
- package/dist/apis/definitions/DialogApi.esm.js +4 -1
- package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
- package/dist/apis/definitions/DiscoveryApi.esm.js +11 -0
- package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -0
- package/dist/apis/definitions/ErrorApi.esm.js +11 -0
- package/dist/apis/definitions/ErrorApi.esm.js.map +1 -0
- package/dist/apis/definitions/FeatureFlagsApi.esm.js +21 -0
- package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -0
- package/dist/apis/definitions/FetchApi.esm.js +11 -0
- package/dist/apis/definitions/FetchApi.esm.js.map +1 -0
- package/dist/apis/definitions/IconsApi.esm.js +4 -1
- package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
- package/dist/apis/definitions/IdentityApi.esm.js +11 -0
- package/dist/apis/definitions/IdentityApi.esm.js.map +1 -0
- package/dist/apis/definitions/OAuthRequestApi.esm.js +11 -0
- package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -0
- package/dist/apis/definitions/RouteResolutionApi.esm.js +4 -1
- package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
- package/dist/apis/definitions/StorageApi.esm.js +11 -0
- package/dist/apis/definitions/StorageApi.esm.js.map +1 -0
- package/dist/apis/definitions/SwappableComponentsApi.esm.js +4 -1
- package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
- package/dist/apis/definitions/TranslationApi.esm.js +11 -0
- package/dist/apis/definitions/TranslationApi.esm.js.map +1 -0
- package/dist/apis/definitions/auth.esm.js +51 -0
- package/dist/apis/definitions/auth.esm.js.map +1 -0
- package/dist/apis/system/ApiRef.esm.js +27 -0
- package/dist/apis/system/ApiRef.esm.js.map +1 -0
- package/dist/apis/system/helpers.esm.js +13 -0
- package/dist/apis/system/helpers.esm.js.map +1 -0
- package/dist/apis/system/useApi.esm.js +50 -0
- package/dist/apis/system/useApi.esm.js.map +1 -0
- package/dist/blueprints/NavItemBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PageBlueprint.esm.js +15 -1
- package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/SignInPageBlueprint.esm.js +15 -1
- package/dist/blueprints/SignInPageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/ThemeBlueprint.esm.js.map +1 -1
- package/dist/components/ExtensionBoundary.esm.js +2 -1
- package/dist/components/ExtensionBoundary.esm.js.map +1 -1
- package/dist/components/createSwappableComponent.esm.js +14 -1
- package/dist/components/createSwappableComponent.esm.js.map +1 -1
- package/dist/index.d.ts +1595 -148
- package/dist/index.esm.js +20 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/routing/useRouteRef.esm.js +14 -1
- package/dist/routing/useRouteRef.esm.js.map +1 -1
- package/dist/translation/TranslationMessages.esm.js +11 -0
- package/dist/translation/TranslationMessages.esm.js.map +1 -0
- package/dist/translation/TranslationRef.esm.js +62 -0
- package/dist/translation/TranslationRef.esm.js.map +1 -0
- package/dist/translation/TranslationResource.esm.js +21 -0
- package/dist/translation/TranslationResource.esm.js.map +1 -0
- package/dist/translation/useTranslationRef.esm.js +89 -0
- package/dist/translation/useTranslationRef.esm.js.map +1 -0
- package/package.json +28 -21
package/dist/index.esm.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
export { AnalyticsContext } from './analytics/AnalyticsContext.esm.js';
|
|
2
2
|
export { useAnalytics } from './analytics/useAnalytics.esm.js';
|
|
3
3
|
export { appTreeApiRef } from './apis/definitions/AppTreeApi.esm.js';
|
|
4
|
-
export { SessionState,
|
|
4
|
+
export { SessionState, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, vmwareCloudAuthApiRef } from './apis/definitions/auth.esm.js';
|
|
5
|
+
export { alertApiRef } from './apis/definitions/AlertApi.esm.js';
|
|
6
|
+
export { appLanguageApiRef } from './apis/definitions/AppLanguageApi.esm.js';
|
|
7
|
+
export { appThemeApiRef } from './apis/definitions/AppThemeApi.esm.js';
|
|
5
8
|
export { swappableComponentsApiRef } from './apis/definitions/SwappableComponentsApi.esm.js';
|
|
9
|
+
export { configApiRef } from './apis/definitions/ConfigApi.esm.js';
|
|
10
|
+
export { discoveryApiRef } from './apis/definitions/DiscoveryApi.esm.js';
|
|
11
|
+
export { errorApiRef } from './apis/definitions/ErrorApi.esm.js';
|
|
12
|
+
export { FeatureFlagState, featureFlagsApiRef } from './apis/definitions/FeatureFlagsApi.esm.js';
|
|
13
|
+
export { fetchApiRef } from './apis/definitions/FetchApi.esm.js';
|
|
6
14
|
export { iconsApiRef } from './apis/definitions/IconsApi.esm.js';
|
|
15
|
+
export { identityApiRef } from './apis/definitions/IdentityApi.esm.js';
|
|
7
16
|
export { dialogApiRef } from './apis/definitions/DialogApi.esm.js';
|
|
17
|
+
export { oauthRequestApiRef } from './apis/definitions/OAuthRequestApi.esm.js';
|
|
8
18
|
export { routeResolutionApiRef } from './apis/definitions/RouteResolutionApi.esm.js';
|
|
19
|
+
export { storageApiRef } from './apis/definitions/StorageApi.esm.js';
|
|
9
20
|
export { analyticsApiRef } from './apis/definitions/AnalyticsApi.esm.js';
|
|
21
|
+
export { translationApiRef } from './apis/definitions/TranslationApi.esm.js';
|
|
22
|
+
export { useApi, useApiHolder, withApis } from './apis/system/useApi.esm.js';
|
|
23
|
+
export { createApiRef } from './apis/system/ApiRef.esm.js';
|
|
24
|
+
export { createApiFactory } from './apis/system/helpers.esm.js';
|
|
10
25
|
export { AnalyticsImplementationBlueprint } from './blueprints/AnalyticsImplementationBlueprint.esm.js';
|
|
11
26
|
export { ApiBlueprint } from './blueprints/ApiBlueprint.esm.js';
|
|
12
27
|
export { AppRootElementBlueprint } from './blueprints/AppRootElementBlueprint.esm.js';
|
|
@@ -29,7 +44,10 @@ export { createSubRouteRef } from './routing/SubRouteRef.esm.js';
|
|
|
29
44
|
export { createExternalRouteRef } from './routing/ExternalRouteRef.esm.js';
|
|
30
45
|
export { useRouteRef } from './routing/useRouteRef.esm.js';
|
|
31
46
|
export { useRouteRefParams } from './routing/useRouteRefParams.esm.js';
|
|
32
|
-
export { createTranslationMessages
|
|
47
|
+
export { createTranslationMessages } from './translation/TranslationMessages.esm.js';
|
|
48
|
+
export { createTranslationResource } from './translation/TranslationResource.esm.js';
|
|
49
|
+
export { createTranslationRef } from './translation/TranslationRef.esm.js';
|
|
50
|
+
export { useTranslationRef } from './translation/useTranslationRef.esm.js';
|
|
33
51
|
export { coreExtensionData } from './wiring/coreExtensionData.esm.js';
|
|
34
52
|
export { createExtension } from './wiring/createExtension.esm.js';
|
|
35
53
|
export { createExtensionInput } from './wiring/createExtensionInput.esm.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
3
|
import '../apis/definitions/AppTreeApi.esm.js';
|
|
4
|
-
import
|
|
4
|
+
import '../apis/definitions/auth.esm.js';
|
|
5
|
+
import '../apis/definitions/AlertApi.esm.js';
|
|
6
|
+
import '../apis/definitions/AppLanguageApi.esm.js';
|
|
7
|
+
import '../apis/definitions/AppThemeApi.esm.js';
|
|
5
8
|
import '../apis/definitions/SwappableComponentsApi.esm.js';
|
|
9
|
+
import '../apis/definitions/ConfigApi.esm.js';
|
|
10
|
+
import '../apis/definitions/DiscoveryApi.esm.js';
|
|
11
|
+
import '../apis/definitions/ErrorApi.esm.js';
|
|
12
|
+
import '../apis/definitions/FeatureFlagsApi.esm.js';
|
|
13
|
+
import '../apis/definitions/FetchApi.esm.js';
|
|
6
14
|
import '../apis/definitions/IconsApi.esm.js';
|
|
15
|
+
import '../apis/definitions/IdentityApi.esm.js';
|
|
7
16
|
import '../apis/definitions/DialogApi.esm.js';
|
|
17
|
+
import '../apis/definitions/OAuthRequestApi.esm.js';
|
|
8
18
|
import { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi.esm.js';
|
|
19
|
+
import '../apis/definitions/StorageApi.esm.js';
|
|
9
20
|
import '../apis/definitions/AnalyticsApi.esm.js';
|
|
21
|
+
import '../apis/definitions/TranslationApi.esm.js';
|
|
22
|
+
import { useApi } from '../apis/system/useApi.esm.js';
|
|
10
23
|
|
|
11
24
|
function useRouteRef(routeRef) {
|
|
12
25
|
const { pathname } = useLocation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouteRef.esm.js","sources":["../../src/routing/useRouteRef.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { AnyRouteRefParams } from './types';\nimport { RouteRef } from './RouteRef';\nimport { SubRouteRef } from './SubRouteRef';\nimport { ExternalRouteRef } from './ExternalRouteRef';\nimport { RouteFunc, routeResolutionApiRef, useApi } from '../apis';\n\n/**\n * React hook for constructing URLs to routes.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}\n *\n * @param routeRef - The ref to route that should be converted to URL.\n * @returns A function that will in turn return the concrete URL of the `routeRef`, or `undefined` if the route is not available.\n * @public\n */\nexport function useRouteRef<TParams extends AnyRouteRefParams>(\n routeRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams>,\n): RouteFunc<TParams> | undefined {\n const { pathname } = useLocation();\n const routeResolutionApi = useApi(routeResolutionApiRef);\n\n const routeFunc = useMemo(\n () => routeResolutionApi.resolve(routeRef, { sourcePath: pathname }),\n [routeResolutionApi, routeRef, pathname],\n );\n\n return routeFunc;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRouteRef.esm.js","sources":["../../src/routing/useRouteRef.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { AnyRouteRefParams } from './types';\nimport { RouteRef } from './RouteRef';\nimport { SubRouteRef } from './SubRouteRef';\nimport { ExternalRouteRef } from './ExternalRouteRef';\nimport { RouteFunc, routeResolutionApiRef, useApi } from '../apis';\n\n/**\n * React hook for constructing URLs to routes.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}\n *\n * @param routeRef - The ref to route that should be converted to URL.\n * @returns A function that will in turn return the concrete URL of the `routeRef`, or `undefined` if the route is not available.\n * @public\n */\nexport function useRouteRef<TParams extends AnyRouteRefParams>(\n routeRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams>,\n): RouteFunc<TParams> | undefined {\n const { pathname } = useLocation();\n const routeResolutionApi = useApi(routeResolutionApiRef);\n\n const routeFunc = useMemo(\n () => routeResolutionApi.resolve(routeRef, { sourcePath: pathname }),\n [routeResolutionApi, routeRef, pathname],\n );\n\n return routeFunc;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YACd,QAAA,EAIgC;AAChC,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,WAAA,EAAY;AACjC,EAAA,MAAM,kBAAA,GAAqB,OAAO,qBAAqB,CAAA;AAEvD,EAAA,MAAM,SAAA,GAAY,OAAA;AAAA,IAChB,MAAM,kBAAA,CAAmB,OAAA,CAAQ,UAAU,EAAE,UAAA,EAAY,UAAU,CAAA;AAAA,IACnE,CAAC,kBAAA,EAAoB,QAAA,EAAU,QAAQ;AAAA,GACzC;AAEA,EAAA,OAAO,SAAA;AACT;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function createTranslationMessages(options) {
|
|
2
|
+
return {
|
|
3
|
+
$$type: "@backstage/TranslationMessages",
|
|
4
|
+
id: options.ref.id,
|
|
5
|
+
full: Boolean(options.full),
|
|
6
|
+
messages: options.messages
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createTranslationMessages };
|
|
11
|
+
//# sourceMappingURL=TranslationMessages.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationMessages.esm.js","sources":["../../src/translation/TranslationMessages.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TranslationRef } from './TranslationRef';\n\n/**\n * Represents a collection of messages to be provided for a given translation ref.\n *\n * @public\n * @remarks\n *\n * This collection of messages can either be used directly as an override for the\n * default messages, or it can be used to provide translations for a language by\n * by being referenced by a {@link TranslationResource}.\n */\nexport interface TranslationMessages<\n TId extends string = string,\n TMessages extends { [key in string]: string } = { [key in string]: string },\n TFull extends boolean = boolean,\n> {\n $$type: '@backstage/TranslationMessages';\n /** The ID of the translation ref that these messages are for */\n id: TId;\n /** Whether or not these messages override all known messages */\n full: TFull;\n /** The messages provided for the given translation ref */\n messages: TMessages;\n}\n\n/**\n * Options for {@link createTranslationMessages}.\n *\n * @public\n */\nexport interface TranslationMessagesOptions<\n TId extends string,\n TMessages extends { [key in string]: string },\n TFull extends boolean,\n> {\n ref: TranslationRef<TId, TMessages>;\n\n full?: TFull;\n\n messages: false extends TFull\n ? { [key in keyof TMessages]?: string | null }\n : { [key in keyof TMessages]: string | null };\n}\n\n/**\n * Creates a collection of messages for a given translation ref.\n *\n * @public\n */\nexport function createTranslationMessages<\n TId extends string,\n TMessages extends { [key in string]: string },\n TFull extends boolean,\n>(\n options: TranslationMessagesOptions<TId, TMessages, TFull>,\n): TranslationMessages<TId, TMessages, TFull> {\n return {\n $$type: '@backstage/TranslationMessages',\n id: options.ref.id,\n full: Boolean(options.full) as TFull,\n messages: options.messages as TMessages,\n };\n}\n"],"names":[],"mappings":"AAkEO,SAAS,0BAKd,OAAA,EAC4C;AAC5C,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,gCAAA;AAAA,IACR,EAAA,EAAI,QAAQ,GAAA,CAAI,EAAA;AAAA,IAChB,IAAA,EAAM,OAAA,CAAQ,OAAA,CAAQ,IAAI,CAAA;AAAA,IAC1B,UAAU,OAAA,CAAQ;AAAA,GACpB;AACF;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createTranslationResource } from './TranslationResource.esm.js';
|
|
2
|
+
|
|
3
|
+
function flattenMessages(nested) {
|
|
4
|
+
const entries = new Array();
|
|
5
|
+
function visit(obj, prefix) {
|
|
6
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
entries.push([prefix + key, value]);
|
|
9
|
+
} else {
|
|
10
|
+
visit(value, `${prefix}${key}.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
visit(nested, "");
|
|
15
|
+
return Object.fromEntries(entries);
|
|
16
|
+
}
|
|
17
|
+
class TranslationRefImpl {
|
|
18
|
+
#id;
|
|
19
|
+
#messages;
|
|
20
|
+
#resources;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.#id = options.id;
|
|
23
|
+
this.#messages = flattenMessages(
|
|
24
|
+
options.messages
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
$$type = "@backstage/TranslationRef";
|
|
28
|
+
version = "v1";
|
|
29
|
+
get id() {
|
|
30
|
+
return this.#id;
|
|
31
|
+
}
|
|
32
|
+
get T() {
|
|
33
|
+
throw new Error("Not implemented");
|
|
34
|
+
}
|
|
35
|
+
getDefaultMessages() {
|
|
36
|
+
return this.#messages;
|
|
37
|
+
}
|
|
38
|
+
setDefaultResource(resources) {
|
|
39
|
+
this.#resources = resources;
|
|
40
|
+
}
|
|
41
|
+
getDefaultResource() {
|
|
42
|
+
return this.#resources;
|
|
43
|
+
}
|
|
44
|
+
toString() {
|
|
45
|
+
return `TranslationRef{id=${this.id}}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function createTranslationRef(config) {
|
|
49
|
+
const ref = new TranslationRefImpl(config);
|
|
50
|
+
if (config.translations) {
|
|
51
|
+
ref.setDefaultResource(
|
|
52
|
+
createTranslationResource({
|
|
53
|
+
ref,
|
|
54
|
+
translations: config.translations
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return ref;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { createTranslationRef };
|
|
62
|
+
//# sourceMappingURL=TranslationRef.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationRef.esm.js","sources":["../../src/translation/TranslationRef.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createTranslationResource,\n TranslationResource,\n} from './TranslationResource';\n\n/** @public */\nexport interface TranslationRef<\n TId extends string = string,\n TMessages extends { [key in string]: string } = { [key in string]: string },\n> {\n $$type: '@backstage/TranslationRef';\n\n id: TId;\n\n T: TMessages;\n}\n\n/** @internal */\ntype AnyMessages = { [key in string]: string };\n\n/** @ignore */\ntype AnyNestedMessages = { [key in string]: AnyNestedMessages | string };\n\n/**\n * Flattens a nested message declaration into a flat object with dot-separated keys.\n *\n * @ignore\n */\ntype FlattenedMessages<TMessages extends AnyNestedMessages> =\n // Flatten out object keys into a union structure of objects, e.g. { a: 'a', b: 'b' } -> { a: 'a' } | { b: 'b' }\n // Any nested object will be flattened into the individual unions, e.g. { a: 'a', b: { x: 'x', y: 'y' } } -> { a: 'a' } | { 'b.x': 'x', 'b.y': 'y' }\n // We create this structure by first nesting the desired union types into the original object, and\n // then extract them by indexing with `keyof TMessages` to form the union.\n // Throughout this the objects are wrapped up in a function parameter, which allows us to have the\n // final step of flipping this unions around to an intersection by inferring the function parameter.\n {\n [TKey in keyof TMessages]: (\n _: TMessages[TKey] extends infer TValue // \"local variable\" for the value\n ? TValue extends AnyNestedMessages\n ? FlattenedMessages<TValue> extends infer TNested // Recurse into nested messages, \"local variable\" for the result\n ? {\n [TNestedKey in keyof TNested as `${TKey & string}.${TNestedKey &\n string}`]: TNested[TNestedKey];\n }\n : never\n : { [_ in TKey]: TValue } // Primitive object values are passed through with the same key\n : never,\n ) => void;\n // The `[keyof TMessages]` extracts the object values union from our flattened structure, still wrapped up in function parameters.\n // The `extends (_: infer TIntersection) => void` flips the union to an intersection, at which point we have the correct type.\n }[keyof TMessages] extends (_: infer TIntersection) => void\n ? // This object mapping just expands similar to the Expand<> utility type, providing nicer type hints\n {\n readonly [TExpandKey in keyof TIntersection]: TIntersection[TExpandKey];\n }\n : never;\n\n/** @internal */\nexport interface InternalTranslationRef<\n TId extends string = string,\n TMessages extends { [key in string]: string } = { [key in string]: string },\n> extends TranslationRef<TId, TMessages> {\n version: 'v1';\n\n getDefaultMessages(): AnyMessages;\n\n getDefaultResource(): TranslationResource | undefined;\n}\n\n/** @public */\nexport interface TranslationRefOptions<\n TId extends string,\n TNestedMessages extends AnyNestedMessages,\n TTranslations extends {\n [language in string]: () => Promise<{\n default: {\n [key in keyof FlattenedMessages<TNestedMessages>]: string | null;\n };\n }>;\n },\n> {\n id: TId;\n messages: TNestedMessages;\n translations?: TTranslations;\n}\n\nfunction flattenMessages(nested: AnyNestedMessages): AnyMessages {\n const entries = new Array<[string, string]>();\n\n function visit(obj: AnyNestedMessages, prefix: string): void {\n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'string') {\n entries.push([prefix + key, value]);\n } else {\n visit(value, `${prefix}${key}.`);\n }\n }\n }\n\n visit(nested, '');\n\n return Object.fromEntries(entries);\n}\n\n/** @internal */\nclass TranslationRefImpl<\n TId extends string,\n TNestedMessages extends AnyNestedMessages,\n> implements InternalTranslationRef<TId, FlattenedMessages<TNestedMessages>>\n{\n #id: TId;\n #messages: FlattenedMessages<TNestedMessages>;\n #resources: TranslationResource | undefined;\n\n constructor(options: TranslationRefOptions<TId, TNestedMessages, any>) {\n this.#id = options.id;\n this.#messages = flattenMessages(\n options.messages,\n ) as FlattenedMessages<TNestedMessages>;\n }\n\n $$type = '@backstage/TranslationRef' as const;\n\n version = 'v1' as const;\n\n get id(): TId {\n return this.#id;\n }\n\n get T(): never {\n throw new Error('Not implemented');\n }\n\n getDefaultMessages(): AnyMessages {\n return this.#messages;\n }\n\n setDefaultResource(resources: TranslationResource): void {\n this.#resources = resources;\n }\n\n getDefaultResource(): TranslationResource | undefined {\n return this.#resources;\n }\n\n toString() {\n return `TranslationRef{id=${this.id}}`;\n }\n}\n\n/** @public */\nexport function createTranslationRef<\n TId extends string,\n const TNestedMessages extends AnyNestedMessages,\n TTranslations extends {\n [language in string]: () => Promise<{\n default: {\n [key in keyof FlattenedMessages<TNestedMessages>]: string | null;\n };\n }>;\n },\n>(\n config: TranslationRefOptions<TId, TNestedMessages, TTranslations>,\n): TranslationRef<TId, FlattenedMessages<TNestedMessages>> {\n const ref = new TranslationRefImpl(config);\n if (config.translations) {\n ref.setDefaultResource(\n createTranslationResource({\n ref,\n translations: config.translations as any,\n }),\n );\n }\n return ref;\n}\n\n/** @internal */\nexport function toInternalTranslationRef<\n TId extends string,\n TMessages extends AnyMessages,\n>(ref: TranslationRef<TId, TMessages>): InternalTranslationRef<TId, TMessages> {\n const r = ref as InternalTranslationRef<TId, TMessages>;\n if (r.$$type !== '@backstage/TranslationRef') {\n throw new Error(`Invalid translation ref, bad type '${r.$$type}'`);\n }\n if (r.version !== 'v1') {\n throw new Error(`Invalid translation ref, bad version '${r.version}'`);\n }\n return r;\n}\n"],"names":[],"mappings":";;AAsGA,SAAS,gBAAgB,MAAA,EAAwC;AAC/D,EAAA,MAAM,OAAA,GAAU,IAAI,KAAA,EAAwB;AAE5C,EAAA,SAAS,KAAA,CAAM,KAAwB,MAAA,EAAsB;AAC3D,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAA,EAAG;AAC9C,MAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,QAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,MAAA,GAAS,GAAA,EAAK,KAAK,CAAC,CAAA;AAAA,MACpC,CAAA,MAAO;AACL,QAAA,KAAA,CAAM,KAAA,EAAO,CAAA,EAAG,MAAM,CAAA,EAAG,GAAG,CAAA,CAAA,CAAG,CAAA;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AAEA,EAAA,KAAA,CAAM,QAAQ,EAAE,CAAA;AAEhB,EAAA,OAAO,MAAA,CAAO,YAAY,OAAO,CAAA;AACnC;AAGA,MAAM,kBAAA,CAIN;AAAA,EACE,GAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EAEA,YAAY,OAAA,EAA2D;AACrE,IAAA,IAAA,CAAK,MAAM,OAAA,CAAQ,EAAA;AACnB,IAAA,IAAA,CAAK,SAAA,GAAY,eAAA;AAAA,MACf,OAAA,CAAQ;AAAA,KACV;AAAA,EACF;AAAA,EAEA,MAAA,GAAS,2BAAA;AAAA,EAET,OAAA,GAAU,IAAA;AAAA,EAEV,IAAI,EAAA,GAAU;AACZ,IAAA,OAAO,IAAA,CAAK,GAAA;AAAA,EACd;AAAA,EAEA,IAAI,CAAA,GAAW;AACb,IAAA,MAAM,IAAI,MAAM,iBAAiB,CAAA;AAAA,EACnC;AAAA,EAEA,kBAAA,GAAkC;AAChC,IAAA,OAAO,IAAA,CAAK,SAAA;AAAA,EACd;AAAA,EAEA,mBAAmB,SAAA,EAAsC;AACvD,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA;AAAA,EACpB;AAAA,EAEA,kBAAA,GAAsD;AACpD,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACd;AAAA,EAEA,QAAA,GAAW;AACT,IAAA,OAAO,CAAA,kBAAA,EAAqB,KAAK,EAAE,CAAA,CAAA,CAAA;AAAA,EACrC;AACF;AAGO,SAAS,qBAWd,MAAA,EACyD;AACzD,EAAA,MAAM,GAAA,GAAM,IAAI,kBAAA,CAAmB,MAAM,CAAA;AACzC,EAAA,IAAI,OAAO,YAAA,EAAc;AACvB,IAAA,GAAA,CAAI,kBAAA;AAAA,MACF,yBAAA,CAA0B;AAAA,QACxB,GAAA;AAAA,QACA,cAAc,MAAA,CAAO;AAAA,OACtB;AAAA,KACH;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function createTranslationResource(options) {
|
|
2
|
+
return {
|
|
3
|
+
$$type: "@backstage/TranslationResource",
|
|
4
|
+
version: "v1",
|
|
5
|
+
id: options.ref.id,
|
|
6
|
+
resources: Object.entries(options.translations).map(
|
|
7
|
+
([language, loader]) => ({
|
|
8
|
+
language,
|
|
9
|
+
loader: () => loader().then((m) => {
|
|
10
|
+
const value = m.default;
|
|
11
|
+
return {
|
|
12
|
+
messages: value?.$$type === "@backstage/TranslationMessages" ? value.messages : value
|
|
13
|
+
};
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { createTranslationResource };
|
|
21
|
+
//# sourceMappingURL=TranslationResource.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationResource.esm.js","sources":["../../src/translation/TranslationResource.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TranslationMessages } from './TranslationMessages';\nimport { TranslationRef } from './TranslationRef';\n\n/** @public */\nexport interface TranslationResource<TId extends string = string> {\n $$type: '@backstage/TranslationResource';\n id: TId;\n}\n\n/** @internal */\nexport type InternalTranslationResourceLoader = () => Promise<{\n messages: { [key in string]: string | null };\n}>;\n\n/** @internal */\nexport interface InternalTranslationResource<TId extends string = string>\n extends TranslationResource<TId> {\n version: 'v1';\n resources: Array<{\n language: string;\n loader: InternalTranslationResourceLoader;\n }>;\n}\n\n/** @internal */\nexport function toInternalTranslationResource<TId extends string>(\n resource: TranslationResource<TId>,\n): InternalTranslationResource<TId> {\n const r = resource as InternalTranslationResource<TId>;\n if (r.$$type !== '@backstage/TranslationResource') {\n throw new Error(`Invalid translation resource, bad type '${r.$$type}'`);\n }\n if (r.version !== 'v1') {\n throw new Error(`Invalid translation resource, bad version '${r.version}'`);\n }\n\n return r;\n}\n\n/** @public */\nexport interface TranslationResourceOptions<\n TId extends string,\n TMessages extends { [key in string]: string },\n TTranslations extends {\n [language in string]: () => Promise<{\n default:\n | TranslationMessages<TId>\n | { [key in keyof TMessages]: string | null };\n }>;\n },\n> {\n ref: TranslationRef<TId, TMessages>;\n\n translations: TTranslations;\n}\n\n/** @public */\nexport function createTranslationResource<\n TId extends string,\n TMessages extends { [key in string]: string },\n TTranslations extends {\n [language in string]: () => Promise<{\n default:\n | TranslationMessages<TId>\n | { [key in keyof TMessages]: string | null };\n }>;\n },\n>(\n options: TranslationResourceOptions<TId, TMessages, TTranslations>,\n): TranslationResource<TId> {\n return {\n $$type: '@backstage/TranslationResource',\n version: 'v1',\n id: options.ref.id,\n resources: Object.entries(options.translations).map(\n ([language, loader]) => ({\n language,\n loader: () =>\n loader().then(m => {\n const value = m.default;\n return {\n messages:\n value?.$$type === '@backstage/TranslationMessages'\n ? value.messages\n : value,\n };\n }),\n }),\n ),\n } as InternalTranslationResource<TId>;\n}\n"],"names":[],"mappings":"AAyEO,SAAS,0BAWd,OAAA,EAC0B;AAC1B,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,gCAAA;AAAA,IACR,OAAA,EAAS,IAAA;AAAA,IACT,EAAA,EAAI,QAAQ,GAAA,CAAI,EAAA;AAAA,IAChB,SAAA,EAAW,MAAA,CAAO,OAAA,CAAQ,OAAA,CAAQ,YAAY,CAAA,CAAE,GAAA;AAAA,MAC9C,CAAC,CAAC,QAAA,EAAU,MAAM,CAAA,MAAO;AAAA,QACvB,QAAA;AAAA,QACA,MAAA,EAAQ,MACN,MAAA,EAAO,CAAE,KAAK,CAAA,CAAA,KAAK;AACjB,UAAA,MAAM,QAAQ,CAAA,CAAE,OAAA;AAChB,UAAA,OAAO;AAAA,YACL,QAAA,EACE,KAAA,EAAO,MAAA,KAAW,gCAAA,GACd,MAAM,QAAA,GACN;AAAA,WACR;AAAA,QACF,CAAC;AAAA,OACL;AAAA;AACF,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import '../apis/definitions/AppTreeApi.esm.js';
|
|
3
|
+
import '../apis/definitions/auth.esm.js';
|
|
4
|
+
import '../apis/definitions/AlertApi.esm.js';
|
|
5
|
+
import '../apis/definitions/AppLanguageApi.esm.js';
|
|
6
|
+
import '../apis/definitions/AppThemeApi.esm.js';
|
|
7
|
+
import '../apis/definitions/SwappableComponentsApi.esm.js';
|
|
8
|
+
import '../apis/definitions/ConfigApi.esm.js';
|
|
9
|
+
import '../apis/definitions/DiscoveryApi.esm.js';
|
|
10
|
+
import { errorApiRef } from '../apis/definitions/ErrorApi.esm.js';
|
|
11
|
+
import '../apis/definitions/FeatureFlagsApi.esm.js';
|
|
12
|
+
import '../apis/definitions/FetchApi.esm.js';
|
|
13
|
+
import '../apis/definitions/IconsApi.esm.js';
|
|
14
|
+
import '../apis/definitions/IdentityApi.esm.js';
|
|
15
|
+
import '../apis/definitions/DialogApi.esm.js';
|
|
16
|
+
import '../apis/definitions/OAuthRequestApi.esm.js';
|
|
17
|
+
import '../apis/definitions/RouteResolutionApi.esm.js';
|
|
18
|
+
import '../apis/definitions/StorageApi.esm.js';
|
|
19
|
+
import '../apis/definitions/AnalyticsApi.esm.js';
|
|
20
|
+
import { translationApiRef } from '../apis/definitions/TranslationApi.esm.js';
|
|
21
|
+
import { useApi } from '../apis/system/useApi.esm.js';
|
|
22
|
+
|
|
23
|
+
const loggedRefs = /* @__PURE__ */ new WeakSet();
|
|
24
|
+
const useTranslationRef = (translationRef) => {
|
|
25
|
+
const errorApi = useApi(errorApiRef);
|
|
26
|
+
const translationApi = useApi(translationApiRef);
|
|
27
|
+
const [snapshot, setSnapshot] = useState(
|
|
28
|
+
() => translationApi.getTranslation(translationRef)
|
|
29
|
+
);
|
|
30
|
+
const observable = useMemo(
|
|
31
|
+
() => translationApi.translation$(translationRef),
|
|
32
|
+
[translationApi, translationRef]
|
|
33
|
+
);
|
|
34
|
+
const onError = useCallback(
|
|
35
|
+
(error) => {
|
|
36
|
+
if (!loggedRefs.has(translationRef)) {
|
|
37
|
+
const errMsg = `Failed to load translation resource '${translationRef.id}'; caused by ${error}`;
|
|
38
|
+
console.error(errMsg);
|
|
39
|
+
errorApi.post(new Error(errMsg));
|
|
40
|
+
loggedRefs.add(translationRef);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[errorApi, translationRef]
|
|
44
|
+
);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const subscription = observable.subscribe({
|
|
47
|
+
next(next) {
|
|
48
|
+
if (next.ready) {
|
|
49
|
+
setSnapshot(next);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
error(error) {
|
|
53
|
+
onError(error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return () => {
|
|
57
|
+
subscription.unsubscribe();
|
|
58
|
+
};
|
|
59
|
+
}, [observable, onError]);
|
|
60
|
+
const initialRenderRef = useRef(true);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (initialRenderRef.current) {
|
|
63
|
+
initialRenderRef.current = false;
|
|
64
|
+
} else {
|
|
65
|
+
setSnapshot(translationApi.getTranslation(translationRef));
|
|
66
|
+
}
|
|
67
|
+
}, [translationApi, translationRef]);
|
|
68
|
+
if (!snapshot.ready) {
|
|
69
|
+
throw new Promise((resolve) => {
|
|
70
|
+
const subscription = observable.subscribe({
|
|
71
|
+
next(next) {
|
|
72
|
+
if (next.ready) {
|
|
73
|
+
subscription.unsubscribe();
|
|
74
|
+
resolve();
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
error(error) {
|
|
78
|
+
subscription.unsubscribe();
|
|
79
|
+
onError(error);
|
|
80
|
+
resolve();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return { t: snapshot.t };
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { useTranslationRef };
|
|
89
|
+
//# sourceMappingURL=useTranslationRef.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslationRef.esm.js","sources":["../../src/translation/useTranslationRef.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { errorApiRef, useApi } from '../apis';\nimport {\n translationApiRef,\n TranslationFunction,\n TranslationSnapshot,\n} from '../apis/definitions/TranslationApi';\nimport { TranslationRef } from './TranslationRef';\n\n// Make sure we don't fill the logs with loading errors for the same ref\nconst loggedRefs = new WeakSet<TranslationRef<string, {}>>();\n\n/** @public */\nexport const useTranslationRef = <\n TMessages extends { [key in string]: string },\n>(\n translationRef: TranslationRef<string, TMessages>,\n): { t: TranslationFunction<TMessages> } => {\n const errorApi = useApi(errorApiRef);\n const translationApi = useApi(translationApiRef);\n\n const [snapshot, setSnapshot] = useState<TranslationSnapshot<TMessages>>(() =>\n translationApi.getTranslation(translationRef),\n );\n const observable = useMemo(\n () => translationApi.translation$(translationRef),\n [translationApi, translationRef],\n );\n\n const onError = useCallback(\n (error: Error) => {\n if (!loggedRefs.has(translationRef)) {\n const errMsg = `Failed to load translation resource '${translationRef.id}'; caused by ${error}`;\n // eslint-disable-next-line no-console\n console.error(errMsg);\n errorApi.post(new Error(errMsg));\n loggedRefs.add(translationRef);\n }\n },\n [errorApi, translationRef],\n );\n\n useEffect(() => {\n const subscription = observable.subscribe({\n next(next) {\n if (next.ready) {\n setSnapshot(next);\n }\n },\n error(error) {\n onError(error);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [observable, onError]);\n\n // Keep track of if the provided translation ref changes, and in that case update the snapshot\n const initialRenderRef = useRef(true);\n useEffect(() => {\n if (initialRenderRef.current) {\n initialRenderRef.current = false;\n } else {\n setSnapshot(translationApi.getTranslation(translationRef));\n }\n }, [translationApi, translationRef]);\n\n if (!snapshot.ready) {\n throw new Promise<void>(resolve => {\n const subscription = observable.subscribe({\n next(next) {\n if (next.ready) {\n subscription.unsubscribe();\n resolve();\n }\n },\n error(error) {\n subscription.unsubscribe();\n onError(error);\n resolve();\n },\n });\n });\n }\n\n return { t: snapshot.t };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,UAAA,uBAAiB,OAAA,EAAoC;AAGpD,MAAM,iBAAA,GAAoB,CAG/B,cAAA,KAC0C;AAC1C,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,cAAA,GAAiB,OAAO,iBAAiB,CAAA;AAE/C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAAA;AAAA,IAAyC,MACvE,cAAA,CAAe,cAAA,CAAe,cAAc;AAAA,GAC9C;AACA,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,cAAA,CAAe,YAAA,CAAa,cAAc,CAAA;AAAA,IAChD,CAAC,gBAAgB,cAAc;AAAA,GACjC;AAEA,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACd,CAAC,KAAA,KAAiB;AAChB,MAAA,IAAI,CAAC,UAAA,CAAW,GAAA,CAAI,cAAc,CAAA,EAAG;AACnC,QAAA,MAAM,MAAA,GAAS,CAAA,qCAAA,EAAwC,cAAA,CAAe,EAAE,gBAAgB,KAAK,CAAA,CAAA;AAE7F,QAAA,OAAA,CAAQ,MAAM,MAAM,CAAA;AACpB,QAAA,QAAA,CAAS,IAAA,CAAK,IAAI,KAAA,CAAM,MAAM,CAAC,CAAA;AAC/B,QAAA,UAAA,CAAW,IAAI,cAAc,CAAA;AAAA,MAC/B;AAAA,IACF,CAAA;AAAA,IACA,CAAC,UAAU,cAAc;AAAA,GAC3B;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,WAAW,SAAA,CAAU;AAAA,MACxC,KAAK,IAAA,EAAM;AACT,QAAA,IAAI,KAAK,KAAA,EAAO;AACd,UAAA,WAAA,CAAY,IAAI,CAAA;AAAA,QAClB;AAAA,MACF,CAAA;AAAA,MACA,MAAM,KAAA,EAAO;AACX,QAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,MACf;AAAA,KACD,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,YAAA,CAAa,WAAA,EAAY;AAAA,IAC3B,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,UAAA,EAAY,OAAO,CAAC,CAAA;AAGxB,EAAA,MAAM,gBAAA,GAAmB,OAAO,IAAI,CAAA;AACpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,iBAAiB,OAAA,EAAS;AAC5B,MAAA,gBAAA,CAAiB,OAAA,GAAU,KAAA;AAAA,IAC7B,CAAA,MAAO;AACL,MAAA,WAAA,CAAY,cAAA,CAAe,cAAA,CAAe,cAAc,CAAC,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA,EAAG,CAAC,cAAA,EAAgB,cAAc,CAAC,CAAA;AAEnC,EAAA,IAAI,CAAC,SAAS,KAAA,EAAO;AACnB,IAAA,MAAM,IAAI,QAAc,CAAA,OAAA,KAAW;AACjC,MAAA,MAAM,YAAA,GAAe,WAAW,SAAA,CAAU;AAAA,QACxC,KAAK,IAAA,EAAM;AACT,UAAA,IAAI,KAAK,KAAA,EAAO;AACd,YAAA,YAAA,CAAa,WAAA,EAAY;AACzB,YAAA,OAAA,EAAQ;AAAA,UACV;AAAA,QACF,CAAA;AAAA,QACA,MAAM,KAAA,EAAO;AACX,UAAA,YAAA,CAAa,WAAA,EAAY;AACzB,UAAA,OAAA,CAAQ,KAAK,CAAA;AACb,UAAA,OAAA,EAAQ;AAAA,QACV;AAAA,OACD,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,EAAE,CAAA,EAAG,QAAA,CAAS,CAAA,EAAE;AACzB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-plugin-api",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2-next.0",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
7
7
|
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
"main": "dist/index.esm.js",
|
|
10
|
-
"types": "dist/index.d.ts"
|
|
8
|
+
"access": "public"
|
|
11
9
|
},
|
|
12
10
|
"repository": {
|
|
13
11
|
"type": "git",
|
|
@@ -16,8 +14,23 @@
|
|
|
16
14
|
},
|
|
17
15
|
"license": "Apache-2.0",
|
|
18
16
|
"sideEffects": false,
|
|
19
|
-
"
|
|
20
|
-
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.esm.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.esm.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.esm.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
"package.json": [
|
|
30
|
+
"package.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
21
34
|
"files": [
|
|
22
35
|
"dist"
|
|
23
36
|
],
|
|
@@ -31,20 +44,21 @@
|
|
|
31
44
|
"test": "backstage-cli package test"
|
|
32
45
|
},
|
|
33
46
|
"dependencies": {
|
|
34
|
-
"@backstage/
|
|
35
|
-
"@backstage/core-
|
|
36
|
-
"@backstage/
|
|
37
|
-
"@backstage/
|
|
47
|
+
"@backstage/config": "1.3.6",
|
|
48
|
+
"@backstage/core-components": "0.18.4-next.0",
|
|
49
|
+
"@backstage/errors": "1.2.7",
|
|
50
|
+
"@backstage/types": "1.2.2",
|
|
51
|
+
"@backstage/version-bridge": "1.0.11",
|
|
38
52
|
"@material-ui/core": "^4.12.4",
|
|
39
53
|
"lodash": "^4.17.21",
|
|
40
54
|
"zod": "^3.22.4",
|
|
41
55
|
"zod-to-json-schema": "^3.21.4"
|
|
42
56
|
},
|
|
43
57
|
"devDependencies": {
|
|
44
|
-
"@backstage/cli": "
|
|
45
|
-
"@backstage/frontend-app-api": "
|
|
46
|
-
"@backstage/frontend-test-utils": "
|
|
47
|
-
"@backstage/test-utils": "
|
|
58
|
+
"@backstage/cli": "0.34.6-next.0",
|
|
59
|
+
"@backstage/frontend-app-api": "0.13.3-next.0",
|
|
60
|
+
"@backstage/frontend-test-utils": "0.4.2-next.0",
|
|
61
|
+
"@backstage/test-utils": "1.7.14-next.0",
|
|
48
62
|
"@testing-library/jest-dom": "^6.0.0",
|
|
49
63
|
"@testing-library/react": "^16.0.0",
|
|
50
64
|
"@types/react": "^18.0.0",
|
|
@@ -64,12 +78,5 @@
|
|
|
64
78
|
"optional": true
|
|
65
79
|
}
|
|
66
80
|
},
|
|
67
|
-
"typesVersions": {
|
|
68
|
-
"*": {
|
|
69
|
-
"package.json": [
|
|
70
|
-
"package.json"
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
81
|
"module": "./dist/index.esm.js"
|
|
75
82
|
}
|