refactor(core): move infra modules to core (#9207)

This commit is contained in:
EYHN
2024-12-23 04:53:59 +00:00
parent 2ea79d25ad
commit 129f94ee78
337 changed files with 908 additions and 1367 deletions

View File

@@ -1,5 +1,4 @@
import type { GetWorkspacePageMetaByIdQuery } from '@affine/graphql';
import type { DocService, GlobalCache } from '@toeverything/infra';
import {
backoffRetry,
catchErrorInto,
@@ -13,6 +12,8 @@ import {
} from '@toeverything/infra';
import { EMPTY, mergeMap } from 'rxjs';
import type { DocService } from '../../doc';
import type { GlobalCache } from '../../storage';
import { isBackendError, isNetworkError } from '../error';
import type { CloudDocMetaStore } from '../stores/cloud-doc-meta';

View File

@@ -1,5 +1,4 @@
import type { InvoicesQuery } from '@affine/graphql';
import type { WorkspaceService } from '@toeverything/infra';
import {
backoffRetry,
catchErrorInto,
@@ -13,6 +12,7 @@ import {
} from '@toeverything/infra';
import { EMPTY, map, mergeMap } from 'rxjs';
import type { WorkspaceService } from '../../workspace';
import { isBackendError, isNetworkError } from '../error';
import type { WorkspaceServerService } from '../services/workspace-server';
import { InvoicesStore } from '../stores/invoices';

View File

@@ -1,6 +1,5 @@
import type { SubscriptionQuery, SubscriptionRecurring } from '@affine/graphql';
import { SubscriptionPlan } from '@affine/graphql';
import type { WorkspaceService } from '@toeverything/infra';
import {
backoffRetry,
catchErrorInto,
@@ -14,10 +13,10 @@ import {
} from '@toeverything/infra';
import { EMPTY, mergeMap } from 'rxjs';
import type { WorkspaceService } from '../../workspace';
import { isBackendError, isNetworkError } from '../error';
import type { WorkspaceServerService } from '../services/workspace-server';
import { SubscriptionStore } from '../stores/subscription';
export type SubscriptionType = NonNullable<
SubscriptionQuery['currentUser']
>['subscriptions'][number];

View File

@@ -33,18 +33,12 @@ export { WorkspaceServerService } from './services/workspace-server';
export { WorkspaceSubscriptionService } from './services/workspace-subscription';
export type { ServerConfig } from './types';
import {
DocScope,
DocService,
type Framework,
GlobalCache,
GlobalState,
GlobalStateService,
WorkspaceScope,
WorkspaceService,
} from '@toeverything/infra';
import { type Framework } from '@toeverything/infra';
import { DocScope, DocService } from '../doc';
import { GlobalCache, GlobalState, GlobalStateService } from '../storage';
import { UrlService } from '../url';
import { WorkspaceScope, WorkspaceService } from '../workspace';
import { CloudDocMeta } from './entities/cloud-doc-meta';
import { Invoices } from './entities/invoices';
import { Server } from './entities/server';

View File

@@ -1,9 +1,10 @@
import { AIProvider } from '@affine/core/blocksuite/presets/ai';
import type { OAuthProviderType } from '@affine/graphql';
import { track } from '@affine/track';
import { ApplicationFocused, OnEvent, Service } from '@toeverything/infra';
import { OnEvent, Service } from '@toeverything/infra';
import { distinctUntilChanged, map, skip } from 'rxjs';
import { ApplicationFocused } from '../../lifecycle';
import type { UrlService } from '../../url';
import { type AuthAccountInfo, AuthSession } from '../entities/session';
import { BackendError } from '../error';

View File

@@ -1,6 +1,7 @@
import { ApplicationStarted, OnEvent, Service } from '@toeverything/infra';
import { OnEvent, Service } from '@toeverything/infra';
import { Manager } from 'socket.io-client';
import { ApplicationStarted } from '../../lifecycle';
import { AccountChanged } from '../events/account-changed';
import type { WebSocketAuthProvider } from '../provider/websocket-auth';
import type { AuthService } from './auth';

View File

@@ -3,9 +3,9 @@ import {
updateUserProfileMutation,
uploadAvatarMutation,
} from '@affine/graphql';
import type { GlobalState } from '@toeverything/infra';
import { Store } from '@toeverything/infra';
import type { GlobalState } from '../../storage';
import type { AuthSessionInfo } from '../entities/session';
import type { FetchService } from '../services/fetch';
import type { GraphQLService } from '../services/graphql';

View File

@@ -1,7 +1,7 @@
import type { GlobalStateService } from '@toeverything/infra';
import { Store } from '@toeverything/infra';
import { map } from 'rxjs';
import type { GlobalStateService } from '../../storage';
import { BUILD_IN_SERVERS } from '../constant';
import type { ServerConfig, ServerMetadata } from '../types';

View File

@@ -12,14 +12,13 @@ import {
subscriptionQuery,
updateSubscriptionMutation,
} from '@affine/graphql';
import type { GlobalCache } from '@toeverything/infra';
import { Store } from '@toeverything/infra';
import type { GlobalCache } from '../../storage';
import type { UrlService } from '../../url';
import type { SubscriptionType } from '../entities/subscription';
import type { GraphQLService } from '../services/graphql';
import type { ServerService } from '../services/server';
const SUBSCRIPTION_CACHE_KEY = 'subscription:';
const getDefaultSubscriptionSuccessCallbackLink = (