@wovin/core 0.1.15 → 0.1.16

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.
@@ -46,7 +46,7 @@ import {
46
46
  variableNameWithoutQuestionmark,
47
47
  withPvFrom,
48
48
  withTs
49
- } from "./chunk-3Y5KUHV5.min.js";
49
+ } from "./chunk-MPOFY7NX.min.js";
50
50
  import "./chunk-HYMC7W6S.min.js";
51
51
  import "./chunk-KEHU7HGZ.min.js";
52
52
  import "./chunk-PHITDXZT.min.js";
@@ -16,7 +16,7 @@ import {
16
16
  rollingMapper,
17
17
  sortApplogsByTs,
18
18
  wrapper_default
19
- } from "./chunk-3Y5KUHV5.min.js";
19
+ } from "./chunk-MPOFY7NX.min.js";
20
20
  import {
21
21
  action,
22
22
  autorun,
@@ -507,4 +507,4 @@ export {
507
507
  withTimeout,
508
508
  throwOnTimeout
509
509
  };
510
- //# sourceMappingURL=chunk-SFDNH2ID.min.js.map
510
+ //# sourceMappingURL=chunk-AIITTHC6.min.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QPGEBDMJ.min.js";
4
4
  import {
5
5
  lastWriteWins
6
- } from "./chunk-SFDNH2ID.min.js";
6
+ } from "./chunk-AIITTHC6.min.js";
7
7
  import {
8
8
  CID,
9
9
  areCidsEqual,
@@ -16,7 +16,7 @@ import {
16
16
  rollingFilter,
17
17
  src_exports,
18
18
  wrapper_default
19
- } from "./chunk-3Y5KUHV5.min.js";
19
+ } from "./chunk-MPOFY7NX.min.js";
20
20
  import {
21
21
  __commonJS,
22
22
  __toESM
@@ -4119,4 +4119,4 @@ export {
4119
4119
  carFromBlob,
4120
4120
  streamReaderToIterable
4121
4121
  };
4122
- //# sourceMappingURL=chunk-GH2FXZ3U.min.js.map
4122
+ //# sourceMappingURL=chunk-C22YMCSL.min.js.map
@@ -2,7 +2,7 @@ import {
2
2
  cyrb53hash,
3
3
  ensureTsPvAndFinalizeApplog,
4
4
  g
5
- } from "./chunk-3Y5KUHV5.min.js";
5
+ } from "./chunk-MPOFY7NX.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-6KONUEQB.min.js.map
40
+ //# sourceMappingURL=chunk-DUAUQKBV.min.js.map
@@ -3,7 +3,7 @@ import {
3
3
  areCidsEqual,
4
4
  decode,
5
5
  g
6
- } from "./chunk-3Y5KUHV5.min.js";
6
+ } from "./chunk-MPOFY7NX.min.js";
7
7
 
8
8
  // src/ipfs/fetch-snapshot-chain.ts
9
9
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -67,4 +67,4 @@ function createMemoryBlockStore() {
67
67
  export {
68
68
  fetchSnapshotChainUntil
69
69
  };
70
- //# sourceMappingURL=chunk-XR2SGDQV.min.js.map
70
+ //# sourceMappingURL=chunk-I73T6OVV.min.js.map
@@ -4,7 +4,7 @@ import {
4
4
  createDebugName,
5
5
  g,
6
6
  observableArrayMap
7
- } from "./chunk-3Y5KUHV5.min.js";
7
+ } from "./chunk-MPOFY7NX.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-6XE4TT2P.min.js.map
65
+ //# sourceMappingURL=chunk-IFB3AKYA.min.js.map
@@ -10579,7 +10579,7 @@ function joinThreads(threads) {
10579
10579
  var { WARN: WARN6, LOG: LOG6, DEBUG: DEBUG6, VERBOSE: VERBOSE6, ERROR: ERROR6 } = g.setup(g.INFO);
10580
10580
  var MappedThread = class _MappedThread extends Thread {
10581
10581
  // mapped to unsubscribe function
10582
- constructor(name2, parents, filters, _initialLogs, _eventMapper, _writeMapper = null) {
10582
+ constructor(name2, parents, filters, _initialLogs, _eventMapper, _writeMapper = null, _readOnly) {
10583
10583
  super(
10584
10584
  name2,
10585
10585
  parents,
@@ -10591,6 +10591,7 @@ var MappedThread = class _MappedThread extends Thread {
10591
10591
  this._initialLogs = _initialLogs;
10592
10592
  this._eventMapper = _eventMapper;
10593
10593
  this._writeMapper = _writeMapper;
10594
+ this._readOnly = _readOnly;
10594
10595
  makeObservable(this, {
10595
10596
  // @ts-expect-error bc it's private
10596
10597
  onParentUpdate: action
@@ -10610,13 +10611,29 @@ var MappedThread = class _MappedThread extends Thread {
10610
10611
  mapper
10611
10612
  );
10612
10613
  }
10614
+ static asReadOnly(parent) {
10615
+ if (parent.readOnly) return parent;
10616
+ return new _MappedThread(
10617
+ `readOnly(${parent.name})`,
10618
+ parent,
10619
+ parent.filters,
10620
+ // @ts-expect-error ? what's the proper way
10621
+ parent._applogs,
10622
+ null,
10623
+ null,
10624
+ true
10625
+ // readOnly
10626
+ );
10627
+ }
10613
10628
  _parentSubscriptions = null;
10614
10629
  insert(appLogsToInsert) {
10630
+ if (this.readOnly) throw ERROR6(`[MappedThread] insert() called on read-only thread:`, this.nameAndSizeUntracked);
10615
10631
  const mapped = this._writeMapper ? this._writeMapper(appLogsToInsert) : appLogsToInsert;
10616
10632
  if (this._writeMapper && !mapped) return;
10617
10633
  return this.parents.forEach((parent) => parent.insert(mapped));
10618
10634
  }
10619
10635
  insertRaw(appLogsToInsert) {
10636
+ if (this.readOnly) throw ERROR6(`[MappedThread] insertRaw() called on read-only thread:`, this.nameAndSizeUntracked);
10620
10637
  const mapped = this._writeMapper ? this._writeMapper(appLogsToInsert) : appLogsToInsert;
10621
10638
  if (this._writeMapper && !mapped) return;
10622
10639
  return this.parents.forEach((parent) => parent.insertRaw(mapped));
@@ -10699,7 +10716,7 @@ var MappedThread = class _MappedThread extends Thread {
10699
10716
  this.notifySubscribers(mapResult);
10700
10717
  }
10701
10718
  get readOnly() {
10702
- return false;
10719
+ return this._readOnly ?? false;
10703
10720
  }
10704
10721
  };
10705
10722
 
@@ -10840,6 +10857,7 @@ function assertOnlyCurrent(thread) {
10840
10857
  if (!hasFilter(thread, "lastWriteWins") || !hasFilter(thread, "withoutDeleted")) throw ERROR7(`should be filtered thread, but is:`, thread.filters);
10841
10858
  return thread;
10842
10859
  }
10860
+ var asReadOnly = MappedThread.asReadOnly;
10843
10861
  var simpleApplogMapper = function simpleApplogMapper2(thread, logMapper, opts = {}) {
10844
10862
  const mappedTo = /* @__PURE__ */ new Map();
10845
10863
  const mapLogs = (applogs, thread2) => {
@@ -11218,6 +11236,7 @@ export {
11218
11236
  hasFilter,
11219
11237
  assertRaw,
11220
11238
  assertOnlyCurrent,
11239
+ asReadOnly,
11221
11240
  simpleApplogMapper,
11222
11241
  WriteableThread,
11223
11242
  ThreadInMemory,
@@ -11253,4 +11272,4 @@ lodash-es/lodash.js:
11253
11272
  @noble/hashes/utils.js:
11254
11273
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
11255
11274
  */
11256
- //# sourceMappingURL=chunk-3Y5KUHV5.min.js.map
11275
+ //# sourceMappingURL=chunk-MPOFY7NX.min.js.map