chore: update yrs and appflowy-collab (#677)
* chore: update yrs and appflowy-collab * chore: remove wasm compilation target * chore: fixed number conversion in tests * chore: remove wasm integration tests --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
parent
cd8b33cc93
commit
44406ccdae
|
|
@ -113,17 +113,6 @@ jobs:
|
|||
echo "Running tests for ${{ matrix.test_service }} with flags: ${{ matrix.test_cmd }}"
|
||||
RUST_LOG="info" DISABLE_CI_TEST_LOG="true" cargo test ${{ matrix.test_cmd }}
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Run WASM tests
|
||||
working-directory: ./libs/wasm-test
|
||||
run: |
|
||||
cargo install wasm-pack
|
||||
wasm-pack test --headless --firefox
|
||||
|
||||
cleanup:
|
||||
name: Cleanup Docker Images
|
||||
if: always()
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
name: WASM CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened ]
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20.12.0'
|
||||
RUST_TOOLCHAIN: "1.77"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
AppFlowy-Cloud
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: npm install -g wasm-pack
|
||||
|
||||
- name: Build with wasm-pack
|
||||
run: wasm-pack build
|
||||
working-directory: ./libs/client-api-wasm
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
name: Manual NPM Package Publish
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
working_directory:
|
||||
description: 'Working directory (e.g., libs/client-api-wasm)'
|
||||
required: true
|
||||
default: 'libs/client-api-wasm'
|
||||
package_name:
|
||||
description: 'Which package to publish'
|
||||
required: true
|
||||
default: '@appflowyinc/client-api-wasm'
|
||||
type: choice
|
||||
options:
|
||||
- '@appflowyinc/client-api-wasm'
|
||||
package_version:
|
||||
description: 'Package version'
|
||||
required: true
|
||||
prerelease_preid:
|
||||
description: 'Preid for prerelease version (e.g., alpha, beta, rc)'
|
||||
required: false
|
||||
type: choice
|
||||
default: ''
|
||||
options:
|
||||
- ''
|
||||
- 'alpha'
|
||||
- 'beta'
|
||||
- 'rc'
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20.12.0'
|
||||
RUST_TOOLCHAIN: "1.77"
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
AppFlowy-Cloud
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: npm install -g wasm-pack
|
||||
|
||||
- name: Build with wasm-pack
|
||||
run: wasm-pack build
|
||||
working-directory: ${{ github.event.inputs.working_directory }}
|
||||
|
||||
- name: Update name
|
||||
working-directory: ${{ github.event.inputs.working_directory }}/pkg
|
||||
run: |
|
||||
jq '.name = "${{ github.event.inputs.package_name }}"' package.json > package.json.tmp
|
||||
mv package.json.tmp package.json
|
||||
- name: Update version
|
||||
working-directory: ${{ github.event.inputs.working_directory }}/pkg
|
||||
run: |
|
||||
npm version ${{ github.event.inputs.package_version }}
|
||||
if [ "${{ github.event.inputs.prerelease_preid }}" != "" ]; then
|
||||
npm version prerelease --preid ${{ github.event.inputs.prerelease_preid }}
|
||||
fi
|
||||
|
||||
- name: Configure npm for wasm-pack
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${{ github.event.inputs.working_directory }}/pkg/.npmrc
|
||||
|
||||
- name: Publish package
|
||||
run: |
|
||||
npm config set access public
|
||||
wasm-pack publish
|
||||
working-directory: ${{ github.event.inputs.working_directory }}/pkg
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
|
@ -2006,7 +2006,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=870cd70#870cd70e31fa30bc6f94595ca040a91c685dfb4e"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20f7814#20f7814beb265ea76e85ea7a9d392b9fe18a2a63"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -2030,7 +2030,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-document"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=870cd70#870cd70e31fa30bc6f94595ca040a91c685dfb4e"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20f7814#20f7814beb265ea76e85ea7a9d392b9fe18a2a63"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"collab",
|
||||
|
|
@ -2044,12 +2044,13 @@ dependencies = [
|
|||
"tokio",
|
||||
"tokio-stream",
|
||||
"tracing",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "collab-entity"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=870cd70#870cd70e31fa30bc6f94595ca040a91c685dfb4e"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20f7814#20f7814beb265ea76e85ea7a9d392b9fe18a2a63"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -2064,7 +2065,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-folder"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=870cd70#870cd70e31fa30bc6f94595ca040a91c685dfb4e"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20f7814#20f7814beb265ea76e85ea7a9d392b9fe18a2a63"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
|
@ -7189,6 +7190,7 @@ checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
|||
dependencies = [
|
||||
"getrandom 0.2.12",
|
||||
"serde",
|
||||
"sha1_smol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -7799,9 +7801,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "yrs"
|
||||
version = "0.18.7"
|
||||
version = "0.19.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d58fbc807677598fedfab76f99f6e1aa5c644411255002b5438ea0ab14672398"
|
||||
checksum = "71df0198938b69f1eec0d5f19f591c6e4f2f770b0bf16f858428f6d91b8bb280"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"atomic_refcell",
|
||||
|
|
|
|||
10
Cargo.toml
10
Cargo.toml
|
|
@ -215,7 +215,7 @@ pgvector = { version = "0.3", features = ["sqlx"] }
|
|||
client-api-entity = { path = "libs/client-api-entity" }
|
||||
|
||||
# collaboration
|
||||
yrs = "0.18.7"
|
||||
yrs = "0.19.1"
|
||||
collab = { version = "0.2.0" }
|
||||
collab-entity = { version = "0.2.0" }
|
||||
collab-folder = { version = "0.2.0" }
|
||||
|
|
@ -233,10 +233,10 @@ debug = true
|
|||
[patch.crates-io]
|
||||
# It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate.
|
||||
# So using patch to workaround this issue.
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "870cd70" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "870cd70" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "870cd70" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "870cd70" }
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20f7814" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20f7814" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20f7814" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20f7814" }
|
||||
|
||||
[features]
|
||||
history = []
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ impl UpdateSync {
|
|||
Some(Message::Sync(SyncMessage::Update(right))),
|
||||
) = (self.as_update(), other.as_update())
|
||||
{
|
||||
let update = merge_updates_v1(&[&left, &right])?;
|
||||
let update = merge_updates_v1([left, right])?;
|
||||
let msg = Message::Sync(SyncMessage::Update(update));
|
||||
let mut encoder = EncoderV1::new();
|
||||
msg.encode(&mut encoder);
|
||||
|
|
|
|||
|
|
@ -131,15 +131,17 @@ impl CollabBroadcast {
|
|||
let cloned_oid = self.object_id.clone();
|
||||
|
||||
// Observer the awareness's update and broadcast it to all subscribers.
|
||||
let awareness_sub = collab.lock().observe_awareness(move |event| {
|
||||
if let Some(awareness_update) = event.awareness_update() {
|
||||
let payload = Message::Awareness(awareness_update.clone()).encode_v1();
|
||||
let msg = AwarenessSync::new(cloned_oid.clone(), payload, CollabOrigin::Empty);
|
||||
if let Err(err) = broadcast_sink.send(msg.into()) {
|
||||
trace!("fail to broadcast awareness:{}", err);
|
||||
let awareness_sub = collab
|
||||
.lock()
|
||||
.observe_awareness(move |awareness, event, _origin| {
|
||||
if let Ok(awareness_update) = awareness.update_with_clients(event.all_changes()) {
|
||||
let payload = Message::Awareness(awareness_update).encode_v1();
|
||||
let msg = AwarenessSync::new(cloned_oid.clone(), payload, CollabOrigin::Empty);
|
||||
if let Err(err) = broadcast_sink.send(msg.into()) {
|
||||
trace!("fail to broadcast awareness:{}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
(doc_sub, awareness_sub)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use app_error::AppError;
|
|||
|
||||
use appflowy_collaborate::collab::storage::CollabAccessControlStorage;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::preclude::{Any, Collab, MapPrelim};
|
||||
use collab::preclude::{Any, Collab};
|
||||
use collab_entity::define::WORKSPACE_DATABASES;
|
||||
use collab_entity::CollabType;
|
||||
use database::collab::CollabStorage;
|
||||
|
|
@ -85,7 +85,7 @@ async fn create_workspace_database_collab(
|
|||
let collab_type = CollabType::WorkspaceDatabase;
|
||||
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false);
|
||||
let _ = collab.with_origin_transact_mut(|txn| {
|
||||
collab.create_array_with_txn::<MapPrelim<Any>>(txn, WORKSPACE_DATABASES, vec![]);
|
||||
collab.create_array_with_txn::<Any>(txn, WORKSPACE_DATABASES, vec![]);
|
||||
Ok::<(), AppError>(())
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ async fn same_device_multiple_connect_in_order_test() {
|
|||
&object_id,
|
||||
&collab_type,
|
||||
10,
|
||||
json!({"0":0.0,"1":1.0,"2":2.0}),
|
||||
json!({"0":0,"1":1,"2":2}),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
|||
Loading…
Reference in New Issue