@secondlayer/subgraphs 3.25.0 → 3.26.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/dist/src/index.d.ts +31 -18
- package/dist/src/index.js +8 -4
- package/dist/src/index.js.map +4 -4
- package/dist/src/runtime/block-processor.js +5 -1
- package/dist/src/runtime/block-processor.js.map +3 -3
- package/dist/src/runtime/catchup.js +5 -1
- package/dist/src/runtime/catchup.js.map +3 -3
- package/dist/src/runtime/processor.js +9 -6
- package/dist/src/runtime/processor.js.map +5 -5
- package/dist/src/runtime/reindex.d.ts +59 -3
- package/dist/src/runtime/reindex.js +9 -4
- package/dist/src/runtime/reindex.js.map +4 -4
- package/dist/src/runtime/reorg.js +5 -1
- package/dist/src/runtime/reorg.js.map +3 -3
- package/dist/src/service.js +9 -6
- package/dist/src/service.js.map +5 -5
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -459,9 +459,28 @@ declare function filterFieldsByType(): Array<{
|
|
|
459
459
|
type: string
|
|
460
460
|
fields: string[]
|
|
461
461
|
}>;
|
|
462
|
+
/** A (decoded event type, optional contract scope) pair the sparse probe
|
|
463
|
+
* checks. Contract scoping is what makes token-subgraph reindexes leap over
|
|
464
|
+
* everything that isn't their token. */
|
|
465
|
+
type SparseProbeTarget = {
|
|
466
|
+
eventType: string
|
|
467
|
+
contractId?: string
|
|
468
|
+
};
|
|
469
|
+
/** Sparse scanning is sound only when EVERY source is an event-type filter —
|
|
470
|
+
* a contract_call/contract_deploy source matches transactions, which the
|
|
471
|
+
* event probe can't see. */
|
|
472
|
+
declare function canSparseScan(subgraph: SubgraphDefinition): boolean;
|
|
473
|
+
/** Probe targets for a subgraph's filters: decoded type + contract scope when\\n* the filter pins one (assetIdentifier "SP….contract::asset" or contractId). */
|
|
474
|
+
declare function sparseProbeTargets(subgraph: SubgraphDefinition): SparseProbeTarget[];
|
|
462
475
|
interface ReindexOptions {
|
|
463
|
-
|
|
464
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Policy floor on the walk's first block — NOT a caller-supplied range.
|
|
478
|
+
* Free-tier accounts may not reindex below their registered `start_block`
|
|
479
|
+
* (see `resolveGenesisPolicy` on the API side); this raises the walk start
|
|
480
|
+
* and can never lower it. There is deliberately no `toBlock` counterpart:
|
|
481
|
+
* a reindex always runs to chain tip. See {@link resolveBlockRange}.
|
|
482
|
+
*/
|
|
483
|
+
startBlockFloor?: number;
|
|
465
484
|
schemaName?: string;
|
|
466
485
|
/** Op row to receive processed_events on each progress flush. */
|
|
467
486
|
operationId?: string;
|
|
@@ -470,6 +489,13 @@ interface ReindexOptions {
|
|
|
470
489
|
/**
|
|
471
490
|
* Reindex a subgraph by dropping its tables, recreating them, and reprocessing
|
|
472
491
|
* all historical blocks through the handler pipeline.
|
|
492
|
+
*
|
|
493
|
+
* Always whole-subgraph: `[start_block, chain tip]`. There is no ranged
|
|
494
|
+
* reindex — the drop cannot be scoped to a range without re-running delta
|
|
495
|
+
* handlers (`ctx.increment` / `ctx.update` / `ctx.patchOrInsert`) over rows
|
|
496
|
+
* that were never removed, which is the exact double-count hazard `backfill`
|
|
497
|
+
* already refuses. Use `backfillSubgraph` for ranged, additive work.
|
|
498
|
+
*
|
|
473
499
|
* Supports cancellation via AbortSignal — on shutdown abort, status stays
|
|
474
500
|
* "reindexing" for auto-resume; on user cancel, status resets to "active".
|
|
475
501
|
*/
|
|
@@ -1076,10 +1102,10 @@ declare function generateIndexSchema(target: IndexCodegenTarget, opts?: IndexCod
|
|
|
1076
1102
|
/** Index tables available to codegen, for help text and validation. */
|
|
1077
1103
|
declare const INDEX_CODEGEN_TABLES: readonly string[];
|
|
1078
1104
|
import { pgSchemaName } from "@secondlayer/shared/db/queries/subgraphs";
|
|
1079
|
-
import { Database as
|
|
1105
|
+
import { Database as Database3 } from "@secondlayer/shared/db";
|
|
1080
1106
|
import { ByoBreakingChangeDetails } from "@secondlayer/shared/errors";
|
|
1081
|
-
import { Kysely as
|
|
1082
|
-
type AnyDb =
|
|
1107
|
+
import { Kysely as Kysely3 } from "kysely";
|
|
1108
|
+
type AnyDb = Kysely3<Database3>;
|
|
1083
1109
|
interface TableDiff {
|
|
1084
1110
|
/** Tables added to the schema */
|
|
1085
1111
|
addedTables: string[];
|
|
@@ -1200,17 +1226,4 @@ declare function deploySchema(db: AnyDb, def: SubgraphDefinition, handlerPath: s
|
|
|
1200
1226
|
/** Non-fatal caveats the caller should surface (e.g. handler grafts at tip). */
|
|
1201
1227
|
warnings?: string[]
|
|
1202
1228
|
}>;
|
|
1203
|
-
/** A (decoded event type, optional contract scope) pair the sparse probe
|
|
1204
|
-
* checks. Contract scoping is what makes token-subgraph reindexes leap over
|
|
1205
|
-
* everything that isn't their token. */
|
|
1206
|
-
type SparseProbeTarget = {
|
|
1207
|
-
eventType: string
|
|
1208
|
-
contractId?: string
|
|
1209
|
-
};
|
|
1210
|
-
/** Sparse scanning is sound only when EVERY source is an event-type filter —
|
|
1211
|
-
* a contract_call/contract_deploy source matches transactions, which the
|
|
1212
|
-
* event probe can't see. */
|
|
1213
|
-
declare function canSparseScan(subgraph: SubgraphDefinition): boolean;
|
|
1214
|
-
/** Probe targets for a subgraph's filters: decoded type + contract scope when\\n* the filter pins one (assetIdentifier "SP….contract::asset" or contractId). */
|
|
1215
|
-
declare function sparseProbeTargets(subgraph: SubgraphDefinition): SparseProbeTarget[];
|
|
1216
1229
|
export { validateSubgraphDefinition, validatePrintPayload, sparseProbeTargets, resumeReindex, renderDeployPlan, reindexSubgraph, readContractAt, pgSchemaName, inferPrintTopics, hasBreakingChanges, generateSubgraphSQL, generatePrismaSchema, generateKyselySchema, generateIndexSchema, generateDrizzleSchema, filterFieldsByType, diffSchema, deploySchema, defineSubgraph, defineSchema, canSparseScan, camelizeDataKey, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubscribeOptions, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, SparseProbeTarget, RowValue, ReindexOptions, PrismaGenOptions, PrintValidationResult, PrintSample, PrintFieldToTS, PrintField, PrintEventPayload, PrintEventFor, PrintEventFilter, PrintDataOf, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, KyselyGenOptions, InferredTopicSchema, InferredPrintField, InferTableRow, InferSubgraphClient, InferContext, InferColumnType, IndexCodegenTarget, IndexCodegenOptions, INDEX_CODEGEN_TABLES, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, FactoryScope, EventForFilter, ErasedChainReadClient, DrizzleGenOptions, DeployPlan, DeployDiff, ContractDeployPayload, ContractDeployFilter, ContractCallPayload, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, ChainReadOptions, ChainReadMethods, ChainReadError, ChainReadClient, ChainReadCacheMode, ByoMigrationPlan, ByoBreakingChangeError, AnyEvent, AggregateSpec, AggregateResult };
|
package/dist/src/index.js
CHANGED
|
@@ -2813,6 +2813,10 @@ async function resolveRoute(subgraphName, targetDb) {
|
|
|
2813
2813
|
version: row?.version ?? ""
|
|
2814
2814
|
};
|
|
2815
2815
|
routeCache.set(subgraphName, route);
|
|
2816
|
+
logger7.info("subgraph handler dispatch path resolved", {
|
|
2817
|
+
subgraph: subgraphName,
|
|
2818
|
+
path: sandboxEnabled({ sandbox_workers: route.sandboxWorkers }) ? "sandbox" : "in-process"
|
|
2819
|
+
});
|
|
2816
2820
|
return route;
|
|
2817
2821
|
}
|
|
2818
2822
|
function invalidateSubgraphRoute(subgraphName) {
|
|
@@ -3564,9 +3568,9 @@ async function processBlockRange(def, opts) {
|
|
|
3564
3568
|
return { blocksProcessed, totalEventsProcessed, totalErrors, aborted };
|
|
3565
3569
|
}
|
|
3566
3570
|
async function resolveBlockRange(source, def, opts) {
|
|
3567
|
-
const
|
|
3568
|
-
const
|
|
3569
|
-
return { fromBlock, toBlock };
|
|
3571
|
+
const definitionStart = def.startBlock ?? 1;
|
|
3572
|
+
const fromBlock = opts?.startBlockFloor != null ? Math.max(definitionStart, opts.startBlockFloor) : definitionStart;
|
|
3573
|
+
return { fromBlock, toBlock: await source.getTip() };
|
|
3570
3574
|
}
|
|
3571
3575
|
async function clearReindexMetadata(db, subgraphName) {
|
|
3572
3576
|
await db.updateTable("subgraphs").set({ reindex_from_block: null, reindex_to_block: null }).where("name", "=", subgraphName).execute();
|
|
@@ -5082,5 +5086,5 @@ export {
|
|
|
5082
5086
|
ByoBreakingChangeError
|
|
5083
5087
|
};
|
|
5084
5088
|
|
|
5085
|
-
//# debugId=
|
|
5089
|
+
//# debugId=06A0A7FF47E0C5EE64756E2164756E21
|
|
5086
5090
|
//# sourceMappingURL=index.js.map
|