univo 0.2.10 → 0.2.11

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
@@ -5,7 +5,7 @@ import { config } from 'dotenv';
5
5
  import { WebSocket } from 'partysocket';
6
6
  import { defineCommand, runMain } from 'citty';
7
7
  import { http } from './transport.mjs';
8
- import { c as createLogger, v as version, f as name } from './shared/univo.DfCC9G2B.mjs';
8
+ import { c as createLogger, v as version, f as name } from './shared/univo.Cz5ut_5D.mjs';
9
9
  import './shared/univo.C0flyVee.mjs';
10
10
 
11
11
  const log = createLogger({ quiet: false });
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createLogger, d as decompress, a as decoder, h as hexToNumber, i as isHexEqual, r as retry, v as version, n as normalizeHex } from './shared/univo.DfCC9G2B.mjs';
1
+ import { c as createLogger, d as decompress, a as decoder, h as hexToNumber, i as isHexEqual, r as retry, v as version, n as normalizeHex } from './shared/univo.Cz5ut_5D.mjs';
2
2
  import { c as createException, g as getException, a as catchException } from './shared/univo.C0flyVee.mjs';
3
3
 
4
4
  function matchFilter(block, filter) {
package/dist/realtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createLogger, b as iife, h as hexToNumber, e as numberToHex, m as mutex, r as retry, i as isHexEqual } from './shared/univo.DfCC9G2B.mjs';
1
+ import { c as createLogger, b as iife, h as hexToNumber, e as numberToHex, m as mutex, r as retry, i as isHexEqual } from './shared/univo.Cz5ut_5D.mjs';
2
2
 
3
3
  const MAX_LENGTH = 1e4;
4
4
  function defineBlockchain(opts) {
@@ -102,7 +102,7 @@ function realtime(opts) {
102
102
  pending.push(head);
103
103
  const heads = pending.map((head2) => ({ chain, ...head2 }));
104
104
  await opts.indexer.request({ method: "public_writeUnfinalizedHeads", params: [heads] });
105
- log.debug(`Delivered ${heads.length} unfinalized heads`);
105
+ log.debug(`Delivered ${heads.length} unfinalized head(s)`);
106
106
  pending = pending.filter((head2) => {
107
107
  return !heads.some((_head) => {
108
108
  return isHexEqual(head2.hash, _head.hash);
@@ -1,5 +1,5 @@
1
1
  const name = "univo";
2
- const version = "0.2.10";
2
+ const version = "0.2.11";
3
3
 
4
4
  function createLogger(opts) {
5
5
  let prefix = `[${name}@${version}]`;
@@ -12,7 +12,7 @@ function createLogger(opts) {
12
12
  return;
13
13
  }
14
14
  if (process.env.LOG_LEVEL === "DEBUG") {
15
- console.log(`${opts.prefix} DEBUG`, ...any);
15
+ console.log(`${prefix} DEBUG`, ...any);
16
16
  }
17
17
  },
18
18
  info(...any) {
@@ -20,7 +20,7 @@ function createLogger(opts) {
20
20
  return;
21
21
  }
22
22
  if (process.env.LOG_LEVEL === "DEBUG" || process.env.LOG_LEVEL === "INFO") {
23
- console.log(`${opts.prefix} INFO`, ...any);
23
+ console.log(`${prefix} INFO`, ...any);
24
24
  }
25
25
  },
26
26
  warn(...any) {
@@ -28,7 +28,7 @@ function createLogger(opts) {
28
28
  return;
29
29
  }
30
30
  if (process.env.LOG_LEVEL === "DEBUG" || process.env.LOG_LEVEL === "INFO" || process.env.LOG_LEVEL === "WARN") {
31
- console.log(`${opts.prefix} WARN`, ...any);
31
+ console.log(`${prefix} WARN`, ...any);
32
32
  }
33
33
  },
34
34
  error(...any) {
@@ -36,7 +36,7 @@ function createLogger(opts) {
36
36
  return;
37
37
  }
38
38
  if (process.env.LOG_LEVEL === "DEBUG" || process.env.LOG_LEVEL === "INFO" || process.env.LOG_LEVEL === "WARN" || process.env.LOG_LEVEL === "ERROR") {
39
- console.log(`${opts.prefix} ERROR`, ...any);
39
+ console.log(`${prefix} ERROR`, ...any);
40
40
  }
41
41
  }
42
42
  };
@@ -1,7 +1,7 @@
1
1
  import ws from 'ws';
2
2
  import { WebSocket } from 'partysocket';
3
3
  import { c as createException } from './shared/univo.C0flyVee.mjs';
4
- import { g as compress, j as raise, c as createLogger } from './shared/univo.DfCC9G2B.mjs';
4
+ import { g as compress, j as raise, c as createLogger } from './shared/univo.Cz5ut_5D.mjs';
5
5
 
6
6
  function createSocket(url, opts) {
7
7
  const socket = new WebSocket(url, [], { WebSocket: ws });
@@ -164,6 +164,9 @@ function http(url, opts = {}) {
164
164
  const res = await fetch(url, { headers, body, method: "POST", signal: AbortSignal.timeout(30 * 1e3) }).catch((cause) => {
165
165
  throw new Error(ClientConnectionError, { cause });
166
166
  });
167
+ if (!res.ok || res.status < 200 || res.status >= 300) {
168
+ throw new Error(ClientConnectionError);
169
+ }
167
170
  const json = await res.json().catch((cause) => {
168
171
  throw new Error(ClientResponseError, { cause });
169
172
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "univo",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "0.2.10",
5
+ "version": "0.2.11",
6
6
  "sideEffects": false,
7
7
  "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",