jazz-tools 0.8.49 → 0.8.51
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 +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/{chunk-6OHBW32Q.js → chunk-MUJIKQFH.js} +23 -16
- package/dist/chunk-MUJIKQFH.js.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.web.js +1 -1
- package/package.json +2 -2
- package/src/coValues/coFeed.ts +18 -12
- package/src/coValues/coList.ts +5 -3
- package/src/coValues/coMap.ts +14 -9
- package/src/coValues/group.ts +3 -2
- package/src/coValues/interfaces.ts +23 -1
- package/src/tests/coFeed.test.ts +16 -0
- package/src/tests/coList.test.ts +14 -0
- package/src/tests/coMap.test.ts +19 -0
- package/dist/chunk-6OHBW32Q.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.8.
|
2
|
+
> jazz-tools@0.8.51 build /home/runner/work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index.web":"src/index.web.ts","index.native":"src/index.native.ts"}
|
@@ -11,8 +11,8 @@
|
|
11
11
|
[34mESM[39m Build start
|
12
12
|
[32mESM[39m [1mdist/index.web.js [22m[32m1.08 KB[39m
|
13
13
|
[32mESM[39m [1mdist/index.native.js [22m[32m1.07 KB[39m
|
14
|
-
[32mESM[39m [1mdist/chunk-
|
14
|
+
[32mESM[39m [1mdist/chunk-MUJIKQFH.js [22m[32m82.20 KB[39m
|
15
15
|
[32mESM[39m [1mdist/index.web.js.map [22m[32m270.00 B[39m
|
16
16
|
[32mESM[39m [1mdist/index.native.js.map [22m[32m280.00 B[39m
|
17
|
-
[32mESM[39m [1mdist/chunk-
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
17
|
+
[32mESM[39m [1mdist/chunk-MUJIKQFH.js.map [22m[32m189.68 KB[39m
|
18
|
+
[32mESM[39m ⚡️ Build success in 71ms
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.8.51
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- dc62b95: Return field name on \_edits
|
8
|
+
- 1de26f8: Simplify the .create calls by accepting directly "Account | Group" as second param
|
9
|
+
|
10
|
+
## 0.8.50
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- Updated dependencies [43378ef]
|
15
|
+
- cojson@0.8.50
|
16
|
+
|
3
17
|
## 0.8.49
|
4
18
|
|
5
19
|
### Patch Changes
|
@@ -768,6 +768,12 @@ function subscribeToExistingCoValue(existing, depth, listener) {
|
|
768
768
|
listener
|
769
769
|
);
|
770
770
|
}
|
771
|
+
function parseCoValueCreateOptions(options) {
|
772
|
+
return "_type" in options && (options._type === "Account" || options._type === "Group") ? { owner: options, uniqueness: void 0 } : {
|
773
|
+
owner: options.owner,
|
774
|
+
uniqueness: options.unique ? { uniqueness: options.unique } : void 0
|
775
|
+
};
|
776
|
+
}
|
771
777
|
|
772
778
|
// src/coValues/inbox.ts
|
773
779
|
import {
|
@@ -1050,7 +1056,8 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
1050
1056
|
ref: RegisteredSchemas["Account"],
|
1051
1057
|
optional: false
|
1052
1058
|
}).accessFrom(target, "_edits." + key + ".by"),
|
1053
|
-
madeAt: rawEdit.at
|
1059
|
+
madeAt: rawEdit.at,
|
1060
|
+
key
|
1054
1061
|
};
|
1055
1062
|
}
|
1056
1063
|
/** @category Collaboration */
|
@@ -1124,11 +1131,8 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
1124
1131
|
**/
|
1125
1132
|
static create(init, options) {
|
1126
1133
|
const instance = new this();
|
1127
|
-
const
|
1128
|
-
|
1129
|
-
options.owner,
|
1130
|
-
options.unique === void 0 ? void 0 : { uniqueness: options.unique }
|
1131
|
-
);
|
1134
|
+
const { owner, uniqueness } = parseCoValueCreateOptions(options);
|
1135
|
+
const raw = instance.rawFromInit(init, owner, uniqueness);
|
1132
1136
|
Object.defineProperties(instance, {
|
1133
1137
|
id: {
|
1134
1138
|
value: raw.id,
|
@@ -1761,7 +1765,7 @@ var _Group = class _Group extends CoValueBase {
|
|
1761
1765
|
return new Proxy(this, AccountAndGroupProxyHandler);
|
1762
1766
|
}
|
1763
1767
|
static create(options) {
|
1764
|
-
return new this(options);
|
1768
|
+
return new this(parseCoValueCreateOptions(options));
|
1765
1769
|
}
|
1766
1770
|
myRole() {
|
1767
1771
|
return this._raw.myRole();
|
@@ -1911,8 +1915,9 @@ var _CoFeed = class _CoFeed extends CoValueBase {
|
|
1911
1915
|
* @category Creation
|
1912
1916
|
*/
|
1913
1917
|
static create(init, options) {
|
1914
|
-
const
|
1915
|
-
const
|
1918
|
+
const { owner } = parseCoValueCreateOptions(options);
|
1919
|
+
const instance = new this({ init, owner });
|
1920
|
+
const raw = owner._raw.createStream();
|
1916
1921
|
Object.defineProperties(instance, {
|
1917
1922
|
id: {
|
1918
1923
|
value: raw.id,
|
@@ -2224,7 +2229,7 @@ var FileStream = class extends CoValueBase {
|
|
2224
2229
|
});
|
2225
2230
|
}
|
2226
2231
|
static create(options) {
|
2227
|
-
return new this(options);
|
2232
|
+
return new this(parseCoValueCreateOptions(options));
|
2228
2233
|
}
|
2229
2234
|
getChunks(options) {
|
2230
2235
|
return this._raw.getBinaryChunks(options?.allowUnfinished);
|
@@ -2283,7 +2288,8 @@ var FileStream = class extends CoValueBase {
|
|
2283
2288
|
* @category Content
|
2284
2289
|
*/
|
2285
2290
|
static async createFromBlob(blob, options) {
|
2286
|
-
const stream = this.create(
|
2291
|
+
const stream = this.create(options);
|
2292
|
+
const onProgress = "onProgress" in options ? options.onProgress : void 0;
|
2287
2293
|
const start = Date.now();
|
2288
2294
|
const data = new Uint8Array(await blob.arrayBuffer());
|
2289
2295
|
stream.start({
|
@@ -2296,7 +2302,7 @@ var FileStream = class extends CoValueBase {
|
|
2296
2302
|
for (let idx = 0; idx < data.length; idx += chunkSize) {
|
2297
2303
|
stream.push(data.slice(idx, idx + chunkSize));
|
2298
2304
|
if (Date.now() - lastProgressUpdate > 100) {
|
2299
|
-
|
2305
|
+
onProgress?.(idx / data.length);
|
2300
2306
|
lastProgressUpdate = Date.now();
|
2301
2307
|
}
|
2302
2308
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
@@ -2309,7 +2315,7 @@ var FileStream = class extends CoValueBase {
|
|
2309
2315
|
"s - Throughput in MB/s",
|
2310
2316
|
1e3 * (blob.size / (end - start)) / (1024 * 1024)
|
2311
2317
|
);
|
2312
|
-
|
2318
|
+
onProgress?.(1);
|
2313
2319
|
return stream;
|
2314
2320
|
}
|
2315
2321
|
/**
|
@@ -2482,8 +2488,9 @@ var _CoList = class _CoList extends Array {
|
|
2482
2488
|
* @category Creation
|
2483
2489
|
**/
|
2484
2490
|
static create(items, options) {
|
2485
|
-
const
|
2486
|
-
const
|
2491
|
+
const { owner } = parseCoValueCreateOptions(options);
|
2492
|
+
const instance = new this({ init: items, owner });
|
2493
|
+
const raw = owner._raw.createList(
|
2487
2494
|
toRawItems(items, instance._schema[ItemsSym])
|
2488
2495
|
);
|
2489
2496
|
Object.defineProperties(instance, {
|
@@ -2850,4 +2857,4 @@ export {
|
|
2850
2857
|
SchemaUnion
|
2851
2858
|
};
|
2852
2859
|
/* istanbul ignore file -- @preserve */
|
2853
|
-
//# sourceMappingURL=chunk-
|
2860
|
+
//# sourceMappingURL=chunk-MUJIKQFH.js.map
|