Merge remote-tracking branch 'origin/master' into feat/cloud-sync-saika

This commit is contained in:
alt0
2023-01-09 15:38:25 +08:00
106 changed files with 196 additions and 653 deletions
+8 -4
View File
@@ -10,8 +10,8 @@
".": "./dist/src/index.js"
},
"scripts": {
"build": "tsc --project ./tsconfig.json",
"test": "playwright test"
"dev": "tsc --project ./tsconfig.json -w",
"build": "tsc --project ./tsconfig.json"
},
"keywords": [],
"author": "",
@@ -26,8 +26,8 @@
"typescript": "^4.8.4"
},
"dependencies": {
"@blocksuite/blocks": "=0.3.1-20230106060050-1aad55d",
"@blocksuite/store": "=0.3.1-20230106060050-1aad55d",
"@blocksuite/blocks": "^0.3.1-20230109032243-37ad3ba",
"@blocksuite/store": "^0.3.1-20230109032243-37ad3ba",
"debug": "^4.3.4",
"encoding": "^0.1.13",
"firebase": "^9.15.0",
@@ -38,5 +38,9 @@
"swr": "^2.0.0",
"yjs": "^13.5.44",
"y-protocols": "^1.0.5"
},
"peerDependencies": {
"@blocksuite/blocks": "0.3.1-*",
"@blocksuite/store": "0.3.1-*"
}
}
-25
View File
@@ -1,25 +0,0 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: './tests',
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000,
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
use: {
actionTimeout: 0,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
};
export default config;
@@ -1 +1 @@
export * from './local';
export * from './local.js';
@@ -1,10 +1,10 @@
import { describe, test, expect } from 'vitest';
import { Workspaces } from '../../workspaces';
import { LocalProvider } from './local';
import { test, expect } from '@playwright/test';
import { Workspaces } from '../../workspaces/index.js';
import { LocalProvider } from './local.js';
import 'fake-indexeddb/auto';
import { BlobStorage } from '@blocksuite/store';
describe('local provider', () => {
test.describe.serial('local provider', () => {
const workspaces = new Workspaces();
const provider = new LocalProvider({
workspaces: workspaces.createScope(),
@@ -46,7 +46,12 @@ describe('local provider', () => {
test('delete workspace', async () => {
expect(workspaces.workspaces.length).toEqual(1);
await provider.deleteWorkspace(workspaces.workspaces[0].id);
expect(workspaces.workspaces.length).toEqual(0);
/**
* FIXME
* Running following code will crash the worker, and get error like next line:
* InvalidStateError: An operation was called on an object on which it is not allowed or at a time when it is not allowed. Also occurs if a request is made on a source object that has been deleted or removed. Use TransactionInactiveError or ReadOnlyError when possible, as they are more specific variations of InvalidStateError.
* */
// await provider.deleteWorkspace(workspaces.workspaces[0].id);
// expect(workspaces.workspaces.length).toEqual(0);
});
});
@@ -1,11 +1,11 @@
import { BaseProvider } from '../base';
import { BaseProvider } from '../base.js';
import type { ProviderConstructorParams } from '../base';
import { varStorage as storage } from 'lib0/storage';
import { Workspace as WS, WorkspaceMeta } from '../../types';
import { Workspace, uuidv4 } from '@blocksuite/store';
import { IndexedDBProvider } from '../indexeddb';
import { IndexedDBProvider } from '../indexeddb.js';
import assert from 'assert';
import { getDefaultHeadImgBlob } from '../../utils';
import { getDefaultHeadImgBlob } from '../../utils/index.js';
const WORKSPACE_KEY = 'workspaces';
+1 -1
View File
@@ -1,2 +1,2 @@
export { Workspaces } from './workspaces';
export { Workspaces } from './workspaces.js';
export type { WorkspacesScope, WorkspacesChangeEvent } from './workspaces';
@@ -1,8 +1,8 @@
import { describe, test, expect } from 'vitest';
import { Workspaces } from './workspaces';
import { test, expect } from '@playwright/test';
import { Workspaces } from './workspaces.js';
import type { WorkspacesChangeEvent } from './workspaces';
describe('workspaces observable', () => {
test.describe.serial('workspaces observable', () => {
const workspaces = new Workspaces();
const scope = workspaces.createScope();
+6 -1
View File
@@ -21,5 +21,10 @@
"outDir": "./dist"
},
"include": ["next-env.d.ts", "src/**/*.ts", "pages/**/*.tsx"],
"exclude": ["node_modules", "dist", "src/provider/affine/sync.js"]
"exclude": [
"node_modules",
"dist",
"src/provider/affine/sync.js",
"src/**/*.spec.ts"
]
}