@secondlayer/shared 11.24.1 → 12.0.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.
Files changed (32) hide show
  1. package/dist/src/archive/range-digest.d.ts +8 -19
  2. package/dist/src/archive/semantic-digest-builder.d.ts +8 -19
  3. package/dist/src/coverage/index.d.ts +8 -19
  4. package/dist/src/db/index.d.ts +9 -20
  5. package/dist/src/db/queries/chain-reorgs.d.ts +8 -19
  6. package/dist/src/db/queries/contracts.d.ts +8 -19
  7. package/dist/src/db/queries/instance.d.ts +8 -19
  8. package/dist/src/db/queries/integrity.d.ts +8 -19
  9. package/dist/src/db/queries/subgraph-gaps.d.ts +8 -19
  10. package/dist/src/db/queries/subgraph-operations.d.ts +8 -19
  11. package/dist/src/db/queries/subgraphs.d.ts +8 -19
  12. package/dist/src/db/queries/subgraphs.js +1 -7
  13. package/dist/src/db/queries/subgraphs.js.map +4 -4
  14. package/dist/src/db/queries/sync-scope.d.ts +8 -19
  15. package/dist/src/db/queries/webhooks.d.ts +11 -33
  16. package/dist/src/db/queries/webhooks.js +3 -12
  17. package/dist/src/db/queries/webhooks.js.map +3 -3
  18. package/dist/src/db/schema.d.ts +9 -20
  19. package/dist/src/index.d.ts +15 -81
  20. package/dist/src/index.js +3 -108
  21. package/dist/src/index.js.map +4 -4
  22. package/dist/src/node/local-client.d.ts +8 -19
  23. package/dist/src/schemas/index.d.ts +7 -62
  24. package/dist/src/schemas/index.js +3 -108
  25. package/dist/src/schemas/index.js.map +4 -4
  26. package/dist/src/schemas/subgraphs.d.ts +0 -2
  27. package/dist/src/schemas/subgraphs.js.map +1 -1
  28. package/dist/src/schemas/webhooks.d.ts +10 -65
  29. package/dist/src/schemas/webhooks.js +2 -107
  30. package/dist/src/schemas/webhooks.js.map +3 -3
  31. package/migrations/0159_drop_subgraph_row_webhooks.ts +91 -0
  32. package/package.json +1 -1
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -1280,12 +1280,11 @@ interface SentinelAccountsTable {
1280
1280
  via: "created" | "consent";
1281
1281
  }
1282
1282
  type WebhookStatus = "active" | "paused" | "error";
1283
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
1284
- * `chain` reacts to raw chain events matched directly off the Index/Streams
1285
- * clock (no subgraph). See migration 0088. */
1286
- type WebhookKind = "subgraph" | "chain";
1283
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
1284
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
1285
+ * webhooks; the column stays as the discriminator. */
1286
+ type WebhookKind = "chain";
1287
1287
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
1288
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
1289
1288
  interface WebhooksTable {
1290
1289
  id: Generated<string>;
1291
1290
  account_id: string;
@@ -1293,17 +1292,11 @@ interface WebhooksTable {
1293
1292
  name: string;
1294
1293
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
1295
1294
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1296
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
1297
- subgraph_name: string | null;
1298
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
1299
- table_name: string | null;
1300
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
1301
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
1302
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
1303
- triggers: unknown | null;
1304
- filter: Generated<unknown>;
1295
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
1296
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
1297
+ * schemas/webhooks.ts owns the shape. */
1298
+ triggers: unknown;
1305
1299
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
1306
- runtime: WebhookRuntime | null;
1307
1300
  url: string;
1308
1301
  signing_secret_enc: Buffer;
1309
1302
  auth_config: Generated<unknown>;
@@ -1323,10 +1316,6 @@ interface WebhookOutboxTable {
1323
1316
  id: Generated<string>;
1324
1317
  webhook_id: string;
1325
1318
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1326
- /** Null for chain-webhook rows. */
1327
- subgraph_name: string | null;
1328
- /** Null for chain-webhook rows. */
1329
- table_name: string | null;
1330
1319
  block_height: number | bigint;
1331
1320
  tx_id: string | null;
1332
1321
  row_pk: unknown;
@@ -1021,12 +1021,11 @@ type InsertSubgraphHealthSnapshot = Insertable<SubgraphHealthSnapshotsTable>;
1021
1021
  type SubgraphGap = Selectable<SubgraphGapsTable>;
1022
1022
  type InsertSubgraphGap = Insertable<SubgraphGapsTable>;
1023
1023
  type WebhookStatus = "active" | "paused" | "error";
1024
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
1025
- * `chain` reacts to raw chain events matched directly off the Index/Streams
1026
- * clock (no subgraph). See migration 0088. */
1027
- type WebhookKind = "subgraph" | "chain";
1024
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
1025
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
1026
+ * webhooks; the column stays as the discriminator. */
1027
+ type WebhookKind = "chain";
1028
1028
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
1029
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
1030
1029
  interface WebhooksTable {
1031
1030
  id: Generated<string>;
1032
1031
  account_id: string;
@@ -1034,17 +1033,11 @@ interface WebhooksTable {
1034
1033
  name: string;
1035
1034
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
1036
1035
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1037
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
1038
- subgraph_name: string | null;
1039
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
1040
- table_name: string | null;
1041
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
1042
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
1043
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
1044
- triggers: unknown | null;
1045
- filter: Generated<unknown>;
1036
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
1037
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
1038
+ * schemas/webhooks.ts owns the shape. */
1039
+ triggers: unknown;
1046
1040
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
1047
- runtime: WebhookRuntime | null;
1048
1041
  url: string;
1049
1042
  signing_secret_enc: Buffer;
1050
1043
  auth_config: Generated<unknown>;
@@ -1067,10 +1060,6 @@ interface WebhookOutboxTable {
1067
1060
  id: Generated<string>;
1068
1061
  webhook_id: string;
1069
1062
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1070
- /** Null for chain-webhook rows. */
1071
- subgraph_name: string | null;
1072
- /** Null for chain-webhook rows. */
1073
- table_name: string | null;
1074
1063
  block_height: number | bigint;
1075
1064
  tx_id: string | null;
1076
1065
  row_pk: unknown;
@@ -2260,4 +2249,4 @@ declare function closeDb(): Promise<void>;
2260
2249
  * actual work is done.
2261
2250
  */
2262
2251
  declare function closeDbOrTimeout(timeoutMs?: number, closeFn?: () => Promise<void>): Promise<void>;
2263
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, Contract, ContractsTable, CoverageSegmentsTable, Database, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertArchiveFetch, InsertBlock, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RepairMode, RetryState, RunStatus, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookFormat, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookRuntime, WebhookStatus, WebhooksTable, applicationDatabaseUrl, assertDbSplit, closeDb, closeDbOrTimeout, describeDbUrl, getDb, getDbSplitStatus, getMigrationRole, getRawClient, getRawClientFor, getSourceDb, getTargetDb, jsonb, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
2252
+ export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, Contract, ContractsTable, CoverageSegmentsTable, Database, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertArchiveFetch, InsertBlock, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RepairMode, RetryState, RunStatus, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookFormat, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhooksTable, applicationDatabaseUrl, assertDbSplit, closeDb, closeDbOrTimeout, describeDbUrl, getDb, getDbSplitStatus, getMigrationRole, getRawClient, getRawClientFor, getSourceDb, getTargetDb, jsonb, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -964,12 +964,11 @@ interface SentinelAccountsTable {
964
964
  }
965
965
  type Contract = Selectable<ContractsTable>;
966
966
  type WebhookStatus = "active" | "paused" | "error";
967
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
968
- * `chain` reacts to raw chain events matched directly off the Index/Streams
969
- * clock (no subgraph). See migration 0088. */
970
- type WebhookKind = "subgraph" | "chain";
967
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
968
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
969
+ * webhooks; the column stays as the discriminator. */
970
+ type WebhookKind = "chain";
971
971
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
972
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
973
972
  interface WebhooksTable {
974
973
  id: Generated<string>;
975
974
  account_id: string;
@@ -977,17 +976,11 @@ interface WebhooksTable {
977
976
  name: string;
978
977
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
979
978
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
980
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
981
- subgraph_name: string | null;
982
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
983
- table_name: string | null;
984
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
985
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
986
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
987
- triggers: unknown | null;
988
- filter: Generated<unknown>;
979
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
980
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
981
+ * schemas/webhooks.ts owns the shape. */
982
+ triggers: unknown;
989
983
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
990
- runtime: WebhookRuntime | null;
991
984
  url: string;
992
985
  signing_secret_enc: Buffer;
993
986
  auth_config: Generated<unknown>;
@@ -1007,10 +1000,6 @@ interface WebhookOutboxTable {
1007
1000
  id: Generated<string>;
1008
1001
  webhook_id: string;
1009
1002
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1010
- /** Null for chain-webhook rows. */
1011
- subgraph_name: string | null;
1012
- /** Null for chain-webhook rows. */
1013
- table_name: string | null;
1014
1003
  block_height: number | bigint;
1015
1004
  tx_id: string | null;
1016
1005
  row_pk: unknown;
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -963,12 +963,11 @@ interface SentinelAccountsTable {
963
963
  via: "created" | "consent";
964
964
  }
965
965
  type WebhookStatus = "active" | "paused" | "error";
966
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
967
- * `chain` reacts to raw chain events matched directly off the Index/Streams
968
- * clock (no subgraph). See migration 0088. */
969
- type WebhookKind = "subgraph" | "chain";
966
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
967
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
968
+ * webhooks; the column stays as the discriminator. */
969
+ type WebhookKind = "chain";
970
970
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
971
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
972
971
  interface WebhooksTable {
973
972
  id: Generated<string>;
974
973
  account_id: string;
@@ -976,17 +975,11 @@ interface WebhooksTable {
976
975
  name: string;
977
976
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
978
977
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
979
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
980
- subgraph_name: string | null;
981
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
982
- table_name: string | null;
983
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
984
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
985
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
986
- triggers: unknown | null;
987
- filter: Generated<unknown>;
978
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
979
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
980
+ * schemas/webhooks.ts owns the shape. */
981
+ triggers: unknown;
988
982
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
989
- runtime: WebhookRuntime | null;
990
983
  url: string;
991
984
  signing_secret_enc: Buffer;
992
985
  auth_config: Generated<unknown>;
@@ -1006,10 +999,6 @@ interface WebhookOutboxTable {
1006
999
  id: Generated<string>;
1007
1000
  webhook_id: string;
1008
1001
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1009
- /** Null for chain-webhook rows. */
1010
- subgraph_name: string | null;
1011
- /** Null for chain-webhook rows. */
1012
- table_name: string | null;
1013
1002
  block_height: number | bigint;
1014
1003
  tx_id: string | null;
1015
1004
  row_pk: unknown;
@@ -964,12 +964,11 @@ interface SentinelAccountsTable {
964
964
  }
965
965
  type SubgraphOperation = Selectable<SubgraphOperationsTable>;
966
966
  type WebhookStatus = "active" | "paused" | "error";
967
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
968
- * `chain` reacts to raw chain events matched directly off the Index/Streams
969
- * clock (no subgraph). See migration 0088. */
970
- type WebhookKind = "subgraph" | "chain";
967
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
968
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
969
+ * webhooks; the column stays as the discriminator. */
970
+ type WebhookKind = "chain";
971
971
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
972
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
973
972
  interface WebhooksTable {
974
973
  id: Generated<string>;
975
974
  account_id: string;
@@ -977,17 +976,11 @@ interface WebhooksTable {
977
976
  name: string;
978
977
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
979
978
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
980
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
981
- subgraph_name: string | null;
982
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
983
- table_name: string | null;
984
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
985
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
986
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
987
- triggers: unknown | null;
988
- filter: Generated<unknown>;
979
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
980
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
981
+ * schemas/webhooks.ts owns the shape. */
982
+ triggers: unknown;
989
983
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
990
- runtime: WebhookRuntime | null;
991
984
  url: string;
992
985
  signing_secret_enc: Buffer;
993
986
  auth_config: Generated<unknown>;
@@ -1007,10 +1000,6 @@ interface WebhookOutboxTable {
1007
1000
  id: Generated<string>;
1008
1001
  webhook_id: string;
1009
1002
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1010
- /** Null for chain-webhook rows. */
1011
- subgraph_name: string | null;
1012
- /** Null for chain-webhook rows. */
1013
- table_name: string | null;
1014
1003
  block_height: number | bigint;
1015
1004
  tx_id: string | null;
1016
1005
  row_pk: unknown;
@@ -964,12 +964,11 @@ interface SentinelAccountsTable {
964
964
  }
965
965
  type Subgraph = Selectable<SubgraphsTable>;
966
966
  type WebhookStatus = "active" | "paused" | "error";
967
- /** Polymorphic webhook mode: `subgraph` reacts to processed table rows;
968
- * `chain` reacts to raw chain events matched directly off the Index/Streams
969
- * clock (no subgraph). See migration 0088. */
970
- type WebhookKind = "subgraph" | "chain";
967
+ /** Webhooks react to raw chain events matched directly off the Index/Streams
968
+ * clock. `chain` is the only kind since migration 0159 removed subgraph-row
969
+ * webhooks; the column stays as the discriminator. */
970
+ type WebhookKind = "chain";
971
971
  type WebhookFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
972
- type WebhookRuntime = "inngest" | "trigger" | "cloudflare" | "node";
973
972
  interface WebhooksTable {
974
973
  id: Generated<string>;
975
974
  account_id: string;
@@ -977,17 +976,11 @@ interface WebhooksTable {
977
976
  name: string;
978
977
  status: ColumnType<WebhookStatus, WebhookStatus | undefined, WebhookStatus>;
979
978
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
980
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
981
- subgraph_name: string | null;
982
- /** Null for chain webhooks (CHECK webhooks_kind_shape). */
983
- table_name: string | null;
984
- /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Null for
985
- * subgraph webhooks. Typed loosely here to avoid a shared→subgraphs
986
- * import cycle; the Zod schema in schemas/webhooks.ts owns the shape. */
987
- triggers: unknown | null;
988
- filter: Generated<unknown>;
979
+ /** Chain-trigger filter array (the `SubgraphFilter` shape, JSON). Typed
980
+ * loosely here to avoid a shared→subgraphs import cycle; the Zod schema in
981
+ * schemas/webhooks.ts owns the shape. */
982
+ triggers: unknown;
989
983
  format: ColumnType<WebhookFormat, WebhookFormat | undefined, WebhookFormat>;
990
- runtime: WebhookRuntime | null;
991
984
  url: string;
992
985
  signing_secret_enc: Buffer;
993
986
  auth_config: Generated<unknown>;
@@ -1007,10 +1000,6 @@ interface WebhookOutboxTable {
1007
1000
  id: Generated<string>;
1008
1001
  webhook_id: string;
1009
1002
  kind: ColumnType<WebhookKind, WebhookKind | undefined, WebhookKind>;
1010
- /** Null for chain-webhook rows. */
1011
- subgraph_name: string | null;
1012
- /** Null for chain-webhook rows. */
1013
- table_name: string | null;
1014
1003
  block_height: number | bigint;
1015
1004
  tx_id: string | null;
1016
1005
  row_pk: unknown;
@@ -185,12 +185,6 @@ async function deleteSubgraph(db, name, accountId) {
185
185
  if (!subgraph)
186
186
  return null;
187
187
  const schemaName = subgraph.schema_name ?? pgSchemaName(name);
188
- await db.updateTable("webhooks").set({
189
- status: "paused",
190
- last_error: `Subgraph "${name}" deleted; webhook auto-paused.`,
191
- updated_at: new Date
192
- }).where("subgraph_name", "=", name).execute();
193
- await db.deleteFrom("webhook_outbox").where("status", "=", "pending").where("webhook_id", "in", (qb) => qb.selectFrom("webhooks").select("id").where("subgraph_name", "=", name)).execute();
194
188
  await sql2`DROP SCHEMA IF EXISTS ${sql2.raw(`"${schemaName}"`)} CASCADE`.execute(db);
195
189
  await db.deleteFrom("subgraphs").where("id", "=", subgraph.id).execute();
196
190
  return subgraph;
@@ -231,5 +225,5 @@ export {
231
225
  updateSubgraphStatus
232
226
  };
233
227
 
234
- //# debugId=3407FD67D654BD8464756E2164756E21
228
+ //# debugId=4E4F882681C76C4F64756E2164756E21
235
229
  //# sourceMappingURL=subgraphs.js.map