Do Observable too

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-10-22 16:11:23 +02:00
parent 56f182dde2
commit 10615525f3
33 changed files with 76 additions and 36 deletions
+26
View File
@@ -0,0 +1,26 @@
---
'@backstage/backend-common': patch
'@backstage/catalog-model': patch
'@backstage/cli': patch
'@backstage/config-loader': patch
'@backstage/core-app-api': patch
'@backstage/errors': patch
'@backstage/search-common': patch
'@backstage/test-utils': patch
'@backstage/plugin-app-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-catalog-backend-module-ldap': patch
'@backstage/plugin-catalog-graphql': patch
'@backstage/plugin-catalog-react': patch
'@backstage/plugin-config-schema': patch
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-scaffolder-backend': patch
'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch
'@backstage/plugin-scaffolder-backend-module-rails': patch
'@backstage/plugin-scaffolder-backend-module-yeoman': patch
'@backstage/plugin-scaffolder-common': patch
'@backstage/plugin-search': patch
'@backstage/plugin-shortcuts': patch
---
Switch to use the json and observable types from `@backstage/types`
+2 -3
View File
@@ -40,8 +40,7 @@ import { IconComponent } from '@backstage/core-plugin-api';
import { microsoftAuthApiRef } from '@backstage/core-plugin-api';
import { OAuthApi } from '@backstage/core-plugin-api';
import { OAuthRequestApi } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/core-plugin-api';
import { Observable as Observable_2 } from '@backstage/types';
import { Observable } from '@backstage/types';
import { oktaAuthApiRef } from '@backstage/core-plugin-api';
import { oneloginAuthApiRef } from '@backstage/core-plugin-api';
import { OpenIdConnectApi } from '@backstage/core-plugin-api';
@@ -341,7 +340,7 @@ export const defaultConfigLoader: AppConfigLoader;
export class ErrorAlerter implements ErrorApi {
constructor(alertApi: AlertApi, errorApi: ErrorApi);
// (undocumented)
error$(): Observable_2<{
error$(): Observable<{
error: {
name: string;
message: string;
@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AlertApi, AlertMessage, Observable } from '@backstage/core-plugin-api';
import { AlertApi, AlertMessage } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { PublishSubject } from '../../../lib/subjects';
/**
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { AppThemeApi, AppTheme, Observable } from '@backstage/core-plugin-api';
import { AppThemeApi, AppTheme } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { BehaviorSubject } from '../../../lib/subjects';
const STORAGE_KEY = 'theme';
@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorApi, ErrorContext, Observable } from '@backstage/core-plugin-api';
import { ErrorApi, ErrorContext } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { PublishSubject } from '../../../lib/subjects';
/**
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { BehaviorSubject } from '../../../lib/subjects';
type RequestQueueEntry<ResultType> = {
@@ -19,8 +19,8 @@ import {
PendingAuthRequest,
AuthRequester,
AuthRequesterOptions,
Observable,
} from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { OAuthPendingRequests, PendingRequest } from './OAuthPendingRequests';
import { BehaviorSubject } from '../../../lib/subjects';
@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
StorageApi,
StorageValueChange,
ErrorApi,
Observable,
} from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import ObservableImpl from 'zen-observable';
const buckets = new Map<string, WebStorage>();
@@ -24,8 +24,8 @@ import {
ProfileInfo,
BackstageIdentity,
AuthRequestOptions,
Observable,
} from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { SessionManager } from '../../../../lib/AuthSessionManager/types';
import {
AuthSessionStore,
@@ -28,8 +28,8 @@ import {
SessionState,
SessionApi,
BackstageIdentityApi,
Observable,
} from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { OAuth2Session } from './types';
import { OAuthApiCreateOptions } from '../types';
@@ -25,8 +25,8 @@ import {
ProfileInfoApi,
BackstageIdentityApi,
SessionApi,
Observable,
} from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { SamlSession } from './types';
import {
AuthSessionStore,
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Observable, SessionState } from '@backstage/core-plugin-api';
import { SessionState } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { OptionalRefreshSessionManagerMux } from './OptionalRefreshSessionManagerMux';
import { MutableSessionManager, SessionManager } from './types';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Observable, SessionState } from '@backstage/core-plugin-api';
import { SessionState } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import {
SessionManager,
MutableSessionManager,
@@ -15,7 +15,8 @@
*/
import { BehaviorSubject } from '../subjects';
import { Observable, SessionState } from '@backstage/core-plugin-api';
import { SessionState } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
export class SessionStateTracker {
private readonly subject = new BehaviorSubject<SessionState>(
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Observable, SessionState } from '@backstage/core-plugin-api';
import { SessionState } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
export type GetSessionOptions = {
optional?: boolean;
+1 -1
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import ObservableImpl from 'zen-observable';
// TODO(Rugvip): These are stopgap and probably incomplete implementations of subjects.
+1 -1
View File
@@ -9,7 +9,7 @@ import { ComponentType } from 'react';
import { ErrorApi } from '@backstage/core-plugin-api';
import { ErrorContext } from '@backstage/core-plugin-api';
import { ExternalRouteRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { RenderResult } from '@testing-library/react';
+1
View File
@@ -33,6 +33,7 @@
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/test-utils-core": "^0.1.3",
"@backstage/theme": "^0.2.11",
"@backstage/types": "^0.1.1",
"@material-ui/core": "^4.12.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { ErrorApi, ErrorContext, Observable } from '@backstage/core-plugin-api';
import { ErrorApi, ErrorContext } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
type Options = {
collect?: boolean;
@@ -14,11 +14,8 @@
* limitations under the License.
*/
import {
Observable,
StorageApi,
StorageValueChange,
} from '@backstage/core-plugin-api';
import { StorageApi, StorageValueChange } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import ObservableImpl from 'zen-observable';
export type MockStorageBucket = { [key: string]: any };
+1 -1
View File
@@ -16,7 +16,7 @@ import { Entity } from '@backstage/catalog-model';
import { EntityName } from '@backstage/catalog-model';
import { IconButton } from '@material-ui/core';
import { LinkProps } from '@backstage/core-components';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
import { ReactNode } from 'react';
+1
View File
@@ -36,6 +36,7 @@
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/errors": "^0.1.3",
"@backstage/integration": "^0.6.8",
"@backstage/types": "^0.1.1",
"@backstage/version-bridge": "^0.1.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Observable, StorageApi } from '@backstage/core-plugin-api';
import { StorageApi } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import ObservableImpl from 'zen-observable';
import { performMigrationToTheNewBucket } from './migration';
import { StarredEntitiesApi } from './StarredEntitiesApi';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { ApiRef, createApiRef, Observable } from '@backstage/core-plugin-api';
import { ApiRef, createApiRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
/**
* An API to store starred entities
+1 -1
View File
@@ -7,7 +7,7 @@
import { ApiRef } from '@backstage/core-plugin-api';
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { RouteRef } from '@backstage/core-plugin-api';
import { Schema } from 'jsonschema';
@@ -18,7 +18,7 @@ import ObservableImpl from 'zen-observable';
import { ResponseError } from '@backstage/errors';
import { Schema } from 'jsonschema';
import { ConfigSchemaApi, ConfigSchemaResult } from './types';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
const DEFAULT_URL = 'config-schema.json';
+2 -1
View File
@@ -15,7 +15,8 @@
*/
import { Schema } from 'jsonschema';
import { createApiRef, Observable } from '@backstage/core-plugin-api';
import { createApiRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
export interface ConfigSchemaResult {
schema?: Schema;
+1 -1
View File
@@ -22,7 +22,7 @@ import { IdentityApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { JSONSchema } from '@backstage/catalog-model';
import { JsonValue } from '@backstage/types';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { default as React_2 } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';
import { ScmIntegrationRegistry } from '@backstage/integration';
+1 -2
View File
@@ -15,7 +15,7 @@
*/
import { EntityName } from '@backstage/catalog-model';
import { JsonObject, JsonValue } from '@backstage/types';
import { JsonObject, JsonValue, Observable } from '@backstage/types';
import { ResponseError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { Field, FieldValidation } from '@rjsf/core';
@@ -25,7 +25,6 @@ import {
createApiRef,
DiscoveryApi,
IdentityApi,
Observable,
} from '@backstage/core-plugin-api';
export const scaffolderApiRef = createApiRef<ScaffolderApi>({
@@ -17,7 +17,8 @@ import { useImmerReducer } from 'use-immer';
import { useEffect } from 'react';
import { scaffolderApiRef, LogEvent } from '../../api';
import { ScaffolderTask, Status, TaskOutput } from '../../types';
import { Subscription, useApi } from '@backstage/core-plugin-api';
import { useApi } from '@backstage/core-plugin-api';
import { Subscription } from '@backstage/types';
type Step = {
id: string;
+1 -1
View File
@@ -7,7 +7,7 @@
import { ApiRef } from '@backstage/core-plugin-api';
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import ObservableImpl from 'zen-observable';
import { StorageApi } from '@backstage/core-plugin-api';
+1
View File
@@ -24,6 +24,7 @@
"@backstage/core-components": "^0.7.1",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/theme": "^0.2.11",
"@backstage/types": "^0.1.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
+2 -1
View File
@@ -15,7 +15,8 @@
*/
import { Shortcut } from '../types';
import { createApiRef, Observable } from '@backstage/core-plugin-api';
import { createApiRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
export const shortcutsApiRef = createApiRef<ShortcutApi>({
id: 'plugin.shortcuts.api',