@wovin/core 0.0.11 → 0.0.13

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QPGEBDMJ.min.js";
4
4
  import {
5
5
  lastWriteWins
6
- } from "./chunk-TPRWMCU7.min.js";
6
+ } from "./chunk-DPU6MD7E.min.js";
7
7
  import {
8
8
  CID,
9
9
  E,
@@ -23,7 +23,7 @@ import {
23
23
  rollingFilter,
24
24
  src_exports,
25
25
  wrapper_default
26
- } from "./chunk-UQJEOS7T.min.js";
26
+ } from "./chunk-JEYJIYNF.min.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __toESM
@@ -2032,7 +2032,12 @@ async function decodePubFromBlocks({ rootCID, blockStore }, recursionTrace = [])
2032
2032
  if (areCidsEqual(root.prev, rootCID) || containsCid(recursionTrace, root.prev)) {
2033
2033
  throw ERROR(`[pubFromBlocks] pub chain has a loop`, { rootCID, prev: root.prev, recursionTrace });
2034
2034
  }
2035
- applogs.push(...(await decodePubFromBlocks({ rootCID: root.prev, blockStore }, [...recursionTrace, rootCID])).applogs);
2035
+ applogs = applogs.concat(
2036
+ (await decodePubFromBlocks(
2037
+ { rootCID: root.prev, blockStore },
2038
+ [...recursionTrace, rootCID]
2039
+ )).applogs
2040
+ );
2036
2041
  }
2037
2042
  const result = {
2038
2043
  cid: rootCID,
@@ -2152,7 +2157,7 @@ async function preparePubForPush(agent, appThread, threadToPublish, publication,
2152
2157
  }
2153
2158
  VERBOSE2("encrypting", { sharedAgents, sharedKeyMap });
2154
2159
  for (const [eachAgent, eachEncKey] of Array.from(sharedKeyMap.entries())) {
2155
- VERBOSE2.force("adding key", { eachAgent, eachEncKey });
2160
+ VERBOSE2("adding key", { eachAgent, eachEncKey });
2156
2161
  agentSharedKeyLogs.push({
2157
2162
  ag: agent.ag,
2158
2163
  en: eachAgent,
@@ -2164,9 +2169,9 @@ async function preparePubForPush(agent, appThread, threadToPublish, publication,
2164
2169
  const CIDlist = [];
2165
2170
  const pubCIDmap = {};
2166
2171
  for (const eachLog of logsToPublish) {
2167
- VERBOSE2.force("[crypto] encrypting ", { eachLog, sharedKey });
2172
+ VERBOSE2("[crypto] encrypting ", { eachLog, sharedKey });
2168
2173
  const encPayload = await encryptApplog(eachLog, sharedKey);
2169
- DEBUG2.force("[crypto] encrypted ", { eachLog, encPayload, sharedKey });
2174
+ DEBUG2("[crypto] encrypted ", { eachLog, encPayload, sharedKey });
2170
2175
  encryptedApplogs.push({ enc: encPayload });
2171
2176
  }
2172
2177
  maybeEncryptedApplogs = encryptedApplogs;
@@ -2209,11 +2214,11 @@ async function encodePubAsCar(agent, applogs, infoLogs, prevPubCID) {
2209
2214
  DEBUG2(`[encodePubAsCar] encoding`, { agent, applogs, infoLogs });
2210
2215
  const { cids: infoLogCids, encodedApplogs: encodedInfoLogs } = await encodeApplogsAsIPLD(infoLogs);
2211
2216
  const { cids: applogCids, encodedApplogs } = await encodeApplogsAsIPLD(applogs);
2212
- const blocks = [...encodedApplogs, ...encodedInfoLogs];
2217
+ let blocks = encodedApplogs.concat(encodedInfoLogs);
2213
2218
  const infoLogsWrap = await encodeBlockOriginal({ logs: infoLogCids });
2214
2219
  blocks.push(infoLogsWrap);
2215
2220
  const { rootCID: chunkRootCID, blocks: chunkBlocks } = await chunkApplogs(applogCids);
2216
- blocks.push(...chunkBlocks);
2221
+ blocks = blocks.concat(chunkBlocks);
2217
2222
  const infoSignature = await agent.sign(infoLogsWrap.cid.bytes);
2218
2223
  const applogsSignature = await agent.sign(chunkRootCID.bytes);
2219
2224
  const root = {
@@ -2279,14 +2284,14 @@ async function encodeApplogsAsCar(applogs) {
2279
2284
  return await makeCarBlob(encodedRoot.cid, [encodedRoot, ...encodedApplogs]);
2280
2285
  }
2281
2286
  async function encodeApplogsAsIPLD(applogs) {
2282
- DEBUG2.force({ applogs });
2287
+ DEBUG2({ applogs });
2283
2288
  const validApplogs = applogs.filter((eachLog) => !!eachLog);
2284
- DEBUG2.force({ validApplogs });
2289
+ DEBUG2({ validApplogs });
2285
2290
  if (!validApplogs.length)
2286
2291
  throw ERROR2("no valid applogs");
2287
2292
  const preppedLogs = validApplogs.map((log) => prepareForPub(log).log);
2288
2293
  const encodedApplogs = await Promise.all(preppedLogs.map(encodeBlockOriginal));
2289
- DEBUG2.force("[encodeApplogsAsIpld] encoded applogs", { preppedLogs, encodedApplogs });
2294
+ DEBUG2("[encodeApplogsAsIpld] encoded applogs", { preppedLogs, encodedApplogs });
2290
2295
  const cids = encodedApplogs.map((b) => {
2291
2296
  if (!b.cid)
2292
2297
  throw ERROR2(`[publish] no cid for encoded log:`, b);
@@ -2311,4 +2316,4 @@ export {
2311
2316
  carFromBlob,
2312
2317
  streamReaderToIterable
2313
2318
  };
2314
- //# sourceMappingURL=chunk-C75X52ZX.min.js.map
2319
+ //# sourceMappingURL=chunk-R3MVKMV2.min.js.map