Skip to content

Commit d27b86c

Browse files
authored
feat: add new UndoManager APIs for loro-ffi 1.5.10 (#12)
1 parent d47577e commit d27b86c

File tree

7 files changed

+117
-30144
lines changed

7 files changed

+117
-30144
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ target/
9292
*.podspec
9393
rust_modules/
9494
*.a
95-
cpp/
95+
cpp/generated/*
9696
*.podspec
9797
src/gen/
9898
*.tgz

cpp/generated/loro.cpp

Lines changed: 0 additions & 27432 deletions
This file was deleted.

cpp/generated/loro.hpp

Lines changed: 0 additions & 2706 deletions
This file was deleted.

loro-rs/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

loro-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name = "uniffi-bindgen"
1111
path = "src/uniffi-bindgen.rs"
1212

1313
[dependencies]
14-
loro-ffi = { version = "1.5.9" }
14+
loro-ffi = { version = "1.5.10" }
1515
uniffi = { version = "0.28.3" }
1616

1717
[build-dependencies]

src/generated/loro-ffi.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,18 @@ interface NativeModuleInterface {
17451745
ptr: bigint,
17461746
uniffi_out_err: UniffiRustCallStatus
17471747
): number;
1748+
ubrn_uniffi_loro_ffi_fn_method_undomanager_group_end(
1749+
ptr: bigint,
1750+
uniffi_out_err: UniffiRustCallStatus
1751+
): void;
1752+
ubrn_uniffi_loro_ffi_fn_method_undomanager_group_start(
1753+
ptr: bigint,
1754+
uniffi_out_err: UniffiRustCallStatus
1755+
): void;
1756+
ubrn_uniffi_loro_ffi_fn_method_undomanager_peer(
1757+
ptr: bigint,
1758+
uniffi_out_err: UniffiRustCallStatus
1759+
): bigint;
17481760
ubrn_uniffi_loro_ffi_fn_method_undomanager_record_new_checkpoint(
17491761
ptr: bigint,
17501762
uniffi_out_err: UniffiRustCallStatus
@@ -2300,6 +2312,9 @@ interface NativeModuleInterface {
23002312
ubrn_uniffi_loro_ffi_checksum_method_undomanager_add_exclude_origin_prefix(): number;
23012313
ubrn_uniffi_loro_ffi_checksum_method_undomanager_can_redo(): number;
23022314
ubrn_uniffi_loro_ffi_checksum_method_undomanager_can_undo(): number;
2315+
ubrn_uniffi_loro_ffi_checksum_method_undomanager_group_end(): number;
2316+
ubrn_uniffi_loro_ffi_checksum_method_undomanager_group_start(): number;
2317+
ubrn_uniffi_loro_ffi_checksum_method_undomanager_peer(): number;
23032318
ubrn_uniffi_loro_ffi_checksum_method_undomanager_record_new_checkpoint(): number;
23042319
ubrn_uniffi_loro_ffi_checksum_method_undomanager_redo(): number;
23052320
ubrn_uniffi_loro_ffi_checksum_method_undomanager_redo_count(): number;

src/generated/loro.ts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17031,6 +17031,23 @@ export interface UndoManagerInterface {
1703117031
* Whether the undo manager can undo.
1703217032
*/
1703317033
canUndo(): boolean;
17034+
/**
17035+
* Ends the current group, calling UndoManager::undo() after this will
17036+
* undo all changes that occurred during the group.
17037+
*/
17038+
groupEnd(): void;
17039+
/**
17040+
* Will start a new group of changes, all subsequent changes will be merged
17041+
* into a new item on the undo stack. If we receive remote changes, we determine
17042+
* wether or not they are conflicting. If the remote changes are conflicting
17043+
* we split the undo item and close the group. If there are no conflict
17044+
* in changed container ids we continue the group merge.
17045+
*/
17046+
groupStart() /*throws*/ : void;
17047+
/**
17048+
* Get the peer id of the undo manager
17049+
*/
17050+
peer(): /*u64*/ bigint;
1703417051
/**
1703517052
* Record a new checkpoint.
1703617053
*/
@@ -17148,6 +17165,61 @@ export class UndoManager
1714817165
);
1714917166
}
1715017167

17168+
/**
17169+
* Ends the current group, calling UndoManager::undo() after this will
17170+
* undo all changes that occurred during the group.
17171+
*/
17172+
public groupEnd(): void {
17173+
uniffiCaller.rustCall(
17174+
/*caller:*/ (callStatus) => {
17175+
nativeModule().ubrn_uniffi_loro_ffi_fn_method_undomanager_group_end(
17176+
uniffiTypeUndoManagerObjectFactory.clonePointer(this),
17177+
callStatus
17178+
);
17179+
},
17180+
/*liftString:*/ FfiConverterString.lift
17181+
);
17182+
}
17183+
17184+
/**
17185+
* Will start a new group of changes, all subsequent changes will be merged
17186+
* into a new item on the undo stack. If we receive remote changes, we determine
17187+
* wether or not they are conflicting. If the remote changes are conflicting
17188+
* we split the undo item and close the group. If there are no conflict
17189+
* in changed container ids we continue the group merge.
17190+
*/
17191+
public groupStart(): void /*throws*/ {
17192+
uniffiCaller.rustCallWithError(
17193+
/*liftError:*/ FfiConverterTypeLoroError.lift.bind(
17194+
FfiConverterTypeLoroError
17195+
),
17196+
/*caller:*/ (callStatus) => {
17197+
nativeModule().ubrn_uniffi_loro_ffi_fn_method_undomanager_group_start(
17198+
uniffiTypeUndoManagerObjectFactory.clonePointer(this),
17199+
callStatus
17200+
);
17201+
},
17202+
/*liftString:*/ FfiConverterString.lift
17203+
);
17204+
}
17205+
17206+
/**
17207+
* Get the peer id of the undo manager
17208+
*/
17209+
public peer(): /*u64*/ bigint {
17210+
return FfiConverterUInt64.lift(
17211+
uniffiCaller.rustCall(
17212+
/*caller:*/ (callStatus) => {
17213+
return nativeModule().ubrn_uniffi_loro_ffi_fn_method_undomanager_peer(
17214+
uniffiTypeUndoManagerObjectFactory.clonePointer(this),
17215+
callStatus
17216+
);
17217+
},
17218+
/*liftString:*/ FfiConverterString.lift
17219+
)
17220+
);
17221+
}
17222+
1715117223
/**
1715217224
* Record a new checkpoint.
1715317225
*/
@@ -21126,6 +21198,30 @@ function uniffiEnsureInitialized() {
2112621198
'uniffi_loro_ffi_checksum_method_undomanager_can_undo'
2112721199
);
2112821200
}
21201+
if (
21202+
nativeModule().ubrn_uniffi_loro_ffi_checksum_method_undomanager_group_end() !==
21203+
37541
21204+
) {
21205+
throw new UniffiInternalError.ApiChecksumMismatch(
21206+
'uniffi_loro_ffi_checksum_method_undomanager_group_end'
21207+
);
21208+
}
21209+
if (
21210+
nativeModule().ubrn_uniffi_loro_ffi_checksum_method_undomanager_group_start() !==
21211+
64372
21212+
) {
21213+
throw new UniffiInternalError.ApiChecksumMismatch(
21214+
'uniffi_loro_ffi_checksum_method_undomanager_group_start'
21215+
);
21216+
}
21217+
if (
21218+
nativeModule().ubrn_uniffi_loro_ffi_checksum_method_undomanager_peer() !==
21219+
45180
21220+
) {
21221+
throw new UniffiInternalError.ApiChecksumMismatch(
21222+
'uniffi_loro_ffi_checksum_method_undomanager_peer'
21223+
);
21224+
}
2112921225
if (
2113021226
nativeModule().ubrn_uniffi_loro_ffi_checksum_method_undomanager_record_new_checkpoint() !==
2113121227
12209

0 commit comments

Comments
 (0)