@secondlayer/subgraphs 4.2.0 → 4.3.0

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.
@@ -2701,7 +2701,7 @@ function stableStringify(obj) {
2701
2701
  return acc;
2702
2702
  }, {}));
2703
2703
  }
2704
- async function emitSubscriptionOutbox(tx, subgraphName, manifest, matcher, blockHeight) {
2704
+ async function emitWebhookOutbox(tx, subgraphName, manifest, matcher, blockHeight) {
2705
2705
  if (!isEmitOutboxEnabled()) {
2706
2706
  if (!loggedKillSwitch) {
2707
2707
  logger6.warn("SECONDLAYER_EMIT_OUTBOX=false — outbox emission bypassed");
@@ -2720,7 +2720,7 @@ async function emitSubscriptionOutbox(tx, subgraphName, manifest, matcher, block
2720
2720
  const eventType = `${subgraphName}.${write.table}.${OP_VERB[write.op]}`;
2721
2721
  for (const s of subs) {
2722
2722
  rows.push({
2723
- subscription_id: s.id,
2723
+ webhook_id: s.id,
2724
2724
  subgraph_name: subgraphName,
2725
2725
  table_name: write.table,
2726
2726
  block_height: blockHeight,
@@ -2734,7 +2734,7 @@ async function emitSubscriptionOutbox(tx, subgraphName, manifest, matcher, block
2734
2734
  }
2735
2735
  if (rows.length === 0)
2736
2736
  return 0;
2737
- await tx.insertInto("subscription_outbox").values(rows).onConflict((oc) => oc.columns(["subscription_id", "dedup_key"]).doNothing()).execute();
2737
+ await tx.insertInto("webhook_outbox").values(rows).onConflict((oc) => oc.columns(["webhook_id", "dedup_key"]).doNothing()).execute();
2738
2738
  return rows.length;
2739
2739
  }
2740
2740
 
@@ -3047,8 +3047,8 @@ async function answerRead(hostCtx, msg) {
3047
3047
  }
3048
3048
  }
3049
3049
 
3050
- // src/runtime/subscription-state.ts
3051
- import { listSubscriptions } from "@secondlayer/shared/db/queries/subscriptions";
3050
+ // src/runtime/webhook-state.ts
3051
+ import { listWebhooks } from "@secondlayer/shared/db/queries/webhooks";
3052
3052
  import { sql as sql3 } from "kysely";
3053
3053
 
3054
3054
  // src/runtime/emitter-matcher.ts
@@ -3168,7 +3168,7 @@ function key(subgraphName, tableName) {
3168
3168
  return `${subgraphName}\x00${tableName}`;
3169
3169
  }
3170
3170
 
3171
- class SubscriptionMatcher {
3171
+ class WebhookMatcher {
3172
3172
  byKey = new Map;
3173
3173
  byId = new Map;
3174
3174
  setAll(subs) {
@@ -3210,11 +3210,11 @@ class SubscriptionMatcher {
3210
3210
  }
3211
3211
  }
3212
3212
 
3213
- // src/runtime/subscription-state.ts
3214
- var matcher = new SubscriptionMatcher;
3213
+ // src/runtime/webhook-state.ts
3214
+ var matcher = new WebhookMatcher;
3215
3215
  async function refreshMatcher(db) {
3216
3216
  const rows = await sql3`
3217
- SELECT * FROM subscriptions WHERE status = 'active'
3217
+ SELECT * FROM webhooks WHERE status = 'active'
3218
3218
  `.execute(db);
3219
3219
  matcher.setAll(rows.rows);
3220
3220
  return matcher.size();
@@ -3504,7 +3504,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
3504
3504
  const manifest = await ctx.flush();
3505
3505
  flushedWrites = manifest.count > 0;
3506
3506
  if (manifest.count > 0) {
3507
- await emitSubscriptionOutbox(tx, subgraphName, manifest, matcher, block.height);
3507
+ await emitWebhookOutbox(tx, subgraphName, manifest, matcher, block.height);
3508
3508
  }
3509
3509
  flushMs = performance.now() - flushStart;
3510
3510
  }
@@ -3575,5 +3575,5 @@ export {
3575
3575
  BLOCK_RETRY_DELAYS_MS
3576
3576
  };
3577
3577
 
3578
- //# debugId=224EDC1D6107B84664756E2164756E21
3578
+ //# debugId=BB9A5C44EBBF0BD764756E2164756E21
3579
3579
  //# sourceMappingURL=block-processor.js.map