@secondlayer/shared 11.6.1 → 11.7.1

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 (47) hide show
  1. package/dist/src/archive/range-digest.d.ts +46 -27
  2. package/dist/src/archive/semantic-digest-builder.d.ts +46 -27
  3. package/dist/src/coverage/index.d.ts +46 -27
  4. package/dist/src/db/index.d.ts +57 -39
  5. package/dist/src/db/index.js +5 -4
  6. package/dist/src/db/index.js.map +3 -3
  7. package/dist/src/db/queries/chain-reorgs.d.ts +46 -27
  8. package/dist/src/db/queries/chain-reorgs.js +5 -4
  9. package/dist/src/db/queries/chain-reorgs.js.map +3 -3
  10. package/dist/src/db/queries/contracts.d.ts +46 -27
  11. package/dist/src/db/queries/instance.d.ts +46 -27
  12. package/dist/src/db/queries/integrity.d.ts +47 -28
  13. package/dist/src/db/queries/integrity.js +4 -3
  14. package/dist/src/db/queries/integrity.js.map +3 -3
  15. package/dist/src/db/queries/subgraph-gaps.d.ts +46 -27
  16. package/dist/src/db/queries/subgraph-operations.d.ts +46 -27
  17. package/dist/src/db/queries/subgraphs.d.ts +47 -33
  18. package/dist/src/db/queries/subgraphs.js +1 -10
  19. package/dist/src/db/queries/subgraphs.js.map +3 -3
  20. package/dist/src/db/queries/sync-scope.d.ts +46 -27
  21. package/dist/src/db/queries/webhooks.d.ts +46 -27
  22. package/dist/src/db/schema.d.ts +53 -36
  23. package/dist/src/index-http.d.ts +23 -0
  24. package/dist/src/index-http.js +9 -2
  25. package/dist/src/index-http.js.map +3 -3
  26. package/dist/src/index.d.ts +86 -42
  27. package/dist/src/index.js +58 -6
  28. package/dist/src/index.js.map +5 -5
  29. package/dist/src/node/local-client.d.ts +67 -28
  30. package/dist/src/node/local-client.js +41 -2
  31. package/dist/src/node/local-client.js.map +5 -4
  32. package/dist/src/schemas/index.d.ts +23 -1
  33. package/dist/src/schemas/index.js +38 -1
  34. package/dist/src/schemas/index.js.map +3 -3
  35. package/dist/src/schemas/webhooks.d.ts +23 -1
  36. package/dist/src/schemas/webhooks.js +38 -1
  37. package/dist/src/schemas/webhooks.js.map +3 -3
  38. package/dist/src/streams-rows/index.d.ts +43 -1
  39. package/dist/src/streams-rows/index.js +14 -3
  40. package/dist/src/streams-rows/index.js.map +3 -3
  41. package/dist/src/types.d.ts +12 -1
  42. package/migrations/0131_vm_events.ts +81 -0
  43. package/migrations/0132_vm_events_type_ordinal_idx.ts +21 -0
  44. package/migrations/0133_vm_events_fk_cascade.ts +47 -0
  45. package/migrations/0134_waitlists.ts +64 -0
  46. package/migrations/0135_drop_hosted_play_and_meters.ts +58 -0
  47. package/package.json +2 -2
@@ -82,6 +82,27 @@ interface EventsArchiveTable {
82
82
  orphaned_block_hash: string | null;
83
83
  archived_at: Generated<Date>;
84
84
  }
85
+ interface VmEventsTable {
86
+ id: Generated<string>;
87
+ tx_id: string;
88
+ block_height: number;
89
+ ordinal: number;
90
+ type: string;
91
+ data: unknown;
92
+ created_at: Generated<Date>;
93
+ }
94
+ interface VmEventsArchiveTable {
95
+ archive_id: Generated<string>;
96
+ id: string;
97
+ tx_id: string;
98
+ block_height: number;
99
+ ordinal: number;
100
+ type: string;
101
+ data: unknown;
102
+ created_at: Date;
103
+ orphaned_block_hash: string | null;
104
+ archived_at: Generated<Date>;
105
+ }
85
106
  interface DeadLetterEventsTable {
86
107
  id: Generated<string>;
87
108
  block_height: number;
@@ -262,21 +283,6 @@ interface MagicLinksTable {
262
283
  failed_attempts: Generated<number>;
263
284
  created_at: Generated<Date>;
264
285
  }
265
- /** One-shot hashed tokens that attach a play ghost to an email at claim. */
266
- interface ClaimTokensTable {
267
- id: Generated<string>;
268
- account_id: string;
269
- token_hash: string;
270
- created_at: Generated<Date>;
271
- expires_at: Date;
272
- used_at: Date | null;
273
- }
274
- /** 3 play provisions per IP per UTC day. PK (ip_hash, day); `count` caps at 3. */
275
- interface PlayProvisionsTable {
276
- ip_hash: string;
277
- day: string;
278
- count: Generated<number>;
279
- }
280
286
  interface SubgraphProcessingStatsTable {
281
287
  id: Generated<string>;
282
288
  subgraph_name: string;
@@ -724,8 +730,10 @@ interface Database {
724
730
  blocks: BlocksTable;
725
731
  transactions: TransactionsTable;
726
732
  events: EventsTable;
733
+ vm_events: VmEventsTable;
727
734
  transactions_archive: TransactionsArchiveTable;
728
735
  events_archive: EventsArchiveTable;
736
+ vm_events_archive: VmEventsArchiveTable;
729
737
  dead_letter_events: DeadLetterEventsTable;
730
738
  mempool_transactions: MempoolTransactionsTable;
731
739
  index_progress: IndexProgressTable;
@@ -736,8 +744,6 @@ interface Database {
736
744
  accounts: AccountsTable;
737
745
  sessions: SessionsTable;
738
746
  magic_links: MagicLinksTable;
739
- claim_tokens: ClaimTokensTable;
740
- play_provisions: PlayProvisionsTable;
741
747
  subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
742
748
  subgraph_processing_stats: SubgraphProcessingStatsTable;
743
749
  subgraph_gaps: SubgraphGapsTable;
@@ -746,7 +752,6 @@ interface Database {
746
752
  processed_stripe_events: ProcessedStripeEventsTable;
747
753
  account_spend_caps: AccountSpendCapsTable;
748
754
  account_credits: AccountCreditsTable;
749
- hosted_meter_days: HostedMeterDaysTable;
750
755
  webhooks: WebhooksTable;
751
756
  webhook_outbox: WebhookOutboxTable;
752
757
  webhook_deliveries: WebhookDeliveriesTable;
@@ -777,6 +782,8 @@ interface Database {
777
782
  coverage_segments: CoverageSegmentsTable;
778
783
  stage_failures: StageFailuresTable;
779
784
  archive_fetches: ArchiveFetchesTable;
785
+ waitlists: WaitlistsTable;
786
+ waitlist_signups: WaitlistSignupsTable;
780
787
  }
781
788
  interface ServiceHeartbeatsTable {
782
789
  name: string;
@@ -811,18 +818,6 @@ interface AccountCreditsTable {
811
818
  type AccountCredits = Selectable<AccountCreditsTable>;
812
819
  type InsertAccountCredits = Insertable<AccountCreditsTable>;
813
820
  type UpdateAccountCredits = Updateable<AccountCreditsTable>;
814
- /** Daily idempotency ledger for hosted subgraph running + storage meters. */
815
- interface HostedMeterDaysTable {
816
- day: string;
817
- account_id: string;
818
- subgraph_name: string;
819
- kind: string;
820
- usd_micros: string | number | bigint;
821
- billed_at: Generated<Date>;
822
- }
823
- type HostedMeterDay = Selectable<HostedMeterDaysTable>;
824
- type InsertHostedMeterDay = Insertable<HostedMeterDaysTable>;
825
- type UpdateHostedMeterDay = Updateable<HostedMeterDaysTable>;
826
821
  /**
827
822
  * Archive fetch charge log (design-f089 gate). Append-only: one row per
828
823
  * priced attempt to fetch a partition object. `usd_micros` is 0 for
@@ -851,6 +846,9 @@ type InsertMempoolTransaction = Insertable<MempoolTransactionsTable>;
851
846
  type Event = Selectable<EventsTable>;
852
847
  type InsertEvent = Insertable<EventsTable>;
853
848
  type UpdateEvent = Updateable<EventsTable>;
849
+ type VmEvent = Selectable<VmEventsTable>;
850
+ type InsertVmEvent = Insertable<VmEventsTable>;
851
+ type UpdateVmEvent = Updateable<VmEventsTable>;
854
852
  type IndexProgress = Selectable<IndexProgressTable>;
855
853
  type InsertIndexProgress = Insertable<IndexProgressTable>;
856
854
  type UpdateIndexProgress = Updateable<IndexProgressTable>;
@@ -870,11 +868,6 @@ type Account = Selectable<AccountsTable>;
870
868
  type InsertAccount = Insertable<AccountsTable>;
871
869
  type MagicLink = Selectable<MagicLinksTable>;
872
870
  type InsertMagicLink = Insertable<MagicLinksTable>;
873
- type ClaimToken = Selectable<ClaimTokensTable>;
874
- type InsertClaimToken = Insertable<ClaimTokensTable>;
875
- type UpdateClaimToken = Updateable<ClaimTokensTable>;
876
- type PlayProvision = Selectable<PlayProvisionsTable>;
877
- type InsertPlayProvision = Insertable<PlayProvisionsTable>;
878
871
  type Session = Selectable<SessionsTable>;
879
872
  type InsertSession = Insertable<SessionsTable>;
880
873
  type SubgraphHealthSnapshot = Selectable<SubgraphHealthSnapshotsTable>;
@@ -978,6 +971,30 @@ interface TriggerEvaluatorStateTable {
978
971
  updated_at: Generated<Date>;
979
972
  }
980
973
  type TriggerEvaluatorState = Selectable<TriggerEvaluatorStateTable>;
974
+ /** A public waitlist page: what it is for and whether it takes signups. */
975
+ interface WaitlistsTable {
976
+ slug: string;
977
+ title: string;
978
+ description: string;
979
+ url: string;
980
+ opened_at: Generated<Date>;
981
+ /** Null while the list is open. */
982
+ closed_at: Date | null;
983
+ }
984
+ /**
985
+ * One signup per (list, contact, token). `answers` holds the list's own
986
+ * questions, validated per list by the API before insert.
987
+ */
988
+ interface WaitlistSignupsTable {
989
+ id: Generated<string>;
990
+ list: string;
991
+ contact: string;
992
+ answers: Record<string, unknown>;
993
+ created_at: Generated<Date>;
994
+ }
995
+ type Waitlist = Selectable<WaitlistsTable>;
996
+ type WaitlistSignup = Selectable<WaitlistSignupsTable>;
997
+ type InsertWaitlistSignup = Insertable<WaitlistSignupsTable>;
981
998
  interface EnvSchemaOutput {
982
999
  DATABASE_URL?: string;
983
1000
  /**
@@ -1922,8 +1939,10 @@ declare const TABLE_TO_DB: {
1922
1939
  blocks: string
1923
1940
  transactions: string
1924
1941
  events: string
1942
+ vm_events: string
1925
1943
  transactions_archive: string
1926
1944
  events_archive: string
1945
+ vm_events_archive: string
1927
1946
  dead_letter_events: string
1928
1947
  mempool_transactions: string
1929
1948
  index_progress: string
@@ -1957,8 +1976,6 @@ declare const TABLE_TO_DB: {
1957
1976
  api_keys: string
1958
1977
  sessions: string
1959
1978
  magic_links: string
1960
- claim_tokens: string
1961
- play_provisions: string
1962
1979
  account_spend_caps: string
1963
1980
  processed_stripe_events: string
1964
1981
  webhooks: string
@@ -1972,8 +1989,9 @@ declare const TABLE_TO_DB: {
1972
1989
  subgraph_violations: string
1973
1990
  subgraph_processing_stats: string
1974
1991
  account_credits: string
1975
- hosted_meter_days: string
1976
1992
  archive_fetches: string
1993
+ waitlists: string
1994
+ waitlist_signups: string
1977
1995
  service_heartbeats: string
1978
1996
  };
1979
1997
  /** OSS: one application URL. SOURCE_/TARGET_ are hosted split only. */
@@ -2354,7 +2372,7 @@ declare const WebhookFilterPrimitiveSchema: z3.ZodType<WebhookFilterPrimitive>;
2354
2372
  declare const WebhookFilterOperatorSchema: z3.ZodType<WebhookFilterOperator>;
2355
2373
  declare const WebhookFilterClauseSchema: z3.ZodType<WebhookFilterClause>;
2356
2374
  declare const WebhookFilterSchema: z3.ZodType<WebhookFilter>;
2357
- declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event", "sbtc_deposit", "sbtc_withdrawal_create", "sbtc_withdrawal_accept", "sbtc_withdrawal_reject", "sbtc_withdrawal_swept_confirmed"];
2375
+ declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event", "nested_contract_call", "var_set", "map_set", "map_insert", "map_delete", "sbtc_deposit", "sbtc_withdrawal_create", "sbtc_withdrawal_accept", "sbtc_withdrawal_reject", "sbtc_withdrawal_swept_confirmed"];
2358
2376
  /**
2359
2377
  * Per-type accepted filter fields for chain triggers, DERIVED from
2360
2378
  * {@link ChainTriggerSchema} so the agent-facing reference can never drift behind
@@ -2453,6 +2471,28 @@ type ChainTrigger = {
2453
2471
  type: "print_event"
2454
2472
  contractId?: string
2455
2473
  topic?: string
2474
+ } & TraitScoped) | ({
2475
+ type: "nested_contract_call"
2476
+ contractId?: string
2477
+ functionName?: string
2478
+ caller?: string
2479
+ sender?: string
2480
+ } & TraitScoped) | ({
2481
+ type: "var_set"
2482
+ contractId?: string
2483
+ varName?: string
2484
+ } & TraitScoped) | ({
2485
+ type: "map_set"
2486
+ contractId?: string
2487
+ map?: string
2488
+ } & TraitScoped) | ({
2489
+ type: "map_insert"
2490
+ contractId?: string
2491
+ map?: string
2492
+ } & TraitScoped) | ({
2493
+ type: "map_delete"
2494
+ contractId?: string
2495
+ map?: string
2456
2496
  } & TraitScoped) | {
2457
2497
  type: "sbtc_deposit"
2458
2498
  sender?: string
@@ -2694,9 +2734,13 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
2694
2734
  declare function ed25519KeyId(publicKeyPem: string): string;
2695
2735
  declare function signEd25519(payload: string, privateKey: KeyObject): string;
2696
2736
  declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
2697
- import { DECODED_EVENT_TYPES } from "@secondlayer/stacks/filters";
2737
+ import { DECODED_EVENT_TYPES, VM_NODE_TO_STORED_TYPE } from "@secondlayer/stacks/filters";
2698
2738
  import { DecodedEventType } from "@secondlayer/stacks/filters";
2699
- import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2, DecodedEventType as DecodedEventType2 } from "@secondlayer/stacks/filters";
2739
+ import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE as VM_NODE_TO_STORED_TYPE2, DecodedEventType as DecodedEventType2, VmEventType, VmNodeEventType } from "@secondlayer/stacks/filters";
2740
+ type VmStoredToNode = { [K in keyof typeof VM_NODE_TO_STORED_TYPE as (typeof VM_NODE_TO_STORED_TYPE)[K]] : K };
2741
+ /** Inverse of {@link VM_NODE_TO_STORED_TYPE}. Replay reconstruction emits the
2742
+ * node-shaped `/new_block.vm_events` body, so ingest can re-parse it. */
2743
+ declare const VM_STORED_TO_NODE_TYPE: VmStoredToNode;
2700
2744
  /** Alias kept for the Streams surface (identical to {@link DECODED_EVENT_TYPES}).
2701
2745
  * Explicit type annotation required — isolatedDeclarations emits `unknown` for
2702
2746
  * a bare const-to-const alias. */
@@ -3015,4 +3059,4 @@ interface ChainTestDelivery {
3015
3059
  * "Chain webhook webhook payloads" doc.
3016
3060
  */
3017
3061
  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;
3018
- 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, 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, 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, Pox4FunctionName, 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 };
3062
+ 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, WaitlistsTable, WaitlistSignupsTable, WaitlistSignup, Waitlist, WEBHOOK_STATUSES, WEBHOOK_RUNTIMES, WEBHOOK_FORMATS, WEBHOOK_FILTER_OPERATORS, VmNodeEventType, VmEventsTable, VmEventsArchiveTable, VmEventType, VmEvent, VersionConflictError, ValidationError, VM_STORED_TO_NODE_TYPE, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_EVENT_TYPES, UpdateWebhookRequestSchema, UpdateWebhookRequest, UpdateWebhookOutbox, UpdateWebhook, UpdateVmEvent, UpdateTransaction, UpdateSubgraphOperation, UpdateSubgraph, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateBlock, UpdateArchiveFetch, UpdateApiKey, UpdateAccountSpendCap, UpdateAccountCredits, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantSuspendedError, TABLE_TO_DB, SyncScopesTable, SubgraphsTable, SubgraphViolationsTable, 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, 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, Pox4FunctionName, Pox4CallsTable, PendingForkBlocksTable, PaymentRequiredError, ParsedUpdateWebhookRequest, ParsedReplayWebhookRequest, ParsedCreateWebhookRequest, OutboxStatus, ObserverJournalTable, ObserverJournalStatus, NumericAsText, NotFoundError, NativeClock, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, KeyRotatedError, InstancesTable, InsertWebhookOutbox, InsertWebhookDelivery, InsertWebhook, InsertWaitlistSignup, InsertVmEvent, InsertTransaction, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertBlock, InsertArchiveFetch, InsertApiKey, InsertAccountSpendCap, InsertAccountCredits, InsertAccount, IndexProgressTable, IndexProgress, IndexPrimaryKey, IndexColumnType, IndexColumn, 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, 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
@@ -736,8 +736,10 @@ var TABLE_TO_DB = {
736
736
  blocks: "source",
737
737
  transactions: "source",
738
738
  events: "source",
739
+ vm_events: "source",
739
740
  transactions_archive: "source",
740
741
  events_archive: "source",
742
+ vm_events_archive: "source",
741
743
  dead_letter_events: "source",
742
744
  mempool_transactions: "source",
743
745
  index_progress: "source",
@@ -771,8 +773,6 @@ var TABLE_TO_DB = {
771
773
  api_keys: "target",
772
774
  sessions: "target",
773
775
  magic_links: "target",
774
- claim_tokens: "target",
775
- play_provisions: "target",
776
776
  account_spend_caps: "target",
777
777
  processed_stripe_events: "target",
778
778
  webhooks: "target",
@@ -786,8 +786,9 @@ var TABLE_TO_DB = {
786
786
  subgraph_violations: "target",
787
787
  subgraph_processing_stats: "target",
788
788
  account_credits: "target",
789
- hosted_meter_days: "target",
790
789
  archive_fetches: "target",
790
+ waitlists: "target",
791
+ waitlist_signups: "target",
791
792
  service_heartbeats: "both"
792
793
  };
793
794
 
@@ -1172,6 +1173,11 @@ var CHAIN_TRIGGER_TYPES = [
1172
1173
  "contract_call",
1173
1174
  "contract_deploy",
1174
1175
  "print_event",
1176
+ "nested_contract_call",
1177
+ "var_set",
1178
+ "map_set",
1179
+ "map_insert",
1180
+ "map_delete",
1175
1181
  "sbtc_deposit",
1176
1182
  "sbtc_withdrawal_create",
1177
1183
  "sbtc_withdrawal_accept",
@@ -1266,6 +1272,38 @@ var ChainTriggerSchema = z3.discriminatedUnion("type", [
1266
1272
  topic: triggerPattern.optional(),
1267
1273
  trait: trait.optional()
1268
1274
  }).strict(),
1275
+ z3.object({
1276
+ type: z3.literal("nested_contract_call"),
1277
+ contractId: triggerPattern.optional(),
1278
+ functionName: triggerPattern.optional(),
1279
+ caller: triggerPattern.optional(),
1280
+ sender: triggerPattern.optional(),
1281
+ trait: trait.optional()
1282
+ }).strict(),
1283
+ z3.object({
1284
+ type: z3.literal("var_set"),
1285
+ contractId: triggerPattern.optional(),
1286
+ varName: triggerPattern.optional(),
1287
+ trait: trait.optional()
1288
+ }).strict(),
1289
+ z3.object({
1290
+ type: z3.literal("map_set"),
1291
+ contractId: triggerPattern.optional(),
1292
+ map: triggerPattern.optional(),
1293
+ trait: trait.optional()
1294
+ }).strict(),
1295
+ z3.object({
1296
+ type: z3.literal("map_insert"),
1297
+ contractId: triggerPattern.optional(),
1298
+ map: triggerPattern.optional(),
1299
+ trait: trait.optional()
1300
+ }).strict(),
1301
+ z3.object({
1302
+ type: z3.literal("map_delete"),
1303
+ contractId: triggerPattern.optional(),
1304
+ map: triggerPattern.optional(),
1305
+ trait: trait.optional()
1306
+ }).strict(),
1269
1307
  z3.object({
1270
1308
  type: z3.literal("sbtc_deposit"),
1271
1309
  sender: triggerPattern.optional(),
@@ -1973,10 +2011,21 @@ function verifyEd25519(payload, signatureBase64, publicKey) {
1973
2011
  }
1974
2012
  }
1975
2013
  // src/event-types.ts
1976
- import { DECODED_EVENT_TYPES } from "@secondlayer/stacks/filters";
1977
2014
  import {
1978
- DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2
2015
+ DECODED_EVENT_TYPES
1979
2016
  } from "@secondlayer/stacks/filters";
2017
+ import {
2018
+ DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2,
2019
+ VM_EVENT_TYPES,
2020
+ VM_NODE_TO_STORED_TYPE
2021
+ } from "@secondlayer/stacks/filters";
2022
+ var VM_STORED_TO_NODE_TYPE = {
2023
+ nested_contract_call: "contract_call_event",
2024
+ var_set: "var_set_event",
2025
+ map_set: "map_set_event",
2026
+ map_insert: "map_insert_event",
2027
+ map_delete: "map_delete_event"
2028
+ };
1980
2029
  var STREAMS_EVENT_TYPES = DECODED_EVENT_TYPES;
1981
2030
  // src/db-event-types.ts
1982
2031
  var STREAMS_DB_EVENT_TYPES = [
@@ -2119,6 +2168,9 @@ export {
2119
2168
  WEBHOOK_FILTER_OPERATORS,
2120
2169
  VersionConflictError,
2121
2170
  ValidationError,
2171
+ VM_STORED_TO_NODE_TYPE,
2172
+ VM_NODE_TO_STORED_TYPE,
2173
+ VM_EVENT_TYPES,
2122
2174
  UpdateWebhookRequestSchema,
2123
2175
  TenantSuspendedError,
2124
2176
  TABLE_TO_DB,
@@ -2150,5 +2202,5 @@ export {
2150
2202
  AuthenticationError
2151
2203
  };
2152
2204
 
2153
- //# debugId=8F2ED175D8933C9164756E2164756E21
2205
+ //# debugId=A60A47C6792357BF64756E2164756E21
2154
2206
  //# sourceMappingURL=index.js.map