@secondlayer/shared 11.5.0 → 11.6.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.
@@ -136,7 +136,6 @@ interface SubgraphsTable {
136
136
  expires_at: Date | null;
137
137
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
138
138
  sparse_probe_targets: unknown | null;
139
- database_url_enc: ColumnType<Buffer | null, Buffer | null | undefined, Buffer | null>;
140
139
  sandbox_workers: Generated<boolean>;
141
140
  created_at: Generated<Date>;
142
141
  updated_at: Generated<Date>;
@@ -232,7 +231,7 @@ interface AccountsTable {
232
231
  email: string | null;
233
232
  /** True for anonymous self-serve accounts until claimed via magic link. */
234
233
  ghost: Generated<boolean>;
235
- /** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
234
+ /** Stacks principal owning a wallet-ghost account. */
236
235
  wallet_principal: string | null;
237
236
  display_name: string | null;
238
237
  bio: string | null;
@@ -811,8 +810,6 @@ interface Database {
811
810
  bns_names: BnsNamesTable;
812
811
  bns_namespaces: BnsNamespacesTable;
813
812
  service_heartbeats: ServiceHeartbeatsTable;
814
- x402_payments: X402PaymentsTable;
815
- x402_balances: X402BalancesTable;
816
813
  chain_read_cache: ChainReadCacheTable;
817
814
  pending_fork_blocks: PendingForkBlocksTable;
818
815
  observer_journal: ObserverJournalTable;
@@ -824,46 +821,10 @@ interface Database {
824
821
  stage_failures: StageFailuresTable;
825
822
  archive_fetches: ArchiveFetchesTable;
826
823
  }
827
- /** Prepaid x402 credit — one running USD-micros balance per payer principal. */
828
- interface X402BalancesTable {
829
- principal: string;
830
- balance_usd_micros: Generated<string | number | bigint>;
831
- /** Month bucket ("YYYY-MM") the spend counter applies to. */
832
- spent_month: string | null;
833
- spent_month_usd_micros: Generated<string | number | bigint>;
834
- updated_at: Generated<Date>;
835
- }
836
824
  interface ServiceHeartbeatsTable {
837
825
  name: string;
838
826
  updated_at: Generated<Date>;
839
827
  }
840
- /** x402 pay-per-request ledger (control plane). One row per settled payment,
841
- * keyed by challenge nonce + settled txid. `state` tracks confirmed-tier
842
- * settlement and post-serve reorg reversal. */
843
- interface X402PaymentsTable {
844
- id: Generated<string>;
845
- nonce: string;
846
- txid: string;
847
- asset: string;
848
- amount: string;
849
- payer: string;
850
- surface: string;
851
- state: Generated<"pending" | "confirmed" | "reverted">;
852
- created_at: Generated<Date>;
853
- updated_at: Generated<Date>;
854
- /** "payment" = per-call settle; "deposit" = prepaid balance top-up. */
855
- kind: Generated<string>;
856
- /** Linked claimed account once the paying wallet is attached (continuity). */
857
- account_id: string | null;
858
- /** USD-micros to credit on confirmation, for deposit rows the reconciler
859
- * settles asynchronously. NULL for per-call settles (credit nothing). */
860
- credit_usd_micros: string | null;
861
- /** Idempotency key: stamped exactly once when this row's credit is applied.
862
- * NULL means never credited (or not a credit-bearing row). Pre-migration
863
- * non-pending deposit rows are backfilled to a non-null sentinel so the
864
- * reconciler's heal path can never double-credit them. */
865
- credited_at: Generated<Date> | null;
866
- }
867
828
  interface AccountSpendCapsTable {
868
829
  account_id: string;
869
830
  monthly_cap_cents: number | null;
@@ -877,7 +838,7 @@ interface AccountSpendCapsTable {
877
838
  type AccountSpendCap = Selectable<AccountSpendCapsTable>;
878
839
  type InsertAccountSpendCap = Insertable<AccountSpendCapsTable>;
879
840
  type UpdateAccountSpendCap = Updateable<AccountSpendCapsTable>;
880
- /** Prepaid dev credits — card-funded balance per account (peer to x402_balances). */
841
+ /** Prepaid dev credits — card-funded balance per account. */
881
842
  interface AccountCreditsTable {
882
843
  account_id: string;
883
844
  balance_usd_micros: Generated<string | number | bigint>;
@@ -2057,8 +2018,6 @@ declare const TABLE_TO_DB: {
2057
2018
  subgraph_violations: string
2058
2019
  subgraph_processing_stats: string
2059
2020
  subgraph_table_snapshots: string
2060
- x402_payments: string
2061
- x402_balances: string
2062
2021
  account_credits: string
2063
2022
  hosted_meter_days: string
2064
2023
  archive_fetches: string
@@ -2126,9 +2085,9 @@ declare function getDb(connectionString?: string): Kysely<Database>;
2126
2085
  declare function getRawClient(role?: "source" | "target"): ReturnType<typeof postgres>;
2127
2086
  /**
2128
2087
  * Raw postgres.js client for an arbitrary connection string (cached by URL).
2129
- * Used by the BYO data plane to run DDL / serving queries against a
2130
- * user-owned Postgres. Distinct from {@link getRawClient}, which only knows the
2131
- * source/target roles resolved from env.
2088
+ * Used by the CLI setup-wizard and similar one-off tooling. Distinct from
2089
+ * {@link getRawClient}, which only knows the source/target roles resolved
2090
+ * from env.
2132
2091
  */
2133
2092
  declare function getRawClientFor(url: string): ReturnType<typeof postgres>;
2134
2093
  /** Close all DB connection pools. Call in CLI commands to allow process exit. */
@@ -3068,8 +3027,6 @@ interface ChainTestDelivery {
3068
3027
  test: true
3069
3028
  message: string
3070
3029
  webhook_id: string
3071
- /** @deprecated Use webhook_id. Removed next minor. */
3072
- subscription_id?: string
3073
3030
  sent_at: string
3074
3031
  };
3075
3032
  }
@@ -3105,4 +3062,4 @@ interface ChainTestDelivery {
3105
3062
  * "Chain webhook webhook payloads" doc.
3106
3063
  */
3107
3064
  type ChainWebhookDelivery = ChainApplyDeliveryOf<"stx_transfer", ChainEventEnvelope<"stx_transfer_event", ChainStxTransferData>> | ChainApplyDeliveryOf<"stx_mint", ChainEventEnvelope<"stx_mint_event", ChainStxMintData>> | ChainApplyDeliveryOf<"stx_burn", ChainEventEnvelope<"stx_burn_event", ChainStxBurnData>> | ChainApplyDeliveryOf<"stx_lock", ChainEventEnvelope<"stx_lock_event", ChainStxLockData>> | ChainApplyDeliveryOf<"ft_transfer", ChainEventEnvelope<"ft_transfer_event", ChainFtTransferData>> | ChainApplyDeliveryOf<"ft_mint", ChainEventEnvelope<"ft_mint_event", ChainFtMintData>> | ChainApplyDeliveryOf<"ft_burn", ChainEventEnvelope<"ft_burn_event", ChainFtBurnData>> | ChainApplyDeliveryOf<"nft_transfer", ChainEventEnvelope<"nft_transfer_event", ChainNftTransferData>> | ChainApplyDeliveryOf<"nft_mint", ChainEventEnvelope<"nft_mint_event", ChainNftMintData>> | ChainApplyDeliveryOf<"nft_burn", ChainEventEnvelope<"nft_burn_event", ChainNftBurnData>> | ChainApplyDeliveryOf<"print_event", ChainEventEnvelope<"contract_event", ChainPrintEventData>> | ChainApplyDeliveryOf<"contract_call", ChainTxLevelEvent> | ChainApplyDeliveryOf<"contract_deploy", ChainTxLevelEvent> | ChainApplyDeliveryOf<"sbtc_deposit", SbtcDepositEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_create", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_accept", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_reject", SbtcWithdrawalEvent> | ChainApplyDeliveryOf<"sbtc_withdrawal_swept_confirmed", SbtcWithdrawalSweptConfirmedEvent> | ChainReorgRollbackDelivery | ChainTestDelivery;
3108
- export { validateWebhookFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isSbtcDecoderEnabled, isPox5DecoderEnabled, isPox4DecoderEnabled, isEmptyRangeCursor, isBnsDecoderEnabled, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatWebhookSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, compareStreamsCursor, closeDb, blockEndCursor, assertDbSplit, applicationDatabaseUrl, X402PaymentsTable, X402BalancesTable, WebhooksTable, WebhookSummary, WebhookStatusSchema, WebhookStatus, WebhookSchemaTables, WebhookSchemaTable, WebhookSchemaColumn, WebhookRuntimeSchema, WebhookRuntime, WebhookOutboxTable, WebhookOutbox, WebhookKind, WebhookFormatSchema, WebhookFormat, WebhookFilterSchema, WebhookFilterPrimitiveSchema, WebhookFilterPrimitive, WebhookFilterOperatorSchema, WebhookFilterOperator, WebhookFilterClauseSchema, WebhookFilterClause, WebhookFilter, WebhookDetail, WebhookDelivery, WebhookDeliveriesTable, Webhook, WEBHOOK_STATUSES, WEBHOOK_RUNTIMES, WEBHOOK_FORMATS, WEBHOOK_FILTER_OPERATORS, VersionConflictError, ValidationError, UpdateWebhookRequestSchema, UpdateWebhookRequest, UpdateWebhookOutbox, UpdateWebhook, UpdateTransaction, UpdateSubgraphOperation, UpdateSubgraph, UpdateIndexProgress, UpdateHostedMeterDay, UpdateEvent, UpdateContract, UpdateClaimToken, UpdateBlock, UpdateArchiveFetch, UpdateApiKey, UpdateAccountSpendCap, UpdateAccountCredits, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantSuspendedError, TABLE_TO_DB, SyncScopesTable, SubgraphsTable, SubgraphViolationsTable, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, SubgraphAgentSchema, Subgraph, StreamsEventType, StreamsDbEventType, StreamsCursor, StageRunsTable, StageRegistryTable, StageKind, StageFailuresTable, StageBlockReceiptsTable, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalEvent, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcSettlementsTable, SbtcEventsTable, SbtcEventTopic, SbtcDepositEvent, STREAMS_TO_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_DB_EVENT_TYPES, SOURCE_READ_TYPES, SOURCE_READ_PKS, SOURCE_READ_COLUMNS, RunStatus, RotateSecretResponse, RetryState, ReplayWebhookRequestSchema, ReplayWebhookRequest, ReplayResult, RepairMode, ReindexResponse, RateLimitError, ProcessedStripeEventsTable, Pox5EventsTable, Pox5EventTopic, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, PlayProvisionsTable, PlayProvision, PendingForkBlocksTable, PaymentRequiredError, ParsedUpdateWebhookRequest, ParsedReplayWebhookRequest, ParsedCreateWebhookRequest, OutboxStatus, ObserverJournalTable, ObserverJournalStatus, NumericAsText, NotFoundError, NativeClock, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, KeyRotatedError, InstancesTable, InsertWebhookOutbox, InsertWebhookDelivery, InsertWebhook, InsertTransaction, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertPlayProvision, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertHostedMeterDay, InsertEvent, InsertContract, InsertClaimToken, InsertBlock, InsertArchiveFetch, InsertApiKey, InsertAccountSpendCap, InsertAccountCredits, InsertAccount, IndexProgressTable, IndexProgress, IndexPrimaryKey, IndexColumnType, IndexColumn, HostedMeterDaysTable, HostedMeterDay, ForbiddenError, FailureUnit, FailureClass, EventsTable, EventsArchiveTable, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecoderCheckpointsTable, DecodedEventsTable, DecodedEventType2 as DecodedEventType, DeadRow, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DB_TO_STREAMS_EVENT_TYPE, CreateWebhookResponse, CreateWebhookRequestSchema, CreateWebhookRequest, CoverageSegmentsTable, ContractsTable, Contract, ClaimTokensTable, ClaimToken, ChainWebhookEnvelope, ChainWebhookDelivery, ChainTxLevelEvent, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgsTable, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainReadCacheTable, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CODE_TO_STATUS, CHAIN_TRIGGER_TYPES, CHAIN_TRIGGER_FIELDS, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ArchiveFetchesTable, ArchiveFetch, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountCreditsTable, AccountCredits, Account };
3065
+ export { validateWebhookFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isSbtcDecoderEnabled, isPox5DecoderEnabled, isPox4DecoderEnabled, isEmptyRangeCursor, isBnsDecoderEnabled, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatWebhookSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, compareStreamsCursor, closeDb, blockEndCursor, assertDbSplit, applicationDatabaseUrl, WebhooksTable, WebhookSummary, WebhookStatusSchema, WebhookStatus, WebhookSchemaTables, WebhookSchemaTable, WebhookSchemaColumn, WebhookRuntimeSchema, WebhookRuntime, WebhookOutboxTable, WebhookOutbox, WebhookKind, WebhookFormatSchema, WebhookFormat, WebhookFilterSchema, WebhookFilterPrimitiveSchema, WebhookFilterPrimitive, WebhookFilterOperatorSchema, WebhookFilterOperator, WebhookFilterClauseSchema, WebhookFilterClause, WebhookFilter, WebhookDetail, WebhookDelivery, WebhookDeliveriesTable, Webhook, WEBHOOK_STATUSES, WEBHOOK_RUNTIMES, WEBHOOK_FORMATS, WEBHOOK_FILTER_OPERATORS, VersionConflictError, ValidationError, UpdateWebhookRequestSchema, UpdateWebhookRequest, UpdateWebhookOutbox, UpdateWebhook, UpdateTransaction, UpdateSubgraphOperation, UpdateSubgraph, UpdateIndexProgress, UpdateHostedMeterDay, UpdateEvent, UpdateContract, UpdateClaimToken, UpdateBlock, UpdateArchiveFetch, UpdateApiKey, UpdateAccountSpendCap, UpdateAccountCredits, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantSuspendedError, TABLE_TO_DB, SyncScopesTable, SubgraphsTable, SubgraphViolationsTable, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, SubgraphAgentSchema, Subgraph, StreamsEventType, StreamsDbEventType, StreamsCursor, StageRunsTable, StageRegistryTable, StageKind, StageFailuresTable, StageBlockReceiptsTable, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalEvent, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcSettlementsTable, SbtcEventsTable, SbtcEventTopic, SbtcDepositEvent, STREAMS_TO_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_DB_EVENT_TYPES, SOURCE_READ_TYPES, SOURCE_READ_PKS, SOURCE_READ_COLUMNS, RunStatus, RotateSecretResponse, RetryState, ReplayWebhookRequestSchema, ReplayWebhookRequest, ReplayResult, RepairMode, ReindexResponse, RateLimitError, ProcessedStripeEventsTable, Pox5EventsTable, Pox5EventTopic, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, PlayProvisionsTable, PlayProvision, PendingForkBlocksTable, PaymentRequiredError, ParsedUpdateWebhookRequest, ParsedReplayWebhookRequest, ParsedCreateWebhookRequest, OutboxStatus, ObserverJournalTable, ObserverJournalStatus, NumericAsText, NotFoundError, NativeClock, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, KeyRotatedError, InstancesTable, InsertWebhookOutbox, InsertWebhookDelivery, InsertWebhook, InsertTransaction, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertPlayProvision, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertHostedMeterDay, InsertEvent, InsertContract, InsertClaimToken, InsertBlock, InsertArchiveFetch, InsertApiKey, InsertAccountSpendCap, InsertAccountCredits, InsertAccount, IndexProgressTable, IndexProgress, IndexPrimaryKey, IndexColumnType, IndexColumn, HostedMeterDaysTable, HostedMeterDay, ForbiddenError, FailureUnit, FailureClass, EventsTable, EventsArchiveTable, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecoderCheckpointsTable, DecodedEventsTable, DecodedEventType2 as DecodedEventType, DeadRow, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DB_TO_STREAMS_EVENT_TYPE, CreateWebhookResponse, CreateWebhookRequestSchema, CreateWebhookRequest, CoverageSegmentsTable, ContractsTable, Contract, ClaimTokensTable, ClaimToken, ChainWebhookEnvelope, ChainWebhookDelivery, ChainTxLevelEvent, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgsTable, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainReadCacheTable, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CODE_TO_STATUS, CHAIN_TRIGGER_TYPES, CHAIN_TRIGGER_FIELDS, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ArchiveFetchesTable, ArchiveFetch, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountCreditsTable, AccountCredits, Account };
package/dist/src/index.js CHANGED
@@ -789,8 +789,6 @@ var TABLE_TO_DB = {
789
789
  subgraph_violations: "target",
790
790
  subgraph_processing_stats: "target",
791
791
  subgraph_table_snapshots: "target",
792
- x402_payments: "target",
793
- x402_balances: "target",
794
792
  account_credits: "target",
795
793
  hosted_meter_days: "target",
796
794
  archive_fetches: "target",
@@ -2156,5 +2154,5 @@ export {
2156
2154
  AuthenticationError
2157
2155
  };
2158
2156
 
2159
- //# debugId=D3AB339890A27E2964756E2164756E21
2157
+ //# debugId=B4E2CB25014B384E64756E2164756E21
2160
2158
  //# sourceMappingURL=index.js.map