@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.
- package/README.md +9 -9
- package/dist/src/index.js +11 -11
- package/dist/src/index.js.map +9 -9
- package/dist/src/runtime/block-processor.js +11 -11
- package/dist/src/runtime/block-processor.js.map +9 -9
- package/dist/src/runtime/catchup.js +11 -11
- package/dist/src/runtime/catchup.js.map +9 -9
- package/dist/src/runtime/context.d.ts +1 -1
- package/dist/src/runtime/context.js.map +1 -1
- package/dist/src/runtime/emitter.d.ts +10 -10
- package/dist/src/runtime/emitter.js +68 -44
- package/dist/src/runtime/emitter.js.map +14 -13
- package/dist/src/runtime/processor.js +64 -36
- package/dist/src/runtime/processor.js.map +13 -12
- package/dist/src/runtime/reindex.js +11 -11
- package/dist/src/runtime/reindex.js.map +9 -9
- package/dist/src/runtime/reorg.d.ts +2 -2
- package/dist/src/runtime/reorg.js +17 -17
- package/dist/src/runtime/reorg.js.map +10 -10
- package/dist/src/runtime/replay.d.ts +6 -6
- package/dist/src/runtime/replay.js +26 -26
- package/dist/src/runtime/replay.js.map +4 -4
- package/dist/src/runtime/runner.d.ts +1 -1
- package/dist/src/service.js +79 -36
- package/dist/src/service.js.map +14 -13
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/triggers/index.d.ts +2 -2
- package/dist/src/triggers/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -2701,7 +2701,7 @@ function stableStringify(obj) {
|
|
|
2701
2701
|
return acc;
|
|
2702
2702
|
}, {}));
|
|
2703
2703
|
}
|
|
2704
|
-
async function
|
|
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
|
-
|
|
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("
|
|
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/
|
|
3051
|
-
import {
|
|
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
|
|
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/
|
|
3214
|
-
var matcher = new
|
|
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
|
|
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
|
|
3507
|
+
await emitWebhookOutbox(tx, subgraphName, manifest, matcher, block.height);
|
|
3508
3508
|
}
|
|
3509
3509
|
flushMs = performance.now() - flushStart;
|
|
3510
3510
|
}
|
|
@@ -3993,5 +3993,5 @@ export {
|
|
|
3993
3993
|
bumpReorgEpoch
|
|
3994
3994
|
};
|
|
3995
3995
|
|
|
3996
|
-
//# debugId=
|
|
3996
|
+
//# debugId=C09B9607BACD80D164756E2164756E21
|
|
3997
3997
|
//# sourceMappingURL=catchup.js.map
|