jazz-tools 0.14.27 → 0.14.28

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.14.27 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.14.28 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,12 +11,12 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 11.11 KB
13
13
  ESM dist/testing.js 6.31 KB
14
- ESM dist/chunk-G3QC4FAY.js 137.25 KB
14
+ ESM dist/chunk-AUQIX4E7.js 137.28 KB
15
15
  ESM dist/index.js.map 18.38 KB
16
16
  ESM dist/testing.js.map 12.57 KB
17
- ESM dist/chunk-G3QC4FAY.js.map 313.88 KB
18
- ESM ⚡️ Build success in 65ms
17
+ ESM dist/chunk-AUQIX4E7.js.map 313.97 KB
18
+ ESM ⚡️ Build success in 61ms
19
19
 
20
- > jazz-tools@0.14.27 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.14.28 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.14.28
4
+
5
+ ### Patch Changes
6
+
7
+ - 06c5a1c: Resolve FileStream.load() only when the stream is fully downloaded
8
+ - cojson@0.14.28
9
+
3
10
  ## 0.14.27
4
11
 
5
12
  ### Patch Changes
@@ -1444,21 +1444,6 @@ var FileStream = class extends CoValueBase {
1444
1444
  */
1445
1445
  static async loadAsBlob(id, options) {
1446
1446
  let stream = await this.load(id, options);
1447
- if (!options?.allowUnfinished && !stream?.isBinaryStreamEnded()) {
1448
- stream = await new Promise((resolve) => {
1449
- subscribeToCoValueWithoutMe(
1450
- this,
1451
- id,
1452
- options || {},
1453
- (value, unsubscribe) => {
1454
- if (value.isBinaryStreamEnded()) {
1455
- unsubscribe();
1456
- resolve(value);
1457
- }
1458
- }
1459
- );
1460
- });
1461
- }
1462
1447
  return stream?.toBlob({
1463
1448
  allowUnfinished: options?.allowUnfinished
1464
1449
  });
@@ -1524,8 +1509,24 @@ var FileStream = class extends CoValueBase {
1524
1509
  * Load a `FileStream`
1525
1510
  * @category Subscription & Loading
1526
1511
  */
1527
- static load(id, options) {
1528
- return loadCoValueWithoutMe(this, id, options);
1512
+ static async load(id, options) {
1513
+ const stream = await loadCoValueWithoutMe(this, id, options);
1514
+ if (!options?.allowUnfinished && !stream?.isBinaryStreamEnded()) {
1515
+ return new Promise((resolve) => {
1516
+ subscribeToCoValueWithoutMe(
1517
+ this,
1518
+ id,
1519
+ options || {},
1520
+ (value, unsubscribe) => {
1521
+ if (value.isBinaryStreamEnded()) {
1522
+ unsubscribe();
1523
+ resolve(value);
1524
+ }
1525
+ }
1526
+ );
1527
+ });
1528
+ }
1529
+ return stream;
1529
1530
  }
1530
1531
  static subscribe(id, ...args) {
1531
1532
  const { options, listener } = parseSubscribeRestArgs(args);
@@ -4823,4 +4824,4 @@ export {
4823
4824
  JazzContextManager
4824
4825
  };
4825
4826
  /* istanbul ignore file -- @preserve */
4826
- //# sourceMappingURL=chunk-G3QC4FAY.js.map
4827
+ //# sourceMappingURL=chunk-AUQIX4E7.js.map