diff --git a/common/deno.json b/common/deno.json index 4ca07db..682eab5 100644 --- a/common/deno.json +++ b/common/deno.json @@ -1,7 +1,10 @@ { "name": "@atp/common", - "version": "0.1.0-alpha.5", - "exports": "./mod.ts", + "version": "0.1.0-alpha.6", + "exports": { + ".": "./mod.ts", + "./server": "./server.ts" + }, "license": "MIT", "imports": { "@ipld/dag-cbor": "npm:@ipld/dag-cbor@^9.2.5", diff --git a/common/mod.ts b/common/mod.ts index 336d81e..eb1730f 100644 --- a/common/mod.ts +++ b/common/mod.ts @@ -2,15 +2,15 @@ * # AT Protocol Common Utilities * * Shared TypeScript code for other @atp/* packages. - * This package is oriented towards writing servers. + * This module is web-compatible. + * + * For server-only utilities (env, fs, logger), use "@atp/common/server". * * @module */ export * as check from "./check.ts"; export * as util from "./util.ts"; -export * from "./env.ts"; -export * from "./fs.ts"; export * from "./ipld.ts"; export * from "./ipld-multi.ts"; export * from "./obfuscate.ts"; @@ -19,7 +19,6 @@ export * from "./async.ts"; export * from "./types.ts"; export * from "./tid.ts"; export * from "./strings.ts"; -export * from "./logger.ts"; export * from "./dates.ts"; export * from "./util.ts"; export * from "./retry.ts"; diff --git a/common/server.ts b/common/server.ts new file mode 100644 index 0000000..37d3bcc --- /dev/null +++ b/common/server.ts @@ -0,0 +1,11 @@ +/** + * # AT Protocol Common Utilities (Server) + * + * Server-only utilities that require Deno/Node.js runtime. + * Includes: env, fs, logger. + * + * @module + */ +export * from "./env.ts"; +export * from "./fs.ts"; +export * from "./logger.ts"; diff --git a/sync/firehose/index.ts b/sync/firehose/index.ts index bf46ad5..970e45f 100644 --- a/sync/firehose/index.ts +++ b/sync/firehose/index.ts @@ -250,11 +250,11 @@ export class Firehose { if (!parsed) { continue; } - this.opts.runner.trackEvent(parsed.did, parsed.seq, async () => { + await this.opts.runner.trackEvent(parsed.did, parsed.seq, async () => { const parsed = await this.parseEvt(evt); for (const write of parsed) { try { - this.opts.handleEvent(write); + await this.opts.handleEvent(write); } catch (err) { this.opts.onError(new FirehoseHandlerError(err, write)); } @@ -314,7 +314,7 @@ export class Firehose { const parsed = await this.parseEvt(evt); for (const write of parsed) { try { - this.opts.handleEvent(write); + await this.opts.handleEvent(write); } catch (err) { this.opts.onError(new FirehoseHandlerError(err, write)); }