@backstage/core-plugin-api 1.11.2-next.0 → 1.11.2-next.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage/core-plugin-api
2
2
 
3
+ ## 1.11.2-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b2bef92: Convert all enums to erasable-syntax compliant patterns
8
+
3
9
  ## 1.11.2-next.0
4
10
 
5
11
  ### Patch Changes
@@ -3,11 +3,16 @@ import '@backstage/version-bridge';
3
3
  import '@backstage/errors';
4
4
  import { createApiRef } from '../system/ApiRef.esm.js';
5
5
 
6
- var FeatureFlagState = /* @__PURE__ */ ((FeatureFlagState2) => {
7
- FeatureFlagState2[FeatureFlagState2["None"] = 0] = "None";
8
- FeatureFlagState2[FeatureFlagState2["Active"] = 1] = "Active";
9
- return FeatureFlagState2;
10
- })(FeatureFlagState || {});
6
+ const FeatureFlagState = {
7
+ /**
8
+ * Feature flag inactive (disabled).
9
+ */
10
+ None: 0,
11
+ /**
12
+ * Feature flag active (enabled).
13
+ */
14
+ Active: 1
15
+ };
11
16
  const featureFlagsApiRef = createApiRef({
12
17
  id: "core.featureflags"
13
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../../src/apis/definitions/FeatureFlagsApi.ts"],"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 { ApiRef, createApiRef } from '../system';\n\n/**\n * Feature flag descriptor.\n *\n * @public\n */\nexport type FeatureFlag = {\n name: string;\n pluginId: string;\n description?: string;\n};\n\n/**\n * Enum representing the state of a feature flag (inactive/active).\n *\n * @public\n */\nexport enum FeatureFlagState {\n /**\n * Feature flag inactive (disabled).\n */\n None = 0,\n /**\n * Feature flag active (enabled).\n */\n Active = 1,\n}\n\n/**\n * Options to use when saving feature flags.\n *\n * @public\n */\nexport type FeatureFlagsSaveOptions = {\n /**\n * The new feature flag states to save.\n */\n states: Record<string, FeatureFlagState>;\n\n /**\n * Whether the saves states should be merged into the existing ones, or replace them.\n *\n * Defaults to false.\n */\n merge?: boolean;\n};\n\n/**\n * The feature flags API is used to toggle functionality to users across plugins and Backstage.\n *\n * @remarks\n *\n * Plugins can use this API to register feature flags that they have available\n * for users to enable/disable, and this API will centralize the current user's\n * state of which feature flags they would like to enable.\n *\n * This is ideal for Backstage plugins, as well as your own App, to trial incomplete\n * or unstable upcoming features. Although there will be a common interface for users\n * to enable and disable feature flags, this API acts as another way to enable/disable.\n *\n * @public\n */\nexport interface FeatureFlagsApi {\n /**\n * Registers a new feature flag. Once a feature flag has been registered it\n * can be toggled by users, and read back to enable or disable features.\n */\n registerFlag(flag: FeatureFlag): void;\n\n /**\n * Get a list of all registered flags.\n */\n getRegisteredFlags(): FeatureFlag[];\n\n /**\n * Whether the feature flag with the given name is currently activated for the user.\n */\n isActive(name: string): boolean;\n\n /**\n * Save the user's choice of feature flag states.\n */\n save(options: FeatureFlagsSaveOptions): void;\n}\n\n/**\n * The {@link ApiRef} of {@link FeatureFlagsApi}.\n *\n * @public\n */\nexport const featureFlagsApiRef: ApiRef<FeatureFlagsApi> = createApiRef({\n id: 'core.featureflags',\n});\n"],"names":["FeatureFlagState"],"mappings":";;;;;AAkCO,IAAK,gBAAA,qBAAAA,iBAAAA,KAAL;AAIL,EAAAA,iBAAAA,CAAAA,iBAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AAIA,EAAAA,iBAAAA,CAAAA,iBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AARU,EAAA,OAAAA,iBAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA;AAyEL,MAAM,qBAA8C,YAAA,CAAa;AAAA,EACtE,EAAA,EAAI;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../../src/apis/definitions/FeatureFlagsApi.ts"],"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/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { ApiRef, createApiRef } from '../system';\n\n/**\n * Feature flag descriptor.\n *\n * @public\n */\nexport type FeatureFlag = {\n name: string;\n pluginId: string;\n description?: string;\n};\n\n/**\n * Enum representing the state of a feature flag (inactive/active).\n *\n * @public\n */\nexport const FeatureFlagState = {\n /**\n * Feature flag inactive (disabled).\n */\n None: 0,\n /**\n * Feature flag active (enabled).\n */\n Active: 1,\n} as const;\n\n/**\n * @public\n */\nexport type FeatureFlagState =\n (typeof FeatureFlagState)[keyof typeof FeatureFlagState];\n\n/**\n * @public\n */\nexport namespace FeatureFlagState {\n export type None = typeof FeatureFlagState.None;\n export type Active = typeof FeatureFlagState.Active;\n}\n\n/**\n * Options to use when saving feature flags.\n *\n * @public\n */\nexport type FeatureFlagsSaveOptions = {\n /**\n * The new feature flag states to save.\n */\n states: Record<string, FeatureFlagState>;\n\n /**\n * Whether the saves states should be merged into the existing ones, or replace them.\n *\n * Defaults to false.\n */\n merge?: boolean;\n};\n\n/**\n * The feature flags API is used to toggle functionality to users across plugins and Backstage.\n *\n * @remarks\n *\n * Plugins can use this API to register feature flags that they have available\n * for users to enable/disable, and this API will centralize the current user's\n * state of which feature flags they would like to enable.\n *\n * This is ideal for Backstage plugins, as well as your own App, to trial incomplete\n * or unstable upcoming features. Although there will be a common interface for users\n * to enable and disable feature flags, this API acts as another way to enable/disable.\n *\n * @public\n */\nexport interface FeatureFlagsApi {\n /**\n * Registers a new feature flag. Once a feature flag has been registered it\n * can be toggled by users, and read back to enable or disable features.\n */\n registerFlag(flag: FeatureFlag): void;\n\n /**\n * Get a list of all registered flags.\n */\n getRegisteredFlags(): FeatureFlag[];\n\n /**\n * Whether the feature flag with the given name is currently activated for the user.\n */\n isActive(name: string): boolean;\n\n /**\n * Save the user's choice of feature flag states.\n */\n save(options: FeatureFlagsSaveOptions): void;\n}\n\n/**\n * The {@link ApiRef} of {@link FeatureFlagsApi}.\n *\n * @public\n */\nexport const featureFlagsApiRef: ApiRef<FeatureFlagsApi> = createApiRef({\n id: 'core.featureflags',\n});\n"],"names":[],"mappings":";;;;;AAoCO,MAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA,EAI9B,IAAA,EAAM,CAAA;AAAA;AAAA;AAAA;AAAA,EAIN,MAAA,EAAQ;AACV;AA8EO,MAAM,qBAA8C,YAAA,CAAa;AAAA,EACtE,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -3,11 +3,16 @@ import '@backstage/version-bridge';
3
3
  import '@backstage/errors';
4
4
  import { createApiRef } from '../system/ApiRef.esm.js';
5
5
 
6
- var SessionState = /* @__PURE__ */ ((SessionState2) => {
7
- SessionState2["SignedIn"] = "SignedIn";
8
- SessionState2["SignedOut"] = "SignedOut";
9
- return SessionState2;
10
- })(SessionState || {});
6
+ const SessionState = {
7
+ /**
8
+ * User signed in.
9
+ */
10
+ SignedIn: "SignedIn",
11
+ /**
12
+ * User not signed in.
13
+ */
14
+ SignedOut: "SignedOut"
15
+ };
11
16
  const googleAuthApiRef = createApiRef({
12
17
  id: "core.auth.google"
13
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"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 { ApiRef, createApiRef } from '../system';\nimport { IconComponent } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>({ ... })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n */\n icon: IconComponent;\n\n /**\n * Optional user friendly messaage to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport enum SessionState {\n /**\n * User signed in.\n */\n SignedIn = 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut = 'SignedOut',\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.google',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.github',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.okta',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.gitlab',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.microsoft',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.onelogin',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket-server',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.atlassian',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.vmware-cloud',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.openshift',\n});\n"],"names":["SessionState"],"mappings":";;;;;AA+QO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AAIL,EAAAA,cAAA,UAAA,CAAA,GAAW,UAAA;AAIX,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AARF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AA4CL,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,iBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAYM,MAAM,sBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAOM,MAAM,qBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,wBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAaM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"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/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { ApiRef, createApiRef } from '../system';\nimport { IconComponent } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>({ ... })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n */\n icon: IconComponent;\n\n /**\n * Optional user friendly messaage to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport const SessionState = {\n /**\n * User signed in.\n */\n SignedIn: 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut: 'SignedOut',\n} as const;\n\n/**\n * @public\n */\nexport type SessionState = (typeof SessionState)[keyof typeof SessionState];\n\n/**\n * @public\n */\nexport namespace SessionState {\n export type SignedIn = typeof SessionState.SignedIn;\n export type SignedOut = typeof SessionState.SignedOut;\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.google',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.github',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.okta',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.gitlab',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.microsoft',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.onelogin',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket-server',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.atlassian',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.vmware-cloud',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.openshift',\n});\n"],"names":[],"mappings":";;;;;AAiRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAIV,SAAA,EAAW;AACb;AAgDO,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,iBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAYM,MAAM,sBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAOM,MAAM,qBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,wBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAaM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;;;;"}
package/dist/index.d.ts CHANGED
@@ -409,15 +409,26 @@ type ProfileInfo = {
409
409
  *
410
410
  * @public
411
411
  */
412
- declare enum SessionState {
412
+ declare const SessionState: {
413
413
  /**
414
414
  * User signed in.
415
415
  */
416
- SignedIn = "SignedIn",
416
+ readonly SignedIn: "SignedIn";
417
417
  /**
418
418
  * User not signed in.
419
419
  */
420
- SignedOut = "SignedOut"
420
+ readonly SignedOut: "SignedOut";
421
+ };
422
+ /**
423
+ * @public
424
+ */
425
+ type SessionState = (typeof SessionState)[keyof typeof SessionState];
426
+ /**
427
+ * @public
428
+ */
429
+ declare namespace SessionState {
430
+ type SignedIn = typeof SessionState.SignedIn;
431
+ type SignedOut = typeof SessionState.SignedOut;
421
432
  }
422
433
  /**
423
434
  * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.
@@ -872,15 +883,26 @@ type FeatureFlag = {
872
883
  *
873
884
  * @public
874
885
  */
875
- declare enum FeatureFlagState {
886
+ declare const FeatureFlagState: {
876
887
  /**
877
888
  * Feature flag inactive (disabled).
878
889
  */
879
- None = 0,
890
+ readonly None: 0;
880
891
  /**
881
892
  * Feature flag active (enabled).
882
893
  */
883
- Active = 1
894
+ readonly Active: 1;
895
+ };
896
+ /**
897
+ * @public
898
+ */
899
+ type FeatureFlagState = (typeof FeatureFlagState)[keyof typeof FeatureFlagState];
900
+ /**
901
+ * @public
902
+ */
903
+ declare namespace FeatureFlagState {
904
+ type None = typeof FeatureFlagState.None;
905
+ type Active = typeof FeatureFlagState.Active;
884
906
  }
885
907
  /**
886
908
  * Options to use when saving feature flags.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/core-plugin-api",
3
- "version": "1.11.2-next.0",
3
+ "version": "1.11.2-next.1",
4
4
  "description": "Core API used by Backstage plugins",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -64,8 +64,8 @@
64
64
  "history": "^5.0.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@backstage/cli": "0.34.5-next.0",
68
- "@backstage/core-app-api": "1.19.2-next.0",
67
+ "@backstage/cli": "0.34.5-next.1",
68
+ "@backstage/core-app-api": "1.19.2-next.1",
69
69
  "@backstage/test-utils": "1.7.13-next.0",
70
70
  "@testing-library/dom": "^10.0.0",
71
71
  "@testing-library/jest-dom": "^6.0.0",