chore: rename data services

This commit is contained in:
DarkSky 2022-12-29 14:55:41 +08:00 committed by DarkSky
parent 8e1bf90ebd
commit 0d79f183c5
41 changed files with 49 additions and 48 deletions

View File

@ -3,5 +3,5 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"cSpell.words": ["blocksuite", "livedemo", "pnpm", "testid"]
"cSpell.words": ["blocksuite", "datacenter", "livedemo", "pnpm", "testid"]
}

View File

@ -7,12 +7,12 @@
"scripts": {
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
"dev:ac": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev:ac",
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/data-services -r build",
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
"export": "pnpm --filter @affine/app export",
"start": "pnpm --filter @affine/app start",
"lint": "pnpm --filter @affine/app lint",
"test": "playwright test",
"test:dc": "pnpm --filter @affine/data-services test",
"test:dc": "pnpm --filter @affine/datacenter test",
"test:e2e:codegen": "npx playwright codegen http://localhost:8080",
"test:unit": "jest",
"postinstall": "husky install",

View File

@ -10,7 +10,7 @@
"lint": "next lint"
},
"dependencies": {
"@affine/data-services": "workspace:*",
"@affine/datacenter": "workspace:*",
"@blocksuite/blocks": "0.3.1",
"@blocksuite/editor": "0.3.1",
"@blocksuite/icons": "^2.0.2",

View File

@ -4,7 +4,7 @@ import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { useState } from 'react';
import { inviteMember, getUserByEmail } from '@affine/data-services';
import { inviteMember, getUserByEmail } from '@affine/datacenter';
import { Avatar } from '@mui/material';
interface LoginModalProps {
open: boolean;

View File

@ -1,4 +1,4 @@
import { signInWithGoogle } from '@affine/data-services';
import { signInWithGoogle } from '@affine/datacenter';
import { styled } from '@/styles';
import { Button } from '@/ui/button';
import { useModal } from '@/providers/global-modal-provider';

View File

@ -11,7 +11,7 @@ import {
import { useState } from 'react';
import { ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
import { deleteWorkspace } from '@affine/data-services';
import { deleteWorkspace } from '@affine/datacenter';
import { useRouter } from 'next/router';
import { useAppState } from '@/providers/app-state-provider';

View File

@ -9,7 +9,7 @@ import { StyledSettingH2 } from '../style';
import { useState } from 'react';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { uploadBlob, Workspace, WorkspaceType } from '@affine/data-services';
import { uploadBlob, Workspace, WorkspaceType } from '@affine/datacenter';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
import { WorkspaceDelete } from './delete';

View File

@ -7,7 +7,7 @@ import {
} from './style';
import { ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
import { leaveWorkspace } from '@affine/data-services';
import { leaveWorkspace } from '@affine/datacenter';
import { useRouter } from 'next/router';
import { useAppState } from '@/providers/app-state-provider';

View File

@ -42,7 +42,7 @@ import {
Member,
removeMember,
updateWorkspace,
} from '@affine/data-services';
} from '@affine/datacenter';
import { Avatar } from '@mui/material';
import { Menu, MenuItem } from '@/ui/menu';
import { toast } from '@/ui/toast';

View File

@ -12,7 +12,7 @@ import {
} from './WorkspaceItem';
import { WorkspaceSetting } from '@/components/workspace-setting';
import { useCallback, useEffect, useState } from 'react';
import { getWorkspaceDetail, WorkspaceType } from '@affine/data-services';
import { getWorkspaceDetail, WorkspaceType } from '@affine/datacenter';
import { useModal } from '@/providers/global-modal-provider';
export type WorkspaceDetails = Record<

View File

@ -1,4 +1,4 @@
import { createWorkspace, uploadBlob } from '@affine/data-services';
import { createWorkspace, uploadBlob } from '@affine/datacenter';
import Modal from '@/ui/modal';
import Input from '@/ui/input';
import {

View File

@ -7,7 +7,7 @@ import {
} from '../styles';
import { FooterSetting } from './FooterSetting';
import { FooterUsers } from './FooterUsers';
import { WorkspaceType } from '@affine/data-services';
import { WorkspaceType } from '@affine/datacenter';
import { useAppState } from '@/providers/app-state-provider';
interface WorkspaceItemProps {

View File

@ -3,7 +3,7 @@ import { Avatar, WorkspaceName, SelectorWrapper } from './styles';
import { SelectorPopperContent } from './SelectorPopperContent';
import { useState } from 'react';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceType } from '@affine/data-services';
import { WorkspaceType } from '@affine/datacenter';
import { AffineIcon } from '../icons/icons';
export const WorkspaceSelector = () => {

View File

@ -1,7 +1,7 @@
import { styled } from '@/styles';
import { Empty } from '@/ui/empty';
import { Avatar } from '@mui/material';
import { acceptInviting } from '@affine/data-services';
import { acceptInviting } from '@affine/datacenter';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

View File

@ -1,6 +1,6 @@
import { createContext, MutableRefObject, useContext } from 'react';
import type { Workspace } from '@affine/data-services';
import { AccessTokenMessage } from '@affine/data-services';
import type { Workspace } from '@affine/datacenter';
import { AccessTokenMessage } from '@affine/datacenter';
import type {
Page as StorePage,
Workspace as StoreWorkspace,

View File

@ -1,9 +1,5 @@
import { useEffect } from 'react';
import {
AccessTokenMessage,
getWorkspaces,
token,
} from '@affine/data-services';
import { AccessTokenMessage, getWorkspaces, token } from '@affine/datacenter';
import { LoadWorkspaceHandler } from '../context';
export const useSyncData = ({

View File

@ -1,7 +1,7 @@
import { useMemo, useState, useEffect, useCallback, useRef } from 'react';
import type { ReactNode } from 'react';
import dynamic from 'next/dynamic';
import { getWorkspaces } from '@affine/data-services';
import { getWorkspaces } from '@affine/datacenter';
import { AppState, AppStateContext } from './context';
import type {
AppStateValue,

View File

@ -1,5 +1,5 @@
{
"name": "@affine/data-services",
"name": "@affine/datacenter",
"version": "0.3.0",
"description": "",
"type": "module",

View File

@ -0,0 +1,9 @@
export class DataCenter {
static async init() {
return new DataCenter();
}
private constructor() {
// TODO
}
}

View File

@ -0,0 +1,15 @@
import { DataCenter } from './datacenter.js';
const _initializeDataCenter = () => {
let _dataCenterInstance: Promise<DataCenter>;
return () => {
if (!_dataCenterInstance) {
_dataCenterInstance = DataCenter.init();
}
return _dataCenterInstance;
};
};
export const getDataCenter = _initializeDataCenter();

View File

@ -3,4 +3,4 @@ export * from './request';
export * from './sdks';
export * from './websocket';
export { getDataCenter } from './data-center';
export { getDataCenter } from './datacenter';

View File

@ -1,4 +1,4 @@
export const getDataCenter = () =>
import('../src/data-center.js').then(async dataCenter =>
import('../src/datacenter/index.js').then(async dataCenter =>
dataCenter.getDataCenter()
);

View File

@ -1,19 +0,0 @@
class DataCenter {
static async init() {
return new DataCenter();
}
private constructor() {
// TODO
}
}
let _dataCenterInstance: Promise<DataCenter>;
export const getDataCenter = () => {
if (!_dataCenterInstance) {
_dataCenterInstance = DataCenter.init();
}
return _dataCenterInstance;
};

View File

@ -44,7 +44,7 @@ importers:
packages/app:
specifiers:
'@affine/data-services': workspace:*
'@affine/datacenter': workspace:*
'@blocksuite/blocks': 0.3.1
'@blocksuite/editor': 0.3.1
'@blocksuite/icons': ^2.0.2
@ -86,7 +86,7 @@ importers:
typescript: 4.8.3
yjs: ^13.5.44
dependencies:
'@affine/data-services': link:../data-services
'@affine/datacenter': link:../data-center
'@blocksuite/blocks': 0.3.1_yjs@13.5.44
'@blocksuite/editor': 0.3.1_yjs@13.5.44
'@blocksuite/icons': 2.0.4_w5j4k42lgipnm43s3brx6h3c34
@ -129,7 +129,7 @@ importers:
raw-loader: 4.0.2
typescript: 4.8.3
packages/data-services:
packages/data-center:
specifiers:
'@playwright/test': ^1.29.1
encoding: ^0.1.13