@secondlayer/subgraphs 3.24.2 → 3.24.3
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/src/index.js +12 -1
- package/dist/src/index.js.map +3 -3
- package/dist/src/runtime/block-processor.d.ts +12 -1
- package/dist/src/runtime/block-processor.js +13 -1
- package/dist/src/runtime/block-processor.js.map +3 -3
- package/dist/src/runtime/catchup.js +12 -1
- package/dist/src/runtime/catchup.js.map +3 -3
- package/dist/src/runtime/processor.js +12 -1
- package/dist/src/runtime/processor.js.map +3 -3
- package/dist/src/runtime/reindex.js +12 -1
- package/dist/src/runtime/reindex.js.map +3 -3
- package/dist/src/runtime/reorg.js +12 -1
- package/dist/src/runtime/reorg.js.map +3 -3
- package/dist/src/service.js +12 -1
- package/dist/src/service.js.map +3 -3
- package/package.json +2 -2
package/dist/src/service.js
CHANGED
|
@@ -1627,6 +1627,7 @@ function matchSources(sources, transactions, events, traitContracts = new Map, f
|
|
|
1627
1627
|
}
|
|
1628
1628
|
|
|
1629
1629
|
// src/runtime/block-processor.ts
|
|
1630
|
+
import { secretsKeyAvailable } from "@secondlayer/shared/crypto/secrets";
|
|
1630
1631
|
import { getTargetDb } from "@secondlayer/shared/db";
|
|
1631
1632
|
import { resolveTraitContractIds } from "@secondlayer/shared/db/queries/contracts";
|
|
1632
1633
|
import { advanceOperationCursor } from "@secondlayer/shared/db/queries/subgraph-operations";
|
|
@@ -2564,12 +2565,22 @@ async function refreshMatcher(db) {
|
|
|
2564
2565
|
|
|
2565
2566
|
// src/runtime/block-processor.ts
|
|
2566
2567
|
var routeCache = new Map;
|
|
2568
|
+
|
|
2569
|
+
class ByoKeyUnavailableError extends Error {
|
|
2570
|
+
constructor(subgraphName) {
|
|
2571
|
+
super(`subgraph ${subgraphName} is BYO (database_url_enc set) but this process has no SECONDLAYER_SECRETS_KEY — the subgraph processor deliberately does not hold it (f072). Route BYO subgraphs to a process that does, or unset BYO.`);
|
|
2572
|
+
this.name = "ByoKeyUnavailableError";
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2567
2575
|
async function resolveRoute(subgraphName, targetDb) {
|
|
2568
2576
|
const cached = routeCache.get(subgraphName);
|
|
2569
2577
|
if (cached)
|
|
2570
2578
|
return cached;
|
|
2571
2579
|
const row = await targetDb.selectFrom("subgraphs").selectAll().where("name", "=", subgraphName).executeTakeFirst();
|
|
2572
2580
|
const byo = row ? isByoSubgraph(row) : false;
|
|
2581
|
+
if (row && byo && !secretsKeyAvailable()) {
|
|
2582
|
+
throw new ByoKeyUnavailableError(subgraphName);
|
|
2583
|
+
}
|
|
2573
2584
|
const route = {
|
|
2574
2585
|
schemaName: row?.schema_name ?? pgSchemaName(subgraphName),
|
|
2575
2586
|
dataDb: row && byo ? resolveSubgraphDb(row) : targetDb,
|
|
@@ -4419,5 +4430,5 @@ var shutdown = async () => {
|
|
|
4419
4430
|
process.on("SIGINT", shutdown);
|
|
4420
4431
|
process.on("SIGTERM", shutdown);
|
|
4421
4432
|
|
|
4422
|
-
//# debugId=
|
|
4433
|
+
//# debugId=93DDC9090FFF48C664756E2164756E21
|
|
4423
4434
|
//# sourceMappingURL=service.js.map
|