@loro-dev/flock 1.1.1 → 2.0.1

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.d.mts CHANGED
@@ -23,7 +23,10 @@ type ExportRecord = {
23
23
  d?: Value;
24
24
  m?: MetadataMap;
25
25
  };
26
- type ExportBundle = Record<string, ExportRecord>;
26
+ type ExportBundle = {
27
+ version: number;
28
+ entries: Record<string, ExportRecord>;
29
+ };
27
30
  type EntryClock = {
28
31
  physicalTime: number;
29
32
  logicalCounter: number;
@@ -115,9 +118,20 @@ declare class Flock {
115
118
  setPeerId(peerId: Uint8Array): void;
116
119
  private putWithMetaInternal;
117
120
  private putWithMetaWithHooks;
121
+ /**
122
+ * Put a value into the flock. If the given entry already exists, this insert will be skipped.
123
+ * @param key
124
+ * @param value
125
+ * @param now
126
+ */
118
127
  put(key: KeyPart[], value: Value, now?: number): void;
119
128
  putWithMeta(key: KeyPart[], value: Value, options?: PutWithMetaOptions): void | Promise<void>;
120
129
  set(key: KeyPart[], value: Value, now?: number): void;
130
+ /**
131
+ * Delete a value from the flock. If the given entry does not exist, this delete will be skipped.
132
+ * @param key
133
+ * @param now
134
+ */
121
135
  delete(key: KeyPart[], now?: number): void;
122
136
  get(key: KeyPart[]): Value | undefined;
123
137
  merge(other: Flock): void;
package/dist/index.d.ts CHANGED
@@ -23,7 +23,10 @@ type ExportRecord = {
23
23
  d?: Value;
24
24
  m?: MetadataMap;
25
25
  };
26
- type ExportBundle = Record<string, ExportRecord>;
26
+ type ExportBundle = {
27
+ version: number;
28
+ entries: Record<string, ExportRecord>;
29
+ };
27
30
  type EntryClock = {
28
31
  physicalTime: number;
29
32
  logicalCounter: number;
@@ -115,9 +118,20 @@ declare class Flock {
115
118
  setPeerId(peerId: Uint8Array): void;
116
119
  private putWithMetaInternal;
117
120
  private putWithMetaWithHooks;
121
+ /**
122
+ * Put a value into the flock. If the given entry already exists, this insert will be skipped.
123
+ * @param key
124
+ * @param value
125
+ * @param now
126
+ */
118
127
  put(key: KeyPart[], value: Value, now?: number): void;
119
128
  putWithMeta(key: KeyPart[], value: Value, options?: PutWithMetaOptions): void | Promise<void>;
120
129
  set(key: KeyPart[], value: Value, now?: number): void;
130
+ /**
131
+ * Delete a value from the flock. If the given entry does not exist, this delete will be skipped.
132
+ * @param key
133
+ * @param now
134
+ */
121
135
  delete(key: KeyPart[], now?: number): void;
122
136
  get(key: KeyPart[]): Value | undefined;
123
137
  merge(other: Flock): void;