jazz-tools 0.11.0 → 0.11.2
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-RTRX7HIO.js → chunk-MVDJNBLV.js} +11 -2
- package/dist/chunk-MVDJNBLV.js.map +1 -0
- package/dist/coValues/coList.d.ts +1 -0
- package/dist/coValues/coList.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +2 -1
- package/src/coValues/coList.ts +14 -1
- package/src/tests/coList.test.ts +20 -0
- package/dist/chunk-RTRX7HIO.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.11.
|
2
|
+
> jazz-tools@0.11.2 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -10,13 +10,13 @@
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
11
11
|
[34mESM[39m Build start
|
12
12
|
[32mESM[39m [1mdist/index.js [22m[32m1.50 KB[39m
|
13
|
+
[32mESM[39m [1mdist/chunk-MVDJNBLV.js [22m[32m119.45 KB[39m
|
13
14
|
[32mESM[39m [1mdist/testing.js [22m[32m6.18 KB[39m
|
14
|
-
[32mESM[39m [1mdist/chunk-RTRX7HIO.js [22m[32m119.14 KB[39m
|
15
15
|
[32mESM[39m [1mdist/index.js.map [22m[32m259.00 B[39m
|
16
|
+
[32mESM[39m [1mdist/chunk-MVDJNBLV.js.map [22m[32m284.49 KB[39m
|
16
17
|
[32mESM[39m [1mdist/testing.js.map [22m[32m12.24 KB[39m
|
17
|
-
[32mESM[39m
|
18
|
-
[32mESM[39m ⚡️ Build success in 46ms
|
18
|
+
[32mESM[39m ⚡️ Build success in 43ms
|
19
19
|
|
20
|
-
> jazz-tools@0.11.
|
20
|
+
> jazz-tools@0.11.2 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
21
21
|
> tsc --outDir dist
|
22
22
|
|
package/CHANGELOG.md
CHANGED
@@ -2423,6 +2423,7 @@ var FileStream = class extends CoValueBase {
|
|
2423
2423
|
|
2424
2424
|
// src/coValues/coList.ts
|
2425
2425
|
import { RawAccount as RawAccount5 } from "cojson";
|
2426
|
+
import { calcPatch } from "fast-myers-diff";
|
2426
2427
|
var _CoList = class _CoList extends Array {
|
2427
2428
|
/**
|
2428
2429
|
* Declare a `CoList` by subclassing `CoList.Of(...)` and passing the item schema using `co`.
|
@@ -2587,12 +2588,20 @@ var _CoList = class _CoList extends Array {
|
|
2587
2588
|
}
|
2588
2589
|
let appendAfter = Math.max(start - 1, 0);
|
2589
2590
|
for (const item of toRawItems(items, this._schema[ItemsSym])) {
|
2590
|
-
console.log(this._raw.asArray(), appendAfter);
|
2591
2591
|
this._raw.append(item, appendAfter);
|
2592
2592
|
appendAfter++;
|
2593
2593
|
}
|
2594
2594
|
return deleted;
|
2595
2595
|
}
|
2596
|
+
applyDiff(other) {
|
2597
|
+
const current = this._raw.asArray();
|
2598
|
+
const cmp = isRefEncoded(this._schema[ItemsSym]) ? (aIdx, bIdx) => current[aIdx].id === other[bIdx].id : void 0;
|
2599
|
+
for (const [from, to, insert] of [
|
2600
|
+
...calcPatch(current, other, cmp)
|
2601
|
+
].reverse()) {
|
2602
|
+
this.splice(from, to - from, ...insert);
|
2603
|
+
}
|
2604
|
+
}
|
2596
2605
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2597
2606
|
toJSON(_key, seenAbove) {
|
2598
2607
|
const itemDescriptor = this._schema[ItemsSym];
|
@@ -4157,4 +4166,4 @@ export {
|
|
4157
4166
|
consumeInviteLink
|
4158
4167
|
};
|
4159
4168
|
/* istanbul ignore file -- @preserve */
|
4160
|
-
//# sourceMappingURL=chunk-
|
4169
|
+
//# sourceMappingURL=chunk-MVDJNBLV.js.map
|