univo 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.
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 './client.mjs';
|
|
8
|
-
import { c as createLogger, e as version, l as name } from './shared/univo.
|
|
8
|
+
import { c as createLogger, e as version, l as name } from './shared/univo.C9TrncJq.mjs';
|
|
9
9
|
|
|
10
10
|
const log = createLogger({ quiet: false });
|
|
11
11
|
const dev = defineCommand({
|
package/dist/client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createException, o as compress, f as getSignature, g as getException } from './shared/univo.
|
|
1
|
+
import { a as createException, o as compress, f as getSignature, g as getException } from './shared/univo.C9TrncJq.mjs';
|
|
2
2
|
|
|
3
3
|
const MIN_GZIP_SIZE = 1024;
|
|
4
4
|
function http(url, opts = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createLogger, v as verifySignature, d as decompress, a as createException, g as getException, h as hexToNumber, i as isAddressEqual, b as catchException, r as retry, e as version, n as nonNullable, f as getSignature } from './shared/univo.
|
|
1
|
+
import { c as createLogger, v as verifySignature, d as decompress, a as createException, g as getException, h as hexToNumber, i as isAddressEqual, b as catchException, r as retry, e as version, n as nonNullable, f as getSignature } from './shared/univo.C9TrncJq.mjs';
|
|
2
2
|
|
|
3
3
|
function matchFilter(block, filter) {
|
|
4
4
|
if (!chainValid(block, filter)) return false;
|
|
@@ -223,7 +223,7 @@ function indexer(opts) {
|
|
|
223
223
|
"__lookupGetter__",
|
|
224
224
|
"__lookupSetter__"
|
|
225
225
|
];
|
|
226
|
-
const getWriteEventsProxy = (value,
|
|
226
|
+
const getWriteEventsProxy = (value, callback) => {
|
|
227
227
|
const createProxyHandler = (path) => {
|
|
228
228
|
return {
|
|
229
229
|
get(target, key, receiver) {
|
|
@@ -238,7 +238,7 @@ function indexer(opts) {
|
|
|
238
238
|
if (ignored.some((ignored2) => key.endsWith(ignored2))) {
|
|
239
239
|
return value2;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
return callback();
|
|
242
242
|
}
|
|
243
243
|
if (typeof value2 === "object" && value2 !== null) {
|
|
244
244
|
return new Proxy(value2, createProxyHandler());
|
|
@@ -255,7 +255,11 @@ function indexer(opts) {
|
|
|
255
255
|
if (relevant_events.length === 0) return { failures: [] };
|
|
256
256
|
if (params.events.length === 0) return { failures: [] };
|
|
257
257
|
const failures = {};
|
|
258
|
-
|
|
258
|
+
let accessed_undefined_key = false;
|
|
259
|
+
const proxied_blocks = getWriteEventsProxy(params.blocks, () => {
|
|
260
|
+
accessed_undefined_key = true;
|
|
261
|
+
throw new Error(IncompleteBlockError);
|
|
262
|
+
});
|
|
259
263
|
const promises = events_grouped_by_storage_map.entries().map(async ([storage, grouped_events]) => {
|
|
260
264
|
const batch = [];
|
|
261
265
|
for (const event2 of grouped_events) {
|
|
@@ -264,6 +268,7 @@ function indexer(opts) {
|
|
|
264
268
|
try {
|
|
265
269
|
if (!event2.filters.some((filter) => matchFilter(block, filter))) continue;
|
|
266
270
|
const events = event2.handler(block);
|
|
271
|
+
if (accessed_undefined_key) throw new Error(IncompleteBlockError);
|
|
267
272
|
for (const event3 of events) batch.push(event3);
|
|
268
273
|
} catch (error) {
|
|
269
274
|
const status = catchException(error, IncompleteBlockError) ? "incomplete_error" : "handler_error";
|
|
@@ -285,7 +290,10 @@ function indexer(opts) {
|
|
|
285
290
|
}
|
|
286
291
|
if (batch.length === 0) return;
|
|
287
292
|
const start = Date.now();
|
|
288
|
-
|
|
293
|
+
try {
|
|
294
|
+
await retry(storage.upsert, [batch], 2);
|
|
295
|
+
if (accessed_undefined_key) throw new Error(IncompleteBlockError);
|
|
296
|
+
} catch (error) {
|
|
289
297
|
const status = catchException(error, IncompleteBlockError) ? "incomplete_error" : "upsert_error";
|
|
290
298
|
if (status === "upsert_error") {
|
|
291
299
|
if (error instanceof Error) {
|
|
@@ -305,7 +313,7 @@ function indexer(opts) {
|
|
|
305
313
|
};
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
|
-
}
|
|
316
|
+
}
|
|
309
317
|
const stop = Date.now() - start;
|
|
310
318
|
for (const event2 of relevant_events) {
|
|
311
319
|
log.debug(`Recorded ${batch.length} ${event2.id} in ${stop}ms`);
|
package/dist/realtime.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import WS from 'ws';
|
|
2
2
|
import { WebSocket } from 'partysocket';
|
|
3
3
|
import { http } from './client.mjs';
|
|
4
|
-
import { c as createLogger, r as retry, h as hexToNumber, j as raise, m as mutex, k as assert } from './shared/univo.
|
|
4
|
+
import { c as createLogger, r as retry, h as hexToNumber, j as raise, m as mutex, k as assert } from './shared/univo.C9TrncJq.mjs';
|
|
5
5
|
|
|
6
6
|
function createSocket(url, opts) {
|
|
7
7
|
const ws = new WebSocket(url, [], { WebSocket: WS });
|