@loro-dev/flock 2.0.0 → 2.1.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.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/_moon_flock.d.ts +6 -2
- package/src/_moon_flock.ts +772 -652
- package/src/index.ts +48 -6
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
3
3
|
type ExportOptions = {
|
|
4
4
|
from?: VersionVector;
|
|
5
5
|
hooks?: ExportHooks;
|
|
6
|
+
pruneTombstonesBefore?: number;
|
|
6
7
|
};
|
|
7
8
|
type ImportOptions = {
|
|
8
9
|
bundle: ExportBundle;
|
|
@@ -118,9 +119,20 @@ declare class Flock {
|
|
|
118
119
|
setPeerId(peerId: Uint8Array): void;
|
|
119
120
|
private putWithMetaInternal;
|
|
120
121
|
private putWithMetaWithHooks;
|
|
122
|
+
/**
|
|
123
|
+
* Put a value into the flock. If the given entry already exists, this insert will be skipped.
|
|
124
|
+
* @param key
|
|
125
|
+
* @param value
|
|
126
|
+
* @param now
|
|
127
|
+
*/
|
|
121
128
|
put(key: KeyPart[], value: Value, now?: number): void;
|
|
122
129
|
putWithMeta(key: KeyPart[], value: Value, options?: PutWithMetaOptions): void | Promise<void>;
|
|
123
130
|
set(key: KeyPart[], value: Value, now?: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* Delete a value from the flock. If the given entry does not exist, this delete will be skipped.
|
|
133
|
+
* @param key
|
|
134
|
+
* @param now
|
|
135
|
+
*/
|
|
124
136
|
delete(key: KeyPart[], now?: number): void;
|
|
125
137
|
get(key: KeyPart[]): Value | undefined;
|
|
126
138
|
merge(other: Flock): void;
|
|
@@ -129,6 +141,7 @@ declare class Flock {
|
|
|
129
141
|
private exportJsonWithHooks;
|
|
130
142
|
exportJson(): ExportBundle;
|
|
131
143
|
exportJson(from: VersionVector): ExportBundle;
|
|
144
|
+
exportJson(from: VersionVector, pruneTombstonesBefore: number): ExportBundle;
|
|
132
145
|
exportJson(options: ExportOptions): Promise<ExportBundle>;
|
|
133
146
|
private importJsonInternal;
|
|
134
147
|
private importJsonWithHooks;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
3
3
|
type ExportOptions = {
|
|
4
4
|
from?: VersionVector;
|
|
5
5
|
hooks?: ExportHooks;
|
|
6
|
+
pruneTombstonesBefore?: number;
|
|
6
7
|
};
|
|
7
8
|
type ImportOptions = {
|
|
8
9
|
bundle: ExportBundle;
|
|
@@ -118,9 +119,20 @@ declare class Flock {
|
|
|
118
119
|
setPeerId(peerId: Uint8Array): void;
|
|
119
120
|
private putWithMetaInternal;
|
|
120
121
|
private putWithMetaWithHooks;
|
|
122
|
+
/**
|
|
123
|
+
* Put a value into the flock. If the given entry already exists, this insert will be skipped.
|
|
124
|
+
* @param key
|
|
125
|
+
* @param value
|
|
126
|
+
* @param now
|
|
127
|
+
*/
|
|
121
128
|
put(key: KeyPart[], value: Value, now?: number): void;
|
|
122
129
|
putWithMeta(key: KeyPart[], value: Value, options?: PutWithMetaOptions): void | Promise<void>;
|
|
123
130
|
set(key: KeyPart[], value: Value, now?: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* Delete a value from the flock. If the given entry does not exist, this delete will be skipped.
|
|
133
|
+
* @param key
|
|
134
|
+
* @param now
|
|
135
|
+
*/
|
|
124
136
|
delete(key: KeyPart[], now?: number): void;
|
|
125
137
|
get(key: KeyPart[]): Value | undefined;
|
|
126
138
|
merge(other: Flock): void;
|
|
@@ -129,6 +141,7 @@ declare class Flock {
|
|
|
129
141
|
private exportJsonWithHooks;
|
|
130
142
|
exportJson(): ExportBundle;
|
|
131
143
|
exportJson(from: VersionVector): ExportBundle;
|
|
144
|
+
exportJson(from: VersionVector, pruneTombstonesBefore: number): ExportBundle;
|
|
132
145
|
exportJson(options: ExportOptions): Promise<ExportBundle>;
|
|
133
146
|
private importJsonInternal;
|
|
134
147
|
private importJsonWithHooks;
|