Commit graph

79 commits

Author SHA1 Message Date
Zixuan Chen
07500dab34
fix: map.keys() may return keys from deleted entries (#618)
* fix: map.keys() may return keys from deleted entries

* chore: changeset

* chore: fix latest clippy warning
2025-01-15 14:12:30 +08:00
github-actions[bot]
9caae235c1 chore: version packages
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2025-01-09 12:46:23 +08:00
Zixuan Chen
ddafb7e899
feat: diff, revertTo, and applyDiff (#610)
* feat: expose diff, apply_diff, revert_to, to rust crate

* fix: revert to

* refactor: simplify TextDiff data structure

* fix: make diff and apply_diff actually work

* step 0

* feat(wasm): add diff, applyDiff, revertTo

* test: add a more complicated revert test

* chore: fix clippy warnings

* feat: add order to diff events batch

* fix: DiffBatch invariants maintain

* docs: refine docs a bit

* chore: fix warnings

* chore: add changeset
2025-01-09 12:39:03 +08:00
Zixuan Chen
9c1005d92e
fix: prevent merging remote changes based on local changeMergeInterval config (#614)
* docs: make the merge interval unit clear

* fix: prevent merging remote changes with small intervals and improve commit message handling

The changeMergeInterval config should only work for local changes.

* docs: refine docs
2025-01-09 12:00:52 +08:00
Zixuan Chen
8039e446a8
feat: find id spans between (#607)
* feat: add a method to find id spans between frontiers

* feat(wasm): expose frontiers (from&to) in event

* test: fix test

* chore: changeset

* refactor: rename to findIdSpansBetween

* test: fix test err

* refactor: rename the fields of version vector diff

replace `left` and `right` with `retreat` and `forward`

* docs: add more details about find_id_spans_between
2025-01-06 11:15:10 +08:00
Zixuan Chen
ac51ceb2f9
feat: add exportJsonInIdSpan and make peer compression optional (#602)
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
This change will make the internal operations more accessible to the application code.

* feat: add exportJsonInIdSpan and make peer compression optional

- Introduced `export_json_updates_without_peer_compression` method to allow exporting JSON updates without compressing peer IDs, making it easier for application code to process.
- Updated existing `export_json_updates` method to accept a `with_peer_compression` parameter, defaulting to true.
- Refactored related code in various files to accommodate the new functionality, ensuring backward compatibility.

* fix: slice err & add tests

* chore: changeset
2025-01-05 01:25:15 +08:00
github-actions[bot]
137d8b2d14 chore: version packages 2025-01-04 02:11:42 +08:00
Zixuan Chen
da249109bc
fix: should commit before travel_change_ancestors (#599)
* fix: should commit before travel_change_ancestors

* chore: changeest
2025-01-04 02:08:05 +08:00
github-actions[bot]
2709090756 chore: version packages
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-12-31 14:25:59 +08:00
Zixuan Chen
df81aece51
Fix-better-event-order (#595)
The event will now be ordered by (depth, container counter). Therefore, two container creation events within the same layer will be sorted based on the containers’ counter values. This approach can prevent the issue where child tree node events are received before the parent tree node events
2024-12-31 13:26:52 +08:00
Zixuan Chen
d552955ec6
feat: make get_by_path work for tree (#594) 2024-12-31 13:11:12 +08:00
github-actions[bot]
5a85e6e5d2 chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-12-28 22:53:50 +08:00
Zixuan Chen
9faa149e04
fix: panic when detach then attach (#592)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
detaching should commit the pending ops
2024-12-28 14:57:46 +08:00
github-actions[bot]
d03d53626e chore: version packages 2024-12-27 10:19:52 +08:00
Leon Zhao
5aa79856d4 chore: changeset 2024-12-27 09:47:11 +08:00
github-actions[bot]
2b7a621744 chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-12-23 14:37:20 +08:00
Zixuan Chen
1ca1275455
chore: add changeset info
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-12-23 11:51:32 +08:00
Zixuan Chen
42949c0e24
fix(wasm): ownership of vv (#585)
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
* test: add failed test

* fix: ownership issue of version vector in wasm

* chore: fix clippy warning
2024-12-20 02:31:59 +08:00
github-actions[bot]
f861da45fb chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-12-16 12:03:07 +08:00
Zixuan Chen
3b7a738b0e
chore: update changeset 2024-12-16 11:54:49 +08:00
github-actions[bot]
1275e95479 chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-12-11 17:27:28 +08:00
Zixuan Chen
adb6ab87a7
fix: panic when returned non-boolean value from text.iter(f) (#578)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
* fix: panic when returned non-boolean value from text.iter(f) #577

* test: add related test

* fix: add type for iter function
2024-12-11 15:14:43 +08:00
github-actions[bot]
6e0437e88c chore: version packages
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-12-10 16:36:17 +08:00
Zixuan Chen
d08a865d50
fix: getOrCreateContainer should not throw if value is null (#576)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
* fix: getOrCreateContainer should not throw if value is null

resolve #575

* chore: update changeset release info
2024-12-10 15:01:12 +08:00
Zixuan Chen
01fccc5a7d
feat: return import status in import_batch method (#573)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
* feat: return import status in import_batch method

* feat(wasm): add importUpdateBatch returned status support

* chore: add changeset update

* chore: update ffi return type
2024-12-09 16:31:21 +08:00
github-actions[bot]
d54ad80bb6 chore: version packages 2024-11-29 14:24:59 +08:00
Zixuan Chen
0325061476
fix: dead loop when importing updates (#570)
Fix the dead loop issue here: https://gist.github.com/sunflowerdeath/c0e2b46b6f5d2e32d368f8e04f730237

# Reason for the Dead Loop in `find_common_ancestor`

### Original Assumptions

1. **Dependency Assumption**

   If a DagNode is depended upon by other nodes, the direction of this dependency will only point to before the end of the node. This assumption is used in system design.

2. **Node Overlap Assumption**

   DagNodes do not overlap with each other. When retrieving DagNodes from two different positions:
   - They are either completely identical
   - Or they do not overlap at all
   - If there is overlap, it means they are the same node

### Current Issues

1. **Issues Caused by Lazy Loading**

   Due to the use of lazy loading, new situations have arisen. Initially:
   - A certain DagNode is not depended upon by other DagNodes
   - Therefore, the initially retrieved form is complete

2. **Impact of Subsequent Loading**

   After loading additional DagNodes:
   - The newly loaded DagNode may depend on the internal position of the previously complete DagNode
   - This causes the originally complete DagNode to be split into multiple smaller DagNodes

3. **Violation of Original Assumptions**

   In this case, when retrieving the content of the original DagNode again:
   - Other DagNode dependencies may appear in the middle
   - There may be overlaps on the DagNode
   - This violates the original design assumptions

# Fix Approach

Remove the assumption in the original implementation that "overlapping DagNodes will not occur." When overlapping DagNodes are found, retain the shorter one and remove the longer one.
2024-11-29 13:01:15 +08:00
github-actions[bot]
eef5a9fa9a chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-11-18 15:25:39 +08:00
Zixuan Chen
d6966aca34
fix: fractional index is enabled by default now (#561)
* fix: tree should use jitter 0 by default

Otherwise, there may be inconsistency between the event and the actual data. But this will increase the cost when the index property is not used.

* chore: add changeset

* chore: fix warning

* refactor: enable tree move by default

* docs: update related docs
2024-11-18 14:32:56 +08:00
github-actions[bot]
c4a9729c9c chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-11-16 19:33:41 +08:00
Zixuan Chen
70c4942fad
chore: add wasm-base64 build target 2024-11-16 19:18:29 +08:00
Zixuan Chen
35e7ea5f54
fix: calc change count (#556)
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
* fix: calc change count

* fix: len ops
2024-11-13 16:52:41 +08:00
github-actions[bot]
3edae43e7b chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-11-12 23:06:29 +08:00
Zixuan Chen
ee26952fc0
feat: Add isDeleted() method to containers (#555)
* feat: Add isDeleted() method to containers

- Add isDeleted() method to all container types (Text, Map, List, Tree, etc.)
- Fix deletion tracking for containers in tree operations
- Add tests to verify deletion state across different scenarios

* chore: fix redundant field names

---------

Co-authored-by: Leon Zhao <leeeon233@gmail.com>
2024-11-12 21:15:46 +08:00
Zixuan Chen
9abeb81747
feat(wasm): add methods to modify vv (#552)
* feat(wasm): add methods to modify vv

* test: add js test for updating vv
2024-11-10 16:36:09 +08:00
github-actions[bot]
85b4722a27 chore: version packages
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-11-09 21:04:10 +08:00
Zixuan Chen
778ca5452d
feat: allow users to query the changed containers in the target id range (#549)
* feat: allow users to query the changed containers in the target id range

* chore: add changeset note

* chore: update cargo toml

* test: add related tests and add a commit before get_changed_container_in
2024-11-09 21:00:07 +08:00
Zixuan Chen
6e878d216a
Feat add API to query creators, the last editors/movers (#548)
* feat: LoroMap::get_last_editor

* feat: get creator/mover/editor of items

* chore: add changeset

* chore: fix warnings
2024-11-09 19:17:56 +08:00
Zixuan Chen
661610165b
perf: import batch optimize - use the largest snapshot first (#547)
* perf: import batch optimize - use the largest snapshot first

* chore: add changeset info
2024-11-09 16:10:13 +08:00
Zixuan Chen
8486234aba
fix: get correct encode blob info (#545)
* fix: get correct encode blob info

* fix: is_snapshot

* test: fix test case

* test: update ts tests

* chore: add change file

* chore: fix warnings
2024-11-09 15:43:11 +08:00
github-actions[bot]
67fcc89e58 chore: version packages
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-11-04 22:45:55 +08:00
Zixuan Chen
9b60d01be2
fix: define the fork behavior when the doc is detached (#537)
* fix: define the fork behavior when the doc is detached

* chore: add release note
2024-11-04 22:34:33 +08:00
Zixuan Chen
7bf6db7398
feat: add push/push_container to LoroText/LoroList/LoroMovableList (#534)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
* feat: add push_container and push_str to list/text

* chore: add changeset file
2024-11-04 17:03:24 +08:00
github-actions[bot]
d3cdb20ef8
chore: version packages (#533)
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-29 21:54:16 +08:00
Zixuan Chen
62a3a93552
Refactor: merge two js packages (#532)
* feat: make vitest tests pass

* chore: update readme & add deno test for web bundle

* chore: bump version to 1.0.8-alpha.0

* chore: bump loro-crdt version

* fix: build script
export init method from loro-wasm/web

* chore: bump version

* chore: specify which files to include for npm publish

* refactor: rename loro-js to loro-js-test

* refactor: remove the old loro-js folder

* fix: build scripts

* chore: 1.0.8-alpha.3

* chore: add release info
2024-10-29 21:46:56 +08:00
github-actions[bot]
87157121e4
chore: version packages (#527)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-23 23:19:24 +08:00
Zixuan Chen
dd3bd92d87
chore: release v1 (#526) 2024-10-23 23:16:11 +08:00
Zixuan Chen
596374d622
docs: update the release guide 2024-10-09 19:33:32 +08:00
github-actions[bot]
7fc85b1b04
chore: version packages (#370)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-23 10:28:24 +08:00
Zixuan Chen
34f6064edc
chore: prerelease 2024-05-23 10:24:06 +08:00