@procedures/store 0.51.0 → 0.52.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/CHANGELOG.md +24 -0
- package/README.md +19 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/storage/hybrid.d.ts +30 -4
- package/dist/storage/hybrid.d.ts.map +1 -1
- package/dist/storage/hybrid.js +49 -4
- package/dist/storage/hybrid.js.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js.map +1 -1
- package/package.json +4 -4
- package/src/storage/hybrid.ts +77 -9
- package/src/storage/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @procedures/store
|
|
2
2
|
|
|
3
|
+
## 0.52.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @procedures/client@0.52.1
|
|
8
|
+
- @procedures/collections@0.52.1
|
|
9
|
+
|
|
10
|
+
## 0.52.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 01a1410: `mergeFn` gets a fourth argument, `context` (roadmap CLI-109). `context.overlap(paths)` reports the paths where the merge kept only one side. The hook `onDropped` gets one call with the reason `overlap` for each report. The report holds `remote`, `base`, `merged` and `paths`. The merged write stays in the queue. `getMetadata()` counts the reports as `stats.overlaps`.
|
|
15
|
+
|
|
16
|
+
Migration steps for the site and each app:
|
|
17
|
+
|
|
18
|
+
- The type `DroppedWrite["reason"]` gets the value `"overlap"`. Add a case for it to each exhaustive `switch` over `reason`. Otherwise the check of `never` does not compile.
|
|
19
|
+
- An `onDropped` hook that writes the value again must skip the reason `overlap`. The merged write of an overlap is still in the queue.
|
|
20
|
+
- Code that calls a `mergeFn` itself must give a fourth argument, for example `{ overlap: () => {} }`. A merge function with two or three parameters needs no change.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @procedures/client@0.52.0
|
|
25
|
+
- @procedures/collections@0.52.0
|
|
26
|
+
|
|
3
27
|
## 0.51.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -358,6 +358,25 @@ With `versionOf` and the policy `merge`, a queued write also keeps its base valu
|
|
|
358
358
|
- The option `sendBaseVersions: false` stops the expected versions. Then a queued write replaces the remote item, as before CLI-16.
|
|
359
359
|
- A write of the mode `write-through` goes to the remote directly. It sends only the expected version of its caller.
|
|
360
360
|
|
|
361
|
+
### The overlaps of a merge
|
|
362
|
+
|
|
363
|
+
A merge can keep only one side of a path. `mergeFn` reports these paths with its fourth argument, `context` (roadmap CLI-109).
|
|
364
|
+
|
|
365
|
+
- `context.overlap(paths)` reports the paths where the merge kept only one side, for example `["title"]`.
|
|
366
|
+
- Each call during the merge gives one call of `onDropped` with the reason `overlap`.
|
|
367
|
+
- The report holds the local value, `remote`, `base`, `merged` and `paths`, and the sync of the conflict.
|
|
368
|
+
- `base` is undefined when the storage does not know the base value, for example for an operation from an older version.
|
|
369
|
+
- The merged write of an overlap stays in the queue, and the push sends it. `getMetadata()` counts the reports as `stats.overlaps`, not as `stats.dropped`.
|
|
370
|
+
- A call of `context.overlap` after the end of the merge changes nothing.
|
|
371
|
+
- A merge function with two or three parameters works as before, and gives no report.
|
|
372
|
+
|
|
373
|
+
```ts
|
|
374
|
+
const mergeTitle = (local: Note, remote: Note, base: Note | null | undefined, context: MergeContext): Note => {
|
|
375
|
+
if (base && local.title !== base.title && remote.title !== base.title) context.overlap(["title"]);
|
|
376
|
+
return { ...remote, body: local.body };
|
|
377
|
+
};
|
|
378
|
+
```
|
|
379
|
+
|
|
361
380
|
### The clock, the backoff and the status
|
|
362
381
|
|
|
363
382
|
The timers and the retries run on a clock: `Clock` of `@mark1russell7/service/clock`. A test gives `fakeClock` of `@mark1russell7/service/testing`, and the times are then exact.
|