@wovin/core 0.1.31 → 0.1.33

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.
@@ -47,7 +47,7 @@ import {
47
47
  withAg,
48
48
  withPvFrom,
49
49
  withTs
50
- } from "./chunk-5WIJ7WIJ.min.js";
50
+ } from "./chunk-CDYQMETJ.min.js";
51
51
  import "./chunk-HYMC7W6S.min.js";
52
52
  import "./chunk-QO2KMGDN.min.js";
53
53
  import "./chunk-KEHU7HGZ.min.js";
@@ -2,7 +2,7 @@ import {
2
2
  cyrb53hash,
3
3
  ensureTsPvAndFinalizeApplog,
4
4
  g
5
- } from "./chunk-5WIJ7WIJ.min.js";
5
+ } from "./chunk-CDYQMETJ.min.js";
6
6
 
7
7
  // src/pubsub/pub-pull.ts
8
8
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -37,4 +37,4 @@ export {
37
37
  isSubscription,
38
38
  agentToShortHash
39
39
  };
40
- //# sourceMappingURL=chunk-ZHASNJ2G.min.js.map
40
+ //# sourceMappingURL=chunk-2UDZBFG2.min.js.map
@@ -4,7 +4,7 @@ import {
4
4
  createDebugName,
5
5
  g,
6
6
  observableArrayMap
7
- } from "./chunk-5WIJ7WIJ.min.js";
7
+ } from "./chunk-CDYQMETJ.min.js";
8
8
  import {
9
9
  autorun,
10
10
  comparer,
@@ -62,4 +62,4 @@ export {
62
62
  includes,
63
63
  includedIn
64
64
  };
65
- //# sourceMappingURL=chunk-SETD2AWO.min.js.map
65
+ //# sourceMappingURL=chunk-3PE2HQMQ.min.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  unchunkApplogsBlock
3
- } from "./chunk-44AW6ACI.min.js";
3
+ } from "./chunk-U5TJTVXW.min.js";
4
4
  import {
5
5
  CID,
6
6
  areCidsEqual,
7
7
  decode,
8
8
  g,
9
9
  removeDuplicateAppLogs
10
- } from "./chunk-5WIJ7WIJ.min.js";
10
+ } from "./chunk-CDYQMETJ.min.js";
11
11
 
12
12
  // src/retrieve/update-thread.ts
13
13
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -141,4 +141,4 @@ export {
141
141
  withBlockCache,
142
142
  updateThreadFromSnapshot
143
143
  };
144
- //# sourceMappingURL=chunk-KWMOB4AM.min.js.map
144
+ //# sourceMappingURL=chunk-7HS5JGSX.min.js.map
@@ -6202,6 +6202,7 @@ var Thread = class {
6202
6202
  // applogs: computed, //observable.shallow,
6203
6203
  // applogsSorted: computed,
6204
6204
  applogsCids: computed,
6205
+ applogsCidSet: computed,
6205
6206
  applogsByCid: computed,
6206
6207
  insert: action,
6207
6208
  size: computed,
@@ -6253,6 +6254,9 @@ var Thread = class {
6253
6254
  get applogsCids() {
6254
6255
  return this._applogs.map((l2) => l2.cid);
6255
6256
  }
6257
+ get applogsCidSet() {
6258
+ return new Set(this._applogs.map((l2) => l2.cid));
6259
+ }
6256
6260
  map(fn) {
6257
6261
  return this.applogs.map(fn);
6258
6262
  }
@@ -6277,7 +6281,7 @@ var Thread = class {
6277
6281
  }
6278
6282
  }
6279
6283
  hasApplogCid(cid) {
6280
- return this.applogsCids.includes(cid.toString());
6284
+ return this.applogsCidSet.has(cid.toString());
6281
6285
  }
6282
6286
  get applogsByCid() {
6283
6287
  return new Map(this.applogs.map((log) => [log.cid, log]));
@@ -7880,8 +7884,12 @@ function getCidSync(bytes) {
7880
7884
  }
7881
7885
  function encodeBlock(jsonObject) {
7882
7886
  DEBUG3("[encodeBlock]", jsonObject);
7883
- const byteView = encode2(jsonObject);
7884
- return { bytes: byteView, cid: getCidSync(byteView) };
7887
+ try {
7888
+ const byteView = encode2(jsonObject);
7889
+ return { bytes: byteView, cid: getCidSync(byteView) };
7890
+ } catch (err) {
7891
+ throw ERROR3("[encodeBlock] failed to encode:", jsonObject, err);
7892
+ }
7885
7893
  }
7886
7894
  async function encodeBlockOriginal(jsonObject) {
7887
7895
  const encoded = await encode4({ value: jsonObject, codec: src_exports, hasher: sha2562 });
@@ -8701,6 +8709,8 @@ var WriteableThread = class extends Thread {
8701
8709
  super(name2, null, filters, applogs);
8702
8710
  makeObservable(this, {
8703
8711
  // (i) all fields handled in parent
8712
+ insertRaw: action,
8713
+ purge: action
8704
8714
  });
8705
8715
  }
8706
8716
  purge(cidsToPurge) {
@@ -8783,7 +8793,10 @@ var WriteableThread = class extends Thread {
8783
8793
  sortApplogsByTs(appLogsToInsert);
8784
8794
  const sortNeeded = this._applogs.length && isTsBefore(appLogsToInsert[0], this._applogs[this._applogs.length - 1]);
8785
8795
  DEBUG8(`[WriteableThread.insertRaw] About to push to _applogs array`);
8786
- this._applogs.push(...appLogsToInsert);
8796
+ const CHUNK_SIZE = 5e4;
8797
+ for (let i = 0; i < appLogsToInsert.length; i += CHUNK_SIZE) {
8798
+ this._applogs.push(...appLogsToInsert.slice(i, i + CHUNK_SIZE));
8799
+ }
8787
8800
  if (sortNeeded) {
8788
8801
  DEBUG8(`[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)`);
8789
8802
  sortApplogsByTs(this._applogs);
@@ -9051,4 +9064,4 @@ lodash-es/lodash.js:
9051
9064
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9052
9065
  *)
9053
9066
  */
9054
- //# sourceMappingURL=chunk-5WIJ7WIJ.min.js.map
9067
+ //# sourceMappingURL=chunk-CDYQMETJ.min.js.map