@loro-dev/flock 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/_moon_flock.ts +29 -11
package/package.json
CHANGED
package/src/_moon_flock.ts
CHANGED
|
@@ -999,10 +999,11 @@ const zxch3n$expect$$yellow$46$constr$47$2738 = 3;
|
|
|
999
999
|
const zxch3n$expect$$blue$46$constr$47$2740 = 4;
|
|
1000
1000
|
const zxch3n$flock$sorted_map$$range$46$tuple$47$3158 = { _0: true, _1: true };
|
|
1001
1001
|
const zxch3n$flock$sorted_map$$range$46$tuple$47$3159 = { _0: true, _1: true };
|
|
1002
|
-
const zxch3n$flock$flock$$from_string$46$42$bind$124$
|
|
1002
|
+
const zxch3n$flock$flock$$from_string$46$42$bind$124$872 = ",";
|
|
1003
1003
|
const zxch3n$flock$flock$$zero$46$record$47$3245 = { physical_time: 0, logical_counter: 0 };
|
|
1004
1004
|
const zxch3n$flock$flock$$new$46$42$bind$47$3438 = { physical_time: 0, logical_counter: 0 };
|
|
1005
|
-
const zxch3n$flock$flock$$
|
|
1005
|
+
const zxch3n$flock$flock$$delete$46$inner$46$constr$47$3535 = true;
|
|
1006
|
+
const zxch3n$flock$flock$$import_json$46$inner$46$constr$47$3767 = new Source$Import("import_json");
|
|
1006
1007
|
(() => {
|
|
1007
1008
|
Yoorkin$jmop$$ffi_init(Yoorkin$jmop$$convert_thrown_error);
|
|
1008
1009
|
})();
|
|
@@ -12255,7 +12256,7 @@ function zxch3n$flock$flock$$HlcWithPeer$to_string(self) {
|
|
|
12255
12256
|
return `${zxch3n$flock$flock$$Hlc$to_string(self.hlc)},${zxch3n$flock$flock$$peer_key_to_string(self.peer)}`;
|
|
12256
12257
|
}
|
|
12257
12258
|
function zxch3n$flock$flock$$HlcWithPeer$from_string(s) {
|
|
12258
|
-
const parts = moonbitlang$core$builtin$$Iter$collect$15$(moonbitlang$core$string$$StringView$split(s, { str: zxch3n$flock$flock$$from_string$46$42$bind$124$
|
|
12259
|
+
const parts = moonbitlang$core$builtin$$Iter$collect$15$(moonbitlang$core$string$$StringView$split(s, { str: zxch3n$flock$flock$$from_string$46$42$bind$124$872, start: 0, end: zxch3n$flock$flock$$from_string$46$42$bind$124$872.length }));
|
|
12259
12260
|
if (parts.length < 3) {
|
|
12260
12261
|
return undefined;
|
|
12261
12262
|
}
|
|
@@ -12926,13 +12927,29 @@ function zxch3n$flock$flock$$Flock$check_consistency(a, b) {
|
|
|
12926
12927
|
return true;
|
|
12927
12928
|
}
|
|
12928
12929
|
function zxch3n$flock$flock$$Flock$check_invariants(_self) {}
|
|
12929
|
-
function zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, data, metadata, now, hooks) {
|
|
12930
|
+
function zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, data, metadata, now, hooks, skip_same_value) {
|
|
12930
12931
|
const _bind = zxch3n$flock$memcomparable$$encode_json_key(key);
|
|
12931
12932
|
if (_bind === undefined) {
|
|
12932
12933
|
return new Result$Err$33$(new Error$zxch3n$47$flock$47$flock$46$PutError$46$InvalidKey(moonbitlang$core$builtin$$ToJson$to_json$63$(key)));
|
|
12933
12934
|
} else {
|
|
12934
12935
|
const _Some = _bind;
|
|
12935
12936
|
const _encoded_key = _Some;
|
|
12937
|
+
if (skip_same_value) {
|
|
12938
|
+
const _bind$2 = zxch3n$flock$sorted_map$$SortedMap$get$75$(self.kv, _encoded_key);
|
|
12939
|
+
if (_bind$2 === undefined) {
|
|
12940
|
+
if (data === undefined) {
|
|
12941
|
+
if (metadata === undefined) {
|
|
12942
|
+
return new Result$Ok$33$(undefined);
|
|
12943
|
+
}
|
|
12944
|
+
}
|
|
12945
|
+
} else {
|
|
12946
|
+
const _Some$2 = _bind$2;
|
|
12947
|
+
const _existing = _Some$2;
|
|
12948
|
+
if (moonbitlang$core$builtin$$Eq$equal$24$(_existing.value.data, data) && moonbitlang$core$builtin$$Eq$equal$64$(_existing.value.metadata, metadata)) {
|
|
12949
|
+
return new Result$Ok$33$(undefined);
|
|
12950
|
+
}
|
|
12951
|
+
}
|
|
12952
|
+
}
|
|
12936
12953
|
const now$2 = moonbitlang$core$option$$Option$unwrap_or_else$68$(now, () => moonbitlang$core$uint64$$UInt64$to_double(moonbitlang$core$env$$now()));
|
|
12937
12954
|
if (now$2 > self.max_hlc.physical_time) {
|
|
12938
12955
|
self.max_hlc = { physical_time: now$2, logical_counter: 0 };
|
|
@@ -12983,7 +13000,7 @@ function zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, data, metadata,
|
|
|
12983
13000
|
}
|
|
12984
13001
|
}
|
|
12985
13002
|
}
|
|
12986
|
-
function zxch3n$flock$flock$$Flock$put_inner(self, key, data, metadata$46$opt, now$46$opt, hooks$46$opt) {
|
|
13003
|
+
function zxch3n$flock$flock$$Flock$put_inner(self, key, data, metadata$46$opt, now$46$opt, hooks$46$opt, skip_same_value$46$opt) {
|
|
12987
13004
|
let metadata;
|
|
12988
13005
|
if (metadata$46$opt.$tag === 1) {
|
|
12989
13006
|
const _Some = metadata$46$opt;
|
|
@@ -13005,10 +13022,11 @@ function zxch3n$flock$flock$$Flock$put_inner(self, key, data, metadata$46$opt, n
|
|
|
13005
13022
|
} else {
|
|
13006
13023
|
hooks = undefined;
|
|
13007
13024
|
}
|
|
13008
|
-
|
|
13025
|
+
const skip_same_value = skip_same_value$46$opt === -1 ? true : skip_same_value$46$opt;
|
|
13026
|
+
return zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, data, metadata, now, hooks, skip_same_value);
|
|
13009
13027
|
}
|
|
13010
13028
|
function zxch3n$flock$flock$$Flock$put_with_meta$46$inner(self, key, value, metadata, now, hooks) {
|
|
13011
|
-
return zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, value, metadata, now, hooks);
|
|
13029
|
+
return zxch3n$flock$flock$$Flock$put_inner$46$inner(self, key, value, metadata, now, hooks, true);
|
|
13012
13030
|
}
|
|
13013
13031
|
function zxch3n$flock$flock$$Flock$put_with_meta(self, key, value, metadata$46$opt, now$46$opt, hooks$46$opt) {
|
|
13014
13032
|
let metadata;
|
|
@@ -13038,7 +13056,7 @@ function zxch3n$flock$flock$$Flock$put$46$inner(self, key, value, now) {
|
|
|
13038
13056
|
return zxch3n$flock$flock$$Flock$put_with_meta(self, key, value, Option$None$34$, now, Option$None$35$);
|
|
13039
13057
|
}
|
|
13040
13058
|
function zxch3n$flock$flock$$Flock$delete$46$inner(self, key, now) {
|
|
13041
|
-
return zxch3n$flock$flock$$Flock$put_inner(self, key, undefined, Option$None$34$, now, Option$None$35$);
|
|
13059
|
+
return zxch3n$flock$flock$$Flock$put_inner(self, key, undefined, Option$None$34$, now, Option$None$35$, zxch3n$flock$flock$$delete$46$inner$46$constr$47$3535);
|
|
13042
13060
|
}
|
|
13043
13061
|
function zxch3n$flock$flock$$Flock$get(self, key) {
|
|
13044
13062
|
const _bind = zxch3n$flock$memcomparable$$encode_json_key(key);
|
|
@@ -13855,7 +13873,7 @@ function zxch3n$flock$flock$$Flock$import_json$46$inner(self, json, hooks) {
|
|
|
13855
13873
|
const _Some = _bind$2;
|
|
13856
13874
|
const _events = _Some._0;
|
|
13857
13875
|
if (_events.length > 0) {
|
|
13858
|
-
zxch3n$flock$flock$$SubscriberSet$notify$91$(self.subscribers, { by: zxch3n$flock$flock$$import_json$46$inner$46$constr$47$
|
|
13876
|
+
zxch3n$flock$flock$$SubscriberSet$notify$91$(self.subscribers, { by: zxch3n$flock$flock$$import_json$46$inner$46$constr$47$3767, events: _events });
|
|
13859
13877
|
}
|
|
13860
13878
|
}
|
|
13861
13879
|
return new Result$Ok$38$({ accepted: accepted.val, skipped: skipped_entries });
|
|
@@ -13975,7 +13993,7 @@ function zxch3n$flock$flock$$Flock$put_mvr$46$inner(self, key, value, now) {
|
|
|
13975
13993
|
moonbitlang$core$array$$Array$push$13$(key$2, value);
|
|
13976
13994
|
const _p = true;
|
|
13977
13995
|
const _tmp$2 = _p ? $64$moonbitlang$47$core$47$builtin$46$Json$True : $64$moonbitlang$47$core$47$builtin$46$Json$False;
|
|
13978
|
-
return zxch3n$flock$flock$$Flock$put_inner(self, key$2, _tmp$2, Option$None$34$, now, Option$None$35
|
|
13996
|
+
return zxch3n$flock$flock$$Flock$put_inner(self, key$2, _tmp$2, Option$None$34$, now, Option$None$35$, -1);
|
|
13979
13997
|
}
|
|
13980
13998
|
function zxch3n$flock$flock$$Flock$get_mvr(self, key) {
|
|
13981
13999
|
const ans = [];
|
|
@@ -14102,7 +14120,7 @@ function zxch3n$flock$flock$$Flock$put_ffi(self, key, value, now) {
|
|
|
14102
14120
|
}
|
|
14103
14121
|
}
|
|
14104
14122
|
const key_arr$2 = _p;
|
|
14105
|
-
const _bind$3 = zxch3n$flock$flock$$Flock$put_inner(self, key_arr$2, value$2, Option$None$34$, new Option$Some$12$(now), Option$None$35
|
|
14123
|
+
const _bind$3 = zxch3n$flock$flock$$Flock$put_inner(self, key_arr$2, value$2, Option$None$34$, new Option$Some$12$(now), Option$None$35$, -1);
|
|
14106
14124
|
if (_bind$3.$tag === 1) {
|
|
14107
14125
|
const _ok = _bind$3;
|
|
14108
14126
|
_ok._0;
|