univo 0.2.21 → 0.2.22

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/dist/cli.mjs CHANGED
@@ -4,8 +4,8 @@ import open from 'open';
4
4
  import { config } from 'dotenv';
5
5
  import { WebSocket } from 'partysocket';
6
6
  import { defineCommand, runMain } from 'citty';
7
- import { h as http } from './shared/univo.DB3LVZYu.mjs';
8
- import { c as createLogger, v as version, b as name } from './shared/univo.lpJwPpJF.mjs';
7
+ import { h as http } from './shared/univo.l25rfakv.mjs';
8
+ import { c as createLogger, v as version, b as name } from './shared/univo.7tiS89tH.mjs';
9
9
 
10
10
  const log = createLogger({ quiet: false });
11
11
  const dev = defineCommand({
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { StorageError } from '@storagesdk/core';
2
- import { g as getException, c as createException, a as catchException, l as local } from './shared/univo.DB3LVZYu.mjs';
3
- import { c as createLogger, d as decompress, e as decoder, r as retry, v as version, h as hexToNumber, a as isHexEqual, n as numberToHex, f as normalizeHex, g as compress } from './shared/univo.lpJwPpJF.mjs';
2
+ import { g as getException, c as createException, a as catchException, l as local } from './shared/univo.l25rfakv.mjs';
3
+ import { c as createLogger, d as decompress, e as decoder, r as retry, v as version, h as hexToNumber, a as isHexEqual, n as numberToHex, f as normalizeHex, g as compress } from './shared/univo.7tiS89tH.mjs';
4
4
  import 'ws';
5
5
  import 'partysocket';
6
6
 
@@ -266,6 +266,14 @@ function indexer(opts) {
266
266
  const prefix = `heights/v1/${normalizeHex(chain)}/${normalizeHex(number, 16)}`;
267
267
  const body = JSON.stringify({ hello: "world" });
268
268
  await opts.metadataStorage.upload(prefix, body);
269
+ },
270
+ async delete(heights) {
271
+ await Promise.all(
272
+ heights.map(async (height) => {
273
+ const prefix = `heights/v1/${normalizeHex(height.chain)}/${normalizeHex(height.number, 16)}`;
274
+ await opts.metadataStorage.delete(prefix);
275
+ })
276
+ );
269
277
  }
270
278
  }
271
279
  };
@@ -617,21 +625,26 @@ function indexer(opts) {
617
625
  await Promise.all(promises);
618
626
  }
619
627
  async function cleanupFinalizedHeads(chain, finalized) {
620
- const [_blocks, _commits] = await Promise.all([
628
+ const [_blocks, _commits, _heights] = await Promise.all([
621
629
  metadata.blocks.list(chain),
622
630
  //
623
- metadata.commits.list(chain)
631
+ metadata.commits.list(chain),
632
+ metadata.heights.list(chain)
624
633
  ]);
625
634
  const blocks = _blocks.filter((block) => {
626
635
  return hexToNumber(block.number) <= hexToNumber(finalized);
627
636
  });
628
637
  const commits = _commits.filter((commit) => {
629
- return hexToNumber(commit.number) < hexToNumber(finalized);
638
+ return hexToNumber(commit.number) <= hexToNumber(finalized);
639
+ });
640
+ const heights = _heights.filter((height) => {
641
+ return hexToNumber(height.number) < hexToNumber(finalized);
630
642
  });
631
643
  await Promise.all([
632
644
  metadata.blocks.delete(blocks),
633
645
  //
634
- metadata.commits.delete(commits)
646
+ metadata.commits.delete(commits),
647
+ metadata.heights.delete(heights)
635
648
  ]);
636
649
  }
637
650
  const private_getMetadata = async () => {
package/dist/realtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createLogger, i as iife, h as hexToNumber, n as numberToHex, m as mutex, r as retry, a as isHexEqual } from './shared/univo.lpJwPpJF.mjs';
1
+ import { c as createLogger, i as iife, h as hexToNumber, n as numberToHex, m as mutex, r as retry, a as isHexEqual } from './shared/univo.7tiS89tH.mjs';
2
2
 
3
3
  function defineBlockchain(opts) {
4
4
  const log = createLogger({ quiet: opts.quiet });
@@ -1,5 +1,5 @@
1
1
  const name = "univo";
2
- const version = "0.2.21";
2
+ const version = "0.2.22";
3
3
 
4
4
  function createLogger(opts) {
5
5
  let prefix = `[${name}@${version}]`;
@@ -1,6 +1,6 @@
1
1
  import ws from 'ws';
2
2
  import { WebSocket } from 'partysocket';
3
- import { g as compress, j as raise, c as createLogger, m as mutex } from './univo.lpJwPpJF.mjs';
3
+ import { g as compress, j as raise, c as createLogger, m as mutex } from './univo.7tiS89tH.mjs';
4
4
 
5
5
  function createException(message) {
6
6
  return `univo:${message}`;
@@ -1,4 +1,4 @@
1
1
  import 'ws';
2
2
  import 'partysocket';
3
- export { h as http, l as local, w as wss } from './shared/univo.DB3LVZYu.mjs';
4
- import './shared/univo.lpJwPpJF.mjs';
3
+ export { h as http, l as local, w as wss } from './shared/univo.l25rfakv.mjs';
4
+ import './shared/univo.7tiS89tH.mjs';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "univo",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "0.2.21",
5
+ "version": "0.2.22",
6
6
  "sideEffects": false,
7
7
  "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",